-
Notifications
You must be signed in to change notification settings - Fork 29.1k
[SPARK-29231][SQL] Constraints should be inferred from cast equality constraint #27252
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
048a0ec
34c7001
7dcfe91
2060190
420058b
8dcd076
47eadf4
d283028
d055eba
4b14b3f
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 |
|---|---|---|
|
|
@@ -283,17 +283,23 @@ class InferFiltersFromConstraintsSuite extends PlanTest { | |
| test("Constraints shouldn't be inferred from cast equality constraint(filter lower data type)") { | ||
| val testRelation1 = LocalRelation('a.int) | ||
| val testRelation2 = LocalRelation('b.long) | ||
| val originalLeft = testRelation1.where('a > 1).subquery('left) | ||
| val originalRight = testRelation2.where('b < 10).subquery('right) | ||
| val originalLeft = testRelation1.where('a === 1).subquery('left) | ||
| val originalRight = testRelation2.subquery('right) | ||
|
|
||
| val left = testRelation1.where( | ||
| IsNotNull('a) && 'a > 1 && 'a.cast(LongType) < Literal(10).cast(LongType)).subquery('left) | ||
| val right = testRelation2.where( | ||
| IsNotNull('b) && 'b < Literal(10).cast(LongType)).subquery('right) | ||
| val left = testRelation1.where(IsNotNull('a) && 'a === 1).subquery('left) | ||
| val right = testRelation2.where(IsNotNull('b)).subquery('right) | ||
|
|
||
| Seq(Some("left.a".attr.cast(LongType) === "right.b".attr), | ||
cloud-fan marked this conversation as resolved.
Show resolved
Hide resolved
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I might be wrong, but I find these test cases a bit confusing because |
||
| Some("right.b".attr === "left.a".attr.cast(LongType))).foreach { condition => | ||
| testConstraintsAfterJoin(originalLeft, originalRight, left, right, Inner, condition) | ||
| } | ||
|
|
||
| testConstraintsAfterJoin( | ||
| originalLeft, | ||
| originalRight, | ||
| left, | ||
| testRelation2.where(IsNotNull('b) && 'b.attr.cast(IntegerType) === 1).subquery('right), | ||
| Inner, | ||
| Some("left.a".attr === "right.b".attr.cast(IntegerType))) | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.