Skip to content

Commit 2251bcf

Browse files
committed
moidfy getDecimal by DecimalData.fromBigDecimal(bigDecimal, precision, scale)
1 parent 332f0b8 commit 2251bcf

3 files changed

Lines changed: 20 additions & 8 deletions

File tree

chunjun-connectors/chunjun-connector-jdbc-base/src/main/java/com/dtstack/chunjun/connector/jdbc/source/JdbcInputFormat.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -868,11 +868,12 @@ protected void executeQuery(String startLocation) throws SQLException {
868868
state = startLocation;
869869
}
870870
} else {
871-
statement = dbConn.createStatement(resultSetType, resultSetConcurrency);
872-
statement.setFetchSize(jdbcConf.getFetchSize());
873-
statement.setQueryTimeout(jdbcConf.getQueryTimeOut());
874-
resultSet = statement.executeQuery(jdbcConf.getQuerySql());
875-
hasNext = resultSet.next();
871+
// statement = dbConn.createStatement(resultSetType, resultSetConcurrency);
872+
// statement.setFetchSize(jdbcConf.getFetchSize());
873+
// statement.setQueryTimeout(jdbcConf.getQueryTimeOut());
874+
// resultSet = statement.executeQuery(jdbcConf.getQuerySql());
875+
// hasNext = resultSet.next();
876+
throw new UnsupportedOperationException("must be polling");
876877
}
877878
}
878879

chunjun-core/src/main/java/com/dtstack/chunjun/element/ColumnRowData.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,8 +240,13 @@ public StringData getString(int pos) {
240240

241241
@Override
242242
public DecimalData getDecimal(int pos, int precision, int scale) {
243-
BigDecimal bigDecimal = this.columnList.get(pos).asBigDecimal();
244-
return DecimalData.fromBigDecimal(bigDecimal, bigDecimal.precision(), bigDecimal.scale());
243+
244+
// baisui modify 2022/07/29
245+
AbstractBaseColumn col = this.columnList.get(pos);
246+
BigDecimal bigDecimal = (BigDecimal) col.getData();
247+
// =this.columnList.get(pos).asBigDecimal();
248+
// return DecimalData.fromBigDecimal(bigDecimal, bigDecimal.precision(), bigDecimal.scale());
249+
return DecimalData.fromBigDecimal(bigDecimal, precision, scale);
245250
}
246251

247252
@Override

chunjun-core/src/main/java/com/dtstack/chunjun/element/column/TimeColumn.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,13 @@ public String asTimestampStr() {
104104

105105
@Override
106106
public Integer asInt() {
107-
throw new CastException("java.sql.Time", "Integer", this.asString());
107+
// throw new CastException("java.sql.Time", "Integer", this.asString());
108+
109+
Time time = asTime();
110+
if (time == null) {
111+
return null;
112+
}
113+
return (int) time.getTime();
108114
}
109115

110116
@Override

0 commit comments

Comments
 (0)