Skip to content
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

Merged
merged 5 commits into from
Nov 21, 2019

Conversation

XuHuaiyu
Copy link
Contributor

@XuHuaiyu XuHuaiyu commented Nov 21, 2019

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

  • Integration test

Code changes

  • Has exported function/method change

Side effects

N/A

Related changes

  • Need to cherry-pick to the release branch

Release note

Make the check of SQL Mode only_full_group_by correct when the group by items is wrapped with parentheses.

@@ -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 {
Copy link
Contributor

@alivxxx alivxxx Nov 21, 2019

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
Copy link

codecov bot commented Nov 21, 2019

Codecov Report

Merging #13655 into master will not change coverage.
The diff coverage is n/a.

@@             Coverage Diff             @@
##             master     #13655   +/-   ##
===========================================
  Coverage   79.9886%   79.9886%           
===========================================
  Files           473        473           
  Lines        116284     116284           
===========================================
  Hits          93014      93014           
  Misses        15964      15964           
  Partials       7306       7306

@XuHuaiyu XuHuaiyu changed the title executor: refine the check of onlyFullGroupBy when contains parentheses executor: refine the check of onlyFullGroupBy when groupByItem is parenthesesExpr or UnaryPlusExpr Nov 21, 2019
Copy link
Contributor

@alivxxx alivxxx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@zimulala zimulala left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@zimulala zimulala added the status/can-merge Indicates a PR has been approved by a committer. label Nov 21, 2019
@sre-bot
Copy link
Contributor

sre-bot commented Nov 21, 2019

Your auto merge job has been accepted, waiting for 13168

@sre-bot
Copy link
Contributor

sre-bot commented Nov 21, 2019

/run-all-tests

@sre-bot sre-bot merged commit f98a107 into pingcap:master Nov 21, 2019
@sre-bot
Copy link
Contributor

sre-bot commented Nov 21, 2019

cherry pick to release-2.1 failed

@sre-bot
Copy link
Contributor

sre-bot commented Nov 21, 2019

cherry pick to release-3.0 failed

@XuHuaiyu XuHuaiyu deleted the only_full_group_by branch November 21, 2019 05:19
XuHuaiyu added a commit to XuHuaiyu/tidb that referenced this pull request Nov 21, 2019
sre-bot pushed a commit that referenced this pull request Dec 17, 2019
XiaTianliang pushed a commit to XiaTianliang/tidb that referenced this pull request Dec 21, 2019
@sre-bot
Copy link
Contributor

sre-bot commented Apr 7, 2020

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.

@XuHuaiyu
Copy link
Contributor Author

XuHuaiyu commented Apr 8, 2020

/run-cherry-picker

@sre-bot
Copy link
Contributor

sre-bot commented Apr 8, 2020

cherry pick to release-2.1 in PR #16145

XuHuaiyu added a commit to sre-bot/tidb that referenced this pull request Apr 9, 2020
sre-bot added a commit that referenced this pull request Apr 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sig/planner SIG: Planner status/can-merge Indicates a PR has been approved by a committer. type/bugfix This PR fixes a bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants