Skip to content

Commit d810201

Browse files
committed
fix empty group_by display
1 parent d07d095 commit d810201

File tree

2 files changed

+21
-13
lines changed

2 files changed

+21
-13
lines changed

datafusion/physical-plan/src/aggregates/mod.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -836,7 +836,9 @@ impl DisplayAs for AggregateExec {
836836
.map(|agg| agg.name().to_string())
837837
.collect();
838838
writeln!(f, "mode={:?}", self.mode)?;
839-
writeln!(f, "group_by={}", g.join(", "))?;
839+
if !g.is_empty() {
840+
writeln!(f, "group_by={}", g.join(", "))?;
841+
}
840842
writeln!(f, "aggr={}", a.join(", "))?;
841843
}
842844
}

datafusion/sqllogictest/test_files/explain_tree.slt

+18-12
Original file line numberDiff line numberDiff line change
@@ -1093,22 +1093,28 @@ physical_plan
10931093
11)└───────────────────────────┘└─────────────┬─────────────┘
10941094
12)-----------------------------┌─────────────┴─────────────┐
10951095
13)-----------------------------│ AggregateExec │
1096-
14)-----------------------------└─────────────┬─────────────┘
1097-
15)-----------------------------┌─────────────┴─────────────┐
1098-
16)-----------------------------│ CoalescePartitionsExec
1096+
14)-----------------------------│ -------------------- │
1097+
15)-----------------------------│ aggr: count(Int64(1)) │
1098+
16)-----------------------------│ mode: Final
10991099
17)-----------------------------└─────────────┬─────────────┘
11001100
18)-----------------------------┌─────────────┴─────────────┐
1101-
19)-----------------------------│ AggregateExec
1101+
19)-----------------------------│ CoalescePartitionsExec
11021102
20)-----------------------------└─────────────┬─────────────┘
11031103
21)-----------------------------┌─────────────┴─────────────┐
1104-
22)-----------------------------│ RepartitionExec │
1105-
23)-----------------------------└─────────────┬─────────────┘
1106-
24)-----------------------------┌─────────────┴─────────────┐
1107-
25)-----------------------------│ DataSourceExec │
1108-
26)-----------------------------│ -------------------- │
1109-
27)-----------------------------│ files: 1 │
1110-
28)-----------------------------│ format: parquet │
1111-
29)-----------------------------└───────────────────────────┘
1104+
22)-----------------------------│ AggregateExec │
1105+
23)-----------------------------│ -------------------- │
1106+
24)-----------------------------│ aggr: count(Int64(1)) │
1107+
25)-----------------------------│ mode: Partial │
1108+
26)-----------------------------└─────────────┬─────────────┘
1109+
27)-----------------------------┌─────────────┴─────────────┐
1110+
28)-----------------------------│ RepartitionExec │
1111+
29)-----------------------------└─────────────┬─────────────┘
1112+
30)-----------------------------┌─────────────┴─────────────┐
1113+
31)-----------------------------│ DataSourceExec │
1114+
32)-----------------------------│ -------------------- │
1115+
33)-----------------------------│ files: 1 │
1116+
34)-----------------------------│ format: parquet │
1117+
35)-----------------------------└───────────────────────────┘
11121118

11131119
# Query with cross join.
11141120
query TT

0 commit comments

Comments
 (0)