You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@orc.apache.org by GitBox <gi...@apache.org> on 2021/08/23 13:55:24 UTC

[GitHub] [orc] pgaref commented on a change in pull request #754: ORC-852: Allow DynamicByteArray to Return a ByteBuffer

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



##########
File path: java/core/src/java/org/apache/orc/impl/DictionaryUtils.java
##########
@@ -46,6 +47,18 @@ public static void getTextInternal(Text result, int position,
     byteArray.setText(result, offset, length);
   }
 
+  public static ByteBuffer getTextInternal(int position, DynamicIntArray keyOffsets,
+      DynamicByteArray byteArray) {
+    final int offset = keyOffsets.get(position);
+    final int length;
+    if (position + 1 == keyOffsets.size()) {
+      length = byteArray.size() - offset;
+    } else {
+      length = keyOffsets.get(position + 1) - offset;
+    }

Review comment:
       Length calculation is repeated at least 5 times already -- lets move this to a helper function

##########
File path: java/core/src/java/org/apache/orc/impl/DictionaryUtils.java
##########
@@ -46,6 +47,18 @@ public static void getTextInternal(Text result, int position,
     byteArray.setText(result, offset, length);
   }
 
+  public static ByteBuffer getTextInternal(int position, DynamicIntArray keyOffsets,

Review comment:
       Shall we name this explicitly getTexBuffertInternal ?

##########
File path: java/core/src/java/org/apache/orc/impl/Dictionary.java
##########
@@ -52,6 +53,8 @@
    */
   void getText(Text result, int position);
 
+  ByteBuffer getText(int position);

Review comment:
       maybe name getTextBuffer instead?




-- 
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-unsubscribe@orc.apache.org

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