Skip to content

[SPARK-56250][SQL] Remove confusing defensive code in SortExec.rowSorter and add warning comment#55048

Open
viirya wants to merge 5 commits intoapache:masterfrom
viirya:revert-sort-exec-defensive-code
Open

[SPARK-56250][SQL] Remove confusing defensive code in SortExec.rowSorter and add warning comment#55048
viirya wants to merge 5 commits intoapache:masterfrom
viirya:revert-sort-exec-defensive-code

Conversation

@viirya
Copy link
Copy Markdown
Member

@viirya viirya commented Mar 27, 2026

What changes were proposed in this pull request?

SPARK-52609 added some defensive code to SortExec. The defensive has some issues and was fixed by SPARK-56203.

But actually the defensive code is not for Spark itself but to guard multithreading access to SortExec that isn't an issue to Spark itself. The defensive code could easily confuse others. After rethinking about it, it might be better to revert it and add some warning comment.

Why are the changes needed?

To simplify the code and reduce confusion.

Does this PR introduce any user-facing change?

No

How was this patch tested?

Existing tests

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

Generated-by: Claude Sonnet 4.6

@viirya viirya requested a review from cloud-fan March 27, 2026 02:21
@viirya viirya changed the title [SPARK-56250] Add warning comment to SortExec.rowSorter [SPARK-56250][SQL] Add warning comment to SortExec.rowSorter Mar 27, 2026
@viirya viirya requested a review from peter-toth March 27, 2026 02:22
@peter-toth
Copy link
Copy Markdown
Contributor

Let me doublecheck something today and get back to you @viirya .

@peter-toth
Copy link
Copy Markdown
Contributor

peter-toth commented Mar 27, 2026

Yeah, using theadlocal there doesn't make much sense. I was actually investigating a very different issue when the theoretical problem in #55006 came up, but it had nothing to do with my root problem. Reverting both commits looks ok to me.

@peter-toth
Copy link
Copy Markdown
Contributor

peter-toth commented Mar 27, 2026

Test failures seem real, but unrelated to this change.

Maybe #54854 is causing them? cc @HeartSaVioR

Copy link
Copy Markdown
Member

@dongjoon-hyun dongjoon-hyun left a comment

Choose a reason for hiding this comment

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

Got it. +1 for reverting.

Copy link
Copy Markdown
Member

@dongjoon-hyun dongjoon-hyun left a comment

Choose a reason for hiding this comment

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

BTW, @viirya , I believe we should remove some discussion part in the PR description because it never happens in the community.

After some discussion and rethinking about it, it might be better to revert it and add some warning comment.

In addition, the PR title is correct but very misleading because the code itself is Reverting instead of simply adding a comment. This PR includes a code change. It would be great if the PR title clarifies that we are chaining the code itself.

@viirya viirya changed the title [SPARK-56250][SQL] Add warning comment to SortExec.rowSorter [SPARK-56250][SQL] Remove confusing defensive code in SortExec.rowSorter and add warning comment Mar 27, 2026
@viirya
Copy link
Copy Markdown
Member Author

viirya commented Mar 27, 2026

Thank you @dongjoon-hyun. I updated the PR description and title.

@dongjoon-hyun
Copy link
Copy Markdown
Member

Thank you so much. BTW, I saw that this is created Improvement. However, can we have this version of code change in branch-4.1 too?

@viirya
Copy link
Copy Markdown
Member Author

viirya commented Mar 27, 2026

Thank you so much. BTW, I saw that this is created Improvement. However, can we have this version of code change in branch-4.1 too?

Hmm, yes, maybe bug is more proper as I want to backport this.

@viirya
Copy link
Copy Markdown
Member Author

viirya commented Mar 27, 2026

I updated the JIRA ticket's title and changed it to bug.

@dongjoon-hyun
Copy link
Copy Markdown
Member

Thank you again~

@peter-toth
Copy link
Copy Markdown
Contributor

peter-toth commented Mar 27, 2026

Test failures seem real, but unrelated to this change.

Maybe #54854 is causing them? cc @HeartSaVioR

Same failure again: read stream-stream join v4 state change feed *** FAILED ***. Also happened on my #55036 (comment). This is very likely due to that recently commited PR.

viirya and others added 5 commits March 27, 2026 11:50
…be overwritten by other tasks in parallel"

This reverts commit 26a9ba6.
…ces comment

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@viirya viirya force-pushed the revert-sort-exec-defensive-code branch from 4a721ce to d3700dc Compare March 27, 2026 18:51
@viirya
Copy link
Copy Markdown
Member Author

viirya commented Mar 27, 2026

Same failure again: read stream-stream join v4 state change feed *** FAILED ***. Also happened on my #55036 (comment). This is very likely due to that recently commited PR.

If it is too flaky, maybe we should consider revert it first to unblock CI.

@HeartSaVioR
Copy link
Copy Markdown
Contributor

I'm looking into this now. You can revert but we can probably fix forward if we can wait for a couple hours.

@HeartSaVioR
Copy link
Copy Markdown
Contributor

#55071 waiting for CI

@viirya
Copy link
Copy Markdown
Member Author

viirya commented Mar 28, 2026

Thank you @HeartSaVioR

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.

6 participants