spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gatorsmile <>
Subject [GitHub] spark pull request #16971: [SPARK-19573][SQL] Make NaN/null handling consist...
Date Wed, 22 Feb 2017 23:25:54 GMT
Github user gatorsmile commented on a diff in the pull request:
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/DataFrameStatFunctions.scala ---
    @@ -89,18 +89,17 @@ final class DataFrameStatFunctions private[sql](df: DataFrame) {
        *   Note that values greater than 1 are accepted but give the same result as 1.
        * @return the approximate quantiles at the given probabilities of each column
    -   * @note Rows containing any null or NaN values will be removed before calculation.
    -   *   the dataframe is empty or all rows contain null or NaN, null is returned.
    +   * @note null and NaN values will be removed from the numerical column before calculation.
    +   *   the dataframe is empty, or all rows in some column contain null or NaN, null is
        * @since 2.2.0
       def approxQuantile(
           cols: Array[String],
           probabilities: Array[Double],
           relativeError: Double): Array[Array[Double]] = {
    -    // TODO: Update NaN/null handling to keep consistent with the single-column version
         try {
    -      StatFunctions.multipleApproxQuantiles( _*).na.drop(), cols,
    +      StatFunctions.multipleApproxQuantiles( _*), cols,
             probabilities, relativeError).map(_.toArray).toArray
         } catch {
           case e: NoSuchElementException => null
    --- End diff --
    In Spark SQL, all the other built-in functions will not throw an exception if the input
data set is empty. An empty inupt data set is pretty normal. Returning either `null` or empty
`Array` looks ok 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 or file a JIRA ticket
with INFRA.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message