Skip to content

Commit

Permalink
[Fix-3478][CDCSOURCE] Fix Oracle CDC could not deal with the date and…
Browse files Browse the repository at this point in the history
… number type properly (#3562)

Co-authored-by: wenmo <[email protected]>
  • Loading branch information
aiwenmo and aiwenmo authored Jun 5, 2024
1 parent 8b9bfd1 commit 34eacc2
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ protected Optional<Object> convertBigIntType(Object value, LogicalType logicalTy
return Optional.of(((Integer) value).longValue());
}

return Optional.of(value);
return Optional.of(Long.parseLong(value.toString()));
}
return Optional.empty();
}
Expand Down Expand Up @@ -484,7 +484,7 @@ protected Optional<Object> convertTimeType(Object target, LogicalType logicalTyp

protected Optional<Object> convertVarCharType(Object target, LogicalType logicalType) {
if (logicalType instanceof VarCharType) {
return Optional.of(StringData.fromString((String) target));
return Optional.of((String) target);
}
return Optional.empty();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ private SQLSinkBuilder(FlinkCDCConfig config) {
@Override
protected void initTypeConverterList() {
typeConverterList = Arrays.asList(
this::convertVarCharType,
this::convertDateType,
this::convertTimestampType,
this::convertFloatType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public ColumnType convert(Column column, DriverConfig<T> driverConfig) {
if (Asserts.isNull(column)) {
return ColumnType.STRING;
}
column.setType(column.getType().toLowerCase());
for (Map.Entry<String, BiFunction<Column, DriverConfig<T>, Optional<ColumnType>>> entry :
convertMap.entrySet()) {
if (column.getType().contains(entry.getKey())) {
Expand Down

0 comments on commit 34eacc2

Please sign in to comment.