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: mark the both side operand of NAAJ & refuse partial column substitute in projection elimination of Apply de-correlation #37117

Merged

Conversation

AilinKid
Copy link
Contributor

@AilinKid AilinKid commented Aug 16, 2022

Signed-off-by: AilinKid 314806019@qq.com

What problem does this PR solve?

Issue Number: close #37032

Problem Summary:
two problems mainly:
1: in the projection elimination of Apply decorrelate rule, we try to substitute any condition used in Apply with raw projected expression under this projection, after which this projection can be eliminated. But we should make sure
that all columns mapped from the schema of projection OP must be substituted atomically (all succeed or fail).

2: Consider an EQ condition converted from NOT IN OP (NAAJ), in which we used to mark the right side column of this "NA" EQ as InOperand=true. In some cases like columns substitution as we talked about above, cases like:

(a NA EQ b (marked InOperand=true ) ) where b will be substituted with like a constant string, so we got (a NA EQ "example" ), this condition will not be considered as a NA EQ condition anymore and will be moved from other condition to equal condition of join OP in the logical rule of pddResolver .

What is changed and how it works?

1: NAAJ is not just about one side, mark both as inOperand=true. so even the right has successfully been substituted with a constant string, we can also get (a (marked InOperand=true) NA EQ "example" ) as a NA EQ in the other condition.

2: make the column substitution atomically (all succeed or fail) in projection elimination of Apply decorrelation.

Check List

Tests

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

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.

make the both side operand of NAAJ & refuse partial column substitute in projection elimination

… in projection elimination

Signed-off-by: AilinKid <314806019@qq.com>
@ti-chi-bot
Copy link
Member

ti-chi-bot commented Aug 16, 2022

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • time-and-fate
  • winoros

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

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

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-bot added needs-cherry-pick-4.0 needs-cherry-pick-release-5.0 needs-cherry-pick-release-5.1 needs-cherry-pick-release-5.2 needs-cherry-pick-release-5.3 Type: Need cherry pick to release-5.3 needs-cherry-pick-release-5.4 Should cherry pick this PR to release-5.4 branch. needs-cherry-pick-release-6.1 Should cherry pick this PR to release-6.1 branch. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Aug 16, 2022
@AilinKid AilinKid changed the title make the both side operand of NAAJ & refuse partial column substitute in projection elimination planner: make the both side operand of NAAJ & refuse partial column substitute in projection elimination Aug 16, 2022
@sre-bot
Copy link
Contributor

sre-bot commented Aug 16, 2022

Please follow PR Title Format:

  • pkg [, pkg2, pkg3]: what is changed

Or if the count of mainly changed packages are more than 3, use

  • *: what is changed

After you have format title, you can leave a comment /run-check_title to recheck it

@ti-chi-bot
Copy link
Member

ti-chi-bot commented Aug 16, 2022

@AilinKid AilinKid requested a review from winoros August 16, 2022 03:44
@hawkingrei
Copy link
Member

/run-build

@AilinKid AilinKid changed the title planner: make the both side operand of NAAJ & refuse partial column substitute in projection elimination planner: mark the both side operand of NAAJ & refuse partial column substitute in projection elimination Aug 16, 2022
@AilinKid AilinKid changed the title planner: mark the both side operand of NAAJ & refuse partial column substitute in projection elimination planner: mark the both side operand of NAAJ & refuse partial column substitute in projection elimination of Apply de-correlation Aug 16, 2022
@hawkingrei
Copy link
Member

[2022-08-16T03:55:46.307Z] planner/core/expression_rewriter.go:940:6: ineffectual assignment to larg (ineffassign)

[2022-08-16T03:55:46.307Z] planner/core/logical_plans.go:396:58: should use make([]*expression.ScalarFunction, len(p.EqualConditions)) instead (S1019)

[2022-08-16T03:55:46.307Z] planner/core/rule_decorrelate.go:174:63: should use make([]expression.Expression, len(proj.Exprs)) instead (S1019)

@AilinKid Please fix linter.

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

cherry pick to release-4.0 in PR #37346

ti-srebot pushed a commit to ti-srebot/tidb that referenced this pull request Aug 24, 2022
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
ti-srebot pushed a commit to ti-srebot/tidb that referenced this pull request Aug 24, 2022
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
@ti-srebot
Copy link
Contributor

cherry pick to release-5.0 in PR #37347

ti-srebot pushed a commit to ti-srebot/tidb that referenced this pull request Aug 24, 2022
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
@ti-srebot
Copy link
Contributor

cherry pick to release-5.1 in PR #37348

@ti-srebot
Copy link
Contributor

cherry pick to release-5.2 in PR #37349

ti-srebot pushed a commit to ti-srebot/tidb that referenced this pull request Aug 24, 2022
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
ti-srebot pushed a commit to ti-srebot/tidb that referenced this pull request Aug 24, 2022
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
@ti-srebot
Copy link
Contributor

cherry pick to release-5.3 in PR #37350

ti-srebot pushed a commit to ti-srebot/tidb that referenced this pull request Aug 24, 2022
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
@ti-srebot
Copy link
Contributor

cherry pick to release-5.4 in PR #37351

ti-srebot pushed a commit to ti-srebot/tidb that referenced this pull request Aug 24, 2022
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
@ti-srebot
Copy link
Contributor

cherry pick to release-6.0 in PR #37352

ti-srebot pushed a commit to ti-srebot/tidb that referenced this pull request Aug 24, 2022
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
@ti-srebot
Copy link
Contributor

cherry pick to release-6.1 in PR #37354

@sre-bot
Copy link
Contributor

sre-bot commented Aug 24, 2022

TiDB MergeCI notify

CI Name Result Duration Compare with Parent commit
idc-jenkins-ci/integration-cdc-test 🟢 all 36 tests passed 29 min Existing passed
idc-jenkins-ci-tidb/integration-common-test 🟢 all 17 tests passed 18 min Existing passed
idc-jenkins-ci-tidb/common-test 🟢 all 11 tests passed 14 min Existing passed
idc-jenkins-ci-tidb/integration-ddl-test 🟢 all 6 tests passed 7 min 30 sec Existing passed
idc-jenkins-ci-tidb/sqllogic-test-2 🟢 all 28 tests passed 7 min 9 sec Existing passed
idc-jenkins-ci-tidb/tics-test 🟢 all 1 tests passed 6 min 51 sec Existing passed
idc-jenkins-ci-tidb/sqllogic-test-1 🟢 all 26 tests passed 6 min 1 sec Existing passed
idc-jenkins-ci-tidb/integration-compatibility-test 🟢 all 1 tests passed 4 min 33 sec Existing passed
idc-jenkins-ci-tidb/mybatis-test 🟢 all 1 tests passed 3 min 40 sec Existing passed
idc-jenkins-ci-tidb/plugin-test 🟢 build success, plugin test success 4min Existing passed

ti-srebot pushed a commit to ti-srebot/tidb that referenced this pull request Aug 24, 2022
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
@ti-srebot
Copy link
Contributor

cherry pick to release-6.2 in PR #37357

ti-chi-bot pushed a commit that referenced this pull request Jan 18, 2023
…ubstitute in projection elimination of Apply de-correlation (#37117) (#37354)

close #37032
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-cherry-pick-release-5.0 needs-cherry-pick-release-5.1 needs-cherry-pick-release-5.2 needs-cherry-pick-release-5.3 Type: Need cherry pick to release-5.3 needs-cherry-pick-release-5.4 Should cherry pick this PR to release-5.4 branch. needs-cherry-pick-release-6.1 Should cherry pick this PR to release-6.1 branch. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Got can't find column error when IN/NOT IN is used
8 participants