diff options
author | jiangxingbo <jiangxb1987@gmail.com> | 2016-11-28 11:05:58 -0800 |
---|---|---|
committer | Herman van Hovell <hvanhovell@databricks.com> | 2016-11-28 11:05:58 -0800 |
commit | 0f5f52a3d1e5dcf5b970c49e324e322b9deb00f3 (patch) | |
tree | 3324b94c8e4275c2bd2ac0bab7804835c7ccab59 /sql/hive/src/test | |
parent | 185642846e25fa812f9c7f398ab20bffc1e25273 (diff) | |
download | spark-0f5f52a3d1e5dcf5b970c49e324e322b9deb00f3.tar.gz spark-0f5f52a3d1e5dcf5b970c49e324e322b9deb00f3.tar.bz2 spark-0f5f52a3d1e5dcf5b970c49e324e322b9deb00f3.zip |
[SPARK-16282][SQL] Implement percentile SQL function.
## What changes were proposed in this pull request?
Implement percentile SQL function. It computes the exact percentile(s) of expr at pc with range in [0, 1].
## How was this patch tested?
Add a new testsuite `PercentileSuite` to test percentile directly.
Updated related testcases in `ExpressionToSQLSuite`.
Author: jiangxingbo <jiangxb1987@gmail.com>
Author: 蒋星博 <jiangxingbo@meituan.com>
Author: jiangxingbo <jiangxingbo@meituan.com>
Closes #14136 from jiangxb1987/percentile.
Diffstat (limited to 'sql/hive/src/test')
-rw-r--r-- | sql/hive/src/test/scala/org/apache/spark/sql/catalyst/ExpressionToSQLSuite.scala | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/sql/hive/src/test/scala/org/apache/spark/sql/catalyst/ExpressionToSQLSuite.scala b/sql/hive/src/test/scala/org/apache/spark/sql/catalyst/ExpressionToSQLSuite.scala index fdd02821df..27ea167b90 100644 --- a/sql/hive/src/test/scala/org/apache/spark/sql/catalyst/ExpressionToSQLSuite.scala +++ b/sql/hive/src/test/scala/org/apache/spark/sql/catalyst/ExpressionToSQLSuite.scala @@ -173,6 +173,8 @@ class ExpressionToSQLSuite extends SQLBuilderTest with SQLTestUtils { checkSqlGeneration("SELECT max(value) FROM t1 GROUP BY key") checkSqlGeneration("SELECT mean(value) FROM t1 GROUP BY key") checkSqlGeneration("SELECT min(value) FROM t1 GROUP BY key") + checkSqlGeneration("SELECT percentile(value, 0.25) FROM t1 GROUP BY key") + checkSqlGeneration("SELECT percentile(value, array(0.25, 0.75)) FROM t1 GROUP BY key") checkSqlGeneration("SELECT skewness(value) FROM t1 GROUP BY key") checkSqlGeneration("SELECT stddev(value) FROM t1 GROUP BY key") checkSqlGeneration("SELECT stddev_pop(value) FROM t1 GROUP BY key") |