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


##########
hudi-common/src/main/java/org/apache/hudi/internal/schema/convert/InternalSchemaConverter.java:
##########
@@ -18,7 +18,10 @@
 
 package org.apache.hudi.internal.schema.convert;
 
-import org.apache.hudi.avro.AvroSchemaUtils;
+import org.apache.hudi.common.schema.HoodieJsonProperties;
+import org.apache.hudi.common.schema.HoodieSchema;
+import org.apache.hudi.common.schema.HoodieSchemaField;
+import org.apache.hudi.common.schema.HoodieSchemaType;

Review Comment:
   Sounds good.



##########
hudi-common/src/main/java/org/apache/hudi/common/schema/HoodieSchema.java:
##########
@@ -384,12 +374,26 @@ public HoodieSchemaType getType() {
   }
 
   /**
-   * Returns the name of this schema, if it has one.
+   * If this is a union schema representing a null, it returns the underlying 
non-null type.
+   * @return the underlying non-null HoodieSchema
+   */
+  public HoodieSchema getUnderlyingType() {
+    if (HoodieSchemaType.UNION == type) {
+      return getTypes().stream()
+          .filter(schema -> schema.getType() != HoodieSchemaType.NULL)
+          .findFirst()
+          .orElseThrow(() -> new IllegalArgumentException("No non-null type 
found in Union"));

Review Comment:
   Got it



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