Skip to content

[feature](load) Support show load for insert select progress#65203

Open
0AyanamiRei wants to merge 5 commits into
apache:masterfrom
0AyanamiRei:feature/insert-select-show-load-progress
Open

[feature](load) Support show load for insert select progress#65203
0AyanamiRei wants to merge 5 commits into
apache:masterfrom
0AyanamiRei:feature/insert-select-show-load-progress

Conversation

@0AyanamiRei

@0AyanamiRei 0AyanamiRei commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

What problem does this PR solve?

Issue Number: None

Related PR: None

Problem Summary:

INSERT INTO ... SELECT ... runs synchronously, but users need to observe its load progress from another SQL session through SHOW LOAD by label. Before this change, the running insert load job/progress information was not registered early enough for SHOW LOAD to provide useful runtime visibility.

This PR registers a running InsertLoadJob after transaction creation and sink finalization, initializes progress tracking after the job is registered, marks the job as LOADING during execution, and reuses the same job/statistics when the insert reaches FINISHED or CANCELLED. It also adds regression coverage for observing S3/TVF-source INSERT INTO SELECT runtime progress, including non-zero rows/bytes/file/backend details.

Release note

Support observing INSERT INTO SELECT load progress through SHOW LOAD.

Check List (For Author)

  • Test

    • 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
  • Behavior changed:

    • No.
    • Yes. SHOW LOAD can observe running INSERT INTO SELECT load jobs by label, including progress and job details.
  • Does this need documentation?

    • No.
    • Yes.

Check List (For Reviewer who merge this PR)

  • Confirm the release note
  • Confirm test cases
  • Confirm document
  • Add branch pick label

### What problem does this PR solve?

Issue Number: None

Related PR: None

Problem Summary: INSERT INTO SELECT is executed synchronously, but the runtime load job was not visible enough through SHOW LOAD from another SQL session. This change registers a running InsertLoadJob after transaction creation and sink finalization, initializes progress tracking, marks the job LOADING during execution, and keeps the same job/statistics through FINISHED or CANCELLED states. It also adds regression coverage for observing S3/TVF-source insert-select progress with SHOW LOAD.

### Release note

Support observing INSERT INTO SELECT load progress through SHOW LOAD.

### Check List (For Author)

- Test: Regression test / Unit Test / Manual test
    - Regression test: ./run-regression-test.sh --run -d load_p0/insert -s test_show_load_insert_runtime_observation -c 'jdbc:mysql://127.0.0.1:9035/?useLocalSessionState=true&allowLoadLocalInfile=true&zeroDateTimeBehavior=round' -ha 127.0.0.1:8035
    - Unit Test: ./run-fe-ut.sh --run org.apache.doris.load.loadv2.InsertLoadJobTest
    - Manual test: ./build.sh --fe -j60; git diff --check
- Behavior changed: Yes. SHOW LOAD can now show running INSERT INTO SELECT load jobs by label.
- 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?

### What problem does this PR solve?

Issue Number: None

Related PR: apache#65203

Problem Summary: Fix follow-up FE build failures in the INSERT INTO SELECT SHOW LOAD progress implementation. The previous local iteration left an unused import in AbstractInsertExecutor, missed imports required by InsertIntoTableCommand, and kept InsertLoadJobTest on the old initRunning signature. This change aligns the imports and test code with the current runtime registration implementation.

### Release note

None

### Check List (For Author)

- Test: Unit Test / Manual test
    - Unit Test: ./run-fe-ut.sh --run org.apache.doris.load.loadv2.InsertLoadJobTest
    - Manual test: ./build.sh --fe -j60; git diff --check for changed FE files
- Behavior changed: No.
- Does this need documentation: No
@0AyanamiRei

Copy link
Copy Markdown
Contributor Author

run buildall

@hello-stephen

Copy link
Copy Markdown
Contributor

FE Regression Coverage Report

Increment line coverage 80.85% (38/47) 🎉
Increment coverage report
Complete coverage report

@0AyanamiRei

Copy link
Copy Markdown
Contributor Author

run buildall

@hello-stephen

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

------ Round 1 ----------------------------------
============================================
q1	17648	3928	3907	3907
q2	2034	321	193	193
q3	10280	1417	880	880
q4	4685	479	340	340
q5	7485	828	575	575
q6	181	173	133	133
q7	774	828	615	615
q8	9732	1651	1580	1580
q9	6339	4371	4390	4371
q10	6806	1762	1502	1502
q11	509	341	303	303
q12	703	552	439	439
q13	18124	3390	2756	2756
q14	268	276	242	242
q15	q16	793	769	704	704
q17	1047	1058	974	974
q18	6749	5774	5582	5582
q19	1315	1257	1062	1062
q20	769	671	567	567
q21	5925	2636	2554	2554
q22	424	358	304	304
Total cold run time: 102590 ms
Total hot run time: 29583 ms

----- Round 2, with runtime_filter_mode=off -----
============================================
q1	4320	4210	4227	4210
q2	302	324	211	211
q3	4631	4902	4415	4415
q4	2046	2140	1361	1361
q5	4382	4346	4316	4316
q6	227	175	128	128
q7	1753	1983	1723	1723
q8	2449	2170	2119	2119
q9	7816	7821	7783	7783
q10	4709	4655	4288	4288
q11	564	414	391	391
q12	877	814	549	549
q13	3254	3608	2998	2998
q14	290	307	289	289
q15	q16	720	748	653	653
q17	1333	1330	1326	1326
q18	8030	7175	6861	6861
q19	1120	1066	1100	1066
q20	2210	2206	1925	1925
q21	5206	4509	4365	4365
q22	494	441	388	388
Total cold run time: 56733 ms
Total hot run time: 51365 ms

@hello-stephen

Copy link
Copy Markdown
Contributor
TPC-DS: Total hot run time: 172611 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 72a1b9cba9106b99db4eb3a4fc097c7e8fed5bec, data reload: false

query5	4309	651	481	481
query6	446	215	199	199
query7	4846	549	334	334
query8	335	193	171	171
query9	8792	3994	3979	3979
query10	480	343	320	320
query11	5941	2319	2127	2127
query12	162	100	101	100
query13	1257	607	383	383
query14	6214	5266	4933	4933
query14_1	4260	4238	4283	4238
query15	208	201	175	175
query16	1000	470	431	431
query17	1094	698	570	570
query18	2458	459	329	329
query19	196	181	139	139
query20	109	106	103	103
query21	226	148	131	131
query22	13610	13620	13337	13337
query23	17335	16454	16161	16161
query23_1	16140	16272	16260	16260
query24	7513	1745	1281	1281
query24_1	1328	1286	1301	1286
query25	565	462	394	394
query26	1352	352	209	209
query27	2577	635	380	380
query28	4506	2011	1995	1995
query29	1113	624	508	508
query30	339	272	227	227
query31	1131	1096	1000	1000
query32	102	63	61	61
query33	537	336	256	256
query34	1192	1165	686	686
query35	791	780	674	674
query36	1435	1378	1214	1214
query37	147	108	87	87
query38	1871	1653	1660	1653
query39	938	931	880	880
query39_1	890	876	884	876
query40	274	175	145	145
query41	71	73	71	71
query42	98	96	97	96
query43	328	335	297	297
query44	1462	786	773	773
query45	199	195	184	184
query46	1124	1184	742	742
query47	2372	2337	2265	2265
query48	448	404	282	282
query49	575	409	306	306
query50	1100	418	343	343
query51	4454	4360	4382	4360
query52	86	85	70	70
query53	265	262	209	209
query54	273	245	206	206
query55	75	68	65	65
query56	306	295	288	288
query57	1448	1398	1334	1334
query58	286	258	250	250
query59	1566	1666	1407	1407
query60	305	257	249	249
query61	150	148	151	148
query62	693	639	587	587
query63	244	203	208	203
query64	2478	760	586	586
query65	4846	4756	4746	4746
query66	1822	508	378	378
query67	29430	29447	28647	28647
query68	3191	1584	1006	1006
query69	420	296	256	256
query70	1061	960	948	948
query71	347	329	317	317
query72	3129	2572	2298	2298
query73	826	800	457	457
query74	5129	4980	4755	4755
query75	2616	2595	2209	2209
query76	2327	1179	803	803
query77	354	373	270	270
query78	12339	12551	11840	11840
query79	1355	1177	803	803
query80	658	547	444	444
query81	457	327	294	294
query82	560	156	121	121
query83	402	314	290	290
query84	291	163	132	132
query85	916	588	523	523
query86	375	299	267	267
query87	1825	1813	1746	1746
query88	3711	2815	2806	2806
query89	446	414	351	351
query90	2014	192	189	189
query91	201	184	162	162
query92	63	63	55	55
query93	1690	1676	1007	1007
query94	560	336	325	325
query95	775	496	435	435
query96	1044	838	369	369
query97	2688	2678	2552	2552
query98	212	207	197	197
query99	1178	1148	1032	1032
Total cold run time: 258167 ms
Total hot run time: 172611 ms

@hello-stephen

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

query1	0.01	0.00	0.01
query2	0.10	0.04	0.04
query3	0.25	0.13	0.14
query4	1.61	0.14	0.14
query5	0.28	0.22	0.22
query6	1.27	1.07	1.06
query7	0.04	0.02	0.00
query8	0.06	0.03	0.03
query9	0.37	0.31	0.32
query10	0.54	0.53	0.54
query11	0.20	0.14	0.14
query12	0.19	0.14	0.15
query13	0.47	0.48	0.46
query14	1.02	1.01	1.00
query15	0.61	0.61	0.58
query16	0.33	0.32	0.30
query17	1.10	1.12	1.11
query18	0.22	0.21	0.20
query19	2.04	1.87	1.90
query20	0.02	0.02	0.01
query21	15.44	0.20	0.13
query22	4.98	0.06	0.05
query23	16.12	0.30	0.12
query24	2.95	0.42	0.32
query25	0.12	0.05	0.05
query26	0.73	0.21	0.14
query27	0.04	0.04	0.03
query28	3.56	0.93	0.54
query29	12.56	4.27	3.48
query30	0.28	0.15	0.15
query31	2.77	0.60	0.31
query32	3.22	0.61	0.48
query33	3.20	3.20	3.25
query34	15.51	4.28	3.54
query35	3.50	3.54	3.54
query36	0.57	0.46	0.43
query37	0.10	0.07	0.06
query38	0.05	0.04	0.04
query39	0.04	0.03	0.03
query40	0.18	0.16	0.16
query41	0.09	0.03	0.02
query42	0.04	0.03	0.02
query43	0.04	0.04	0.04
Total cold run time: 96.82 s
Total hot run time: 25.15 s

@hello-stephen

Copy link
Copy Markdown
Contributor

FE Regression Coverage Report

Increment line coverage 80.85% (38/47) 🎉
Increment coverage report
Complete coverage report

@0AyanamiRei

Copy link
Copy Markdown
Contributor Author

run buildall

@hello-stephen

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

------ Round 1 ----------------------------------
============================================
q1	17710	4206	4237	4206
q2	2083	318	193	193
q3	10222	1447	845	845
q4	4688	468	333	333
q5	7667	858	584	584
q6	187	180	142	142
q7	810	843	629	629
q8	9370	1641	1627	1627
q9	6285	4393	4393	4393
q10	6816	1783	1512	1512
q11	534	354	338	338
q12	729	572	450	450
q13	18138	3354	2717	2717
q14	269	263	242	242
q15	q16	793	779	711	711
q17	983	954	1007	954
q18	7095	5897	5620	5620
q19	1296	1316	1112	1112
q20	730	647	584	584
q21	5842	2666	2538	2538
q22	441	369	311	311
Total cold run time: 102688 ms
Total hot run time: 30041 ms

----- Round 2, with runtime_filter_mode=off -----
============================================
q1	4512	4462	4441	4441
q2	315	307	207	207
q3	4673	4975	4494	4494
q4	2066	2190	1401	1401
q5	4532	4367	4469	4367
q6	235	181	135	135
q7	2215	1875	1703	1703
q8	2753	2316	2346	2316
q9	7730	7935	7953	7935
q10	4693	4712	4246	4246
q11	776	463	429	429
q12	794	754	566	566
q13	3265	3740	3050	3050
q14	321	332	286	286
q15	q16	751	757	643	643
q17	1414	1368	1362	1362
q18	8249	7558	6915	6915
q19	1138	1121	1124	1121
q20	2238	2229	1964	1964
q21	5447	4792	4740	4740
q22	541	478	397	397
Total cold run time: 58658 ms
Total hot run time: 52718 ms

@hello-stephen

Copy link
Copy Markdown
Contributor
TPC-DS: Total hot run time: 173870 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 f48b8b214809dafd489afa4aac6d97932a911d60, data reload: false

query5	4340	632	489	489
query6	466	217	216	216
query7	4864	592	359	359
query8	344	192	170	170
query9	8757	4106	4079	4079
query10	453	353	293	293
query11	5959	2343	2195	2195
query12	157	102	100	100
query13	1293	616	439	439
query14	6258	5315	4986	4986
query14_1	4341	4325	4303	4303
query15	221	215	184	184
query16	1009	473	458	458
query17	959	722	596	596
query18	2443	485	350	350
query19	210	189	149	149
query20	119	106	116	106
query21	239	156	137	137
query22	13725	13674	13432	13432
query23	17468	16661	16195	16195
query23_1	16393	16331	16272	16272
query24	7520	1773	1300	1300
query24_1	1334	1289	1321	1289
query25	577	463	395	395
query26	1331	372	214	214
query27	2571	575	357	357
query28	4468	1974	1999	1974
query29	1104	633	506	506
query30	344	276	231	231
query31	1129	1095	990	990
query32	110	63	62	62
query33	539	330	273	273
query34	1570	1123	651	651
query35	778	815	679	679
query36	1377	1464	1321	1321
query37	162	119	92	92
query38	1927	1740	1697	1697
query39	967	953	912	912
query39_1	917	913	935	913
query40	256	166	164	164
query41	68	66	63	63
query42	95	91	93	91
query43	329	346	297	297
query44	1524	805	765	765
query45	208	187	177	177
query46	1085	1191	752	752
query47	2378	2358	2227	2227
query48	402	450	277	277
query49	587	418	323	323
query50	1050	402	326	326
query51	4376	4407	4394	4394
query52	86	86	76	76
query53	261	283	209	209
query54	288	237	211	211
query55	76	77	66	66
query56	291	294	281	281
query57	1442	1399	1366	1366
query58	295	260	232	232
query59	1606	1708	1443	1443
query60	301	276	255	255
query61	156	154	164	154
query62	695	653	591	591
query63	246	206	210	206
query64	2551	774	608	608
query65	4923	4821	4812	4812
query66	1819	513	382	382
query67	29565	29568	28762	28762
query68	3131	1650	985	985
query69	418	308	260	260
query70	1085	976	961	961
query71	350	310	295	295
query72	2908	2660	2346	2346
query73	891	840	414	414
query74	5142	5027	4825	4825
query75	2598	2596	2222	2222
query76	2354	1210	791	791
query77	362	379	282	282
query78	12494	12610	11927	11927
query79	1484	1191	778	778
query80	1302	538	470	470
query81	557	326	283	283
query82	667	154	117	117
query83	368	312	291	291
query84	324	160	130	130
query85	1036	628	507	507
query86	444	292	287	287
query87	1839	1837	1752	1752
query88	3785	2835	2819	2819
query89	459	404	352	352
query90	1867	198	193	193
query91	203	192	160	160
query92	66	61	54	54
query93	1801	1522	1082	1082
query94	747	357	317	317
query95	772	519	562	519
query96	1089	820	378	378
query97	2698	2703	2540	2540
query98	216	207	199	199
query99	1203	1152	1040	1040
Total cold run time: 260585 ms
Total hot run time: 173870 ms

@hello-stephen

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

query1	0.00	0.00	0.00
query2	0.10	0.05	0.04
query3	0.26	0.13	0.14
query4	1.61	0.14	0.14
query5	0.24	0.21	0.22
query6	1.23	1.13	1.07
query7	0.04	0.01	0.01
query8	0.06	0.04	0.04
query9	0.38	0.31	0.32
query10	0.57	0.57	0.56
query11	0.20	0.14	0.14
query12	0.19	0.15	0.14
query13	0.46	0.48	0.47
query14	1.03	1.00	0.99
query15	0.60	0.59	0.62
query16	0.30	0.31	0.32
query17	1.14	1.08	1.13
query18	0.24	0.21	0.21
query19	1.99	2.06	1.99
query20	0.01	0.01	0.01
query21	15.43	0.19	0.14
query22	4.98	0.06	0.05
query23	16.08	0.31	0.13
query24	2.98	0.41	0.34
query25	0.12	0.04	0.04
query26	0.83	0.22	0.14
query27	0.05	0.04	0.03
query28	3.54	0.91	0.56
query29	12.47	4.39	3.47
query30	0.27	0.15	0.16
query31	2.78	0.56	0.31
query32	3.22	0.60	0.49
query33	3.16	3.31	3.24
query34	15.67	4.21	3.51
query35	3.56	3.54	3.57
query36	0.58	0.43	0.40
query37	0.09	0.06	0.06
query38	0.05	0.04	0.04
query39	0.04	0.03	0.03
query40	0.18	0.17	0.15
query41	0.08	0.03	0.02
query42	0.05	0.03	0.03
query43	0.04	0.04	0.04
Total cold run time: 96.9 s
Total hot run time: 25.35 s

@hello-stephen

Copy link
Copy Markdown
Contributor

FE Regression Coverage Report

Increment line coverage 3.93% (25/636) 🎉
Increment coverage report
Complete coverage report

### What problem does this PR solve?

Issue Number: None

Related PR: apache#65203

Problem Summary: INSERT INTO SELECT is executed synchronously, but the runtime SHOW LOAD observation path temporarily initialized the InsertLoadJob as PENDING before marking it LOADING at execution start. PENDING is part of the asynchronous load scheduler lifecycle and can be misleading for synchronous INSERT jobs. This change initializes the runtime InsertLoadJob directly as LOADING after transaction and sink initialization, removes the separate markLoading transition, and updates the focused unit test to assert the direct LOADING semantics.

### Release note

None

### Check List (For Author)

- Test: Unit Test / Manual test
    - Unit Test: ./run-fe-ut.sh --run org.apache.doris.load.loadv2.InsertLoadJobTest
    - Manual test: git diff --check
- Behavior changed: No. Internal state management is simplified while preserving SHOW LOAD runtime observation.
- Does this need documentation: No
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.

2 participants