danny0405 commented on a change in pull request #3837:
URL: https://github.com/apache/hudi/pull/3837#discussion_r733468279



##########
File path: hudi-common/src/main/java/org/apache/hudi/avro/HoodieAvroUtils.java
##########
@@ -546,8 +546,11 @@ private static Object 
convertValueForAvroLogicalTypes(Schema fieldSchema, Object
         return decimalConversion.fromFixed((GenericFixed) fieldValue, 
fieldSchema,
             LogicalTypes.decimal(dc.getPrecision(), dc.getScale()));
       } else if (fieldSchema.getType() == Schema.Type.BYTES) {
-        return decimalConversion.fromBytes((ByteBuffer) fieldValue, 
fieldSchema,
-            LogicalTypes.decimal(dc.getPrecision(), dc.getScale()));
+        ByteBuffer byteBuffer = (ByteBuffer) fieldValue;
+        BigDecimal convertedValue = decimalConversion.fromBytes(byteBuffer, 
fieldSchema,
+                LogicalTypes.decimal(dc.getPrecision(), dc.getScale()));
+        byteBuffer.rewind();
+        return convertedValue;

Review comment:
       Nice catch, thanks for the fix.




-- 
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]


Reply via email to