JNSimba opened a new pull request, #61317:
URL: https://github.com/apache/doris/pull/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)
### Release note
None
### Check List (For Author)
- Test <!-- At least one of them must be included. -->
- [ ] Regression test
- [ ] Unit Test
- [ ] Manual test (add detailed scripts or steps below)
- [ ] No need to test or manual test. Explain why:
- [ ] This is a refactor/code format and no logic has been changed.
- [ ] Previous test can cover this change.
- [ ] No code files have been changed.
- [ ] Other reason <!-- Add your reason? -->
- Behavior changed:
- [ ] No.
- [ ] Yes. <!-- Explain the behavior change -->
- Does this need documentation?
- [ ] No.
- [ ] Yes. <!-- Add document PR link here. eg:
https://github.com/apache/doris-website/pull/1214 -->
### Check List (For Reviewer who merge this PR)
- [ ] Confirm the release note
- [ ] Confirm test cases
- [ ] Confirm document
- [ ] Add branch pick label <!-- Add branch pick label that this PR should
merge into -->
--
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]