-
Notifications
You must be signed in to change notification settings - Fork 28.4k
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-23079][SQL] Fix query constraints propagation with aliases #20270
Conversation
Test build #86135 has finished for PR 20270 at commit
|
/** | ||
* Infers an additional set of constraints from a given set of equality constraints. | ||
* For e.g., if an operator has constraints of the form (`a = 5`, `a = b`), this returns an | ||
* additional constraint of the form `b = 5`. | ||
*/ | ||
private def inferAdditionalConstraints(constraints: Set[Expression]): Set[Expression] = { | ||
val aliasedConstraints = eliminateAliasedExpressionInConstraints(constraints) |
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.
Let us revert this back?
e9dd769
to
8a22e1d
Compare
Test build #86173 has started for PR 20270 at commit |
05c32bf
to
aaad66a
Compare
Test build #86175 has started for PR 20270 at commit |
Test build #86176 has started for PR 20270 at commit |
retest this please |
Test build #86217 has finished for PR 20270 at commit
|
## What changes were proposed in this pull request? Previously, PR apache#19201 fix the problem of non-converging constraints. After that PR apache#19149 improve the loop and constraints is inferred only once. So the problem of non-converging constraints is gone. However, the case below will fail. ``` spark.range(5).write.saveAsTable("t") val t = spark.read.table("t") val left = t.withColumn("xid", $"id" + lit(1)).as("x") val right = t.withColumnRenamed("id", "xid").as("y") val df = left.join(right, "xid").filter("id = 3").toDF() checkAnswer(df, Row(4, 3)) ``` Because `aliasMap` replace all the aliased child. See the test case in PR for details. This PR is to fix this bug by removing useless code for preventing non-converging constraints. It can be also fixed with apache#20270, but this is much simpler and clean up the code. ## How was this patch tested? Unit test Author: Wang Gengliang <[email protected]> Closes apache#20278 from gengliangwang/FixConstraintSimple.
## What changes were proposed in this pull request? Previously, PR #19201 fix the problem of non-converging constraints. After that PR #19149 improve the loop and constraints is inferred only once. So the problem of non-converging constraints is gone. However, the case below will fail. ``` spark.range(5).write.saveAsTable("t") val t = spark.read.table("t") val left = t.withColumn("xid", $"id" + lit(1)).as("x") val right = t.withColumnRenamed("id", "xid").as("y") val df = left.join(right, "xid").filter("id = 3").toDF() checkAnswer(df, Row(4, 3)) ``` Because `aliasMap` replace all the aliased child. See the test case in PR for details. This PR is to fix this bug by removing useless code for preventing non-converging constraints. It can be also fixed with #20270, but this is much simpler and clean up the code. ## How was this patch tested? Unit test Author: Wang Gengliang <[email protected]> Closes #20278 from gengliangwang/FixConstraintSimple. (cherry picked from commit 8598a98) Signed-off-by: Wenchen Fan <[email protected]>
What changes were proposed in this pull request?
Previously, PR #19201 fix the problem of non-converging constraints.
However, the case below will fail.
Because
aliasMap
replace all the aliased child. See the test case in PR for details.This PR is to fix this bug by removing useless
aliasMap
.Duplicated to #20278, this PR will be closed after test finished.
This PR makes sense but it takes time to understand the whole code.
How was this patch tested?
Unit test