Github user maropu commented on a diff in the pull request:
https://github.com/apache/spark/pull/17758#discussion_r123957252
--- Diff:
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/InsertIntoHadoopFsRelationCommand.scala
---
@@ -62,13 +63,10 @@ case class InsertIntoHadoopFsRelationCommand(
assert(children.length == 1)
// Most formats don't do well with duplicate columns, so lets not
allow that
- if (query.schema.fieldNames.length !=
query.schema.fieldNames.distinct.length) {
- val duplicateColumns =
query.schema.fieldNames.groupBy(identity).collect {
- case (x, ys) if ys.length > 1 => "\"" + x + "\""
- }.mkString(", ")
- throw new AnalysisException(s"Duplicate column(s): $duplicateColumns
found, " +
- "cannot save to file.")
- }
+ SchemaUtils.checkSchemaColumnNameDuplication(
--- End diff --
I checked that the three tests below hit catches this check;
https://github.com/apache/spark/pull/17758/files#diff-5d2ebf4e9ca5a990136b276859769289R1126
https://github.com/apache/spark/pull/17758/files#diff-5d2ebf4e9ca5a990136b276859769289R1136
https://github.com/apache/spark/pull/17758/files#diff-b9ddfbc9be8d83ecf100b3b8ff9610b9R699
---
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]