linliu-code commented on code in PR #17601:
URL: https://github.com/apache/hudi/pull/17601#discussion_r2738880490


##########
hudi-common/src/main/java/org/apache/hudi/avro/AvroSchemaUtils.java:
##########
@@ -471,4 +494,15 @@ public static Schema asNullable(Schema schema) {
         (change, field) -> change.updateColumnNullability(field, true));
     return convert(SchemaChangeUtils.applyTableChanges2Schema(internalSchema, 
schemaChange), schema.getFullName());
   }
+
+  public static Schema getRepairedSchema(Schema writerSchema, Schema 
readerSchema) {
+    try {
+      Class<?> avroSchemaRepairClass = 
Class.forName("org.apache.parquet.schema.AvroSchemaRepair");
+      Method repairMethod = 
avroSchemaRepairClass.getMethod("repairLogicalTypes", Schema.class, 
Schema.class);
+      return (Schema) repairMethod.invoke(null, writerSchema, readerSchema);

Review Comment:
   For static method, the first parameter is ignored. So either null or 
avroSchemaRepairClass should both work.



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