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-51268][SQL] Make TreeNode lock-free #50019

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

zhengruifeng
Copy link
Contributor

What changes were proposed in this pull request?

Make TreeNode lock-free, by replace lazy val with BestEffortLazyVal

Why are the changes needed?

In several deadlock issues, we observed that the lock of TreeNode._hashCode is the root cause.

Does this PR introduce any user-facing change?

no

How was this patch tested?

ci

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

no

@github-actions github-actions bot added the SQL label Feb 20, 2025
Copy link
Contributor

@LuciferYang LuciferYang left a comment

Choose a reason for hiding this comment

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

LGTM

@dongjoon-hyun
Copy link
Member

cc @JoshRosen and @cloud-fan

@zhengruifeng zhengruifeng marked this pull request as draft February 21, 2025 00:33
@@ -67,15 +67,16 @@ abstract class QueryPlan[PlanType <: QueryPlan[PlanType]]
def outputOrdering: Seq[SortOrder] = Nil

// Override `treePatternBits` to propagate bits for its expressions.
override lazy val treePatternBits: BitSet = {
private val _treePatternBits = new BestEffortLazyVal[BitSet](() => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

treePatternBits was kept lazy val in previous PR, do you @cloud-fan remember it was intended or not?

Copy link
Contributor

Choose a reason for hiding this comment

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

Curiously, Since the treePatternBits only init once, how it keep the correctness if the expressions transformed with rules?

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

Successfully merging this pull request may close these issues.

4 participants