-
Notifications
You must be signed in to change notification settings - Fork 489
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 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.
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.
|
LGTM |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…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
…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
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).FloatingPointType
to 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 aFLOAT
instead of aDOUBLE
, matching behavior of MySQL 8 (but note thatFLOAT(m,d)
is deprecated since MySQL 8.0.17).Related changes