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

Do not collapse projects in CombineUnions if it hasCorrelatedSubquery

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

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.3.0
    • 3.3.0
    • SQL
    • None

    Description

       

      SPARK-37915 added CollapseProject in rule CombineUnions, but it shouldn't collapse projects that contain correlated subqueries since haven't been de-correlated (PullupCorrelatedPredicates).

      Here is a simple example to reproduce this issue

      SELECT (SELECT IF(x, 1, 0)) AS a
      FROM (SELECT true) t(x)
      UNION 
      SELECT 1 AS a 

      Exception:

      java.lang.IllegalStateException: Couldn't find x#4 in [] 

       

      Attachments

        Activity

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

          People

            yumwang Yuming Wang
            allisonwang-db Allison Wang
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment