VStreamer Events: remove preceding zeroes from decimals in Row Events#7297
Merged
rohit-nayak-ps merged 3 commits intovitessio:masterfrom Jan 19, 2021
Merged
Conversation
Signed-off-by: Rohit Nayak <rohit@planetscale.com>
Signed-off-by: Rohit Nayak <rohit@planetscale.com>
systay
approved these changes
Jan 15, 2021
shlomi-noach
approved these changes
Jan 17, 2021
Contributor
shlomi-noach
left a comment
There was a problem hiding this comment.
Just for completeness, can we add a unit test for a negative -0000000001.23 value?
Signed-off-by: Rohit Nayak <rohit@planetscale.com>
| `commit`, | ||
| }, { | ||
| `begin`, | ||
| `type:ROW row_event:<table_name:"vitess_decimal" row_changes:<after:<lengths:1 lengths:6 lengths:6 values:"31.23001.2300" > > > `, |
Contributor
There was a problem hiding this comment.
I guess its because I do not understand the encodings, but 31.23001.2300 is mightily confusing to me. What separates the values?
Contributor
There was a problem hiding this comment.
Ah, skip that. solved by lengths 1, 6, 6
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.
Description
Currently in VStreamer ROW Events, Decimal numbers get prefix-padded with 0s when precision is greater than 12.
e.g. for a value of 1.23, DECIMAL(12,2) gives 1.23, DECIMAL(13,2) gives 000000001.23
This PR removes these extra 0s so, for the example above, we return 1.23 for DECIMAL(13,2)
Related Issue(s)
#7282
Checklist
Impacted Areas in Vitess