belugabehr commented on a change in pull request #754:
URL: https://github.com/apache/orc/pull/754#discussion_r671935567



##########
File path: java/core/src/java/org/apache/orc/impl/DynamicByteArray.java
##########
@@ -294,6 +295,16 @@ public void setByteBuffer(ByteBuffer result, int offset, 
int length) {
     return result;
   }
 
+  public ByteBuffer get(int offset, int length) {
+    final int currentChunk = offset / chunkSize;
+    final int currentOffset = offset % chunkSize;
+    final int currentLength = Math.min(length, chunkSize - currentOffset);
+    if (currentLength == length) {
+      return ByteBuffer.wrap(data[currentChunk], currentOffset, length);

Review comment:
       This is the "win" right here.  If the data requested is contiguous 
within a single data chunk, then a view to the data can be returned without 
needing to copy into a buffer.




-- 
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: dev-unsubscr...@orc.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to