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

Do not collapse projects in CombineUnions if it hasCorrelatedSubquery

    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

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: