Repository navigation
GH-1552: Return exact unsigned integer values and report isSigned in Flight SQL JDBC - #1554
Closed
fredjoonpark wants to merge 1 commit into
Closed
fredjoonpark wants to merge 1 commit into
fredjoonpark wants to merge 1 commit into
Conversation
…Flight SQL JDBC Zero-extend UInt8 and UInt32 holders, read UInt64 values above Long.MAX_VALUE as unsigned in getBigDecimal, getDouble and getFloat, build the scaled getBigDecimal on the exact getBigDecimal, support getObject(BigInteger.class) for integer columns, and set the column signed flag from the Arrow type.
fredjoonpark
requested review from
jbonofre,
laurentgo,
lidavidm and
wgtmac
as code owners
December 4, 2026 18:52
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What's Changed
The Flight SQL JDBC driver sign-extended
UInt8andUInt32values, wrappedUInt64values aboveLong.MAX_VALUEin getters whose return type can hold them, threwClassCastExceptionfromgetObject(i, BigInteger.class), and reportedisSigned()as false for every column.The change is in
flight/flight-sql-jdbc-core:ArrowFlightJdbcNumericGetter: zero-extends theUInt8andUInt32holders, sogetLong,getString,getBigDecimal,getDoubleandgetFloat(andgetShort/getIntforUInt8) return the exact value.ArrowFlightJdbcBaseIntVectorAccessor:getBigDecimal,getDoubleandgetFloatreadUInt64values aboveLong.MAX_VALUEas unsigned. The deprecatedgetBigDecimal(columnIndex, scale)is built on the exactgetBigDecimal()instead ofgetDouble().getObject(i, BigInteger.class)returns the value.ConvertUtils: setssignedfrom the Arrow type, matching the parameter converters:Intfollows its flag,FloatingPointandDecimalare signed, everything else isn't.Two behaviours change for signed columns.
isSigned()becomes true for signed numeric columns, which changes the types callers derive from it; for example, Spark infersIntegerTypeandLongTypefor signedINTEGERandBIGINTcolumns instead ofLongTypeandDecimalType(20,0). The deprecated scaledgetBigDecimalbecomes exact for values above 2^53.This contains breaking changes.
Unchanged, and left for #1553 because fixing them means throwing or changing a returned class: narrowing getters still truncate values that don't fit, and
getObject(all widths) andgetLong(UInt64aboveLong.MAX_VALUE) still return the same-width signed value.Testing
ArrowFlightJdbcBaseIntVectorAccessorTest: for all eight integer vector types,getByte,getShort,getInt,getLong,getBigDecimal,getString,getFloat,getDoubleandgetObject(i, BigInteger.class)are checked against the value read from the vector, over values that include each type's maximum and sign bit.ArrowFlightJdbcBaseIntVectorAccessorUnitTest: the scaledgetBigDecimalfor aBIGINTabove 2^53, andgetObject(i, BigInteger.class)for null.ConvertUtilsTest: for 22 Arrow types, columnsignedis as expected and matches the parameter metadata.ResultSetMetadataTest:isSigned()for signed, unsigned and non-numeric columns, from a prepared statement before execution and from its result set.ResultSetTest: through the driver,UInt8,UInt16,UInt32andUInt64columns holding each type's maximum and its sign bit alone return the exact value fromgetString,getBigDecimal, the scaledgetBigDecimal,getDouble,getObject(i, BigInteger.class),getObject(i, BigDecimal.class)and, where it fits,getLong.mvn -pl flight/flight-sql-jdbc-core verify: 1461 tests, 0 failures, 0 errors; the 46 skipped are existing@Disabledor assumption-guarded tests inArrowFlightConnectionPropertyTest,ArrowFlightJdbcTimeStampVectorAccessorTestandArrowFlightPreparedStatementTest.Closes #1552.