Skip to content

Commit

Permalink
Minor: fix Aggregation Docs from review (#12880)
Browse files Browse the repository at this point in the history
* fix aggregate docs

* fmt fix

---------

Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
  • Loading branch information
jonathanc-n and alamb authored Oct 16, 2024
1 parent 91899d4 commit 5d6254c
Show file tree
Hide file tree
Showing 16 changed files with 90 additions and 89 deletions.
2 changes: 1 addition & 1 deletion datafusion/functions-aggregate/src/approx_distinct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
})
Expand Down
2 changes: 1 addition & 1 deletion datafusion/functions-aggregate/src/approx_median.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion datafusion/functions-aggregate/src/array_agg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
})
Expand Down
8 changes: 4 additions & 4 deletions datafusion/functions-aggregate/src/average.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
})
Expand Down
16 changes: 10 additions & 6 deletions datafusion/functions-aggregate/src/bool_and_or.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
})
Expand Down Expand Up @@ -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()
})
Expand Down
10 changes: 6 additions & 4 deletions datafusion/functions-aggregate/src/correlation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
})
Expand Down
2 changes: 1 addition & 1 deletion datafusion/functions-aggregate/src/count.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
})
Expand Down
22 changes: 11 additions & 11 deletions datafusion/functions-aggregate/src/covariance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
})
Expand Down Expand Up @@ -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()
})
Expand Down
4 changes: 2 additions & 2 deletions datafusion/functions-aggregate/src/first_last.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
})
Expand Down Expand Up @@ -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()
})
Expand Down
9 changes: 4 additions & 5 deletions datafusion/functions-aggregate/src/median.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) |
Expand All @@ -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()
})
Expand Down
22 changes: 10 additions & 12 deletions datafusion/functions-aggregate/src/min_max.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
})
Expand Down Expand Up @@ -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()
})
Expand Down
18 changes: 9 additions & 9 deletions datafusion/functions-aggregate/src/stddev.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
})
Expand Down Expand Up @@ -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()
})
Expand Down
11 changes: 5 additions & 6 deletions datafusion/functions-aggregate/src/sum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
})
Expand Down
Loading

0 comments on commit 5d6254c

Please sign in to comment.