-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
planner/cascades: Add the transformation rule PushSelDownWindow #14068
Conversation
… push OperandSelection down to OperandWindow.
@jiangyuzhao Oh, there's one more thing you need to modify:
After |
I think it will be better if I use
in |
It's ok to open it in |
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 you contribution.
LGTM after address this comment.
"Group#3 Schema:[test.t.a,test.t.b,Column#14]", | ||
" Window_4 input:[Group#4]", | ||
"Group#4 Schema:[test.t.a,test.t.b]", | ||
" Projection_3 input:[Group#5], test.t.a, test.t.b", |
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.
I'm not sure whether it's right. For the Projection_3
may be unexpected.
And I wonder why we can only push b > 10 down to window, that is why we can only push col in partition by down to window?
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 me explain the second one first.
Push the filters which contain the column not in partition by clause would cause wrong result.
Take the given case as example. There're two rows a=-1 and b = 11
and a = 10 and b = 11
. If we push the filter a < 10
down to the window. a=-1 and b=11
will be filtered. Then the partition b=11
's min(a)
would become 10
instead of -1
.
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.
And for the first one.
Though windown is in the select field but it's calculated at last.
For a SQL pattern select normal_field, window_field from tables where filters
:
The tables
in FROM CLAUSE is calcualted first, then is the normal_field, then filters, then window_field. So some redundant project may be added when build plans. We'll use the EliminateProjection rule to eliminate the unnecessary ones.
@jingyugao
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.
OK, Thank you for the awesome explanation. But my github name is @jiangyuzhao , hhh.
Codecov Report
@@ Coverage Diff @@
## master #14068 +/- ##
=========================================
Coverage 80.449% 80.449%
=========================================
Files 483 483
Lines 123452 123452
=========================================
Hits 99316 99316
Misses 16355 16355
Partials 7781 7781 |
…d use it in PushSelDownWindow.OnTransform
Thanks, please sign the CLA. See @claassistantio 's comment |
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.
LGTM
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.
LGTM
/run-all-tests |
What problem does this PR solve?
This PR adds Transformation rule PushSelDownWindow which is a part of predicate push down in cascades planner(#13709).
What is changed and how it works?
The logic is the same with
planner/core/rule_predicate_push_down.go/LogicalWindow.PredicatePushdown
.Check List
Tests
Code changes