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

    https://github.com/apache/spark/pull/18307#discussion_r124932359
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/Dataset.scala ---
    @@ -2205,37 +2205,170 @@ class Dataset[T] private[sql](
        *   // max     92.0  192.0
        * }}}
        *
    +   * See also [[describeExtended]] and [[describeAdvanced]]
    +   *
    +   * @param cols Columns to compute statistics on.
    +   *
        * @group action
        * @since 1.6.0
        */
       @scala.annotation.varargs
    -  def describe(cols: String*): DataFrame = withPlan {
    +  def describe(cols: String*): DataFrame =
    +    describeAdvanced(Array("count", "mean", "stddev", "min", "max"), cols: 
_*)
    +
    +  /**
    +   * Computes statistics for numeric and string columns, including count, 
mean, stddev, min,
    +   * approximate quartiles, and max. If no columns are given, this 
function computes
    +   * statistics for all numerical or string columns.
    +   *
    +   * This function is meant for exploratory data analysis, as we make no 
guarantee about the
    +   * backward compatibility of the schema of the resulting Dataset. If you 
want to
    +   * programmatically compute summary statistics, use the `agg` function 
instead.
    +   *
    +   * {{{
    +   *   ds.describeExtended("age", "height").show()
    +   *
    +   *   // output:
    +   *   // summary age   height
    +   *   // count   10.0  10.0
    +   *   // mean    53.3  178.05
    +   *   // stddev  11.6  15.7
    +   *   // min     18.0  163.0
    +   *   // 25%     24.0  176.0
    +   *   // 50%     24.0  176.0
    +   *   // 75%     32.0  180.0
    +   *   // max     92.0  192.0
    +   * }}}
    +   *
    +   * To specify which statistics or percentiles are desired see 
[[describeAdvanced]]
    +   *
    +   * @param cols Columns to compute statistics on.
    +   *
    +   * @group action
    +   * @since 2.3.0
    +   */
    +  @scala.annotation.varargs
    +  def describeExtended(cols: String*): DataFrame =
    +    describeAdvanced(Array("count", "mean", "stddev", "min", "25%", "50%", 
"75%", "max"), cols: _*)
    +
    +  /**
    +   * Computes specified statistics for numeric and string columns. 
Available statistics are:
    +   *
    +   * - count
    +   * - mean
    +   * - stddev
    +   * - min
    +   * - max
    +   * - arbitrary approximate percentiles specifid as a percentage (eg, 75%)
    +   *
    +   * If no columns are given, this function computes statistics for all 
numerical or string
    +   * columns.
    +   *
    +   * This function is meant for exploratory data analysis, as we make no 
guarantee about the
    +   * backward compatibility of the schema of the resulting Dataset. If you 
want to
    +   * programmatically compute summary statistics, use the `agg` function 
instead.
    +   *
    +   * {{{
    +   *   ds.describeAdvanced(Array("count", "min", "25%", "75%", "max"), 
"age", "height").show()
    +   *
    +   *   // output:
    +   *   // summary age   height
    +   *   // count   10.0  10.0
    +   *   // min     18.0  163.0
    +   *   // 25%     24.0  176.0
    +   *   // 75%     32.0  180.0
    +   *   // max     92.0  192.0
    +   * }}}
    +   *
    +   * @param statistics Statistics from above list to be computed.
    +   * @param cols Columns to compute statistics on.
    +   *
    +   * @group action
    +   * @since 2.3.0
    +   */
    +  @scala.annotation.varargs
    +  def describeAdvanced(statistics: Array[String], cols: String*): 
DataFrame = withPlan {
    --- End diff --
    
    actually i'm thinking it was a mistake to ask for columns in describe. a 
more sensible approach is to do `df.select("a", "b").describe("sum", "50%")`
    
    Unfortunately if we do that now we'd break the API. I really hate 
"describeAdvanced" as a name. Is there another word we can use instead of 
"describe" to achieve that" Maybe "summarize"?



---
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