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


##########
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:
   can we add a test around this case?



##########
hudi-spark-datasource/hudi-spark/src/test/scala/org/apache/spark/sql/hudi/TestInsertTable.scala:
##########
@@ -2448,6 +2449,50 @@ class TestInsertTable extends HoodieSparkSqlTestBase {
     })
   }
 
+  test("Test query with Foldable Propagation expression") {

Review Comment:
   Make the test name more readable



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