-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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 ExtractCorrelatedCols method in PhysicalTableScan #51205
Conversation
Hi @Lloyd-Pottiger. Thanks for your PR. PRs from untrusted users cannot be marked as trusted with 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. |
please update the "Problem Summary" and "Release note" |
done |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #51205 +/- ##
=================================================
- Coverage 70.6268% 54.1562% -16.4706%
=================================================
Files 1467 1576 +109
Lines 434809 605291 +170482
=================================================
+ Hits 307092 327803 +20711
- Misses 108517 254591 +146074
- Partials 19200 22897 +3697
Flags with carried forward coverage won't be shown. Click here to find out more.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
pkg/planner/core/physical_plans.go
Outdated
@@ -935,13 +936,16 @@ func (ts *PhysicalTableScan) Clone() (PhysicalPlan, error) { | |||
|
|||
// ExtractCorrelatedCols implements PhysicalPlan interface. | |||
func (ts *PhysicalTableScan) ExtractCorrelatedCols() []*expression.CorrelatedColumn { | |||
corCols := make([]*expression.CorrelatedColumn, 0, len(ts.AccessCondition)+len(ts.filterCondition)) | |||
corCols := make([]*expression.CorrelatedColumn, 0, len(ts.AccessCondition)+len(ts.filterCondition)+len(ts.LateMaterializationFilterCondition)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add the tests for it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
pkg/planner/core/physical_plans.go
Outdated
@@ -935,13 +936,16 @@ func (ts *PhysicalTableScan) Clone() (PhysicalPlan, error) { | |||
|
|||
// ExtractCorrelatedCols implements PhysicalPlan interface. | |||
func (ts *PhysicalTableScan) ExtractCorrelatedCols() []*expression.CorrelatedColumn { | |||
corCols := make([]*expression.CorrelatedColumn, 0, len(ts.AccessCondition)+len(ts.filterCondition)) | |||
corCols := make([]*expression.CorrelatedColumn, 0, len(ts.AccessCondition)+len(ts.filterCondition)+len(ts.LateMaterializationFilterCondition)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will CorrelatedCols be explicit in explan plan?
If so maybe a ut can be added.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
/hold |
[LGTM Timeline notifier]Timeline:
|
/retest |
@Lloyd-Pottiger: Cannot trigger testing until a trusted user reviews the PR and leaves an In response to this:
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. |
@@ -437,3 +437,57 @@ func TestPhysicalPlanMemoryTrace(t *testing.T) { | |||
pp.MPPPartitionCols = append(pp.MPPPartitionCols, &property.MPPPartitionColumn{}) | |||
require.Greater(t, pp.MemoryUsage(), size) | |||
} | |||
|
|||
func TestPhysicalTableScanExtractCorrelatedCols(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we just use json output file to compare the whole physical plan? It is hard to see what is the purpose of this test case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can add some comments.
It is only used to test ExtractCorrelatedCols
, compare the whole plan do not meet our needs.
/unhold |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: fixdb, SeaRise, windtalker 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 |
In response to a cherrypick label: new pull request created to branch |
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
In response to a cherrypick label: new pull request created to branch |
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
…d in PhysicalTableScan (pingcap#887) * planner: fix ExtractCorrelatedCols method in PhysicalTableScan (pingcap#51205) (pingcap#51227) close pingcap#51204 * make check Signed-off-by: zzm <zhouzemin@pingcap.com> * gctuner: make TestIssue48741 more stable (pingcap#49430) --------- Signed-off-by: zzm <zhouzemin@pingcap.com> Co-authored-by: Ti Chi Robot <ti-community-prow-bot@tidb.io> Co-authored-by: Hangjie Mo <mohangjie1995@gmail.com>
What problem does this PR solve?
Issue Number: close #51204
Problem Summary:
What changed and how does it work?
Before, we do not try to extract correlated column in LateMaterializationFilterCondition. So when the correlated columns only in LateMaterializationFilterCondition, exprs failed to fill in correlated column with constant value during Plan2Pb, and it leads to wrong query result.
Now, in ExtractCorrelatedCols method, we will also try to extract correlated column in LateMaterializationFilterCondition.
Also fix other methods.
Check List
Currently, integration test do not support TiFlash, so I will add tests in https://github.com/pingcap/tiflash
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.