|
2 | 2 | #include "duckdb/execution/operator/aggregate/physical_window.hpp" |
3 | 3 | #include "duckdb/execution/operator/projection/physical_projection.hpp" |
4 | 4 | #include "duckdb/execution/physical_plan_generator.hpp" |
5 | | -#include "duckdb/main/client_context.hpp" |
| 5 | +#include "duckdb/main/client_config.hpp" |
6 | 6 | #include "duckdb/planner/expression/bound_reference_expression.hpp" |
7 | 7 | #include "duckdb/planner/expression/bound_window_expression.hpp" |
8 | 8 | #include "duckdb/planner/operator/logical_window.hpp" |
9 | 9 |
|
10 | | -#include <numeric> |
11 | | - |
12 | 10 | namespace duckdb { |
13 | 11 |
|
14 | 12 | PhysicalOperator &PhysicalPlanGenerator::CreatePlan(LogicalWindow &op) { |
@@ -44,12 +42,12 @@ PhysicalOperator &PhysicalPlanGenerator::CreatePlan(LogicalWindow &op) { |
44 | 42 | // Process the window functions by sharing the partition/order definitions |
45 | 43 | unordered_map<idx_t, idx_t> projection_map; |
46 | 44 | vector<vector<idx_t>> window_expressions; |
47 | | - idx_t blocking_count = 0; |
| 45 | + idx_t streaming_count = 0; |
48 | 46 | auto output_pos = input_width; |
49 | 47 | while (!blocking_windows.empty() || !streaming_windows.empty()) { |
50 | | - const bool process_streaming = blocking_windows.empty(); |
51 | | - auto &remaining = process_streaming ? streaming_windows : blocking_windows; |
52 | | - blocking_count += process_streaming ? 0 : 1; |
| 48 | + const bool process_blocking = streaming_windows.empty(); |
| 49 | + auto &remaining = process_blocking ? blocking_windows : streaming_windows; |
| 50 | + streaming_count += process_blocking ? 0 : 1; |
53 | 51 |
|
54 | 52 | // Find all functions that share the partitioning of the first remaining expression |
55 | 53 | auto over_idx = remaining[0]; |
@@ -122,7 +120,7 @@ PhysicalOperator &PhysicalPlanGenerator::CreatePlan(LogicalWindow &op) { |
122 | 120 | } |
123 | 121 |
|
124 | 122 | // Chain the new window operator on top of the plan |
125 | | - if (i < blocking_count) { |
| 123 | + if (i >= streaming_count) { |
126 | 124 | auto &window = Make<PhysicalWindow>(types, std::move(select_list), op.estimated_cardinality); |
127 | 125 | window.children.push_back(plan); |
128 | 126 | plan = window; |
|
0 commit comments