codope commented on code in PR #12050:
URL: https://github.com/apache/hudi/pull/12050#discussion_r1799873491


##########
hudi-spark-datasource/hudi-spark/src/test/scala/org/apache/hudi/functional/TestPartitionStatsIndexWithSql.scala:
##########
@@ -238,30 +238,37 @@ class TestPartitionStatsIndexWithSql extends 
HoodieSparkSqlTestBase {
 
   test(s"Test partition stats index on int type field with update and file 
pruning") {
     Seq("cow", "mor").foreach { tableType =>
-      withTempDir { tmp =>
-        val tableName = generateTableName
-        val tablePath = s"${tmp.getCanonicalPath}/$tableName"
-        spark.sql(
-          s"""
-             |create table $tableName (
-             |  id int,
-             |  name string,
-             |  price int,
-             |  ts long
-             |) using hudi
-             |partitioned by (ts)
-             |tblproperties (
-             |  type = '$tableType',
-             |  primaryKey = 'id',
-             |  preCombineField = 'price',
-             |  hoodie.metadata.index.partition.stats.enable = 'true',
-             |  hoodie.metadata.index.column.stats.column.list = 'price'
-             |)
-             |location '$tablePath'
-             |""".stripMargin
-        )
-
-        writeAndValidatePartitionStats(tableName, tablePath)
+      Seq(true, false).foreach { shouldCompact =>
+        withTempDir { tmp =>
+          val tableName = generateTableName
+          val tablePath = s"${tmp.getCanonicalPath}/$tableName"
+          spark.sql(
+            s"""
+               |create table $tableName (
+               |  id int,
+               |  name string,
+               |  price int,
+               |  ts long
+               |) using hudi
+               |partitioned by (ts)
+               |tblproperties (
+               |  type = '$tableType',
+               |  primaryKey = 'id',
+               |  preCombineField = 'price',
+               |  hoodie.metadata.index.partition.stats.enable = 'true',
+               |  hoodie.metadata.index.column.stats.column.list = 'price'
+               |)
+               |location '$tablePath'
+               |""".stripMargin
+          )
+
+          // trigger compaction after update and validate stats
+          if (tableType == "mor" && shouldCompact) {
+            spark.sql("set hoodie.compact.inline=true")
+            spark.sql("set hoodie.compact.inline.max.delta.commits=2")
+          }
+          writeAndValidatePartitionStats(tableName, tablePath)

Review Comment:
   for MOR, added additional validation on partition stats records - 
https://github.com/apache/hudi/pull/12050/files#diff-f65dc170508bd3a056c6dc0d6bea8b4faf61131d4b58285590714820f3db5b20R317



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