jonvex commented on code in PR #13595:
URL: https://github.com/apache/hudi/pull/13595#discussion_r2229351486
##########
hudi-common/src/main/java/org/apache/hudi/internal/schema/utils/AvroSchemaEvolutionUtils.java:
##########
@@ -214,5 +215,32 @@ public static Schema reconcileSchemaRequirements(Schema
sourceSchema, Schema tar
return
convert(SchemaChangeUtils.applyTableChanges2Schema(sourceInternalSchema,
schemaChange), sourceSchema.getFullName());
}
+
+ /**
+ * Checks if the schema evolution is just making a field nullable.
+ *
+ * @param tableFieldSchema the original field schema
+ * @param writerFieldSchema the new field schema
+ * @return true if this is just a nullable evolution, false otherwise
+ */
+ public static boolean isNullableEvolution(Schema tableFieldSchema, Schema
writerFieldSchema) {
+ // Check if writer schema is nullable but table schema is not
+ if (!AvroSchemaUtils.isNullable(tableFieldSchema) &&
AvroSchemaUtils.isNullable(writerFieldSchema)) {
Review Comment:
Can you use AvroSchemaUtils.resolveNullableSchema? I think that does pretty
much the same as what follows here
--
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]