Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-4244

ConstantFolding has to be done before initialize the Generic UDF

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.2.0
    • Component/s: SQL
    • Labels:
      None

      Description

      The query is
      "SELECT named_struct(lower("AA"), "12", lower("Bb"), "13") FROM src LIMIT 1:

      It throws exception

      Even arguments to NAMED_STRUCT must be a constant STRING.org.apache.hadoop.hive.serde2.objectinspector.primitive.JavaStringObjectInspector@798a6e99
      org.apache.hadoop.hive.ql.exec.UDFArgumentTypeException: Even arguments to NAMED_STRUCT must be a constant STRING.org.apache.hadoop.hive.serde2.objectinspector.primitive.JavaStringObjectInspector@798a6e99
      at org.apache.hadoop.hive.ql.udf.generic.GenericUDFNamedStruct.initialize(GenericUDFNamedStruct.java:55)
      at org.apache.spark.sql.hive.HiveGenericUdf.returnInspector$lzycompute(hiveUdfs.scala:157)
      at org.apache.spark.sql.hive.HiveGenericUdf.returnInspector(hiveUdfs.scala:157)
      at org.apache.spark.sql.hive.HiveGenericUdf.dataType$lzycompute(hiveUdfs.scala:173)
      at org.apache.spark.sql.hive.HiveGenericUdf.dataType(hiveUdfs.scala:173)
      at org.apache.spark.sql.catalyst.expressions.Alias.toAttribute(namedExpressions.scala:104)
      at org.apache.spark.sql.catalyst.plans.logical.Project$$anonfun$output$1.apply(basicOperators.scala:25)
      at org.apache.spark.sql.catalyst.plans.logical.Project$$anonfun$output$1.apply(basicOperators.scala:25)

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              chenghao Cheng Hao
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: