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


##########
backends-clickhouse/src/test/scala/org/apache/gluten/execution/mergetree/GlutenClickHouseMergeTreeWriteOnS3Suite.scala:
##########
@@ -512,123 +503,116 @@ class GlutenClickHouseMergeTreeWriteOnS3Suite extends 
CreateMergeTreeSuite {
       RuntimeSettings.INSERT_WITHOUT_LOCAL_STORAGE.key -> "true",
       RuntimeSettings.MERGE_AFTER_INSERT.key -> "true"
     ) {
-      spark.sql(s"""
-                   |DROP TABLE IF EXISTS $tableName;
-                   |""".stripMargin)
-
-      spark.sql(s"""
-                   |CREATE TABLE IF NOT EXISTS $tableName
-                   |USING clickhouse
-                   |LOCATION '$dataPath'
-                   | 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())
+      withTable(tableName) {
+        spark.sql(s"""
+                     |CREATE TABLE $tableName
+                     |USING clickhouse
+                     |LOCATION '$dataPath'
+                     | 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())

Review Comment:
   This case doesn't really exercise `INSERT_WITHOUT_LOCAL_STORAGE`, though 
that predates this PR (you only re-indented it). Its `CREATE TABLE` has no 
`storage_policy='__s3_main'`, unlike the other catalog-table cases in this 
suite, so the table uses the `default` policy. `SparkMergeTreeSink::create` 
only stages parts locally when the policy's disk is remote, so the setting has 
no effect here. The assertion also checks 
`$CH_DEFAULT_STORAGE_DIR/lineitem_mergetree_insert_optimize_basic`, without the 
`_s3` suffix, which nothing in this suite writes, so it passes no matter what 
the insert does.
   
   A fix would start with adding `storage_policy='__s3_main'`, like the HDFS 
suite's case of the same name does with `__hdfs_main`. A local-disk check 
afterwards still can't reliably tell a staged write from a direct one, since 
the staged write drops its temp table at commit (`SparkMergeTreeSink.cpp:347`), 
so the current assertion could just go. Not blocking; a follow-up is fine.



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