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

   ### What changes were proposed in this pull request?
   
   This PR adds the four higher-order map functions to 
`HigherOrderFunctions.swift`,
   built on the lambda infrastructure added by SPARK-59254.
   
   | Function | Closure |
   | -------- | ------- |
   | `map_filter(col, f)` | `(Column, Column) -> Column` (key, value) |
   | `transform_keys(col, f)` | `(Column, Column) -> Column` (key, value) |
   | `transform_values(col, f)` | `(Column, Column) -> Column` (key, value) |
   | `map_zip_with(left, right, f)` | `(Column, Column, Column) -> Column` 
(key, value1, value2) |
   
   `map_zip_with` is the first user of the three-argument `createLambda` 
overload,
   which was added by SPARK-59254 but had no caller until now.
   
   ### Why are the changes needed?
   
   For feature parity with Apache Spark. These four functions exist in both the
   Scala and Python clients but had no Swift equivalent. They complete the set 
of
   higher-order functions, whose array half landed in SPARK-59254.
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes, this adds new public APIs. For example:
   
   ```swift
   let df = try await spark.range(1)
   let m = map_from_arrays(array(lit(1), lit(2)), array(lit(10), lit(20)))
   
   try await df.select(map_filter(m) { _, v in v > 10 }.cast("string")).show()
   // {2 -> 20}
   
   try await df.select(transform_keys(m) { k, v in k + v 
}.cast("string")).show()
   // {11 -> 10, 22 -> 20}
   
   try await df.select(transform_values(m) { k, v in k + v 
}.cast("string")).show()
   // {1 -> 11, 2 -> 22}
   
   let m2 = map_from_arrays(array(lit(1), lit(2)), array(lit(100), lit(200)))
   try await df.select(map_zip_with(m, m2) { _, v1, v2 in v1 + v2 
}.cast("string")).show()
   // {1 -> 110, 2 -> 220}
   ```
   
   All four functions were introduced in Spark 3.1.0, so no version gate is 
needed.
   
   ### How was this patch tested?
   
   Extended the existing `HigherOrderFunctionsTests` suite.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Opus 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