You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "dongjoon-hyun (via GitHub)" <gi...@apache.org> on 2026/07/31 14:53:59 UTC

[PR] [SPARK-58473] Support comparison/logical/arithmetic operators in `Column` [spark-connect-swift]

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

   ### What changes were proposed in this pull request?
   
   This PR aims to support comparison, logical, and arithmetic operators in `Column`.
   
   - Comparison: `==`, `!=`, `<`, `<=`, `>`, `>=`
   - Logical: `&&`, `||`, prefix `!`
   - Arithmetic: `+`, `-`, `*`, `/`, `%`, prefix `-` (negation)
   
   The operators build `Expression.UnresolvedFunction` with the same function names as the Scala client (`Column.scala`): `==` → `"="`, `!=` → `"!"` of `"="`, `&&` → `"and"`, `||` → `"or"`, prefix `-` → `"negative"`, and the same symbols for the rest.
   
   In addition, `DataFrame.filter(_: Column)` and `DataFrame.where(_: Column)` overloads are added to make the operators usable.
   
   ```swift
   let adults = df.filter(col("age") > lit(21) && col("name") == lit("Alice"))
   let doubled = df.select((col("id") * lit(2)).alias("doubled"))
   ```
   
   Note that unlike Scala, Swift allows overloading `==` with a `Column` return type without conflicts because `Column` does not conform to `Equatable`, so the Scala-style `===`/`=!=` operators are not needed. Misuse such as `if col("a") == col("b")` is rejected at compile time (`cannot convert value of type 'Column' to expected condition type 'Bool'`).
   
   ### Why are the changes needed?
   
   To allow users to write filter and projection expressions in the idiomatic PySpark/Scala style instead of SQL strings.
   
   ### 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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-58473] Support comparison/logical/arithmetic operators in `Column` [spark-connect-swift]

Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun closed pull request #455: [SPARK-58473] Support comparison/logical/arithmetic operators in `Column`
URL: https://github.com/apache/spark-connect-swift/pull/455


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-58473] Support comparison/logical/arithmetic operators in `Column` [spark-connect-swift]

Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun commented on PR #455:
URL: https://github.com/apache/spark-connect-swift/pull/455#issuecomment-5144257319

   Oh, good morning, @viirya . Thank you!


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org