Github user gatorsmile commented on a diff in the pull request: https://github.com/apache/spark/pull/16776#discussion_r99215565 --- Diff: sql/core/src/test/scala/org/apache/spark/sql/DataFrameStatSuite.scala --- @@ -159,16 +159,53 @@ class DataFrameStatSuite extends QueryTest with SharedSQLContext { assert(math.abs(md1 - 2 * q1 * n) < error_double) assert(math.abs(md2 - 2 * q2 * n) < error_double) } - // test approxQuantile on NaN values - val dfNaN = Seq(Double.NaN, 1.0, Double.NaN, Double.NaN).toDF("input") - val resNaN = dfNaN.stat.approxQuantile("input", Array(q1, q2), epsilons.head) + + // test relativeError greater than 1 return the same result as 1 + val Array(single1_1) = df.stat.approxQuantile("singles", Array(q1), 1.0) + val Array(s1_1, s2_1) = df.stat.approxQuantile("singles", Array(q1, q2), 1.0) + val Array(Array(ms1_1, ms2_1), Array(md1_1, md2_1)) = + df.stat.approxQuantile(Array("singles", "doubles"), Array(q1, q2), 1.0) + for (epsilon <- Seq(2.0, 100.0)) { + val Array(single1) = df.stat.approxQuantile("singles", Array(q1), epsilon) + val Array(s1, s2) = df.stat.approxQuantile("singles", Array(q1, q2), epsilon) + val Array(Array(ms1, ms2), Array(md1, md2)) = + df.stat.approxQuantile(Array("singles", "doubles"), Array(q1, q2), epsilon) + assert(single1_1 === single1) + assert(s1_1 === s1) + assert(s2_1 === s2) + assert(ms1_1 === ms1) + assert(ms2_1 === ms2) + assert(md1_1 === md1) + assert(md2_1 === md2) + } + + // quantile should be in the range [0.0, 1.0] + val e: IllegalArgumentException = intercept[IllegalArgumentException] { --- End diff -- `val e: IllegalArgumentException` -> `val e`
--- 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