Skip to content

Apache DataFusion SQL Query Engine

fix: correct the copy-pasted docs for covar_pop and bool_or (#24990)

jackylee67e65382ac6e
diff --git a/datafusion/functions-aggregate/src/bool_and_or.rs b/datafusion/functions-aggregate/src/bool_and_or.rs
index 5f37def71b..33c9880e27 100644
--- a/datafusion/functions-aggregate/src/bool_and_or.rs
+++ b/datafusion/functions-aggregate/src/bool_and_or.rs
@@ -221,12 +221,12 @@ impl Accumulator for BoolAndAccumulator {
#[user_doc(
doc_section(label = "General Functions"),
- description = "Returns true if all non-null input values are true, otherwise false.",
- syntax_example = "bool_and(expression)",
+ description = "Returns true if any non-null input value is true, otherwise false.",
+ syntax_example = "bool_or(expression)",
sql_example = r#"```sql
-> SELECT bool_and(column_name) FROM table_name;
+> SELECT bool_or(column_name) FROM table_name;
+----------------------------+
-| bool_and(column_name) |
+| bool_or(column_name) |
+----------------------------+
| true |
+----------------------------+
diff --git a/datafusion/functions-aggregate/src/covariance.rs b/datafusion/functions-aggregate/src/covariance.rs
index 5d4992336c..454d56f8ea 100644
--- a/datafusion/functions-aggregate/src/covariance.rs
+++ b/datafusion/functions-aggregate/src/covariance.rs
@@ -132,14 +132,14 @@ impl AggregateUDFImpl for CovarianceSample {
#[user_doc(
doc_section(label = "Statistical Functions"),
- description = "Returns the sample covariance of a set of number pairs.",
- syntax_example = "covar_samp(expression1, expression2)",
+ description = "Returns the population covariance of a set of number pairs.",
+ syntax_example = "covar_pop(expression1, expression2)",
sql_example = r#"```sql
-> SELECT covar_samp(column1, column2) FROM table_name;
+> SELECT covar_pop(column1, column2) FROM table_name;
+-----------------------------------+
-| covar_samp(column1, column2) |
+| covar_pop(column1, column2) |
+-----------------------------------+
-| 8.25 |
+| 7.63333333333 |
+-----------------------------------+
```"#,
standard_argument(name = "expression1", prefix = "First"),
diff --git a/docs/source/user-guide/sql/aggregate_functions.md b/docs/source/user-guide/sql/aggregate_functions.md
index 4569a8850c..2d59970b00 100644
--- a/docs/source/user-guide/sql/aggregate_functions.md
+++ b/docs/source/user-guide/sql/aggregate_functions.md
@@ -247,10 +247,10 @@ bool_and(expression)
### `bool_or`
-Returns true if all non-null input values are true, otherwise false.
+Returns true if any non-null input value is true, otherwise false.
```sql
-bool_and(expression)
+bool_or(expression)
```
#### Arguments
@@ -260,9 +260,9 @@ bool_and(expression)
#### Example
```sql
-> SELECT bool_and(column_name) FROM table_name;
+> SELECT bool_or(column_name) FROM table_name;
+----------------------------+
-| bool_and(column_name) |
+| bool_or(column_name) |
+----------------------------+
| true |
+----------------------------+
@@ -644,10 +644,10 @@ _Alias of [covar_samp](#covar_samp)._
### `covar_pop`
-Returns the sample covariance of a set of number pairs.
+Returns the population covariance of a set of number pairs.
```sql
-covar_samp(expression1, expression2)
+covar_pop(expression1, expression2)
```
#### Arguments
@@ -658,11 +658,11 @@ covar_samp(expression1, expression2)
#### Example
```sql
-> SELECT covar_samp(column1, column2) FROM table_name;
+> SELECT covar_pop(column1, column2) FROM table_name;
+-----------------------------------+
-| covar_samp(column1, column2) |
+| covar_pop(column1, column2) |
+-----------------------------------+
-| 8.25 |
+| 7.63333333333 |
+-----------------------------------+
```