Open dash12653 opened 1 day ago
[APPROVALNOTIFIER] This PR is NOT APPROVED
This pull-request has been approved by: Once this PR has been reviewed and has the lgtm label, please assign winoros for approval. For more information see the Code Review Process.
The full list of commands accepted by this bot can be found here.
Hi @dash12653. Thanks for your PR.
I'm waiting for a pingcap member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test
on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.
Once the patch is verified, the new status will be reflected by the ok-to-test
label.
I understand the commands that are listed here.
Hi @dash12653. 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.
/ok-to-test
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 73.3545%. Comparing base (
91c14a4
) to head (35e8289
). Report is 3 commits behind head on master.
🚨 Try these New Features:
What problem does this PR solve?
Issue Number: close #57390
Problem Summary:
What changed and how does it work?
This is the plan:
When tidb encounters an
IN subquery
, it tries to rewrite the outer table and subquery asINNER JOIN
.https://github.com/pingcap/tidb/blob/c091dba89718599dc1b3d3e45f9b0308a8d49ef0/pkg/planner/core/expression_rewriter.go#L1226-L1242
When rewriting
OR expressions
(e.g., (c1 OR c1)), the kernel will convert the type of c1 toDOUBLE
.https://github.com/pingcap/tidb/blob/c091dba89718599dc1b3d3e45f9b0308a8d49ef0/pkg/expression/builtin_cast.go#L2556-L2568
The join's condition is
(c1 OR c1) = c1
.We can check the output of the join condition for the left and right tables after converting INNER JOIN.
left output:
right output:
After the
DISTINCT
operation,CAST(c1 AS DOUBLE)
actually causes data duplication, which will lead to unexpected results forin operation
.To address this, I add a restriction who will check if the left expression is or function in the conditions for converting to an INNER JOIN.
Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.