EricJoy2048 commented on code in PR #4439:
URL:
https://github.com/apache/incubator-seatunnel/pull/4439#discussion_r1155069239
##########
seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/source/JdbcSource.java:
##########
@@ -236,6 +237,6 @@ private PartitionParameter
initPartitionParameterAndExtendSql(Connection connect
}
private boolean isNumericType(SeaTunnelDataType<?> type) {
- return type.equals(BasicType.INT_TYPE) ||
type.equals(BasicType.LONG_TYPE);
+ return type.equals(BasicType.INT_TYPE) ||
type.equals(BasicType.LONG_TYPE) || type instanceof DecimalType;
Review Comment:
> DecimalType.equals(type) and decimal may cause some exception for spilt,
because how solve the float data?
I agree with you. The `max` and `min` type is long. It may case exception.
```
long max = Long.MAX_VALUE;
long min = Long.MIN_VALUE;
if (jdbcSourceConfig.getPartitionLowerBound().isPresent()
&& jdbcSourceConfig.getPartitionUpperBound().isPresent()) {
max = jdbcSourceConfig.getPartitionUpperBound().get();
min = jdbcSourceConfig.getPartitionLowerBound().get();
return new PartitionParameter(
columnName, min, max,
jdbcSourceConfig.getPartitionNumber().orElse(null));
}
try (ResultSet rs =
connection
.createStatement()
.executeQuery(
String.format(
"SELECT MAX(%s),MIN(%s) " + "FROM
(%s) tt",
columnName, columnName, query))) {
if (rs.next()) {
max =
jdbcSourceConfig.getPartitionUpperBound().isPresent()
?
jdbcSourceConfig.getPartitionUpperBound().get()
: Long.parseLong(rs.getString(1));
min =
jdbcSourceConfig.getPartitionLowerBound().isPresent()
?
jdbcSourceConfig.getPartitionLowerBound().get()
: Long.parseLong(rs.getString(2));
}
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]