dongjoon-hyun opened a new pull request, #512:
URL: https://github.com/apache/spark-connect-swift/pull/512

   ### What changes were proposed in this pull request?
   
   This PR aims to support nanosecond timestamp literals in `lit` and SQL 
parameter binding.
   
   - Add `lit(_ value: TimestampNanos)` which builds 
`Expression.Literal.TimestampLTZNanos` with `epochMicros`, `nanosWithinMicro`, 
and `precision = 9`.
   - Conform `TimestampNanos` to `SparkLiteral` so it can be used directly as 
an operand of `Column` operators, e.g. `col("t") == ts`.
   - Handle `TimestampNanos` in `ExpressionLiteral.init(_:)` so it can be bound 
as a positional (`?`) or named (`:name`) parameter of `spark.sql`.
   
   Like `Date`, which maps to `TIMESTAMP` (`TIMESTAMP_LTZ`), `TimestampNanos` 
is an absolute point in time and maps to `TIMESTAMP_LTZ(9)`.
   
   ```swift
   try await spark.conf.set("spark.sql.timestampNanosTypes.enabled", "true")
   let ts = TimestampNanos(epochNanos: 1_767_225_600_123_456_789)
   spark.range(1).select(lit(ts))                     // timestamp_ltz(9)
   try await spark.sql("SELECT ?", ts)
   try await spark.sql("SELECT :t", args: ["t": ts])
   ```
   
   ### Why are the changes needed?
   
   SPARK-59198 covered only the read path (`DataFrame.collect`). This completes 
the write path for expressions so that Swift users can send nanosecond 
timestamp values to the server via `lit`, `Column` operators, and parameterized 
SQL without losing sub-microsecond digits.
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes, `TimestampNanos` is newly accepted by `lit`, `Column` operators, and 
`spark.sql` parameters. There is no behavior change for existing code.
   
   ### How was this patch tested?
   
   Pass the CIs with newly added test cases.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Fable 5.1


-- 
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]

Reply via email to