Skip to content

Comments

[SPARK-42831][SQL] Show result expressions in AggregateExec#40461

Closed
wankunde wants to merge 4 commits intoapache:masterfrom
wankunde:show_results_in_agg
Closed

[SPARK-42831][SQL] Show result expressions in AggregateExec#40461
wankunde wants to merge 4 commits intoapache:masterfrom
wankunde:show_results_in_agg

Conversation

@wankunde
Copy link
Contributor

What changes were proposed in this pull request?

If the result expressions in AggregateExec are not empty, we should display them. Or we will get confused because some important expressions do not show up in the DAG.

Why are the changes needed?

For example, the plan for query SELECT sum(p) from values(cast(23.4 as decimal(7,2))) t(p) was incorrect because the result expression MakeDecimal(sum(UnscaledValue(p#0))#1L,17,2) AS sum(p)#2 is not displayed

Before

== Physical Plan ==
AdaptiveSparkPlan isFinalPlan=false
+- HashAggregate(keys=[], functions=[sum(UnscaledValue(p#0))], output=[sum(p)#2])
   +- Exchange SinglePartition, ENSURE_REQUIREMENTS, [plan_id=11]
      +- HashAggregate(keys=[], functions=[partial_sum(UnscaledValue(p#0))], output=[sum#5L])
         +- LocalTableScan [p#0]

After

== Physical Plan ==     
AdaptiveSparkPlan isFinalPlan=false
+- HashAggregate(keys=[], functions=[sum(UnscaledValue(p#0))], results=[MakeDecimal(sum(UnscaledValue(p#0))#1L,17,2) AS sum(p)#2], output=[sum(p)#2])
   +- Exchange SinglePartition, ENSURE_REQUIREMENTS, [plan_id=38]
      +- HashAggregate(keys=[], functions=[partial_sum(UnscaledValue(p#0))], results=[sum#13L], output=[sum#13L])
         +- LocalTableScan [p#0]

Does this PR introduce any user-facing change?

No

How was this patch tested?

Local test

@github-actions github-actions bot added the SQL label Mar 17, 2023
@wankunde wankunde force-pushed the show_results_in_agg branch from a369610 to 2aa67ff Compare March 18, 2023 15:26
@wankunde wankunde force-pushed the show_results_in_agg branch from 2aa67ff to 1ece614 Compare March 19, 2023 04:35
@github-actions
Copy link

We're closing this PR because it hasn't been updated in a while. This isn't a judgement on the merit of the PR in any way. It's just a way of keeping the PR queue manageable.
If you'd like to revive this PR, please reopen it and ask a committer to remove the Stale tag!

@github-actions github-actions bot added the Stale label Jul 17, 2023
@github-actions github-actions bot closed this Jul 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant