Davis-Zhang-Onehouse commented on code in PR #12583:
URL: https://github.com/apache/hudi/pull/12583#discussion_r1909484960
##########
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:
not required, it is a workaround for
https://issues.apache.org/jira/browse/HUDI-8835.
In general, for MIT to be able to operate independently from precombine
field, it requires more work
##########
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:
unintentional changes, reverted
##########
hudi-spark-datasource/hudi-spark/src/test/scala/org/apache/spark/sql/hudi/dml/TestMergeIntoTable.scala:
##########
@@ -22,11 +22,13 @@ import
org.apache.hudi.DataSourceWriteOptions.SPARK_SQL_OPTIMIZED_WRITES
import
org.apache.hudi.config.HoodieWriteConfig.MERGE_SMALL_FILE_GROUP_CANDIDATES_LIMIT
import org.apache.hudi.hadoop.fs.HadoopFSUtils
import org.apache.hudi.testutils.DataSourceTestUtils
-
+import org.apache.spark.sql.hudi.ProvidesHoodieConfig.getClass
Review Comment:
done
--
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]