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

   ### What changes were proposed in this pull request?
   
   [SPARK-61150](https://issues.apache.org/jira/browse/SPARK-61150): Draw the 
plan IDs of all the sessions of the process from one counter, as PySpark does.
   
   `PlanIds` numbered the nodes of each session from 1. PySpark's 
`LogicalPlan._nextPlanId` is one counter of the process. This change makes the 
counter a process-wide `AtomicI64` (`NEXT_PLAN_ID`) that every `PlanIds` draws 
from, and `assign` raises it past the ID it is given, as before. Each session 
keeps its own node-to-ID map, with its pruning, so a node keeps its ID across 
re-executions (SPARK-60898).
   
   The unit test that asserted that each session numbers its own plans from 1 
now asserts that the sessions never hand out the same ID. The test that checked 
a returned relation's plan ID of 1 now compares it with the ID of that node.
   
   ### Why are the changes needed?
   
   `a = spark.createDataFrame([(1,)], "id int")` and `b = 
spark.newSession().createDataFrame([(2,)], "id int")` gave 
`a.select(b.id).collect()` as `[Row(id=1)]`, and `a.filter(b.id == 2).count()` 
as `0`. The column of `b` carried a plan ID that also named a node of `a`'s 
plan, so the server silently resolved it to `a`'s column of the same name. 
PySpark raises `AnalysisException` `CANNOT_RESOLVE_DATAFRAME_COLUMN` for both.
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes. A column of a DataFrame of another session no longer resolves against 
this session's DataFrame, and raises `CANNOT_RESOLVE_DATAFRAME_COLUMN` as in 
PySpark.
   
   ### How was this patch tested?
   
   - `the_sessions_of_a_process_never_hand_out_the_same_plan_id` (Rust unit 
test): plans of two sessions never get the same plan ID. It fails with the 
per-session counter.
   - The existing unit tests of stable plan IDs, pruning and returned relations 
pass with the global counter.
   - `test_columns_of_another_session_do_not_resolve_in_this_one` (live): 
select and filter with a column of another session raise 
`CANNOT_RESOLVE_DATAFRAME_COLUMN`, and a column of this session still selects. 
The same calls give the same condition with official PySpark 4.3.0.
   - The lib tests of both crates (590 passed), the build of all tests, also 
with `wasm-udf`, and the offline Python suites (2201 passed, 8 skipped), and 
the live tests of sessions, plan IDs, columns, joins and pickling (42 passed) 
against a local Spark 4.3.0 server; rustfmt passes, and 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