Skip to content

[fix](mtmv) Preserve origin statement for internal refresh - #68269

Merged
morrySnow merged 3 commits into
apache:masterfrom
morrySnow:fix/mtmv-origin-statement
Sep 24, 2026
Merged

morrySnow merged 3 commits into
apache:masterfrom
morrySnow:fix/mtmv-origin-statement

Conversation

@morrySnow

@morrySnow morrySnow commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

What problem does this PR solve?

Issue Number: None

Problem Summary:

Internally constructed MTMV refresh commands could lose their origin statement. Complete refreshes created a StatementContext without the MV query, while StmtExecutor copied a null LogicalPlanAdapter origin back into contexts that already had one. Complete and partition refreshes now use the MV query as their origin and pass the same origin to the adapter.

Incremental refresh and incremental dry run had a related parsing order bug: an MV definition with a SET_VAR hint was parsed before its new StatementContext was installed on the internal ConnectContext. Hint parsing reads that context and could fail with a null dereference. Both paths now install the origin-bearing context before parsing the MV query. The existing dry-run regression case uses a hinted MV definition to cover both refresh paths.

Release note

Fix internal materialized view refresh planning to retain its originating SQL statement, and allow incremental refresh and dry run of MV queries containing SET_VAR hints.

Check List (For Author)

  • Test: Unit Test
    • ./run-fe-ut.sh --run org.apache.doris.mtmv.ivm.IvmIncrRefreshManagerTest,org.apache.doris.nereids.trees.plans.commands.RefreshMTMVCommandTest (26 passed)
    • ./run-fe-ut.sh --run org.apache.doris.nereids.trees.plans.CreateMTMVCommandTest,org.apache.doris.mtmv.MTMVTaskTest,org.apache.doris.nereids.trees.plans.commands.UpdateMvByPartitionCommandTest (155 passed)
    • mvn -pl fe-core checkstyle:check -DskipTests -Dmaven.build.cache.enabled=false -q (passed)
  • Behavior changed: Yes. Incremental refresh and dry run can parse MV queries containing SET_VAR hints.
  • Does this need documentation: No

### What problem does this PR solve?

Problem Summary:

Internally constructed MTMV refresh commands could lose their origin statement. Complete refreshes created a StatementContext without the MV query, while StmtExecutor copied a null LogicalPlanAdapter origin back into contexts that already had one.

Initialize complete-refresh contexts with the MV query and propagate the same OriginStatement to the LogicalPlanAdapter before executor construction.

### Release note

Fix internal materialized view refresh planning to retain its originating SQL statement.

### Check List (For Author)

- Test: Unit Test
- Behavior changed: No
- 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?

@morrySnow

Copy link
Copy Markdown
Contributor Author

run buildall

@morrySnow

Copy link
Copy Markdown
Contributor Author

/review

@github-actions

Copy link
Copy Markdown
Contributor

Codex automated review failed and did not complete.

Error: Selected model is at capacity. Please try a different model.
Workflow run: https://github.com/apache/doris/actions/runs/35502865543

Please inspect the workflow logs and rerun the review after the underlying issue is resolved.

@hello-stephen

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

------ Round 1 ----------------------------------
============================================
q1	17632	3840	3857	3840
q2	2151	363	301	301
q3	10112	1389	774	774
q4	4681	471	349	349
q5	7474	827	548	548
q6	178	170	137	137
q7	731	795	579	579
q8	9286	1429	1463	1429
q9	5391	4170	4117	4117
q10	6812	1313	1007	1007
q11	423	270	233	233
q12	626	418	290	290
q13	18102	2619	2005	2005
q14	255	255	234	234
q15	q16	733	711	655	655
q17	1756	1146	990	990
q18	6461	5557	5553	5553
q19	1169	1218	1040	1040
q20	478	395	260	260
q21	5424	3040	2951	2951
q22	461	347	313	313
Total cold run time: 100336 ms
Total hot run time: 27605 ms

