HyukjinKwon opened a new pull request, #216:
URL: https://github.com/apache/spark-connect-rust/pull/216

   ### What changes were proposed in this pull request?
   
   [SPARK-61011](https://issues.apache.org/jira/browse/SPARK-61011): the 
columns of a DataFrame now refer to it by the plan ID of its plan, as PySpark 
Connect's do. A DataFrame's relation is sent with that plan ID.
   
   - `df["name"]`, `df.name` and `df._col(name)` are the `ColumnReference` of 
the name and the plan ID.
   - `df["*"]` is the `UnresolvedStar` of the plan ID.
   - `df.metadataColumn(name)` is the metadata `ColumnReference` of it.
   - `df.colRegex(regex)` is the Column of the `UnresolvedRegex` of it, rather 
than a DataFrame.
   
   The server resolves them against that plan. So `df1.join(df2, df1["id"] == 
df2["id"]).select(df1["id"], df2["w"])` selects the `id` of `df1`, and a 
self-join of a DataFrame and one derived from it raises 
`AMBIGUOUS_COLUMN_REFERENCE`, as for PySpark.
   
   In the core, the DataFrame has `col`, `star` and `col_regex` for these, and 
the star and regex expressions take an optional plan ID.
   
   ### Why are the changes needed?
   
   The columns referred to their names only, so the common join above raised 
`AMBIGUOUS_REFERENCE`, as did `df1.join(df2, df1.id == df2.id)`. PySpark 4.3.0 
runs both. `colRegex` also returned a DataFrame rather than a Column.
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes. The columns of DataFrames resolve as in PySpark 4.3.0, and `colRegex` 
returns a Column. In the Rust API, `DataFrame::col_regex` returns a Column too.
   
   ### How was this patch tested?
   
   - A new live test runs joins that select the columns of each side by name, 
by attribute, by `df["*"]` and by `colRegex`. It also checks the error of an 
ambiguous self-join. It passes with official PySpark 4.3.0, and fails without 
this change.
   - A new offline test checks that the columns sent to a mock Connect server 
have the plan IDs of the relations of their DataFrames. It fails without this 
change.
   - A new lib test checks the plan IDs of the columns, the star, the regex and 
the metadata column.
   - The lib tests and every integration test, e2e included, against a local 
Spark 4.3.0 server (665 passed, and 125 of the transport crate), the build of 
all tests with `wasm-udf`, the offline Python suites (1485 passed, 8 skipped), 
and the live drop-in and Arrow suites (88 passed) and live cases (10 passed). 
Clippy reports no diagnostics in the changed lines.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Opus 5.5
   
   This pull request and its description were written by Isaac.
   


-- 
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