LuciferYang commented on a change in pull request #35262:
URL: https://github.com/apache/spark/pull/35262#discussion_r797366940



##########
File path: 
sql/core/src/main/java/org/apache/spark/sql/execution/datasources/parquet/VectorizedDeltaLengthByteArrayReader.java
##########
@@ -66,20 +57,18 @@ public void readBinary(int total, WritableColumnVector c, 
int rowId) {
     }
     ByteBuffer buffer;
     ByteBufferOutputWriter outputWriter;
-    if (memoryMode == MemoryMode.OFF_HEAP) {
-      outputWriter = ByteBufferOutputWriter::copyWriteByteBuffer;
-    } else {
-      outputWriter = ByteBufferOutputWriter::writeArrayByteBuffer;
-    }
+    outputWriter = ByteBufferOutputWriter::writeArrayByteBuffer;
     int length;
     for (int i = 0; i < total; i++) {
       length = lengthsVector.getInt(rowId + i);
-      try {
-        buffer = in.slice(length);
-      } catch (EOFException e) {
-        throw new ParquetDecodingException("Failed to read " + length + " 
bytes");
+      if (length > 0) {
+        try {
+          buffer = in.slice(length);
+        } catch (EOFException e) {
+          throw new ParquetDecodingException("Failed to read " + length + " 
bytes");
+        }
+        outputWriter.write(c, rowId + i, buffer, length);
       }
-      outputWriter.write(c, rowId + i, buffer, length);
       currentRow++;

Review comment:
       should we change line72 to `currentRow += total` and move it out of the 
loop?




-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to