hive-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Work logged] (HIVE-21313) Use faster function to prevent copying immutable byte array twice
Date Sun, 24 Feb 2019 07:37:00 GMT

     [ https://issues.apache.org/jira/browse/HIVE-21313?focusedWorklogId=203192&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-203192
]

ASF GitHub Bot logged work on HIVE-21313:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 24/Feb/19 07:36
            Start Date: 24/Feb/19 07:36
    Worklog Time Spent: 10m 
      Work Description: ZhangXinJason commented on 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


Issue Time Tracking
-------------------

            Worklog Id:     (was: 203192)
            Time Spent: 10m
    Remaining Estimate: 0h

> Use faster function to prevent copying immutable byte array twice
> -----------------------------------------------------------------
>
>                 Key: HIVE-21313
>                 URL: https://issues.apache.org/jira/browse/HIVE-21313
>             Project: Hive
>          Issue Type: Improvement
>            Reporter: ZhangXin
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> 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 message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message