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

   ### Search before asking
   
   - [X] I searched in the [issues](https://github.com/apache/paimon/issues) 
and found nothing similar.
   
   ### Paimon version
   
   master (30d91278af)
   
   ### Compute Engine
   
   Spark
   
   ### Minimal reproduce step
   
   ```scala
   spark.conf.set("spark.paimon.format-table.implementation", "engine")
   spark.sql("CREATE TABLE t (a INT, b STRING, pt STRING) USING csv PARTITIONED 
BY (pt)")
   spark.sql("INSERT INTO t VALUES (1, 'old1', 'p1')")
   
   Seq((5, "x5", "p1")).toDF("a", "b", "pt").writeTo("t").append()
   spark.sql("SELECT * FROM t").show()
   ```
   
   ### What doesn't meet your expectations?
   
   The append succeeds, but the `SELECT` returns only `(1, old1, p1)`. The new 
row is lost without an error.
   
   SQL `INSERT INTO` and `INSERT OVERWRITE` on these tables are rewritten to 
Spark's V1 file write by `FallBackFileSourceV2`, which writes partition 
directories. DataFrame writes (`writeTo(...).append()` / `overwrite(...)`, 
`insertInto`, `INSERT ... REPLACE WHERE`) and RTAS (`CREATE OR REPLACE TABLE 
... AS SELECT`, `saveAsTable` in overwrite mode) go through Spark's V2 
`FileWrite`, which always writes with no partition columns. The files land in 
the table root, and the partitioned file index of `PartitionedCSVTable` and the 
other engine tables never reads them. RTAS replaces the table first and then 
writes the new rows the same way.
   
   CTAS into a partitioned engine format table is already rejected by 
`SparkCatalog.checkPartitionedFormatTableCtas`.
   
   ### Anything else?
   
   _No response_
   
   ### 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