Apache DataFusion SQL Query Engine
Minor: fix Aggregation Docs from review (#12880)
Jonathan Chen5d6254cd99a6
diff --git a/datafusion/functions-aggregate/src/approx_distinct.rs b/datafusion/functions-aggregate/src/approx_distinct.rsindex efa9a6d8da..d6cc711147 100644--- a/datafusion/functions-aggregate/src/approx_distinct.rs+++ b/datafusion/functions-aggregate/src/approx_distinct.rs@@ -332,7 +332,7 @@ fn get_approx_distinct_doc() -> &'static Documentation {+-----------------------------------+```"#,)- .with_argument("expression", "Expression to operate on. Can be a constant, column, or function, and any combination of arithmetic operators.")+ .with_standard_argument("expression", "The").build().unwrap()})diff --git a/datafusion/functions-aggregate/src/approx_median.rs b/datafusion/functions-aggregate/src/approx_median.rsindex dd5bb8d441..84442fa5a2 100644--- a/datafusion/functions-aggregate/src/approx_median.rs+++ b/datafusion/functions-aggregate/src/approx_median.rs@@ -145,7 +145,7 @@ fn get_approx_median_doc() -> &'static Documentation {+-----------------------------------+```"#,)- .with_argument("expression", "Expression to operate on. Can be a constant, column, or function, and any combination of arithmetic operators.")+ .with_standard_argument("expression", "The").build().unwrap()})diff --git a/datafusion/functions-aggregate/src/approx_percentile_cont.rs b/datafusion/functions-aggregate/src/approx_percentile_cont.rsindex b4488d6d9e..9b8a99e977 100644--- a/datafusion/functions-aggregate/src/approx_percentile_cont.rs+++ b/datafusion/functions-aggregate/src/approx_percentile_cont.rs@@ -293,7 +293,7 @@ fn get_approx_percentile_cont_doc() -> &'static Documentation {| 65.0 |+-------------------------------------------------+```"#)- .with_argument("expression", "Expression to operate on. Can be a constant, column, or function, and any combination of arithmetic operators.")+ .with_standard_argument("expression", "The").with_argument("percentile", "Percentile to compute. Must be a float value between 0 and 1 (inclusive).").with_argument("centroids", "Number of centroids to use in the t-digest algorithm. _Default is 100_. A higher number results in more accurate approximation but requires more memory.").build()diff --git a/datafusion/functions-aggregate/src/approx_percentile_cont_with_weight.rs b/datafusion/functions-aggregate/src/approx_percentile_cont_with_weight.rsindex 8cbf9587a7..a5362713a6 100644--- a/datafusion/functions-aggregate/src/approx_percentile_cont_with_weight.rs+++ b/datafusion/functions-aggregate/src/approx_percentile_cont_with_weight.rs@@ -179,7 +179,7 @@ fn get_approx_percentile_cont_with_weight_doc() -> &'static Documentation {+----------------------------------------------------------------------+```"#,)- .with_argument("expression", "Expression to operate on. Can be a constant, column, or function, and any combination of arithmetic operators.")+ .with_standard_argument("expression", "The").with_argument("weight", "Expression to use as weight. Can be a constant, column, or function, and any combination of arithmetic operators.").with_argument("percentile", "Percentile to compute. Must be a float value between 0 and 1 (inclusive).").build()diff --git a/datafusion/functions-aggregate/src/array_agg.rs b/datafusion/functions-aggregate/src/array_agg.rsindex b44c4e6874..28ff6fb346 100644--- a/datafusion/functions-aggregate/src/array_agg.rs+++ b/datafusion/functions-aggregate/src/array_agg.rs@@ -168,7 +168,7 @@ fn get_array_agg_doc() -> &'static Documentation {+-----------------------------------------------+```"#,)- .with_argument("expression", "Expression to operate on. Can be a constant, column, or function, and any combination of arithmetic operators.")+ .with_standard_argument("expression", "The").build().unwrap()})diff --git a/datafusion/functions-aggregate/src/average.rs b/datafusion/functions-aggregate/src/average.rsindex ad58eecdf9..8782f8cfcc 100644--- a/datafusion/functions-aggregate/src/average.rs+++ b/datafusion/functions-aggregate/src/average.rs@@ -253,17 +253,17 @@ fn get_avg_doc() -> &'static Documentation {"Returns the average of numeric values in the specified column.",).with_syntax_example("avg(expression)")- .with_sql_example(r#"```sql+ .with_sql_example(+ r#"```sql> SELECT avg(column_name) FROM table_name;+---------------------------+| avg(column_name) |+---------------------------+| 42.75 |+---------------------------+-```"#,+```"#,)- .with_argument("expression", "Expression to operate on. Can be a constant, column, or function, and any combination of arithmetic operators.")- .with_argument("Aliases: ", "`mean`")+ .with_standard_argument("expression", "The").build().unwrap()})diff --git a/datafusion/functions-aggregate/src/bool_and_or.rs b/datafusion/functions-aggregate/src/bool_and_or.rsindex e212ba8d61..63ad1ea573 100644--- a/datafusion/functions-aggregate/src/bool_and_or.rs+++ b/datafusion/functions-aggregate/src/bool_and_or.rs@@ -191,15 +191,17 @@ fn get_bool_and_doc() -> &'static Documentation {"Returns true if all non-null input values are true, otherwise false.",).with_syntax_example("bool_and(expression)")- .with_sql_example(r#"```sql+ .with_sql_example(+ r#"```sql> SELECT bool_and(column_name) FROM table_name;+----------------------------+| bool_and(column_name) |+----------------------------+| true |+----------------------------+-```"#)- .with_argument("expression", "Expression to operate on. Can be a constant, column, or function, and any combination of arithmetic operators.")+```"#,+ )+ .with_standard_argument("expression", "The").build().unwrap()})@@ -338,15 +340,17 @@ fn get_bool_or_doc() -> &'static Documentation {"Returns true if any non-null input value is true, otherwise false.",).with_syntax_example("bool_or(expression)")- .with_sql_example(r#"```sql+ .with_sql_example(+ r#"```sql> SELECT bool_or(column_name) FROM table_name;+----------------------------+| bool_or(column_name) |+----------------------------+| true |+----------------------------+-```"#)- .with_standard_argument("expression", "Expression to operate on. Can be a constant, column, or function, and any combination of arithmetic operators.")+```"#,+ )+ .with_standard_argument("expression", "The").build().unwrap()})diff --git a/datafusion/functions-aggregate/src/correlation.rs b/datafusion/functions-aggregate/src/correlation.rsindex 60be3608e9..d5dc482d68 100644--- a/datafusion/functions-aggregate/src/correlation.rs+++ b/datafusion/functions-aggregate/src/correlation.rs@@ -124,16 +124,18 @@ fn get_corr_doc() -> &'static Documentation {"Returns the coefficient of correlation between two numeric values.",).with_syntax_example("corr(expression1, expression2)")- .with_sql_example(r#"```sql+ .with_sql_example(+ r#"```sql> SELECT corr(column1, column2) FROM table_name;+--------------------------------+| corr(column1, column2) |+--------------------------------+| 0.85 |+--------------------------------+-```"#)- .with_argument("expression1", "First expression to operate on. Can be a constant, column, or function, and any combination of arithmetic operators.")- .with_argument("expression2", "Second expression to operate on. Can be a constant, column, or function, and any combination of arithmetic operators.")+```"#,+ )+ .with_standard_argument("expression1", "First")+ .with_standard_argument("expression2", "Second").build().unwrap()})diff --git a/datafusion/functions-aggregate/src/count.rs b/datafusion/functions-aggregate/src/count.rsindex 23dd5b65bf..2511c70c46 100644--- a/datafusion/functions-aggregate/src/count.rs+++ b/datafusion/functions-aggregate/src/count.rs@@ -357,7 +357,7 @@ fn get_count_doc() -> &'static Documentation {| 120 |+------------------+```"#)- .with_argument("expression", "Expression to operate on. Can be a constant, column, or function, and any combination of arithmetic operators.")+ .with_standard_argument("expression", "The").build().unwrap()})diff --git a/datafusion/functions-aggregate/src/covariance.rs b/datafusion/functions-aggregate/src/covariance.rsindex c599b58ed2..f3b323d74d 100644--- a/datafusion/functions-aggregate/src/covariance.rs+++ b/datafusion/functions-aggregate/src/covariance.rs@@ -138,21 +138,20 @@ fn get_covar_samp_doc() -> &'static Documentation {DOCUMENTATION.get_or_init(|| {Documentation::builder().with_doc_section(DOC_SECTION_STATISTICAL)- .with_description(- "Returns the sample covariance of a set of number pairs.",- )+ .with_description("Returns the sample covariance of a set of number pairs.").with_syntax_example("covar_samp(expression1, expression2)")- .with_sql_example(r#"```sql+ .with_sql_example(+ r#"```sql> SELECT covar_samp(column1, column2) FROM table_name;+-----------------------------------+| covar_samp(column1, column2) |+-----------------------------------+| 8.25 |+-----------------------------------+-```"#,+```"#,)- .with_argument("expression1", "First expression to operate on. Can be a constant, column, or function, and any combination of arithmetic operators.")- .with_argument("expression2", "Second expression to operate on. Can be a constant, column, or function, and any combination of arithmetic operators.")+ .with_standard_argument("expression1", "First")+ .with_standard_argument("expression2", "Second").build().unwrap()})@@ -239,17 +238,18 @@ fn get_covar_pop_doc() -> &'static Documentation {"Returns the population covariance of a set of number pairs.",).with_syntax_example("covar_pop(expression1, expression2)")- .with_sql_example(r#"```sql+ .with_sql_example(+ r#"```sql> SELECT covar_pop(column1, column2) FROM table_name;+-----------------------------------+| covar_pop(column1, column2) |+-----------------------------------+| 7.63 |+-----------------------------------+-```"#,+```"#,)- .with_argument("expression1", "First expression to operate on. Can be a constant, column, or function, and any combination of arithmetic operators.")- .with_argument("expression2", "Second expression to operate on. Can be a constant, column, or function, and any combination of arithmetic operators.")+ .with_standard_argument("expression1", "First")+ .with_standard_argument("expression2", "Second").build().unwrap()})diff --git a/datafusion/functions-aggregate/src/first_last.rs b/datafusion/functions-aggregate/src/first_last.rsindex 02b8c52282..f6a84c84dc 100644--- a/datafusion/functions-aggregate/src/first_last.rs+++ b/datafusion/functions-aggregate/src/first_last.rs@@ -191,7 +191,7 @@ fn get_first_value_doc() -> &'static Documentation {+-----------------------------------------------+```"#,)- .with_argument("expression", "Expression to operate on. Can be a constant, column, or function, and any combination of arithmetic operators.")+ .with_standard_argument("expression", "The").build().unwrap()})@@ -519,7 +519,7 @@ fn get_last_value_doc() -> &'static Documentation {+-----------------------------------------------+```"#,)- .with_argument("expression", "Expression to operate on. Can be a constant, column, or function, and any combination of arithmetic operators.")+ .with_standard_argument("expression", "The").build().unwrap()})diff --git a/datafusion/functions-aggregate/src/median.rs b/datafusion/functions-aggregate/src/median.rsindex 8eb17db1ec..5a0cac2c82 100644--- a/datafusion/functions-aggregate/src/median.rs+++ b/datafusion/functions-aggregate/src/median.rs@@ -165,11 +165,10 @@ fn get_median_doc() -> &'static Documentation {DOCUMENTATION.get_or_init(|| {Documentation::builder().with_doc_section(DOC_SECTION_GENERAL)- .with_description(- "Returns the median value in the specified column.",- )+ .with_description("Returns the median value in the specified column.").with_syntax_example("median(expression)")- .with_sql_example(r#"```sql+ .with_sql_example(+ r#"```sql> SELECT median(column_name) FROM table_name;+----------------------+| median(column_name) |@@ -178,7 +177,7 @@ fn get_median_doc() -> &'static Documentation {+----------------------+```"#,)- .with_argument("expression", "Expression to operate on. Can be a constant, column, or function, and any combination of arithmetic operators.")+ .with_standard_argument("expression", "The").build().unwrap()})diff --git a/datafusion/functions-aggregate/src/min_max.rs b/datafusion/functions-aggregate/src/min_max.rsindex 2f7954a8ee..d576b1fdad 100644--- a/datafusion/functions-aggregate/src/min_max.rs+++ b/datafusion/functions-aggregate/src/min_max.rs@@ -345,20 +345,19 @@ fn get_max_doc() -> &'static Documentation {DOCUMENTATION.get_or_init(|| {Documentation::builder().with_doc_section(DOC_SECTION_GENERAL)- .with_description(- "Returns the maximum value in the specified column.",- )+ .with_description("Returns the maximum value in the specified column.").with_syntax_example("max(expression)")- .with_sql_example(r#"```sql+ .with_sql_example(+ r#"```sql> SELECT max(column_name) FROM table_name;+----------------------+| max(column_name) |+----------------------+| 150 |+----------------------+-```"#,+```"#,)- .with_argument("expression", "Expression to operate on. Can be a constant, column, or function, and any combination of arithmetic operators.")+ .with_standard_argument("expression", "The").build().unwrap()})@@ -1176,20 +1175,19 @@ fn get_min_doc() -> &'static Documentation {DOCUMENTATION.get_or_init(|| {Documentation::builder().with_doc_section(DOC_SECTION_GENERAL)- .with_description(- "Returns the minimum value in the specified column.",- )+ .with_description("Returns the minimum value in the specified column.").with_syntax_example("min(expression)")- .with_sql_example(r#"```sql+ .with_sql_example(+ r#"```sql> SELECT min(column_name) FROM table_name;+----------------------+| min(column_name) |+----------------------+| 12 |+----------------------+-```"#,+```"#,)- .with_argument("expression", "Expression to operate on. Can be a constant, column, or function, and any combination of arithmetic operators.")+ .with_standard_argument("expression", "The").build().unwrap()})diff --git a/datafusion/functions-aggregate/src/stddev.rs b/datafusion/functions-aggregate/src/stddev.rsindex 9f9da0c585..332a8efcc0 100644--- a/datafusion/functions-aggregate/src/stddev.rs+++ b/datafusion/functions-aggregate/src/stddev.rs@@ -146,20 +146,19 @@ fn get_stddev_doc() -> &'static Documentation {DOCUMENTATION.get_or_init(|| {Documentation::builder().with_doc_section(DOC_SECTION_STATISTICAL)- .with_description(- "Returns the standard deviation of a set of numbers.",- )+ .with_description("Returns the standard deviation of a set of numbers.").with_syntax_example("stddev(expression)")- .with_sql_example(r#"```sql+ .with_sql_example(+ r#"```sql> SELECT stddev(column_name) FROM table_name;+----------------------+| stddev(column_name) |+----------------------+| 12.34 |+----------------------+-```"#,+```"#,)- .with_argument("expression", "Expression to operate on. Can be a constant, column, or function, and any combination of arithmetic operators.")+ .with_standard_argument("expression", "The").build().unwrap()})@@ -273,16 +272,17 @@ fn get_stddev_pop_doc() -> &'static Documentation {"Returns the population standard deviation of a set of numbers.",).with_syntax_example("stddev_pop(expression)")- .with_sql_example(r#"```sql+ .with_sql_example(+ r#"```sql> SELECT stddev_pop(column_name) FROM table_name;+--------------------------+| stddev_pop(column_name) |+--------------------------+| 10.56 |+--------------------------+-```"#,+```"#,)- .with_argument("expression", "Expression to operate on. Can be a constant, column, or function, and any combination of arithmetic operators.")+ .with_standard_argument("expression", "The").build().unwrap()})diff --git a/datafusion/functions-aggregate/src/sum.rs b/datafusion/functions-aggregate/src/sum.rsindex 91e777dd2a..3b561f3028 100644--- a/datafusion/functions-aggregate/src/sum.rs+++ b/datafusion/functions-aggregate/src/sum.rs@@ -248,20 +248,19 @@ fn get_sum_doc() -> &'static Documentation {DOCUMENTATION.get_or_init(|| {Documentation::builder().with_doc_section(DOC_SECTION_GENERAL)- .with_description(- "Returns the sum of all values in the specified column.",- )+ .with_description("Returns the sum of all values in the specified column.").with_syntax_example("sum(expression)")- .with_sql_example(r#"```sql+ .with_sql_example(+ r#"```sql> SELECT sum(column_name) FROM table_name;+-----------------------+| sum(column_name) |+-----------------------+| 12345 |+-----------------------+-```"#,+```"#,)- .with_argument("expression", "Expression to operate on. Can be a constant, column, or function, and any combination of arithmetic operators.")+ .with_standard_argument("expression", "The").build().unwrap()})diff --git a/docs/source/user-guide/sql/aggregate_functions_new.md b/docs/source/user-guide/sql/aggregate_functions_new.mdindex fc918c3b15..6c9d9b043f 100644--- a/docs/source/user-guide/sql/aggregate_functions_new.md+++ b/docs/source/user-guide/sql/aggregate_functions_new.md@@ -70,7 +70,7 @@ array_agg(expression [ORDER BY expression])#### Arguments-- **expression**: Expression to operate on. Can be a constant, column, or function, and any combination of arithmetic operators.+- **expression**: The expression to operate on. Can be a constant, column, or function, and any combination of operators.#### Example@@ -93,8 +93,7 @@ avg(expression)#### Arguments-- **expression**: Expression to operate on. Can be a constant, column, or function, and any combination of arithmetic operators.-- **Aliases: **: `mean`+- **expression**: The expression to operate on. Can be a constant, column, or function, and any combination of operators.#### Example@@ -157,7 +156,7 @@ bool_and(expression)#### Arguments-- **expression**: Expression to operate on. Can be a constant, column, or function, and any combination of arithmetic operators.+- **expression**: The expression to operate on. Can be a constant, column, or function, and any combination of operators.#### Example@@ -180,7 +179,7 @@ bool_and(expression)#### Arguments-- **expression**: Expression to operate on. Can be a constant, column, or function, and any combination of arithmetic operators.+- **expression**: The expression to operate on. Can be a constant, column, or function, and any combination of operators.#### Example@@ -203,7 +202,7 @@ count(expression)#### Arguments-- **expression**: Expression to operate on. Can be a constant, column, or function, and any combination of arithmetic operators.+- **expression**: The expression to operate on. Can be a constant, column, or function, and any combination of operators.#### Example@@ -233,7 +232,7 @@ first_value(expression [ORDER BY expression])#### Arguments-- **expression**: Expression to operate on. Can be a constant, column, or function, and any combination of arithmetic operators.+- **expression**: The expression to operate on. Can be a constant, column, or function, and any combination of operators.#### Example@@ -283,7 +282,7 @@ first_value(expression [ORDER BY expression])#### Arguments-- **expression**: Expression to operate on. Can be a constant, column, or function, and any combination of arithmetic operators.+- **expression**: The expression to operate on. Can be a constant, column, or function, and any combination of operators.#### Example@@ -306,7 +305,7 @@ max(expression)#### Arguments-- **expression**: Expression to operate on. Can be a constant, column, or function, and any combination of arithmetic operators.+- **expression**: The expression to operate on. Can be a constant, column, or function, and any combination of operators.#### Example@@ -333,7 +332,7 @@ median(expression)#### Arguments-- **expression**: Expression to operate on. Can be a constant, column, or function, and any combination of arithmetic operators.+- **expression**: The expression to operate on. Can be a constant, column, or function, and any combination of operators.#### Example@@ -356,7 +355,7 @@ max(expression)#### Arguments-- **expression**: Expression to operate on. Can be a constant, column, or function, and any combination of arithmetic operators.+- **expression**: The expression to operate on. Can be a constant, column, or function, and any combination of operators.#### Example@@ -404,7 +403,7 @@ sum(expression)#### Arguments-- **expression**: Expression to operate on. Can be a constant, column, or function, and any combination of arithmetic operators.+- **expression**: The expression to operate on. Can be a constant, column, or function, and any combination of operators.#### Example@@ -483,8 +482,8 @@ corr(expression1, expression2)#### Arguments-- **expression1**: First expression to operate on. Can be a constant, column, or function, and any combination of arithmetic operators.-- **expression2**: Second expression to operate on. Can be a constant, column, or function, and any combination of arithmetic operators.+- **expression1**: First expression to operate on. Can be a constant, column, or function, and any combination of operators.+- **expression2**: Second expression to operate on. Can be a constant, column, or function, and any combination of operators.#### Example@@ -511,8 +510,8 @@ covar_samp(expression1, expression2)#### Arguments-- **expression1**: First expression to operate on. Can be a constant, column, or function, and any combination of arithmetic operators.-- **expression2**: Second expression to operate on. Can be a constant, column, or function, and any combination of arithmetic operators.+- **expression1**: First expression to operate on. Can be a constant, column, or function, and any combination of operators.+- **expression2**: Second expression to operate on. Can be a constant, column, or function, and any combination of operators.#### Example@@ -535,8 +534,8 @@ covar_samp(expression1, expression2)#### Arguments-- **expression1**: First expression to operate on. Can be a constant, column, or function, and any combination of arithmetic operators.-- **expression2**: Second expression to operate on. Can be a constant, column, or function, and any combination of arithmetic operators.+- **expression1**: First expression to operate on. Can be a constant, column, or function, and any combination of operators.+- **expression2**: Second expression to operate on. Can be a constant, column, or function, and any combination of operators.#### Example@@ -592,7 +591,7 @@ stddev(expression)#### Arguments-- **expression**: Expression to operate on. Can be a constant, column, or function, and any combination of arithmetic operators.+- **expression**: The expression to operate on. Can be a constant, column, or function, and any combination of operators.#### Example@@ -619,7 +618,7 @@ stddev(expression)#### Arguments-- **expression**: Expression to operate on. Can be a constant, column, or function, and any combination of arithmetic operators.+- **expression**: The expression to operate on. Can be a constant, column, or function, and any combination of operators.#### Example@@ -653,7 +652,7 @@ approx_distinct(expression)#### Arguments-- **expression**: Expression to operate on. Can be a constant, column, or function, and any combination of arithmetic operators.+- **expression**: The expression to operate on. Can be a constant, column, or function, and any combination of operators.#### Example@@ -676,7 +675,7 @@ approx_median(expression)#### Arguments-- **expression**: Expression to operate on. Can be a constant, column, or function, and any combination of arithmetic operators.+- **expression**: The expression to operate on. Can be a constant, column, or function, and any combination of operators.#### Example@@ -699,7 +698,7 @@ approx_percentile_cont(expression, percentile, centroids)#### Arguments-- **expression**: Expression to operate on. Can be a constant, column, or function, and any combination of arithmetic operators.+- **expression**: The expression to operate on. Can be a constant, column, or function, and any combination of operators.- **percentile**: Percentile to compute. Must be a float value between 0 and 1 (inclusive).- **centroids**: Number of centroids to use in the t-digest algorithm. _Default is 100_. A higher number results in more accurate approximation but requires more memory.@@ -724,7 +723,7 @@ approx_percentile_cont_with_weight(expression, weight, percentile)#### Arguments-- **expression**: Expression to operate on. Can be a constant, column, or function, and any combination of arithmetic operators.+- **expression**: The expression to operate on. Can be a constant, column, or function, and any combination of operators.- **weight**: Expression to use as weight. Can be a constant, column, or function, and any combination of arithmetic operators.- **percentile**: Percentile to compute. Must be a float value between 0 and 1 (inclusive).