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 Tue, 09 Jun 2020 16:48:01 GMT

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

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

                Author: ASF GitHub Bot
            Created on: 09/Jun/20 16:47
            Start Date: 09/Jun/20 16:47
    Worklog Time Spent: 10m 
      Work Description: belugabehr commented on a change in pull request #548:
URL: https://github.com/apache/hive/pull/548#discussion_r437556723



##########
File path: ql/src/java/org/apache/hadoop/hive/ql/exec/vector/VectorAssignRow.java
##########
@@ -466,11 +466,11 @@ private void assignRowColumn(
             if (object instanceof String) {
               String string = (String) object;
               byte[] bytes = string.getBytes();

Review comment:
       StringBytes should include the CharSet of UTF8

##########
File path: ql/src/java/org/apache/hadoop/hive/ql/exec/vector/VectorAssignRow.java
##########
@@ -778,7 +778,7 @@ private void assignConvertRowColumn(ColumnVector columnVector, int batchIndex,
               text = new Text();
             }
             text.set(string);
-            ((BytesColumnVector) columnVector).setVal(
+            ((BytesColumnVector) columnVector).setRef(

Review comment:
       Text here is used as a re-usable buffer (if no buffer is passed into the method, a
new one is created.  I'm honestly not sure why the String is being Wrapped in a Text, at a
quick glance, that seems like it can be removed, however, for the purposes of this PR, this
is no immutable and therefore is not a candidate for `setRef`.

##########
File path: ql/src/java/org/apache/hadoop/hive/ql/exec/vector/VectorAssignRow.java
##########
@@ -778,7 +778,7 @@ private void assignConvertRowColumn(ColumnVector columnVector, int batchIndex,
               text = new Text();
             }
             text.set(string);
-            ((BytesColumnVector) columnVector).setVal(
+            ((BytesColumnVector) columnVector).setRef(

Review comment:
       Text here is used as a re-usable buffer (if no buffer is passed into the method, a
new one is created.  I'm honestly not sure why the String is being Wrapped in a Text, at a
quick glance, that seems like it can be removed, however, for the purposes of this PR, this
is not immutable and therefore is not a candidate for `setRef`.




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

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


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

    Worklog Id:     (was: 443260)
    Time Spent: 40m  (was: 0.5h)

> 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: 40m
>  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
(v8.3.4#803005)

Mime
View raw message