aboutsummaryrefslogtreecommitdiff
path: root/sql/hive
diff options
context:
space:
mode:
authorYin Huai <yhuai@databricks.com>2015-11-15 13:59:59 -0800
committerDavies Liu <davies.liu@gmail.com>2015-11-15 13:59:59 -0800
commit3e2e1873b2762d07e49de8f9ea709bf3fa2d171c (patch)
tree7b4656a38863a4757dbcfc6d29405d8ead60d800 /sql/hive
parent64e55511033afb6ef42be142eb371bfbc31f5230 (diff)
downloadspark-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/hive')
-rw-r--r--sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/AggregationQuerySuite.scala52
1 files changed, 52 insertions, 0 deletions
diff --git a/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/AggregationQuerySuite.scala b/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/AggregationQuerySuite.scala
index 61e3e913c2..6dde79f74d 100644
--- a/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/AggregationQuerySuite.scala
+++ b/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/AggregationQuerySuite.scala
@@ -132,6 +132,22 @@ abstract class AggregationQuerySuite extends QueryTest with SQLTestUtils with Te
(3, null, null)).toDF("key", "value1", "value2")
data2.write.saveAsTable("agg2")
+ val data3 = Seq[(Seq[Integer], Integer, Integer)](
+ (Seq[Integer](1, 1), 10, -10),
+ (Seq[Integer](null), -60, 60),
+ (Seq[Integer](1, 1), 30, -30),
+ (Seq[Integer](1), 30, 30),
+ (Seq[Integer](2), 1, 1),
+ (null, -10, 10),
+ (Seq[Integer](2, 3), -1, null),
+ (Seq[Integer](2, 3), 1, 1),
+ (Seq[Integer](2, 3, 4), null, 1),
+ (Seq[Integer](null), 100, -10),
+ (Seq[Integer](3), null, 3),
+ (null, null, null),
+ (Seq[Integer](3), null, null)).toDF("key", "value1", "value2")
+ data3.write.saveAsTable("agg3")
+
val emptyDF = sqlContext.createDataFrame(
sparkContext.emptyRDD[Row],
StructType(StructField("key", StringType) :: StructField("value", IntegerType) :: Nil))
@@ -146,6 +162,7 @@ abstract class AggregationQuerySuite extends QueryTest with SQLTestUtils with Te
override def afterAll(): Unit = {
sqlContext.sql("DROP TABLE IF EXISTS agg1")
sqlContext.sql("DROP TABLE IF EXISTS agg2")
+ sqlContext.sql("DROP TABLE IF EXISTS agg3")
sqlContext.dropTempTable("emptyTable")
}
@@ -266,6 +283,41 @@ abstract class AggregationQuerySuite extends QueryTest with SQLTestUtils with Te
Row(100, null) ::
Row(null, 3) ::
Row(null, null) :: Nil)
+
+ checkAnswer(
+ sqlContext.sql(
+ """
+ |SELECT DISTINCT key
+ |FROM agg3
+ """.stripMargin),
+ Row(Seq[Integer](1, 1)) ::
+ Row(Seq[Integer](null)) ::
+ Row(Seq[Integer](1)) ::
+ Row(Seq[Integer](2)) ::
+ Row(null) ::
+ Row(Seq[Integer](2, 3)) ::
+ Row(Seq[Integer](2, 3, 4)) ::
+ Row(Seq[Integer](3)) :: Nil)
+
+ checkAnswer(
+ sqlContext.sql(
+ """
+ |SELECT value1, key
+ |FROM agg3
+ |GROUP BY value1, key
+ """.stripMargin),
+ Row(10, Seq[Integer](1, 1)) ::
+ Row(-60, Seq[Integer](null)) ::
+ Row(30, Seq[Integer](1, 1)) ::
+ Row(30, Seq[Integer](1)) ::
+ Row(1, Seq[Integer](2)) ::
+ Row(-10, null) ::
+ Row(-1, Seq[Integer](2, 3)) ::
+ Row(1, Seq[Integer](2, 3)) ::
+ Row(null, Seq[Integer](2, 3, 4)) ::
+ Row(100, Seq[Integer](null)) ::
+ Row(null, Seq[Integer](3)) ::
+ Row(null, null) :: Nil)
}
test("case in-sensitive resolution") {