Gopal V created HIVE-20277:
------------------------------

             Summary: Vectorization: Case expressions that return NULL in FILTER
                 Key: HIVE-20277
                 URL: https://issues.apache.org/jira/browse/HIVE-20277
             Project: Hive
          Issue Type: Bug
            Reporter: Gopal V


In cases like Query89, the vertex with the filter is not vectorized.

{code}
                   Filter Operator
                      predicate: CASE WHEN ((avg_window_0 <> 0.0D)) THEN 
(((abs((_col6 - avg_window_0)) / avg_window_0) > 0.1D)) ELSE (null) END (type: 
boolean)
{code}

{code}
        Reducer 3 
            Execution mode: llap
            Reduce Vectorization:
                enabled: true
                enableConditionsMet: hive.vectorized.execution.reduce.enabled 
IS true, hive.execution.engine tez IN [tez, spark] IS true
                notVectorizedReason: FILTER operator: Unexpected hive type name 
void
                vectorized: false
{code}

The query specifically has 

{code}
where case when (avg_monthly_sales <> 0) then (abs(sum_sales - 
avg_monthly_sales) / avg_monthly_sales) else null end > 0.1
{code}

while rewriting it to 

{code}
where case when (avg_monthly_sales <> 0) then (abs(sum_sales - 
avg_monthly_sales) / avg_monthly_sales) > 0.1 else false end
{code}

does vectorize into 

{code}
                    Filter Operator
                      Filter Vectorization:
                          className: VectorFilterOperator
                          native: true
                          predicateExpression: SelectColumnIsTrue(col 
12:boolean)(children: VectorUDFAdaptor(CASE WHEN ((avg_window_0 <> 0.0D)) THEN 
(((abs((_col6 - avg_window_0)) / avg_window_0) > 0.1D)) ELSE (false) 
END)(children: DoubleColNotEqualDoubleScalar(col 7:double, val 0.0) -> 
8:boolean, DoubleColGreaterDoubleScalar(col 9:double, val 0.1)(children: 
DoubleColDivideDoubleColumn(col 10:double, col 7:double)(children: 
FuncAbsDoubleToDouble(col 9:double)(children: DoubleColSubtractDoubleColumn(col 
6:double, col 7:double) -> 9:double) -> 10:double) -> 9:double) -> 11:boolean) 
-> 12:boolean)
                      predicate: CASE WHEN ((avg_window_0 <> 0.0D)) THEN 
(((abs((_col6 - avg_window_0)) / avg_window_0) > 0.1D)) ELSE (false) END (type: 
boolean)
                      Statistics: Num rows: 11 Data size: 5291 Basic stats: 
COMPLETE Column stats: COMPLETE
{code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to