Uploaded image for project: 'Hive'
  1. Hive
  2. HIVE-13951

GenericUDFArray should constant fold at compile time

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Critical
    • Resolution: Unresolved
    • Affects Version/s: 1.3.0, 2.1.0
    • Fix Version/s: None
    • Component/s: UDF
    • Labels:
      None
    • Release Note:
      Constant fold array() UDF

      Description

      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.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                gopalv Gopal Vijayaraghavan
                Reporter:
                Spring Sergey Zadoroshnyak
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated: