You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hive.apache.org by "Teddy Choi (JIRA)" <ji...@apache.org> on 2015/08/11 10:06:45 UTC

[jira] [Commented] (HIVE-10238) Loop optimization for SIMD in IfExprColumnColumn.txt

    [ https://issues.apache.org/jira/browse/HIVE-10238?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14681394#comment-14681394 ] 

Teddy Choi commented on HIVE-10238:
-----------------------------------

Hello [~mmokhtar] and [~chengxiang li].

I think {{LongColumnVector}} can be vectorized with bitwise operators as following.
{code}
for (int i = 0; i < n; i++) {
  outputVector[i] = (~(vector1[i] - 1) & vector2[i]) | ((vector1[i] - 1) & vector3[i]);
  outputIsNull[i] = (vector1[i] & arg2ColVector.isNull[i]) | (vector1[i] ^ 1 & arg3ColVector.isNull[i]);
}
{code}

As the condition is stored as a long integer, any arithmetic operation with a floating point needs a type conversion. There's no type conversion vectorization in Java 8 yet. (http://hg.openjdk.java.net/jdk8/jdk8/hotspot/rev/006050192a5a) However, {{outputIsNull}} array still can be vectorized as above.

Thanks.

> Loop optimization for SIMD in IfExprColumnColumn.txt
> ----------------------------------------------------
>
>                 Key: HIVE-10238
>                 URL: https://issues.apache.org/jira/browse/HIVE-10238
>             Project: Hive
>          Issue Type: Sub-task
>          Components: Vectorization
>    Affects Versions: 1.1.0
>            Reporter: Chengxiang Li
>            Assignee: Chengxiang Li
>            Priority: Minor
>
> The ?: operator as following could not be vectorized in loop, we may transfer it into mathematical expression.
> {code:java}
> for(int j = 0; j != n; j++) {
>       int i = sel[j];
>       outputVector[i] = (vector1[i] == 1 ? vector2[i] : vector3[i]);
>       outputIsNull[i] = (vector1[i] == 1 ?
>           arg2ColVector.isNull[i] : arg3ColVector.isNull[i]);
> }
> {code} 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)