Skip to content

Commit d9a1562

Browse files
committed
Migrate tests
1 parent 09fecca commit d9a1562

File tree

5 files changed

+52
-56
lines changed

5 files changed

+52
-56
lines changed

datafusion/physical-expr/src/aggregate/variance.rs

-53
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,6 @@ impl Accumulator for VarianceAccumulator {
257257
}
258258
}
259259

260-
// TODO (yyin): Move to aggregations.slt
261260
#[cfg(test)]
262261
mod tests {
263262
use super::*;
@@ -285,24 +284,6 @@ mod tests {
285284
generic_test_op!(a, DataType::Float64, VariancePop, ScalarValue::from(2_f64))
286285
}
287286

288-
// #[test]
289-
// fn variance_f64_3() -> Result<()> {
290-
// let a: ArrayRef =
291-
// Arc::new(Float64Array::from(vec![1_f64, 2_f64, 3_f64, 4_f64, 5_f64]));
292-
// generic_test_op!(a, DataType::Float64, Variance, ScalarValue::from(2.5_f64))
293-
// }
294-
295-
// #[test]
296-
// fn variance_f64_4() -> Result<()> {
297-
// let a: ArrayRef = Arc::new(Float64Array::from(vec![1.1_f64, 2_f64, 3_f64]));
298-
// generic_test_op!(
299-
// a,
300-
// DataType::Float64,
301-
// Variance,
302-
// ScalarValue::from(0.9033333333333333_f64)
303-
// )
304-
// }
305-
306287
#[test]
307288
fn variance_i32() -> Result<()> {
308289
let a: ArrayRef = Arc::new(Int32Array::from(vec![1, 2, 3, 4, 5]));
@@ -323,23 +304,6 @@ mod tests {
323304
generic_test_op!(a, DataType::Float32, VariancePop, ScalarValue::from(2_f64))
324305
}
325306

326-
// #[test]
327-
// fn test_variance_1_input() -> Result<()> {
328-
// let a: ArrayRef = Arc::new(Float64Array::from(vec![1_f64]));
329-
// let schema = Schema::new(vec![Field::new("a", DataType::Float64, false)]);
330-
// let batch = RecordBatch::try_new(Arc::new(schema.clone()), vec![a])?;
331-
332-
// let agg = Arc::new(Variance::new(
333-
// col("a", &schema)?,
334-
// "bla".to_string(),
335-
// DataType::Float64,
336-
// ));
337-
// let actual = aggregate(&batch, agg).unwrap();
338-
// assert_eq!(actual, ScalarValue::Float64(None));
339-
340-
// Ok(())
341-
// }
342-
343307
#[test]
344308
fn variance_i32_with_nulls() -> Result<()> {
345309
let a: ArrayRef = Arc::new(Int32Array::from(vec![
@@ -357,23 +321,6 @@ mod tests {
357321
)
358322
}
359323

360-
// #[test]
361-
// fn variance_i32_all_nulls() -> Result<()> {
362-
// let a: ArrayRef = Arc::new(Int32Array::from(vec![None, None]));
363-
// let schema = Schema::new(vec![Field::new("a", DataType::Int32, true)]);
364-
// let batch = RecordBatch::try_new(Arc::new(schema.clone()), vec![a])?;
365-
366-
// let agg = Arc::new(Variance::new(
367-
// col("a", &schema)?,
368-
// "bla".to_string(),
369-
// DataType::Float64,
370-
// ));
371-
// let actual = aggregate(&batch, agg).unwrap();
372-
// assert_eq!(actual, ScalarValue::Float64(None));
373-
374-
// Ok(())
375-
// }
376-
377324
#[test]
378325
fn variance_f64_merge_1() -> Result<()> {
379326
let a = Arc::new(Float64Array::from(vec![1_f64, 2_f64, 3_f64]));

datafusion/sqllogictest/test_files/aggregate.slt

+48
Original file line numberDiff line numberDiff line change
@@ -2338,6 +2338,54 @@ select covar_pop(c1, c2), arrow_typeof(covar_pop(c1, c2)) from t;
23382338
statement ok
23392339
drop table t;
23402340

2341+
# variance_f64_1
2342+
statement ok
2343+
create table t (c double) as values (1), (2), (3), (4), (5);
2344+
2345+
query RT
2346+
select var(c), arrow_typeof(var(c)) from t;
2347+
----
2348+
2.5 Float64
2349+
2350+
statement ok
2351+
drop table t;
2352+
2353+
# variance_f64_2
2354+
statement ok
2355+
create table t (c double) as values (1.1), (2), (3);
2356+
2357+
query RT
2358+
select var(c), arrow_typeof(var(c)) from t;
2359+
----
2360+
0.903333333333 Float64
2361+
2362+
statement ok
2363+
drop table t;
2364+
2365+
# variance_1_input
2366+
statement ok
2367+
create table t (a double not null) as values (1);
2368+
2369+
query RT
2370+
select var(a), arrow_typeof(var(a)) from t;
2371+
----
2372+
NULL Float64
2373+
2374+
statement ok
2375+
drop table t;
2376+
2377+
# variance_i32_all_nulls
2378+
statement ok
2379+
create table t (a int) as values (null), (null);
2380+
2381+
query RT
2382+
select var(a), arrow_typeof(var(a)) from t;
2383+
----
2384+
NULL Float64
2385+
2386+
statement ok
2387+
drop table t;
2388+
23412389
# simple_mean
23422390
query R
23432391
select mean(c1) from test

datafusion/sqllogictest/test_files/order.slt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1131,4 +1131,4 @@ physical_plan
11311131
01)SortPreservingMergeExec: [c@0 ASC NULLS LAST]
11321132
02)--ProjectionExec: expr=[CAST(inc_col@0 > desc_col@1 AS Int32) as c]
11331133
03)----RepartitionExec: partitioning=RoundRobinBatch(2), input_partitions=1
1134-
04)------CsvExec: file_groups={1 group: [[WORKSPACE_ROOT/datafusion/core/tests/data/window_1.csv]]}, projection=[inc_col, desc_col], output_orderings=[[inc_col@0 ASC NULLS LAST], [desc_col@1 DESC]], has_header=true
1134+
04)------CsvExec: file_groups={1 group: [[WORKSPACE_ROOT/datafusion/core/tests/data/window_1.csv]]}, projection=[inc_col, desc_col], output_orderings=[[inc_col@0 ASC NULLS LAST], [desc_col@1 DESC]], has_header=true

datafusion/sqllogictest/test_files/sort_merge_join.slt

+1
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,7 @@ t1 as (
344344
select 11 a, 13 b)
345345
select t1.* from t1 where exists (select 1 from t1 t2 where t2.a = t1.a and t2.b != t1.b)
346346
) order by 1, 2;
347+
----
347348

348349
query II
349350
select * from (

datafusion/sqllogictest/test_files/unnest.slt

+2-2
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ select * from unnest(struct(1,2,3));
6565
----
6666
1 2 3
6767

68-
## Multiple unnest expression in from clause
68+
## Multiple unnest expression in from clause
6969
query IIII
7070
select * from unnest(struct(1,2,3)),unnest([4,5,6]);
7171
----
@@ -446,7 +446,7 @@ query error DataFusion error: type_coercion\ncaused by\nThis feature is not impl
446446
select sum(unnest(generate_series(1,10)));
447447

448448
## TODO: support unnest as a child expr
449-
query error DataFusion error: Internal error: unnest on struct can ony be applied at the root level of select expression
449+
query error DataFusion error: Internal error: unnest on struct can ony be applied at the root level of select expression
450450
select arrow_typeof(unnest(column5)) from unnest_table;
451451

452452

0 commit comments

Comments
 (0)