spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From MLnick <...@git.apache.org>
Subject [GitHub] spark pull request #16776: [SPARK-19436][SQL] Add missing tests for approxQu...
Date Tue, 14 Feb 2017 21:51:09 GMT
Github user MLnick commented on a diff in the pull request:

    https://github.com/apache/spark/pull/16776#discussion_r101152427
  
    --- Diff: sql/core/src/test/scala/org/apache/spark/sql/DataFrameStatSuite.scala ---
    @@ -159,16 +159,72 @@ 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)
    +
    +    // quantile should be in the range [0.0, 1.0]
    +    val e = intercept[IllegalArgumentException] {
    +      df.stat.approxQuantile(Array("singles", "doubles"), Array(q1, q2, -0.1), epsilons.head)
    +    }
    +    assert(e.getMessage.contains("quantile should be in the range [0.0, 1.0]"))
    +
    +    // relativeError should be non-negative
    +    val e2 = intercept[IllegalArgumentException] {
    +      df.stat.approxQuantile(Array("singles", "doubles"), Array(q1, q2), -1.0)
    +    }
    +    assert(e2.getMessage.contains("Relative Error must be non-negative"))
    +
    +    // dataset should be non-empty
    +    intercept[NoSuchElementException] {
    --- End diff --
    
    Do we really want to return null? Seems very un Scala like to me


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Mime
View raw message