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



##########
File path: 
hudi-flink/src/main/java/org/apache/hudi/util/AvroSchemaConverter.java
##########
@@ -244,10 +244,13 @@ public static Schema convertToSchema(LogicalType 
logicalType, String rowName) {
         return nullable ? nullableSchema(time) : time;
       case DECIMAL:
         DecimalType decimalType = (DecimalType) logicalType;
-        // store BigDecimal as byte[]
+        // store BigDecimal as Fixed
+        // for spark compatibility.
         Schema decimal =
             LogicalTypes.decimal(decimalType.getPrecision(), 
decimalType.getScale())
-                .addToSchema(SchemaBuilder.builder().bytesType());
+                .addToSchema(SchemaBuilder
+                    .fixed(String.format("%s.fixed", rowName))
+                    
.size(computeMinBytesForDecimlPrecision(decimalType.getPrecision())));

Review comment:
       Thanks for the fix, can this type be read through Hive directly ? There 
is also some type compatibility for Spark & Hive decimal types.




-- 
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: commits-unsubscr...@hudi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to