Gopinath created HIVE-30280:
-------------------------------

             Summary: Vectorized PTF returns NULL for window function arguments 
that need transient initialization, e.g. CAST(string AS INT)
                 Key: HIVE-30280
                 URL: https://issues.apache.org/jira/browse/HIVE-30280
             Project: Hive
          Issue Type: Bug
          Components: Vectorization
    Affects Versions: 4.2.1, 4.2.0, 4.1.0, 4.0.0
            Reporter: Gopinath
            Assignee: Gopinath


With vectorized PTF, a window function whose argument is an expression that 
needs transient
initialization silently returns NULL instead of the row-mode result.

 
{code:java}
create table t (k int, ord int, s string) stored as orc;
insert into t values (1, 1, '2'), (1, 2, 'x'), (1, 3, NULL),
  (2, 4, '3'), (2, 5, '0'), (2, 6, NULL), (2, 7, '-5'), (2, 8, '9'), (2, 9, 
'y'), (2, 10, '1');
select k, ord, sum(cast(s as int)) over (partition by k order by ord) from 
t;{code}
 

Row mode (hive.vectorized.execution.ptf.enabled=false): k=1: 2 2 2; k=2: 3 3 3 
-2 7 7 8
Vectorized: every value is NULL.

Cause: VectorPTFOperator.initializeOp transient-initializes the partition and 
order expressions,
but not the evaluators' input expressions. CastStringToLong sets 
integerPrimitiveCategory only in
transientInit, so evaluate() hits an NPE, which is caught and written as NULL.

Fix: call VectorExpression.doTransientInit(evaluator.inputVecExpr, hconf) in 
initializeOp



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to