Skip to content

Commit 57fae2e

Browse files
committed
tests: more test corrections
1 parent c0421a1 commit 57fae2e

File tree

4 files changed

+42
-42
lines changed

4 files changed

+42
-42
lines changed

datafusion/core/tests/dataframe/mod.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1206,23 +1206,23 @@ async fn window_using_aggregates() -> Result<()> {
12061206
| | | | | | | | 1 | -85 |
12071207
| -85 | -101 | 14 | -12 | -12 | 83 | -101 | 4 | -54 |
12081208
| -85 | -101 | 17 | -25 | -25 | 83 | -101 | 5 | -31 |
1209-
| -85 | -12 | 10 | -34 | -34 | 83 | -85 | 3 | 13 |
1209+
| -85 | -12 | 10 | -43 | -34 | 83 | -85 | 3 | 13 |
12101210
| -85 | -25 | 3 | -56 | -56 | -25 | -85 | 1 | -5 |
1211-
| -85 | -31 | 18 | -28 | -28 | 83 | -101 | 5 | 36 |
1211+
| -85 | -31 | 18 | -31 | -28 | 83 | -101 | 5 | 36 |
12121212
| -85 | -38 | 16 | -25 | -25 | 83 | -101 | 4 | 65 |
12131213
| -85 | -43 | 7 | -43 | -43 | 83 | -85 | 2 | 45 |
1214-
| -85 | -48 | 6 | -36 | -36 | 83 | -85 | 2 | -43 |
1215-
| -85 | -5 | 4 | -40 | -40 | -5 | -85 | 1 | 83 |
1216-
| -85 | -54 | 15 | -18 | -18 | 83 | -101 | 4 | -38 |
1217-
| -85 | -56 | 2 | -70 | -70 | -56 | -85 | 1 | -25 |
1214+
| -85 | -48 | 6 | -48 | -36 | 83 | -85 | 2 | -43 |
1215+
| -85 | -5 | 4 | -56 | -40 | -5 | -85 | 1 | 83 |
1216+
| -85 | -54 | 15 | -25 | -18 | 83 | -101 | 4 | -38 |
1217+
| -85 | -56 | 2 | -85 | -70 | -56 | -85 | 1 | -25 |
12181218
| -85 | -72 | 9 | -43 | -43 | 83 | -85 | 3 | -12 |
12191219
| -85 | -85 | 1 | -85 | -85 | -85 | -85 | 1 | -56 |
1220-
| -85 | 13 | 11 | -18 | -18 | 83 | -85 | 3 | 14 |
1220+
| -85 | 13 | 11 | -25 | -18 | 83 | -85 | 3 | 14 |
12211221
| -85 | 13 | 11 | -25 | -25 | 83 | -85 | 3 | 13 |
12221222
| -85 | 14 | 12 | -12 | -12 | 83 | -85 | 3 | 17 |
1223-
| -85 | 17 | 13 | -8 | -8 | 83 | -85 | 4 | -101 |
1224-
| -85 | 45 | 8 | -34 | -34 | 83 | -85 | 3 | -72 |
1225-
| -85 | 65 | 17 | -18 | -18 | 83 | -101 | 5 | -101 |
1223+
| -85 | 17 | 13 | -12 | -8 | 83 | -85 | 4 | -101 |
1224+
| -85 | 45 | 8 | -43 | -34 | 83 | -85 | 3 | -72 |
1225+
| -85 | 65 | 17 | -25 | -18 | 83 | -101 | 5 | -101 |
12261226
| -85 | 83 | 5 | -25 | -25 | 83 | -85 | 2 | -48 |
12271227
+-------------+----------+-----------------+---------------+--------+-----+------+----+------+
12281228
"

datafusion/sqllogictest/test_files/aggregate.slt

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1351,7 +1351,7 @@ DROP TABLE median_window_test;
13511351
query RT
13521352
select approx_median(arrow_cast(col_f32, 'Float16')), arrow_typeof(approx_median(arrow_cast(col_f32, 'Float16'))) from median_table;
13531353
----
1354-
2.75 Float16
1354+
2.1992188 Float16
13551355

13561356
# This shouldn't be NaN, see:
13571357
# https://github.com/apache/datafusion/issues/18945
@@ -1369,7 +1369,7 @@ select
13691369
arrow_typeof(approx_percentile_cont(0.5) within group (order by arrow_cast(col_f32, 'Float16')))
13701370
from median_table;
13711371
----
1372-
2.75 Float16
1372+
2.1992188 Float16
13731373

13741374
query ?T
13751375
select approx_median(NULL), arrow_typeof(approx_median(NULL)) from median_table;
@@ -1388,7 +1388,7 @@ select median(c), arrow_typeof(median(c)) from t;
13881388
query RT
13891389
select approx_median(c), arrow_typeof(approx_median(c)) from t;
13901390
----
1391-
0.00035 Float64
1391+
0.0003 Float64
13921392

13931393
statement ok
13941394
drop table t;
@@ -2322,7 +2322,7 @@ SELECT c1, approx_percentile_cont(0.95) WITHIN GROUP (ORDER BY c3) AS c3_p95 FRO
23222322
a 65
23232323
b 68
23242324
c 118
2325-
d 123
2325+
d 125
23262326
e 112
23272327

23282328

@@ -2333,7 +2333,7 @@ SELECT c1, approx_percentile_cont(c3, 0.95) AS c3_p95 FROM aggregate_test_100 GR
23332333
a 65
23342334
b 68
23352335
c 118
2336-
d 123
2336+
d 125
23372337
e 112
23382338

23392339

@@ -2344,7 +2344,7 @@ SELECT c1, approx_percentile_cont(c2, 0.95) AS c2, approx_percentile_cont(c3, 0.
23442344
a 5 65
23452345
b 5 68
23462346
c 5 118
2347-
d 5 123
2347+
d 5 125
23482348
e 5 112
23492349

23502350
# error is unique to this UDAF
@@ -2362,11 +2362,11 @@ e 3 40.333333333333
23622362
query TI
23632363
SELECT c1, approx_percentile_cont(0.95) WITHIN GROUP (ORDER BY c3 DESC) AS c3_p95 FROM aggregate_test_100 GROUP BY 1 ORDER BY 1
23642364
----
2365-
a -100
2366-
b -111
2365+
a -101
2366+
b -117
23672367
c -107
2368-
d -98
2369-
e -85
2368+
d -99
2369+
e -86
23702370

23712371
# csv_query_approx_percentile_cont_with_weight (2)
23722372
query TI
@@ -2375,7 +2375,7 @@ SELECT c1, approx_percentile_cont_with_weight(1, 0.95) WITHIN GROUP (ORDER BY c3
23752375
a 65
23762376
b 68
23772377
c 118
2378-
d 123
2378+
d 125
23792379
e 112
23802380

23812381
# csv_query_approx_percentile_cont_with_weight alternate syntax
@@ -2385,18 +2385,18 @@ SELECT c1, approx_percentile_cont_with_weight(c3, 1, 0.95) AS c3_p95 FROM aggreg
23852385
a 65
23862386
b 68
23872387
c 118
2388-
d 123
2388+
d 125
23892389
e 112
23902390

23912391

23922392
query TI
23932393
SELECT c1, approx_percentile_cont_with_weight(1, 0.95) WITHIN GROUP (ORDER BY c3 DESC) AS c3_p95 FROM aggregate_test_100 GROUP BY 1 ORDER BY 1
23942394
----
2395-
a -100
2396-
b -111
2395+
a -101
2396+
b -117
23972397
c -107
2398-
d -98
2399-
e -85
2398+
d -99
2399+
e -86
24002400

24012401
# csv_query_approx_percentile_cont_with_histogram_bins
24022402
query TI
@@ -2405,7 +2405,7 @@ SELECT c1, approx_percentile_cont(0.95, 200) WITHIN GROUP (ORDER BY c3) AS c3_p9
24052405
a 65
24062406
b 68
24072407
c 118
2408-
d 123
2408+
d 125
24092409
e 112
24102410

24112411
query TI
@@ -8804,9 +8804,9 @@ FROM (SELECT * FROM stream_test ORDER BY g LIMIT 10000)
88048804
GROUP BY g
88058805
ORDER BY g;
88068806
----
8807-
1 2 1.5 1.5 1.5 1.5 1.5 1.5 1.5 1.5
8808-
2 2 1.5 1.5 1.5 1.5 1.5 1.5 1.5 1.5
8809-
3 2 1.5 1.5 1.5 1.5 1.5 1.5 1.5 1.5
8807+
1 2 1 1.5 1.5 1 1 1.5 1 1
8808+
2 2 1 1.5 1.5 1 1 1.5 1 1
8809+
3 2 1 1.5 1.5 1 1 1.5 1 1
88108810

88118811
# Config reset
88128812

datafusion/sqllogictest/test_files/aggregate_skip_partial.slt

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -321,11 +321,11 @@ SELECT c2, median(c5), median(c11) FROM aggregate_test_100 GROUP BY c2 ORDER BY
321321
query IIR
322322
SELECT c2, approx_median(c5), approx_median(c11) FROM aggregate_test_100 GROUP BY c2 ORDER BY c2;
323323
----
324-
1 23971150 0.5922606
325-
2 -562486880 0.43422085
324+
1 -335410409 0.5780736
325+
2 -587831330 0.4279275
326326
3 240273900 0.40199697
327327
4 762932956 0.48515016
328-
5 604973998 0.49842384
328+
5 586844478 0.44318348
329329

330330
# Test approx_distinct for varchar / int
331331
query III
@@ -405,8 +405,8 @@ SELECT c2, approx_median(c3), approx_median(c11) FROM aggregate_test_100_null GR
405405
1 12 0.6067944
406406
2 1 0.46076488
407407
3 14 0.40154034
408-
4 -17 0.48515016
409-
5 -35 0.5536642
408+
4 -38 0.48515016
409+
5 -40 0.5536642
410410

411411
# Test approx_distinct with nullable fields
412412
query II
@@ -525,8 +525,8 @@ FROM aggregate_test_100 GROUP BY c2 ORDER BY c2;
525525
----
526526
1 57 -56
527527
2 52 -60
528-
3 71 -74
529-
4 65 -69
528+
3 71 -76
529+
4 65 -79
530530
5 64 -59
531531

532532
# Test count with nullable fields and filter
@@ -669,22 +669,22 @@ SELECT c2,
669669
FROM aggregate_test_100_null GROUP BY c2 ORDER BY c2;
670670
----
671671
1 -5 0.6623719
672-
2 15 0.52930677
672+
2 1 0.52930677
673673
3 13 0.32792538
674674
4 -38 0.49774808
675-
5 -18 0.49842384
675+
5 -31 0.44318348
676676

677677
# Test approx_median with nullable fields and nullable filter
678678
query II
679679
SELECT c2,
680680
approx_median(c3) FILTER (WHERE c11 > 0.5)
681681
FROM aggregate_test_100_null GROUP BY c2 ORDER BY c2;
682682
----
683-
1 33
683+
1 29
684684
2 -29
685685
3 22
686686
4 -90
687-
5 -22
687+
5 -40
688688

689689
statement ok
690690
DROP TABLE aggregate_test_100_null;

datafusion/sqllogictest/test_files/metadata.slt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ select count(distinct name) from table_with_metadata;
8686
query I
8787
select approx_median(distinct id) from table_with_metadata;
8888
----
89-
2
89+
1
9090

9191
# Regression test: prevent field metadata loss per https://github.com/apache/datafusion/issues/12687
9292
statement ok

0 commit comments

Comments
 (0)