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

Check ascendingOrder type in sort_array function ahead

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Trivial
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.0.2, 2.1.0
    • Component/s: SQL
    • Labels:
      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

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

              Dates

              • Created:
                Updated:
                Resolved: