codelipenghui commented on a change in pull request #6325: KeyValue schema 
support for pulsar sql
URL: https://github.com/apache/pulsar/pull/6325#discussion_r379236938
 
 

 ##########
 File path: 
pulsar-sql/presto-pulsar/src/main/java/org/apache/pulsar/sql/presto/PulsarRecordCursor.java
 ##########
 @@ -418,7 +421,16 @@ public boolean advanceNextPosition() {
         //start time for deseralizing record
         metricsTracker.start_RECORD_DESERIALIZE_TIME();
 
-        currentRecord = 
this.schemaHandler.deserialize(this.currentMessage.getData());
+        if (this.schemaHandler instanceof KeyValueSchemaHandler) {
+            ByteBuf keyByteBuf = null;
+            if (this.currentMessage.getKey().isPresent()) {
+                keyByteBuf = Unpooled.wrappedBuffer(
+                        
Base64.getDecoder().decode(this.currentMessage.getKey().get()));
+            }
 
 Review comment:
   We can get the `keyBytes` by  `message.getKeyBytes()`, so that you don't 
need to decode a String by base64 decoder.

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