Skip to content

Commit

Permalink
[Enhancement]remove some type check to support more type mapping for …
Browse files Browse the repository at this point in the history
…jdbc (#47618)

Signed-off-by: zombee0 <ewang2027@gmail.com>
  • Loading branch information
zombee0 authored Jun 28, 2024
1 parent 714843c commit 0f7c9d2
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions be/src/exec/jdbc_scanner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -294,14 +294,14 @@ StatusOr<LogicalType> JDBCScanner::_precheck_data_type(const std::string& java_c
}
return TYPE_FLOAT;
} else if (java_class == "java.lang.Double") {
if (type != TYPE_DOUBLE) {
if (type != TYPE_DOUBLE && type != TYPE_FLOAT) {
return Status::NotSupported(fmt::format(
"Type mismatches on column[{}], JDBC result type is Double, please set the type to double",
"Type mismatches on column[{}], JDBC result type is Double, please set the type to double/float",
slot_desc->col_name()));
}
return TYPE_DOUBLE;
} else if (java_class == "java.sql.Timestamp") {
if (type != TYPE_DATETIME) {
if (type != TYPE_DATETIME && type != TYPE_VARCHAR) {
return Status::NotSupported(fmt::format(
"Type mismatches on column[{}], JDBC result type is Timestamp, please set the type to datetime",
slot_desc->col_name()));
Expand Down Expand Up @@ -336,10 +336,11 @@ StatusOr<LogicalType> JDBCScanner::_precheck_data_type(const std::string& java_c
}
return TYPE_VARCHAR;
} else if (java_class == "java.math.BigDecimal") {
if (type != TYPE_DECIMAL32 && type != TYPE_DECIMAL64 && type != TYPE_DECIMAL128 && type != TYPE_VARCHAR) {
if (type != TYPE_DECIMAL32 && type != TYPE_DECIMAL64 && type != TYPE_DECIMAL128 && type != TYPE_VARCHAR &&
type != TYPE_DOUBLE) {
return Status::NotSupported(
fmt::format("Type mismatches on column[{}], JDBC result type is BigDecimal, please set the type to "
"decimal or varchar",
"decimal、double or varchar",
slot_desc->col_name()));
}
return TYPE_VARCHAR;
Expand Down

0 comments on commit 0f7c9d2

Please sign in to comment.