Commit 4ef18bd
committed
Fix: Show aliased aggregate expressions in physical EXPLAIN output (#19685)
When an aggregate expression has been aliased, the logical plan EXPLAIN
shows both the alias and the original expression. However, the physical
plan EXPLAIN only showed the alias, making plans hard to interpret.
This fix updates the physical EXPLAIN output to show both the underlying
aggregate expression and its alias in the format:
AggregateExec: mode=Single, gby=[], aggr=[sum(column1@0) as my_alias]
instead of:
AggregateExec: mode=Single, gby=[], aggr=[my_alias]
Changes:
- Modified create_aggregate_expr_and_maybe_filter() in physical_planner.rs
to use the unaliased expression for human_display, so it captures the
actual aggregate expression instead of just the alias name.
- Modified DisplayAs impl for AggregateExec to show both expression and
alias when they differ.
- Updated test expectations in explain.slt, aggregate.slt, and
agg_func_substitute.slt to reflect the new output format.1 parent 209a0a2 commit 4ef18bd
File tree
5 files changed
+62
-16
lines changed- datafusion
- core/src
- physical-plan/src/aggregates
- sqllogictest/test_files
5 files changed
+62
-16
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2189 | 2189 | | |
2190 | 2190 | | |
2191 | 2191 | | |
2192 | | - | |
| 2192 | + | |
| 2193 | + | |
| 2194 | + | |
| 2195 | + | |
| 2196 | + | |
2193 | 2197 | | |
2194 | 2198 | | |
2195 | 2199 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1116 | 1116 | | |
1117 | 1117 | | |
1118 | 1118 | | |
1119 | | - | |
| 1119 | + | |
| 1120 | + | |
| 1121 | + | |
| 1122 | + | |
| 1123 | + | |
| 1124 | + | |
| 1125 | + | |
| 1126 | + | |
| 1127 | + | |
| 1128 | + | |
1120 | 1129 | | |
1121 | 1130 | | |
1122 | 1131 | | |
| |||
Lines changed: 6 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | | - | |
| 47 | + | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
| 50 | + | |
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
66 | | - | |
| 66 | + | |
67 | 67 | | |
68 | 68 | | |
69 | | - | |
| 69 | + | |
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
84 | | - | |
| 84 | + | |
85 | 85 | | |
86 | 86 | | |
87 | | - | |
| 87 | + | |
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3647 | 3647 | | |
3648 | 3648 | | |
3649 | 3649 | | |
3650 | | - | |
| 3650 | + | |
3651 | 3651 | | |
3652 | | - | |
| 3652 | + | |
3653 | 3653 | | |
3654 | 3654 | | |
3655 | 3655 | | |
| |||
3660 | 3660 | | |
3661 | 3661 | | |
3662 | 3662 | | |
3663 | | - | |
| 3663 | + | |
3664 | 3664 | | |
3665 | | - | |
| 3665 | + | |
3666 | 3666 | | |
3667 | 3667 | | |
3668 | 3668 | | |
| |||
3673 | 3673 | | |
3674 | 3674 | | |
3675 | 3675 | | |
3676 | | - | |
| 3676 | + | |
3677 | 3677 | | |
3678 | | - | |
| 3678 | + | |
3679 | 3679 | | |
3680 | 3680 | | |
3681 | 3681 | | |
| |||
3686 | 3686 | | |
3687 | 3687 | | |
3688 | 3688 | | |
3689 | | - | |
| 3689 | + | |
3690 | 3690 | | |
3691 | | - | |
| 3691 | + | |
3692 | 3692 | | |
3693 | 3693 | | |
3694 | 3694 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
660 | 660 | | |
661 | 661 | | |
662 | 662 | | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
663 | 696 | | |
664 | 697 | | |
0 commit comments