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


##########
hudi-spark-datasource/hudi-spark/src/test/scala/org/apache/spark/sql/hudi/dml/TestMergeIntoTable.scala:
##########
@@ -1336,44 +1339,59 @@ class TestMergeIntoTable extends HoodieSparkSqlTestBase 
with ScalaAssertionSuppo
 
   test("Test MergeInto with partial insert") {
     spark.sql(s"set ${MERGE_SMALL_FILE_GROUP_CANDIDATES_LIMIT.key} = 0")
-    Seq(true, false).foreach { sparkSqlOptimizedWrites =>
+
+    // Test combinations: (tableType, sparkSqlOptimizedWrites)
+    val testConfigs = Seq(
+      ("mor", true),
+      ("mor", false),
+      ("cow", true),
+      ("cow", false)
+    )
+
+    testConfigs.foreach { case (tableType, sparkSqlOptimizedWrites) =>
+      log.info(s"=== Testing MergeInto with partial insert: 
tableType=$tableType, sparkSqlOptimizedWrites=$sparkSqlOptimizedWrites ===")
       withRecordType()(withTempDir { tmp =>
         spark.sql("set hoodie.payload.combined.schema.validate = true")
-        // Create a partitioned mor table
+        // Create a partitioned table
         val tableName = generateTableName
         spark.sql(
           s"""
              | create table $tableName (
              |  id bigint,
              |  name string,
              |  price double,
+             |  ts bigint,
              |  dt string
              | ) using hudi
              | tblproperties (
-             |  type = 'mor',
-             |  primaryKey = 'id'
+             |  type = '$tableType',
+             |  primaryKey = 'id',
+             |  precombineKey = 'ts'

Review Comment:
   Is `precombineKey` required in this test?



##########
hudi-spark-datasource/hudi-spark/src/test/scala/org/apache/spark/sql/hudi/dml/TestMergeIntoTable.scala:
##########
@@ -842,7 +844,8 @@ class TestMergeIntoTable extends HoodieSparkSqlTestBase 
with ScalaAssertionSuppo
       )
 
       checkAnswer(s"select id,name,price,v,dt from $tableName1 order by id")(
-        Seq(1, "a1", 10, 1000, "2021-03-21")
+        Seq(1, "a1", 10, 1000, "2021-03-21"),
+        Seq(3, "a3", 30, 3000, "2021-03-21")

Review Comment:
   Why does the result have to change here?



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