-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
adding avro schema #1917
adding avro schema #1917
Conversation
@mgodave please review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At least for Avro it would be good to have schema validation since it explicitely supports that.
pulsar-client/pom.xml
Outdated
<dependency> | ||
<groupId>org.apache.avro</groupId> | ||
<artifactId>avro</artifactId> | ||
<version>1.8.2</version> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Version should be defined in top-level pom
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
@merlimat if you try a to deserialize a object with not the expected schema, an exception will be thrown |
retest this please |
It needs to prevent from creating a producer if the topic has a different schema. Otherwise it's not a "schema" but just a "serde" |
@mgodave please review it. |
I don't think there is a path to do a validation for now, unless I am not wrong. @mgodave ? I think we should do the validation in a separate PR, more I think we need to think validation along with how SQL use schema registry. |
I think there should be some kind of validation already for JSON. Also we need to validate that the schema is there. eg: topic is set to Avro, a producer cannot connect and send "bytes". Avro has a way to extract schema info. That is what should be stored in the registry. Otherwise the whole "registry" part is completely useless.
Yes, if we don't store the "type" info, we cannot getting that back and discover how the data looks like |
I think this PR already store the type info, no? It does same work as json schema. or I am missing something here? |
Sure, though I'm not sure where the validation is being done. We should have few unit tests to verify the behavior. eg what happens when :
|
@mgodave can you comment on this question? and do we have the test coverage? |
@sijie I think that in any case, the validation would have to be done in server side, comparing the schema from producer and the latest schema from registry |
I mean: Avro specific validation on the server side |
I image there should be a validation method in the the validation should be part of |
Implement |
by default everything is "compatible", adding the checker allows you to customize that behavior. |
retest this please |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change LGTM. when the question on the tests is resolved it should be good to go
@merlimat I have shaded the avro dependences. Please check if I got them all |
@@ -86,6 +86,14 @@ | |||
<include>org.apache.httpcomponents:httpclient</include> | |||
<include>commons-logging:commons-logging</include> | |||
<include>org.apache.httpcomponents:httpcore</include> | |||
<include>org.apache.avro:avro</include> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jerrypeng there's also pulsar-client-kafka :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yup forgot you said that one as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
No description provided.