Github user HyukjinKwon commented on a diff in the pull request:

    https://github.com/apache/spark/pull/16776#discussion_r100986732
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/DataFrameStatFunctions.scala ---
    @@ -58,49 +58,54 @@ final class DataFrameStatFunctions private[sql](df: 
DataFrame) {
        * @param probabilities a list of quantile probabilities
        *   Each number must belong to [0, 1].
        *   For example 0 is the minimum, 0.5 is the median, 1 is the maximum.
    -   * @param relativeError The relative target precision to achieve 
(greater or equal to 0).
    +   * @param relativeError The relative target precision to achieve 
(greater than or equal to 0).
        *   If set to zero, the exact quantiles are computed, which could be 
very expensive.
        *   Note that values greater than 1 are accepted but give the same 
result as 1.
        * @return the approximate quantiles at the given probabilities
        *
    -   * @note NaN values will be removed from the numerical column before 
calculation
    +   * @note null and NaN values will be removed from the numerical column 
before calculation. If
    +   *   the dataframe is empty or all rows contain null or NaN, null is 
returned.
        *
        * @since 2.0.0
        */
       def approxQuantile(
           col: String,
           probabilities: Array[Double],
           relativeError: Double): Array[Double] = {
    -    StatFunctions.multipleApproxQuantiles(df.select(col).na.drop(),
    -      Seq(col), probabilities, relativeError).head.toArray
    +    val res = approxQuantile(Array(col), probabilities, relativeError)
    +    Option(res).map(_.head).orNull
       }
     
       /**
        * Calculates the approximate quantiles of numerical columns of a 
DataFrame.
    -   * @see [[DataFrameStatsFunctions.approxQuantile(col:Str* 
approxQuantile]] for
    -   *     detailed description.
    +   * @see `[[DataFrameStatsFunctions.approxQuantile(col:Str* 
approxQuantile]]` for detailed
    --- End diff --
    
    nit: `DataFrameStatsFunctions` -> `DataFrameStatFunctions` or remove it.
    
    For example, just
    
    ```
    `approxQuantile(String, Array[Double], Double)`
    ```
    
    We could just wrap them by backticks without `[[ ... ]]` in general. It 
seems Scaladoc specific annotation also does not work to disambiguate the 
argument types.
    
    ```
    [error] 
.../spark/sql/core/target/java/org/apache/spark/sql/DataFrameStatFunctions.java:43:
 error: unexpected content
    [error]    * @see {@link DataFrameStatFunctions.approxQuantile(col:Str* 
approxQuantile)} for
    [error]      ^
    [error] 
.../spark/sql/core/target/java/org/apache/spark/sql/DataFrameStatFunctions.java:45:
 error: unexpected text
    [error]    * @see #approxQuantile(String, Array[Double], Double) for 
detailed description.
    [error]      ^
    ```
    
    I guess It does not necessarily make a link if it breaks.
    
    



---
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 [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to