Mihailo Aleksic created SPARK-52102:
---------------------------------------

             Summary: Normalize correlated aggregate function names in HAVING 
condition
                 Key: SPARK-52102
                 URL: https://issues.apache.org/jira/browse/SPARK-52102
             Project: Spark
          Issue Type: Improvement
          Components: SQL
    Affects Versions: 4.1.0
            Reporter: Mihailo Aleksic


In the following query we would have `min(outer(t2.t2a))` as a name for 
`min(t2a)` expression.
```
SELECT t1a 
FROM   t1
WHERE  t1a IN (SELECT t2a 
               FROM   t2
               WHERE  EXISTS (SELECT min(t2a) 
                              FROM   t3))
```
This is a problem in compatibility between single-pass resolver and fixed-point 
analyzer because names in single-pass are generated after we finish resolution 
of aggregate expression `min(t2a)` (bottom-up manner) and at that point we have 
`OuterReference` wrapped around aggregate expression (name looks like 
`outer(min(t2a))`).
I propose that we fix it by normalizing `Alias` names for correlated aggregate 
functions in HAVING condition.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org
For additional commands, e-mail: issues-h...@spark.apache.org

Reply via email to