test(spark): characterize ArrowUtils Arrow-to-Spark type mapping#8770
Merged
robert3005 merged 1 commit intoJul 15, 2026
Merged
Conversation
`ArrowUtils` maps Arrow types to Spark SQL `DataType`s and had no test coverage. Add `ArrowUtilsTest` pinning down both directions of its behavior: - supported mappings: Bool, signed ints (8/16/32/64), single/double float, decimal (precision+scale preserved), Utf8/LargeUtf8, Binary/LargeBinary, Date(DAY), Timestamp(MICROSECOND) with/without timezone, and Null; plus the nested `fromArrowField` cases for Struct and List (element nullability). - rejected configurations: unsigned integers, half-precision float, non-DAY date units, and non-microsecond timestamp units all raise UnsupportedOperationException; an unrecognized type raises IllegalArgumentException. Test-only change; no production code is modified. Signed-off-by: jackylee <qcsd2011@gmail.com>
robert3005
approved these changes
Jul 15, 2026
robert3005
left a comment
Contributor
There was a problem hiding this comment.
Thanks, I will have a pr to improve the completeness of these cases
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.
Rationale for this change
ArrowUtils(java/vortex-spark/src/main/java/dev/vortex/spark/ArrowUtils.java) mapsArrow types to Spark SQL
DataTypes on the read path, and currently has no testcoverage. It has several branches that deliberately reject type configurations
(unsigned ints, half floats, non-DAY dates, non-microsecond timestamps, unrecognized
types), and the mapping table itself is exactly the kind of code that regresses quietly.
What changes are included in this PR?
A new
ArrowUtilsTestthat characterizes both directions of the mapping:Bool; signed ints 8/16/32/64 →Byte/Short/Integer/Long;SINGLE/DOUBLEfloat →Float/Double;Decimal(precision + scale preserved);Utf8/LargeUtf8→StringType;Binary/LargeBinary→BinaryType;Date(DAY)→DateType;Timestamp(MICROSECOND)→TimestampTypewith a timezoneand
TimestampNTZTypewithout;Null→NullType; and the nestedfromArrowFieldcases for
StructandList(carrying element nullability).units, and non-microsecond timestamp units all raise
UnsupportedOperationException;an unrecognized Arrow type raises
IllegalArgumentException.This is a test-only change; no production code is modified. 16 tests, all passing
locally (
:vortex-spark_2.12:test --tests 'dev.vortex.spark.ArrowUtilsTest').What APIs are changed? Are there any user-facing changes?
None. No production code or public API is touched.