the-other-tim-brown commented on code in PR #14314:
URL: https://github.com/apache/hudi/pull/14314#discussion_r2554401763
##########
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:
I'll switch to `getNonNullType`. I forgot to update this branch after the
other one was merged.
--
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]