Skip to content

Conversation

time-and-fate
Copy link
Member

@time-and-fate time-and-fate commented Apr 21, 2025

What problem does this PR solve?

Issue Number: close #60692

Problem Summary:

As said in the issue, sometimes the FullSchema may contain outdated Columns after the projection elimination.

We should have fixed the FullSchema, but considering the long-standing problems in schema maintenance and column pruning in tidb, we can't make sure we won't introduce any new risk.
This PR is likely to be cherry-picked to the LTS version quickly. So it's better to just restore the previous checking logic, i.e., use the Schema() to do the check.

What changed and how does it work?

Add back what's been removed in #51057 in (*LogicalJoin).ExtractUsedCols().

Check List

Tests

  • 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

@ti-chi-bot ti-chi-bot bot added release-note-none Denotes a PR that doesn't merit a release note. sig/planner SIG: Planner size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Apr 21, 2025
@time-and-fate time-and-fate requested a review from Copilot April 21, 2025 20:26
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR restores the previous logic in LogicalJoin by bringing back the usage of each child’s Schema (via FullSchema) when checking for used columns, addressing cases where outdated columns may persist after projection elimination.

  • Introduces local variables lFullSchema and rFullSchema to capture children’s FullSchema.
  • Adjusts conditional checks to consider both the original Schema and FullSchema for column containment.
Files not reviewed (2)
  • tests/integrationtest/r/planner/core/issuetest/planner_issue.result: Language not supported
  • tests/integrationtest/t/planner/core/issuetest/planner_issue.test: Language not supported

Copy link

codecov bot commented Apr 21, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 74.0250%. Comparing base (8b75529) to head (249cb7a).
Report is 15 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #60694        +/-   ##
================================================
+ Coverage   73.1255%   74.0250%   +0.8994%     
================================================
  Files          1716       1716                
  Lines        475616     479130      +3514     
================================================
+ Hits         347797     354676      +6879     
+ Misses       106435     103055      -3380     
- Partials      21384      21399        +15     
Flag Coverage Δ
integration 42.9359% <100.0000%> (?)
unit 72.9041% <100.0000%> (+0.5588%) ⬆️

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

Components Coverage Δ
dumpling 52.6553% <ø> (ø)
parser ∅ <ø> (∅)
br 47.5997% <ø> (+0.1812%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ti-chi-bot ti-chi-bot bot added approved needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Apr 22, 2025
Copy link

ti-chi-bot bot commented Apr 23, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: AilinKid, winoros

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 lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Apr 23, 2025
Copy link

ti-chi-bot bot commented Apr 23, 2025

[LGTM Timeline notifier]

Timeline:

  • 2025-04-22 04:02:48.507792862 +0000 UTC m=+328312.319583242: ☑️ agreed by winoros.
  • 2025-04-23 06:40:44.302886913 +0000 UTC m=+424188.114677494: ☑️ agreed by AilinKid.

@AilinKid
Copy link
Contributor

/retest-required

@time-and-fate
Copy link
Member Author

/retest

@ti-chi-bot ti-chi-bot bot merged commit 55a1fa2 into pingcap:master Apr 23, 2025
23 of 24 checks passed
@time-and-fate
Copy link
Member Author

/cherry-pick release-8.5

ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request Apr 23, 2025
@ti-chi-bot
Copy link
Member

@time-and-fate: new pull request created to branch release-8.5: #60738.
But this PR has conflicts, please resolve them!

In response to this:

/cherry-pick release-8.5

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 ti-community-infra/tichi repository.

ti-chi-bot bot pushed a commit that referenced this pull request Apr 25, 2025
Kiran01bm pushed a commit to Kiran01bm/tidb that referenced this pull request Apr 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm release-note-none Denotes a PR that doesn't merit a release note. sig/planner SIG: Planner size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

tidb reports "Can't find column" error from v8.5.0 when there are multiple joins in the query
4 participants