-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-22211][SQL] Remove incorrect FOJ limit pushdown #19647
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 all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -113,35 +113,34 @@ class LimitPushdownSuite extends PlanTest { | |
|
|
||
| test("full outer join where neither side is limited and both sides have same statistics") { | ||
|
Member
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. Hi, @gatorsmile and @henryr . cc @felixcheung for 2.2.1.
Member
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. Could you submit a fix to resolve the test failure?
Contributor
Author
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. Sure, I'm taking a look now.
Member
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. Thank you, all!
Contributor
Author
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. See #19701. I think something got dropped in the backport to branch-2.2, so thankfully it's an easy fix. |
||
| assert(x.stats.sizeInBytes === y.stats.sizeInBytes) | ||
| val originalQuery = x.join(y, FullOuter).limit(1) | ||
| val optimized = Optimize.execute(originalQuery.analyze) | ||
| val correctAnswer = Limit(1, LocalLimit(1, x).join(y, FullOuter)).analyze | ||
| comparePlans(optimized, correctAnswer) | ||
| val originalQuery = x.join(y, FullOuter).limit(1).analyze | ||
| val optimized = Optimize.execute(originalQuery) | ||
| // No pushdown for FULL OUTER JOINS. | ||
| comparePlans(optimized, originalQuery) | ||
| } | ||
|
|
||
| test("full outer join where neither side is limited and left side has larger statistics") { | ||
| val xBig = testRelation.copy(data = Seq.fill(2)(null)).subquery('x) | ||
| assert(xBig.stats.sizeInBytes > y.stats.sizeInBytes) | ||
| val originalQuery = xBig.join(y, FullOuter).limit(1) | ||
| val optimized = Optimize.execute(originalQuery.analyze) | ||
| val correctAnswer = Limit(1, LocalLimit(1, xBig).join(y, FullOuter)).analyze | ||
| comparePlans(optimized, correctAnswer) | ||
| val originalQuery = xBig.join(y, FullOuter).limit(1).analyze | ||
| val optimized = Optimize.execute(originalQuery) | ||
| // No pushdown for FULL OUTER JOINS. | ||
| comparePlans(optimized, originalQuery) | ||
| } | ||
|
|
||
| test("full outer join where neither side is limited and right side has larger statistics") { | ||
| val yBig = testRelation.copy(data = Seq.fill(2)(null)).subquery('y) | ||
| assert(x.stats.sizeInBytes < yBig.stats.sizeInBytes) | ||
| val originalQuery = x.join(yBig, FullOuter).limit(1) | ||
| val optimized = Optimize.execute(originalQuery.analyze) | ||
| val correctAnswer = Limit(1, x.join(LocalLimit(1, yBig), FullOuter)).analyze | ||
| comparePlans(optimized, correctAnswer) | ||
| val originalQuery = x.join(yBig, FullOuter).limit(1).analyze | ||
| val optimized = Optimize.execute(originalQuery) | ||
| // No pushdown for FULL OUTER JOINS. | ||
| comparePlans(optimized, originalQuery) | ||
| } | ||
|
|
||
| test("full outer join where both sides are limited") { | ||
| val originalQuery = x.limit(2).join(y.limit(2), FullOuter).limit(1) | ||
| val optimized = Optimize.execute(originalQuery.analyze) | ||
| val correctAnswer = Limit(1, Limit(2, x).join(Limit(2, y), FullOuter)).analyze | ||
| comparePlans(optimized, correctAnswer) | ||
| val originalQuery = x.limit(2).join(y.limit(2), FullOuter).limit(1).analyze | ||
| val optimized = Optimize.execute(originalQuery) | ||
| // No pushdown for FULL OUTER JOINS. | ||
| comparePlans(optimized, originalQuery) | ||
| } | ||
| } | ||
|
|
||
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.
Thanks for working on it! We should still keep it.
Let me fix it based on my original PR: #10454
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.
We decide to disable it and merge it to master and the previous release