----- Round 2, with runtime_filter_mode=off -----
============================================
q1	4524	4480	4372	4372
q2	705	570	526	526
q3	4728	5129	4569	4569
q4	2202	2372	1462	1462
q5	4527	4495	4285	4285
q6	230	175	136	136
q7	1819	1759	1563	1563
q8	2356	1988	1974	1974
q9	7580	7264	6820	6820
q10	3634	3520	3067	3067
q11	510	366	344	344
q12	710	701	501	501
q13	2264	2595	1988	1988
q14	289	281	255	255
q15	q16	659	677	610	610
q17	7275	6691	6581	6581
q18	11896	11060	11703	11060
q19	1073	970	979	970
q20	2185	2187	1900	1900
q21	4890	4030	4251	4030
q22	514	449	405	405
Total cold run time: 64570 ms
Total hot run time: 57418 ms

@hello-stephen

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

query5	4298	575	462	462
query6	437	219	207	207
query7	5037	572	305	305
query8	315	173	162	162
query9	8792	4004	3962	3962
query10	462	297	248	248
query11	5801	3517	3205	3205
query12	145	92	83	83
query13	1251	569	410	410
query14	6509	4503	4202	4202
query14_1	3996	3957	3956	3956
query15	203	200	181	181
query16	994	449	417	417
query17	935	669	537	537
query18	2427	475	340	340
query19	203	178	143	143
query20	81	81	80	80
query21	219	131	115	115
query22	13133	13036	12721	12721
query23	13947	13067	12570	12570
query23_1	12504	12510	12421	12421
query24	7247	1110	660	660
query24_1	694	669	718	669
query25	555	448	383	383
query26	1284	301	169	169
query27	2672	557	327	327
query28	4588	1999	1971	1971
query29	1656	737	552	552
query30	304	216	180	180
query31	903	784	639	639
query32	150	98	98	98
query33	526	323	249	249
query34	1199	1086	642	642
query35	740	752	635	635
query36	799	780	717	717
query37	145	109	96	96
query38	1827	1780	1667	1667
query39	700	693	648	648
query39_1	646	641	649	641
query40	229	130	105	105
query41	73	73	67	67
query42	94	92	92	92
query43	343	350	310	310
query44	1380	722	707	707
query45	190	180	172	172
query46	1048	1169	744	744
query47	1510	1509	1403	1403
query48	436	425	290	290
query49	585	405	290	290
query50	984	341	256	256
query51	10509	10047	10404	10047
query52	84	89	76	76
query53	231	264	184	184
query54	245	211	197	197
query55	76	72	68	68
query56	233	222	206	206
query57	1623	1384	1295	1295
query58	273	261	256	256
query59	1994	2058	1865	1865
query60	280	236	223	223
query61	152	151	146	146
query62	392	316	270	270
query63	220	179	172	172
query64	2799	1030	830	830
query65	3442	3382	3403	3382
query66	1796	426	305	305
query67	20055	19891	19704	19704
query68	3310	1469	921	921
query69	428	298	256	256
query70	888	786	817	786
query71	288	235	217	217
query72	2643	2515	2116	2116
query73	874	797	428	428
query74	4644	4506	4307	4307
query75	2268	2305	1953	1953
query76	2337	1088	809	809
query77	388	400	321	321
query78	9034	9113	8598	8598
query79	1357	1177	766	766
query80	576	450	358	358
query81	551	317	277	277
query82	623	159	124	124
query83	310	223	194	194
query84	321	146	116	116
query85	864	471	375	375
query86	344	225	233	225
query87	1974	1951	1832	1832
query88	3619	2732	2701	2701
query89	350	288	241	241
query90	1932	179	178	178
query91	169	156	129	129
query92	102	80	89	80
query93	1528	1403	807	807
query94	545	336	305	305
query95	681	450	348	348
query96	1014	765	321	321
query97	2432	2428	2304	2304
query98	161	149	143	143
query99	717	723	633	633
Total cold run time: 236479 ms
Total hot run time: 151814 ms

@hello-stephen

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

query1	0.00	0.00	0.00
query2	0.09	0.05	0.05
query3	0.25	0.14	0.14
query4	1.60	0.14	0.13
query5	0.23	0.21	0.21
query6	1.15	0.95	0.92
query7	0.04	0.01	0.00
query8	0.06	0.04	0.03
query9	0.39	0.34	0.36
query10	0.54	0.55	0.56
query11	0.20	0.14	0.15
query12	0.18	0.14	0.14
query13	0.46	0.47	0.46
query14	0.96	0.95	0.95
query15	0.60	0.57	0.61
query16	0.34	0.31	0.32
query17	1.05	1.04	1.09
query18	0.22	0.20	0.20
query19	2.02	1.89	1.94
query20	0.02	0.01	0.02
query21	15.41	0.22	0.16
query22	4.72	0.05	0.05
query23	16.11	0.31	0.12
query24	2.98	0.44	0.33
query25	0.12	0.04	0.04
query26	0.74	0.21	0.14
query27	0.04	0.03	0.04
query28	3.54	0.72	0.36
query29	12.54	4.08	3.20
query30	0.28	0.15	0.14
query31	2.77	0.56	0.31
query32	3.21	0.60	0.48
query33	3.26	3.25	3.24
query34	15.64	3.94	3.25
query35	3.26	3.18	3.27
query36	0.54	0.42	0.42
query37	0.10	0.06	0.07
query38	0.06	0.04	0.03
query39	0.04	0.03	0.03
query40	0.19	0.16	0.14
query41	0.08	0.03	0.04
query42	0.04	0.03	0.03
query43	0.04	0.04	0.03
Total cold run time: 96.11 s
Total hot run time: 23.88 s

@hello-stephen

Copy link
Copy Markdown
Contributor

FE UT Coverage Report

Increment line coverage 100.00% (5/5) 🎉
Increment coverage report
Complete coverage report

1 similar comment
@hello-stephen

Copy link
Copy Markdown
Contributor

FE UT Coverage Report

Increment line coverage 100.00% (5/5) 🎉
Increment coverage report
Complete coverage report

yiguolei pushed a commit that referenced this pull request Sep 21, 2026
### What problem does this PR solve?

Issue Number: None

Related PR: #68269

Problem Summary:

Internal MTMV refresh tasks could construct a StatementContext and
LogicalPlanAdapter without an origin statement. StmtExecutor then copied
the null adapter origin back into the context. If CBO candidate costing
failed, CostBasedRewriteJob dereferenced that missing origin while
logging and raised an unrelated NullPointerException.

This change initializes refresh planning with the MV query, propagates
the same origin through the adapter, and makes the CBO failure log
tolerate internal contexts without an origin statement.

### Release note

Fix internal materialized view refresh failures caused by a missing
origin statement.

### Check List (For Author)

- Test: Unit Test
- ./run-fe-ut.sh --run
org.apache.doris.mtmv.MTMVTaskTest,org.apache.doris.nereids.jobs.rewrite.CostBasedRewriteJobTest
  - 17 tests passed
- Behavior changed: No
- Does this need documentation: No
…tatement

# Conflicts:
#	fe/fe-core/src/main/java/org/apache/doris/job/extensions/mtmv/MTMVTask.java
@morrySnow

Copy link
Copy Markdown
Contributor Author

run buildall

@hello-stephen

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

------ Round 1 ----------------------------------
============================================
q1	17706	3886	3860	3860
q2	2207	362	317	317
q3	10089	1394	787	787
q4	4677	476	347	347
q5	7464	821	560	560
q6	187	180	137	137
q7	785	812	594	594
q8	9323	1568	1560	1560
q9	5411	4176	4166	4166
q10	6825	1339	1020	1020
q11	430	265	244	244
q12	632	416	297	297
q13	18099	2650	2015	2015
q14	264	253	235	235
q15	q16	757	717	661	661
q17	1834	1160	991	991
q18	6586	5605	5596	5596
q19	1292	1223	1055	1055
q20	469	393	264	264
q21	5721	3412	3117	3117
q22	463	360	306	306
Total cold run time: 101221 ms
Total hot run time: 28129 ms

----- Round 2, with runtime_filter_mode=off -----
============================================
q1	4714	4721	4802	4721
q2	751	586	566	566
q3	5232	5218	4618	4618
q4	2224	2317	1440	1440
q5	4578	4365	4669	4365
q6	238	177	126	126
q7	1850	1707	1505	1505
q8	2423	2084	2029	2029
q9	7287	7283	7276	7276
q10	3683	3626	3072	3072
q11	510	371	345	345
q12	716	715	494	494
q13	2302	2617	2025	2025
q14	281	270	254	254
q15	q16	681	690	600	600
q17	7329	6797	6653	6653
q18	11865	11064	11711	11064
q19	1112	1001	1004	1001
q20	2202	2197	1910	1910
q21	5012	4160	4278	4160
q22	502	436	410	410
Total cold run time: 65492 ms
Total hot run time: 58634 ms

@hello-stephen

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

query5	4311	602	467	467
query6	429	214	194	194
query7	4876	526	285	285
query8	317	178	168	168
query9	8814	3994	4019	3994
query10	473	299	261	261
query11	5806	3545	3211	3211
query12	151	87	86	86
query13	1269	551	394	394
query14	6517	4491	4242	4242
query14_1	3980	3966	3910	3910
query15	208	198	178	178
query16	1025	468	369	369
query17	932	683	553	553
query18	2428	484	343	343
query19	208	179	141	141
query20	83	79	82	79
query21	222	133	116	116
query22	13069	13074	12824	12824
query23	14036	13068	12426	12426
query23_1	12575	12681	12469	12469
query24	7328	1203	688	688
query24_1	720	666	639	639
query25	569	445	386	386
query26	1252	311	164	164
query27	2738	522	330	330
query28	4576	1988	1967	1967
query29	1658	748	536	536
query30	306	216	180	180
query31	894	760	641	641
query32	151	99	94	94
query33	523	318	260	260
query34	1180	1063	651	651
query35	732	761	649	649
query36	791	794	709	709
query37	147	102	92	92
query38	1810	1765	1705	1705
query39	699	715	659	659
query39_1	636	650	659	650
query40	226	128	109	109
query41	73	74	70	70
query42	98	94	96	94
query43	333	347	296	296
query44	1361	728	724	724
query45	181	179	168	168
query46	1059	1243	738	738
query47	1520	1506	1400	1400
query48	427	410	269	269
query49	583	408	285	285
query50	1013	345	252	252
query51	10665	10501	10523	10501
query52	86	86	74	74
query53	229	251	180	180
query54	250	224	192	192
query55	77	72	69	69
query56	226	207	210	207
query57	1532	1343	1412	1343
query58	274	257	246	246
query59	2001	2037	1856	1856
query60	287	245	210	210
query61	161	147	149	147
query62	398	320	264	264
query63	211	181	176	176
query64	2809	978	807	807
query65	3476	3406	3412	3406
query66	1786	408	314	314
query67	20022	20086	19862	19862
query68	3194	1575	881	881
query69	430	316	302	302
query70	894	822	825	822
query71	289	241	215	215
query72	2677	2469	2253	2253
query73	813	745	417	417
query74	4652	4513	4305	4305
query75	2288	2287	1922	1922
query76	2335	1079	758	758
query77	365	396	292	292
query78	9112	9088	8544	8544
query79	1375	1239	737	737
query80	562	459	372	372
query81	547	323	282	282
query82	640	165	126	126
query83	310	234	196	196
query84	317	144	113	113
query85	872	457	382	382
query86	340	245	224	224
query87	2005	1970	1850	1850
query88	3667	2739	2722	2722
query89	359	284	243	243
query90	1907	189	183	183
query91	173	168	134	134
query92	99	91	88	88
query93	1474	1372	917	917
query94	542	349	307	307
query95	681	390	427	390
query96	1016	805	361	361
query97	2443	2418	2306	2306
query98	163	150	150	150
query99	729	727	627	627
Total cold run time: 236614 ms
Total hot run time: 152674 ms

@hello-stephen

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

query1	0.00	0.00	0.01
query2	0.09	0.05	0.05
query3	0.25	0.13	0.13
query4	1.61	0.13	0.13
query5	0.25	0.23	0.23
query6	1.15	0.93	0.94
query7	0.05	0.01	0.00
query8	0.06	0.04	0.03
query9	0.43	0.33	0.34
query10	0.56	0.57	0.53
query11	0.21	0.15	0.14
query12	0.19	0.15	0.15
query13	0.46	0.46	0.48
query14	0.94	0.97	0.94
query15	0.61	0.60	0.60
query16	0.32	0.31	0.32
query17	1.10	1.16	1.07
query18	0.22	0.20	0.20
query19	2.00	1.95	1.88
query20	0.02	0.01	0.01
query21	15.45	0.22	0.13
query22	4.84	0.06	0.05
query23	16.13	0.31	0.12
query24	2.97	0.43	0.30
query25	0.11	0.05	0.04
query26	0.74	0.21	0.14
query27	0.04	0.04	0.03
query28	3.47	0.82	0.37
query29	12.65	4.02	3.18
query30	0.28	0.15	0.16
query31	2.77	0.55	0.31
query32	3.22	0.58	0.48
query33	3.23	3.25	3.18
query34	15.58	3.92	3.30
query35	3.26	3.23	3.25
query36	0.55	0.43	0.41
query37	0.09	0.06	0.07
query38	0.05	0.04	0.04
query39	0.03	0.03	0.03
query40	0.17	0.16	0.15
query41	0.08	0.03	0.02
query42	0.04	0.03	0.03
query43	0.04	0.03	0.03
Total cold run time: 96.31 s
Total hot run time: 23.9 s

@morrySnow

Copy link
Copy Markdown
Contributor 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 opinion: Request changes.

The origin-statement propagation itself is focused and internally consistent: complete/partition refreshes now create an origin-bearing StatementContext, the shared executor helper transfers the same OriginStatement into LogicalPlanAdapter, and both production callers satisfy the new non-null contract. One directly related parallel refresh bug remains and is called out inline.

Critical checkpoints:

  • Goal and proof: the changed tests verify both the production MV-query origin and object identity through StmtExecutor. The author reports the two FE unit suites passed; this automated review was static-only and did not run builds or tests, as required by the review prompt.
  • Scope and clarity: the four-file change is small and clear. The new precondition fails loudly and all in-repository callers were enumerated.
  • Concurrency and lifecycle: no new shared state or locking is introduced. Executor publication/clearing, cancellation, retry isolation, query unregistration, statement-context close, and task thread-local cleanup remain unchanged.
  • Configuration and compatibility: no configuration, persistence/EditLog, storage format, FE-BE protocol, or rolling-upgrade contract changes.
  • Parallel paths and conditions: complete/partition origin handling is correct, and incremental execution already supplies a non-null origin. However, incremental and incremental-dry-run parsing still do not install that context before parsing SET_VAR, causing the inline failure. Base/head verification shows this ordering predates the branch, but it is a substantiated, uncovered bug in the reviewed parallel call chain.
  • Data writes and transactions: insert/overwrite planning, transactionality, and visibility behavior are unchanged by origin propagation.
  • Observability and performance: the origin improves query/profile and lock diagnostics; explicit refresh audit text remains unchanged. No meaningful performance regression was found.
  • User focus: no additional user-provided focus points.

Review completion: two full review rounds converged at head bb43257535eba46e57c20abec68975bdc6b4ab96; all candidates were independently verified, deduplicated, and resolved. One inline P2 issue is submitted.

### What problem does this PR solve?

Issue Number: None

Related PR: apache#68269

Problem Summary: Incremental refresh and dry run parsed the MV query before installing their new StatementContext on the internal ConnectContext. Parsing a SET_VAR hint reads that context and could fail with a null dereference. Install the origin-bearing context before parsing in both paths, and cover the hinted MV query with FE and regression tests.

### Release note

Fix incremental materialized view refresh and dry run for MV queries containing SET_VAR hints.

### Check List (For Author)

- Test: Unit Test
  - Focused FE unit tests and Checkstyle passed.
  - Hinted dry-run regression case added; not run locally.
- Behavior changed: Yes. Hinted incremental refreshes now parse successfully.
- Does this need documentation: No
@morrySnow

Copy link
Copy Markdown
Contributor Author

/review

@morrySnow

Copy link
Copy Markdown
Contributor Author

run buildall

@hello-stephen

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

------ Round 1 ----------------------------------
============================================
q1	17676	4152	4046	4046
q2	2170	358	291	291
q3	10136	1436	799	799
q4	4688	480	345	345
q5	7483	842	548	548
q6	187	180	148	148
q7	753	809	619	619
q8	9349	1705	1580	1580
q9	5399	4181	4214	4181
q10	6844	1320	1037	1037
q11	440	287	249	249
q12	634	435	315	315
q13	18080	2620	1992	1992
q14	269	264	245	245
q15	q16	739	716	665	665
q17	1717	1143	986	986
q18	6560	5606	5556	5556
q19	1189	1325	1080	1080
q20	481	415	269	269
q21	5450	3559	2990	2990
q22	434	371	329	329
Total cold run time: 100678 ms
Total hot run time: 28270 ms

----- Round 2, with runtime_filter_mode=off -----
============================================
q1	4936	4700	4720	4700
q2	783	591	563	563
q3	4711	5280	4581	4581
q4	2347	2367	1521	1521
q5	4709	4503	4540	4503
q6	250	191	142	142
q7	1869	1749	1564	1564
q8	2551	2223	2243	2223
q9	7249	7225	6876	6876
q10	3636	3555	3091	3091
q11	549	414	384	384
q12	717	707	526	526
q13	2304	2635	2015	2015
q14	284	296	250	250
q15	q16	683	692	597	597
q17	7347	6793	6696	6696
q18	11918	11122	11690	11122
q19	1116	974	1006	974
q20	2193	2204	1943	1943
q21	5208	4332	4566	4332
q22	517	445	407	407
Total cold run time: 65877 ms
Total hot run time: 59010 ms

@hello-stephen

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

