dongjoon-hyun edited a comment on issue #23756: [SPARK-26853][SQL] Add example 
and version for commonly used aggregate function descriptions
URL: https://github.com/apache/spark/pull/23756#issuecomment-462110894
 
 
   Oh, is that a problem? Then, please use the following examples.
   
   * `collect_list`, `collect_set`
   ```sql
   spark-sql> SELECT collect_set(col) FROM VALUES (1), (2), (1) AS tab(col);
   [1,2]
   spark-sql> SELECT collect_list(col) FROM VALUES (1), (2), (1) AS tab(col);
   [1,2,1]
   ```
   
   * `std (=stddev_samp)`, `stddev_pop`
   ```sql
   spark-sql> SELECT stddev_samp(col) FROM VALUES (1), (2), (3) AS tab(col);
   1.0
   
   spark-sql> SELECT stddev_pop(col) FROM VALUES (1), (2), (3) AS tab(col);
   0.816496580927726
   ```
   
   * `variance (=var_samp)`, `var_pop`
   ```sql
   spark-sql> SELECT var_samp(col) FROM VALUES (1), (2), (3) AS tab(col);
   1.0
   
   spark-sql> SELECT var_pop(col) FROM VALUES (1), (2), (3) AS tab(col);
   0.6666666666666666
   ```
   
   * `covar_samp`, `covar_pop`
   ```sql
   spark-sql> SELECT covar_samp(c1,c2) FROM VALUES (1,1), (2,2), (3,3) AS 
tab(c1,c2);
   1.0
   
   spark-sql> SELECT covar_pop(c1,c2) FROM VALUES (1,1), (2,2), (3,3) AS 
tab(c1,c2);
   0.6666666666666666
   ```
   
   * `percentile`
   ```sql
   spark-sql> SELECT percentile(col, 0.3) FROM VALUES (0), (10) AS tab(col);
   3.0
   
   spark-sql> SELECT percentile(col, array(0.25,0.75)) FROM VALUES (0), (10) AS 
tab(col);
   [2.5,7.5]
   ```
   
   For the other functions, please reuse the example in 
[window.sql](https://github.com/apache/spark/blob/master/sql/core/src/test/resources/sql-tests/inputs/window.sql#L58-L87).
 You don't need to reinvent the example. Let's finish all in this PR.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

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

Reply via email to