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

GroupingSets Returns an Incorrect Results

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Critical
    • Resolution: Fixed
    • 1.6.0, 2.0.0
    • 2.0.0
    • SQL

    Description

      The following query returns a wrong result:

      sql("select course, sum(earnings) as sum from courseSales group by course, earnings" +
           " grouping sets((), (course), (course, earnings))" +
           " order by course, sum").show()
      

      Before the fix, the results are like

      [null,null]
      [Java,null]
      [Java,20000.0]
      [Java,30000.0]
      [dotNET,null]
      [dotNET,5000.0]
      [dotNET,10000.0]
      [dotNET,48000.0]
      

      After the fix, the results are corrected:

      [null,113000.0]
      [Java,20000.0]
      [Java,30000.0]
      [Java,50000.0]
      [dotNET,5000.0]
      [dotNET,10000.0]
      [dotNET,48000.0]
      [dotNET,63000.0]
      

      Attachments

        Issue Links

          Activity

            People

              smilegator Xiao Li
              smilegator Xiao Li
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: