dongjoon-hyun opened a new pull request, #481:
URL: https://github.com/apache/spark-connect-swift/pull/481
### What changes were proposed in this pull request?
This PR aims to support `TIME` type values in `DataFrame.collect` by
introducing a new
`LocalTime` struct, following up SPARK-58568 which covered the schema path.
- A new public struct `LocalTime` represents a time of day without a date or
a time zone,
like `java.time.LocalTime` of the Scala client and `datetime.time` of
PySpark. It stores
`nanoOfDay` and exposes `hour`/`minute`/`second`/`nanosecond` components.
- `DataFrame.collect` now decodes Arrow `time64` columns into `LocalTime`
values. Apache
Spark serializes `TIME(n)` columns as Arrow `time64(NANOSECOND)`
regardless of precision.
- `Row.==` supports `LocalTime` value comparison.
No vendored `Arrow*.swift` file is touched; the Arrow layer already decodes
`time64`.
### Why are the changes needed?
`DataFrame.collect` silently returned `nil` for every `TIME` column value
because the
Arrow-to-Row conversion had no `time64` case and fell through to the
`String` cast.
```swift
let df = try await spark.sql("SELECT TIME'12:34:56'")
try await df.collect() // Before: [Row(nil)]
// After: [Row(LocalTime(hour: 12, minute: 34,
second: 56))]
```
### Does this PR introduce _any_ user-facing change?
Yes, `DataFrame.collect` returns `LocalTime` values instead of `nil` for
`TIME` columns,
and a new public type `LocalTime` is added. This is a bug fix from the
unreleased perspective.
### How was this patch tested?
Pass the CIs with the newly added test cases.
### Was this patch authored or co-authored using generative AI tooling?
Generated-by: Claude Fable 5
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]