opwvhk commented on a change in pull request #1584:
URL: https://github.com/apache/avro/pull/1584#discussion_r834611439
##########
File path: lang/java/avro/src/main/java/org/apache/avro/Conversions.java
##########
@@ -77,11 +78,20 @@ public String getLogicalTypeName() {
@Override
public BigDecimal fromCharSequence(CharSequence value, Schema schema,
LogicalType type) {
- return new BigDecimal(value.toString());
+ BigDecimal result = new BigDecimal(value.toString());
+ int scale = ((LogicalTypes.Decimal) type).getScale();
+ if (result.scale() != scale) {
Review comment:
👍
Looks good. One could allow scale increases this was as well ( <= instead of
!= ), but this is less magical.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]