-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-23405] Generate additional constraints for Join's children #20670
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
Changes from 1 commit
705ed46
f44a92a
1e0f78a
f7d764e
b3f2ade
ed5c170
023f2f7
709ed39
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,12 +29,26 @@ trait QueryPlanConstraints { self: LogicalPlan => | |
| */ | ||
| lazy val constraints: ExpressionSet = { | ||
| if (conf.constraintPropagationEnabled) { | ||
| var relevantOutPutSet: AttributeSet = outputSet | ||
| constraints.foreach { | ||
| case eq @ EqualTo(l: Attribute, r: Attribute) => | ||
|
||
| if (l.references.subsetOf(relevantOutPutSet) | ||
|
||
| && !r.references.subsetOf(relevantOutPutSet)) { | ||
| relevantOutPutSet = relevantOutPutSet.++(r.references) | ||
|
||
| } | ||
| if (r.references.subsetOf(relevantOutPutSet) | ||
| && !l.references.subsetOf(relevantOutPutSet)) { | ||
| relevantOutPutSet = relevantOutPutSet.++(l.references) | ||
| } | ||
| case _ => // No inference | ||
| } | ||
|
|
||
| ExpressionSet( | ||
| validConstraints | ||
| .union(inferAdditionalConstraints(validConstraints)) | ||
| .union(constructIsNotNullConstraints(validConstraints)) | ||
| .filter { c => | ||
| c.references.nonEmpty && c.references.subsetOf(outputSet) && c.deterministic | ||
| c.references.nonEmpty && c.references.subsetOf(relevantOutPutSet) && c.deterministic | ||
| } | ||
| ) | ||
| } else { | ||
|
|
||
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.
now we don't need this if.