in schema-converter/avro-schema-converter/src/main/java/org/apache/rocketmq/schema/avro/AvroData.java [971:1009]
private static boolean schemaEquals(Schema src, Schema that, Map<SchemaPair, Boolean> cache) {
if (src == that) {
return true;
} else if (src == null || that == null) {
return false;
}
SchemaPair sp = new SchemaPair(src, that);
Boolean cacheHit = cache.putIfAbsent(sp, true);
if (cacheHit != null) {
return cacheHit;
}
boolean equals = Objects.equals(src.isOptional(), that.isOptional())
&& Objects.equals(src.getVersion(), that.getVersion())
&& Objects.equals(src.getName(), that.getName())
&& Objects.equals(src.getDoc(), that.getDoc())
&& Objects.equals(src.getFieldType(), that.getFieldType())
&& Objects.deepEquals(src.getDefaultValue(), that.getDefaultValue())
&& Objects.equals(src.getParameters(), that.getParameters());
switch (src.getFieldType()) {
case STRUCT:
equals = equals && fieldListEquals(src.getFields(), that.getFields(), cache);
break;
case ARRAY:
equals = equals && schemaEquals(src.getValueSchema(), that.getValueSchema(), cache);
break;
case MAP:
equals = equals
&& schemaEquals(src.getValueSchema(), that.getValueSchema(), cache)
&& schemaEquals(src.getKeySchema(), that.getKeySchema(), cache);
break;
default:
break;
}
cache.put(sp, equals);
return equals;
}