shivadarshan-devadiga opened a new pull request, #13676:
URL: https://github.com/apache/gluten/pull/13676

   ## What changes are proposed in this pull request?
   
   Fixes #13675
   
   Follow-up to #13636 / #13637.
   
   #13637 wrapped cases that dropped their tables after the assertions. This PR 
covers what it left out: cases that only run `DROP TABLE IF EXISTS` before the 
create and never drop afterwards, and the MergeTree suites. Each case now 
creates its tables inside `withTable(...)`. The manual drops are removed, and 
where the pre-create drop was removed, `CREATE TABLE IF NOT EXISTS` becomes 
`CREATE TABLE`, so a leftover table fails the create instead of being reused.
   
   - `GlutenClickHouseMergeTreeWriteSuite` (24 cases), 
`GlutenClickHouseMergeTreeOptimizeSuite` (9), 
`GlutenClickHouseMergeTreeWriteOnS3Suite` (7), 
`GlutenClickHouseMergeTreeWriteOnHDFSSuite` (6), 
`GlutenClickHouseMergeTreeWriteOnHDFSWithRocksDBMetaSuite` (5), 
`GlutenClickHouseMergeTreeCacheDataSuite` (5), 
`GlutenClickHouseMergeTreeWriteTaskNotSerializableSuite` (1)
   - `GlutenClickHouseDeltaParquetWriteSuite` (14), 
`GlutenDeltaParquetDeletionVectorSuite` (4). Three of its cases dropped through 
`doInsert(drop(table), ...)`; `doInsert` loses the `drop` parameter, the 
`drop(...)` helper is removed and `createLineitem` uses `CREATE TABLE`.
   - `GlutenClickHouseHiveTableSuite` (6): the drop SQL values 
(`drop_table_sql` etc.) are removed with their calls.
   - `GlutenClickHouseTPCHNotNullSkipIndexSuite` and 
`GlutenClickHouseTPCHNullableSkipIndexSuite` (4 each), 
`GlutenClickHouseTPCHSaltNullParquetSuite` (1), 
`GlutenClickHouseSyntheticDataSuite` (1)
   - `GlutenClickHouseNativeWriteTableSuite` and `NativeWriteChecker`:
     - `nativeWrite2` now drops its table when the block finishes. The table is 
only used inside that block, and 16 cases go through it.
     - `withDestinationTable` keeps its drop before the create. In the 
`writeAndCheckRead` cases, `compareWriteFilesSignature` reads the table after 
the helper returns, so the helper can't drop it. Those cases and the direct 
`withDestinationTable` / inline-drop cases use `withTable` themselves instead.
   
   Where the table name depends on the loop or format, `withTable` goes inside 
the loop, so each iteration drops its own table.
   
   Notes:
   
   - **`PURGE`:** a few MergeTree cases dropped with `PURGE`, before the create 
(`insert overwrite … dynamic`) or at the end (`MergeTreeCacheDataSuite`, the 
RocksDB bucket case). `withTable` doesn't purge. Their data is under 
`$dataHome`, which the suite deletes in `beforeAll`, or under the HDFS path 
that `beforeEach` deletes (with metadata and cache reset). So no later case 
sees it.
   - **External locations:** the Hive text tables point `LOCATION` at the test 
resources. They are external tables, so dropping them doesn't touch the 
resource files.
   
   Not changed:
   
   - `GlutenClickHouseTableAfterRestart`, `GLUTEN-4749: Support to purge 
mergetree data` and `GLUTEN-5219`: they test `DROP` / `PURGE` themselves.
   - Two cases in `GlutenClickHouseSyntheticDataSuite` that drop a name they 
only use as a temporary view (`createOrReplaceTempView`), with the table create 
commented out.
   - Path-based Delta tables (``delta.`$dataPath` ``): they aren't in the 
catalog.
   - `GlutenClickHouseMergeTreeWriteStatsSuite`: `test mergetree virtual 
columns` and the shared `writeAndCompareDeltaStats` helper also drop before the 
create. They are left for a separate change, together with the 
`GlutenClickHouseHiveTableSuite` cases that create a table without dropping it 
at all (`test_empty_partitions` in the issue-2022 case, `test_file_recursive` 
in `test hive read recursive dirs`).
   
   ## How was this patch tested?
   
   - Each changed case was checked against the original: its `withTable` lists 
exactly the tables the case creates, no manual drop is left in it, and its 
comments are unchanged. Apart from the removed drops and `IF NOT EXISTS`, the 
edits only re-indent code and the `stripMargin` strings, plus one `UPDATE` 
statement split across two lines to stay within 100 columns.
   - `spotless:check` and scalastyle pass for `backends-clickhouse` 
(`-Pspark-3.5 -Pdelta`).
   - `backends-clickhouse` was not compiled locally. Main sources don't compile 
here (`Option.when` in `src-delta33` under Scala 2.12), and none of the changed 
suites were run locally, since they need the native backend. The ClickHouse CI 
compiles and runs them.
   
   ## Was this patch authored or co-authored using generative AI tooling?
   
   Co-authored by: Claude Sonnet 4.5
   


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