pitrou commented on code in PR #1291:
URL: https://github.com/apache/parquet-mr/pull/1291#discussion_r1516619298


##########
parquet-column/src/main/java/org/apache/parquet/column/values/bytestreamsplit/ByteStreamSplitValuesReaderForDouble.java:
##########
@@ -18,20 +18,15 @@
  */
 package org.apache.parquet.column.values.bytestreamsplit;
 
-import org.apache.parquet.bytes.BytesUtils;
+import static org.apache.parquet.bytes.BytesUtils.bytesToLong;
 
 public class ByteStreamSplitValuesReaderForDouble extends 
ByteStreamSplitValuesReader {
-
-  private final byte[] valueByteBuffer;
-
   public ByteStreamSplitValuesReaderForDouble() {
     super(Double.BYTES);
-    valueByteBuffer = new byte[Double.BYTES];
   }
 
   @Override
   public double readDouble() {
-    gatherElementDataFromStreams(valueByteBuffer);
-    return Double.longBitsToDouble(BytesUtils.bytesToLong(valueByteBuffer));
+    return 
Double.longBitsToDouble(bytesToLong(readElement().getBytesUnsafe()));

Review Comment:
   `getBytesUnsafe` is doing a copy here, but to a very small array. I don't 
know enough about JVM performance to decide if this is a problem or not. 
@gszadovszky Do you have any idea or suggestion?
   
   (the underlying problem is that `ByteBuffer` and `Binary` have different 
limitations in their respective APIs, and whether we want to use one or the 
other depends on which data type we want to convert to :-))



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