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

Fix 22301 and 33056 #10

Merged
merged 2 commits into from
Mar 14, 2022

Conversation

AilinKid
Copy link
Collaborator

@AilinKid AilinKid commented Mar 14, 2022

What problem does this PR solve?

Fix pingcap#22301 and pingcap#33056

What is changed and how it works?

drop table if exists t1, t2;
create table t1 (a int);
create table t2 (a int, b int);
select t1.a from t1 join t2 on t2.a=t1.a group by t2.a having min(t2.b) > 0;

22301: having and order-by clause will append additional select fields into original select. there are some difference:
for having: the direct expr/col should be limited with only-full-group-by
for order by: the direct expr/col should be limited with only-full-group-by when group-cols are NOT empty.
for both: the base col extracted from these clause don't have to be checked with only-full-group-by

create table t1 (a int);
create table t2 (a int, b int);
select t2.a, count(t2.b) from t1 join t2 using (a) where t1.a = 1;

33056: inner join with using will hide some col, which cause the agg can't find it with there is a selection above the join; besides, FD in selection should also take into consideration of this kind of full schema, otherwise, will wrongly project out some column'FD, for example here, t2.a

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Code changes

  • Has exported function/method change
  • Has exported variable/fields change
  • Has interface methods change
  • Has persistent data change

Side effects

  • Possible performance regression
  • Increased code complexity
  • Breaking backward compatibility

Related changes

  • Need to cherry-pick to the release branch
  • Need to update the documentation
  • Need to update the tidb-ansible repository
  • Need to be included in the release note

Signed-off-by: ailinkid <314806019@qq.com>
Signed-off-by: ailinkid <314806019@qq.com>
@winoros winoros merged commit 2ef6d7b into winoros:functional-dependency Mar 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants