Skip to content

Commit

Permalink
Merge branch 'main' of github.com:apache/arrow-datafusion into array-…
Browse files Browse the repository at this point in the history
…coercion
  • Loading branch information
jayzhan211 committed Oct 10, 2024
2 parents 368908d + 8945e7a commit 2de7041
Show file tree
Hide file tree
Showing 11 changed files with 88 additions and 13 deletions.
4 changes: 3 additions & 1 deletion datafusion/functions-aggregate-common/src/tdigest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,9 @@ impl TDigest {
let max = cast_scalar_f64!(&state[3]);
let min = cast_scalar_f64!(&state[4]);

assert!(max.total_cmp(&min).is_ge());
if min.is_finite() && max.is_finite() {
assert!(max.total_cmp(&min).is_ge());
}

Self {
max_size,
Expand Down
18 changes: 18 additions & 0 deletions datafusion/sqllogictest/test_files/aggregate.slt
Original file line number Diff line number Diff line change
Expand Up @@ -1385,6 +1385,24 @@ NaN
statement ok
DROP TABLE tmp_percentile_cont;

# Test for issue where approx_percentile_cont_with_weight

statement ok
CREATE TABLE t1(v1 BOOL);

statement ok
INSERT INTO t1 VALUES (TRUE);

# ISSUE: https://github.com/apache/datafusion/issues/12716
# This test verifies that approx_percentile_cont_with_weight does not panic when given 'NaN' and returns 'inf'
query R
SELECT approx_percentile_cont_with_weight('NaN'::DOUBLE, 0, 0) FROM t1 WHERE t1.v1;
----
Infinity

statement ok
DROP TABLE t1;

# csv_query_cube_avg
query TIR
SELECT c1, c2, AVG(c3) FROM aggregate_test_100 GROUP BY CUBE (c1, c2) ORDER BY c1, c2
Expand Down
3 changes: 2 additions & 1 deletion datafusion/wasmtest/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,5 @@ wasm-bindgen = "0.2.87"
wasm-bindgen-futures = "0.4.40"

[dev-dependencies]
wasm-bindgen-test = "0.3"
tokio = { workspace = true }
wasm-bindgen-test = "0.3.44"
5 changes: 3 additions & 2 deletions datafusion/wasmtest/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,14 @@ mod test {

wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser);

#[wasm_bindgen_test]
#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)]
#[cfg_attr(not(target_arch = "wasm32"), allow(dead_code))]
fn datafusion_test() {
basic_exprs();
basic_parse();
}

#[wasm_bindgen_test]
#[wasm_bindgen_test(unsupported = tokio::test)]
async fn basic_execute() {
let sql = "SELECT 2 + 2;";

Expand Down
24 changes: 20 additions & 4 deletions dev/update_function_docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,11 @@ dev/update_function_docs.sh file for updating surrounding text.
# Aggregate Functions (NEW)
This page is a WIP and will replace the Aggregate Functions page once completed.
Note: this documentation is in the process of being migrated to be [automatically created from the codebase].
Please see the [Aggregate Functions (old)](aggregate_functions.md) page for
the rest of the documentation.
[automatically created from the codebase]: https://github.com/apache/datafusion/issues/12740
Aggregate functions operate on a set of values to compute a single result.
EOF
Expand Down Expand Up @@ -105,7 +109,12 @@ dev/update_function_docs.sh file for updating surrounding text.
# Scalar Functions (NEW)
This page is a WIP and will replace the Scalar Functions page once completed.
Note: this documentation is in the process of being migrated to be [automatically created from the codebase].
Please see the [Scalar Functions (old)](aggregate_functions.md) page for
the rest of the documentation.
[automatically created from the codebase]: https://github.com/apache/datafusion/issues/12740
EOF

echo "Running CLI and inserting scalar function docs table"
Expand Down Expand Up @@ -151,9 +160,16 @@ dev/update_function_docs.sh file for updating surrounding text.
# Window Functions (NEW)
This page is a WIP and will replace the Window Functions page once completed.
Note: this documentation is in the process of being migrated to be [automatically created from the codebase].
Please see the [Window Functions (Old)](window_functions.md) page for
the rest of the documentation.
[automatically created from the codebase]: https://github.com/apache/datafusion/issues/12740
A _window function_ performs a calculation across a set of table rows that are somehow related to the current row. This is comparable to the type of calculation that can be done with an aggregate function. However, window functions do not cause rows to become grouped into a single output row like non-window aggregate calls would. Instead, the rows retain their separate identities. Behind the scenes, the window function is able to access more than just the current row of the query result
A _window function_ performs a calculation across a set of table rows that are somehow related to the current row.
This is comparable to the type of calculation that can be done with an aggregate function.
However, window functions do not cause rows to become grouped into a single output row like non-window aggregate calls would.
Instead, the rows retain their separate identities. Behind the scenes, the window function is able to access more than just the current row of the query result
Here is an example that shows how to compare each employee's salary with the average salary in his or her department:
Expand Down
6 changes: 6 additions & 0 deletions docs/source/user-guide/sql/aggregate_functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@

Aggregate functions operate on a set of values to compute a single result.

Note: this documentation is in the process of being migrated to be [automatically created from the codebase].
Please see the [Aggregate Functions (new)](aggregate_functions_new.md) page for
the rest of the documentation.

[automatically created from the codebase]: https://github.com/apache/datafusion/issues/12740

## General

- [avg](#avg)
Expand Down
6 changes: 5 additions & 1 deletion docs/source/user-guide/sql/aggregate_functions_new.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ dev/update_function_docs.sh file for updating surrounding text.

# Aggregate Functions (NEW)

This page is a WIP and will replace the Aggregate Functions page once completed.
Note: this documentation is in the process of being migrated to be [automatically created from the codebase].
Please see the [Aggregate Functions (old)](aggregate_functions.md) page for
the rest of the documentation.

[automatically created from the codebase]: https://github.com/apache/datafusion/issues/12740

Aggregate functions operate on a set of values to compute a single result.

Expand Down
8 changes: 8 additions & 0 deletions docs/source/user-guide/sql/scalar_functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@

# Scalar Functions

Scalar functions operate on a single row at a time and return a single value.

Note: this documentation is in the process of being migrated to be [automatically created from the codebase].
Please see the [Scalar Functions (new)](scalar_functions_new.md) page for
the rest of the documentation.

[automatically created from the codebase]: https://github.com/apache/datafusion/issues/12740

## Math Functions

- [abs](#abs)
Expand Down
6 changes: 5 additions & 1 deletion docs/source/user-guide/sql/scalar_functions_new.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ dev/update_function_docs.sh file for updating surrounding text.

# Scalar Functions (NEW)

This page is a WIP and will replace the Scalar Functions page once completed.
Note: this documentation is in the process of being migrated to be [automatically created from the codebase].
Please see the [Scalar Functions (old)](aggregate_functions.md) page for
the rest of the documentation.

[automatically created from the codebase]: https://github.com/apache/datafusion/issues/12740

## Math Functions

Expand Down
10 changes: 9 additions & 1 deletion docs/source/user-guide/sql/window_functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,15 @@

# Window Functions

A _window function_ performs a calculation across a set of table rows that are somehow related to the current row. This is comparable to the type of calculation that can be done with an aggregate function. However, window functions do not cause rows to become grouped into a single output row like non-window aggregate calls would. Instead, the rows retain their separate identities. Behind the scenes, the window function is able to access more than just the current row of the query result
A _window function_ performs a calculation across a set of table rows that are somehow related to the current row.

Note: this documentation is in the process of being migrated to be [automatically created from the codebase].
Please see the [Window Functions (new)](window_functions_new.md) page for
the rest of the documentation.

[automatically created from the codebase]: https://github.com/apache/datafusion/issues/12740

Window functions are comparable to the type of calculation that can be done with an aggregate function. However, window functions do not cause rows to become grouped into a single output row like non-window aggregate calls would. Instead, the rows retain their separate identities. Behind the scenes, the window function is able to access more than just the current row of the query result

Here is an example that shows how to compare each employee's salary with the average salary in his or her department:

Expand Down
11 changes: 9 additions & 2 deletions docs/source/user-guide/sql/window_functions_new.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,16 @@ dev/update_function_docs.sh file for updating surrounding text.

# Window Functions (NEW)

This page is a WIP and will replace the Window Functions page once completed.
Note: this documentation is in the process of being migrated to be [automatically created from the codebase].
Please see the [Window Functions (Old)](window_functions.md) page for
the rest of the documentation.

A _window function_ performs a calculation across a set of table rows that are somehow related to the current row. This is comparable to the type of calculation that can be done with an aggregate function. However, window functions do not cause rows to become grouped into a single output row like non-window aggregate calls would. Instead, the rows retain their separate identities. Behind the scenes, the window function is able to access more than just the current row of the query result
[automatically created from the codebase]: https://github.com/apache/datafusion/issues/12740

A _window function_ performs a calculation across a set of table rows that are somehow related to the current row.
This is comparable to the type of calculation that can be done with an aggregate function.
However, window functions do not cause rows to become grouped into a single output row like non-window aggregate calls would.
Instead, the rows retain their separate identities. Behind the scenes, the window function is able to access more than just the current row of the query result

Here is an example that shows how to compare each employee's salary with the average salary in his or her department:

Expand Down

0 comments on commit 2de7041

Please sign in to comment.