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

Mostafa Mokhtar commented on HIVE-10238:
----------------------------------------

[~chengxiang li]

I have been trying to find a substitute in Java to mix boolean expression with 
arithmetic without any luck.

I wanted to change code from this 
{code}
for(int j=i=0; i<n; i++)
    if (col[i] < val) res[j++] = i;
{code}

To this, which is not possible in Java, the code below removes the branch but 
still has data dependency which can't be unrolled. 
{code}
int j;
for(int j=i=0; i<n; i++)
    j += (col[i] < val); 
   res[j++] = i;
{code}



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

Reply via email to