Skip to content

[SPARK-56245][PS] Fix DataFrame.eval inplace assignment on pandas 3#55041

Closed
ueshin wants to merge 1 commit intoapache:masterfrom
ueshin:issues/SPARK-56245/eval
Closed

[SPARK-56245][PS] Fix DataFrame.eval inplace assignment on pandas 3#55041
ueshin wants to merge 1 commit intoapache:masterfrom
ueshin:issues/SPARK-56245/eval

Conversation

@ueshin
Copy link
Member

@ueshin ueshin commented Mar 26, 2026

What changes were proposed in this pull request?

This PR updates pandas-on-Spark DataFrame.eval to make a writable pandas copy before calling pdf.eval(..., inplace=True) on pandas 3.

Why are the changes needed?

With pandas 3, the pandas batch frame used by pandas-on-Spark can be read-only. In that case, inplace expressions such as psdf.eval("A = B + C", inplace=True) can fail with:

ValueError: Cannot assign expression output to target

Copying the batch only for the pandas 3 inplace path keeps the fix minimal and preserves the existing behavior for non-inplace eval.

Does this PR introduce any user-facing change?

No.

How was this patch tested?

The existing tests should pass.

Was this patch authored or co-authored using generative AI tooling?

Generated-by: Codex (GPT-5)

@ueshin
Copy link
Member Author

ueshin commented Mar 26, 2026

@HyukjinKwon
Copy link
Member

Merged to master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants