gatorsmile commented on a change in pull request #24886: [SPARK-28054][SQL] Fix 
error when insert Hive partitioned table dynamically where partition name is 
upper case
URL: https://github.com/apache/spark/pull/24886#discussion_r297462034
 
 

 ##########
 File path: 
sql/hive/src/main/scala/org/apache/spark/sql/hive/execution/SaveAsHiveFile.scala
 ##########
 @@ -83,6 +83,16 @@ private[hive] trait SaveAsHiveFile extends 
DataWritingCommand {
       jobId = java.util.UUID.randomUUID().toString,
       outputPath = outputLocation)
 
+    // SPARK-28054: Hive metastore is not case preserving and keeps partition 
columns
+    // with lower cased names, Hive will validate the column names in 
partition spec and
+    // the partition paths. Besides lowercasing the column names in the 
partition spec,
+    // we also need to lowercase the column names in written partition paths.
+    // scalastyle:off caselocale
+    val hiveCompatiblePartitionColumns = partitionAttributes.map { attr =>
+     attr.withName(attr.name.toLowerCase)
 
 Review comment:
   indent. 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to