LantaoJin opened a new pull request #29062:
URL: https://github.com/apache/spark/pull/29062


   ### Why are the changes needed?
   Below SQL in Spark3.0 will throw AnalysisException, but it works in Spark2.x
   ```
   WITH cte AS (SELECT /*+ REPARTITION(3) */ T.id, T.data FROM $t1 T)
   SELECT cte.id, cte.data FROM cte
   ```
   Failed to analyze query: org.apache.spark.sql.AnalysisException: cannot 
resolve '`cte.id`' given input columns: [cte.data, cte.id]; line 3 pos 7;
   'Project ['cte.id, 'cte.data]
   +- SubqueryAlias cte
      +- Project [id#21L, data#22]
         +- SubqueryAlias T
            +- SubqueryAlias testcat.ns1.ns2.tbl
               +- RelationV2[id#21L, data#22] testcat.ns1.ns2.tbl
   
   'Project ['cte.id, 'cte.data]
   +- SubqueryAlias cte
      +- Project [id#21L, data#22]
         +- SubqueryAlias T
            +- SubqueryAlias testcat.ns1.ns2.tbl
               +- RelationV2[id#21L, data#22] testcat.ns1.ns2.tbl
   
   ### Does this PR introduce _any_ user-facing change?
   No
   
   ### How was this patch tested?
   Add a unit test
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



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

Reply via email to