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 predicate simplification panic caused by zero-argument expressions like rand() #56947

Merged
merged 1 commit into from
Nov 14, 2024

Conversation

dash12653
Copy link
Contributor

What problem does this PR solve?

Issue Number: close #56270

Problem Summary:

What changed and how does it work?

When checking predicate type in predicate simplification, it will use arg[0] to judge if the arg is *expression.Column, however, "rand()" has 0 argument, which will lead a panic.

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 labels Oct 29, 2024
Copy link

ti-chi-bot bot commented Oct 29, 2024

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.

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 added needs-ok-to-test Indicates a PR created by contributors and need ORG member send '/ok-to-test' to start testing. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Oct 29, 2024
Copy link

tiprow bot commented Oct 29, 2024

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.

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.

@lance6716
Copy link
Contributor

/ok-to-test

@ti-chi-bot ti-chi-bot bot added ok-to-test Indicates a PR is ready to be tested. and removed needs-ok-to-test Indicates a PR created by contributors and need ORG member send '/ok-to-test' to start testing. labels Oct 29, 2024
Copy link

codecov bot commented Oct 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 58.6565%. Comparing base (c32c7b2) to head (91bed62).
Report is 201 commits behind head on master.

Additional details and impacted files
@@                Coverage Diff                @@
##             master     #56947         +/-   ##
=================================================
- Coverage   73.3374%   58.6565%   -14.6810%     
=================================================
  Files          1638       1801        +163     
  Lines        453738     665866     +212128     
=================================================
+ Hits         332760     390574      +57814     
- Misses       100578     251338     +150760     
- Partials      20400      23954       +3554     
Flag Coverage Δ
integration 38.9389% <100.0000%> (?)
unit 74.6726% <0.0000%> (+2.1192%) ⬆️

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

Components Coverage Δ
dumpling 55.2602% <ø> (+2.3124%) ⬆️
parser ∅ <ø> (∅)
br 52.9699% <ø> (+6.9710%) ⬆️
---- 🚨 Try these New Features:

@ti-chi-bot ti-chi-bot bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Oct 29, 2024
@dash12653
Copy link
Contributor Author

/retest

@dash12653 dash12653 changed the title planner: set *expression.ScalarFunction which has 0 argument to 'otherPredicate' in findingPredicateType() planner: classify no-argument scalar functions as 'other predicate' in predicate simplification within findingPredicateType() Oct 30, 2024
@dash12653 dash12653 changed the title planner: classify no-argument scalar functions as 'other predicate' in predicate simplification within findingPredicateType() planner: Fix predicate simplification panic caused by zero-argument expressions like rand() Nov 1, 2024
@ti-chi-bot ti-chi-bot bot added approved lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Nov 14, 2024
Copy link

ti-chi-bot bot commented Nov 14, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-10-29 08:36:39.389562318 +0000 UTC m=+338912.228717865: ☑️ agreed by lance6716.
  • 2024-11-14 07:43:06.793431048 +0000 UTC m=+514948.984300044: ☑️ agreed by AilinKid.

Copy link

ti-chi-bot bot commented Nov 14, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: AilinKid, hawkingrei, lance6716

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 merged commit ed2d749 into pingcap:master Nov 14, 2024
23 checks passed
@dash12653 dash12653 deleted the tidb-56270-2 branch November 15, 2024 08:13
@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 22, 2024
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-8.5: #57618.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm 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/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.

runtime error: index out of range [0] with length 0 by RAND()
5 participants