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: Fix mpp join column prune added projection incorrect construction #52943

Merged
merged 1 commit into from
Apr 28, 2024

Conversation

yibin87
Copy link
Contributor

@yibin87 yibin87 commented Apr 28, 2024

What problem does this PR solve?

Issue Number: ref #52828

Problem Summary:
In #52836, we added missing "hashCols" to the added projection's schema, since they may be needed by potential type cast projection. However, the way we added is somewhat problemtic, we directly added from the hashCols instead of HashJoin's output schema:

proj.SetSchema(p.Schema().Clone())
for _, hashCol := range hashColArray {
if !proj.Schema().Contains(hashCol) {
proj.Exprs = append(proj.Exprs, hashCol)
proj.Schema().Append(hashCol)
}
}

While from the existing getProj implementation, we need to add from child executor's schema, and cloned it also(not sure if it is needed), since inside the schema.Clone() function column is cloned actually:
func getProj(ctx base.PlanContext, p base.PhysicalPlan) *PhysicalProjection {
proj := PhysicalProjection{
Exprs: make([]expression.Expression, 0, len(p.Schema().Columns)),
}.Init(ctx, p.StatsInfo(), p.QueryBlockOffset())
for _, col := range p.Schema().Columns {
proj.Exprs = append(proj.Exprs, col)
}
proj.SetSchema(p.Schema().Clone())
proj.SetChildren(p)
return proj
}

After fixing this, we can pass all tiflash's randgen mpp tests in both normal and non-broadcast join mode.

What changed and how does it work?

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • Manully test all tiflash randgen mpp tests, compile and execute without any errors.
  • 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

Signed-off-by: yibin <huyibin@pingcap.com>
@ti-chi-bot ti-chi-bot bot added do-not-merge/needs-tests-checked release-note-none sig/planner SIG: Planner size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Apr 28, 2024
Copy link

tiprow bot commented Apr 28, 2024

Hi @yibin87. 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.

@yibin87
Copy link
Contributor Author

yibin87 commented Apr 28, 2024

/cc @windtalker @SeaRise

@ti-chi-bot ti-chi-bot bot requested review from SeaRise and windtalker April 28, 2024 01:28
@yibin87
Copy link
Contributor Author

yibin87 commented Apr 28, 2024

/cc @winoros

Copy link

codecov bot commented Apr 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 56.0366%. Comparing base (c73d6c5) to head (0de9e15).
Report is 5 commits behind head on master.

Additional details and impacted files
@@                Coverage Diff                @@
##             master     #52943         +/-   ##
=================================================
- Coverage   72.4412%   56.0366%   -16.4047%     
=================================================
  Files          1482       1593        +111     
  Lines        428430     601166     +172736     
=================================================
+ Hits         310360     336873      +26513     
- Misses        98853     241315     +142462     
- Partials      19217      22978       +3761     
Flag Coverage Δ
integration 37.6194% <0.0000%> (?)
unit 71.5114% <100.0000%> (+0.1865%) ⬆️

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

Components Coverage Δ
dumpling 53.9957% <ø> (ø)
parser ∅ <ø> (∅)
br 49.8794% <ø> (+8.6751%) ⬆️

Copy link
Contributor

@windtalker windtalker left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link

ti-chi-bot bot commented Apr 28, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-04-28 01:58:35.416831271 +0000 UTC m=+149669.173966845: ☑️ agreed by SeaRise.
  • 2024-04-28 02:05:51.954683531 +0000 UTC m=+150105.711819101: ☑️ agreed by windtalker.

@yibin87
Copy link
Contributor Author

yibin87 commented Apr 28, 2024

/cc @AilinKid

@ti-chi-bot ti-chi-bot bot requested a review from AilinKid April 28, 2024 03:36
Copy link

ti-chi-bot bot commented Apr 28, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: AilinKid, 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 /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 Apr 28, 2024
@yibin87
Copy link
Contributor Author

yibin87 commented Apr 28, 2024

/test unit-test

Copy link

tiprow bot commented Apr 28, 2024

@yibin87: 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/test-infra repository.

@yibin87
Copy link
Contributor Author

yibin87 commented Apr 28, 2024

/test unit-test

Copy link

tiprow bot commented Apr 28, 2024

@yibin87: 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/test-infra repository.

@yibin87
Copy link
Contributor Author

yibin87 commented Apr 28, 2024

/test unit-test

Copy link

tiprow bot commented Apr 28, 2024

@yibin87: 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/test-infra repository.

@ti-chi-bot ti-chi-bot bot merged commit cbbfb23 into pingcap:master Apr 28, 2024
21 of 23 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 sig/planner SIG: Planner size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants