urbandan commented on PR #10566: URL: https://github.com/apache/kafka/pull/10566#issuecomment-1452111290
@C0urante I'm also hesitant to change the API, but I think this part of the API is broken. If we tweak ConnectSchema::equals to use the Schema interface methods, then setting the default value on the SchemaBuilder will work, but then Struct::equals will stop working on default values. Assume that ConnectSchema::equals uses the Schema methods, and we write this code: ` SchemaBuilder builder = SchemaBuilder.struct() .field("f1", Schema.BOOLEAN_SCHEMA); Struct defaultValue = new Struct(builder); defaultValue.put("f1", true); Schema finalSchema = builder.defaultValue(defaultValue).build(); Struct anotherValue = new Struct(finalSchema); anotherValue.put("f1", true); assertEquals(defaultValue, anotherValue); assertEquals(anotherValue, defaultValue); ` The first assert fails (defaultValue has a SchemaBuilder instance as the schema, which doesn't have an equals override, so defaultValue.schema.equals(anotherValue.schema) is false). The second assert never exits, it's infinite recursion (anotherValue has a ConnectSchema instance as the schema, which checks the default value for equality, which then checks the schema equality, and so on). To me, the tweak doesn't seem like a proper fix. -- 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: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org