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-46100][CORE][PYTHON] Reduce stack depth by replace (string|array).size with (string|array).length #44011

Closed
wants to merge 1 commit into from

Conversation

beliefer
Copy link
Contributor

What changes were proposed in this pull request?

There are a lot of [string|array].size called.
In fact, the size calls the underlying length, this behavior increase the stack length.
We should call [string|array].length directly.
We also get the compile waring Replace .size with .length on arrays and strings

This PR just improve the core module.

Why are the changes needed?

Reduce stack depth by replace (string|array).size with (string|array).length

Does this PR introduce any user-facing change?

'No'.

How was this patch tested?

Exists test cases.

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

'No'.

@beliefer beliefer changed the title [SPARK-46100][CORE] Reduce stack depth by replace (string|array).size with (string|array).length [SPARK-46100][CORE][PYTHON] Reduce stack depth by replace (string|array).size with (string|array).length Nov 25, 2023
@LuciferYang
Copy link
Contributor

Is this all the similar cases in the project? I think we can fix all cases in one PR :)

@beliefer
Copy link
Contributor Author

Is this all the similar cases in the project? I think we can fix all cases in one PR :)

It's very hard. I fix the cases in core module paid two hours.

@srowen
Copy link
Member

srowen commented Nov 25, 2023

Merged to master

@srowen srowen closed this in 7b58fff Nov 25, 2023
@beliefer
Copy link
Contributor Author

@srowen @LuciferYang Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants