Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix](jdbc catalog) fix gbase catalog time type mapping and scan && limit pushdown #41587

Merged
merged 1 commit into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ protected Object getColumnValue(int columnIndex, ColumnType type, String[] repla
case CHAR:
case VARCHAR:
case STRING:
String stringVal = resultSet.getString(columnIndex + 1);
String stringVal = (String) resultSet.getObject(columnIndex + 1);
return resultSet.wasNull() ? null : stringVal;
default:
throw new IllegalArgumentException("Unsupported column type: " + type.getType());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,12 @@ protected Type jdbcTypeToDoris(JdbcFieldSchema fieldSchema) {
}
return ScalarType.createDatetimeV2Type(scale);
}
case Types.TIME:
case Types.CHAR:
ScalarType charType = ScalarType.createType(PrimitiveType.CHAR);
charType.setLength(fieldSchema.getColumnSize()
.orElseThrow(() -> new IllegalArgumentException("Length not present")));
return charType;
case Types.TIME:
case Types.VARCHAR:
case Types.LONGVARCHAR:
return ScalarType.createStringType();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,8 @@ private String getJdbcQueryStr() {
|| jdbcType == TOdbcTableType.SAP_HANA
|| jdbcType == TOdbcTableType.TRINO
|| jdbcType == TOdbcTableType.PRESTO
|| jdbcType == TOdbcTableType.OCEANBASE)) {
|| jdbcType == TOdbcTableType.OCEANBASE
|| jdbcType == TOdbcTableType.GBASE)) {
sql.append(" LIMIT ").append(limit);
}

Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ suite("test_gbase_jdbc_catalog", "p0,external,gbase,external_docker,external_doc
// REPEAT('A', 21845), -- text_col (max value 21845 characters)
// '9999-12-31', -- date_col (max value)
// '9999-12-31 23:59:59.999999',-- datetime_col (max value)
// '23:59:59', -- time_col (max value)
// '838:59:59', -- time_col (max value)
// '2038-01-01 00:59:59' -- timestamp_col (max value)
// );

Expand Down Expand Up @@ -134,4 +134,10 @@ suite("test_gbase_jdbc_catalog", "p0,external,gbase,external_docker,external_doc
//order_qt_sample_table_select """ select * from gbase_test order by 1; """
//order_qt_show_tables """ show tables; """

// explain {
// sql("select tinyint_col from gbase_test limit 2;")

// contains "QUERY: SELECT `tinyint_col` FROM `doris_test`.`gbase_test` LIMIT 2"
// }

}
Loading