-
Notifications
You must be signed in to change notification settings - Fork 2k
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
VStreamer Events: remove preceding zeroes from decimals in Row Events #7297
VStreamer Events: remove preceding zeroes from decimals in Row Events #7297
Conversation
Signed-off-by: Rohit Nayak <rohit@planetscale.com>
Signed-off-by: Rohit Nayak <rohit@planetscale.com>
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.
Just for completeness, can we add a unit test for a negative -0000000001.23
value?
Signed-off-by: Rohit Nayak <rohit@planetscale.com>
@@ -1610,6 +1612,16 @@ func TestTypes(t *testing.T) { | |||
`type:ROW row_event:<table_name:"vitess_decimal" row_changes:<after:<lengths:1 lengths:7 lengths:7 values:"2-1.2300-1.2300" > > > `, | |||
`gtid`, | |||
`commit`, | |||
}, { | |||
`begin`, | |||
`type:ROW row_event:<table_name:"vitess_decimal" row_changes:<after:<lengths:1 lengths:6 lengths:6 values:"31.23001.2300" > > > `, |
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.
I guess its because I do not understand the encodings, but 31.23001.2300
is mightily confusing to me. What separates the values?
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.
Ah, skip that. solved by lengths
1, 6, 6
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