-
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 transformation rule EliminateSingleMaxMin #14274
Merged
Merged
Changes from 13 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
5cad383
planner/cascades: add transformation rule EliminateSingleMaxMin
Reminiscent 545c5bd
fix check_dev
Reminiscent e98c12b
Merge branch 'master' of https://github.com/pingcap/tidb into XformMa…
Reminiscent 86c6f5a
Merge branch 'master' of https://github.com/pingcap/tidb into XformMa…
Reminiscent af133a1
address comments
Reminiscent 906fb27
revert the change about go.mod and go.sum
Reminiscent 70bebd0
solve conflicts
Reminiscent 2309308
address comments
Reminiscent 65fa467
Merge branch 'master' of https://github.com/pingcap/tidb into XformMa…
Reminiscent 58743f9
address comments
Reminiscent ce3689b
fix CI
Reminiscent 43e3278
Merge branch 'master' of https://github.com/pingcap/tidb into XformMa…
Reminiscent e1f1ec5
address comments
Reminiscent bc65ec7
address comments
Reminiscent 653f993
fix typo
Reminiscent 433a1cb
address comments: revert the change for the first_row()
Reminiscent 45aeeca
Remove duplicate operation
Reminiscent ab11800
Merge branch 'master' into XformMaxMinToTop1
sre-bot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Can we really elimate max/min in this case? After transformation, there is a selection between source and agg, so the first row becomes
first row that the max/min arguments is not null
, is it expected?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.
It's unexpected. In mysql5.7:
I'll fix it. Thanks for your review.
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.
It seems it's not easy to include the
first_row()
aggFun in this transformation rule. Or we can add a check in thematch
function. We can't use this rule when the two conditions thatfirst_row()
and the column formax/min
aggFunc can be NULL, exist at the same time. But I think it has too many restrictions leading to increased complexity. What's your opinion? @francis0407 @lamxTyler @zz-jasonThere 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.
@lamxTyler good catch !
I think we can revert this new feature. It’s hard to do that in the current framework. Just transform max/min like what we did before.
cc @zz-jason
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 think we can rewrite the
Match()
condition to this:max
ormin
, we can apply this transformationmax
ormin
, and all themax
ormin
arguments are not null, we can apply this transformation as well.BTW, how do calcite handle this problem?
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.
Another problem is that currently we cannot check if the arguments are not null.
mysql.HashNotNullFlag
does not work here, since operators like OuterJoin may generate null values onnot null columns
.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 can add a TODO here, waiting for the not null prop is manitained.