You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Yuming Wang (JIRA)" <ji...@apache.org> on 2019/07/10 06:36:00 UTC

[jira] [Commented] (SPARK-28252) local/global temp view should not accept duplicate column names

    [ https://issues.apache.org/jira/browse/SPARK-28252?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16881766#comment-16881766 ] 

Yuming Wang commented on SPARK-28252:
-------------------------------------

PostgreSQL also do not support it.
{code:sql}
postgres=# CREATE TEMPORARY VIEW spark_28252 as select 1 as c1, 2 as c1;
ERROR:  column "c1" specified more than once
{code}


> local/global temp view should not accept duplicate column names
> ---------------------------------------------------------------
>
>                 Key: SPARK-28252
>                 URL: https://issues.apache.org/jira/browse/SPARK-28252
>             Project: Spark
>          Issue Type: Improvement
>          Components: SQL
>    Affects Versions: 3.0.0
>            Reporter: Yuming Wang
>            Priority: Major
>
> {noformat}
> 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)
>   at org.apache.spark.sql.catalyst.plans.logical.LogicalPlan.resolveChildren(LogicalPlan.scala:101)
>   at org.apache.spark.sql.catalyst.analysis.Analyzer$ResolveReferences$$anonfun$40.apply(Analyzer.scala:890)
>   at org.apache.spark.sql.catalyst.analysis.Analyzer$ResolveReferences$$anonfun$40.apply(Analyzer.scala:892)
>   at org.apache.spark.sql.catalyst.analysis.package$.withPosition(package.scala:53)
> {noformat}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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