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 wrong behavior for = all() #52801

Merged
merged 2 commits into from
May 14, 2024
Merged

Conversation

hawkingrei
Copy link
Member

@hawkingrei hawkingrei commented Apr 22, 2024

What problem does this PR solve?

Issue Number: close #52755

Problem Summary:

What changed and how does it work?

Use max function instead of first_row function.

if the query is t.id = all (select s.id from s), it will be rewrote to
t.id = (select s.id from s having count(distinct s.id) <= 1 and [all checker]) .

If there is NULL in the s.id column, s.id should be the value that isn't null in condition t.id == s.id. So use function max to filter NULL.

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.

None

@ti-chi-bot ti-chi-bot bot added do-not-merge/needs-linked-issue do-not-merge/needs-tests-checked release-note-none Denotes a PR that doesn't merit a release note. sig/planner SIG: Planner size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Apr 22, 2024
@ti-chi-bot ti-chi-bot bot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Apr 22, 2024
Copy link

codecov bot commented Apr 22, 2024

Codecov Report

Attention: Patch coverage is 0% with 9 lines in your changes are missing coverage. Please review.

Project coverage is 64.9850%. Comparing base (4b91fee) to head (03c41a3).
Report is 1 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #52801        +/-   ##
================================================
- Coverage   74.4490%   64.9850%   -9.4640%     
================================================
  Files          1493       1493                
  Lines        356315     426815     +70500     
================================================
+ Hits         265273     277366     +12093     
- Misses        71770     130058     +58288     
- Partials      19272      19391       +119     
Flag Coverage Δ
integration 18.0223% <0.0000%> (?)

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

Components Coverage Δ
dumpling 56.2971% <ø> (ø)
parser ∅ <ø> (∅)
br 36.4583% <ø> (-6.5330%) ⬇️

@hawkingrei
Copy link
Member Author

/test all

@hawkingrei hawkingrei marked this pull request as draft May 13, 2024 09:37
@ti-chi-bot ti-chi-bot bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 13, 2024
@hawkingrei hawkingrei marked this pull request as ready for review May 13, 2024 14:14
@ti-chi-bot ti-chi-bot bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 13, 2024
@ti-chi-bot ti-chi-bot bot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. do-not-merge/needs-tests-checked labels May 13, 2024
@hawkingrei hawkingrei changed the title *: fix invalid query result on a cached table planner: fix wrong behavior for = any() May 14, 2024
@ti-chi-bot ti-chi-bot bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels May 14, 2024
@hawkingrei hawkingrei force-pushed the 52755 branch 2 times, most recently from 3fcdd31 to 5e31536 Compare May 14, 2024 05:11
@winoros winoros changed the title planner: fix wrong behavior for = any() planner: fix wrong behavior for = all() May 14, 2024
@hawkingrei hawkingrei requested a review from qw4990 May 14, 2024 07:16
Copy link

ti-chi-bot bot commented May 14, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: qw4990, 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

@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels May 14, 2024
Copy link

ti-chi-bot bot commented May 14, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-05-14 06:48:03.115921013 +0000 UTC m=+1549436.873056586: ☑️ agreed by winoros.
  • 2024-05-14 07:45:51.566202666 +0000 UTC m=+1552905.323338239: ☑️ agreed by qw4990.

@ti-chi-bot ti-chi-bot bot merged commit 98e5cfb into pingcap:master May 14, 2024
23 checks passed
@hawkingrei
Copy link
Member Author

/cherrypick release-6.5
/cherrypick release-7.1
/cherrypick release-7.5
/cherrypick release-8.1

@hawkingrei hawkingrei deleted the 52755 branch May 14, 2024 08:32
ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request May 14, 2024
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@ti-chi-bot
Copy link
Member

@hawkingrei: new pull request created to branch release-6.5: #53255.

In response to this:

/cherrypick release-6.5
/cherrypick release-7.1
/cherrypick release-7.5
/cherrypick release-8.1

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 ti-community-infra/tichi repository.

@ti-chi-bot
Copy link
Member

@hawkingrei: new pull request created to branch release-7.1: #53256.

In response to this:

/cherrypick release-6.5
/cherrypick release-7.1
/cherrypick release-7.5
/cherrypick release-8.1

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 ti-community-infra/tichi repository.

ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request May 14, 2024
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@ti-chi-bot
Copy link
Member

@hawkingrei: new pull request created to branch release-7.5: #53257.

In response to this:

/cherrypick release-6.5
/cherrypick release-7.1
/cherrypick release-7.5
/cherrypick release-8.1

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 ti-community-infra/tichi repository.

ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request May 14, 2024
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request May 14, 2024
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@ti-chi-bot
Copy link
Member

@hawkingrei: new pull request created to branch release-8.1: #53258.

In response to this:

/cherrypick release-6.5
/cherrypick release-7.1
/cherrypick release-7.5
/cherrypick release-8.1

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 ti-community-infra/tichi repository.

ti-chi-bot bot pushed a commit that referenced this pull request May 14, 2024
ti-chi-bot bot pushed a commit that referenced this pull request May 14, 2024
terry1purcell pushed a commit to terry1purcell/tidb that referenced this pull request May 17, 2024
RidRisR pushed a commit to RidRisR/tidb that referenced this pull request May 23, 2024
hawkingrei added a commit to ti-chi-bot/tidb that referenced this pull request Jun 3, 2024
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
ti-chi-bot bot pushed a commit that referenced this pull request Jun 3, 2024
hawkingrei added a commit to ti-chi-bot/tidb that referenced this pull request Sep 2, 2024
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
ti-chi-bot bot pushed a commit that referenced this pull request Sep 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm release-note-none Denotes a PR that doesn't merit a 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.

Invalid query result on a cached table
4 participants