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

Fix cast datetime to decimal wrong result bug #4152

Merged
merged 3 commits into from
Feb 28, 2022

Conversation

guo-shaoge
Copy link
Contributor

@guo-shaoge guo-shaoge commented Feb 28, 2022

Signed-off-by: guo-shaoge shaoge1994@163.com

What problem does this PR solve?

Issue Number: close #4151

Problem Summary:

  1. wrong const multipiler
  2. overflow may hanppens

What is changed and how it works?

  1. correct const multipiler
  2. use Int128 instead of UInt64 if fsp > 0

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

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

Fix the wrong result that occurs when casting `DATETIME` to `DECIMAL` 

Signed-off-by: guo-shaoge <shaoge1994@163.com>
@ti-chi-bot
Copy link
Member

ti-chi-bot commented Feb 28, 2022

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • windtalker

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

The full list of commands accepted by this bot can be found here.

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-bot added do-not-merge/needs-triage-completed 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 Feb 28, 2022
@guo-shaoge
Copy link
Contributor Author

/run-all-tests

@sre-bot
Copy link
Collaborator

sre-bot commented Feb 28, 2022

Coverage for changed files

Filename                                                     Regions    Missed Regions     Cover   Functions  Missed Functions  Executed       Lines      Missed Lines     Cover    Branches   Missed Branches     Cover
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
/build/tics/dbms/src/Functions/FunctionsTiDBConversion.h         794               424    46.60%          76                25    67.11%        1786               602    66.29%         474               317    33.12%
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TOTAL                                                            794               424    46.60%          76                25    67.11%        1786               602    66.29%         474               317    33.12%

Coverage summary

Functions  MissedFunctions  Executed  Lines   MissedLines  Cover
16548      9504             42.57%    182846  96113        47.43%

full coverage report (for internal network access only)

Signed-off-by: guo-shaoge <shaoge1994@163.com>
@guo-shaoge
Copy link
Contributor Author

/run-integration-test

@guo-shaoge
Copy link
Contributor Author

/run-check-issue-triage-complete
/run-unit-test

@ti-chi-bot ti-chi-bot added needs-cherry-pick-release-4.0 PR which needs to be cherry-picked to release-4.0 needs-cherry-pick-release-5.0 PR which needs to be cherry-picked to release-5.0 needs-cherry-pick-release-5.1 PR which needs to be cherry-picked to release-5.1 needs-cherry-pick-release-5.2 PR which needs to be cherry-picked to release-5.2 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. and removed do-not-merge/needs-triage-completed labels Feb 28, 2022
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

@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Feb 28, 2022
@sre-bot
Copy link
Collaborator

sre-bot commented Feb 28, 2022

Coverage for changed files

Filename                                                     Regions    Missed Regions     Cover   Functions  Missed Functions  Executed       Lines      Missed Lines     Cover    Branches   Missed Branches     Cover
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
/build/tics/dbms/src/Functions/FunctionsTiDBConversion.h         794               424    46.60%          76                25    67.11%        1786               602    66.29%         474               317    33.12%
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TOTAL                                                            794               424    46.60%          76                25    67.11%        1786               602    66.29%         474               317    33.12%

Coverage summary

Functions  MissedFunctions  Executed  Lines   MissedLines  Cover
16548      9504             42.57%    182846  96102        47.44%

full coverage report (for internal network access only)

@guo-shaoge
Copy link
Contributor Author

/merge

@ti-chi-bot
Copy link
Member

@guo-shaoge: It seems you want to merge this PR, I will help you trigger all the tests:

/run-all-tests

You only need to trigger /merge once, and if the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes.

If you have any questions about the PR merge process, please refer to pr process.

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

This pull request has been accepted and is ready to merge.

Commit hash: 1fdf3bb

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Feb 28, 2022
@sre-bot
Copy link
Collaborator

sre-bot commented Feb 28, 2022

Coverage for changed files

Filename                                                     Regions    Missed Regions     Cover   Functions  Missed Functions  Executed       Lines      Missed Lines     Cover    Branches   Missed Branches     Cover
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
/build/tics/dbms/src/Functions/FunctionsTiDBConversion.h         794               424    46.60%          76                25    67.11%        1786               602    66.29%         474               317    33.12%
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TOTAL                                                            794               424    46.60%          76                25    67.11%        1786               602    66.29%         474               317    33.12%

Coverage summary

Functions  MissedFunctions  Executed  Lines   MissedLines  Cover
16715      9483             43.27%    186682  95640        48.77%

full coverage report (for internal network access only)

@ti-chi-bot ti-chi-bot merged commit 8a0d000 into pingcap:master Feb 28, 2022
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created: #4155.

@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created: #4156.

ti-chi-bot pushed a commit to ti-chi-bot/tiflash that referenced this pull request Feb 28, 2022
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created: #4157.

@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created: #4158.

ti-chi-bot pushed a commit to ti-chi-bot/tiflash that referenced this pull request Feb 28, 2022
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created: #4159.

@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created: #4160.

@JaySon-Huang JaySon-Huang added the type/bugfix This PR fixes a bug. label Apr 20, 2022
@sre-bot
Copy link
Collaborator

sre-bot commented Apr 20, 2022

Coverage for changed files

Filename                                                                                                    Regions    Missed Regions     Cover   Functions  Missed Functions  Executed       Lines      Missed Lines     Cover    Branches   Missed Branches     Cover
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
/home/jenkins/agent/workspace/tiflash-build-common/tiflash/dbms/src/Functions/FunctionsTiDBConversion.h         794               424    46.60%          76                25    67.11%        1786               602    66.29%         474               317    33.12%
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TOTAL                                                                                                           794               424    46.60%          76                25    67.11%        1786               602    66.29%         474               317    33.12%

Coverage summary

Functions  MissedFunctions  Executed  Lines   MissedLines  Cover
16715      9483             43.27%    186682  95654        48.76%

full coverage report (for internal network access only)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-cherry-pick-release-4.0 PR which needs to be cherry-picked to release-4.0 needs-cherry-pick-release-5.0 PR which needs to be cherry-picked to release-5.0 needs-cherry-pick-release-5.1 PR which needs to be cherry-picked to release-5.1 needs-cherry-pick-release-5.2 PR which needs to be cherry-picked to release-5.2 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. 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. status/can-merge Indicates a PR has been approved by a committer. status/LGT1 Indicates that a PR has LGTM 1. type/bugfix This PR fixes a bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

cast datetime as decimal wrong result
5 participants