Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SPARK-48310][PYTHON][CONNECT] Cached properties must return copies #46621

Closed

Conversation

grundprinzip
Copy link
Contributor

What changes were proposed in this pull request?

When a consumer modifies the result values of a cached property it will modify the value of the cached property.

Before:

df_columns = df.columns
for col in ['id', 'name']:
  df_columns.remove(col)
assert len(df_columns) == df.columns

But this is wrong and this patch fixes it to

df_columns = df.columns
for col in ['id', 'name']:
  df_columns.remove(col)
assert len(df_columns) != df.columns

Why are the changes needed?

Correctness of the API

Does this PR introduce any user-facing change?

No, this makes the code consistent with Spark classic.

How was this patch tested?

UT

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

No

Copy link
Contributor

@hvanhovell hvanhovell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@HyukjinKwon HyukjinKwon changed the title [SPARK-48310] Cached properties must return copies [SPARK-48310][PYTHON][CONNECT] Cached properties must return copies May 17, 2024
@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
Projects
None yet
3 participants