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: make query case-insensitive for infoschema tables #56989

Closed
wants to merge 8 commits into from

Conversation

joechenrh
Copy link
Contributor

@joechenrh joechenrh commented Oct 30, 2024

What problem does this PR solve?

Issue Number: close #56987 ref #50305

Problem Summary:

What changed and how does it work?

  1. There is no need to store lower and upper functions in pushedDownFuncs since infoschema tables are case-insensitive.
  2. For those predicates can't be pushed down, rewrite them to do comparation using lower case.

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. do-not-merge/needs-triage-completed sig/planner SIG: Planner size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Oct 30, 2024
Copy link

tiprow bot commented Oct 30, 2024

Hi @joechenrh. 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-sigs/prow repository.

Copy link

codecov bot commented Oct 30, 2024

Codecov Report

Attention: Patch coverage is 92.00000% with 8 lines in your changes missing coverage. Please review.

Project coverage is 73.6070%. Comparing base (248000c) to head (8c5cfa4).
Report is 145 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #56989        +/-   ##
================================================
+ Coverage   73.2196%   73.6070%   +0.3874%     
================================================
  Files          1650       1672        +22     
  Lines        455460     483660     +28200     
================================================
+ Hits         333486     356008     +22522     
- Misses       101497     106353      +4856     
- Partials      20477      21299       +822     
Flag Coverage Δ
integration 43.3489% <85.0000%> (?)
unit 72.2362% <92.0000%> (-0.2645%) ⬇️

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

Components Coverage Δ
dumpling 52.7673% <ø> (-0.1806%) ⬇️
parser ∅ <ø> (∅)
br 44.3342% <ø> (-1.6457%) ⬇️
---- 🚨 Try these New Features:

@ti-chi-bot ti-chi-bot bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Oct 31, 2024
Copy link

ti-chi-bot bot commented Oct 31, 2024

[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.

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

@joechenrh joechenrh changed the title planner: make pattern match case-insensitive for some infoschema tables planner: make query case-insensitive for infoschema tables Nov 1, 2024
@joechenrh
Copy link
Contributor Author

/ok-to-test

@ti-chi-bot ti-chi-bot bot added the ok-to-test Indicates a PR is ready to be tested. label Nov 1, 2024
Copy link
Member

@CbcWestwolf CbcWestwolf left a comment

Choose a reason for hiding this comment

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

This PR should be merged with adding a clarification in the documentation to let the user know infoschema tables are case-insensitive in some scenarios and the rewriting makes the execution plan different

Comment on lines 215 to 220
rewrited := make([]expression.Expression, 0, len(remained))
for _, expr := range remained {
newExpr := e.convertToLowerInExpression(ctx, expr)
rewrited = append(rewrited, newExpr)
}
return rewrited
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
rewrited := make([]expression.Expression, 0, len(remained))
for _, expr := range remained {
newExpr := e.convertToLowerInExpression(ctx, expr)
rewrited = append(rewrited, newExpr)
}
return rewrited
for i, expr := range remained {
remained[i] = e.convertToLowerInExpression(ctx, expr)
}
return

func extractColumn(
expr expression.Expression,
supportPushdown bool,
) (*expression.Column, bool) {
Copy link
Member

Choose a reason for hiding this comment

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

The 2nd return value seems unnecessary.

ctx base.PlanContext,
extractCols map[int64]*types.FieldName,
expr *expression.ScalarFunction,
) (string, []types.Datum) {
var (
scalarIdx = 1
Copy link
Member

Choose a reason for hiding this comment

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

Should the variable name be constIdx?

@ti-chi-bot ti-chi-bot bot added the needs-cherry-pick-release-8.5 Should cherry pick this PR to release-8.5 branch. label Nov 13, 2024
Copy link

tiprow bot commented Nov 18, 2024

@joechenrh: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
tidb_parser_test 8c5cfa4 link true /test tidb_parser_test
fast_test_tiprow 8c5cfa4 link true /test fast_test_tiprow

Full PR test history. Your PR dashboard.

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-sigs/prow repository. I understand the commands that are listed here.

Copy link

ti-chi-bot bot commented Nov 18, 2024

@joechenrh: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
idc-jenkins-ci-tidb/check_dev_2 8c5cfa4 link true /test check-dev2

Full PR test history. Your PR dashboard.

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. I understand the commands that are listed here.

@joechenrh joechenrh closed this Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-cherry-pick-release-8.5 Should cherry pick this PR to release-8.5 branch. ok-to-test Indicates a PR is ready to be tested. release-note-none Denotes a PR that doesn't merit a release note. sig/planner SIG: Planner size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

information_schema.tables return wrong results with count(*)
2 participants