diff --git a/src/query/src/query_engine/state.rs b/src/query/src/query_engine/state.rs index e7218b50af..d1b5c542e1 100644 --- a/src/query/src/query_engine/state.rs +++ b/src/query/src/query_engine/state.rs @@ -141,14 +141,19 @@ impl QueryEngineState { // add physical optimizer let mut physical_optimizer = PhysicalOptimizer::new(); - // Change TableScan's partition at first + // Change TableScan's partition right before enforcing distribution physical_optimizer .rules - .insert(0, Arc::new(ParallelizeScan)); + .insert(5, Arc::new(ParallelizeScan)); // Pass distribution requirement to MergeScanExec to avoid unnecessary shuffling physical_optimizer .rules - .insert(1, Arc::new(PassDistribution)); + .insert(6, Arc::new(PassDistribution)); + // Enforce sorting AFTER custom rules that modify the plan structure + physical_optimizer.rules.insert( + 7, + Arc::new(datafusion::physical_optimizer::enforce_sorting::EnforceSorting {}), + ); // Add rule for windowed sort physical_optimizer .rules diff --git a/tests/cases/distributed/explain/step_aggr_advance.result b/tests/cases/distributed/explain/step_aggr_advance.result index 3fc98bfc86..316e282e24 100644 --- a/tests/cases/distributed/explain/step_aggr_advance.result +++ b/tests/cases/distributed/explain/step_aggr_advance.result @@ -84,10 +84,6 @@ tql analyze (1752591864, 1752592164, '30s') max by (a, b, c) (max_over_time(aggr |_|_|_PromRangeManipulateExec: req range=[1752591864000..1752592164000], interval=[30000], eval range=[120000], time index=[greptime_timestamp] REDACTED |_|_|_PromSeriesNormalizeExec: offset=[0], time index=[greptime_timestamp], filter NaN: [true] REDACTED |_|_|_PromSeriesDivideExec: tags=["a", "b", "c", "d"] REDACTED -|_|_|_SortExec: expr=[a@0 ASC, b@1 ASC, c@2 ASC, d@3 ASC, greptime_timestamp@4 ASC], preserve_partitioning=[true] REDACTED -|_|_|_CoalesceBatchesExec: target_batch_size=8192 REDACTED -|_|_|_RepartitionExec: partitioning=REDACTED -|_|_|_CoalescePartitionsExec REDACTED |_|_|_CooperativeExec REDACTED |_|_|_SeriesScan: region=REDACTED, "partition_count":{"count":0, "mem_ranges":0, "files":0, "file_ranges":0}, "distribution":"PerSeries" REDACTED |_|_|_| @@ -97,10 +93,6 @@ tql analyze (1752591864, 1752592164, '30s') max by (a, b, c) (max_over_time(aggr |_|_|_PromRangeManipulateExec: req range=[1752591864000..1752592164000], interval=[30000], eval range=[120000], time index=[greptime_timestamp] REDACTED |_|_|_PromSeriesNormalizeExec: offset=[0], time index=[greptime_timestamp], filter NaN: [true] REDACTED |_|_|_PromSeriesDivideExec: tags=["a", "b", "c", "d"] REDACTED -|_|_|_SortExec: expr=[a@0 ASC, b@1 ASC, c@2 ASC, d@3 ASC, greptime_timestamp@4 ASC], preserve_partitioning=[true] REDACTED -|_|_|_CoalesceBatchesExec: target_batch_size=8192 REDACTED -|_|_|_RepartitionExec: partitioning=REDACTED -|_|_|_CoalescePartitionsExec REDACTED |_|_|_CooperativeExec REDACTED |_|_|_SeriesScan: region=REDACTED, "partition_count":{"count":0, "mem_ranges":0, "files":0, "file_ranges":0}, "distribution":"PerSeries" REDACTED |_|_|_| @@ -176,10 +168,6 @@ tql analyze (1752591864, 1752592164, '30s') sum by (a, b) (max_over_time(aggr_op |_|_|_PromRangeManipulateExec: req range=[1752591864000..1752592164000], interval=[30000], eval range=[120000], time index=[greptime_timestamp] REDACTED |_|_|_PromSeriesNormalizeExec: offset=[0], time index=[greptime_timestamp], filter NaN: [true] REDACTED |_|_|_PromSeriesDivideExec: tags=["a", "b", "c", "d"] REDACTED -|_|_|_SortExec: expr=[a@0 ASC, b@1 ASC, c@2 ASC, d@3 ASC, greptime_timestamp@4 ASC], preserve_partitioning=[true] REDACTED -|_|_|_CoalesceBatchesExec: target_batch_size=8192 REDACTED -|_|_|_RepartitionExec: partitioning=REDACTED -|_|_|_CoalescePartitionsExec REDACTED |_|_|_CooperativeExec REDACTED |_|_|_SeriesScan: region=REDACTED, "partition_count":{"count":0, "mem_ranges":0, "files":0, "file_ranges":0}, "distribution":"PerSeries" REDACTED |_|_|_| @@ -189,10 +177,6 @@ tql analyze (1752591864, 1752592164, '30s') sum by (a, b) (max_over_time(aggr_op |_|_|_PromRangeManipulateExec: req range=[1752591864000..1752592164000], interval=[30000], eval range=[120000], time index=[greptime_timestamp] REDACTED |_|_|_PromSeriesNormalizeExec: offset=[0], time index=[greptime_timestamp], filter NaN: [true] REDACTED |_|_|_PromSeriesDivideExec: tags=["a", "b", "c", "d"] REDACTED -|_|_|_SortExec: expr=[a@0 ASC, b@1 ASC, c@2 ASC, d@3 ASC, greptime_timestamp@4 ASC], preserve_partitioning=[true] REDACTED -|_|_|_CoalesceBatchesExec: target_batch_size=8192 REDACTED -|_|_|_RepartitionExec: partitioning=REDACTED -|_|_|_CoalescePartitionsExec REDACTED |_|_|_CooperativeExec REDACTED |_|_|_SeriesScan: region=REDACTED, "partition_count":{"count":0, "mem_ranges":0, "files":0, "file_ranges":0}, "distribution":"PerSeries" REDACTED |_|_|_| @@ -268,10 +252,6 @@ tql analyze (1752591864, 1752592164, '30s') avg by (a) (max_over_time(aggr_optim |_|_|_PromRangeManipulateExec: req range=[1752591864000..1752592164000], interval=[30000], eval range=[120000], time index=[greptime_timestamp] REDACTED |_|_|_PromSeriesNormalizeExec: offset=[0], time index=[greptime_timestamp], filter NaN: [true] REDACTED |_|_|_PromSeriesDivideExec: tags=["a", "b", "c", "d"] REDACTED -|_|_|_SortExec: expr=[a@0 ASC, b@1 ASC, c@2 ASC, d@3 ASC, greptime_timestamp@4 ASC], preserve_partitioning=[true] REDACTED -|_|_|_CoalesceBatchesExec: target_batch_size=8192 REDACTED -|_|_|_RepartitionExec: partitioning=REDACTED -|_|_|_CoalescePartitionsExec REDACTED |_|_|_CooperativeExec REDACTED |_|_|_SeriesScan: region=REDACTED, "partition_count":{"count":0, "mem_ranges":0, "files":0, "file_ranges":0}, "distribution":"PerSeries" REDACTED |_|_|_| @@ -281,10 +261,6 @@ tql analyze (1752591864, 1752592164, '30s') avg by (a) (max_over_time(aggr_optim |_|_|_PromRangeManipulateExec: req range=[1752591864000..1752592164000], interval=[30000], eval range=[120000], time index=[greptime_timestamp] REDACTED |_|_|_PromSeriesNormalizeExec: offset=[0], time index=[greptime_timestamp], filter NaN: [true] REDACTED |_|_|_PromSeriesDivideExec: tags=["a", "b", "c", "d"] REDACTED -|_|_|_SortExec: expr=[a@0 ASC, b@1 ASC, c@2 ASC, d@3 ASC, greptime_timestamp@4 ASC], preserve_partitioning=[true] REDACTED -|_|_|_CoalesceBatchesExec: target_batch_size=8192 REDACTED -|_|_|_RepartitionExec: partitioning=REDACTED -|_|_|_CoalescePartitionsExec REDACTED |_|_|_CooperativeExec REDACTED |_|_|_SeriesScan: region=REDACTED, "partition_count":{"count":0, "mem_ranges":0, "files":0, "file_ranges":0}, "distribution":"PerSeries" REDACTED |_|_|_| @@ -355,10 +331,6 @@ tql analyze (1752591864, 1752592164, '30s') count by (a, b, c, d) (max_over_time |_|_|_PromRangeManipulateExec: req range=[1752591864000..1752592164000], interval=[30000], eval range=[120000], time index=[greptime_timestamp] REDACTED |_|_|_PromSeriesNormalizeExec: offset=[0], time index=[greptime_timestamp], filter NaN: [true] REDACTED |_|_|_PromSeriesDivideExec: tags=["a", "b", "c", "d"] REDACTED -|_|_|_SortExec: expr=[a@0 ASC, b@1 ASC, c@2 ASC, d@3 ASC, greptime_timestamp@4 ASC], preserve_partitioning=[true] REDACTED -|_|_|_CoalesceBatchesExec: target_batch_size=8192 REDACTED -|_|_|_RepartitionExec: partitioning=REDACTED -|_|_|_CoalescePartitionsExec REDACTED |_|_|_CooperativeExec REDACTED |_|_|_SeriesScan: region=REDACTED, "partition_count":{"count":0, "mem_ranges":0, "files":0, "file_ranges":0}, "distribution":"PerSeries" REDACTED |_|_|_| @@ -368,10 +340,6 @@ tql analyze (1752591864, 1752592164, '30s') count by (a, b, c, d) (max_over_time |_|_|_PromRangeManipulateExec: req range=[1752591864000..1752592164000], interval=[30000], eval range=[120000], time index=[greptime_timestamp] REDACTED |_|_|_PromSeriesNormalizeExec: offset=[0], time index=[greptime_timestamp], filter NaN: [true] REDACTED |_|_|_PromSeriesDivideExec: tags=["a", "b", "c", "d"] REDACTED -|_|_|_SortExec: expr=[a@0 ASC, b@1 ASC, c@2 ASC, d@3 ASC, greptime_timestamp@4 ASC], preserve_partitioning=[true] REDACTED -|_|_|_CoalesceBatchesExec: target_batch_size=8192 REDACTED -|_|_|_RepartitionExec: partitioning=REDACTED -|_|_|_CoalescePartitionsExec REDACTED |_|_|_CooperativeExec REDACTED |_|_|_SeriesScan: region=REDACTED, "partition_count":{"count":0, "mem_ranges":0, "files":0, "file_ranges":0}, "distribution":"PerSeries" REDACTED |_|_|_| @@ -443,10 +411,6 @@ tql analyze (1752591864, 1752592164, '30s') min by (b, c, d) (max_over_time(aggr |_|_|_PromRangeManipulateExec: req range=[1752591864000..1752592164000], interval=[30000], eval range=[120000], time index=[greptime_timestamp] REDACTED |_|_|_PromSeriesNormalizeExec: offset=[0], time index=[greptime_timestamp], filter NaN: [true] REDACTED |_|_|_PromSeriesDivideExec: tags=["a", "b", "c", "d"] REDACTED -|_|_|_SortExec: expr=[a@0 ASC, b@1 ASC, c@2 ASC, d@3 ASC, greptime_timestamp@4 ASC], preserve_partitioning=[true] REDACTED -|_|_|_CoalesceBatchesExec: target_batch_size=8192 REDACTED -|_|_|_RepartitionExec: partitioning=REDACTED -|_|_|_CoalescePartitionsExec REDACTED |_|_|_CooperativeExec REDACTED |_|_|_SeriesScan: region=REDACTED, "partition_count":{"count":0, "mem_ranges":0, "files":0, "file_ranges":0}, "distribution":"PerSeries" REDACTED |_|_|_| @@ -456,10 +420,6 @@ tql analyze (1752591864, 1752592164, '30s') min by (b, c, d) (max_over_time(aggr |_|_|_PromRangeManipulateExec: req range=[1752591864000..1752592164000], interval=[30000], eval range=[120000], time index=[greptime_timestamp] REDACTED |_|_|_PromSeriesNormalizeExec: offset=[0], time index=[greptime_timestamp], filter NaN: [true] REDACTED |_|_|_PromSeriesDivideExec: tags=["a", "b", "c", "d"] REDACTED -|_|_|_SortExec: expr=[a@0 ASC, b@1 ASC, c@2 ASC, d@3 ASC, greptime_timestamp@4 ASC], preserve_partitioning=[true] REDACTED -|_|_|_CoalesceBatchesExec: target_batch_size=8192 REDACTED -|_|_|_RepartitionExec: partitioning=REDACTED -|_|_|_CoalescePartitionsExec REDACTED |_|_|_CooperativeExec REDACTED |_|_|_SeriesScan: region=REDACTED, "partition_count":{"count":0, "mem_ranges":0, "files":0, "file_ranges":0}, "distribution":"PerSeries" REDACTED |_|_|_| @@ -524,19 +484,11 @@ tql analyze sum(aggr_optimize_not); |_|_|_| | 1_| 0_|_PromInstantManipulateExec: range=[0..0], lookback=[300000], interval=[300000], time index=[greptime_timestamp] REDACTED |_|_|_PromSeriesDivideExec: tags=["a", "b", "c", "d"] REDACTED -|_|_|_SortExec: expr=[a@0 ASC, b@1 ASC, c@2 ASC, d@3 ASC, greptime_timestamp@4 ASC], preserve_partitioning=[true] REDACTED -|_|_|_CoalesceBatchesExec: target_batch_size=8192 REDACTED -|_|_|_RepartitionExec: partitioning=REDACTED -|_|_|_CoalescePartitionsExec REDACTED |_|_|_CooperativeExec REDACTED |_|_|_SeriesScan: region=REDACTED, "partition_count":{"count":0, "mem_ranges":0, "files":0, "file_ranges":0}, "distribution":"PerSeries" REDACTED |_|_|_| | 1_| 1_|_PromInstantManipulateExec: range=[0..0], lookback=[300000], interval=[300000], time index=[greptime_timestamp] REDACTED |_|_|_PromSeriesDivideExec: tags=["a", "b", "c", "d"] REDACTED -|_|_|_SortExec: expr=[a@0 ASC, b@1 ASC, c@2 ASC, d@3 ASC, greptime_timestamp@4 ASC], preserve_partitioning=[true] REDACTED -|_|_|_CoalesceBatchesExec: target_batch_size=8192 REDACTED -|_|_|_RepartitionExec: partitioning=REDACTED -|_|_|_CoalescePartitionsExec REDACTED |_|_|_CooperativeExec REDACTED |_|_|_SeriesScan: region=REDACTED, "partition_count":{"count":0, "mem_ranges":0, "files":0, "file_ranges":0}, "distribution":"PerSeries" REDACTED |_|_|_| @@ -601,19 +553,16 @@ tql explain (1752591864, 1752592164, '30s') sum by (a, b, c) (rate(aggr_optimize | physical_plan | ProjectionExec: expr=[a@1 as a, b@2 as b, c@3 as c, greptime_timestamp@4 as greptime_timestamp, sum(prom_rate(greptime_timestamp_range,greptime_value,greptime_timestamp,Int64(120000)))@0 / sum(prom_rate(greptime_timestamp_range,greptime_value,greptime_timestamp,Int64(120000)))@5 as aggr_optimize_not.sum(prom_rate(greptime_timestamp_range,greptime_value,greptime_timestamp,Int64(120000))) / aggr_optimize_not_count.sum(prom_rate(greptime_timestamp_range,greptime_value,greptime_timestamp,Int64(120000)))] | | | CoalesceBatchesExec: target_batch_size=8192 | | | REDACTED -| | CoalesceBatchesExec: target_batch_size=8192 | -| | RepartitionExec: partitioning=REDACTED -| | CoalescePartitionsExec | -| | AggregateExec: mode=FinalPartitioned, gby=[a@0 as a, b@1 as b, c@2 as c, greptime_timestamp@3 as greptime_timestamp], aggr=[sum(prom_rate(greptime_timestamp_range,greptime_value,greptime_timestamp,Int64(120000)))], ordering_mode=PartiallySorted([0, 1, 2]) | -| | SortExec: expr=[a@0 ASC NULLS LAST, b@1 ASC NULLS LAST, c@2 ASC NULLS LAST], preserve_partitioning=[true] | -| | CoalesceBatchesExec: target_batch_size=8192 | -| | RepartitionExec: partitioning=REDACTED -| | AggregateExec: mode=Partial, gby=[a@2 as a, b@3 as b, c@4 as c, greptime_timestamp@0 as greptime_timestamp], aggr=[sum(prom_rate(greptime_timestamp_range,greptime_value,greptime_timestamp,Int64(120000)))], ordering_mode=PartiallySorted([0, 1, 2]) | -| | ProjectionExec: expr=[greptime_timestamp@0 as greptime_timestamp, prom_rate(greptime_timestamp_range,greptime_value,greptime_timestamp,Int64(120000))@1 as prom_rate(greptime_timestamp_range,greptime_value,greptime_timestamp,Int64(120000)), a@2 as a, b@3 as b, c@4 as c] | -| | CooperativeExec | -| | SortExec: expr=[a@2 ASC, b@3 ASC, c@4 ASC, d@5 ASC, greptime_timestamp@0 ASC], preserve_partitioning=[true] | -| | CooperativeExec | -| | MergeScanExec: REDACTED +| | AggregateExec: mode=FinalPartitioned, gby=[a@0 as a, b@1 as b, c@2 as c, greptime_timestamp@3 as greptime_timestamp], aggr=[sum(prom_rate(greptime_timestamp_range,greptime_value,greptime_timestamp,Int64(120000)))], ordering_mode=PartiallySorted([0, 1, 2]) | +| | SortExec: expr=[a@0 ASC NULLS LAST, b@1 ASC NULLS LAST, c@2 ASC NULLS LAST], preserve_partitioning=[true] | +| | CoalesceBatchesExec: target_batch_size=8192 | +| | RepartitionExec: partitioning=REDACTED +| | AggregateExec: mode=Partial, gby=[a@2 as a, b@3 as b, c@4 as c, greptime_timestamp@0 as greptime_timestamp], aggr=[sum(prom_rate(greptime_timestamp_range,greptime_value,greptime_timestamp,Int64(120000)))], ordering_mode=PartiallySorted([0, 1, 2]) | +| | ProjectionExec: expr=[greptime_timestamp@0 as greptime_timestamp, prom_rate(greptime_timestamp_range,greptime_value,greptime_timestamp,Int64(120000))@1 as prom_rate(greptime_timestamp_range,greptime_value,greptime_timestamp,Int64(120000)), a@2 as a, b@3 as b, c@4 as c] | +| | CooperativeExec | +| | SortExec: expr=[a@2 ASC, b@3 ASC, c@4 ASC, d@5 ASC, greptime_timestamp@0 ASC], preserve_partitioning=[true] | +| | CooperativeExec | +| | MergeScanExec: REDACTED | | CoalesceBatchesExec: target_batch_size=8192 | | | RepartitionExec: partitioning=REDACTED | | CoalescePartitionsExec | @@ -645,9 +594,6 @@ tql analyze (1752591864, 1752592164, '30s') sum by (a, b, c) (rate(aggr_optimize | 0_| 0_|_ProjectionExec: expr=[a@1 as a, b@2 as b, c@3 as c, greptime_timestamp@4 as greptime_timestamp, sum(prom_rate(greptime_timestamp_range,greptime_value,greptime_timestamp,Int64(120000)))@0 / sum(prom_rate(greptime_timestamp_range,greptime_value,greptime_timestamp,Int64(120000)))@5 as aggr_optimize_not.sum(prom_rate(greptime_timestamp_range,greptime_value,greptime_timestamp,Int64(120000))) / aggr_optimize_not_count.sum(prom_rate(greptime_timestamp_range,greptime_value,greptime_timestamp,Int64(120000)))] REDACTED |_|_|_CoalesceBatchesExec: target_batch_size=8192 REDACTED |_|_|_REDACTED -|_|_|_CoalesceBatchesExec: target_batch_size=8192 REDACTED -|_|_|_RepartitionExec: partitioning=REDACTED -|_|_|_CoalescePartitionsExec REDACTED |_|_|_AggregateExec: mode=FinalPartitioned, gby=[a@0 as a, b@1 as b, c@2 as c, greptime_timestamp@3 as greptime_timestamp], aggr=[sum(prom_rate(greptime_timestamp_range,greptime_value,greptime_timestamp,Int64(120000)))], ordering_mode=PartiallySorted([0, 1, 2]) REDACTED |_|_|_SortExec: expr=[a@0 ASC NULLS LAST, b@1 ASC NULLS LAST, c@2 ASC NULLS LAST], preserve_partitioning=[true] REDACTED |_|_|_CoalesceBatchesExec: target_batch_size=8192 REDACTED @@ -679,10 +625,6 @@ tql analyze (1752591864, 1752592164, '30s') sum by (a, b, c) (rate(aggr_optimize |_|_|_PromRangeManipulateExec: req range=[1752591864000..1752592164000], interval=[30000], eval range=[120000], time index=[greptime_timestamp] REDACTED |_|_|_PromSeriesNormalizeExec: offset=[0], time index=[greptime_timestamp], filter NaN: [true] REDACTED |_|_|_PromSeriesDivideExec: tags=["a", "b", "c", "d"] REDACTED -|_|_|_SortExec: expr=[a@0 ASC, b@1 ASC, c@2 ASC, d@3 ASC, greptime_timestamp@4 ASC], preserve_partitioning=[true] REDACTED -|_|_|_CoalesceBatchesExec: target_batch_size=8192 REDACTED -|_|_|_RepartitionExec: partitioning=REDACTED -|_|_|_CoalescePartitionsExec REDACTED |_|_|_CooperativeExec REDACTED |_|_|_SeriesScan: region=REDACTED, "partition_count":{"count":0, "mem_ranges":0, "files":0, "file_ranges":0}, "distribution":"PerSeries" REDACTED |_|_|_| @@ -693,10 +635,6 @@ tql analyze (1752591864, 1752592164, '30s') sum by (a, b, c) (rate(aggr_optimize |_|_|_PromRangeManipulateExec: req range=[1752591864000..1752592164000], interval=[30000], eval range=[120000], time index=[greptime_timestamp] REDACTED |_|_|_PromSeriesNormalizeExec: offset=[0], time index=[greptime_timestamp], filter NaN: [true] REDACTED |_|_|_PromSeriesDivideExec: tags=["a", "b", "c", "d"] REDACTED -|_|_|_SortExec: expr=[a@0 ASC, b@1 ASC, c@2 ASC, d@3 ASC, greptime_timestamp@4 ASC], preserve_partitioning=[true] REDACTED -|_|_|_CoalesceBatchesExec: target_batch_size=8192 REDACTED -|_|_|_RepartitionExec: partitioning=REDACTED -|_|_|_CoalescePartitionsExec REDACTED |_|_|_CooperativeExec REDACTED |_|_|_SeriesScan: region=REDACTED, "partition_count":{"count":0, "mem_ranges":0, "files":0, "file_ranges":0}, "distribution":"PerSeries" REDACTED |_|_|_| @@ -707,10 +645,6 @@ tql analyze (1752591864, 1752592164, '30s') sum by (a, b, c) (rate(aggr_optimize |_|_|_PromRangeManipulateExec: req range=[1752591864000..1752592164000], interval=[30000], eval range=[120000], time index=[greptime_timestamp] REDACTED |_|_|_PromSeriesNormalizeExec: offset=[0], time index=[greptime_timestamp], filter NaN: [true] REDACTED |_|_|_PromSeriesDivideExec: tags=["a", "b", "c", "d"] REDACTED -|_|_|_SortExec: expr=[a@0 ASC, b@1 ASC, c@2 ASC, d@3 ASC, greptime_timestamp@4 ASC], preserve_partitioning=[true] REDACTED -|_|_|_CoalesceBatchesExec: target_batch_size=8192 REDACTED -|_|_|_RepartitionExec: partitioning=REDACTED -|_|_|_CoalescePartitionsExec REDACTED |_|_|_CooperativeExec REDACTED |_|_|_SeriesScan: region=REDACTED, "partition_count":{"count":0, "mem_ranges":0, "files":0, "file_ranges":0}, "distribution":"PerSeries" REDACTED |_|_|_| @@ -721,10 +655,6 @@ tql analyze (1752591864, 1752592164, '30s') sum by (a, b, c) (rate(aggr_optimize |_|_|_PromRangeManipulateExec: req range=[1752591864000..1752592164000], interval=[30000], eval range=[120000], time index=[greptime_timestamp] REDACTED |_|_|_PromSeriesNormalizeExec: offset=[0], time index=[greptime_timestamp], filter NaN: [true] REDACTED |_|_|_PromSeriesDivideExec: tags=["a", "b", "c", "d"] REDACTED -|_|_|_SortExec: expr=[a@0 ASC, b@1 ASC, c@2 ASC, d@3 ASC, greptime_timestamp@4 ASC], preserve_partitioning=[true] REDACTED -|_|_|_CoalesceBatchesExec: target_batch_size=8192 REDACTED -|_|_|_RepartitionExec: partitioning=REDACTED -|_|_|_CoalescePartitionsExec REDACTED |_|_|_CooperativeExec REDACTED |_|_|_SeriesScan: region=REDACTED, "partition_count":{"count":0, "mem_ranges":0, "files":0, "file_ranges":0}, "distribution":"PerSeries" REDACTED |_|_|_| diff --git a/tests/cases/distributed/optimizer/order_by.result b/tests/cases/distributed/optimizer/order_by.result index df4ce72d6d..603e3cf2a5 100644 --- a/tests/cases/distributed/optimizer/order_by.result +++ b/tests/cases/distributed/optimizer/order_by.result @@ -73,8 +73,8 @@ explain select * from numbers order by number desc limit 10; | | ]] | | physical_plan | SortPreservingMergeExec: [number@0 DESC], fetch=10 | | | CooperativeExec | -| | SortExec: TopK(fetch=10), expr=[number@0 DESC], preserve_partitioning=[true] | -| | RepartitionExec: partitioning=REDACTED +| | RepartitionExec: partitioning=REDACTED +| | SortExec: TopK(fetch=10), expr=[number@0 DESC], preserve_partitioning=[false] | | | CooperativeExec | | | StreamScanAdapter: [], schema: [Schema { fields: [Field { name: "number", data_type: UInt32, nullable: false, dict_id: 0, dict_is_ordered: false, metadata: {} }], metadata: {"greptime:version": "0"} }] | | | | @@ -95,8 +95,8 @@ explain select * from numbers order by number asc limit 10; | | ]] | | physical_plan | SortPreservingMergeExec: [number@0 ASC NULLS LAST], fetch=10 | | | CooperativeExec | -| | SortExec: TopK(fetch=10), expr=[number@0 ASC NULLS LAST], preserve_partitioning=[true] | -| | RepartitionExec: partitioning=REDACTED +| | RepartitionExec: partitioning=REDACTED +| | SortExec: TopK(fetch=10), expr=[number@0 ASC NULLS LAST], preserve_partitioning=[false] | | | CooperativeExec | | | StreamScanAdapter: [], schema: [Schema { fields: [Field { name: "number", data_type: UInt32, nullable: false, dict_id: 0, dict_is_ordered: false, metadata: {} }], metadata: {"greptime:version": "0"} }] | | | | diff --git a/tests/cases/distributed/tql-explain-analyze/analyze.result b/tests/cases/distributed/tql-explain-analyze/analyze.result index f0b1a63bf9..1f90b57d46 100644 --- a/tests/cases/distributed/tql-explain-analyze/analyze.result +++ b/tests/cases/distributed/tql-explain-analyze/analyze.result @@ -25,10 +25,6 @@ TQL ANALYZE (0, 10, '5s') test; |_|_|_| | 1_| 0_|_PromInstantManipulateExec: range=[0..10000], lookback=[300000], interval=[5000], time index=[j] REDACTED |_|_|_PromSeriesDivideExec: tags=["k"] REDACTED -|_|_|_SortExec: expr=[k@2 ASC, j@1 ASC], preserve_partitioning=[true] REDACTED -|_|_|_CoalesceBatchesExec: target_batch_size=8192 REDACTED -|_|_|_RepartitionExec: partitioning=REDACTED -|_|_|_CoalescePartitionsExec REDACTED |_|_|_CooperativeExec REDACTED |_|_|_SeriesScan: region=REDACTED, "partition_count":{"count":1, "mem_ranges":1, "files":0, "file_ranges":0}, "distribution":"PerSeries" REDACTED |_|_|_| @@ -54,10 +50,6 @@ TQL ANALYZE (0, 10, '1s', '2s') test; |_|_|_| | 1_| 0_|_PromInstantManipulateExec: range=[0..10000], lookback=[2000], interval=[1000], time index=[j] REDACTED |_|_|_PromSeriesDivideExec: tags=["k"] REDACTED -|_|_|_SortExec: expr=[k@2 ASC, j@1 ASC], preserve_partitioning=[true] REDACTED -|_|_|_CoalesceBatchesExec: target_batch_size=8192 REDACTED -|_|_|_RepartitionExec: partitioning=REDACTED -|_|_|_CoalescePartitionsExec REDACTED |_|_|_CooperativeExec REDACTED |_|_|_SeriesScan: region=REDACTED, "partition_count":{"count":1, "mem_ranges":1, "files":0, "file_ranges":0}, "distribution":"PerSeries" REDACTED |_|_|_| @@ -82,10 +74,6 @@ TQL ANALYZE ('1970-01-01T00:00:00'::timestamp, '1970-01-01T00:00:00'::timestamp |_|_|_| | 1_| 0_|_PromInstantManipulateExec: range=[0..10000], lookback=[300000], interval=[5000], time index=[j] REDACTED |_|_|_PromSeriesDivideExec: tags=["k"] REDACTED -|_|_|_SortExec: expr=[k@2 ASC, j@1 ASC], preserve_partitioning=[true] REDACTED -|_|_|_CoalesceBatchesExec: target_batch_size=8192 REDACTED -|_|_|_RepartitionExec: partitioning=REDACTED -|_|_|_CoalescePartitionsExec REDACTED |_|_|_CooperativeExec REDACTED |_|_|_SeriesScan: region=REDACTED, "partition_count":{"count":1, "mem_ranges":1, "files":0, "file_ranges":0}, "distribution":"PerSeries" REDACTED |_|_|_| @@ -112,10 +100,6 @@ TQL ANALYZE VERBOSE (0, 10, '5s') test; |_|_|_| | 1_| 0_|_PromInstantManipulateExec: range=[0..10000], lookback=[300000], interval=[5000], time index=[j] REDACTED |_|_|_PromSeriesDivideExec: tags=["k"] REDACTED -|_|_|_SortExec: expr=[k@2 ASC, j@1 ASC], preserve_partitioning=[true] REDACTED -|_|_|_CoalesceBatchesExec: target_batch_size=8192 REDACTED -|_|_|_RepartitionExec: partitioning=REDACTED -|_|_|_CoalescePartitionsExec REDACTED |_|_|_CooperativeExec REDACTED |_|_|_SeriesScan: region=REDACTED, {"partition_count":{"count":1, "mem_ranges":1, "files":0, "file_ranges":0}, "distribution":"PerSeries", "projection": ["i", "j", "k"], "filters": ["j >= TimestampMillisecond(-300000, None)", "j <= TimestampMillisecond(310000, None)"], "REDACTED |_|_|_| @@ -151,19 +135,11 @@ TQL ANALYZE (0, 10, '5s') test; |_|_|_| | 1_| 0_|_PromInstantManipulateExec: range=[0..10000], lookback=[300000], interval=[5000], time index=[j] REDACTED |_|_|_PromSeriesDivideExec: tags=["k", "l"] REDACTED -|_|_|_SortExec: expr=[k@2 ASC, l@3 ASC, j@1 ASC], preserve_partitioning=[true] REDACTED -|_|_|_CoalesceBatchesExec: target_batch_size=8192 REDACTED -|_|_|_RepartitionExec: partitioning=REDACTED -|_|_|_CoalescePartitionsExec REDACTED |_|_|_CooperativeExec REDACTED |_|_|_SeriesScan: region=REDACTED, "partition_count":{"count":0, "mem_ranges":0, "files":0, "file_ranges":0}, "distribution":"PerSeries" REDACTED |_|_|_| | 1_| 1_|_PromInstantManipulateExec: range=[0..10000], lookback=[300000], interval=[5000], time index=[j] REDACTED |_|_|_PromSeriesDivideExec: tags=["k", "l"] REDACTED -|_|_|_SortExec: expr=[k@2 ASC, l@3 ASC, j@1 ASC], preserve_partitioning=[true] REDACTED -|_|_|_CoalesceBatchesExec: target_batch_size=8192 REDACTED -|_|_|_RepartitionExec: partitioning=REDACTED -|_|_|_CoalescePartitionsExec REDACTED |_|_|_CooperativeExec REDACTED |_|_|_SeriesScan: region=REDACTED, "partition_count":{"count":0, "mem_ranges":0, "files":0, "file_ranges":0}, "distribution":"PerSeries" REDACTED |_|_|_| @@ -195,10 +171,6 @@ TQL ANALYZE (0, 10, '5s') rate(test[10s]); |_|_|_PromRangeManipulateExec: req range=[0..10000], interval=[5000], eval range=[10000], time index=[j] REDACTED |_|_|_PromSeriesNormalizeExec: offset=[0], time index=[j], filter NaN: [true] REDACTED |_|_|_PromSeriesDivideExec: tags=["k", "l"] REDACTED -|_|_|_SortExec: expr=[k@2 ASC, l@3 ASC, j@1 ASC], preserve_partitioning=[true] REDACTED -|_|_|_CoalesceBatchesExec: target_batch_size=8192 REDACTED -|_|_|_RepartitionExec: partitioning=REDACTED -|_|_|_CoalescePartitionsExec REDACTED |_|_|_CooperativeExec REDACTED |_|_|_SeriesScan: region=REDACTED, "partition_count":{"count":0, "mem_ranges":0, "files":0, "file_ranges":0}, "distribution":"PerSeries" REDACTED |_|_|_| @@ -209,10 +181,6 @@ TQL ANALYZE (0, 10, '5s') rate(test[10s]); |_|_|_PromRangeManipulateExec: req range=[0..10000], interval=[5000], eval range=[10000], time index=[j] REDACTED |_|_|_PromSeriesNormalizeExec: offset=[0], time index=[j], filter NaN: [true] REDACTED |_|_|_PromSeriesDivideExec: tags=["k", "l"] REDACTED -|_|_|_SortExec: expr=[k@2 ASC, l@3 ASC, j@1 ASC], preserve_partitioning=[true] REDACTED -|_|_|_CoalesceBatchesExec: target_batch_size=8192 REDACTED -|_|_|_RepartitionExec: partitioning=REDACTED -|_|_|_CoalescePartitionsExec REDACTED |_|_|_CooperativeExec REDACTED |_|_|_SeriesScan: region=REDACTED, "partition_count":{"count":0, "mem_ranges":0, "files":0, "file_ranges":0}, "distribution":"PerSeries" REDACTED |_|_|_| diff --git a/tests/cases/standalone/common/promql/regex.result b/tests/cases/standalone/common/promql/regex.result index 76bdf5a222..ab71cf8e7a 100644 --- a/tests/cases/standalone/common/promql/regex.result +++ b/tests/cases/standalone/common/promql/regex.result @@ -73,10 +73,6 @@ TQL ANALYZE VERBOSE (0, 0, '1s') test{host=~".*"}; |_|_|_| | 1_| 0_|_PromInstantManipulateExec: range=[0..0], lookback=[300000], interval=[1000], time index=[ts] REDACTED |_|_|_PromSeriesDivideExec: tags=["host"] REDACTED -|_|_|_SortExec: expr=[host@1 ASC, ts@0 ASC], preserve_partitioning=[true] REDACTED -|_|_|_CoalesceBatchesExec: target_batch_size=8192 REDACTED -|_|_|_RepartitionExec: partitioning=REDACTED -|_|_|_CoalescePartitionsExec REDACTED |_|_|_CooperativeExec REDACTED |_|_|_SeriesScan: region=REDACTED, {"partition_count":{"count":1, "mem_ranges":1, "files":0, "file_ranges":0}, "distribution":"PerSeries", "projection": ["ts", "host", "val"], "filters": ["ts >= TimestampMillisecond(-300000, None)", "ts <= TimestampMillisecond(300000, None)"], "REDACTED |_|_|_| @@ -100,10 +96,6 @@ TQL ANALYZE VERBOSE (0, 0, '1s') test{host=~".+"}; |_|_|_| | 1_| 0_|_PromInstantManipulateExec: range=[0..0], lookback=[300000], interval=[1000], time index=[ts] REDACTED |_|_|_PromSeriesDivideExec: tags=["host"] REDACTED -|_|_|_SortExec: expr=[host@1 ASC, ts@0 ASC], preserve_partitioning=[true] REDACTED -|_|_|_CoalesceBatchesExec: target_batch_size=8192 REDACTED -|_|_|_RepartitionExec: partitioning=REDACTED -|_|_|_CoalescePartitionsExec REDACTED |_|_|_CooperativeExec REDACTED |_|_|_SeriesScan: region=REDACTED, {"partition_count":{"count":1, "mem_ranges":1, "files":0, "file_ranges":0}, "distribution":"PerSeries", "projection": ["ts", "host", "val"], "filters": ["host != Utf8(\"\")", "ts >= TimestampMillisecond(-300000, None)", "ts <= TimestampMillisecond(300000, None)"], "REDACTED |_|_|_| @@ -152,10 +144,6 @@ TQL ANALYZE VERBOSE (0, 0, '1s') test{host!~".+"}; |_|_|_| | 1_| 0_|_PromInstantManipulateExec: range=[0..0], lookback=[300000], interval=[1000], time index=[ts] REDACTED |_|_|_PromSeriesDivideExec: tags=["host"] REDACTED -|_|_|_SortExec: expr=[host@1 ASC, ts@0 ASC], preserve_partitioning=[true] REDACTED -|_|_|_CoalesceBatchesExec: target_batch_size=8192 REDACTED -|_|_|_RepartitionExec: partitioning=REDACTED -|_|_|_CoalescePartitionsExec REDACTED |_|_|_CooperativeExec REDACTED |_|_|_SeriesScan: region=REDACTED, {"partition_count":{"count":1, "mem_ranges":1, "files":0, "file_ranges":0}, "distribution":"PerSeries", "projection": ["ts", "host", "val"], "filters": ["host = Utf8(\"\")", "ts >= TimestampMillisecond(-300000, None)", "ts <= TimestampMillisecond(300000, None)"], "REDACTED |_|_|_| diff --git a/tests/cases/standalone/common/select/tql_filter.result b/tests/cases/standalone/common/select/tql_filter.result index 2c07fe347e..345671376f 100644 --- a/tests/cases/standalone/common/select/tql_filter.result +++ b/tests/cases/standalone/common/select/tql_filter.result @@ -23,10 +23,6 @@ tql analyze (1, 3, '1s') t1{ a = "a" }; |_|_|_| | 1_| 0_|_PromInstantManipulateExec: range=[1000..3000], lookback=[300000], interval=[1000], time index=[b] REDACTED |_|_|_PromSeriesDivideExec: tags=["a"] REDACTED -|_|_|_SortExec: expr=[a@0 ASC, b@1 ASC], preserve_partitioning=[true] REDACTED -|_|_|_CoalesceBatchesExec: target_batch_size=8192 REDACTED -|_|_|_RepartitionExec: partitioning=REDACTED -|_|_|_CoalescePartitionsExec REDACTED |_|_|_CooperativeExec REDACTED |_|_|_SeriesScan: region=REDACTED, "partition_count":{"count":1, "mem_ranges":1, "files":0, "file_ranges":0}, "distribution":"PerSeries" REDACTED |_|_|_| @@ -50,10 +46,6 @@ tql analyze (1, 3, '1s') t1{ a =~ ".*" }; |_|_|_| | 1_| 0_|_PromInstantManipulateExec: range=[1000..3000], lookback=[300000], interval=[1000], time index=[b] REDACTED |_|_|_PromSeriesDivideExec: tags=["a"] REDACTED -|_|_|_SortExec: expr=[a@0 ASC, b@1 ASC], preserve_partitioning=[true] REDACTED -|_|_|_CoalesceBatchesExec: target_batch_size=8192 REDACTED -|_|_|_RepartitionExec: partitioning=REDACTED -|_|_|_CoalescePartitionsExec REDACTED |_|_|_CooperativeExec REDACTED |_|_|_SeriesScan: region=REDACTED, "partition_count":{"count":1, "mem_ranges":1, "files":0, "file_ranges":0}, "distribution":"PerSeries" REDACTED |_|_|_| @@ -77,10 +69,6 @@ tql analyze (1, 3, '1s') t1{ a =~ "a.*" }; |_|_|_| | 1_| 0_|_PromInstantManipulateExec: range=[1000..3000], lookback=[300000], interval=[1000], time index=[b] REDACTED |_|_|_PromSeriesDivideExec: tags=["a"] REDACTED -|_|_|_SortExec: expr=[a@0 ASC, b@1 ASC], preserve_partitioning=[true] REDACTED -|_|_|_CoalesceBatchesExec: target_batch_size=8192 REDACTED -|_|_|_RepartitionExec: partitioning=REDACTED -|_|_|_CoalescePartitionsExec REDACTED |_|_|_CooperativeExec REDACTED |_|_|_SeriesScan: region=REDACTED, "partition_count":{"count":1, "mem_ranges":1, "files":0, "file_ranges":0}, "distribution":"PerSeries" REDACTED |_|_|_| diff --git a/tests/cases/standalone/common/tql-explain-analyze/explain.result b/tests/cases/standalone/common/tql-explain-analyze/explain.result index 286499673a..da57a55bcc 100644 --- a/tests/cases/standalone/common/tql-explain-analyze/explain.result +++ b/tests/cases/standalone/common/tql-explain-analyze/explain.result @@ -163,9 +163,6 @@ TQL EXPLAIN VERBOSE (0, 10, '5s') test; |_|_| | initial_physical_plan_with_schema_| MergeScanExec: REDACTED |_|_| -| physical_plan after parallelize_scan_| MergeScanExec: REDACTED -|_|_| -| physical_plan after PassDistributionRule_| SAME TEXT AS ABOVE_| | physical_plan after OutputRequirements_| OutputRequirementExec: order_by=[], dist_by=Unspecified_| |_|_MergeScanExec: REDACTED |_|_| @@ -173,6 +170,9 @@ TQL EXPLAIN VERBOSE (0, 10, '5s') test; | physical_plan after join_selection_| SAME TEXT AS ABOVE_| | physical_plan after LimitedDistinctAggregation_| SAME TEXT AS ABOVE_| | physical_plan after FilterPushdown_| SAME TEXT AS ABOVE_| +| physical_plan after parallelize_scan_| SAME TEXT AS ABOVE_| +| physical_plan after PassDistributionRule_| SAME TEXT AS ABOVE_| +| physical_plan after EnforceSorting_| SAME TEXT AS ABOVE_| | physical_plan after EnforceDistribution_| SAME TEXT AS ABOVE_| | physical_plan after CombinePartialFinalAggregate_| SAME TEXT AS ABOVE_| | physical_plan after EnforceSorting_| SAME TEXT AS ABOVE_| diff --git a/tests/cases/standalone/common/tql/general_table.result b/tests/cases/standalone/common/tql/general_table.result index 98a770ce00..9adec3800d 100644 --- a/tests/cases/standalone/common/tql/general_table.result +++ b/tests/cases/standalone/common/tql/general_table.result @@ -27,8 +27,8 @@ TQL analyze (0, 10, '1s') sum by(job) (irate(cpu_usage{job="fire"}[5s])) / 1e9; +-+-+-+ | 0_| 0_|_ProjectionExec: expr=[job@0 as job, ts@1 as ts, sum(prom_irate(ts_range,value))@2 / 1000000000 as sum(prom_irate(ts_range,value)) / Float64(1000000000)] REDACTED |_|_|_RepartitionExec: partitioning=REDACTED -|_|_|_SortExec: expr=[job@0 ASC NULLS LAST, ts@1 ASC NULLS LAST], preserve_partitioning=[false] REDACTED -|_|_|_CoalescePartitionsExec REDACTED +|_|_|_SortPreservingMergeExec: [job@0 ASC NULLS LAST, ts@1 ASC NULLS LAST] REDACTED +|_|_|_SortExec: expr=[job@0 ASC NULLS LAST, ts@1 ASC NULLS LAST], preserve_partitioning=[true] REDACTED |_|_|_AggregateExec: mode=FinalPartitioned, gby=[job@0 as job, ts@1 as ts], aggr=[sum(prom_irate(ts_range,value))] REDACTED |_|_|_CoalesceBatchesExec: target_batch_size=8192 REDACTED |_|_|_RepartitionExec: partitioning=REDACTED diff --git a/tests/cases/standalone/common/tql/partition.result b/tests/cases/standalone/common/tql/partition.result index 08ae5e9e12..401cd68ec0 100644 --- a/tests/cases/standalone/common/tql/partition.result +++ b/tests/cases/standalone/common/tql/partition.result @@ -24,8 +24,8 @@ tql analyze (0, 10, '1s') 100 - (avg by (k) (irate(t[1m])) * 100); |_|_|_| | 1_| 0_|_ProjectionExec: expr=[k@0 as k, j@1 as j, 100 - avg(prom_irate(j_range,i))@2 * 100 as Float64(100) - avg(prom_irate(j_range,i)) * Float64(100)] REDACTED |_|_|_RepartitionExec: partitioning=REDACTED -|_|_|_SortExec: expr=[k@0 ASC NULLS LAST, j@1 ASC NULLS LAST], preserve_partitioning=[false] REDACTED -|_|_|_CoalescePartitionsExec REDACTED +|_|_|_SortPreservingMergeExec: [k@0 ASC NULLS LAST, j@1 ASC NULLS LAST] REDACTED +|_|_|_SortExec: expr=[k@0 ASC NULLS LAST, j@1 ASC NULLS LAST], preserve_partitioning=[true] REDACTED |_|_|_AggregateExec: mode=FinalPartitioned, gby=[k@0 as k, j@1 as j], aggr=[avg(prom_irate(j_range,i))] REDACTED |_|_|_CoalesceBatchesExec: target_batch_size=8192 REDACTED |_|_|_RepartitionExec: partitioning=REDACTED @@ -90,10 +90,6 @@ tql analyze (0, 10, '1s') 100 - (avg by (k) (irate(t[1m])) * 100); |_|_|_PromRangeManipulateExec: req range=[0..10000], interval=[1000], eval range=[60000], time index=[j] REDACTED |_|_|_PromSeriesNormalizeExec: offset=[0], time index=[j], filter NaN: [true] REDACTED |_|_|_PromSeriesDivideExec: tags=["k", "l"] REDACTED -|_|_|_SortExec: expr=[k@2 ASC, l@3 ASC, j@1 ASC], preserve_partitioning=[true] REDACTED -|_|_|_CoalesceBatchesExec: target_batch_size=8192 REDACTED -|_|_|_RepartitionExec: partitioning=REDACTED -|_|_|_CoalescePartitionsExec REDACTED |_|_|_CooperativeExec REDACTED |_|_|_SeriesScan: region=REDACTED, "partition_count":{"count":0, "mem_ranges":0, "files":0, "file_ranges":0}, "distribution":"PerSeries" REDACTED |_|_|_| @@ -103,10 +99,6 @@ tql analyze (0, 10, '1s') 100 - (avg by (k) (irate(t[1m])) * 100); |_|_|_PromRangeManipulateExec: req range=[0..10000], interval=[1000], eval range=[60000], time index=[j] REDACTED |_|_|_PromSeriesNormalizeExec: offset=[0], time index=[j], filter NaN: [true] REDACTED |_|_|_PromSeriesDivideExec: tags=["k", "l"] REDACTED -|_|_|_SortExec: expr=[k@2 ASC, l@3 ASC, j@1 ASC], preserve_partitioning=[true] REDACTED -|_|_|_CoalesceBatchesExec: target_batch_size=8192 REDACTED -|_|_|_RepartitionExec: partitioning=REDACTED -|_|_|_CoalescePartitionsExec REDACTED |_|_|_CooperativeExec REDACTED |_|_|_SeriesScan: region=REDACTED, "partition_count":{"count":0, "mem_ranges":0, "files":0, "file_ranges":0}, "distribution":"PerSeries" REDACTED |_|_|_| diff --git a/tests/cases/standalone/optimizer/order_by.result b/tests/cases/standalone/optimizer/order_by.result index e649d140cf..dfb8b7e7d4 100644 --- a/tests/cases/standalone/optimizer/order_by.result +++ b/tests/cases/standalone/optimizer/order_by.result @@ -69,8 +69,8 @@ explain select * from numbers order by number desc limit 10; | | ]] | | physical_plan | SortPreservingMergeExec: [number@0 DESC], fetch=10 | | | CooperativeExec | -| | SortExec: TopK(fetch=10), expr=[number@0 DESC], preserve_partitioning=[true] | -| | RepartitionExec: partitioning=REDACTED +| | RepartitionExec: partitioning=REDACTED +| | SortExec: TopK(fetch=10), expr=[number@0 DESC], preserve_partitioning=[false] | | | CooperativeExec | | | StreamScanAdapter: [], schema: [Schema { fields: [Field { name: "number", data_type: UInt32, nullable: false, dict_id: 0, dict_is_ordered: false, metadata: {} }], metadata: {"greptime:version": "0"} }] | | | | @@ -90,8 +90,8 @@ explain select * from numbers order by number asc limit 10; | | ]] | | physical_plan | SortPreservingMergeExec: [number@0 ASC NULLS LAST], fetch=10 | | | CooperativeExec | -| | SortExec: TopK(fetch=10), expr=[number@0 ASC NULLS LAST], preserve_partitioning=[true] | -| | RepartitionExec: partitioning=REDACTED +| | RepartitionExec: partitioning=REDACTED +| | SortExec: TopK(fetch=10), expr=[number@0 ASC NULLS LAST], preserve_partitioning=[false] | | | CooperativeExec | | | StreamScanAdapter: [], schema: [Schema { fields: [Field { name: "number", data_type: UInt32, nullable: false, dict_id: 0, dict_is_ordered: false, metadata: {} }], metadata: {"greptime:version": "0"} }] | | | | diff --git a/tests/cases/standalone/optimizer/windowed_sort.result b/tests/cases/standalone/optimizer/windowed_sort.result index b59cad0709..472c6c7de3 100644 --- a/tests/cases/standalone/optimizer/windowed_sort.result +++ b/tests/cases/standalone/optimizer/windowed_sort.result @@ -286,8 +286,8 @@ TQL ANALYZE('2023-10-01 00:00:00.000'::TIMESTAMP, '2023-10-01 00:00:05.000'::TIM | 0_| 0_|_CooperativeExec REDACTED |_|_|_MergeScanExec: REDACTED |_|_|_| -| 1_| 0_|_SortExec: expr=[greptime_timestamp@0 ASC NULLS LAST], preserve_partitioning=[false] REDACTED -|_|_|_CoalescePartitionsExec REDACTED +| 1_| 0_|_SortPreservingMergeExec: [greptime_timestamp@0 ASC NULLS LAST] REDACTED +|_|_|_SortExec: expr=[greptime_timestamp@0 ASC NULLS LAST], preserve_partitioning=[true] REDACTED |_|_|_AggregateExec: mode=FinalPartitioned, gby=[greptime_timestamp@0 as greptime_timestamp], aggr=[sum(instance_job_REDACTED |_|_|_CoalesceBatchesExec: target_batch_size=8192 REDACTED |_|_|_RepartitionExec: partitioning=REDACTED diff --git a/tests/cases/standalone/tql-explain-analyze/analyze.result b/tests/cases/standalone/tql-explain-analyze/analyze.result index ed8cd0e19e..0d366e5965 100644 --- a/tests/cases/standalone/tql-explain-analyze/analyze.result +++ b/tests/cases/standalone/tql-explain-analyze/analyze.result @@ -25,10 +25,6 @@ TQL ANALYZE (0, 10, '5s') test; |_|_|_| | 1_| 0_|_PromInstantManipulateExec: range=[0..10000], lookback=[300000], interval=[5000], time index=[j] REDACTED |_|_|_PromSeriesDivideExec: tags=["k"] REDACTED -|_|_|_SortExec: expr=[k@2 ASC, j@1 ASC], preserve_partitioning=[true] REDACTED -|_|_|_CoalesceBatchesExec: target_batch_size=8192 REDACTED -|_|_|_RepartitionExec: partitioning=REDACTED -|_|_|_CoalescePartitionsExec REDACTED |_|_|_CooperativeExec REDACTED |_|_|_SeriesScan: region=REDACTED, "partition_count":{"count":1, "mem_ranges":1, "files":0, "file_ranges":0}, "distribution":"PerSeries" REDACTED |_|_|_| @@ -54,10 +50,6 @@ TQL ANALYZE (0, 10, '1s', '2s') test; |_|_|_| | 1_| 0_|_PromInstantManipulateExec: range=[0..10000], lookback=[2000], interval=[1000], time index=[j] REDACTED |_|_|_PromSeriesDivideExec: tags=["k"] REDACTED -|_|_|_SortExec: expr=[k@2 ASC, j@1 ASC], preserve_partitioning=[true] REDACTED -|_|_|_CoalesceBatchesExec: target_batch_size=8192 REDACTED -|_|_|_RepartitionExec: partitioning=REDACTED -|_|_|_CoalescePartitionsExec REDACTED |_|_|_CooperativeExec REDACTED |_|_|_SeriesScan: region=REDACTED, "partition_count":{"count":1, "mem_ranges":1, "files":0, "file_ranges":0}, "distribution":"PerSeries" REDACTED |_|_|_| @@ -82,10 +74,6 @@ TQL ANALYZE ('1970-01-01T00:00:00'::timestamp, '1970-01-01T00:00:00'::timestamp |_|_|_| | 1_| 0_|_PromInstantManipulateExec: range=[0..10000], lookback=[300000], interval=[5000], time index=[j] REDACTED |_|_|_PromSeriesDivideExec: tags=["k"] REDACTED -|_|_|_SortExec: expr=[k@2 ASC, j@1 ASC], preserve_partitioning=[true] REDACTED -|_|_|_CoalesceBatchesExec: target_batch_size=8192 REDACTED -|_|_|_RepartitionExec: partitioning=REDACTED -|_|_|_CoalescePartitionsExec REDACTED |_|_|_CooperativeExec REDACTED |_|_|_SeriesScan: region=REDACTED, "partition_count":{"count":1, "mem_ranges":1, "files":0, "file_ranges":0}, "distribution":"PerSeries" REDACTED |_|_|_| @@ -112,10 +100,6 @@ TQL ANALYZE VERBOSE (0, 10, '5s') test; |_|_|_| | 1_| 0_|_PromInstantManipulateExec: range=[0..10000], lookback=[300000], interval=[5000], time index=[j] REDACTED |_|_|_PromSeriesDivideExec: tags=["k"] REDACTED -|_|_|_SortExec: expr=[k@2 ASC, j@1 ASC], preserve_partitioning=[true] REDACTED -|_|_|_CoalesceBatchesExec: target_batch_size=8192 REDACTED -|_|_|_RepartitionExec: partitioning=REDACTED -|_|_|_CoalescePartitionsExec REDACTED |_|_|_CooperativeExec REDACTED |_|_|_SeriesScan: region=REDACTED, {"partition_count":{"count":1, "mem_ranges":1, "files":0, "file_ranges":0}, "distribution":"PerSeries", "projection": ["i", "j", "k"], "filters": ["j >= TimestampMillisecond(-300000, None)", "j <= TimestampMillisecond(310000, None)"], "REDACTED |_|_|_| @@ -151,19 +135,11 @@ TQL ANALYZE (0, 10, '5s') test; |_|_|_| | 1_| 0_|_PromInstantManipulateExec: range=[0..10000], lookback=[300000], interval=[5000], time index=[j] REDACTED |_|_|_PromSeriesDivideExec: tags=["k", "l"] REDACTED -|_|_|_SortExec: expr=[k@2 ASC, l@3 ASC, j@1 ASC], preserve_partitioning=[true] REDACTED -|_|_|_CoalesceBatchesExec: target_batch_size=8192 REDACTED -|_|_|_RepartitionExec: partitioning=REDACTED -|_|_|_CoalescePartitionsExec REDACTED |_|_|_CooperativeExec REDACTED |_|_|_SeriesScan: region=REDACTED, "partition_count":{"count":0, "mem_ranges":0, "files":0, "file_ranges":0}, "distribution":"PerSeries" REDACTED |_|_|_| | 1_| 1_|_PromInstantManipulateExec: range=[0..10000], lookback=[300000], interval=[5000], time index=[j] REDACTED |_|_|_PromSeriesDivideExec: tags=["k", "l"] REDACTED -|_|_|_SortExec: expr=[k@2 ASC, l@3 ASC, j@1 ASC], preserve_partitioning=[true] REDACTED -|_|_|_CoalesceBatchesExec: target_batch_size=8192 REDACTED -|_|_|_RepartitionExec: partitioning=REDACTED -|_|_|_CoalescePartitionsExec REDACTED |_|_|_CooperativeExec REDACTED |_|_|_SeriesScan: region=REDACTED, "partition_count":{"count":0, "mem_ranges":0, "files":0, "file_ranges":0}, "distribution":"PerSeries" REDACTED |_|_|_| @@ -194,10 +170,6 @@ TQL ANALYZE (0, 10, '5s') rate(test[10s]); |_|_|_PromRangeManipulateExec: req range=[0..10000], interval=[5000], eval range=[10000], time index=[j] REDACTED |_|_|_PromSeriesNormalizeExec: offset=[0], time index=[j], filter NaN: [true] REDACTED |_|_|_PromSeriesDivideExec: tags=["k", "l"] REDACTED -|_|_|_SortExec: expr=[k@2 ASC, l@3 ASC, j@1 ASC], preserve_partitioning=[true] REDACTED -|_|_|_CoalesceBatchesExec: target_batch_size=8192 REDACTED -|_|_|_RepartitionExec: partitioning=REDACTED -|_|_|_CoalescePartitionsExec REDACTED |_|_|_CooperativeExec REDACTED |_|_|_SeriesScan: region=REDACTED, "partition_count":{"count":0, "mem_ranges":0, "files":0, "file_ranges":0}, "distribution":"PerSeries" REDACTED |_|_|_| @@ -207,10 +179,6 @@ TQL ANALYZE (0, 10, '5s') rate(test[10s]); |_|_|_PromRangeManipulateExec: req range=[0..10000], interval=[5000], eval range=[10000], time index=[j] REDACTED |_|_|_PromSeriesNormalizeExec: offset=[0], time index=[j], filter NaN: [true] REDACTED |_|_|_PromSeriesDivideExec: tags=["k", "l"] REDACTED -|_|_|_SortExec: expr=[k@2 ASC, l@3 ASC, j@1 ASC], preserve_partitioning=[true] REDACTED -|_|_|_CoalesceBatchesExec: target_batch_size=8192 REDACTED -|_|_|_RepartitionExec: partitioning=REDACTED -|_|_|_CoalescePartitionsExec REDACTED |_|_|_CooperativeExec REDACTED |_|_|_SeriesScan: region=REDACTED, "partition_count":{"count":0, "mem_ranges":0, "files":0, "file_ranges":0}, "distribution":"PerSeries" REDACTED |_|_|_| @@ -278,19 +246,11 @@ TQL ANALYZE FORMAT TEXT (0, 10, '5s') test; |_|_|_| | 1_| 0_|_PromInstantManipulateExec: range=[0..10000], lookback=[300000], interval=[5000], time index=[j] REDACTED |_|_|_PromSeriesDivideExec: tags=["k", "l"] REDACTED -|_|_|_SortExec: expr=[k@2 ASC, l@3 ASC, j@1 ASC], preserve_partitioning=[true] REDACTED -|_|_|_CoalesceBatchesExec: target_batch_size=8192 REDACTED -|_|_|_RepartitionExec: partitioning=REDACTED -|_|_|_CoalescePartitionsExec REDACTED |_|_|_CooperativeExec REDACTED |_|_|_SeriesScan: region=REDACTED, "partition_count":{"count":0, "mem_ranges":0, "files":0, "file_ranges":0}, "distribution":"PerSeries" REDACTED |_|_|_| | 1_| 1_|_PromInstantManipulateExec: range=[0..10000], lookback=[300000], interval=[5000], time index=[j] REDACTED |_|_|_PromSeriesDivideExec: tags=["k", "l"] REDACTED -|_|_|_SortExec: expr=[k@2 ASC, l@3 ASC, j@1 ASC], preserve_partitioning=[true] REDACTED -|_|_|_CoalesceBatchesExec: target_batch_size=8192 REDACTED -|_|_|_RepartitionExec: partitioning=REDACTED -|_|_|_CoalescePartitionsExec REDACTED |_|_|_CooperativeExec REDACTED |_|_|_SeriesScan: region=REDACTED, "partition_count":{"count":0, "mem_ranges":0, "files":0, "file_ranges":0}, "distribution":"PerSeries" REDACTED |_|_|_| @@ -345,19 +305,11 @@ TQL ANALYZE sum(test2); |_|_|_| | 1_| 0_|_PromInstantManipulateExec: range=[0..0], lookback=[300000], interval=[300000], time index=[greptime_timestamp] REDACTED |_|_|_PromSeriesDivideExec: tags=["shard"] REDACTED -|_|_|_SortExec: expr=[shard@2 ASC, greptime_timestamp@0 ASC], preserve_partitioning=[true] REDACTED -|_|_|_CoalesceBatchesExec: target_batch_size=8192 REDACTED -|_|_|_RepartitionExec: partitioning=REDACTED -|_|_|_CoalescePartitionsExec REDACTED |_|_|_CooperativeExec REDACTED |_|_|_SeriesScan: region=REDACTED, "partition_count":{"count":0, "mem_ranges":0, "files":0, "file_ranges":0}, "distribution":"PerSeries" REDACTED |_|_|_| | 1_| 1_|_PromInstantManipulateExec: range=[0..0], lookback=[300000], interval=[300000], time index=[greptime_timestamp] REDACTED |_|_|_PromSeriesDivideExec: tags=["shard"] REDACTED -|_|_|_SortExec: expr=[shard@2 ASC, greptime_timestamp@0 ASC], preserve_partitioning=[true] REDACTED -|_|_|_CoalesceBatchesExec: target_batch_size=8192 REDACTED -|_|_|_RepartitionExec: partitioning=REDACTED -|_|_|_CoalescePartitionsExec REDACTED |_|_|_CooperativeExec REDACTED |_|_|_SeriesScan: region=REDACTED, "partition_count":{"count":0, "mem_ranges":0, "files":0, "file_ranges":0}, "distribution":"PerSeries" REDACTED |_|_|_|