Github user HyukjinKwon commented on a diff in the pull request:
https://github.com/apache/spark/pull/13095#discussion_r63151860
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/AstBuilder.scala
---
@@ -220,11 +220,18 @@ class AstBuilder extends SqlBaseBaseVisitor[AnyRef]
with Logging {
*/
override def visitPartitionSpec(
ctx: PartitionSpecContext): Map[String, Option[String]] =
withOrigin(ctx) {
- ctx.partitionVal.asScala.map { pVal =>
+ val parts = ctx.partitionVal.asScala.map { pVal =>
val name = pVal.identifier.getText.toLowerCase
val value = Option(pVal.constant).map(visitStringConstant)
name -> value
- }.toMap
+ }
+ // Check for duplicate partition columns in one spec.
+ parts.groupBy(_._1).filter(_._2.size > 1).foreach {
+ case (name, _) =>
--- End diff --
(it seems putting the case in the same line is preferred `foreach { case
(name, _) =>`,
[scala-style-guide#pattern-matching](https://github.com/databricks/scala-style-guide#pattern-matching))
---
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]