Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions src/distributed_physical_optimizer_rule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -462,14 +462,14 @@ mod tests {
│ SortPreservingMergeExec: [count(Int64(1))@2 ASC NULLS LAST]
│ [Stage 2] => NetworkCoalesceExec: output_partitions=8, input_tasks=2
└──────────────────────────────────────────────────
┌───── Stage 2 ── Tasks: t0:[p0,p1,p2,p3] t1:[p0,p1,p2,p3]
┌───── Stage 2 ── Tasks: t0:[p0..p3] t1:[p0..p3]
│ SortExec: expr=[count(*)@0 ASC NULLS LAST], preserve_partitioning=[true]
│ ProjectionExec: expr=[count(Int64(1))@1 as count(*), RainToday@0 as RainToday, count(Int64(1))@1 as count(Int64(1))]
│ AggregateExec: mode=FinalPartitioned, gby=[RainToday@0 as RainToday], aggr=[count(Int64(1))]
│ CoalesceBatchesExec: target_batch_size=8192
│ [Stage 1] => NetworkShuffleExec: output_partitions=4, input_tasks=2
└──────────────────────────────────────────────────
┌───── Stage 1 ── Tasks: t0:[p0,p1,p2,p3,p4,p5,p6,p7] t1:[p0,p1,p2,p3,p4,p5,p6,p7]
┌───── Stage 1 ── Tasks: t0:[p0..p7] t1:[p0..p7]
│ RepartitionExec: partitioning=Hash([RainToday@0], 8), input_partitions=4
│ RepartitionExec: partitioning=RoundRobinBatch(4), input_partitions=2
│ AggregateExec: mode=Partial, gby=[RainToday@0 as RainToday], aggr=[count(Int64(1))]
Expand All @@ -490,14 +490,14 @@ mod tests {
│ SortPreservingMergeExec: [count(Int64(1))@2 ASC NULLS LAST]
│ [Stage 2] => NetworkCoalesceExec: output_partitions=8, input_tasks=2
└──────────────────────────────────────────────────
┌───── Stage 2 ── Tasks: t0:[p0,p1,p2,p3] t1:[p0,p1,p2,p3]
┌───── Stage 2 ── Tasks: t0:[p0..p3] t1:[p0..p3]
│ SortExec: expr=[count(*)@0 ASC NULLS LAST], preserve_partitioning=[true]
│ ProjectionExec: expr=[count(Int64(1))@1 as count(*), RainToday@0 as RainToday, count(Int64(1))@1 as count(Int64(1))]
│ AggregateExec: mode=FinalPartitioned, gby=[RainToday@0 as RainToday], aggr=[count(Int64(1))]
│ CoalesceBatchesExec: target_batch_size=8192
│ [Stage 1] => NetworkShuffleExec: output_partitions=4, input_tasks=2
└──────────────────────────────────────────────────
┌───── Stage 1 ── Tasks: t0:[p0,p1,p2,p3,p4,p5,p6,p7] t1:[p0,p1,p2,p3,p4,p5,p6,p7]
┌───── Stage 1 ── Tasks: t0:[p0..p7] t1:[p0..p7]
│ RepartitionExec: partitioning=Hash([RainToday@0], 8), input_partitions=4
│ RepartitionExec: partitioning=RoundRobinBatch(4), input_partitions=2
│ AggregateExec: mode=Partial, gby=[RainToday@0 as RainToday], aggr=[count(Int64(1))]
Expand Down Expand Up @@ -562,13 +562,13 @@ mod tests {
│ CoalesceBatchesExec: target_batch_size=8192
│ [Stage 3] => NetworkShuffleExec: output_partitions=4, input_tasks=2
└──────────────────────────────────────────────────
┌───── Stage 2 ── Tasks: t0:[p0,p1,p2,p3] t1:[p0,p1,p2,p3]
┌───── Stage 2 ── Tasks: t0:[p0..p3] t1:[p0..p3]
│ ProjectionExec: expr=[avg(weather.MinTemp)@1 as MinTemp, RainTomorrow@0 as RainTomorrow]
│ AggregateExec: mode=FinalPartitioned, gby=[RainTomorrow@0 as RainTomorrow], aggr=[avg(weather.MinTemp)]
│ CoalesceBatchesExec: target_batch_size=8192
│ [Stage 1] => NetworkShuffleExec: output_partitions=4, input_tasks=2
└──────────────────────────────────────────────────
┌───── Stage 1 ── Tasks: t0:[p0,p1,p2,p3,p4,p5,p6,p7] t1:[p0,p1,p2,p3,p4,p5,p6,p7]
┌───── Stage 1 ── Tasks: t0:[p0..p7] t1:[p0..p7]
│ RepartitionExec: partitioning=Hash([RainTomorrow@0], 8), input_partitions=4
│ AggregateExec: mode=Partial, gby=[RainTomorrow@1 as RainTomorrow], aggr=[avg(weather.MinTemp)]
│ CoalesceBatchesExec: target_batch_size=8192
Expand All @@ -577,7 +577,7 @@ mod tests {
│ PartitionIsolatorExec: t0:[p0,p1,__] t1:[__,__,p0]
│ DataSourceExec: file_groups={3 groups: [[/testdata/weather/result-000000.parquet], [/testdata/weather/result-000001.parquet], [/testdata/weather/result-000002.parquet]]}, projection=[MinTemp, RainToday, RainTomorrow], file_type=parquet, predicate=RainToday@1 = yes, pruning_predicate=RainToday_null_count@2 != row_count@3 AND RainToday_min@0 <= yes AND yes <= RainToday_max@1, required_guarantees=[RainToday in (yes)]
└──────────────────────────────────────────────────
┌───── Stage 3 ── Tasks: t0:[p0,p1,p2,p3] t1:[p0,p1,p2,p3]
┌───── Stage 3 ── Tasks: t0:[p0..p3] t1:[p0..p3]
│ RepartitionExec: partitioning=Hash([RainTomorrow@0], 4), input_partitions=4
│ AggregateExec: mode=Partial, gby=[RainTomorrow@1 as RainTomorrow], aggr=[avg(weather.MaxTemp)]
│ CoalesceBatchesExec: target_batch_size=8192
Expand All @@ -598,7 +598,7 @@ mod tests {
│ SortPreservingMergeExec: [MinTemp@0 DESC]
│ [Stage 1] => NetworkCoalesceExec: output_partitions=4, input_tasks=2
└──────────────────────────────────────────────────
┌───── Stage 1 ── Tasks: t0:[p0,p1] t1:[p2,p3]
┌───── Stage 1 ── Tasks: t0:[p0..p1] t1:[p2..p3]
│ SortExec: expr=[MinTemp@0 DESC], preserve_partitioning=[true]
│ PartitionIsolatorExec: t0:[p0,p1,__] t1:[__,__,p0]
│ DataSourceExec: file_groups={3 groups: [[/testdata/weather/result-000000.parquet], [/testdata/weather/result-000001.parquet], [/testdata/weather/result-000002.parquet]]}, projection=[MinTemp, MaxTemp, Rainfall, Evaporation, Sunshine, WindGustDir, WindGustSpeed, WindDir9am, WindDir3pm, WindSpeed9am, WindSpeed3pm, Humidity9am, Humidity3pm, Pressure9am, Pressure3pm, Cloud9am, Cloud3pm, Temp9am, Temp3pm, RainToday, RISK_MM, RainTomorrow], file_type=parquet
Expand All @@ -615,12 +615,12 @@ mod tests {
│ CoalescePartitionsExec
│ [Stage 2] => NetworkCoalesceExec: output_partitions=8, input_tasks=2
└──────────────────────────────────────────────────
┌───── Stage 2 ── Tasks: t0:[p0,p1,p2,p3] t1:[p0,p1,p2,p3]
┌───── Stage 2 ── Tasks: t0:[p0..p3] t1:[p0..p3]
│ AggregateExec: mode=FinalPartitioned, gby=[RainToday@0 as RainToday, WindGustDir@1 as WindGustDir], aggr=[]
│ CoalesceBatchesExec: target_batch_size=8192
│ [Stage 1] => NetworkShuffleExec: output_partitions=4, input_tasks=2
└──────────────────────────────────────────────────
┌───── Stage 1 ── Tasks: t0:[p0,p1,p2,p3,p4,p5,p6,p7] t1:[p0,p1,p2,p3,p4,p5,p6,p7]
┌───── Stage 1 ── Tasks: t0:[p0..p7] t1:[p0..p7]
│ RepartitionExec: partitioning=Hash([RainToday@0, WindGustDir@1], 8), input_partitions=4
│ RepartitionExec: partitioning=RoundRobinBatch(4), input_partitions=2
│ AggregateExec: mode=Partial, gby=[RainToday@0 as RainToday, WindGustDir@1 as WindGustDir], aggr=[]
Expand Down
11 changes: 7 additions & 4 deletions src/stage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use datafusion::error::Result;
use datafusion::execution::TaskContext;
use datafusion::physical_plan::display::DisplayableExecutionPlan;
use datafusion::physical_plan::{ExecutionPlan, ExecutionPlanProperties, displayable};
use itertools::{Either, Itertools};
use itertools::Either;
use std::collections::VecDeque;
use std::sync::Arc;
use url::Url;
Expand Down Expand Up @@ -334,9 +334,12 @@ fn format_tasks_for_stage(n_tasks: usize, head: &Arc<dyn ExecutionPlan>) -> Stri
let mut off = 0;
for i in 0..n_tasks {
result += &format!("t{i}:[");
result += &(off..(off + input_partitions))
.map(|v| format!("p{v}"))
.join(",");
let end = off + input_partitions - 1;
if input_partitions == 1 {
result += &format!("p{off}");
} else {
result += &format!("p{off}..p{end}");
}
result += "] ";
off += if hash_shuffle { 0 } else { input_partitions }
}
Expand Down
4 changes: 2 additions & 2 deletions tests/custom_extension_codec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,12 @@ mod tests {
│ RepartitionExec: partitioning=RoundRobinBatch(1), input_partitions=10
│ [Stage 2] => NetworkShuffleExec: output_partitions=10, input_tasks=10
└──────────────────────────────────────────────────
┌───── Stage 2 ── Tasks: t0:[p0,p1,p2,p3,p4,p5,p6,p7,p8,p9] t1:[p0,p1,p2,p3,p4,p5,p6,p7,p8,p9] t2:[p0,p1,p2,p3,p4,p5,p6,p7,p8,p9] t3:[p0,p1,p2,p3,p4,p5,p6,p7,p8,p9] t4:[p0,p1,p2,p3,p4,p5,p6,p7,p8,p9] t5:[p0,p1,p2,p3,p4,p5,p6,p7,p8,p9] t6:[p0,p1,p2,p3,p4,p5,p6,p7,p8,p9] t7:[p0,p1,p2,p3,p4,p5,p6,p7,p8,p9] t8:[p0,p1,p2,p3,p4,p5,p6,p7,p8,p9] t9:[p0,p1,p2,p3,p4,p5,p6,p7,p8,p9]
┌───── Stage 2 ── Tasks: t0:[p0..p9] t1:[p0..p9] t2:[p0..p9] t3:[p0..p9] t4:[p0..p9] t5:[p0..p9] t6:[p0..p9] t7:[p0..p9] t8:[p0..p9] t9:[p0..p9]
│ RepartitionExec: partitioning=Hash([], 10), input_partitions=1
│ SortExec: expr=[numbers@0 DESC NULLS LAST], preserve_partitioning=[false]
│ [Stage 1] => NetworkShuffleExec: output_partitions=1, input_tasks=1
└──────────────────────────────────────────────────
┌───── Stage 1 ── Tasks: t0:[p0,p1,p2,p3,p4,p5,p6,p7,p8,p9]
┌───── Stage 1 ── Tasks: t0:[p0..p9]
│ RepartitionExec: partitioning=Hash([numbers@0], 10), input_partitions=1
│ FilterExec: numbers@0 > 1
│ Int64ListExec: length=6
Expand Down
6 changes: 3 additions & 3 deletions tests/distributed_aggregation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ mod tests {
│ CoalesceBatchesExec: target_batch_size=8192
│ [Stage 1] => NetworkShuffleExec: output_partitions=3, input_tasks=2
└──────────────────────────────────────────────────
┌───── Stage 1 ── Tasks: t0:[p0,p1,p2] t1:[p0,p1,p2]
┌───── Stage 1 ── Tasks: t0:[p0..p2] t1:[p0..p2]
│ RepartitionExec: partitioning=Hash([RainToday@0], 3), input_partitions=2
│ AggregateExec: mode=Partial, gby=[RainToday@0 as RainToday], aggr=[count(Int64(1))]
│ PartitionIsolatorExec: t0:[p0,p1,__] t1:[__,__,p0]
Expand Down Expand Up @@ -132,13 +132,13 @@ mod tests {
│ CoalescePartitionsExec
│ [Stage 2] => NetworkCoalesceExec: output_partitions=18, input_tasks=6
└──────────────────────────────────────────────────
┌───── Stage 2 ── Tasks: t0:[p0,p1,p2] t1:[p0,p1,p2] t2:[p0,p1,p2] t3:[p0,p1,p2] t4:[p0,p1,p2] t5:[p0,p1,p2]
┌───── Stage 2 ── Tasks: t0:[p0..p2] t1:[p0..p2] t2:[p0..p2] t3:[p0..p2] t4:[p0..p2] t5:[p0..p2]
│ ProjectionExec: expr=[count(Int64(1))@1 as count(*), RainToday@0 as RainToday]
│ AggregateExec: mode=FinalPartitioned, gby=[RainToday@0 as RainToday], aggr=[count(Int64(1))]
│ CoalesceBatchesExec: target_batch_size=8192
│ [Stage 1] => NetworkShuffleExec: output_partitions=3, input_tasks=3
└──────────────────────────────────────────────────
┌───── Stage 1 ── Tasks: t0:[p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17] t1:[p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17] t2:[p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17]
┌───── Stage 1 ── Tasks: t0:[p0..p17] t1:[p0..p17] t2:[p0..p17]
│ RepartitionExec: partitioning=Hash([RainToday@0], 18), input_partitions=1
│ AggregateExec: mode=Partial, gby=[RainToday@0 as RainToday], aggr=[count(Int64(1))]
│ PartitionIsolatorExec: t0:[p0,__,__] t1:[__,p0,__] t2:[__,__,p0]
Expand Down
4 changes: 2 additions & 2 deletions tests/stateful_execution_plan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,12 @@ mod tests {
│ RepartitionExec: partitioning=RoundRobinBatch(1), input_partitions=10
│ [Stage 2] => NetworkShuffleExec: output_partitions=10, input_tasks=10
└──────────────────────────────────────────────────
┌───── Stage 2 ── Tasks: t0:[p0,p1,p2,p3,p4,p5,p6,p7,p8,p9] t1:[p0,p1,p2,p3,p4,p5,p6,p7,p8,p9] t2:[p0,p1,p2,p3,p4,p5,p6,p7,p8,p9] t3:[p0,p1,p2,p3,p4,p5,p6,p7,p8,p9] t4:[p0,p1,p2,p3,p4,p5,p6,p7,p8,p9] t5:[p0,p1,p2,p3,p4,p5,p6,p7,p8,p9] t6:[p0,p1,p2,p3,p4,p5,p6,p7,p8,p9] t7:[p0,p1,p2,p3,p4,p5,p6,p7,p8,p9] t8:[p0,p1,p2,p3,p4,p5,p6,p7,p8,p9] t9:[p0,p1,p2,p3,p4,p5,p6,p7,p8,p9]
┌───── Stage 2 ── Tasks: t0:[p0..p9] t1:[p0..p9] t2:[p0..p9] t3:[p0..p9] t4:[p0..p9] t5:[p0..p9] t6:[p0..p9] t7:[p0..p9] t8:[p0..p9] t9:[p0..p9]
│ RepartitionExec: partitioning=Hash([], 10), input_partitions=1
│ SortExec: expr=[numbers@0 DESC NULLS LAST], preserve_partitioning=[false]
│ [Stage 1] => NetworkShuffleExec: output_partitions=1, input_tasks=1
└──────────────────────────────────────────────────
┌───── Stage 1 ── Tasks: t0:[p0,p1,p2,p3,p4,p5,p6,p7,p8,p9]
┌───── Stage 1 ── Tasks: t0:[p0..p9]
│ RepartitionExec: partitioning=Hash([numbers@0], 10), input_partitions=1
│ FilterExec: numbers@0 > 1
│ StatefulInt64ListExec: length=6
Expand Down
Loading