-
Notifications
You must be signed in to change notification settings - Fork 31
Fixing encoding of decimals ending in .0 or 0.0 #115
Conversation
Sorry, because you closed the first PR I assumed this was the same as #112, but it doesn't look like that. |
@@ -2,7 +2,6 @@ | |||
|
|||
require 'bigdecimal' | |||
|
|||
|
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.
Please avoid committing unrelated whitespace changes, it makes PRs so much harder to read. This is just a general comment, obviously a single line isn't a big deal.
Thanks again for the PR and for finding this bug. Good catch. If you fix the small comments I added to the diff I'll merge this as soon as I get the time. Do you need a new gem release soon? |
Yes, I'll fix those. Thanks for the quick reply! A new gem release would be great when you get a chance.
|
I can get one out tomorrow tonight or tomorrow morning. |
Awesome. Tomorrow whenever is great. I fixed those issues, let me know if you have any other comments.
|
Looking at this code now I realize how much of a hack it is. Can you help me come up with a better way of doing this without going through I'll merge this when I can, regardless, but it would be great to have something better for the future. |
It is pretty hacky. I'll look at the docs and try to come up with some alternate solutions.
|
Found an error where storing a BigDecimal ending in .0 or 00.0 would not store/retrieve correctly.
Traced this to the append_decimal method of CqlByteBuffer
Example:
Encoding a BigDecimal of 1042342234234.0 would result in a decoded decimal of -57169393542.0
Encoding a BigDecimal of 12000.0 was unable to be decoded