Github user yhuai commented on a diff in the pull request:
https://github.com/apache/spark/pull/2209#discussion_r16927258
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/basicOperators.scala
---
@@ -158,11 +159,18 @@ case class Subquery(alias: String, child:
LogicalPlan) extends UnaryNode {
* this allows for optional case insensitive attribute resolution. This
node can be elided after
* analysis.
*/
-case class LowerCaseSchema(child: LogicalPlan) extends UnaryNode {
+case class LowerCaseSchema(child: LogicalPlan) extends UnaryNode with
Logging {
protected def lowerCaseSchema(dataType: DataType): DataType = dataType
match {
case StructType(fields) =>
- StructType(fields.map(f =>
- StructField(f.name.toLowerCase(), lowerCaseSchema(f.dataType),
f.nullable)))
+ val convertedFields = fields.map(f =>
+ StructField(f.name.toLowerCase, lowerCaseSchema(f.dataType),
f.nullable))
+ val deduplicatedFields = convertedFields.groupBy(_.name).map {
+ case (fieldName, versions) if versions.size == 1 => versions.head
+ case (fieldName, versions) if versions.size > 1 =>
+ logWarning(s"Resolving attributes case insensitively is
ambiguous for $fieldName")
--- End diff --
Provide more information on which column (with the original column name) we
will keep in the `lowerCaseSchema`?
---
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]