Skip to content

Commit f2ef576

Browse files
fix: metrics displaying on new line (#328)
Previously, metrics were displaying like this: ``` │ ProjectionExec: expr=[Rainfall@0 as MinTemp, RainToday@1 as RainToday] │, metrics=[output_rows_2=33, elapsed_compute_2=4.13µs, output_bytes_2=576.0 KB, output_batches_2=3, expr_0_eval_time_2=541ns, expr_1_eval_time_2=291ns] │ FilterExec: Rainfall@0 > 5 │, metrics=[output_rows_2=33, elapsed_compute_2=38.79µs, output_bytes_2=576.0 KB, output_batches_2=3, selectivity_2=14% (33/234)o# Please enter the commit message for your changes. Lines starting ``` This change removes the extra new line ``` │ ProjectionExec: expr=[Rainfall@0 as MinTemp, RainToday@1 as RainToday], metrics=[output_rows_2=33, elapsed_compute_2=4.75µs, output_bytes_2=576.0 KB, output_batches_2=3, expr_0_ev al_time_2=542ns, expr_1_eval_time_2=125ns] │ FilterExec: Rainfall@0 > 5, metrics=[output_rows_2=33, elapsed_compute_2=45.25µs, output_bytes_2=576.0 KB, output_batches_2=3, selectivity_2=14% (33/234)] ``` (If you are wondering why we only see metrics for task 2 in this snippet, it's because this stage is the child of a union). Display without metrics looks fine still ``` │ ProjectionExec: expr=[Rainfall@0 as MinTemp, RainToday@1 as RainToday] │ FilterExec: Rainfall@0 > 5 ```
1 parent 1e14d1a commit f2ef576

10 files changed

+988
-983
lines changed

src/distributed_planner/batch_coalescing_below_network_boundaries.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ mod tests {
9090
│ RepartitionExec: partitioning=Hash([RainToday@0, WindGustDir@1], 8), input_partitions=4
9191
│ AggregateExec: mode=Partial, gby=[RainToday@0 as RainToday, WindGustDir@1 as WindGustDir], aggr=[]
9292
│ RepartitionExec: partitioning=RoundRobinBatch(4), input_partitions=1
93-
│ PartitionIsolatorExec: t0:[p0,__,__] t1:[__,p0,__] t2:[__,__,p0]
93+
│ PartitionIsolatorExec: t0:[p0,__,__] t1:[__,p0,__] t2:[__,__,p0]
9494
│ DataSourceExec: file_groups={3 groups: [[/testdata/weather/result-000000.parquet], [/testdata/weather/result-000001.parquet], [/testdata/weather/result-000002.parquet]]}, projection=[RainToday, WindGustDir], file_type=parquet
9595
└──────────────────────────────────────────────────
9696
");
@@ -118,7 +118,7 @@ mod tests {
118118
│ RepartitionExec: partitioning=Hash([RainToday@0, WindGustDir@1], 8), input_partitions=4
119119
│ AggregateExec: mode=Partial, gby=[RainToday@0 as RainToday, WindGustDir@1 as WindGustDir], aggr=[]
120120
│ RepartitionExec: partitioning=RoundRobinBatch(4), input_partitions=1
121-
│ PartitionIsolatorExec: t0:[p0,__,__] t1:[__,p0,__] t2:[__,__,p0]
121+
│ PartitionIsolatorExec: t0:[p0,__,__] t1:[__,p0,__] t2:[__,__,p0]
122122
│ DataSourceExec: file_groups={3 groups: [[/testdata/weather/result-000000.parquet], [/testdata/weather/result-000001.parquet], [/testdata/weather/result-000002.parquet]]}, projection=[RainToday, WindGustDir], file_type=parquet
123123
└──────────────────────────────────────────────────
124124
");
@@ -148,7 +148,7 @@ mod tests {
148148
│ RepartitionExec: partitioning=Hash([RainToday@0, WindGustDir@1], 8), input_partitions=4
149149
│ AggregateExec: mode=Partial, gby=[RainToday@0 as RainToday, WindGustDir@1 as WindGustDir], aggr=[]
150150
│ RepartitionExec: partitioning=RoundRobinBatch(4), input_partitions=1
151-
│ PartitionIsolatorExec: t0:[p0,__,__] t1:[__,p0,__] t2:[__,__,p0]
151+
│ PartitionIsolatorExec: t0:[p0,__,__] t1:[__,p0,__] t2:[__,__,p0]
152152
│ DataSourceExec: file_groups={3 groups: [[/testdata/weather/result-000000.parquet], [/testdata/weather/result-000001.parquet], [/testdata/weather/result-000002.parquet]]}, projection=[RainToday, WindGustDir], file_type=parquet
153153
└──────────────────────────────────────────────────
154154
");

src/distributed_planner/distributed_physical_optimizer_rule.rs

Lines changed: 19 additions & 19 deletions
Large diffs are not rendered by default.

src/stage.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,12 @@ fn display_inner_ascii(
307307
};
308308

309309
let node_str = displayable(plan.as_ref()).one_line().to_string();
310-
writeln!(f, "{} {node_str}{metrics_str}", " ".repeat(indent))?;
310+
writeln!(
311+
f,
312+
"{} {}{metrics_str}",
313+
" ".repeat(indent),
314+
node_str.trim_end() // remove trailing newline
315+
)?;
311316

312317
if plan.is_network_boundary() {
313318
return Ok(());

tests/clickbench_plans_test.rs

Lines changed: 42 additions & 42 deletions
Large diffs are not rendered by default.

tests/distributed_aggregation.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ mod tests {
6363
┌───── Stage 1 ── Tasks: t0:[p0..p5] t1:[p0..p5] t2:[p0..p5]
6464
│ RepartitionExec: partitioning=Hash([RainToday@0], 6), input_partitions=1
6565
│ AggregateExec: mode=Partial, gby=[RainToday@0 as RainToday], aggr=[count(Int64(1))]
66-
│ PartitionIsolatorExec: t0:[p0,__,__] t1:[__,p0,__] t2:[__,__,p0]
66+
│ PartitionIsolatorExec: t0:[p0,__,__] t1:[__,p0,__] t2:[__,__,p0]
6767
│ DataSourceExec: file_groups={3 groups: [[/testdata/weather/result-000000.parquet], [/testdata/weather/result-000001.parquet], [/testdata/weather/result-000002.parquet]]}, projection=[RainToday], file_type=parquet
6868
└──────────────────────────────────────────────────
6969
",
@@ -143,7 +143,7 @@ mod tests {
143143
┌───── Stage 1 ── Tasks: t0:[p0..p5] t1:[p0..p5] t2:[p0..p5]
144144
│ RepartitionExec: partitioning=Hash([RainToday@0], 6), input_partitions=1
145145
│ AggregateExec: mode=Partial, gby=[RainToday@0 as RainToday], aggr=[count(Int64(1))]
146-
│ PartitionIsolatorExec: t0:[p0,__,__] t1:[__,p0,__] t2:[__,__,p0]
146+
│ PartitionIsolatorExec: t0:[p0,__,__] t1:[__,p0,__] t2:[__,__,p0]
147147
│ DataSourceExec: file_groups={3 groups: [[/testdata/weather/result-000000.parquet], [/testdata/weather/result-000001.parquet], [/testdata/weather/result-000002.parquet]]}, projection=[RainToday], file_type=parquet
148148
└──────────────────────────────────────────────────
149149
",

tests/distributed_unions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ mod tests {
5050
│ SortExec: expr=[MinTemp@0 ASC NULLS LAST, RainToday@1 ASC NULLS LAST], preserve_partitioning=[true]
5151
│ ProjectionExec: expr=[MaxTemp@0 as MinTemp, RainToday@1 as RainToday]
5252
│ FilterExec: MaxTemp@0 < 30
53-
│ PartitionIsolatorExec: t0:[p0,p1,__] t1:[__,__,p0]
53+
│ PartitionIsolatorExec: t0:[p0,p1,__] t1:[__,__,p0]
5454
│ DataSourceExec: file_groups={3 groups: [[/testdata/weather/result-000000.parquet], [/testdata/weather/result-000001.parquet], [/testdata/weather/result-000002.parquet]]}, projection=[MaxTemp, RainToday], file_type=parquet, predicate=MaxTemp@1 < 30, pruning_predicate=MaxTemp_null_count@1 != row_count@2 AND MaxTemp_min@0 < 30, required_guarantees=[]
5555
└──────────────────────────────────────────────────
5656
",

tests/join.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ mod tests {
107107
// Ensure the distributed plan matches our target plan, registering
108108
// hive-style partitioning and avoiding data-shuffling repartitions.
109109
assert_snapshot!(&distributed_plan,
110-
@"
110+
@r"
111111
┌───── DistributedExec ── Tasks: t0:[p0]
112112
│ SortPreservingMergeExec: [f_dkey@0 ASC NULLS LAST, timestamp@1 ASC NULLS LAST]
113113
│ [Stage 1] => NetworkCoalesceExec: output_partitions=4, input_tasks=2
@@ -116,9 +116,9 @@ mod tests {
116116
│ ProjectionExec: expr=[f_dkey@5 as f_dkey, timestamp@3 as timestamp, value@4 as value, env@0 as env, service@1 as service, host@2 as host]
117117
│ HashJoinExec: mode=Partitioned, join_type=Inner, on=[(d_dkey@3, f_dkey@2)], projection=[env@0, service@1, host@2, timestamp@4, value@5, f_dkey@6]
118118
│ FilterExec: service@1 = log
119-
│ PartitionIsolatorExec: t0:[p0,p1,__,__] t1:[__,__,p0,p1]
119+
│ PartitionIsolatorExec: t0:[p0,p1,__,__] t1:[__,__,p0,p1]
120120
│ DataSourceExec: file_groups={4 groups: [[/testdata/join/parquet/dim/d_dkey=A/data0.parquet], [/testdata/join/parquet/dim/d_dkey=B/data0.parquet], [/testdata/join/parquet/dim/d_dkey=C/data0.parquet], [/testdata/join/parquet/dim/d_dkey=D/data0.parquet]]}, projection=[env, service, host, d_dkey], file_type=parquet, predicate=service@1 = log, pruning_predicate=service_null_count@2 != row_count@3 AND service_min@0 <= log AND log <= service_max@1, required_guarantees=[service in (log)]
121-
│ PartitionIsolatorExec: t0:[p0,p1,__,__] t1:[__,__,p0,p1]
121+
│ PartitionIsolatorExec: t0:[p0,p1,__,__] t1:[__,__,p0,p1]
122122
│ DataSourceExec: file_groups={4 groups: [[/testdata/join/parquet/fact/f_dkey=A/data0.parquet], [/testdata/join/parquet/fact/f_dkey=B/data0.parquet], [/testdata/join/parquet/fact/f_dkey=C/data0.parquet], [/testdata/join/parquet/fact/f_dkey=D/data0.parquet]]}, projection=[timestamp, value, f_dkey], output_ordering=[f_dkey@2 ASC NULLS LAST, timestamp@0 ASC NULLS LAST], file_type=parquet, predicate=DynamicFilter [ empty ]
123123
└──────────────────────────────────────────────────
124124
");
@@ -196,9 +196,9 @@ mod tests {
196196
│ ProjectionExec: expr=[f_dkey@3 as f_dkey, env@0 as env, timestamp@1 as timestamp, value@2 as value]
197197
│ HashJoinExec: mode=Partitioned, join_type=Inner, on=[(d_dkey@1, f_dkey@2)], projection=[env@0, timestamp@2, value@3, f_dkey@4]
198198
│ FilterExec: service@1 = log, projection=[env@0, d_dkey@2]
199-
│ PartitionIsolatorExec: t0:[p0,p1,__,__] t1:[__,__,p0,p1]
199+
│ PartitionIsolatorExec: t0:[p0,p1,__,__] t1:[__,__,p0,p1]
200200
│ DataSourceExec: file_groups={4 groups: [[/testdata/join/parquet/dim/d_dkey=A/data0.parquet], [/testdata/join/parquet/dim/d_dkey=B/data0.parquet], [/testdata/join/parquet/dim/d_dkey=C/data0.parquet], [/testdata/join/parquet/dim/d_dkey=D/data0.parquet]]}, projection=[env, service, d_dkey], file_type=parquet, predicate=service@1 = log, pruning_predicate=service_null_count@2 != row_count@3 AND service_min@0 <= log AND log <= service_max@1, required_guarantees=[service in (log)]
201-
│ PartitionIsolatorExec: t0:[p0,p1,__,__] t1:[__,__,p0,p1]
201+
│ PartitionIsolatorExec: t0:[p0,p1,__,__] t1:[__,__,p0,p1]
202202
│ DataSourceExec: file_groups={4 groups: [[/testdata/join/parquet/fact/f_dkey=A/data0.parquet], [/testdata/join/parquet/fact/f_dkey=B/data0.parquet], [/testdata/join/parquet/fact/f_dkey=C/data0.parquet], [/testdata/join/parquet/fact/f_dkey=D/data0.parquet]]}, projection=[timestamp, value, f_dkey], output_ordering=[f_dkey@2 ASC NULLS LAST, timestamp@0 ASC NULLS LAST], file_type=parquet, predicate=DynamicFilter [ empty ]
203203
└──────────────────────────────────────────────────
204204
"#);
@@ -277,9 +277,9 @@ mod tests {
277277
│ ProjectionExec: expr=[f_dkey@3 as f_dkey, env@0 as env, timestamp@1 as timestamp, value@2 as value]
278278
│ HashJoinExec: mode=Partitioned, join_type=Inner, on=[(d_dkey@1, f_dkey@2)], projection=[env@0, timestamp@2, value@3, f_dkey@4]
279279
│ FilterExec: service@1 = log, projection=[env@0, d_dkey@2]
280-
│ PartitionIsolatorExec: t0:[p0,p1,__,__] t1:[__,__,p0,p1]
280+
│ PartitionIsolatorExec: t0:[p0,p1,__,__] t1:[__,__,p0,p1]
281281
│ DataSourceExec: file_groups={4 groups: [[/testdata/join/parquet/dim/d_dkey=A/data0.parquet], [/testdata/join/parquet/dim/d_dkey=B/data0.parquet], [/testdata/join/parquet/dim/d_dkey=C/data0.parquet], [/testdata/join/parquet/dim/d_dkey=D/data0.parquet]]}, projection=[env, service, d_dkey], file_type=parquet, predicate=service@1 = log, pruning_predicate=service_null_count@2 != row_count@3 AND service_min@0 <= log AND log <= service_max@1, required_guarantees=[service in (log)]
282-
│ PartitionIsolatorExec: t0:[p0,p1,__,__] t1:[__,__,p0,p1]
282+
│ PartitionIsolatorExec: t0:[p0,p1,__,__] t1:[__,__,p0,p1]
283283
│ DataSourceExec: file_groups={4 groups: [[/testdata/join/parquet/fact/f_dkey=A/data0.parquet], [/testdata/join/parquet/fact/f_dkey=B/data0.parquet], [/testdata/join/parquet/fact/f_dkey=C/data0.parquet], [/testdata/join/parquet/fact/f_dkey=D/data0.parquet]]}, projection=[timestamp, value, f_dkey], output_ordering=[f_dkey@2 ASC NULLS LAST, timestamp@0 ASC NULLS LAST], file_type=parquet, predicate=DynamicFilter [ empty ]
284284
└──────────────────────────────────────────────────
285285
"#);

tests/stateful_execution_plan.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ mod tests {
7171
┌───── Stage 1 ── Tasks: t0:[p0] t1:[p1] t2:[p2]
7272
│ SortExec: expr=[MinTemp@0 DESC], preserve_partitioning=[true]
7373
│ FilterExec: MinTemp@0 > 20
74-
│ PartitionIsolatorExec: t0:[p0,__,__] t1:[__,p0,__] t2:[__,__,p0]
74+
│ PartitionIsolatorExec: t0:[p0,__,__] t1:[__,p0,__] t2:[__,__,p0]
7575
│ StatefulPassThroughExec
7676
│ DataSourceExec: file_groups={3 groups: [[/testdata/weather/result-000000.parquet], [/testdata/weather/result-000001.parquet], [/testdata/weather/result-000002.parquet]]}, projection=[MinTemp, RainToday], file_type=parquet, predicate=MinTemp@0 > 20, pruning_predicate=MinTemp_null_count@1 != row_count@2 AND MinTemp_max@0 > 20, required_guarantees=[]
7777
└──────────────────────────────────────────────────

0 commit comments

Comments
 (0)