dzcxzl created SPARK-38951:
------------------------------

             Summary: Aggregate aliases override field names in 
ResolveAggregateFunctions
                 Key: SPARK-38951
                 URL: https://issues.apache.org/jira/browse/SPARK-38951
             Project: Spark
          Issue Type: Bug
          Components: SQL
    Affects Versions: 3.2.1
            Reporter: dzcxzl


Spark versions before 3.1.x can query the following SQL:

{code:java}
select sum(id) as id  from range(10) group by id order by sum(id);{code}
{code:java}
Error in query: Resolved attribute(s) id#0L missing from id#1L in operator 
!Aggregate [id#1L], [sum(id#1L) AS id#0L, sum(id#0L) AS sum(id#0L)#4L]. 
Attribute(s) with the same name appear in the operation: id. Please check if 
the right attribute(s) are used.;
Project [id#0L]
+- Sort [sum(id#0L)#4L ASC NULLS FIRST], true
   +- !Aggregate [id#1L], [sum(id#1L) AS id#0L, sum(id#0L) AS sum(id#0L)#4L]
      +- Range (0, 10, step=1, splits=None) {code}



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

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

Reply via email to