-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
executor: refine the check of onlyFullGroupBy when groupByItem is parenthesesExpr or UnaryPlusExpr #13655
Conversation
planner/core/logical_plan_builder.go
Outdated
@@ -1910,14 +1910,18 @@ func (b *PlanBuilder) checkOnlyFullGroupByWithGroupClause(p LogicalPlan, sel *as | |||
gbyColNames := make(map[*types.FieldName]struct{}, len(sel.Fields.Fields)) | |||
gbyExprs := make([]ast.ExprNode, 0, len(sel.Fields.Fields)) | |||
for _, byItem := range sel.GroupBy.Items { | |||
if colExpr, ok := byItem.Expr.(*ast.ColumnNameExpr); ok { | |||
expr := byItem.Expr | |||
if pe, ok := expr.(*ast.ParenthesesExpr); ok { |
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.
Should the UnaryPlusExpr
be handled? If so, just call the function directly?
Codecov Report
@@ Coverage Diff @@
## master #13655 +/- ##
===========================================
Coverage 79.9886% 79.9886%
===========================================
Files 473 473
Lines 116284 116284
===========================================
Hits 93014 93014
Misses 15964 15964
Partials 7306 7306 |
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
Your auto merge job has been accepted, waiting for 13168 |
/run-all-tests |
cherry pick to release-2.1 failed |
cherry pick to release-3.0 failed |
…enthesesExpr or UnaryPlusExpr (pingcap#13655)
…enthesesExpr or UnaryPlusExpr (pingcap#13655)
It seems that, not for sure, we failed to cherry-pick this commit to release-2.1. Please comment '/run-cherry-picker' to try to trigger the cherry-picker if we did fail to cherry-pick this commit before. @XuHuaiyu PTAL. |
/run-cherry-picker |
cherry pick to release-2.1 in PR #16145 |
…enthesesExpr or UnaryPlusExpr (pingcap#13655)
What problem does this PR solve?
fix issue #13652
What is changed and how it works?
Add the check for ParenthesesExpr and UnaryPlusExpr in checkOnlyFullGroupByWithGroupClause
Check List
Tests
Code changes
Side effects
N/A
Related changes
Release note
Make the check of SQL Mode only_full_group_by correct when the group by items is wrapped with parentheses.