dongjoon-hyun opened a new pull request, #480:
URL: https://github.com/apache/spark-connect-swift/pull/480
### What changes were proposed in this pull request?
This PR aims to support `TIME` type (added in Apache Spark 4.1) in
`DataType.simpleString`
so that `DataFrame.schema`/`dtypes`/`printSchema` work on `TIME` columns.
Following Apache Spark's `TimeType.typeName` convention, the mapping uses
`time(<precision>)`.
When the proto `precision` field is absent, it falls back to `time(6)` like
Apache Spark's
`TimeType.DEFAULT_PRECISION` (`MICROS_PRECISION`).
### Why are the changes needed?
`Spark_Connect_DataType`'s `time` kind fell through to the `default:` branch
of
`DataType.simpleString` and threw `SparkConnectError.InvalidType`. As a
result,
`DataFrame.dtypes` failed entirely on any DataFrame containing a `TIME`
column.
```swift
let df = try await spark.sql("SELECT TIME'12:34:56'")
try await df.dtypes // Before: throws SparkConnectError.InvalidType
// After: [("TIME '12:34:56'", "time(6)")]
```
### Does this PR introduce _any_ user-facing change?
Yes, `DataFrame.dtypes` no longer throws on `TIME` columns and returns
Spark-style type
strings instead. This is a bug fix from the unreleased perspective.
### How was this patch tested?
Pass the CIs with a newly added test case. The new test enables
`spark.sql.timeType.enabled`
at the session level and is guarded to run on Apache Spark 4.2+ only.
### 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]