Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-42831

Show result expressions in AggregateExec

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: In Progress
    • Minor
    • Resolution: Unresolved
    • 3.4.0
    • None
    • SQL
    • None

    Description

      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.

      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]
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            wankun Wan Kun
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: