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

expression: fix wrong result when convert float to unsigned #53590

Merged
merged 4 commits into from
May 28, 2024

Conversation

guo-shaoge
Copy link
Collaborator

@guo-shaoge guo-shaoge commented May 27, 2024

What problem does this PR solve?

Issue Number: close #41736

Problem Summary:

  1. When compare int column with non int constant, will convert non int constant to int
  2. This logic is used to check if underflow happens when convert to int, which requires we should set result as zero when convert X to unsigned int
  3. But ConvertFloatToUint will not obey this requirement when AllowNegativeToUnsigned is disabled.

PS: what does AllowNegativeToUnsigned mean, check description here

What changed and how does it work?

Disable AllowNegativeToUnsigned when conversion happens when compare int column with non int constant.

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.

expression: fix wrong result when convert float to unsigned

@ti-chi-bot ti-chi-bot bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels May 27, 2024
Copy link

tiprow bot commented May 27, 2024

Hi @guo-shaoge. 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.

Signed-off-by: guo-shaoge <[email protected]>
Copy link

codecov bot commented May 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 74.7312%. Comparing base (c333f39) to head (d52311d).
Report is 11 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #53590        +/-   ##
================================================
+ Coverage   72.3985%   74.7312%   +2.3326%     
================================================
  Files          1505       1507         +2     
  Lines        430553     436380      +5827     
================================================
+ Hits         311714     326112     +14398     
+ Misses        99509      90192      -9317     
- Partials      19330      20076       +746     
Flag Coverage Δ
integration 49.6948% <100.0000%> (?)

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

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

@guo-shaoge
Copy link
Collaborator Author

/retest

Copy link

tiprow bot commented May 27, 2024

@guo-shaoge: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/retest

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.

Signed-off-by: guo-shaoge <[email protected]>
@guo-shaoge guo-shaoge requested a review from wshwsh12 May 27, 2024 13:02
Signed-off-by: guo-shaoge <[email protected]>
@ti-chi-bot ti-chi-bot bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels May 28, 2024
@SeaRise
Copy link
Contributor

SeaRise commented May 28, 2024

/cc @SeaRise

@ti-chi-bot ti-chi-bot bot requested a review from SeaRise May 28, 2024 02:34
Copy link
Contributor

@SeaRise SeaRise left a comment

Choose a reason for hiding this comment

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

Sadly, this bug also appeared on tiflash

@ti-chi-bot ti-chi-bot bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label May 28, 2024
@guo-shaoge
Copy link
Collaborator Author

guo-shaoge commented May 28, 2024

Sadly, this bug also appeared on tiflash

After this fix, tiflash will be ok. Because this fix happens during plan generation, so tilflash will receive correct plan after this fix. (verified using this fix and it's ok)

@guo-shaoge
Copy link
Collaborator Author

/retest

Copy link

tiprow bot commented May 28, 2024

@guo-shaoge: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/retest

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.

@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels May 28, 2024
Copy link

ti-chi-bot bot commented May 28, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-05-28 02:52:52.72958136 +0000 UTC m=+2744926.486716928: ☑️ agreed by SeaRise.
  • 2024-05-28 05:05:52.516742324 +0000 UTC m=+2752906.273877897: ☑️ agreed by wshwsh12.

@wshwsh12
Copy link
Contributor

/ok-to-test

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

tiprow bot commented May 28, 2024

@guo-shaoge: 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
fast_test_tiprow d52311d 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
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 May 28, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: SeaRise, windtalker, wshwsh12

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
Copy link
Member

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

@ti-chi-bot
Copy link
Member

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

ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request May 28, 2024
@ti-chi-bot
Copy link
Member

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

ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request May 28, 2024
@ti-chi-bot
Copy link
Member

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

ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request May 28, 2024
@ti-chi-bot
Copy link
Member

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

ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request May 28, 2024
@ti-chi-bot ti-chi-bot added needs-cherry-pick-release-6.5 Should cherry pick this PR to release-6.5 branch. needs-cherry-pick-release-6.1 Should cherry pick this PR to release-6.1 branch. labels May 28, 2024
@ti-chi-bot
Copy link
Member

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

ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request May 28, 2024
@ti-chi-bot
Copy link
Member

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

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-5.3 Type: Need cherry pick to release-5.3 needs-cherry-pick-release-5.4 Should cherry pick this PR to release-5.4 branch. needs-cherry-pick-release-6.1 Should cherry pick this PR to release-6.1 branch. needs-cherry-pick-release-6.5 Should cherry pick this PR to release-6.5 branch. needs-cherry-pick-release-7.1 Should cherry pick this PR to release-7.1 branch. needs-cherry-pick-release-7.5 Should cherry pick this PR to release-7.5 branch. needs-cherry-pick-release-8.1 Should cherry pick this PR to release-8.1 branch. ok-to-test Indicates a PR is ready to be tested. release-note Denotes a PR that will be considered when it comes time to generate release notes. 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.

An incorrect query result
5 participants