Skip to content

Commit 8ff4f1f

Browse files
authored
Merge pull request #252 from data-integrations/PLUGIN-1156
[PLUGIN-1156] Check schema type for bigint object
2 parents 7458f00 + e74e303 commit 8ff4f1f

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

database-commons/src/main/java/io/cdap/plugin/db/DBRecord.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,10 +152,8 @@ protected void setField(ResultSet resultSet, StructuredRecord.Builder recordBuil
152152
} else if (o instanceof BigDecimal) {
153153
recordBuilder.setDecimal(field.getName(), (BigDecimal) o);
154154
} else if (o instanceof BigInteger) {
155-
if (sqlType == Types.BIGINT && (resultSet.getMetaData().isSigned(columnIndex) ||
156-
resultSet.getMetaData().getPrecision(columnIndex) < 19)) {
157-
//SQL BIGINT type is 64-bit long thus signed should be able to convert to long without losing precisions
158-
// or UNSIGNED type is within the scope of signed long
155+
Schema schema = field.getSchema();
156+
if (schema.getType() == Schema.Type.LONG) {
159157
recordBuilder.set(field.getName(), ((BigInteger) o).longValueExact());
160158
} else {
161159
// BigInteger won't have any fraction part and scale is 0

0 commit comments

Comments
 (0)