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

Output non-aggregate expressions without GROUP BY in a subquery does not yield an error

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.0
    • Fix Version/s: 2.0.3, 2.1.1, 2.2.0
    • Component/s: SQL
    • Labels:
      None

      Description

      Xiao Li has found that the following query does not raise a syntax error (note the GROUP BY clause is commented out):

      SELECT pk, cv
      FROM   p, c
      WHERE  p.pk = c.ck
      AND    c.cv = (SELECT max(avg)
                     FROM   (SELECT   c1.cv, avg(c1.cv) avg
                             FROM     c c1
                             WHERE    c1.ck = p.pk
      --                       GROUP BY c1.cv
                            ))
      
      

      There could be multiple values of c1.cv for each value of avg(c1.cv).

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                nsyca Nattavut Sutyanyong
                Reporter:
                nsyca Nattavut Sutyanyong
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: