wuyi created SPARK-32372:
----------------------------

             Summary: "Resolved attribute(s) XXX missing" after dudup conflict 
references
                 Key: SPARK-32372
                 URL: https://issues.apache.org/jira/browse/SPARK-32372
             Project: Spark
          Issue Type: Bug
          Components: SQL
    Affects Versions: 3.0.0, 2.4.6, 2.3.4, 2.2.2
            Reporter: wuyi


{code:java}
// case class Person(id: Int, name: String, age: Int)

sql("SELECT name, avg(age) as avg_age FROM person GROUP BY 
name").createOrReplaceTempView("person_a")
sql("SELECT p1.name, p2.avg_age FROM person p1 JOIN person_a p2 ON p1.name = 
p2.name").createOrReplaceTempView("person_b")
sql("SELECT * FROM person_a UNION SELECT * FROM person_b")   
.createOrReplaceTempView("person_c")
sql("SELECT p1.name, p2.avg_age FROM person_c p1 JOIN person_c p2 ON p1.name = 
p2.name").show
{code}
error:
{code:java}
[info]   Failed to analyze query: org.apache.spark.sql.AnalysisException: 
Resolved attribute(s) avg_age#235 missing from name#233,avg_age#231 in operator 
!Project [name#233, avg_age#235]. Attribute(s) with the same name appear in the 
operation: avg_age. Please check if the right attribute(s) are used.;;
...{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