suxiaogang223 opened a new pull request, #70566:
URL: https://github.com/apache/doris/pull/70566

   ### Background
   
   External INSERT and INSERT OVERWRITE use connector write providers. Iceberg 
supports branch writes, but Paimon cannot select a branch as the write 
destination. Binding, routing and sink construction need to use the same 
destination metadata independently of source scans.
   
   ### What problem does this PR solve?
   
   Issue Number: #67336
   Related PR: None
   PR Type: Feature
   
   Problem Summary:
   
   Support Paimon INSERT and INSERT OVERWRITE with the existing `@branch(name)` 
syntax. Capture an explicit connector write target before normalization and 
retain it through FE planning and sink binding. Move Iceberg INSERT onto this 
shared path while preserving its schema and transaction validation rules.
   
   ### Details
   
   - **Change map:** 724 changed production Java lines, 327 test/baseline lines 
and two build metadata lines. The change covers the connector SPI, FE target 
propagation, and the Paimon/Iceberg providers.
   - **Scope:** Ordinary and branch-targeted INSERT/INSERT OVERWRITE. Branch 
lifecycle operations and branch row-level DML remain follow-up work under 
#67336.
   - **Design:** `ConnectorWriteTarget` retains native metadata inside each 
connector and flows through logical/physical sink copies, distribution, 
sorting, static partition validation, EXPLAIN and final sink construction. 
Paimon binds the requested branch's latest physical schema, retains runtime 
overrides and catalog callbacks, and removes read selectors. Iceberg reuses 
`IcebergWriteSchemaContext` and its existing begin/commit validation; read 
snapshot constraints remain separate.
   - **Usage:** `INSERT INTO t@branch(audit) VALUES (...)` and `INSERT 
OVERWRITE TABLE t@branch(audit) SELECT ...`. Existing static partition syntax 
is retained.
   - **Default behavior:** An omitted branch writes main. Paimon uses the 
destination branch's latest schema, including schema-only changes newer than 
its data snapshot. Iceberg continues using the table-current schema.
   - **Compatibility:** Connector plugin API advances from 30.0 to 31.0; 
external plugins need rebuilding for the new API. Providers that do not resolve 
explicit targets retain the existing path. No Thrift, protobuf or BE changes.
   - **Behavior change:** Paimon accepts branch INSERT/OVERWRITE and keeps 
writer serialization and FE commit bound to that branch.
   
   ### Testing
   
   - Standalone Checkstyle 9.3 with the repository configuration passed for all 
26 changed Java files, including tests; repeated after rebasing onto current 
master.
   - `git diff --check` passed.
   - Compilation, unit tests and SQL regression tests have **not** been run.
   - Added Paimon tests for latest branch schemas with and without data 
snapshots, main, read-policy isolation, runtime options, schema drift, invalid 
targets, serialized branch identity and overwrite commit isolation.
   - Adapted Iceberg/FE tests for explicit targets, optimizer copies, MVCC 
decoration and prepared-execution reset.
   - The plugin surface baseline was updated from the interface signatures. 
Reflection regeneration and the SPI suite remain pending; the ConnectorMetadata 
interface and its baseline are unchanged.
   
   ### Release note
   
   Paimon catalogs support INSERT and INSERT OVERWRITE to named branches with 
`@branch(name)`. These writes use the branch's latest schema. Connector plugin 
API advances to 31.0.
   
   ### Check List (For Author)
   
   - Behavior changed: Yes (see Details)
   - Does this need documentation: Yes; document Paimon branch-write syntax and 
schema semantics in apache/doris-website before marking ready.
   - Pre-submission status: Not ready: format-checked draft awaiting code 
review, compilation, SPI validation and unit/SQL regression execution.
   
   ### AI Disclosure
   
   - Tool: Codex, GPT-6
   - Generated: Implementation, test changes and this description
   - Human review: Pending
   
   


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