Skip to content

Commit ec4a720

Browse files
authored
Make DisplayAs consistent and more readable ... (#1347)
... for Shuffle[Reader|Writer|Unresolved].
1 parent f3c868f commit ec4a720

File tree

4 files changed

+53
-43
lines changed

4 files changed

+53
-43
lines changed

ballista/client/tests/context_checks.rs

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -998,43 +998,43 @@ mod supported {
998998
.unwrap();
999999

10001000
let expected: Vec<&str> = vec![
1001-
"+------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+",
1002-
"| plan_type | plan |",
1003-
"+------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+",
1004-
"| logical_plan | Projection: count(Int64(1)) AS count(*), id |",
1005-
"| | Aggregate: groupBy=[[id]], aggr=[[count(Int64(1))]] |",
1006-
"| | Projection: __unnest_placeholder(make_array(Int64(1),Int64(2),Int64(3),Int64(4),Int64(5)),depth=1) AS UNNEST(make_array(Int64(1),Int64(2),Int64(3),Int64(4),Int64(5))) AS id |",
1007-
"| | Unnest: lists[__unnest_placeholder(make_array(Int64(1),Int64(2),Int64(3),Int64(4),Int64(5)))|depth=1] structs[] |",
1008-
"| | Projection: List([1, 2, 3, 4, 5]) AS __unnest_placeholder(make_array(Int64(1),Int64(2),Int64(3),Int64(4),Int64(5))) |",
1009-
"| | EmptyRelation: rows=1 |",
1010-
"| physical_plan | ProjectionExec: expr=[count(Int64(1))@1 as count(*), id@0 as id] |",
1011-
"| | AggregateExec: mode=FinalPartitioned, gby=[id@0 as id], aggr=[count(Int64(1))] |",
1012-
"| | CoalesceBatchesExec: target_batch_size=8192 |",
1013-
"| | RepartitionExec: partitioning=Hash([id@0], 16), input_partitions=1 |",
1014-
"| | AggregateExec: mode=Partial, gby=[id@0 as id], aggr=[count(Int64(1))] |",
1015-
"| | ProjectionExec: expr=[__unnest_placeholder(make_array(Int64(1),Int64(2),Int64(3),Int64(4),Int64(5)),depth=1)@0 as id] |",
1016-
"| | UnnestExec |",
1017-
"| | ProjectionExec: expr=[[1, 2, 3, 4, 5] as __unnest_placeholder(make_array(Int64(1),Int64(2),Int64(3),Int64(4),Int64(5)))] |",
1018-
"| | PlaceholderRowExec |",
1019-
"| | |",
1020-
"| distributed_plan | =========ResolvedStage[stage_id=1.0, partitions=1]========= |",
1021-
"| | ShuffleWriterExec: partitioning:Some(Hash([Column { name: \"id\", index: 0 }], 16)) |",
1022-
"| | AggregateExec: mode=Partial, gby=[id@0 as id], aggr=[count(Int64(1))] |",
1023-
"| | ProjectionExec: expr=[__unnest_placeholder(make_array(Int64(1),Int64(2),Int64(3),Int64(4),Int64(5)),depth=1)@0 as id] |",
1024-
"| | UnnestExec |",
1025-
"| | ProjectionExec: expr=[[1, 2, 3, 4, 5] as __unnest_placeholder(make_array(Int64(1),Int64(2),Int64(3),Int64(4),Int64(5)))] |",
1026-
"| | PlaceholderRowExec |",
1027-
"| | |",
1028-
"| | =========UnResolvedStage[stage_id=2.0, children=1]========= |",
1029-
"| | Inputs{1: StageOutput { partition_locations: {}, complete: false }} |",
1030-
"| | ShuffleWriterExec: partitioning:None |",
1031-
"| | ProjectionExec: expr=[count(Int64(1))@1 as count(*), id@0 as id] |",
1032-
"| | AggregateExec: mode=FinalPartitioned, gby=[id@0 as id], aggr=[count(Int64(1))] |",
1033-
"| | CoalesceBatchesExec: target_batch_size=8192 |",
1034-
"| | UnresolvedShuffleExec: partitioning=Hash([Column { name: \"id\", index: 0 }], 16) |",
1035-
"| | |",
1036-
"| | |",
1037-
"+------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+",
1001+
"+------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+",
1002+
"| plan_type | plan |",
1003+
"+------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+",
1004+
"| logical_plan | Projection: count(Int64(1)) AS count(*), id |",
1005+
"| | Aggregate: groupBy=[[id]], aggr=[[count(Int64(1))]] |",
1006+
"| | Projection: __unnest_placeholder(make_array(Int64(1),Int64(2),Int64(3),Int64(4),Int64(5)),depth=1) AS UNNEST(make_array(Int64(1),Int64(2),Int64(3),Int64(4),Int64(5))) AS id |",
1007+
"| | Unnest: lists[__unnest_placeholder(make_array(Int64(1),Int64(2),Int64(3),Int64(4),Int64(5)))|depth=1] structs[] |",
1008+
"| | Projection: List([1, 2, 3, 4, 5]) AS __unnest_placeholder(make_array(Int64(1),Int64(2),Int64(3),Int64(4),Int64(5))) |",
1009+
"| | EmptyRelation: rows=1 |",
1010+
"| physical_plan | ProjectionExec: expr=[count(Int64(1))@1 as count(*), id@0 as id] |",
1011+
"| | AggregateExec: mode=FinalPartitioned, gby=[id@0 as id], aggr=[count(Int64(1))] |",
1012+
"| | CoalesceBatchesExec: target_batch_size=8192 |",
1013+
"| | RepartitionExec: partitioning=Hash([id@0], 16), input_partitions=1 |",
1014+
"| | AggregateExec: mode=Partial, gby=[id@0 as id], aggr=[count(Int64(1))] |",
1015+
"| | ProjectionExec: expr=[__unnest_placeholder(make_array(Int64(1),Int64(2),Int64(3),Int64(4),Int64(5)),depth=1)@0 as id] |",
1016+
"| | UnnestExec |",
1017+
"| | ProjectionExec: expr=[[1, 2, 3, 4, 5] as __unnest_placeholder(make_array(Int64(1),Int64(2),Int64(3),Int64(4),Int64(5)))] |",
1018+
"| | PlaceholderRowExec |",
1019+
"| | |",
1020+
"| distributed_plan | =========ResolvedStage[stage_id=1.0, partitions=1]========= |",
1021+
"| | ShuffleWriterExec: partitioning: Hash([id@0], 16) |",
1022+
"| | AggregateExec: mode=Partial, gby=[id@0 as id], aggr=[count(Int64(1))] |",
1023+
"| | ProjectionExec: expr=[__unnest_placeholder(make_array(Int64(1),Int64(2),Int64(3),Int64(4),Int64(5)),depth=1)@0 as id] |",
1024+
"| | UnnestExec |",
1025+
"| | ProjectionExec: expr=[[1, 2, 3, 4, 5] as __unnest_placeholder(make_array(Int64(1),Int64(2),Int64(3),Int64(4),Int64(5)))] |",
1026+
"| | PlaceholderRowExec |",
1027+
"| | |",
1028+
"| | =========UnResolvedStage[stage_id=2.0, children=1]========= |",
1029+
"| | Inputs{1: StageOutput { partition_locations: {}, complete: false }} |",
1030+
"| | ShuffleWriterExec: partitioning: None |",
1031+
"| | ProjectionExec: expr=[count(Int64(1))@1 as count(*), id@0 as id] |",
1032+
"| | AggregateExec: mode=FinalPartitioned, gby=[id@0 as id], aggr=[count(Int64(1))] |",
1033+
"| | CoalesceBatchesExec: target_batch_size=8192 |",
1034+
"| | UnresolvedShuffleExec: partitioning: Hash([id@0], 16) |",
1035+
"| | |",
1036+
"| | |",
1037+
"+------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+",
10381038
];
10391039
assert_batches_eq!(expected, &result);
10401040
}

ballista/core/src/execution_plans/shuffle_reader.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,12 @@ impl DisplayAs for ShuffleReaderExec {
103103
DisplayFormatType::Default | DisplayFormatType::Verbose => {
104104
write!(
105105
f,
106-
"ShuffleReaderExec: partitioning={:?}",
106+
"ShuffleReaderExec: partitioning: {}",
107107
self.properties.partitioning,
108108
)
109109
}
110110
DisplayFormatType::TreeRender => {
111-
write!(f, "partitioning={:?}", self.properties.partitioning)
111+
write!(f, "partitioning={}", self.properties.partitioning)
112112
}
113113
}
114114
}

