From fc792d15020e7c9ba6c6c57fa8699f9550406a97 Mon Sep 17 00:00:00 2001 From: Jonathan Chen Date: Fri, 11 Oct 2024 12:13:05 -0400 Subject: [PATCH 1/2] fix aggregate docs --- .../src/approx_distinct.rs | 2 +- .../functions-aggregate/src/approx_median.rs | 2 +- .../src/approx_percentile_cont.rs | 2 +- .../src/approx_percentile_cont_with_weight.rs | 2 +- .../functions-aggregate/src/array_agg.rs | 2 +- datafusion/functions-aggregate/src/average.rs | 3 +- .../functions-aggregate/src/bool_and_or.rs | 4 +- .../functions-aggregate/src/correlation.rs | 4 +- datafusion/functions-aggregate/src/count.rs | 2 +- .../functions-aggregate/src/covariance.rs | 8 ++-- .../functions-aggregate/src/first_last.rs | 4 +- datafusion/functions-aggregate/src/median.rs | 2 +- datafusion/functions-aggregate/src/min_max.rs | 4 +- datafusion/functions-aggregate/src/stddev.rs | 4 +- datafusion/functions-aggregate/src/sum.rs | 2 +- .../user-guide/sql/aggregate_functions_new.md | 47 +++++++++---------- 16 files changed, 46 insertions(+), 48 deletions(-) diff --git a/datafusion/functions-aggregate/src/approx_distinct.rs b/datafusion/functions-aggregate/src/approx_distinct.rs index efa9a6d8daadc..d6cc711147b5d 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.rs index dd5bb8d441ed7..84442fa5a2e65 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.rs index b4488d6d9e610..9b8a99e977d2d 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.rs index 8cbf9587a75ae..a5362713a6fb7 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.rs index b44c4e6874efe..28ff6fb346e50 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.rs index ad58eecdf9497..ca160976f7e84 100644 --- a/datafusion/functions-aggregate/src/average.rs +++ b/datafusion/functions-aggregate/src/average.rs @@ -262,8 +262,7 @@ fn get_avg_doc() -> &'static Documentation { +---------------------------+ ```"#, ) - .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.rs index e212ba8d61726..77e3be22e9a70 100644 --- a/datafusion/functions-aggregate/src/bool_and_or.rs +++ b/datafusion/functions-aggregate/src/bool_and_or.rs @@ -199,7 +199,7 @@ fn get_bool_and_doc() -> &'static Documentation { | 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() }) @@ -346,7 +346,7 @@ fn get_bool_or_doc() -> &'static Documentation { | 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.rs index 60be3608e99e0..6285d45026fec 100644 --- a/datafusion/functions-aggregate/src/correlation.rs +++ b/datafusion/functions-aggregate/src/correlation.rs @@ -132,8 +132,8 @@ fn get_corr_doc() -> &'static Documentation { | 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.rs index 23dd5b65bf822..2511c70c4608a 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.rs index c599b58ed207b..bba49afe546c4 100644 --- a/datafusion/functions-aggregate/src/covariance.rs +++ b/datafusion/functions-aggregate/src/covariance.rs @@ -151,8 +151,8 @@ fn get_covar_samp_doc() -> &'static Documentation { +-----------------------------------+ ```"#, ) - .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() }) @@ -248,8 +248,8 @@ fn get_covar_pop_doc() -> &'static Documentation { +-----------------------------------+ ```"#, ) - .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.rs index 02b8c522823e0..f6a84c84dcb0b 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.rs index 8eb17db1eca96..c7a31ffac6c0e 100644 --- a/datafusion/functions-aggregate/src/median.rs +++ b/datafusion/functions-aggregate/src/median.rs @@ -178,7 +178,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.rs index 3d2915fd09cb0..bcf506f29096f 100644 --- a/datafusion/functions-aggregate/src/min_max.rs +++ b/datafusion/functions-aggregate/src/min_max.rs @@ -349,7 +349,7 @@ fn get_max_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() }) @@ -1174,7 +1174,7 @@ fn get_min_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/stddev.rs b/datafusion/functions-aggregate/src/stddev.rs index 9f9da0c585fcd..6da43b245aae1 100644 --- a/datafusion/functions-aggregate/src/stddev.rs +++ b/datafusion/functions-aggregate/src/stddev.rs @@ -159,7 +159,7 @@ fn get_stddev_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() }) @@ -282,7 +282,7 @@ fn get_stddev_pop_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/sum.rs b/datafusion/functions-aggregate/src/sum.rs index 91e777dd2a87f..43491c3548c7a 100644 --- a/datafusion/functions-aggregate/src/sum.rs +++ b/datafusion/functions-aggregate/src/sum.rs @@ -261,7 +261,7 @@ fn get_sum_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/docs/source/user-guide/sql/aggregate_functions_new.md b/docs/source/user-guide/sql/aggregate_functions_new.md index fc918c3b15eaf..6c9d9b043fa63 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). From f953d5872b4dc8563163d0f06bf29e729c5fed88 Mon Sep 17 00:00:00 2001 From: Jonathan Chen Date: Fri, 11 Oct 2024 12:17:03 -0400 Subject: [PATCH 2/2] fmt fix --- datafusion/functions-aggregate/src/average.rs | 5 +++-- .../functions-aggregate/src/bool_and_or.rs | 12 ++++++++---- .../functions-aggregate/src/correlation.rs | 6 ++++-- .../functions-aggregate/src/covariance.rs | 14 +++++++------- datafusion/functions-aggregate/src/median.rs | 7 +++---- datafusion/functions-aggregate/src/min_max.rs | 18 ++++++++---------- datafusion/functions-aggregate/src/stddev.rs | 14 +++++++------- datafusion/functions-aggregate/src/sum.rs | 9 ++++----- 8 files changed, 44 insertions(+), 41 deletions(-) diff --git a/datafusion/functions-aggregate/src/average.rs b/datafusion/functions-aggregate/src/average.rs index ca160976f7e84..8782f8cfcc7c6 100644 --- a/datafusion/functions-aggregate/src/average.rs +++ b/datafusion/functions-aggregate/src/average.rs @@ -253,14 +253,15 @@ 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_standard_argument("expression", "The") .build() diff --git a/datafusion/functions-aggregate/src/bool_and_or.rs b/datafusion/functions-aggregate/src/bool_and_or.rs index 77e3be22e9a70..63ad1ea573d56 100644 --- a/datafusion/functions-aggregate/src/bool_and_or.rs +++ b/datafusion/functions-aggregate/src/bool_and_or.rs @@ -191,14 +191,16 @@ 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_standard_argument("expression", "The") .build() .unwrap() @@ -338,14 +340,16 @@ 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", "The") .build() .unwrap() diff --git a/datafusion/functions-aggregate/src/correlation.rs b/datafusion/functions-aggregate/src/correlation.rs index 6285d45026fec..d5dc482d68d2c 100644 --- a/datafusion/functions-aggregate/src/correlation.rs +++ b/datafusion/functions-aggregate/src/correlation.rs @@ -124,14 +124,16 @@ 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_standard_argument("expression1", "First") .with_standard_argument("expression2", "Second") .build() diff --git a/datafusion/functions-aggregate/src/covariance.rs b/datafusion/functions-aggregate/src/covariance.rs index bba49afe546c4..f3b323d74d30a 100644 --- a/datafusion/functions-aggregate/src/covariance.rs +++ b/datafusion/functions-aggregate/src/covariance.rs @@ -138,18 +138,17 @@ 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_standard_argument("expression1", "First") .with_standard_argument("expression2", "Second") @@ -239,14 +238,15 @@ 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_standard_argument("expression1", "First") .with_standard_argument("expression2", "Second") diff --git a/datafusion/functions-aggregate/src/median.rs b/datafusion/functions-aggregate/src/median.rs index c7a31ffac6c0e..5a0cac2c829ed 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) | diff --git a/datafusion/functions-aggregate/src/min_max.rs b/datafusion/functions-aggregate/src/min_max.rs index bcf506f29096f..5586675209cb2 100644 --- a/datafusion/functions-aggregate/src/min_max.rs +++ b/datafusion/functions-aggregate/src/min_max.rs @@ -336,18 +336,17 @@ 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_standard_argument("expression", "The") .build() @@ -1161,18 +1160,17 @@ 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_standard_argument("expression", "The") .build() diff --git a/datafusion/functions-aggregate/src/stddev.rs b/datafusion/functions-aggregate/src/stddev.rs index 6da43b245aae1..332a8efcc0f98 100644 --- a/datafusion/functions-aggregate/src/stddev.rs +++ b/datafusion/functions-aggregate/src/stddev.rs @@ -146,18 +146,17 @@ 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_standard_argument("expression", "The") .build() @@ -273,14 +272,15 @@ 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_standard_argument("expression", "The") .build() diff --git a/datafusion/functions-aggregate/src/sum.rs b/datafusion/functions-aggregate/src/sum.rs index 43491c3548c7a..3b561f3028dea 100644 --- a/datafusion/functions-aggregate/src/sum.rs +++ b/datafusion/functions-aggregate/src/sum.rs @@ -248,18 +248,17 @@ 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_standard_argument("expression", "The") .build()