LuciferYang opened a new issue, #11376:
URL: https://github.com/apache/paimon/issues/11376

   **Search before asking**
   - [x] I searched in the [issues](https://github.com/apache/paimon/issues) 
and found nothing similar.
   
   **Paimon version**
   master @ ae135d59c9
   
   **Compute Engine**
   Spark 4.2.1 and 4.3.0. Spark 4.1 is not affected.
   
   **Minimal reproduce step**
   On an append table without a primary key, deletion vectors or data evolution 
(V2 write is the default):
   
   ```sql
   CREATE TABLE t (id INT, name STRING, pt INT) PARTITIONED BY (pt);
   INSERT INTO t VALUES (1, 'a', 1), (2, 'b', 2);
   EXPLAIN DELETE FROM t WHERE pt = 1;
   ```
   
   On Spark 4.1 the plan is `TruncatePaimonTableWithFilter`, which drops the 
partition's files in the metadata. On Spark 4.2 and 4.3 it is a copy-on-write 
`ReplaceData`, which scans the whole partition and rewrites its data files. For 
an unaware-bucket deletion-vector append table it is a `WriteDelta`, which 
marks every row of the partition in deletion vectors.
   
   **What doesn't meet your expectations?**
   The result is the same, but a partition-only DELETE should be a 
metadata-only truncate, as on Spark 4.1.
   
   **Anything else?**
   Spark rewrites the DELETE into `ReplaceData` or `WriteDelta` itself. On 
Spark 4.1, `Spark41DeleteMetadataRestore` turns that back into 
`DeleteFromPaimonTableCommand`, which 
`OptimizeMetadataOnlyDeleteFromPaimonTable` folds into the truncate. The 
spark42 and spark43 profiles exclude `Spark41*.scala` from 
`paimon-spark4-common`, and `Spark42RowLevelCommandRewrite` handles only UPDATE 
and MERGE, so the restore never runs there.
   
   The shared `PaimonOptimizationTestBase` covers this, but only the Spark 3.x 
to 4.1 modules subclass it; the Spark 4.2 module, which the 4.3 module builds 
from, has no subclass, so the spark42 and spark43 lanes never run it.
   
   **Are you willing to submit a PR?**
   - [x] I'm willing to submit a PR!
   


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