Fix handling of FLOAT(p), FLOAT(m,d) and DECIMAL(m,0) types esp. w.r.t. Restore()#311
Merged
Fix handling of FLOAT(p), FLOAT(m,d) and DECIMAL(m,0) types esp. w.r.t. Restore()#311
Conversation
6c37450 to
4895aa8
Compare
* FLOAT(50,4) should not automatically become a DOUBLE, it is just a FLOAT shown with 50 digits. * FLOAT(0) and FLOAT(24) are the alias of the same type FLOAT. There is no need to record the Flen.
Contributor
Author
|
PTAL @tiancaiamao |
Codecov Report
@@ Coverage Diff @@
## master #311 +/- ##
=======================================
Coverage 53.37% 53.37%
=======================================
Files 31 31
Lines 6540 6540
=======================================
Hits 3491 3491
Misses 2707 2707
Partials 342 342
Continue to review full report at Codecov.
|
Collaborator
|
LGTM |
tiancaiamao
pushed a commit
to tiancaiamao/parser
that referenced
this pull request
Apr 27, 2021
…t. Restore() (pingcap#311) * parser: fix handling of FLOAT(p) and FLOAT(m,d) types * FLOAT(50,4) should not automatically become a DOUBLE, it is just a FLOAT shown with 50 digits. * FLOAT(0) and FLOAT(24) are the alias of the same type FLOAT. There is no need to record the Flen. * types: fix Restore of DECIMAL(m,0) types * tests: add test cases
lyonzhi
pushed a commit
to lyonzhi/parser
that referenced
this pull request
Apr 25, 2024
…t. Restore() (pingcap#311) * parser: fix handling of FLOAT(p) and FLOAT(m,d) types * FLOAT(50,4) should not automatically become a DOUBLE, it is just a FLOAT shown with 50 digits. * FLOAT(0) and FLOAT(24) are the alias of the same type FLOAT. There is no need to record the Flen. * types: fix Restore of DECIMAL(m,0) types * tests: add test cases
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What problem does this PR solve?
DECIMAL(20,0)is restored incorrectly asDECIMAL#310 regardingRestore()ofFLOAT(m,0),DOUBLE(m,0)andDECIMAL(m,0).FLOAT(m,d)is always aFLOAT, never aDOUBLE.FLOAT(0)toFLOAT(24)map to the sameFLOAT, and all ofFLOAT(25)toFLOAT(53)map to the sameDOUBLE.What is changed and how it works?
(*FieldType).Restore()such that all types share the sameTp(m,d)restore logic (exceptTIME(d)and friends).FloatingPointTypeto distinguish between theFLOAT(m,d)andFLOAT(p)cases.Tp(m,d)for the rest of types.Check List
Tests
Code changes
Side effects
FLOAT(24,1)produces aFLOATinstead of aDOUBLE, matching behavior of MySQL 8 (but note thatFLOAT(m,d)is deprecated since MySQL 8.0.17).Related changes