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

planner: fix missing error of only full group by check for folded nature join cols #53228

Closed
wants to merge 2 commits into from

Conversation

AilinKid
Copy link
Contributor

@AilinKid AilinKid commented May 13, 2024

What problem does this PR solve?

Issue Number: close #52935

Problem Summary:
natural join column will be omitted from p.schema usage, which will cause old only full group check confusion in next stage.

func (b *PlanBuilder) checkOnlyFullGroupBy(p base.LogicalPlan, sel *ast.SelectStmt) (err error) {
	if sel.GroupBy != nil {
		err = b.checkOnlyFullGroupByWithGroupClause(p, sel)
	} else {
		err = b.checkOnlyFullGroupByWithOutGroupClause(p, sel)
	}
	return err
}

What changed and how does it work?

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No need to test
    • I checked and no code files have been changed.

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

planner: fix missing error of only full group by check for folded nature join cols

…cols

Signed-off-by: AilinKid <314806019@qq.com>
@ti-chi-bot ti-chi-bot bot added do-not-merge/needs-linked-issue do-not-merge/needs-tests-checked release-note sig/planner SIG: Planner size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels May 13, 2024
Copy link

tiprow bot commented May 13, 2024

Hi @AilinKid. Thanks for your PR.

PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test all.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

.
Signed-off-by: AilinKid <314806019@qq.com>
Copy link

ti-chi-bot bot commented May 13, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: winoros

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link

ti-chi-bot bot commented May 13, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-05-13 08:49:56.296103462 +0000 UTC m=+1470350.053239031: ☑️ agreed by winoros.

Copy link

codecov bot commented May 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 74.1394%. Comparing base (fa94f49) to head (2f7c570).
Report is 6 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #53228        +/-   ##
================================================
+ Coverage   72.4109%   74.1394%   +1.7284%     
================================================
  Files          1493       1493                
  Lines        429341     431000      +1659     
================================================
+ Hits         310890     319541      +8651     
+ Misses        99162      91533      -7629     
- Partials      19289      19926       +637     
Flag Coverage Δ
integration 29.0550% <0.0000%> (?)
unit 71.2970% <100.0000%> (-0.0058%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
dumpling 53.9957% <ø> (ø)
parser ∅ <ø> (∅)
br 50.1807% <ø> (+8.7438%) ⬆️

@hawkingrei
Copy link
Member

/ok-to-test

Copy link

ti-chi-bot bot commented May 13, 2024

@AilinKid: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
idc-jenkins-ci-tidb/mysql-test 2f7c570 link true /test mysql-test
idc-jenkins-ci-tidb/check_dev 2f7c570 link true /test check-dev
idc-jenkins-ci-tidb/check_dev_2 2f7c570 link true /test check-dev2

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@AilinKid
Copy link
Contributor Author

i find it's hard to perfect fix it in old only full group check infra

tidb> set @@session.tidb_enable_new_only_full_group_by_check = 'on';
Query OK, 0 rows affected (0.00 sec)

tidb> SELECT t0.c0 FROM t0 NATURAL RIGHT JOIN t1 GROUP BY NULL;
ERROR 1055 (42000): Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'test.t0.c0' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

@AilinKid AilinKid closed this May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved needs-1-more-lgtm ok-to-test release-note sig/planner SIG: Planner size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

When executing GROUP BY NULL, TiDB returns unexpected results
3 participants