xushiyan commented on code in PR #8490:
URL: https://github.com/apache/hudi/pull/8490#discussion_r1184560033
##########
hudi-spark-datasource/hudi-spark/src/test/scala/org/apache/hudi/functional/TestMORDataSourceStorage.scala:
##########
@@ -133,4 +132,69 @@ class TestMORDataSourceStorage extends
SparkClientFunctionalTestHarness {
assertEquals(100, hudiSnapshotDF3.count())
assertEquals(updatedVerificationVal,
hudiSnapshotDF3.filter(col("_row_key") ===
verificationRowKey).select(verificationCol).first.getString(0))
}
+
+ @ParameterizedTest
+ @CsvSource(Array(
+ "true,GLOBAL_SIMPLE",
+ "true,GLOBAL_BLOOM",
+ "false,GLOBAL_SIMPLE",
+ "false,GLOBAL_BLOOM"
+ ))
+ def testMergeOnReadStorageWithGlobalIndexUpdatePartition(isMetadataEnabled:
Boolean, indexType: String): Unit = {
+ val totalRecords = 10
+ val parallelism = 2
+ val commonOpts = Map(
+ HoodieTableConfig.NAME.key -> "hudi_trips_mor_global_update_partition",
+ DataSourceWriteOptions.TABLE_TYPE.key ->
HoodieTableType.MERGE_ON_READ.name,
+ DataSourceWriteOptions.RECORDKEY_FIELD.key -> "_row_key",
+ DataSourceWriteOptions.PARTITIONPATH_FIELD.key -> "partition_path",
+ DataSourceWriteOptions.PRECOMBINE_FIELD.key -> "timestamp",
+ HoodieMetadataConfig.ENABLE.key -> isMetadataEnabled.toString,
+ HoodieIndexConfig.INDEX_TYPE.key -> indexType,
+ HoodieIndexConfig.SIMPLE_INDEX_UPDATE_PARTITION_PATH_ENABLE.key ->
"true",
+ HoodieIndexConfig.GLOBAL_INDEX_RECONCILE_PARALLELISM.key ->
parallelism.toString,
+ HoodieWriteConfig.UPSERT_PARALLELISM_VALUE.key -> parallelism.toString,
+ HoodieWriteConfig.INSERT_PARALLELISM_VALUE.key -> parallelism.toString,
+ HoodieWriteConfig.BULKINSERT_PARALLELISM_VALUE.key ->
parallelism.toString,
+ HoodieWriteConfig.DELETE_PARALLELISM_VALUE.key -> parallelism.toString
+ )
+ val dataGen = new HoodieTestDataGenerator(0xDEEF)
+
+ def upsertAndValidate(records: java.util.List[HoodieRecord[_]], partition:
String): Unit = {
+ // upsert records
+
spark.read.json(spark.sparkContext.parallelize(recordsToStrings(records),
parallelism))
+ .write.format("hudi")
+ .options(commonOpts)
+ .mode(SaveMode.Append)
+ .save(basePath)
+
+ // validate all records are in the partition
+ val snapshotDF = spark.read.format("org.apache.hudi")
+ .option(DataSourceReadOptions.QUERY_TYPE.key,
DataSourceReadOptions.QUERY_TYPE_SNAPSHOT_OPT_VAL)
+ .option(HoodieMetadataConfig.ENABLE.key, isMetadataEnabled)
+ .load(basePath)
+ assertEquals(totalRecords, snapshotDF.count)
+ assertEquals(totalRecords, snapshotDF.filter(s"partition_path =
'$partition'").count)
Review Comment:
this is done in
https://github.com/apache/hudi/pull/8490/commits/2d719960e519c0cfaca1a8608f7deacb56c04a02
--
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]