Sergey Zadoroshnyak created HIVE-13951:
------------------------------------------

             Summary: GenericUDFArray should constant fold at compile time
                 Key: HIVE-13951
                 URL: https://issues.apache.org/jira/browse/HIVE-13951
             Project: Hive
          Issue Type: Bug
          Components: UDF
    Affects Versions: 1.3.0, 2.1.0
            Reporter: Sergey Zadoroshnyak


1. Hive constant propagation optimizer is enabled.  
hive.optimize.constant.propagation=true;
2. Hive query: 
select array('Total','Total') from some_table;

ERROR: org.apache.hadoop.hive.ql.optimizer.ConstantPropagateProcFactory 
(ConstantPropagateProcFactory.java:evaluateFunction(939)) - Unable to evaluate 
org.apache.hadoop.hive.ql.udf.generic.GenericUDFArray@3d26c423. Return value 
unrecoginizable.

Details:
During compilation of query, hive checks if any subexpression of a specified 
expression can be evaluated to be constant and replaces such subexpression with 
the constant.
If the expression is a deterministic UDF and all the subexpressions are 
constants, the value will be calculated immediately during compilation time 
(not runtime)

So array is a deterministic UDF,  'Total' is string constant. So Hive tries to 
replace result of evaluation UDF with the constant.

But looks like, that Hive only supports primitives and struct objects.

So, array is not supported yet.






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

Reply via email to