sijie commented on a change in pull request #5123: Modify the schema decode 
method can decode ByteBuf
URL: https://github.com/apache/pulsar/pull/5123#discussion_r322407074
 
 

 ##########
 File path: 
pulsar-client/src/main/java/org/apache/pulsar/client/impl/schema/StructSchema.java
 ##########
 @@ -99,6 +108,37 @@ public T decode(byte[] bytes, byte[] schemaVersion) {
         }
     }
 
+    @Override
+    public T decode(ByteBuf byteBuf) {
+        int size = getCanReadSize(byteBuf);
+        return reader.read(tmpBuffer.get(), 0, size);
 
 Review comment:
   I think we should avoid copying the bytes from `ByteBuf` to the tmpBuffer. I 
believe AVRO provides mechanism to read from an input stream. You can convert 
the ByteBuf into an input stream.

----------------------------------------------------------------
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