Skip to content

[SPARK-54203][SQL] Support TimeType in RowToColumnConverter#56613

Open
MaxGekk wants to merge 2 commits into
apache:masterfrom
MaxGekk:time-RowToColumnConverter
Open

[SPARK-54203][SQL] Support TimeType in RowToColumnConverter#56613
MaxGekk wants to merge 2 commits into
apache:masterfrom
MaxGekk:time-RowToColumnConverter

Conversation

@MaxGekk

@MaxGekk MaxGekk commented Jun 19, 2026

Copy link
Copy Markdown
Member

What changes were proposed in this pull request?

Add a TimeType branch (via the abstract AnyTimeType) to RowToColumnConverter.getConverterForType in sql/core/.../execution/Columnar.scala, routing TIME columns through the long-backed LongConverter path. TIME is stored as nanos-of-day Long, and the on/off-heap column vectors already reserve long storage for it (OnHeapColumnVector, OffHeapColumnVector), so no column-vector changes are required.

Why are the changes needed?

Previously getConverterForType handled LongType | TimestampType | TimestampNTZType | DayTimeIntervalType (all long-backed) but had no TimeType case, so a TIME column fell through to unsupportedDataTypeError. This blocked row-to-column conversion paths (e.g. RowToColumnar transitions, vectorized execution) for the TIME data type.

This is a sub-task of SPARK-57550 (Extend support for the TIME data type).

Does this PR introduce any user-facing change?

No. It enables an existing code path for the TIME data type that previously threw an unsupported-type error.

How was this patch tested?

Added round-trip and null-handling tests for TimeType to RowToColumnConverterSuite:

  • TimeType column roundtrip (precisions 0, 3, 6; values including 0L and end-of-day 86399999999999L)
  • TimeType column with nulls

Ran build/sbt 'sql/testOnly *RowToColumnConverterSuite' (all 13 tests pass) and scalastyle on the sql module (0 errors).

Was this patch authored or co-authored using generative AI tooling?

Yes, Generated-by: Cursor.

MaxGekk added 2 commits June 19, 2026 17:05
### What changes were proposed in this pull request?

Add a `TimeType` branch (via the abstract `AnyTimeType`) to
`RowToColumnConverter.getConverterForType` in `Columnar.scala`, routing TIME
columns through the long-backed `LongConverter` path. TIME is stored as
nanos-of-day `Long`, and the on/off-heap column vectors already reserve long
storage for it, so no vector changes are required.

### Why are the changes needed?

Previously `getConverterForType` had no `TimeType` case, so a TIME column fell
through to `unsupportedDataTypeError`, blocking row-to-column conversion paths
(RowToColumnar transitions, vectorized execution, etc.) for TIME.

### Does this PR introduce any user-facing change?

No. It enables an existing code path for the TIME data type.

### How was this patch tested?

Added round-trip and null-handling tests for `TimeType` to
`RowToColumnConverterSuite`. Ran `build/sbt 'sql/testOnly *RowToColumnConverterSuite'`
(all 13 tests pass) and scalastyle on the sql module (0 errors).
…spatch

Use `_: TimeType` instead of the abstract `_: AnyTimeType` in the
long-backed branch of `getConverterForType`, matching every peer
long-backed dispatch site and keeping a future non-long-backed time
subtype on the explicit `unsupportedDataTypeError` path.

Co-authored-by: Isaac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants