wangyum opened a new pull request #25053: [SPARK-28252][SQL] local/global temp 
views should not accept duplicate column names
URL: https://github.com/apache/spark/pull/25053
 
 
   ## What changes were proposed in this pull request?
   
   We disabled create table with duplicate column names:
   
https://github.com/apache/spark/blob/f9837d3bf6c15600f926917a253bf1bdddb4d1b4/sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/rules.scala#L247-L250
   
   But we can create local/global temporary views with duplicate column names. 
This pr disabled create local/global temporary views with duplicate column 
names. Otherwise:
   ```shell
   scala> spark.sql("create temp view v1 as select 1 as col1, 2 as col1")
   res0: org.apache.spark.sql.DataFrame = []
   
   scala> spark.sql("select col1 from v1").show
   19/07/04 22:27:19 WARN ObjectStore: Failed to get database global_temp, 
returning NoSuchObjectException
   org.apache.spark.sql.AnalysisException: Reference 'col1' is ambiguous, could 
be: v1.col1, v1.col1.; line 1 pos 7
     at 
org.apache.spark.sql.catalyst.expressions.package$AttributeSeq.resolve(package.scala:259)
   ```
   
   
   
   ## How was this patch tested?
   
   unit tests
   

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to