You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hive.apache.org by "Stamatis Zampetakis (Jira)" <ji...@apache.org> on 2022/10/21 07:32:00 UTC

[jira] [Updated] (HIVE-21313) Use faster function to point to instead of copy immutable byte arrays

     [ https://issues.apache.org/jira/browse/HIVE-21313?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Stamatis Zampetakis updated HIVE-21313:
---------------------------------------
    Fix Version/s:     (was: All Versions)

I cleared the fixVersion field since this ticket is not resolved. Please review this ticket and if the fix is already committed to a specific version please set the version accordingly and mark the ticket as RESOLVED.

According to the JIRA guidelines (https://cwiki.apache.org/confluence/display/Hive/HowToContribute) the fixVersion should be set only when the issue is resolved/closed.

> 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
>         Attachments: HIVE-21313.patch, HIVE-21313.patch
>
>          Time Spent: 1h
>  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.20.10#820010)