Skip to content

Commit 708aff6

Browse files
adriangbclaude
andcommitted
refactor: count evaluations in the volatile group key filter tests
The tests for apache#25415 ran random() over 10000 rows and checked that no row broke the filter. Use counted_volatile and check that the key is evaluated one time per row. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 9de1c39 commit 708aff6

1 file changed

Lines changed: 14 additions & 8 deletions

File tree

‎datafusion/sqllogictest/test_files/push_down_filter_regression.slt‎

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -696,20 +696,26 @@ physical_plan
696696
06)----------RepartitionExec: partitioning=RoundRobinBatch(4), input_partitions=1
697697
07)------------LazyMemoryExec: partitions=1, batch_generators=[generate_series: start=1, end=10000, batch_size=8192]
698698

699-
query B
700-
SELECT k FROM (SELECT random() < 0.5 AS k, count(*) AS c FROM generate_series(1, 10000) GROUP BY random() < 0.5) WHERE k;
699+
# The key is evaluated one time per input row, by the aggregate.
700+
query BI
701+
SELECT k, c FROM (SELECT counted_volatile(value) <= 3 AS k, count(*) AS c FROM generate_series(1, 10) GROUP BY counted_volatile(value) <= 3) WHERE k;
701702
----
702-
true
703+
true 3
703704

704-
query B
705-
SELECT k FROM (SELECT random() < 0.5 AS k, count(*) AS c FROM generate_series(1, 10000) GROUP BY k) WHERE NOT k;
705+
query I
706+
SELECT evaluations();
707+
----
708+
10
709+
710+
query BI
711+
SELECT k, c FROM (SELECT counted_volatile(value) <= 3 AS k, count(*) AS c FROM generate_series(1, 10) GROUP BY k) WHERE NOT k;
706712
----
707-
false
713+
false 7
708714

709715
query I
710-
SELECT sum(c) FROM (SELECT random() < 0.5 AS k, count(*) AS c FROM generate_series(1, 10000) GROUP BY random() < 0.5) WHERE k OR NOT k;
716+
SELECT evaluations();
711717
----
712-
10000
718+
10
713719

714720
# Window filter pushdown over expression PARTITION BY keys.
715721
#

0 commit comments

Comments
 (0)