You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2021/09/07 21:26:22 UTC

[GitHub] [kafka] C0urante commented on pull request #10566: KAFKA-12694 Avoid schema mismatch DataException when validating default values

C0urante commented on pull request #10566:
URL: https://github.com/apache/kafka/pull/10566#issuecomment-914640232


   Hey Gunnar! Sorry for the delay.
   
   > Initializing a Struct with a builder rather than a Schema seems to be an odd thing to do, no?
   
   Indeed it is rather odd, but it's still possible at the moment and I've definitely seen it in use (intentionally or otherwise...) in at least one fairly large and popular code base. If we can avoid breaking projects that use this pattern (strange as it is) I think that'd be best.
   
   I haven't spent too much time thinking about a clean solution but it's at least possible to satisfy both cases with the following:
   - The change proposed in this PR
   - The change I proposed above where the order of schemas in the comparison in `ConnectSchema::validateValue` is reversed
   - The `ConnectSchema::equals` method is altered to accept any `Schema` instance and only operate on the public methods exposed by the `Schema` interface instead of internal variables for comparison of the schemas' fields, key schema, and value schema
   
   This would be fairly involved for such a small bug so hopefully there's something less invasive out there, but at least it's possible to favor one use case without compromising the other.
   
   As an alternative, could the connector use the `SchemaBuilder` when instantiating the `Struct` object, instead of calling `build` and using a `ConnectSchema`?


-- 
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-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org