Github user andrewor14 commented on a diff in the pull request:
https://github.com/apache/spark/pull/13415#discussion_r65265169
--- Diff:
sql/core/src/main/scala/org/apache/spark/sql/execution/SparkSqlParser.scala ---
@@ -937,7 +937,13 @@ class SparkSqlAstBuilder(conf: SQLConf) extends
AstBuilder {
selectQuery match {
case Some(q) => CreateTableAsSelectLogicalPlan(tableDesc, q,
ifNotExists)
- case None => CreateTableCommand(tableDesc, ifNotExists)
+ case None =>
+ val partitionColsInTable =
partitionCols.map(_.name).toSet.intersect(cols.map(_.name).toSet)
+ if (partitionColsInTable.nonEmpty) {
+ throw new ParseException(s"Column repeated in partitioning
columns: " +
+ partitionColsInTable.mkString("[", ",", "]"), ctx)
--- End diff --
Hi @gatorsmile, this looks OK but it seems a better place to do it is up
there in
[L885](https://github.com/apache/spark/blob/master/sql/core/src/main/scala/org/apache/spark/sql/execution/SparkSqlParser.scala#L885),
where we just concatenate the schema with the partition columns together.
There we can just check if `schema.map(_.name)` has any duplicate values.
---
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 [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]