You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by gu...@apache.org on 2020/09/23 11:24:08 UTC

[spark] branch branch-2.4 updated: [MINOR][SQL][2.4] Improve examples for `percentile_approx()`

This is an automated email from the ASF dual-hosted git repository.

gurwls223 pushed a commit to branch branch-2.4
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/branch-2.4 by this push:
     new 1366443  [MINOR][SQL][2.4] Improve examples for `percentile_approx()`
1366443 is described below

commit 13664434387e338a5029e73a4388943f34e3fc07
Author: Max Gekk <ma...@gmail.com>
AuthorDate: Wed Sep 23 20:14:47 2020 +0900

    [MINOR][SQL][2.4] Improve examples for `percentile_approx()`
    
    ### What changes were proposed in this pull request?
    In the PR, I propose to replace current examples for `percentile_approx()` with **only one** input value by example **with multiple values** in the input column.
    
    ### Why are the changes needed?
    Current examples are pretty trivial, and don't demonstrate function's behaviour on a sequence of values.
    
    ### Does this PR introduce _any_ user-facing change?
    No
    
    ### How was this patch tested?
    `./dev/scalastyle`
    
    Authored-by: Max Gekk <max.gekkgmail.com>
    Signed-off-by: HyukjinKwon <gurwls223apache.org>
    (cherry picked from commit b53da23a28fe149cc75d593c5c36f7020a8a2752)
    Signed-off-by: Max Gekk <max.gekkgmail.com>
    
    Closes #29849 from MaxGekk/example-percentile_approx-2.4.
    
    Authored-by: Max Gekk <ma...@gmail.com>
    Signed-off-by: HyukjinKwon <gu...@apache.org>
---
 .../catalyst/expressions/aggregate/ApproximatePercentile.scala    | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/aggregate/ApproximatePercentile.scala b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/aggregate/ApproximatePercentile.scala
index 4ccde96..fd5d679 100644
--- a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/aggregate/ApproximatePercentile.scala
+++ b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/aggregate/ApproximatePercentile.scala
@@ -62,10 +62,10 @@ import org.apache.spark.sql.types._
   """,
   examples = """
     Examples:
-      > SELECT _FUNC_(10.0, array(0.5, 0.4, 0.1), 100);
-       [10.0,10.0,10.0]
-      > SELECT _FUNC_(10.0, 0.5, 100);
-       10.0
+      > SELECT _FUNC_(col, array(0.5, 0.4, 0.1), 100) FROM VALUES (0), (1), (2), (10) AS tab(col);
+       [1,1,0]
+      > SELECT _FUNC_(col, 0.5, 100) FROM VALUES (0), (6), (7), (9), (10) AS tab(col);
+       7
   """)
 case class ApproximatePercentile(
     child: Expression,


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