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: change more conditions that are always false to dual | tidb-test=pr/2466 #59199

Merged
merged 4 commits into from
Feb 7, 2025

Conversation

hawkingrei
Copy link
Member

@hawkingrei hawkingrei commented Jan 24, 2025

What problem does this PR solve?

Issue Number: close #51446
Problem Summary:

What changed and how does it work?

During the logic optimization phase, we rely on Conds2TableDual to transform conditions that are always false into dual ones. However, the previous implementation was overly simplistic, so we have added some new judgments.

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/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jan 24, 2025
@hawkingrei hawkingrei changed the title planner: change more conditions that are always false to dual | tidb-test=pr/2466 planner: create new rules for changing more conditions that are always false to dual | tidb-test=pr/2466 Jan 24, 2025
Copy link
Contributor

@elsa0520 elsa0520 left a comment

Choose a reason for hiding this comment

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

Please change the title of PR.
This is not create a new rule. Just put the evaluate expression in the predicate push down rule

@hawkingrei hawkingrei changed the title planner: create new rules for changing more conditions that are always false to dual | tidb-test=pr/2466 planner: change more conditions that are always false to dual | tidb-test=pr/2466 Jan 24, 2025
@@ -1870,9 +1871,18 @@ func deriveNotNullExpr(ctx base.PlanContext, expr expression.Expression, schema

// Conds2TableDual builds a LogicalTableDual if cond is constant false or null.
func Conds2TableDual(p base.LogicalPlan, conds []expression.Expression) base.LogicalPlan {
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems that this function does not belong to logical_join. It shouldn't belong to any logical operator.
It should belong to expression utils.
Could we move it to right place ?

Copy link
Member Author

Choose a reason for hiding this comment

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

I have create new file and move it into new file.

@ti-chi-bot ti-chi-bot bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jan 26, 2025
@ti-chi-bot ti-chi-bot bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Jan 26, 2025
Copy link

codecov bot commented Jan 26, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 73.5825%. Comparing base (fc8bdb5) to head (b61a842).
Report is 10 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #59199        +/-   ##
================================================
+ Coverage   73.0496%   73.5825%   +0.5328%     
================================================
  Files          1689       1690         +1     
  Lines        466978     468288      +1310     
================================================
+ Hits         341126     344578      +3452     
+ Misses       104890     102710      -2180     
- Partials      20962      21000        +38     
Flag Coverage Δ
integration 42.8464% <92.3076%> (?)
unit 72.2956% <100.0000%> (+0.0639%) ⬆️

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

Components Coverage Δ
dumpling 52.6910% <ø> (ø)
parser ∅ <ø> (∅)
br 45.4774% <ø> (+0.0516%) ⬆️

@hawkingrei hawkingrei force-pushed the dual2 branch 2 times, most recently from 8dfa228 to 0ac6d80 Compare January 26, 2025 07:37
@hawkingrei
Copy link
Member Author

Please change the title of PR. This is not create a new rule. Just put the evaluate expression in the predicate push down rule

I have updated it.

@hawkingrei
Copy link
Member Author

@AilinKid @elsa0520 PTAL

Signed-off-by: Weizhen Wang <[email protected]>
Signed-off-by: Weizhen Wang <[email protected]>
Signed-off-by: Weizhen Wang <[email protected]>
Copy link
Contributor

@AilinKid AilinKid left a comment

Choose a reason for hiding this comment

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

sgtm

@ti-chi-bot ti-chi-bot bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Feb 7, 2025
Copy link
Contributor

@elsa0520 elsa0520 left a comment

Choose a reason for hiding this comment

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

LGTM

@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Feb 7, 2025
Copy link

ti-chi-bot bot commented Feb 7, 2025

[LGTM Timeline notifier]

Timeline:

  • 2025-02-07 05:14:19.484555035 +0000 UTC m=+421531.016967034: ☑️ agreed by AilinKid.
  • 2025-02-07 07:42:06.177139575 +0000 UTC m=+430397.709551572: ☑️ agreed by elsa0520.

Signed-off-by: Weizhen Wang <[email protected]>
Copy link

ti-chi-bot bot commented Feb 7, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: AilinKid, elsa0520, XuHuaiyu

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 the approved label Feb 7, 2025
@ti-chi-bot ti-chi-bot bot merged commit fa0bc8e into pingcap:master Feb 7, 2025
24 checks passed
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/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Do not need to push down ColumnRef <compare_operator> null which is always false
4 participants