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

   ### What problem does this PR solve? 
    
   Issue Number: close #56005 
    
   Related PR: #xxx 
    
   Problem Summary: 
    
   This PR implements Doris write-back support for Paimon external tables 
(`INSERT INTO ...`), completing the end-to-end write path across FE and BE, 
including planning, sink serialization, execution, and FE-side commit. 
    
   #### 1) Core capability 
   - Support writing data from Doris into Paimon external tables. 
   - Support both writer paths: 
     - **Native Writer (paimon-cpp)**: High-performance C++ native writer path 
(Default).
     - **JNI Writer**: Java-based writer path for complex scenarios and 
compatibility.
    
   #### 2) FE/BE write pipeline integration 
   - **FE**: 
     - Add Paimon insert executor flow. 
     - Build and send Paimon sink metadata (table 
identity/location/options/column names/shuffle info). 
     - Collect commit payload from BE and commit on FE side. 
   - **BE**: 
     - Execute Paimon sink writing. 
     - Build commit payload and report back to FE. 
    
   #### 3) Bucket/partition write behavior 
   - Add distributed bucket shuffle support for bucketed Paimon tables. 
   - Add compatible fallback behavior (e.g. gather/random) when required bucket 
keys are not resolvable. 
   - Keep partition-related write behavior aligned with existing sink 
framework. 
    
   #### 4) Limitations of Native Writer (paimon-cpp)
   Currently, the high-performance Native Writer is the default path, but it 
has some functional limitations compared to the JNI Writer. When these 
scenarios are encountered, users must fallback to the JNI Writer (`set 
enable_paimon_jni_writer = true`):
   - **Dynamic Bucket (`bucket = -1`)**: Not supported. Native Writer currently 
only supports fixed bucket tables.
   - **Inline Compaction**: Not supported. Native Writer operates in write-only 
mode without compaction capabilities during the write process.
   - **Memory Spill**: Not supported. Native Writer lacks disk spill logic when 
memory buffers are exhausted.
   - **File Formats**: Strictly limited to `parquet` for both data files and 
manifest files.
   
   #### 5) Session variables and write tunables 
   This PR introduces/uses Paimon-related session controls for write behavior 
and performance tuning. 
   
   **Execution Path & Shuffle Control**
   - `enable_paimon_jni_writer` (Default: `false`): Switch to JNI writer path 
instead of native paimon-cpp.
   - `enable_paimon_distributed_bucket_shuffle` (Default: `true`): Enable 
distributed bucket shuffle for Paimon tables.
   
   **Memory & Buffer Tuning**
   - `paimon_global_memory_pool_size` (Default: `1073741824L` / 1GB): Global 
memory pool size for Paimon writer.
   - `paimon_write_buffer_size` (Default: `268435456L` / 256MB): Memory buffer 
size per writer.
   - `enable_paimon_adaptive_buffer_size` (Default: `false`): Enable adaptive 
adjustment of buffer sizes.
   - `paimon_writer_queue_size` (Default: `3`): Queue size for writer tasks.
   - `paimon_target_file_size` (Default: `268435456L` / 256MB): Target size for 
generated data files.
   
   **JNI Spill & Compaction Control (Only applicable when 
`enable_paimon_jni_writer=true`)**
   - `enable_paimon_jni_compact` (Default: `true`): Enable inline compaction 
during JNI writing.
   - `enable_paimon_jni_spill` (Default: `false`): Enable memory spilling to 
disk.
   - `paimon_spill_max_disk_size` (Default: `53687091200L` / 50GB): Maximum 
disk space allowed for spilling.
   - `paimon_spill_sort_buffer_size` (Default: `67108864L` / 64MB): Buffer size 
for sorting during spill.
   - `paimon_spill_sort_threshold` (Default: `10`): Threshold triggering sort 
operation.
   - `paimon_spill_compression` (Default: `"zstd"`): Compression codec used for 
spilled files.
    
   #### 6) Compatibility/alignment work 
   - Align merged code with current community branch conventions and 
dependencies. 
   - Resolve compile/checkstyle conflicts introduced by branch differences. 
   - Ensure FE build passes under Maven >= 3.9 environment.
   
   
   #### 7) Current recommendation for production usage
   - **Prefer JNI Writer in production for now**: it is currently the safer 
path for large-scale write workloads.
   - **Enable spill for large data volume**: for big batches, it is recommended 
to set `enable_paimon_jni_spill = true` to reduce memory pressure and avoid 
excessive memory usage.
   - **Native Writer roadmap dependency**: Native Writer can be the default 
high-performance path later, but full production readiness for heavy workloads 
still depends on paimon-cpp upstream support for **compaction** and **spill**.


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