Skip to content

branch-4.1: [Improve](streaming job) support custom table name mapping for CDC streaming job #61317#61605

Open
github-actions[bot] wants to merge 1 commit intobranch-4.1from
auto-pick-61317-branch-4.1
Open

branch-4.1: [Improve](streaming job) support custom table name mapping for CDC streaming job #61317#61605
github-actions[bot] wants to merge 1 commit intobranch-4.1from
auto-pick-61317-branch-4.1

Conversation

@github-actions
Copy link
Contributor

Cherry-picked from #61317

…reaming job (#61317)

### What problem does this PR solve?

 #### Summary

Add support for mapping upstream (PostgreSQL) table names to custom
downstream (Doris) table names
in CDC streaming jobs. Without this feature, the Doris target table must
have the same name as the
  upstream source table.

 #### New configuration

Key format: `"table.<srcTable>.target_table" = "<dstTable>"` in the
`FROM` clause properties.

  ```sql
  CREATE JOB my_job
    ON STREAMING
    FROM POSTGRES (
      ...
      "include_tables" = "pg_orders",
      "table.pg_orders.target_table" = "doris_orders"
    )
    TO DATABASE mydb (...)
```

  When not configured, behavior is unchanged (target table name = source table name).

#### Key design decisions

  - generateCreateTableCmds returns LinkedHashMap<srcName, CreateTableCommand> so callers can
  distinguish source names (for CDC monitoring) from target names (for DDL) — this fixes a bug
  where the CDC split assigner would look up the Doris target table name in PostgreSQL
  - Multi-table merge is supported: two source tables can map to the same Doris table

#### Test plan

  - test_streaming_postgres_job_table_mapping: basic mapping (INSERT/UPDATE/DELETE land in mapped table; Doris table
  created with target name, not source name)
  - test_streaming_postgres_job_table_mapping: multi-table merge (two PG tables → one Doris table, snapshot +
  incremental)
@github-actions github-actions bot requested a review from yiguolei as a code owner March 23, 2026 02:30
@hello-stephen
Copy link
Contributor

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR.

Please clearly describe your PR:

  1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
  2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
  3. What features were added. Why was this function added?
  4. Which code was refactored and why was this part of the code refactored?
  5. Which functions were optimized and what is the difference before and after the optimization?

@dataroaring dataroaring reopened this Mar 23, 2026
@hello-stephen
Copy link
Contributor

run buildall

@hello-stephen
Copy link
Contributor

FE UT Coverage Report

Increment line coverage 0.00% (0/12) 🎉
Increment coverage report
Complete coverage report

@JNSimba
Copy link
Member

JNSimba commented Mar 23, 2026

run p0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants