Github user gatorsmile commented on a diff in the pull request: https://github.com/apache/spark/pull/13756#discussion_r68357453 --- Diff: sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveMetastoreCatalog.scala --- @@ -441,6 +441,9 @@ private[hive] class HiveMetastoreCatalog(sparkSession: SparkSession) extends Log case p: LogicalPlan if p.resolved => p case p @ CreateHiveTableAsSelectLogicalPlan(table, child, allowExisting) => + // Ensuring whether no duplicate name is used in table definition + checkDuplicates(child.output.map(_.name), s"table definition of ${table.identifier}") --- End diff -- `PreWriteCheck` is checked after conversion from `CreateHiveTableAsSelectLogicalPlan ` to `execution.CreateHiveTableAsSelectCommand`. `PreWriteCheck` is unable to access the Hive package `execution.CreateHiveTableAsSelectCommand`. Thus, I have no clue how to move this into `PreWriteCheck `. Introduce a new rule? Actually, in Hive, there is a stage called `Semantic Analysis`, which is done before `Analyzer` but after `Parser`. That stage is for checking these semantic errors. Not sure we should add a similar concept into Spark SQL.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org