Skip to content

Commit 79c17e3

Browse files
authored
Make tests deterministic (#8525)
1 parent cf2de9b commit 79c17e3

2 files changed

Lines changed: 20 additions & 20 deletions

File tree

datafusion/sqllogictest/test_files/distinct_on.slt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,17 @@ LOCATION '../../testing/data/csv/aggregate_test_100.csv'
3838
# Basic example: distinct on the first column project the second one, and
3939
# order by the third
4040
query TI
41-
SELECT DISTINCT ON (c1) c1, c2 FROM aggregate_test_100 ORDER BY c1, c3;
41+
SELECT DISTINCT ON (c1) c1, c2 FROM aggregate_test_100 ORDER BY c1, c3, c9;
4242
----
43-
a 5
43+
a 4
4444
b 4
4545
c 2
4646
d 1
4747
e 3
4848

4949
# Basic example + reverse order of the selected column
5050
query TI
51-
SELECT DISTINCT ON (c1) c1, c2 FROM aggregate_test_100 ORDER BY c1, c3 DESC;
51+
SELECT DISTINCT ON (c1) c1, c2 FROM aggregate_test_100 ORDER BY c1, c3 DESC, c9;
5252
----
5353
a 1
5454
b 5
@@ -58,7 +58,7 @@ e 1
5858

5959
# Basic example + reverse order of the ON column
6060
query TI
61-
SELECT DISTINCT ON (c1) c1, c2 FROM aggregate_test_100 ORDER BY c1 DESC, c3;
61+
SELECT DISTINCT ON (c1) c1, c2 FROM aggregate_test_100 ORDER BY c1 DESC, c3, c9;
6262
----
6363
e 3
6464
d 1

datafusion/sqllogictest/test_files/groupby.slt

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2329,15 +2329,15 @@ ProjectionExec: expr=[country@0 as country, ARRAY_AGG(s.amount) ORDER BY [s.amou
23292329
----SortExec: expr=[amount@1 DESC]
23302330
------MemoryExec: partitions=1, partition_sizes=[1]
23312331

2332-
query T?R
2332+
query T?R rowsort
23332333
SELECT s.country, ARRAY_AGG(s.amount ORDER BY s.amount DESC) AS amounts,
23342334
SUM(s.amount) AS sum1
23352335
FROM sales_global AS s
23362336
GROUP BY s.country
23372337
----
23382338
FRA [200.0, 50.0] 250
2339-
TUR [100.0, 75.0] 175
23402339
GRC [80.0, 30.0] 110
2340+
TUR [100.0, 75.0] 175
23412341

23422342
# test_ordering_sensitive_aggregation3
23432343
# When different aggregators have conflicting requirements, we cannot satisfy all of them in current implementation.
@@ -2373,7 +2373,7 @@ ProjectionExec: expr=[country@0 as country, ARRAY_AGG(s.amount) ORDER BY [s.amou
23732373
----SortExec: expr=[country@0 ASC NULLS LAST,amount@1 DESC]
23742374
------MemoryExec: partitions=1, partition_sizes=[1]
23752375

2376-
query T?R
2376+
query T?R rowsort
23772377
SELECT s.country, ARRAY_AGG(s.amount ORDER BY s.amount DESC) AS amounts,
23782378
SUM(s.amount) AS sum1
23792379
FROM (SELECT *
@@ -2409,7 +2409,7 @@ ProjectionExec: expr=[country@0 as country, zip_code@1 as zip_code, ARRAY_AGG(s.
24092409
----SortExec: expr=[country@1 ASC NULLS LAST,amount@2 DESC]
24102410
------MemoryExec: partitions=1, partition_sizes=[1]
24112411

2412-
query TI?R
2412+
query TI?R rowsort
24132413
SELECT s.country, s.zip_code, ARRAY_AGG(s.amount ORDER BY s.amount DESC) AS amounts,
24142414
SUM(s.amount) AS sum1
24152415
FROM (SELECT *
@@ -2445,7 +2445,7 @@ ProjectionExec: expr=[country@0 as country, ARRAY_AGG(s.amount) ORDER BY [s.coun
24452445
----SortExec: expr=[country@0 ASC NULLS LAST]
24462446
------MemoryExec: partitions=1, partition_sizes=[1]
24472447

2448-
query T?R
2448+
query T?R rowsort
24492449
SELECT s.country, ARRAY_AGG(s.amount ORDER BY s.amount DESC) AS amounts,
24502450
SUM(s.amount) AS sum1
24512451
FROM (SELECT *
@@ -2480,7 +2480,7 @@ ProjectionExec: expr=[country@0 as country, ARRAY_AGG(s.amount) ORDER BY [s.coun
24802480
----SortExec: expr=[country@0 ASC NULLS LAST,amount@1 DESC]
24812481
------MemoryExec: partitions=1, partition_sizes=[1]
24822482

2483-
query T?R
2483+
query T?R rowsort
24842484
SELECT s.country, ARRAY_AGG(s.amount ORDER BY s.country DESC, s.amount DESC) AS amounts,
24852485
SUM(s.amount) AS sum1
24862486
FROM (SELECT *
@@ -2512,16 +2512,16 @@ ProjectionExec: expr=[country@0 as country, ARRAY_AGG(sales_global.amount) ORDER
25122512
----SortExec: expr=[amount@1 DESC]
25132513
------MemoryExec: partitions=1, partition_sizes=[1]
25142514

2515-
query T?RR
2515+
query T?RR rowsort
25162516
SELECT country, ARRAY_AGG(amount ORDER BY amount DESC) AS amounts,
25172517
FIRST_VALUE(amount ORDER BY amount ASC) AS fv1,
25182518
LAST_VALUE(amount ORDER BY amount DESC) AS fv2
25192519
FROM sales_global
25202520
GROUP BY country
25212521
----
25222522
FRA [200.0, 50.0] 50 50
2523-
TUR [100.0, 75.0] 75 75
25242523
GRC [80.0, 30.0] 30 30
2524+
TUR [100.0, 75.0] 75 75
25252525

25262526
# test_reverse_aggregate_expr2
25272527
# Some of the Aggregators can be reversed, by this way we can still run aggregators without re-ordering
@@ -2640,7 +2640,7 @@ ProjectionExec: expr=[country@0 as country, FIRST_VALUE(sales_global.amount) ORD
26402640
----SortExec: expr=[ts@1 ASC NULLS LAST]
26412641
------MemoryExec: partitions=1, partition_sizes=[1]
26422642

2643-
query TRRR
2643+
query TRRR rowsort
26442644
SELECT country, FIRST_VALUE(amount ORDER BY ts DESC) as fv1,
26452645
LAST_VALUE(amount ORDER BY ts DESC) as lv1,
26462646
SUM(amount ORDER BY ts DESC) as sum1
@@ -2649,8 +2649,8 @@ SELECT country, FIRST_VALUE(amount ORDER BY ts DESC) as fv1,
26492649
ORDER BY ts ASC)
26502650
GROUP BY country
26512651
----
2652-
GRC 80 30 110
26532652
FRA 200 50 250
2653+
GRC 80 30 110
26542654
TUR 100 75 175
26552655

26562656
# If existing ordering doesn't satisfy requirement, we should do calculations
@@ -2674,16 +2674,16 @@ ProjectionExec: expr=[country@0 as country, FIRST_VALUE(sales_global.amount) ORD
26742674
----SortExec: expr=[ts@1 DESC]
26752675
------MemoryExec: partitions=1, partition_sizes=[1]
26762676

2677-
query TRRR
2677+
query TRRR rowsort
26782678
SELECT country, FIRST_VALUE(amount ORDER BY ts DESC) as fv1,
26792679
LAST_VALUE(amount ORDER BY ts DESC) as lv1,
26802680
SUM(amount ORDER BY ts DESC) as sum1
26812681
FROM sales_global
26822682
GROUP BY country
26832683
----
2684-
TUR 100 75 175
2685-
GRC 80 30 110
26862684
FRA 200 50 250
2685+
GRC 80 30 110
2686+
TUR 100 75 175
26872687

26882688
query TT
26892689
EXPLAIN SELECT s.zip_code, s.country, s.sn, s.ts, s.currency, LAST_VALUE(e.amount ORDER BY e.sn) AS last_rate
@@ -2715,7 +2715,7 @@ SortExec: expr=[sn@2 ASC NULLS LAST]
27152715
--------------MemoryExec: partitions=1, partition_sizes=[1]
27162716
--------------MemoryExec: partitions=1, partition_sizes=[1]
27172717

2718-
query ITIPTR
2718+
query ITIPTR rowsort
27192719
SELECT s.zip_code, s.country, s.sn, s.ts, s.currency, LAST_VALUE(e.amount ORDER BY e.sn) AS last_rate
27202720
FROM sales_global AS s
27212721
JOIN sales_global AS e
@@ -2725,10 +2725,10 @@ GROUP BY s.sn, s.zip_code, s.country, s.ts, s.currency
27252725
ORDER BY s.sn
27262726
----
27272727
0 GRC 0 2022-01-01T06:00:00 EUR 30
2728+
0 GRC 4 2022-01-03T10:00:00 EUR 80
27282729
1 FRA 1 2022-01-01T08:00:00 EUR 50
2729-
1 TUR 2 2022-01-01T11:30:00 TRY 75
27302730
1 FRA 3 2022-01-02T12:00:00 EUR 200
2731-
0 GRC 4 2022-01-03T10:00:00 EUR 80
2731+
1 TUR 2 2022-01-01T11:30:00 TRY 75
27322732
1 TUR 4 2022-01-03T10:00:00 TRY 100
27332733

27342734
# Run order-sensitive aggregators in multiple partitions

0 commit comments

Comments
 (0)