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



##########
File path: java/core/src/java/org/apache/orc/impl/StringHashTableDictionary.java
##########
@@ -120,6 +122,11 @@ public void getText(Text result, int positionInKeyOffset) {
     DictionaryUtils.getTextInternal(result, positionInKeyOffset, 
this.keyOffsets, this.byteArray);
   }
 
+  @Override
+  public ByteBuffer getText(int positionInKeyOffset) {
+    return DictionaryUtils.getTextInternal(positionInKeyOffset, 
this.keyOffsets, this.byteArray);
+  }

Review comment:
       Hey @kbendick,
   
   > Is it safe to be exporting this ByteBuffer? If it is reused / overwritten 
in some way, will that affect any of the existing code.
   
   I guess everyone has a different scale of what "safe" is.  If your concern 
is regarding the callers changing values in the returned ByteBuffer affected 
the data stored in the Dictionary, then yes, that is a possibility right now.  
There are two ways to handle that:
   
   1. Document this behavior and assume the caller will handle the data 
responsibly
   2. Return a read-only `ByteBuffer` which will prevent callers from modifying 
the data
   
   I'm not sure I understand the second part of your question.




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