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

Cube/Rollup/GrpSet doesn't create the correct plan when group by is on something other than an AttributeReference

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Duplicate
    • None
    • None
    • SQL
    • None

    Description

      Consider the following table: t(a : String, b : String) and the query

      select a, concat(b, '1'), count(*)
      from t
      group by a, concat(b, '1') with cube
      

      The projections in the Expand operator are not setup correctly. The expand logic in Analyzer:expand is comparing grouping expressions against child.output. So concat(b, '1') is never mapped to a null Literal.

      A simple fix is to add a Rule to introduce a Projection below the Cube/Rollup/GrpSet operator that additionally projects the groupingExpressions that are missing in the child.

      Marking this as Critical, because you get wrong results.

      Attachments

        Activity

          People

            Unassigned Unassigned
            rhbutani Harish Butani
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: