Skip to content

[fix](streamingjob) Support precreated streaming job targets - #66950

Open
JNSimba wants to merge 5 commits into
apache:masterfrom
JNSimba:fix/streaming-pg-array-precreated-table
Open

[fix](streamingjob) Support precreated streaming job targets#66950
JNSimba wants to merge 5 commits into
apache:masterfrom
JNSimba:fix/streaming-pg-array-precreated-table

Conversation

@JNSimba

@JNSimba JNSimba commented Aug 19, 2026

Copy link
Copy Markdown
Member

What problem does this PR solve?

Issue Number: None

Related PR: None

Problem Summary: Streaming Job converted every source JDBC column and generated target DDL before checking whether the mapped Doris target table already existed. An unsupported source type therefore prevented CREATE JOB even when the user had already created a compatible target table. This change resolves the mapped target table first and skips source-to-Doris type conversion only when that target already exists. Source table identity, primary-key validation, excluded-primary-key validation, and automatic table creation for missing targets remain unchanged.

Release note

Allow FROM source TO DATABASE streaming jobs to use precreated target tables without requiring FE automatic type mapping.

Check List (For Author)

  • Test: Regression test added but not run as requested; expected output was derived from the deterministic query result
  • Behavior changed: Yes. Precreated targets bypass automatic source type conversion; missing targets preserve the existing behavior
  • Does this need documentation: No

@hello-stephen

Copy link
Copy Markdown
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?

@JNSimba
JNSimba requested a lite review from Copilot August 20, 2026 02:24
@JNSimba

JNSimba commented Aug 20, 2026

Copy link
Copy Markdown
Member Author

/review

@github-actions

Copy link
Copy Markdown
Contributor

Codex automated review failed and did not complete.

Error: All Codex review accounts are usage-limited; earliest retry is 2026-08-20T03:35:00Z.
Workflow run: https://github.com/apache/doris/actions/runs/32324539748

Please trigger /review again after that time.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes FE streaming job creation for FROM <source> TO DATABASE by allowing precreated Doris target tables to bypass JDBC source-column type mapping/DDL generation, avoiding failures when the source contains types unsupported by the automatic mapper.

Changes:

  • Update streaming job table-creation planning to detect existing target tables early and skip source-to-Doris column conversion/CREATE TABLE generation for those targets.
  • Adjust the streaming job creation flow to handle “maybe-create” semantics via Optional<CreateTableCommand>.
  • Add a Postgres CDC regression suite verifying CREATE JOB succeeds and data lands in a precreated target table even when the source uses a problematic type (ENUM).

Review Checkpoints (per skill guidance)

  • Goal & correctness: Largely achieved (precreated targets can bypass automatic type mapping), but there is one behavior regression to address (see stored PR comment) regarding exclude_columns validation when the target already exists.
  • Scope/focus: Changes are localized to streaming job utilities + job init path; the signature change is contained (single caller).
  • Concurrency: No new shared-state concurrency patterns introduced; logic runs during job initialization.
  • Config/compatibility: No new configs; API change is internal (method signature only used in one place).
  • Tests: New regression test and .out are added (external-docker PG); author notes it wasn’t run.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
regression-test/suites/job_p0/streaming_job/cdc/test_streaming_postgres_job_precreated_target.groovy New regression suite covering precreated target behavior with a PG ENUM source column.
regression-test/data/job_p0/streaming_job/cdc/test_streaming_postgres_job_precreated_target.out Expected output for the new regression query.
fe/fe-core/src/main/java/org/apache/doris/job/util/StreamingJobUtils.java Return optional CREATE TABLE commands; early-detect existing targets to skip column type conversion; refactor exclude-column validation helper.
fe/fe-core/src/main/java/org/apache/doris/job/extensions/insert/streaming/StreamingInsertJob.java Consume the new optional CREATE TABLE command mapping during job initialization.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@JNSimba JNSimba changed the title [fix](fe) Support precreated streaming job targets [fix](streamingjob) Support precreated streaming job targets Aug 20, 2026
@JNSimba

JNSimba commented Aug 20, 2026

Copy link
Copy Markdown
Member Author

run buildall

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

@hello-stephen

Copy link
Copy Markdown
Contributor
TPC-H: Total hot run time: 17477 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit 0e149383738e745e13d128068439a59284ab5ed8, data reload: false

------ Round 1 ----------------------------------
============================================
q1	17579	3132	3157	3132
q2	1889	239	163	163
q3	10451	922	519	519
q4	4678	258	201	201
q5	7665	587	391	391
q6	136	124	94	94
q7	543	506	389	389
q8	9247	900	990	900
q9	3521	2435	2414	2414
q10	6501	880	744	744
q11	448	257	242	242
q12	690	395	330	330
q13	17850	1529	1155	1155
q14	161	148	141	141
q15	q16	435	396	365	365
q17	845	821	761	761
q18	3123	2298	2245	2245
q19	1122	926	806	806
q20	676	544	442	442
q21	5304	1807	1937	1807
q22	329	266	236	236
Total cold run time: 93193 ms
Total hot run time: 17477 ms

----- Round 2, with runtime_filter_mode=off -----
============================================
q1	3537	3469	3458	3458
q2	225	216	161	161
q3	2264	2416	2155	2155
q4	1231	1220	921	921
q5	2238	2167	2166	2166
q6	177	126	88	88
q7	1038	932	895	895
q8	1650	1455	1444	1444
q9	3249	3193	3189	3189
q10	1869	1828	1642	1642
q11	367	282	262	262
q12	466	435	347	347
q13	1470	1556	1192	1192
q14	189	183	164	164
q15	q16	401	404	356	356
q17	1080	1061	1050	1050
q18	5053	4427	4843	4427
q19	876	824	843	824
q20	988	955	824	824
q21	3995	3208	3392	3208
q22	528	362	314	314
Total cold run time: 32891 ms
Total hot run time: 29087 ms

@hello-stephen

Copy link
Copy Markdown
Contributor
TPC-DS: Total hot run time: 84670 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpcds-tools
TPC-DS sf100 test result on commit 0e149383738e745e13d128068439a59284ab5ed8, data reload: false

query5	4256	417	351	351
query6	421	172	162	162
query7	4823	459	280	280
query8	289	129	122	122
query9	8716	2982	2975	2975
query10	449	262	252	252
query11	5397	1043	917	917
query12	116	74	74	74
query13	1210	467	356	356
query14	6121	2296	2191	2191
query14_1	2070	2048	2053	2048
query15	177	127	124	124
query16	932	387	373	373
query17	809	472	378	378
query18	2344	350	246	246
query19	170	145	128	128
query20	75	73	74	73
query21	223	122	102	102
query22	5336	5324	5319	5319
query23	6859	6306	5985	5985
query23_1	6320	6009	6156	6009
query24	7271	1109	795	795
query24_1	809	793	800	793
query25	440	311	274	274
query26	1255	273	170	170
query27	2715	445	309	309
query28	4613	1510	1508	1508
query29	957	475	362	362
query30	274	183	153	153
query31	867	433	361	361
query32	101	54	50	50
query33	477	225	190	190
query34	992	826	484	484
query35	421	410	355	355
query36	581	555	537	537
query37	123	87	77	77
query38	1009	877	823	823
query39	505	465	461	461
query39_1	476	455	459	455
query40	229	127	118	118
query41	59	58	58	58
query42	86	86	84	84
query43	249	244	212	212
query44	1050	556	562	556
query45	120	110	107	107
query46	799	833	522	522
query47	818	759	727	727
query48	325	307	219	219
query49	533	223	193	193
query50	870	343	263	263
query51	8366	8419	8426	8419
query52	101	80	65	65
query53	210	258	162	162
query54	250	197	172	172
query55	74	60	58	58
query56	231	229	219	219
query57	720	658	665	658
query58	242	210	195	195
query59	1242	1239	1123	1123
query60	271	232	200	200
query61	130	139	111	111
query62	370	218	196	196
query63	202	171	157	157
query64	2887	765	562	562
query65	1637	1617	1583	1583
query66	1804	309	250	250
query67	9890	9862	9683	9683
query68	3049	1170	802	802
query69	351	222	193	193
query70	656	639	626	626
query71	288	256	250	250
query72	2314	1762	1562	1562
query73	677	615	355	355
query74	2002	1251	1160	1160
query75	1243	1185	1033	1033
query76	2379	754	564	564
query77	251	256	207	207
query78	4067	3819	3345	3345
query79	2381	864	577	577
query80	1598	398	351	351
query81	485	196	180	180
query82	633	140	106	106
query83	363	259	241	241
query84	310	124	102	102
query85	872	449	391	391
query86	395	174	170	170
query87	1013	982	911	911
query88	2829	2158	2161	2158
query89	321	236	211	211
query90	1931	160	159	159
query91	161	146	129	129
query92	54	49	44	44
query93	1500	1191	828	828
query94	682	252	220	220
query95	625	440	383	383
query96	806	586	287	287
query97	1110	1065	1005	1005
query98	153	143	138	138
query99	429	376	323	323
Total cold run time: 180095 ms
Total hot run time: 84670 ms

@hello-stephen

Copy link
Copy Markdown
Contributor
ClickBench: Total hot run time: 14.76 s
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit 0e149383738e745e13d128068439a59284ab5ed8, data reload: false

query1	0.01	0.00	0.00
query2	0.08	0.04	0.04
query3	0.25	0.12	0.11
query4	1.60	0.10	0.10
query5	0.17	0.16	0.16
query6	1.26	0.70	0.68
query7	0.03	0.00	0.01
query8	0.04	0.03	0.03
query9	0.29	0.21	0.22
query10	0.35	0.37	0.35
query11	0.16	0.12	0.12
query12	0.16	0.12	0.12
query13	0.32	0.31	0.32
query14	0.45	0.45	0.46
query15	0.37	0.35	0.34
query16	0.24	0.21	0.23
query17	0.68	0.65	0.73
query18	0.18	0.18	0.18
query19	1.20	1.21	1.13
query20	0.01	0.01	0.01
query21	15.45	0.16	0.11
query22	5.08	0.04	0.04
query23	16.21	0.26	0.09
query24	3.02	0.33	0.29
query25	0.11	0.05	0.03
query26	0.73	0.17	0.12
query27	0.03	0.04	0.03
query28	3.71	0.58	0.29
query29	12.48	3.20	2.59
query30	0.25	0.14	0.14
query31	2.76	0.37	0.17
query32	3.52	0.32	0.24
query33	1.36	1.37	1.43
query34	15.39	2.22	1.81
query35	1.78	1.75	1.76
query36	0.45	0.30	0.28
query37	0.06	0.04	0.03
query38	0.05	0.03	0.03
query39	0.03	0.02	0.03
query40	0.11	0.09	0.07
query41	0.07	0.02	0.02
query42	0.03	0.03	0.02
query43	0.04	0.02	0.03
Total cold run time: 90.57 s
Total hot run time: 14.76 s

@JNSimba

JNSimba commented Aug 20, 2026

Copy link
Copy Markdown
Member Author

run feut

@JNSimba

JNSimba commented Aug 20, 2026

Copy link
Copy Markdown
Member Author

run p0

@hello-stephen

Copy link
Copy Markdown
Contributor

FE UT Coverage Report

Increment line coverage 5.00% (1/20) 🎉
Increment coverage report
Complete coverage report

@JNSimba

JNSimba commented Aug 20, 2026

Copy link
Copy Markdown
Member Author

/review

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review status: complete — converged after 3 rounds.

I am requesting changes for three substantiated issues: the existing-target shortcut still needs downstream CDC type-safety checks, generated target-existence states must be revalidated when consumed, and the committed regression result must be produced by the prescribed runner. The previously reported exclude_columns validation gap is fixed at this head and was treated as a duplicate fence.

Critical checkpoint conclusions

  • Goal and correctness: The focused change proves that a precreated compatible target can accept a supported non-key PostgreSQL enum without FE DDL mapping, but the broad bypass also admits schemas that fail snapshot splitting or silently omit values; see the first inline comment.
  • Scope and user focus: The four-file change is otherwise localized to generation/consumption of target DDL plus one regression suite. No additional user focus was supplied.
  • Concurrency and thread safety: Job initialization can overlap catalog create/drop operations. No new locks, lock-order, or deadlock issue was introduced, but the Optional protocol preserves unlocked catalog observations across remote JDBC work; both stale directions are covered by the second inline comment.
  • Lifecycle, error handling, and memory safety: CREATE-time reader setup does not classify the affected source types, so failures can be deferred until scheduled snapshot work after job registration. Local Java Optionals add no ownership, native-memory, C++ static-lifecycle, or BE nullable hazard; the material lifecycle/error issues are the first two comments.
  • Configuration and dynamic behavior: No configuration item or dynamic-reload contract is added. Doris also does not currently set or expose Debezium's unknown-type option, which is part of the first finding.
  • Compatibility, parallel paths, and conditions: The signature has one production caller and local test callers; generic erasure is unchanged, and no storage, wire, FE/BE, or rolling-upgrade format changes. Existing/missing, default/mapped/fan-in targets and all offset modes were traced. The new existence condition needs the execution-time recheck described inline.
  • Tests and generated results: The positive snapshot and invalid-exclusion cases cover the intended branch, and an extra incremental enum assertion was dismissed because snapshot and incremental records share the same deserializer/mapped writer while nearby suites cover incremental routing. Coverage is still missing for the accepted enum-key, unknown custom type, and stale target-state boundaries. The checked-in .out also lacks the mandated generated provenance; see the third comment.
  • Observability: Existing job/task diagnostics cover ordinary failures, but logging cannot make a silently omitted custom field correct; reject or handle that schema losslessly. No separate metrics issue was found.
  • Transactions, persistence, data writes, and FE/BE variables: There is no new EditLog schema, persisted field, transaction protocol, or FE/BE variable. Stream-load writes retain their existing transaction path, but source-value omission is a data-correctness failure and the non-atomic catalog observation can register a job against a missing target.
  • Performance: Skipping unnecessary FE type conversion for existing targets is the intended optimization, and raw schema fetch occurs only for non-empty exclusions. The only substantiated redundant work is the duplicate target DDL execution covered by the second comment.
  • Other issues: No additional distinct issue remained after the final changed-file, downstream-path, and live-thread sweep.

At the reviewed head, Compile, CheckStyle, FE/BE/Cloud UT, External Regression, NonConcurrent Regression, cloud regression, coverage, and performance checks are green; P0 Regression is failed, while FE coverage and the code-review workflow are pending. No local build or test was run, as required by this automated review environment.

@JNSimba

JNSimba commented Aug 20, 2026

Copy link
Copy Markdown
Member Author

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