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

Check ascendingOrder type in sort_array function ahead

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Trivial
    • Resolution: Fixed
    • None
    • 2.0.2, 2.1.0
    • SQL
    • None

    Description

      spark-sql> SELECT sort_array(array('b', 'd', 'c', 'a'), '1');
      16/10/19 00:28:54 ERROR SparkSQLDriver: Failed in [SELECT sort_array(array('b', 'd', 'c', 'a'), '1')]
      java.lang.ClassCastException: org.apache.spark.unsafe.types.UTF8String cannot be cast to java.lang.Boolean
      	at scala.runtime.BoxesRunTime.unboxToBoolean(BoxesRunTime.java:85)
      	at org.apache.spark.sql.catalyst.expressions.SortArray.nullSafeEval(collectionOperations.scala:185)
      	at org.apache.spark.sql.catalyst.expressions.BinaryExpression.eval(Expression.scala:416)
      	at org.apache.spark.sql.catalyst.optimizer.ConstantFolding$$anonfun$apply$1$$anonfun$applyOrElse$1.applyOrElse(expressions.scala:50)
      	at org.apache.spark.sql.catalyst.optimizer.ConstantFolding$$anonfun$apply$1$$anonfun$applyOrElse$1.applyOrElse(expressions.scala:43)
      

      I guess we should also check this in `checkInputDataTypes`.

      Attachments

        Activity

          People

            hyukjin.kwon Hyukjin Kwon
            hyukjin.kwon Hyukjin Kwon
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: