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 point to instead of copy immutable byte arrays
Date Mon, 25 Feb 2019 10:12:00 GMT

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

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

                Author: ASF GitHub Bot
            Created on: 25/Feb/19 10:11
            Start Date: 25/Feb/19 10:11
    Worklog Time Spent: 10m 
      Work Description: kgyrtkirk commented on pull request #548: HIVE-21313: Use faster method
to prevent copying bytes twice
URL: https://github.com/apache/hive/pull/548#discussion_r259755027
 
 

 ##########
 File path: ql/src/java/org/apache/hadoop/hive/ql/exec/vector/VectorAssignRow.java
 ##########
 @@ -452,11 +452,11 @@ private void assignRowColumn(
           {
             if (object instanceof byte[]) {
               byte[] bytes = (byte[]) object;
-              ((BytesColumnVector) columnVector).setVal(
+              ((BytesColumnVector) columnVector).setRef(
                   batchIndex, bytes, 0, bytes.length);
             } else {
               BytesWritable bw = (BytesWritable) object;
-              ((BytesColumnVector) columnVector).setVal(
+              ((BytesColumnVector) columnVector).setRef(
 
 Review comment:
   I think writeables are usually reused; don't they?
 
----------------------------------------------------------------
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: 203533)
    Time Spent: 20m  (was: 10m)

> Use faster function to point to instead of copy immutable byte arrays
> ---------------------------------------------------------------------
>
>                 Key: HIVE-21313
>                 URL: https://issues.apache.org/jira/browse/HIVE-21313
>             Project: Hive
>          Issue Type: Improvement
>    Affects Versions: All Versions
>            Reporter: ZhangXin
>            Assignee: ZhangXin
>            Priority: Minor
>              Labels: pull-request-available
>             Fix For: All Versions
>
>         Attachments: HIVE-21313.patch, HIVE-21313.patch
>
>          Time Spent: 20m
>  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.
>  
> Pull request on Github:  https://github.com/apache/hive/pull/548
>  
>  
>  
>  
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message