yihua commented on code in PR #13714:
URL: https://github.com/apache/hudi/pull/13714#discussion_r2272227135


##########
hudi-common/src/main/java/org/apache/hudi/avro/HoodieAvroUtils.java:
##########
@@ -1434,10 +1437,18 @@ public static boolean 
recordNeedsRewriteForExtendedAvroTypePromotion(Schema writ
         return needsRewriteToString(writerSchema, true);
       case STRING:
       case BYTES:
+      case FIXED:
+        if (readerSchema.getLogicalType() != null) {
+          // check if logical types are equal
+          return 
!readerSchema.getLogicalType().equals(writerSchema.getLogicalType());
+        }
         return needsRewriteToString(writerSchema, false);
       case DOUBLE:
         // To maintain precision, you need to convert Float -> String -> Double
-        return writerSchema.getType().equals(Schema.Type.FLOAT);
+        return writerSchema.getType().equals(Schema.Type.FLOAT) && 
!writerSchema.getType().equals(Schema.Type.STRING);
+      case INT:
+      case LONG:
+        return writerSchema.getType().equals(Schema.Type.STRING);

Review Comment:
   What I'm trying to understand is, before this PR the `INT->STRING` and 
`LONG->STRING` are not considered for rewrite.  Is it because the Avro reader 
or writer automatically does the type promotion or cast/conversion in other 
places, or it does not work before?  Trying to see if this is necessary, since 
such rewrite adds additional overhead.



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