Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions datafusion/expr-common/src/signature.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1493,6 +1493,7 @@ mod tests {
vec![DataType::UInt16, DataType::UInt16],
vec![DataType::UInt32, DataType::UInt32],
vec![DataType::UInt64, DataType::UInt64],
vec![DataType::Float16, DataType::Float16],
vec![DataType::Float32, DataType::Float32],
vec![DataType::Float64, DataType::Float64]
]
Expand Down
1 change: 1 addition & 0 deletions datafusion/expr-common/src/type_coercion/aggregates.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ pub static NUMERICS: &[DataType] = &[
DataType::UInt16,
DataType::UInt32,
DataType::UInt64,
DataType::Float16,
DataType::Float32,
DataType::Float64,
];
Expand Down
2 changes: 1 addition & 1 deletion datafusion/optimizer/src/analyzer/type_coercion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1754,7 +1754,7 @@ mod test {
.err()
.unwrap()
.strip_backtrace();
assert!(err.starts_with("Error during planning: Failed to coerce arguments to satisfy a call to 'avg' function: coercion from Utf8 to the signature Uniform(1, [Int8, Int16, Int32, Int64, UInt8, UInt16, UInt32, UInt64, Float32, Float64]) failed"));
assert!(err.starts_with("Error during planning: Failed to coerce arguments to satisfy a call to 'avg' function: coercion from Utf8 to the signature Uniform(1, [Int8, Int16, Int32, Int64, UInt8, UInt16, UInt32, UInt64, Float16, Float32, Float64]) failed"));
Ok(())
}

Expand Down
35 changes: 34 additions & 1 deletion datafusion/sqllogictest/test_files/aggregate.slt
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,16 @@ SELECT covar(c2, c12) FROM aggregate_test_100
----
-0.079969012479

query R
SELECT covar_pop(arrow_cast(c2, 'Float16'), arrow_cast(c12, 'Float16')) FROM aggregate_test_100
----
-0.079163311005

query R
SELECT covar(arrow_cast(c2, 'Float16'), arrow_cast(c12, 'Float16')) FROM aggregate_test_100
----
-0.079962940409

# single_row_query_covar_1
query R
select covar_samp(sq.column1, sq.column2) from (values (1.1, 2.2)) as sq
Expand Down Expand Up @@ -996,6 +1006,24 @@ select approx_median(arrow_cast(col_f32, 'Float16')), arrow_typeof(approx_median
----
2.75 Float16

# This shouldn't be NaN, see:
# https://github.com/apache/datafusion/issues/18945
query RT
select
percentile_cont(0.5) within group (order by arrow_cast(col_f32, 'Float16')),
arrow_typeof(percentile_cont(0.5) within group (order by arrow_cast(col_f32, 'Float16')))
from median_table;
----
NaN Float16

query RT
select
approx_percentile_cont(0.5) within group (order by arrow_cast(col_f32, 'Float16')),
arrow_typeof(approx_percentile_cont(0.5) within group (order by arrow_cast(col_f32, 'Float16')))
from median_table;
----
2.75 Float16

query ?T
select approx_median(NULL), arrow_typeof(approx_median(NULL)) from median_table;
----
Expand Down Expand Up @@ -6353,7 +6381,12 @@ from aggregate_test_100;
----
0.051534002628 0.48427355347 100 0.001929150558 0.479274948239 0.508972509913 6.707779292571 9.234223721582 0.345678715695


query R
select
regr_slope(arrow_cast(c12, 'Float16'), arrow_cast(c11, 'Float16'))
from aggregate_test_100;
----
0.051477733249

# regr_*() functions ignore NULLs
query RRIRRRRRR
Expand Down