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

   ### What changes were proposed in this pull request?
   
   This PR aims to support Swift literal operands in `Column` operators so that 
literals can be mixed with `Column` expressions directly without wrapping them 
in `lit`.
   
   - A new public protocol `SparkLiteral` with a `toLiteralColumn` requirement, 
conformed by all nine types supported by `lit`: `Bool`, `Int8`, `Int16`, 
`Int32`, `Int64`, `Int`, `Float`, `Double`, and `String`.
   - Generic overloads for all thirteen binary operators (`==`, `!=`, `<`, 
`<=`, `>`, `>=`, `&&`, `||`, `+`, `-`, `*`, `/`, `%`) accepting `some 
SparkLiteral` on either the left-hand or right-hand side.
   
   ```swift
   df.filter(col("age") > 21 && col("name") == "Alice")
   df.select((col("id") * 2).alias("doubled"))
   df.filter(21 < col("age"))
   ```
   
   Each conformance reuses the existing `lit` functions, so the 
literal-to-proto mapping is defined in one place. Existing Swift operations 
such as `Int == Int` are not affected because every overload requires a 
`Column` on one side.
   
   ### Why are the changes needed?
   
   This allows users to write expressions in the idiomatic PySpark/Scala style 
(`col("age") > 21`) instead of `col("age") > lit(21)`, without an overload 
explosion per literal type.
   
   ### Does this PR introduce _any_ user-facing change?
   
   No. This is a new feature addition to the unreleased `Column` API.
   
   ### How was this patch tested?
   
   Pass the CIs with the newly added unit tests.
   
   ### 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]

Reply via email to