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 2018/12/08 23:33:07 UTC

[GitHub] jerrypeng commented on a change in pull request #3146: Use raw message when manually parsing messages from topic storage

jerrypeng commented on a change in pull request #3146: Use raw message when manually parsing messages from topic storage
URL: https://github.com/apache/pulsar/pull/3146#discussion_r240019573
 
 

 ##########
 File path: pulsar-sql/presto-pulsar/src/main/java/org/apache/pulsar/sql/presto/JSONSchemaHandler.java
 ##########
 @@ -35,24 +39,43 @@
 
     private final DslJson<Object> dslJson = new DslJson<>();
 
+    private static final FastThreadLocal<byte[]> tmpBuffer = new FastThreadLocal<byte[]>() {
+        @Override
+        protected byte[] initialValue() {
+            return new byte[1024];
+        }
+    };
+
     public JSONSchemaHandler(List<PulsarColumnHandle> columnHandles) {
         this.columnHandles = columnHandles;
     }
 
     @Override
-    public Object deserialize(byte[] bytes) {
+    public Object deserialize(ByteBuf payload) {
+        // Since JSON deserializer only works on a byte[] we need to convert a direct mem buffer into
+        // a byte[].
+        int size = payload.readableBytes();
 
 Review comment:
   Why we do not do the same thing here as in the AvroSchemaHandler?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services