You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2020/02/21 06:05:56 UTC

[GitHub] [spark] cloud-fan commented on a change in pull request #27651: [SPARK-30903][SQL] Fail fast on duplicate columns when analyze columns

cloud-fan commented on a change in pull request #27651: [SPARK-30903][SQL] Fail fast on duplicate columns when analyze columns
URL: https://github.com/apache/spark/pull/27651#discussion_r382411322
 
 

 ##########
 File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/AstBuilder.scala
 ##########
 @@ -3202,8 +3202,16 @@ class AstBuilder(conf: SQLConf) extends SqlBaseBaseVisitor[AnyRef] with Logging
       AnalyzeTableStatement(tableName, partitionSpec, noScan = ctx.identifier != null)
     } else {
       checkPartitionSpec()
-      AnalyzeColumnStatement(
-        tableName, Option(visitIdentifierSeq(ctx.identifierSeq())), allColumns = false)
+      val colsOpt = Option(visitIdentifierSeq(ctx.identifierSeq()))
+      colsOpt.foreach { cols =>
+        val duplicates = cols.groupBy(identity).filter(_._2.size > 1).keys
+        if (duplicates.nonEmpty) {
+          throw new ParseException(
 
 Review comment:
   shall we check it in `CheckAnalysis`? It's not a parser error really

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

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