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


##########
hudi-common/src/main/java/org/apache/hudi/internal/schema/convert/AvroInternalSchemaConverter.java:
##########
@@ -510,4 +525,68 @@ private static int computeMinBytesForPrecision(int 
precision) {
     }
     return numBytes;
   }
+
+  /**
+   * Checks if a logical type is an instance of LocalTimestampMillis using 
reflection.
+   * Returns false if the class doesn't exist (e.g., in Avro 1.8.2).
+   */
+  private static boolean isLocalTimestampMillis(LogicalType logicalType) {
+    if (logicalType == null) {
+      return false;
+    }
+    try {
+      Class<?> localTimestampMillisClass = 
Class.forName("org.apache.avro.LogicalTypes$LocalTimestampMillis");
+      return localTimestampMillisClass.isInstance(logicalType);
+    } catch (ClassNotFoundException e) {
+      // Class doesn't exist (e.g., Avro 1.8.2)
+      return false;
+    }
+  }
+
+  /**
+   * Checks if a logical type is an instance of LocalTimestampMicros using 
reflection.
+   * Returns false if the class doesn't exist (e.g., in Avro 1.8.2).
+   */
+  private static boolean isLocalTimestampMicros(LogicalType logicalType) {
+    if (logicalType == null) {
+      return false;
+    }
+    try {
+      Class<?> localTimestampMicrosClass = 
Class.forName("org.apache.avro.LogicalTypes$LocalTimestampMicros");

Review Comment:
   Done.



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