shivadarshan-devadiga commented on code in PR #13772:
URL: https://github.com/apache/gluten/pull/13772#discussion_r4691296545


##########
backends-clickhouse/src/test/scala/org/apache/gluten/execution/mergetree/GlutenClickHouseMergeTreeWriteOnS3Suite.scala:
##########
@@ -501,20 +499,41 @@ class GlutenClickHouseMergeTreeWriteOnS3Suite extends 
CreateMergeTreeSuite {
     withSQLConf(
       "spark.databricks.delta.optimize.minFileSize" -> "200000000",
       RuntimeSettings.INSERT_WITHOUT_LOCAL_STORAGE.key -> "true",
-      RuntimeSettings.MERGE_AFTER_INSERT.key -> "true"
+      RuntimeSettings.MERGE_AFTER_INSERT.key -> "true",
+      RuntimeSettings.MIN_INSERT_BLOCK_SIZE_ROWS.key -> "10000"
     ) {
       withTable(tableName) {
         spark.sql(s"""
                      |CREATE TABLE $tableName
                      |USING clickhouse
                      |LOCATION '$dataPath'
+                     |TBLPROPERTIES (storage_policy='__s3_main')
                      | as select * from lineitem
                      |""".stripMargin)
 
-        val ret = spark.sql(s"select count(*) from $tableName").collect()
-        assertResult(600572)(ret.apply(0).get(0))
-        assert(
-          !new 
File(s"$CH_DEFAULT_STORAGE_DIR/lineitem_mergetree_insert_optimize_basic").exists())
+        // Read the parts back from S3, not from the part metadata the write 
left on local disk.
+        minioHelper.resetMeta()
+        customCheckQuery(q1(tableName)) {
+          df =>
+            val scanExec = collect(df.queryExecution.executedPlan) {
+              case f: FileSourceScanExecTransformer => f
+            }
+            assertResult(1)(scanExec.size)
+            val fileIndex = 
scanExec.head.relation.location.asInstanceOf[TahoeFileIndex]
+            val parts =
+              fileIndex.matchingFiles(Nil, Nil).map(f => 
f.asInstanceOf[AddMergeTreeParts])
+            assertResult(600572)(parts.map(_.rows).sum)
+            // The insert writes a part per block of 10000 rows, which the 
merge combines into

Review Comment:
   Thanks, you're right: it's the squashing threshold, not a part per 10000 
rows. I've used your wording in 535ba43aae40a5ede5c12aff2765b5e17e455a7a



##########
backends-clickhouse/src/test/scala/org/apache/gluten/execution/mergetree/GlutenClickHouseMergeTreeWriteOnS3Suite.scala:
##########
@@ -501,20 +499,41 @@ class GlutenClickHouseMergeTreeWriteOnS3Suite extends 
CreateMergeTreeSuite {
     withSQLConf(
       "spark.databricks.delta.optimize.minFileSize" -> "200000000",
       RuntimeSettings.INSERT_WITHOUT_LOCAL_STORAGE.key -> "true",
-      RuntimeSettings.MERGE_AFTER_INSERT.key -> "true"
+      RuntimeSettings.MERGE_AFTER_INSERT.key -> "true",
+      RuntimeSettings.MIN_INSERT_BLOCK_SIZE_ROWS.key -> "10000"
     ) {
       withTable(tableName) {
         spark.sql(s"""
                      |CREATE TABLE $tableName
                      |USING clickhouse
                      |LOCATION '$dataPath'
+                     |TBLPROPERTIES (storage_policy='__s3_main')
                      | as select * from lineitem
                      |""".stripMargin)
 
-        val ret = spark.sql(s"select count(*) from $tableName").collect()
-        assertResult(600572)(ret.apply(0).get(0))
-        assert(
-          !new 
File(s"$CH_DEFAULT_STORAGE_DIR/lineitem_mergetree_insert_optimize_basic").exists())
+        // Read the parts back from S3, not from the part metadata the write 
left on local disk.
+        minioHelper.resetMeta()
+        customCheckQuery(q1(tableName)) {
+          df =>
+            val scanExec = collect(df.queryExecution.executedPlan) {
+              case f: FileSourceScanExecTransformer => f
+            }
+            assertResult(1)(scanExec.size)
+            val fileIndex = 
scanExec.head.relation.location.asInstanceOf[TahoeFileIndex]
+            val parts =
+              fileIndex.matchingFiles(Nil, Nil).map(f => 
f.asInstanceOf[AddMergeTreeParts])
+            assertResult(600572)(parts.map(_.rows).sum)
+            // The insert writes a part per block of 10000 rows, which the 
merge combines into

Review Comment:
   Thanks, you're right: it's the squashing threshold, not a part per 10000 
rows. I've used your wording in 535ba43aae40a5ede5c12aff2765b5e17e455a7a



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to