avro
avro copied to clipboard
AVRO-3254: Automatically scale up or down decimal values when serializing
Make sure you have checked all steps below.
Jira
- [X] My PR addresses the following Avro Jira issues and references them in the PR title.
- https://issues.apache.org/jira/browse/AVRO-3254
Tests
- [X] My PR adds the following unit tests OR does not need testing for this extremely good reason:
- TestDecimalScalesDown
- TestDecimalScalesDownToZero
- TestDecimalScalesUp
- TestAvroDecimalReScaling (65 test cases)
Commits
- [X] My commits all reference Jira issues in their subject lines. In addition, my commits follow the guidelines from "How to write a good git commit message":
- Subject is separated from body by a blank line
- Subject is limited to 50 characters (not including Jira issue reference)
- Subject does not end with a period
- Subject uses the imperative mood ("add", not "adding")
- Body wraps at 72 characters
- Body explains "what" and "why", not "how"
Documentation
- [X] In case of new functionality, my PR adds documentation that describes how to use it.
- All the public functions and the classes in the PR contain ~Javadoc~ xml doc that explain what it does
Hello! I have a quick concern about this PR -- modifying the scale of an AvroDecimal makes it no longer equal to its old value, so the serialize/deserialize would make the datum, or any record containing the datum (for example), no longer equal to its original value.
I would be worried that this would have some unexpected side effects. Any thoughts?
We should take a look at what the other SDKs are doing.