dongjoon-hyun opened a new pull request, #451:
URL: https://github.com/apache/spark-connect-swift/pull/451
### What changes were proposed in this pull request?
This PR aims to add `DataFrame.alias` API to support qualified column access
and self-joins, like PySpark's `df.alias("a")`.
- `DataFrame.alias(_ alias: String) -> DataFrame` builds a `SubqueryAlias`
relation on top of the current plan.
- `SparkConnectClient.getSubqueryAlias` is added following the existing
`get*` relation helper pattern.
```swift
let df1 = df.alias("l")
let df2 = df.alias("r")
let joined = await df1.join(df2, joinExprs: "l.id = r.id")
```
### Why are the changes needed?
Without `alias`, it is difficult to disambiguate columns with the same name
when self-joining a `DataFrame`. The `Spark_Connect_SubqueryAlias` relation
already exists in the generated protobuf code but was unused.
### Does this PR introduce _any_ user-facing change?
Yes, this adds a new `DataFrame.alias` API.
### How was this patch tested?
Pass the CIs with a newly added test case covering qualified column access
(`df.alias("a").select("a.id")`) and a self-join with two aliases, verified
against a local Apache Spark 4.2.0 Connect server.
### 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]