LuciferYang commented on code in PR #13772:
URL: https://github.com/apache/gluten/pull/13772#discussion_r4682931665


##########
backends-clickhouse/src/test/scala/org/apache/gluten/execution/mergetree/GlutenClickHouseMergeTreeWriteOnS3Suite.scala:
##########
@@ -508,13 +506,12 @@ class GlutenClickHouseMergeTreeWriteOnS3Suite extends 
CreateMergeTreeSuite {
                      |CREATE TABLE $tableName
                      |USING clickhouse
                      |LOCATION '$dataPath'
+                     |TBLPROPERTIES (storage_policy='__s3_main')

Review Comment:
   With the storage policy in place the CTAS now writes straight to S3, but it 
still writes a single part, so the merge this test is about never runs. 
lineitem's 600572 rows stay under both squashing thresholds 
(`min_insert_block_size_rows` 1048449, `min_insert_block_size_bytes` 256 MiB), 
the sink flushes one part in `onFinish`, and `checkAndMerge(true)` skips a lone 
part. Neither the merge on the S3 disk nor `DirectSinkHelper::cleanup`, which 
deletes the merged-away parts from S3, is exercised.
   
   The HDFS case this PR follows covers both: it sets 
`RuntimeSettings.MIN_INSERT_BLOCK_SIZE_ROWS.key -> "10000"` and then checks 
`countDir(dataPath) == 4` inside `eventually`. Could you add the same setting 
here, plus an S3 counterpart of that check, such as 
`countObjects(minioHelper.listObjects(BUCKET_NAME, tableName).toSeq)` in an 
`eventually` block? The expected count needs one run against MinIO.



##########
backends-clickhouse/src/test/scala/org/apache/gluten/execution/mergetree/GlutenClickHouseMergeTreeWriteOnS3Suite.scala:
##########
@@ -508,13 +506,12 @@ class GlutenClickHouseMergeTreeWriteOnS3Suite extends 
CreateMergeTreeSuite {
                      |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))

Review Comment:
   The row count this test now relies on doesn't read the table. With the 
default `stats.skipping` and `optimizeMetadataQuery.enabled`, Delta's 
`PrepareDeltaScan` answers `count(*)` from the `numRecords` stats in the log; 
the GLUTEN-6378 test in `GlutenClickHouseMergeTreeWriteSuite` asserts that plan 
as `LocalTableScanExec`. So 600572 is what the native writer reported, and a 
part that `DirectSinkHelper` wrote to S3 but that can't be read back would 
still pass. This is also the only S3 test that sets 
`INSERT_WITHOUT_LOCAL_STORAGE`, so nothing else in the suite reads back a 
direct write.
   
   Could you add `minioHelper.resetMeta()` followed by 
`checkQuery(q1(tableName))`, the way `test mergetree table write` does? Without 
the reset, q1 reads the part metadata the write left on local disk, so a 
missing or broken `metadata.gluten` on S3 would still go unnoticed.



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