Allison Wang created SPARK-36275:
------------------------------------

             Summary: ResolveAggregateFunctions should work with nested fields
                 Key: SPARK-36275
                 URL: https://issues.apache.org/jira/browse/SPARK-36275
             Project: Spark
          Issue Type: Bug
          Components: SQL
    Affects Versions: 3.2.0
            Reporter: Allison Wang


A sort after Aggregate can fail to resolve if it contains nested fields. For 
example

{code:java}
SELECT c.x, SUM(c.y)
FROM VALUES NAMED_STRUCT('x', 'A', 'y', 1), NAMED_STRUCT('x', 'A', 'y', 2) AS 
t(c)
GROUP BY c.x
ORDER BY c.x
{code}

Error:
{code}
org.apache.spark.sql.AnalysisException: cannot resolve 'c.x' given input 
columns: [sum(c.y), x]; line 5 pos 9;
'Sort ['c.x ASC NULLS FIRST], true
+- Aggregate [c#0.x], [c#0.x AS x#2, sum(c#0.y) AS sum(c.y)#5L]
   +- SubqueryAlias t
      +- LocalRelation [c#0]
{code}

 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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

Reply via email to