Skip to content

Commit

Permalink
Cast BigDecimal to double, BigInteger to long or text(#6612)
Browse files Browse the repository at this point in the history
  • Loading branch information
lynnmatrix committed Apr 4, 2020
1 parent 77663ac commit 6905380
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,14 @@ public Object getField(String fieldName) {
return new GenericJsonRecord(schemaVersion, fields, fn);
} else if (fn.isBoolean()) {
return fn.asBoolean();
} else if (fn.isFloatingPointNumber()) {
return fn.asDouble();
} else if (fn.isBigInteger()) {
if (fn.canConvertToLong()) {
return fn.asLong();
} else {
return fn.asText();
}
} else if (fn.isNumber()) {
return fn.numberValue();
} else {
Expand Down

0 comments on commit 6905380

Please sign in to comment.