diff options
author | Yin Huai <yhuai@databricks.com> | 2015-11-15 13:59:59 -0800 |
---|---|---|
committer | Davies Liu <davies.liu@gmail.com> | 2015-11-15 13:59:59 -0800 |
commit | 3e2e1873b2762d07e49de8f9ea709bf3fa2d171c (patch) | |
tree | 7b4656a38863a4757dbcfc6d29405d8ead60d800 /sql/core | |
parent | 64e55511033afb6ef42be142eb371bfbc31f5230 (diff) | |
download | spark-3e2e1873b2762d07e49de8f9ea709bf3fa2d171c.tar.gz spark-3e2e1873b2762d07e49de8f9ea709bf3fa2d171c.tar.bz2 spark-3e2e1873b2762d07e49de8f9ea709bf3fa2d171c.zip |
[SPARK-11738] [SQL] Making ArrayType orderable
https://issues.apache.org/jira/browse/SPARK-11738
Author: Yin Huai <yhuai@databricks.com>
Closes #9718 from yhuai/makingArrayOrderable.
Diffstat (limited to 'sql/core')
-rw-r--r-- | sql/core/src/test/scala/org/apache/spark/sql/DataFrameFunctionsSuite.scala | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/sql/core/src/test/scala/org/apache/spark/sql/DataFrameFunctionsSuite.scala b/sql/core/src/test/scala/org/apache/spark/sql/DataFrameFunctionsSuite.scala index 3a3f19af14..aff9efe4b2 100644 --- a/sql/core/src/test/scala/org/apache/spark/sql/DataFrameFunctionsSuite.scala +++ b/sql/core/src/test/scala/org/apache/spark/sql/DataFrameFunctionsSuite.scala @@ -308,10 +308,14 @@ class DataFrameFunctionsSuite extends QueryTest with SharedSQLContext { Row(null, null)) ) - val df2 = Seq((Array[Array[Int]](Array(2)), "x")).toDF("a", "b") - assert(intercept[AnalysisException] { - df2.selectExpr("sort_array(a)").collect() - }.getMessage().contains("does not support sorting array of type array<int>")) + val df2 = Seq((Array[Array[Int]](Array(2), Array(1), Array(2, 4), null), "x")).toDF("a", "b") + checkAnswer( + df2.selectExpr("sort_array(a, true)", "sort_array(a, false)"), + Seq( + Row( + Seq[Seq[Int]](null, Seq(1), Seq(2), Seq(2, 4)), + Seq[Seq[Int]](Seq(2, 4), Seq(2), Seq(1), null))) + ) val df3 = Seq(("xxx", "x")).toDF("a", "b") assert(intercept[AnalysisException] { |