-
Notifications
You must be signed in to change notification settings - Fork 28.6k
[WIP][SPARK-52288][PS] Avoid INVALID_ARRAY_INDEX in split
when ANSI mode is on
#51006
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2031,7 +2031,13 @@ def pudf(s: pd.Series) -> pd.Series: | |
if expand: | ||
psdf = psser.to_frame() | ||
scol = psdf._internal.data_spark_columns[0] | ||
spark_columns = [scol[i].alias(str(i)) for i in range(n + 1)] | ||
|
||
if ps.get_option("compute.ansi_mode_support"): | ||
spark_columns = [ | ||
F.try_element_at(scol, F.lit(i + 1)).alias(str(i)) for i in range(n + 1) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can we try to calculate f.lit(i+1) outside loop? since this might avoid function calls and object creation during loop execution
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for suggestion! |
||
] | ||
else: | ||
spark_columns = [scol[i].alias(str(i)) for i in range(n + 1)] | ||
column_labels = [(i,) for i in range(n + 1)] | ||
internal = psdf._internal.with_new_columns( | ||
spark_columns, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems we can always use the new branch, and remove the configuration read here (which needs one Config RPC)