query5	4297	600	482	482
query6	418	204	206	204
query7	4868	529	305	305
query8	323	176	163	163
query9	8820	4026	4042	4026
query10	459	305	251	251
query11	5815	3573	3210	3210
query12	141	91	84	84
query13	1258	593	422	422
query14	6527	4545	4259	4259
query14_1	4088	4066	4048	4048
query15	209	202	182	182
query16	976	469	444	444
query17	912	675	546	546
query18	2431	467	343	343
query19	211	185	146	146
query20	84	82	79	79
query21	216	142	114	114
query22	13030	12983	12894	12894
query23	13913	12849	12342	12342
query23_1	12478	12472	12598	12472
query24	7239	1210	689	689
query24_1	720	737	710	710
query25	574	435	379	379
query26	1256	322	175	175
query27	2637	597	343	343
query28	4525	1998	2012	1998
query29	1664	767	554	554
query30	304	213	182	182
query31	892	753	628	628
query32	158	102	100	100
query33	542	310	255	255
query34	1182	1165	630	630
query35	715	771	679	679
query36	792	790	753	753
query37	146	114	97	97
query38	1818	1769	1704	1704
query39	703	693	665	665
query39_1	661	652	688	652
query40	236	126	103	103
query41	74	70	67	67
query42	99	97	100	97
query43	362	360	324	324
query44	1376	727	737	727
query45	189	178	167	167
query46	1032	1239	772	772
query47	1509	1498	1437	1437
query48	389	416	297	297
query49	608	435	297	297
query50	1031	363	244	244
query51	10395	10424	10361	10361
query52	88	96	76	76
query53	231	261	181	181
query54	263	208	189	189
query55	84	77	69	69
query56	235	229	225	225
query57	1585	1502	1328	1328
query58	284	259	247	247
query59	2001	2102	1843	1843
query60	273	233	219	219
query61	140	152	145	145
query62	394	333	266	266
query63	219	182	181	181
query64	2809	1026	808	808
query65	3478	3424	3425	3424
query66	1817	431	298	298
query67	20161	20132	20036	20036
query68	3123	1645	961	961
query69	412	301	260	260
query70	920	822	818	818
query71	302	240	211	211
query72	2758	2556	2228	2228
query73	876	871	428	428
query74	4606	4484	4283	4283
query75	2299	2299	2010	2010
query76	2295	1114	780	780
query77	369	394	309	309
query78	9052	9104	8367	8367
query79	1398	1240	746	746
query80	619	458	403	403
query81	553	331	287	287
query82	612	170	127	127
query83	303	231	205	205
query84	322	146	116	116
query85	833	464	385	385
query86	348	230	238	230
query87	1980	1973	1843	1843
query88	3667	2748	2738	2738
query89	369	299	254	254
query90	1919	190	185	185
query91	170	157	127	127
query92	105	92	88	88
query93	1534	1519	848	848
query94	542	339	304	304
query95	676	467	332	332
query96	1089	767	353	353
query97	2430	2413	2308	2308
query98	170	150	144	144
query99	722	722	602	602
Total cold run time: 236448 ms
Total hot run time: 153217 ms

@hello-stephen

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

query1	0.01	0.01	0.00
query2	0.09	0.05	0.04
query3	0.25	0.14	0.13
query4	1.61	0.14	0.13
query5	0.25	0.22	0.22
query6	1.16	0.94	0.94
query7	0.04	0.01	0.00
query8	0.05	0.04	0.04
query9	0.40	0.34	0.34
query10	0.56	0.58	0.54
query11	0.21	0.13	0.14
query12	0.19	0.15	0.14
query13	0.46	0.47	0.46
query14	0.94	0.93	0.93
query15	0.61	0.61	0.58
query16	0.31	0.32	0.34
query17	1.16	1.05	1.09
query18	0.21	0.20	0.20
query19	1.99	1.94	1.97
query20	0.02	0.01	0.01
query21	15.47	0.19	0.14
query22	4.99	0.06	0.05
query23	16.13	0.31	0.13
query24	2.93	0.44	0.33
query25	0.10	0.05	0.05
query26	0.73	0.20	0.14
query27	0.05	0.04	0.04
query28	3.57	0.75	0.37
query29	12.54	4.04	3.20
query30	0.28	0.15	0.16
query31	2.77	0.57	0.31
query32	3.22	0.59	0.49
query33	3.27	3.25	3.11
query34	15.77	3.89	3.26
query35	3.26	3.24	3.20
query36	0.55	0.43	0.43
query37	0.10	0.07	0.07
query38	0.05	0.04	0.03
query39	0.04	0.04	0.03
query40	0.18	0.16	0.14
query41	0.08	0.03	0.03
query42	0.04	0.03	0.03
query43	0.04	0.03	0.04
Total cold run time: 96.68 s
Total hot run time: 23.9 s

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

Static review of exact head 7cb38cef96b1ed820e7a12859518a692e8f72941 against base 6b3ea1eb56dcf57c5f2dd5abb9f170e0fbcf1907.

Requesting changes for two P2 issues:

  • Incremental refresh can let a stored SET_VAR(compute_group=...) override the compute group captured for the manual task, unlike COMPLETE/PARTITIONS, and can report a different group from the one used.
  • Incremental dry-run cancellation is not durable during setup/planning, so work can start after Ctrl+C/KILL/timeout.

The current head does fix the previously reported missing-StatementContext SET_VAR NPE and preserves the origin statement through the internal executor; that existing thread was not duplicated.