ballista/core/src/execution_plans/shuffle_writer.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -359,12 +359,22 @@ impl DisplayAs for ShuffleWriterExec {
359359
DisplayFormatType::Default | DisplayFormatType::Verbose => {
360360
write!(
361361
f,
362-
"ShuffleWriterExec: partitioning:{:?}",
362+
"ShuffleWriterExec: partitioning: {}",
363363
self.shuffle_output_partitioning
364+
.as_ref()
365+
.map(|p| p.to_string())
366+
.unwrap_or("None".to_string())
364367
)
365368
}
366369
DisplayFormatType::TreeRender => {
367-
write!(f, "partitioning={:?}", self.shuffle_output_partitioning)
370+
write!(
371+
f,
372+
"partitioning={}",
373+
self.shuffle_output_partitioning
374+
.as_ref()
375+
.map(|p| p.to_string())
376+
.unwrap_or("None".to_string())
377+
)
368378
}
369379
}
370380
}

ballista/core/src/execution_plans/unresolved_shuffle.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,14 @@ impl DisplayAs for UnresolvedShuffleExec {
7272
DisplayFormatType::Default | DisplayFormatType::Verbose => {
7373
write!(
7474
f,
75-
"UnresolvedShuffleExec: partitioning={:?}",
75+
"UnresolvedShuffleExec: partitioning: {}",
7676
self.properties().output_partitioning()
7777
)
7878
}
7979
DisplayFormatType::TreeRender => {
8080
write!(
8181
f,
82-
"partitioning={:?}",
82+
"partitioning={}",
8383
self.properties().output_partitioning()
8484
)
8585
}

0 commit comments

Comments
 (0)