@Override public SqlNode getCastSpec(RelDataType type) { String castSpec; switch (type.getSqlTypeName()) { case TINYINT: // Postgres has no tinyint (1 byte), so instead cast to smallint (2 bytes) castSpec = "_smallint"; break; case DOUBLE: // Postgres has a double type but it is named differently castSpec = "_double precision"; break; default: return super.getCastSpec(type); } return new SqlDataTypeSpec(new SqlIdentifier(castSpec, SqlParserPos.ZERO), -1, -1, null, null, SqlParserPos.ZERO); }
@Override public SqlNode getCastSpec(RelDataType type) { String castSpec; switch (type.getSqlTypeName()) { case TINYINT: // Postgres has no tinyint (1 byte), so instead cast to smallint (2 bytes) castSpec = "_smallint"; break; case DOUBLE: // Postgres has a double type but it is named differently castSpec = "_double precision"; break; default: return super.getCastSpec(type); } return new SqlDataTypeSpec(new SqlIdentifier(castSpec, SqlParserPos.ZERO), -1, -1, null, null, SqlParserPos.ZERO); }
@Override public SqlNode getCastSpec(RelDataType type) { switch (type.getSqlTypeName()) { case VARCHAR: // MySQL doesn't have a VARCHAR type, only CHAR. return new SqlDataTypeSpec(new SqlIdentifier("CHAR", SqlParserPos.ZERO), type.getPrecision(), -1, null, null, SqlParserPos.ZERO); case INTEGER: return new SqlDataTypeSpec(new SqlIdentifier("_UNSIGNED", SqlParserPos.ZERO), type.getPrecision(), -1, null, null, SqlParserPos.ZERO); } return super.getCastSpec(type); }
@Override public SqlNode getCastSpec(RelDataType type) { switch (type.getSqlTypeName()) { case VARCHAR: // MySQL doesn't have a VARCHAR type, only CHAR. return new SqlDataTypeSpec(new SqlIdentifier("CHAR", SqlParserPos.ZERO), type.getPrecision(), -1, null, null, SqlParserPos.ZERO); case INTEGER: case BIGINT: return new SqlDataTypeSpec(new SqlIdentifier("_SIGNED", SqlParserPos.ZERO), type.getPrecision(), -1, null, null, SqlParserPos.ZERO); } return super.getCastSpec(type); }
return nodeList.get(0); } else { nodeList.add(dialect.getCastSpec(call.getType()));
return nodeList.get(0); } else { nodeList.add(dialect.getCastSpec(call.getType()));