You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2022/07/26 04:04:16 UTC

[GitHub] [pulsar] congbobo184 commented on a diff in pull request #16659: [schema][client][improve] Add decode InputStream for Schema

congbobo184 commented on code in PR #16659:
URL: https://github.com/apache/pulsar/pull/16659#discussion_r929493209


##########
pulsar-client/src/main/java/org/apache/pulsar/client/impl/MessageImpl.java:
##########
@@ -489,9 +490,9 @@ private T decodeBySchema(byte[] schemaVersion) {
             return value;
         }
         if (null == schemaVersion) {
-            return schema.decode(getData());
+            return schema.decode(new ReadonlyByteBufInputStream(payload));

Review Comment:
   why should we change this logic?
   
   https://github.com/apache/pulsar/blob/176418765eed3775758a1293217ca5928b47579b/pulsar-client/src/main/java/org/apache/pulsar/client/impl/schema/AbstractStructSchema.java#L70-L72
   
   has changed this to `ByteBufInputStream` right?



##########
pulsar-client/src/main/java/org/apache/pulsar/client/impl/MessageImpl.java:
##########
@@ -489,9 +490,9 @@ private T decodeBySchema(byte[] schemaVersion) {
             return value;
         }
         if (null == schemaVersion) {
-            return schema.decode(getData());
+            return schema.decode(new ReadonlyByteBufInputStream(payload));
         } else {
-            return schema.decode(getData(), schemaVersion);
+            return schema.decode(new ReadonlyByteBufInputStream(payload), schemaVersion);

Review Comment:
   same above



-- 
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: commits-unsubscribe@pulsar.apache.org

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