Skip to content

Commit

Permalink
[Feature] Support clickhouse jdbc datasource(StarRocks#40894)
Browse files Browse the repository at this point in the history
  • Loading branch information
DataScientistSamChan committed Mar 24, 2024
1 parent c2ab144 commit bba80b0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion be/src/exec/jdbc_scanner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ StatusOr<LogicalType> JDBCScanner::_precheck_data_type(const std::string& java_c
"Type mismatches on column[{}], JDBC result type is LocalDate, please set the type to date",
slot_desc->col_name()));
}
return TYPE_DATE;
return TYPE_VARCHAR;
} else if (java_class == "java.math.BigDecimal") {
if (type != TYPE_DECIMAL32 && type != TYPE_DECIMAL64 && type != TYPE_DECIMAL128 && type != TYPE_VARCHAR) {
return Status::NotSupported(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,12 +164,18 @@ public List<Object[]> getNextChunk() throws Exception {
} else if (dataColumn instanceof Double[]) {
dataColumn[resultNumRows] = ((Number) resultObject).doubleValue();
} else if (dataColumn instanceof String[] && resultObject instanceof String) {
System.out.println(1);
System.out.println(resultObject);
// if both sides are String, assign value directly to avoid additional calls to getString
dataColumn[resultNumRows] = resultObject;
} else if (!(dataColumn instanceof String[])) {
System.out.println(2);
// for other general class type, assign value directly
System.out.println(resultObject);
dataColumn[resultNumRows] = resultObject;
} else {
System.out.println(3);
System.out.println(resultSet.getString(i + 1));
// for non-general class type, use string representation
dataColumn[resultNumRows] = resultSet.getString(i + 1);
}
Expand Down

0 comments on commit bba80b0

Please sign in to comment.