Critical checkpoint conclusions:

  • Goal and proof: explicit origins and pre-parse contexts address the stated origin/hint failure, but the two issues above prevent approval.
  • Scope: production changes are otherwise narrow and focused.
  • Concurrency: no new locks or shared mutable structures; the remaining lifecycle defect is the nested dry-run cancellation handoff.
  • Lifecycle: per-attempt contexts, retries, background cleanup, and dry-run caller-context restoration are sound by static tracing apart from that cancellation handoff.
  • Configuration: no new configuration was added; the compute-group issue concerns inconsistent precedence of an existing session variable.
  • Compatibility: no storage, journal, RPC, function-symbol, or rolling-upgrade format change.
  • Parallel paths: COMPLETE/PARTITIONS and INCREMENTAL order hint parsing versus task affinity differently; explain/context paths were also checked.
  • Conditions and errors: the non-null origin precondition fails loudly and all production callers satisfy it.
  • Tests: added unit tests cover origin/context wiring and generic hinted incremental/dry-run parsing; the regression exercises real hinted incremental refresh and dry run, but there is no conflicting-compute-group or early-cancellation test.
  • Test results: the author reports 181 related FE unit tests and Checkstyle passed; the regression suite was not run. This review did not execute tests or builds.
  • Observability: origin/audit propagation improves; the compute-group issue can still make task reporting disagree with execution.
  • Persistence, transactions, and writes: no metadata format or EditLog change; insert transaction and atomicity paths are unchanged.
  • FE-BE propagation: no new variable or protocol field is introduced.
  • Performance: no material hot-path cost was found.
  • User focus: no additional focus was provided.

@yujun777 yujun777 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.

LGTM

@morrySnow
morrySnow merged commit e056f1c into apache:master Sep 24, 2026
46 of 47 checks passed
@morrySnow
morrySnow deleted the fix/mtmv-origin-statement branch September 24, 2026 07:08
morningman added a commit that referenced this pull request Sep 24, 2026
### What problem does this PR solve?

Issue Number: None (branch pick)

Related PR: #67490, #68141, #66963, #68269

Problem Summary: Pick the four merged `incremental-computation` PRs that
do not have the `incremental-computation-picked` label into
`branch-incremental-computation`, in their master merge order:

1. #67490: prevent a local exchange under a serial parent pipeline.
2. #68141: manage MTMV planning caches through a bounded global LRU
cache and expose cache statistics.
3. #66963: restrict HLL, QUANTILE_STATE, and AGG_STATE columns to
Aggregate Key tables by default, with a temporary compatibility setting.
4. #68269: preserve the origin statement for internal MTMV refreshes and
parse `SET_VAR` hints with the refresh context installed.

Dependency check: #33262, referenced by #68141, is already an ancestor
of this branch. #66664 is an open related row-binlog fix rather than a
code prerequisite for #66963. #68272 is the corresponding branch-4.1 fix
for #68269, not a master prerequisite. No additional PR needed picking.

### Release note

Bring the four fixes and MTMV cache management change above to the
incremental computation branch. In particular, non-Aggregate Key tables
now reject new HLL, QUANTILE_STATE, and AGG_STATE columns by default;
incremental MTMV refreshes and dry runs can parse MV queries with
`SET_VAR` hints.

### Check List (For Author)

- Test:
    - `./build.sh --fe` (passed, including Checkstyle with 0 violations)
- Focused `./run-fe-ut.sh --run ...` across 13 changed and related test
classes (356 tests passed, 0 failures/errors/skips)
- SQL regression tests were not run; this worktree has no BE cluster.
- Behavior changed: Yes, as described in the source PRs and release
note.
- Does this need documentation: No; the source PRs do not require a
documentation PR.

---------

Co-authored-by: Mryange <[email protected]>
Co-authored-by: xy720 <[email protected]>
Co-authored-by: Luwei <[email protected]>
Co-authored-by: morrySnow <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants