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..8782f8cfcc7c6 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.rs index e212ba8d61726..63ad1ea573d56 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.rs index 60be3608e99e0..d5dc482d68d2c 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.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..f3b323d74d30a 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.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..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) | @@ -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.rs index 2f7954a8ee021..d576b1fdad788 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.rs index 9f9da0c585fcd..332a8efcc0f98 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.rs index 91e777dd2a87f..3b561f3028dea 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.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).