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 incorrect copy of flag in truncate function #55284

Merged
merged 1 commit into from
Nov 15, 2024

Conversation

tuziemon
Copy link
Contributor

@tuziemon tuziemon commented Aug 7, 2024

What problem does this PR solve?

Issue Number: close #53546

Problem Summary:
When truncate([const], NULL) is NULL, truncate([const], NULL) is not NULL evaluates to 1 unexpectedly.
In master, all the flags of arg0 are copied to a truncate function.
If arg0 is a constant, NotNullFlag is copied, leading to an unexpected constant fold.

What changed and how does it work?

Only UnsignedFlag is copied, which is similar behavior to the round function.
round([const], NULL) is also NULL, but round([const], NULL) is not NULL returns 0 as expected, so it is used as the reference.

The root cause of this problem refers to #53546 (comment)

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

ti-chi-bot bot commented Aug 7, 2024

Welcome @tuziemon!

It looks like this is your first PR to pingcap/tidb 🎉.

I'm the bot to help you request reviewers, add labels and more, See available commands.

We want to make sure your contribution gets all the attention it needs!



Thank you, and welcome to pingcap/tidb. 😃

Copy link

ti-chi-bot bot commented Aug 7, 2024

Hi @tuziemon. 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 Aug 7, 2024
Copy link

tiprow bot commented Aug 7, 2024

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

@hawkingrei
Copy link
Member

/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 Aug 8, 2024
Copy link

codecov bot commented Aug 8, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 79.4356%. Comparing base (1ee9efa) to head (b0c3ab1).
Report is 750 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #55284        +/-   ##
================================================
+ Coverage   72.9271%   79.4356%   +6.5084%     
================================================
  Files          1570       1730       +160     
  Lines        439488     534740     +95252     
================================================
+ Hits         320506     424774    +104268     
+ Misses        99314      89512      -9802     
- Partials      19668      20454       +786     
Flag Coverage Δ
integration 52.9330% <100.0000%> (?)
unit 77.2592% <100.0000%> (+5.2912%) ⬆️

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

Components Coverage Δ
dumpling 56.1916% <ø> (+3.2349%) ⬆️
parser ∅ <ø> (∅)
br 54.2903% <ø> (+8.3982%) ⬆️
---- 🚨 Try these New Features:

@tuziemon
Copy link
Contributor Author

@hawkingrei
could you review this pr when you are available?

@XuHuaiyu XuHuaiyu added the type/bugfix This PR fixes a bug. label Nov 15, 2024
@ti-chi-bot ti-chi-bot bot added approved needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Nov 15, 2024
Copy link

ti-chi-bot bot commented Nov 15, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: wshwsh12, XuHuaiyu

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 Nov 15, 2024
Copy link

ti-chi-bot bot commented Nov 15, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-11-15 09:33:53.117906202 +0000 UTC m=+607995.308775199: ☑️ agreed by XuHuaiyu.
  • 2024-11-15 09:38:16.219106931 +0000 UTC m=+608258.409975912: ☑️ agreed by wshwsh12.

@tuziemon
Copy link
Contributor Author

/retest

1 similar comment
@tuziemon
Copy link
Contributor Author

/retest

@ti-chi-bot ti-chi-bot bot merged commit 4272a56 into pingcap:master Nov 15, 2024
23 checks passed
@XuHuaiyu XuHuaiyu added the needs-cherry-pick-release-8.5 Should cherry pick this PR to release-8.5 branch. label Nov 19, 2024
@ti-chi-bot
Copy link
Member

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

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. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. type/bugfix This PR fixes a bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

when truncate(...) is NULL, truncate(...) is not NULL evaluates to 1 unexpectedly
5 participants