Skip to content

Commit 469ef1b

Browse files
authored
Revert "Perf: Window topn optimisation (#21479)"
This reverts commit 936db37.
1 parent 936db37 commit 469ef1b

14 files changed

Lines changed: 2 additions & 1941 deletions

File tree

benchmarks/queries/h2o/window.sql

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,4 @@ SELECT
109109
id3,
110110
v2,
111111
sum(v2) OVER (PARTITION BY id2 ORDER BY v2 RANGE BETWEEN 3 PRECEDING AND CURRENT ROW) AS my_range_between_by_id2
112-
FROM large;
113-
114-
-- Window Top-N (ROW_NUMBER top-2 per partition)
115-
SELECT id2, largest2_v2 FROM (
116-
SELECT id2, v2 AS largest2_v2,
117-
ROW_NUMBER() OVER (PARTITION BY id2 ORDER BY v2 DESC) AS order_v2
118-
FROM large WHERE v2 IS NOT NULL
119-
) sub_query WHERE order_v2 <= 2;
112+
FROM large;

datafusion/common/src/config.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1087,15 +1087,6 @@ config_namespace! {
10871087
/// past window functions, if possible
10881088
pub enable_window_limits: bool, default = true
10891089

1090-
/// When set to true, the optimizer will replace
1091-
/// Filter(rn<=K) → Window(ROW_NUMBER) → Sort patterns with a
1092-
/// PartitionedTopKExec that maintains per-partition heaps, avoiding
1093-
/// a full sort of the input.
1094-
/// When the window partition key has low cardinality, enabling this optimization
1095-
/// can improve performance. However, for high cardinality keys, it may
1096-
/// cause regressions in both memory usage and runtime.
1097-
pub enable_window_topn: bool, default = false
1098-
10991090
/// When set to true, the optimizer will push TopK (Sort with fetch)
11001091
/// below hash repartition when the partition key is a prefix of the
11011092
/// sort key, reducing data volume before the shuffle.

datafusion/core/tests/physical_optimizer/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,5 @@ mod sanity_checker;
3737
#[expect(clippy::needless_pass_by_value)]
3838
mod test_utils;
3939
mod window_optimize;
40-
mod window_topn;
4140

4241
mod pushdown_utils;

0 commit comments

Comments
 (0)