-
Notifications
You must be signed in to change notification settings - Fork 28.3k
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-33036][SQL] Refactor RewriteCorrelatedScalarSubquery code to replace exprIds in a bottom-up manner #29913
[SPARK-33036][SQL] Refactor RewriteCorrelatedScalarSubquery code to replace exprIds in a bottom-up manner #29913
Conversation
Kubernetes integration test starting |
Kubernetes integration test status success |
Test build #129274 has finished for PR 29913 at commit
|
cc: @cloud-fan |
Hi, @maropu . |
retest this please |
val newExprs = exprs.map { _.transform { | ||
case a: AttributeReference if attrMap.contains(a) => | ||
val exprId = attrMap.getOrElse(a, a).exprId | ||
a.withExprId(exprId) |
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.
shall we simply use attrMap(a)
or only use the exprId?
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.
okay.
Test build #129445 has finished for PR 29913 at commit
|
Kubernetes integration test starting |
Kubernetes integration test status failure |
Kubernetes integration test starting |
Kubernetes integration test status failure |
@@ -587,6 +589,20 @@ object RewriteCorrelatedScalarSubquery extends Rule[LogicalPlan] { | |||
} | |||
} | |||
} | |||
(newChild, AttributeMap(subqueryAttrMapping)) |
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.
AttributeMap(subqueryAttrMapping.toSeq)
to pass scala 2.13 compilation
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.
Ah, I missed that. Updated.
Test build #129480 has finished for PR 29913 at commit
|
Kubernetes integration test starting |
Kubernetes integration test status success |
Test build #129490 has finished for PR 29913 at commit
|
attrMap: AttributeMap[Attribute]): Seq[E] = { | ||
if (attrMap.nonEmpty) { | ||
val newExprs = exprs.map { _.transform { | ||
case a: AttributeReference if attrMap.contains(a) => attrMap(a) |
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.
not a big deal: it's more efficient to write case a: AttributeReference => attrMap.getOrElse(a, a)
Kubernetes integration test starting |
Kubernetes integration test status success |
GA passed, so merged to master. Thanks, @cloud-fan |
Test build #129496 has finished for PR 29913 at commit
|
What changes were proposed in this pull request?
This PR intends to refactor code in
RewriteCorrelatedScalarSubquery
for replacingExprId
s in a bottom-up manner instead of doing in a top-down one.This PR comes from the talk with @cloud-fan in #29585 (comment).
Why are the changes needed?
To improve code.
Does this PR introduce any user-facing change?
No.
How was this patch tested?
Existing tests.