jonvex commented on code in PR #9743:
URL: https://github.com/apache/hudi/pull/9743#discussion_r1365729896
##########
hudi-common/src/main/java/org/apache/hudi/avro/AvroSchemaUtils.java:
##########
@@ -116,9 +116,24 @@ public static String getAvroRecordQualifiedName(String
tableName) {
return "hoodie." + sanitizedTableName + "." + sanitizedTableName +
"_record";
}
+ /**
+ * Validate whether the {@code targetSchema} is a valid evolution of {@code
sourceSchema}.
+ * Basically {@link #isCompatibleProjectionOf(Schema, Schema)} but type
promotion in the
+ * opposite direction
+ */
+ public static boolean isValidEvolutionOf(Schema sourceSchema, Schema
targetSchema) {
+ return (sourceSchema.getType() == Schema.Type.NULL) ||
isProjectionOfInternal(sourceSchema, targetSchema,
+ AvroSchemaUtils::isAtomicSchemasCompatibleEvolution);
+ }
+
+ private static boolean isAtomicSchemasCompatibleEvolution(Schema
oneAtomicType, Schema anotherAtomicType) {
+ // NOTE: Checking for compatibility of atomic types, we should ignore their
+ // corresponding fully-qualified names (as irrelevant)
Review Comment:
I don't know. I copied that from below:
```
private static boolean isAtomicSchemasCompatible(Schema oneAtomicType,
Schema anotherAtomicType) {
// NOTE: Checking for compatibility of atomic types, we should ignore
their
// corresponding fully-qualified names (as irrelevant)
return isSchemaCompatible(oneAtomicType, anotherAtomicType, false, true);
}
```
--
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]