You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hive.apache.org by GitBox <gi...@apache.org> on 2019/02/24 07:36:14 UTC

[GitHub] ZhangXinJason opened a new pull request #548: HIVE-21313: Use faster method to prevent copying bytes twice

ZhangXinJason opened a new pull request #548: HIVE-21313: Use faster method to prevent copying bytes twice
URL: https://github.com/apache/hive/pull/548
 
 
   In file ql/src/java/org/apache/hadoop/hive/ql/exec/vector/VectorAssignRow.java
   We may find code like this:
   ```
   Text text = (Text) convertTargetWritable;
   if (text == null)
   {     text = new Text(); }
   text.set(string);
   ((BytesColumnVector) columnVector).setVal(
       batchIndex, text.getBytes(), 0, text.getLength());
   ```
    
   Using `setVal` method can copy the bytes array generated by `text.getBytes()`. This is totally unnecessary at all. Since the bytes array is immutable, we can just use `setRef` method to point to the specific  byte array, which will also lower the memory usage.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services