-
Notifications
You must be signed in to change notification settings - Fork 25.7k
ES|QL: fix LIMIT pushdown past MV_EXPAND #115624
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
65096cb
280a4b5
f471d54
b03ef72
5b3fd2e
db86a6f
e171cdf
5755968
3b407e7
2322b04
7ee5811
8f1c2d7
adc4d81
af70d28
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -191,6 +191,8 @@ private PhysicalPlan map(UnaryPlan p, PhysicalPlan child) { | |
| if (p instanceof MvExpand mvExpand) { | ||
| MvExpandExec result = new MvExpandExec(mvExpand.source(), map(mvExpand.child()), mvExpand.target(), mvExpand.expanded()); | ||
craigtaverner marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| if (mvExpand.limit() != null && mvExpand.limit() >= 0) { | ||
|
||
| // MvExpand could have an inner limit | ||
| // see PushDownAndCombineLimits rule | ||
| return new LimitExec(result.source(), result, new Literal(Source.EMPTY, mvExpand.limit(), DataType.INTEGER)); | ||
| } | ||
| return result; | ||
|
|
||
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.
Interesting that this code previously did not push the limit down past the MvExpand at all, but the bug reports indicate that that was happening. Was it happening somewhere else? If so, should that location be modified?
Uh oh!
There was an error while loading. Please reload this page.
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.
Oh yeah, good point, I forgot about it...
We have another rule, called
DuplicateLimitAfterMvExpand, that does exactly what I describe above:MV_EXPAND | LIMIT->LIMIT | MV_EXPAND | LIMITI think we can remove it
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.
There is another rule, AddDefaultTopN, that is intrinsically wrong (it adds an arbitrary limit at the beginning of the query) and that IMHO should be removed as well, but I'm not sure this fix is enough to do it, maybe the problems it tries to solve are not only related to MV_EXPAND.