danny0405 opened a new pull request, #20423:
URL: https://github.com/apache/hudi/pull/20423

   ### Describe the issue this Pull Request addresses
   
   Closes #20369.
   
   With HoodieCatalog, 
`df.write.format("hudi").mode("append").saveAsTable(...)` reaches 
`CreateHoodieTableAsSelectCommand` even when the table already exists. The 
command falls through to table initialization, which rejects an existing 
managed-table location instead of inserting the rows.
   
   ### Summary and Changelog
   
   - Handle existing-table append in the Spark 3 and Spark 4 commands by 
invoking `InsertIntoHoodieTableCommand` with catalog metadata and the existing 
partition specification.
   - Preserve normal insert configuration and table refresh, propagate write 
metrics, and return before CTAS initialization and cleanup.
   - Add eight regression cases covering COW/MOR, managed/external, and 
partitioned/unpartitioned tables. Verify existing rows, reordered input 
columns, table location, schema, partition columns, and persisted configuration.
   
   Validation: Spark 4.1 / Scala 2.13 reactor build passed; all 71 tests in 
`TestCreateTable` passed, including the eight new cases. Spark 3.5 / Scala 2.12 
clean reactor build and all eight append regression cases passed. Scala style 
checks passed for the shared SQL and Spark 4 command modules. `git diff 
--check` passed.
   
   ### Impact
   
   Restores append-by-name for existing Hudi tables under HoodieCatalog using 
their persisted configuration. No public API, configuration, or storage-format 
changes.
   
   ### Risk Level
   
   Low: the new branch applies only to append against an existing catalog table 
and delegates writing to the existing insert implementation. Other save modes 
and new-table CTAS retain their current paths. The full Spark 4.1 
table-creation suite passed.
   
   ### Documentation Update
   
   none — restores the expected behavior of the existing append API; no new 
feature or configuration.
   
   ### Contributor's checklist
   
   - [x] Read through [contributor's 
guide](https://hudi.apache.org/contribute/how-to-contribute)
   - [x] Enough context is provided in the sections above
   - [x] Adequate tests were added if applicable
   


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