tidb
tidb copied to clipboard
Optimizer: Refactor and simplify outer to inner join conversion rule #50971
What problem does this PR solve?
Issue Number: Ref #51664
Problem Summary: Currently, the outer to inner join rewrite is part of the predicate push down. This is causing confusion and difficulty in extending of both rewrites. Also, the current implementation of outer to inner join rewrite has unnecessary special cases.
What changed and how does it work?
A new logical optimization is added to the list of rules. Also, a simple solution of null filtering (or NF) predicate check is used. The solution is simply:
- NF(A AND B) = NF(A) OR NF(B)
- NF(A OR B) = NF(A) AND NF(B)
Check List
Tests
- [X] 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
Hi @ghazalfamilyusa. 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/test-infra repository.
Codecov Report
Attention: Patch coverage is 43.62416% with 84 lines in your changes are missing coverage. Please review.
Project coverage is 73.5124%. Comparing base (
acdb6f5) to head (15a2ba2). Report is 12 commits behind head on master.
Additional details and impacted files
@@ Coverage Diff @@
## master #52941 +/- ##
================================================
+ Coverage 72.4943% 73.5124% +1.0180%
================================================
Files 1493 1498 +5
Lines 429359 434713 +5354
================================================
+ Hits 311261 319568 +8307
+ Misses 98889 95083 -3806
- Partials 19209 20062 +853
| Flag | Coverage Δ | |
|---|---|---|
| integration | 24.4896% <43.6241%> (?) |
Flags with carried forward coverage won't be shown. Click here to find out more.
| Components | Coverage Δ | |
|---|---|---|
| dumpling | 53.9957% <ø> (ø) |
|
| parser | ∅ <ø> (∅) |
|
| br | 50.1812% <ø> (+8.7242%) |
:arrow_up: |
/retest
@ghazalfamilyusa: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.
In response to this:
/retest
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.
/retest
@ghazalfamilyusa: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.
In response to this:
/retest
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.
/retest
@ghazalfamilyusa: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.
In response to this:
/retest
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.
/retest
@ghazalfamilyusa: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.
In response to this:
/retest
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.
/retest
/test mysql-test
@elsa0520: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.
In response to this:
/test mysql-test
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.
/test mysql-test
@ghazalfamilyusa: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.
In response to this:
/test mysql-test
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.
/retest unit-test
@ghazalfamilyusa: The /retest command does not accept any targets.
The following commands are available to trigger required jobs:
/test build/test check-dev/test check-dev2/test mysql-test/test pull-br-integration-test/test pull-integration-ddl-test/test pull-lightning-integration-test/test pull-mysql-client-test/test unit-test
The following commands are available to trigger optional jobs:
/test canary-notify-when-compatibility-sections-changed/test pingcap/tidb/canary_ghpr_unit_test/test pull-common-test/test pull-e2e-test/test pull-integration-common-test/test pull-integration-copr-test/test pull-integration-jdbc-test/test pull-integration-mysql-test/test pull-integration-nodejs-test/test pull-sqllogic-test/test pull-tiflash-test
Use /test all to run the following jobs that were automatically triggered:
pingcap/tidb/ghpr_buildpingcap/tidb/ghpr_checkpingcap/tidb/ghpr_check2pingcap/tidb/ghpr_mysql_testpingcap/tidb/ghpr_unit_testpingcap/tidb/pull_integration_ddl_testpingcap/tidb/pull_mysql_client_test
In response to this:
/retest unit-test
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.
@ghazalfamilyusa: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.
In response to this:
/retest unit-test
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.
/test unit_test
@ghazalfamilyusa: The specified target(s) for /test were not found.
The following commands are available to trigger required jobs:
/test build/test check-dev/test check-dev2/test mysql-test/test pull-br-integration-test/test pull-integration-ddl-test/test pull-lightning-integration-test/test pull-mysql-client-test/test unit-test
The following commands are available to trigger optional jobs:
/test canary-notify-when-compatibility-sections-changed/test pingcap/tidb/canary_ghpr_unit_test/test pull-common-test/test pull-e2e-test/test pull-integration-common-test/test pull-integration-copr-test/test pull-integration-jdbc-test/test pull-integration-mysql-test/test pull-integration-nodejs-test/test pull-sqllogic-test/test pull-tiflash-test
Use /test all to run the following jobs that were automatically triggered:
pingcap/tidb/ghpr_buildpingcap/tidb/ghpr_checkpingcap/tidb/ghpr_check2pingcap/tidb/ghpr_mysql_testpingcap/tidb/ghpr_unit_testpingcap/tidb/pull_integration_ddl_testpingcap/tidb/pull_mysql_client_test
In response to this:
/test unit_test
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.
@ghazalfamilyusa: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.
In response to this:
/test unit_test
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.
/test unit-test
@ghazalfamilyusa: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.
In response to this:
/test unit-test
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.
/test unit_test
@ghazalfamilyusa: The specified target(s) for /test were not found.
The following commands are available to trigger required jobs:
/test build/test check-dev/test check-dev2/test mysql-test/test pull-br-integration-test/test pull-integration-ddl-test/test pull-lightning-integration-test/test pull-mysql-client-test/test unit-test
The following commands are available to trigger optional jobs:
/test canary-notify-when-compatibility-sections-changed/test pingcap/tidb/canary_ghpr_unit_test/test pull-common-test/test pull-e2e-test/test pull-integration-common-test/test pull-integration-copr-test/test pull-integration-jdbc-test/test pull-integration-mysql-test/test pull-integration-nodejs-test/test pull-sqllogic-test/test pull-tiflash-test
Use /test all to run the following jobs that were automatically triggered:
pingcap/tidb/ghpr_buildpingcap/tidb/ghpr_checkpingcap/tidb/ghpr_check2pingcap/tidb/ghpr_mysql_testpingcap/tidb/ghpr_unit_testpingcap/tidb/pull_integration_ddl_testpingcap/tidb/pull_mysql_client_test
In response to this:
/test unit_test
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.
@ghazalfamilyusa: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.
In response to this:
/test unit_test
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.
BTW, your linked issue is incorrect. Could you please link a correct issue? If there is no related issue, it will better to create a new issue for this PR ~
BTW, your linked issue is incorrect. Could you please link a correct issue? If there is no related issue, it will better to create a new issue for this PR ~
Done : https://github.com/pingcap/tidb/issues/53278
[LGTM Timeline notifier]
Timeline:
/retest