jonvex commented on code in PR #10826:
URL: https://github.com/apache/hudi/pull/10826#discussion_r1514833811


##########
hudi-spark-datasource/hudi-spark/src/main/scala/org/apache/spark/sql/hudi/command/MergeIntoHoodieTableCommand.scala:
##########
@@ -372,17 +374,23 @@ case class MergeIntoHoodieTableCommand(mergeInto: 
MergeIntoTable) extends Hoodie
     // In case when we're not adding new columns we need to make sure that the 
casing of the key attributes'
     // matches to that one of the target table. This is necessary b/c unlike 
Spark, Avro is case-sensitive
     // and therefore would fail downstream if case of corresponding columns 
don't match
+    val partitionColumns = 
hoodieCatalogTable.tableConfig.getPartitionFieldProp.split(",").toSeq
     val existingAttributes = existingAttributesMap.map(_._1)
-    val adjustedSourceTableOutput = projectedJoinOutput.map { attr =>
+    val adjustedSourceTableOutput = projectedJoinOptimizerOutput.map { attr =>
       existingAttributes.find(keyAttr => resolver(keyAttr.name, attr.name)) 
match {
         // To align the casing we just rename the attribute to match that one 
of the
         // target table
         case Some(keyAttr) => attr.withName(keyAttr.name)
-        case _ => attr
+        // additional check for partition columns because they are not 
required,
+        // but we still care about casing because of keygenerator
+        case _ => partitionColumns.find(colName => resolver(colName, 
attr.name)) match {

Review Comment:
   The test "Test ignoring case for MOR table" hits this case. Partition column 
is not required for the join so we didn't fix the naming like we did for 
precombine and recordkey. However, capitalization still matters if it is 
included because we do keygeneration in avro. So I added this check to adjust 
the partition col names if they are part of the assignment



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to