aboutsummaryrefslogtreecommitdiff
path: root/sql/hive
diff options
context:
space:
mode:
authorHerman van Hovell <hvanhovell@questtec.nl>2015-12-30 16:51:07 -0800
committerYin Huai <yhuai@databricks.com>2015-12-30 16:51:07 -0800
commitf76ee109d87e727710d2721e4be47fdabc21582c (patch)
tree7f26d322151c6b7446e30ad45bfd4b8cf33b33f2 /sql/hive
parentb244297966be1d09f8e861cfe2d8e69f7bed84da (diff)
downloadspark-f76ee109d87e727710d2721e4be47fdabc21582c.tar.gz
spark-f76ee109d87e727710d2721e4be47fdabc21582c.tar.bz2
spark-f76ee109d87e727710d2721e4be47fdabc21582c.zip
[SPARK-8641][SPARK-12455][SQL] Native Spark Window functions - Follow-up (docs & tests)
This PR is a follow-up for PR https://github.com/apache/spark/pull/9819. It adds documentation for the window functions and a couple of NULL tests. The documentation was largely based on the documentation in (the source of) Hive and Presto: * https://prestodb.io/docs/current/functions/window.html * https://cwiki.apache.org/confluence/display/Hive/LanguageManual+WindowingAndAnalytics I am not sure if we need to add the licenses of these two projects to the licenses directory. They are both under the ASL. srowen any thoughts? cc yhuai Author: Herman van Hovell <hvanhovell@questtec.nl> Closes #10402 from hvanhovell/SPARK-8641-docs.
Diffstat (limited to 'sql/hive')
-rw-r--r--sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/WindowQuerySuite.scala15
1 files changed, 15 insertions, 0 deletions
diff --git a/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/WindowQuerySuite.scala b/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/WindowQuerySuite.scala
index c05dbfd760..ea82b8c459 100644
--- a/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/WindowQuerySuite.scala
+++ b/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/WindowQuerySuite.scala
@@ -227,4 +227,19 @@ class WindowQuerySuite extends QueryTest with SQLTestUtils with TestHiveSingleto
Row("Manufacturer#5", "almond azure blanched chiffon midnight", 23, 315.9225931564038, 315.9225931564038, 46, 99807.08486666666, -0.9978877469246935, -5664.856666666666)))
// scalastyle:on
}
+
+ test("null arguments") {
+ checkAnswer(sql("""
+ |select p_mfgr, p_name, p_size,
+ |sum(null) over(distribute by p_mfgr sort by p_name) as sum,
+ |avg(null) over(distribute by p_mfgr sort by p_name) as avg
+ |from part
+ """.stripMargin),
+ sql("""
+ |select p_mfgr, p_name, p_size,
+ |null as sum,
+ |null as avg
+ |from part
+ """.stripMargin))
+ }
}