dongjoon-hyun opened a new pull request, #441:
URL: https://github.com/apache/spark-connect-swift/pull/441
### What changes were proposed in this pull request?
This PR adds a `Column` expression type and a minimal set of `functions` to
`SparkConnect`
module, like Apache Spark's `org.apache.spark.sql.Column` and
`org.apache.spark.sql.functions`.
- `Column`: a `Sendable` struct wrapping `Spark_Connect_Expression`,
providing
`alias`, `asc`, `desc`, and `cast`.
- Functions: `col`, `column`, `lit`, `asc`, `desc`, `count`, `sum`, `avg`,
`mean`, `min`, `max`.
- New overloads accepting `Column` expressions: `DataFrame.select` and
`GroupedData.agg`.
```swift
let df2 = df.select(col("name"), col("age").cast("long").alias("age_long"))
let df3 = await df.groupBy("department")
.agg(count(col("*")).alias("employee_count"), avg(col("salary")))
```
In addition, the unused `Column` struct in `Catalog.swift` is renamed to
`CatalogColumn`
to free the name, and the `groupBy` documentation example is fixed.
### Why are the changes needed?
To provide a type-safe column expression DSL consistent with the other Spark
Connect
clients, instead of relying only on SQL string expressions.
### Does this PR introduce _any_ user-facing change?
Yes, the unused `Column` struct is renamed to `CatalogColumn`. The existing
APIs
behave identically, and the rest are API additions.
### How was this patch tested?
Pass the CIs including the new `FunctionsTests` suite.
### 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]