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

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.0.0
    • 2.0.3, 2.1.1, 2.2.0
    • SQL
    • 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

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

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

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment