pitrou commented on code in PR #1291:
URL: https://github.com/apache/parquet-mr/pull/1291#discussion_r1516934511
##########
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:
(note to self:
https://spotcodereviews.com/articles/optimization/2021/03/15/does-the-jvm-eliminate-allocations-of-temporary-objects.html
has an interesting discussion of array allocation elision)
--
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]