Github user vectorijk commented on a diff in the pull request: https://github.com/apache/spark/pull/14136#discussion_r70834638 --- Diff: sql/core/src/test/scala/org/apache/spark/sql/DataFrameAggregateSuite.scala --- @@ -475,4 +475,20 @@ class DataFrameAggregateSuite extends QueryTest with SharedSQLContext { spark.sql("select avg(a) over () from values 1.0, 2.0, 3.0 T(a)"), Row(2.0) :: Row(2.0) :: Row(2.0) :: Nil) } + + test("percentile functions") { + val df = Seq(1, 3, 3, 6, 5, 4, 17, 38, 29, 400).toDF("a") + checkAnswer( + df.select(percentile($"a", 0.5d), percentile($"a", Seq(0d, 0.75d, 1d))), + Seq(Row(Seq(5.5), Seq(1.0, 26.0, 400.0))) + ) + } + + test("percentile functions with zero input rows.") { + val df = Seq(1, 3, 3, 6, 5, 4, 17, 38, 29, 400).toDF("a").where($"a" < 0) + checkAnswer( + df.select(percentile($"a", 0.5d)), + Seq(Row(Seq.empty)) + ) + } --- End diff -- I think we should also give a test to see what if pass an empty array of percentiles. It may throw an exception or error.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org