sijie commented on a change in pull request #4211: 
[issue#4155][pulsar-clients]Support key value schema versioning
URL: https://github.com/apache/pulsar/pull/4211#discussion_r281460309
 
 

 ##########
 File path: 
pulsar-client/src/main/java/org/apache/pulsar/client/impl/schema/KeyValueSchema.java
 ##########
 @@ -97,6 +103,46 @@ private KeyValueSchema(Schema<K> keySchema,
         this.keySchema = keySchema;
         this.valueSchema = valueSchema;
 
+        if (keySchema instanceof StructSchema) {
+            ((StructSchema) keySchema).setSchemaInfoProvider(new 
SchemaInfoProvider() {
+                @Override
+                public SchemaInfo getSchemaByVersion(byte[] schemaVersion) {
+                    SchemaInfo versionSchemaInfo = 
schemaInfoProvider.getSchemaByVersion(schemaVersion);
+                    return 
decodeKeyValueSchemaInfo(versionSchemaInfo).getKey();
+                }
+
+                @Override
+                public SchemaInfo getLatestSchema() {
+                    return null;
 
 Review comment:
   get the latest schema or use the key schema passed in the constructor.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to