gaoran10 commented on a change in pull request #9631:
URL: https://github.com/apache/pulsar/pull/9631#discussion_r580848095



##########
File path: 
pulsar-sql/presto-pulsar/src/main/java/org/apache/pulsar/sql/presto/PulsarRecordCursor.java
##########
@@ -441,9 +442,11 @@ public boolean advanceNextPosition() {
         //start time for deseralizing record
         metricsTracker.start_RECORD_DESERIALIZE_TIME();
 
-        SchemaInfo schemaInfo;
+        SchemaInfo schemaInfo = 
getBytesSchemaInfo(pulsarSplit.getSchemaType(), pulsarSplit.getSchemaName());

Review comment:
       This method may cause the exception `java.nio.BufferUnderflowException`.
   
   ```
   private SchemaInfo loadSchema(BytesSchemaVersion bytesSchemaVersion) throws 
PulsarAdminException {
       ClassLoader originalContextLoader = 
Thread.currentThread().getContextClassLoader();
       try {
           
Thread.currentThread().setContextClassLoader(InjectionManagerFactory.class.getClassLoader());
           return pulsarAdmin.schemas()
                   .getSchemaInfo(topicName.toString(), 
ByteBuffer.wrap(bytesSchemaVersion.get()).getLong());
       } finally {
           Thread.currentThread().setContextClassLoader(originalContextLoader);
       }
   }
   ```
   
   The schema version of `Schema.BYTES` is an empty bytes array. So 
`ByteBuffer.wrap(bytesSchemaVersion.get()).getLong()` will cause the exception 
`java.nio.BufferUnderflowException`.




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


Reply via email to