Github user budde commented on a diff in the pull request:
https://github.com/apache/spark/pull/17249#discussion_r105499679
--- Diff:
sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveMetastoreCatalog.scala ---
@@ -356,13 +356,10 @@ private[hive] object HiveMetastoreCatalog {
.filterKeys(!inferredSchema.map(_.name.toLowerCase).contains(_))
.values
.filter(_.nullable)
-
// Merge missing nullable fields to inferred schema and build a
case-insensitive field map.
val inferredFields = StructType(inferredSchema ++ missingNullables)
.map(f => f.name.toLowerCase -> f).toMap
- StructType(metastoreFields.map { case(name, field) =>
- field.copy(name = inferredFields(name).name)
- }.toSeq)
+ StructType(metastoreSchema.map(f => f.copy(name =
inferredFields(f.name).name)))
--- End diff --
This should ensure the proper ordering is used. Iterating over the
```metastoreFields``` map isn't guaranteed to maintain the original ordering.
---
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]