Skip to content

test(spark): characterize ArrowUtils Arrow-to-Spark type mapping#8770

Merged
robert3005 merged 1 commit into
vortex-data:developfrom
jackylee-ch:spark-arrowutils-tests
Jul 15, 2026
Merged

test(spark): characterize ArrowUtils Arrow-to-Spark type mapping#8770
robert3005 merged 1 commit into
vortex-data:developfrom
jackylee-ch:spark-arrowutils-tests

Conversation

@jackylee-ch

Copy link
Copy Markdown
Contributor

Rationale for this change

ArrowUtils (java/vortex-spark/src/main/java/dev/vortex/spark/ArrowUtils.java) maps
Arrow types to Spark SQL DataTypes on the read path, and currently has no test
coverage
. 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 ArrowUtilsTest that characterizes both directions of the mapping:

  • Supported mappings: Bool; signed ints 8/16/32/64 → Byte/Short/Integer/Long;
    SINGLE/DOUBLE float → Float/Double; Decimal (precision + scale preserved);
    Utf8/LargeUtf8StringType; Binary/LargeBinaryBinaryType;
    Date(DAY)DateType; Timestamp(MICROSECOND)TimestampType with a timezone
    and TimestampNTZType without; NullNullType; and the nested fromArrowField
    cases for Struct and List (carrying element nullability).
  • Rejected configurations: unsigned integers, half-precision float, non-DAY date
    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.

`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 robert3005 added the changelog/chore A trivial change label Jul 15, 2026

@robert3005 robert3005 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I will have a pr to improve the completeness of these cases

@robert3005 robert3005 merged commit 6b27c45 into vortex-data:develop Jul 15, 2026
79 of 80 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog/chore A trivial change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants