Skip to content

Conversation

@seawinde
Copy link
Contributor

@seawinde seawinde commented Dec 4, 2025

What problem does this PR solve?

This PR introduces two key modifications to improve the reliability of the optimizer (CBO) and the testing pipeline concerning materialized views:

  1. Fixes unstable selection of synchronous materialized views in the pipeline:​ The root cause was that the statistical information of the base table was not reported promptly. This delay could lead the CBO to estimate selectedPartitionsRowCountas zero for the materialized view, causing it to be incorrectly bypassed during query planning. The fix involves manually injecting the statistical information for the synchronous materialized view​ when available, ensuring the CBO can make a stable and accurate assessment of its cost .

  2. Removes the fuzzy value setting for preMaterializedViewRewriteStrategyin SessionVariable:​ The test cases for the TRY_IN_RBO strategy have already been extended to cover scenarios equivalent to both NOT_IN_RBO and FORCE_IN_RBO. Retaining the fuzzy option can introduce unnecessary instability into the pipeline. For instance, a PR might pass tests when the strategy is TRY_IN_RBO but fail if the pipeline randomly selects NOT_IN_RBO, leading to inconsistent results. Removing this fuzzy setting helps eliminate such non-deterministic failures and enhances pipeline stability

Issue Number: close #xxx

Related PR: #xxx

Problem Summary:

Release note

None

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

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

@seawinde
Copy link
Contributor Author

seawinde commented Dec 4, 2025

run buildall

@seawinde seawinde changed the title [fix](mv) Fix sync mc could not be chosen by cbo stable because stats upload from be not in time [fix](mv) Fix sync mv could not be chosen by cbo stable because stats upload from be not in time Dec 4, 2025
@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17640	5081	5052	5052
q2	2050	306	201	201
q3	10252	1335	742	742
q4	10223	843	315	315
q5	7556	2425	2199	2199
q6	192	178	142	142
q7	960	782	639	639
q8	9366	1400	1106	1106
q9	6893	5240	5295	5240
q10	6892	2233	1794	1794
q11	537	315	279	279
q12	340	369	236	236
q13	17796	3651	3064	3064
q14	234	230	212	212
q15	588	516	516	516
q16	888	873	818	818
q17	686	788	531	531
q18	7725	7012	7037	7012
q19	1141	964	620	620
q20	392	353	231	231
q21	4039	3517	2546	2546
q22	1037	983	922	922
Total cold run time: 107427 ms
Total hot run time: 34417 ms

----- Round 2, with runtime_filter_mode=off -----
q1	4999	4935	4957	4935
q2	336	411	319	319
q3	2169	2713	2301	2301
q4	1352	1741	1297	1297
q5	4226	4603	4615	4603
q6	222	177	136	136
q7	2060	2036	1753	1753
q8	2784	2674	2572	2572
q9	7593	7431	7460	7431
q10	3098	3236	2812	2812
q11	601	519	489	489
q12	723	785	641	641
q13	3560	3936	3395	3395
q14	291	310	275	275
q15	553	508	494	494
q16	919	921	909	909
q17	1174	1499	1433	1433
q18	7932	7735	7569	7569
q19	943	834	867	834
q20	1880	1981	1848	1848
q21	4681	4396	4186	4186
q22	1042	1036	987	987
Total cold run time: 53138 ms
Total hot run time: 51219 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 180096 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 f4be1d1e49bbd27c1090e72dff37625a2e0fc266, data reload: false

query5	5089	629	506	506
query6	351	237	247	237
query7	4670	486	289	289
query8	329	266	249	249
query9	8767	2665	2646	2646
query10	572	323	272	272
query11	15507	14789	14565	14565
query12	194	121	114	114
query13	1722	499	372	372
query14	6268	3344	3104	3104
query14_1	2971	3029	2990	2990
query15	221	208	190	190
query16	7651	491	472	472
query17	1240	748	616	616
query18	2040	439	347	347
query19	218	195	176	176
query20	137	125	120	120
query21	221	137	118	118
query22	3898	3835	3841	3835
query23	16638	16076	15944	15944
query23_1	16002	16050	15914	15914
query24	7215	1639	1208	1208
query24_1	1224	1238	1219	1219
query25	624	479	417	417
query26	1255	285	177	177
query27	2895	470	310	310
query28	4363	2185	2158	2158
query29	823	550	483	483
query30	327	246	217	217
query31	832	706	606	606
query32	83	70	73	70
query33	671	359	308	308
query34	869	901	552	552
query35	802	845	751	751
query36	884	913	841	841
query37	127	98	82	82
query38	3962	3886	3788	3788
query39	752	763	755	755
query39_1	701	701	700	700
query40	227	139	122	122
query41	71	63	63	63
query42	128	101	98	98
query43	448	433	405	405
query44	1370	790	765	765
query45	201	196	184	184
query46	910	977	613	613
query47	1671	1681	1599	1599
query48	413	332	233	233
query49	780	436	386	386
query50	694	334	235	235
query51	3872	3839	3856	3839
query52	116	99	92	92
query53	240	242	177	177
query54	346	264	256	256
query55	96	82	80	80
query56	362	300	294	294
query57	1173	1146	1093	1093
query58	295	268	254	254
query59	2349	2416	2345	2345
query60	366	341	309	309
query61	162	160	165	160
query62	802	681	641	641
query63	244	181	184	181
query64	4540	1189	966	966
query65	4109	3936	3956	3936
query66	1214	450	346	346
query67	15160	14856	14739	14739
query68	5924	943	653	653
query69	528	299	274	274
query70	1136	1004	988	988
query71	440	315	282	282
query72	5947	4862	4798	4798
query73	665	558	313	313
query74	8800	8786	8616	8616
query75	3062	3075	2541	2541
query76	3263	1153	775	775
query77	505	422	318	318
query78	9456	9692	8904	8904
query79	1066	896	608	608
query80	705	564	489	489
query81	515	271	243	243
query82	232	135	108	108
query83	284	285	270	270
query84	267	121	104	104
query85	888	490	450	450
query86	339	293	304	293
query87	4198	4125	3913	3913
query88	3011	2149	2180	2149
query89	401	327	302	302
query90	1904	177	172	172
query91	197	184	161	161
query92	80	75	67	67
query93	1175	1022	691	691
query94	721	322	298	298
query95	588	405	353	353
query96	556	506	219	219
query97	2581	2680	2568	2568
query98	253	206	200	200
query99	1354	1317	1244	1244
Total cold run time: 266602 ms
Total hot run time: 180096 ms

@doris-robot
Copy link

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

query1	0.06	0.05	0.05
query2	0.10	0.05	0.04
query3	0.26	0.10	0.08
query4	1.61	0.11	0.11
query5	0.27	0.26	0.26
query6	1.16	0.64	0.65
query7	0.03	0.02	0.02
query8	0.05	0.04	0.05
query9	0.59	0.53	0.50
query10	0.58	0.56	0.55
query11	0.16	0.12	0.11
query12	0.14	0.11	0.12
query13	0.63	0.61	0.61
query14	1.00	0.99	0.98
query15	0.82	0.79	0.81
query16	0.43	0.42	0.40
query17	1.07	1.06	1.00
query18	0.24	0.22	0.21
query19	1.81	1.85	1.85
query20	0.03	0.01	0.01
query21	15.47	0.29	0.14
query22	4.75	0.06	0.04
query23	15.99	0.29	0.11
query24	2.01	0.33	0.51
query25	0.10	0.16	0.06
query26	0.15	0.14	0.13
query27	0.06	0.06	0.06
query28	4.88	1.23	1.03
query29	12.57	3.97	3.18
query30	0.27	0.13	0.12
query31	2.83	0.60	0.42
query32	3.24	0.55	0.46
query33	3.00	3.09	3.06
query34	16.76	5.16	4.54
query35	4.51	4.63	4.56
query36	0.67	0.49	0.48
query37	0.11	0.07	0.07
query38	0.08	0.05	0.04
query39	0.05	0.03	0.03
query40	0.17	0.15	0.14
query41	0.09	0.04	0.03
query42	0.04	0.03	0.03
query43	0.04	0.04	0.03
Total cold run time: 98.88 s
Total hot run time: 27.45 s

@hello-stephen
Copy link
Contributor

FE UT Coverage Report

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

@hello-stephen
Copy link
Contributor

FE Regression Coverage Report

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

@github-actions
Copy link
Contributor

github-actions bot commented Dec 5, 2025

PR approved by at least one committer and no changes requested.

@github-actions github-actions bot added approved Indicates a PR has been approved by one committer. reviewed labels Dec 5, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Dec 5, 2025

PR approved by anyone and no changes requested.

Copy link
Contributor

@yujun777 yujun777 left a comment

Choose a reason for hiding this comment

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

LGTM

@hello-stephen
Copy link
Contributor

FE Regression Coverage Report

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

@morrySnow morrySnow merged commit c74a21c into apache:master Dec 5, 2025
35 checks passed
github-actions bot pushed a commit that referenced this pull request Dec 5, 2025
… upload from be not in time (#58720)

This PR introduces two key modifications to improve the reliability of
the optimizer (CBO) and the testing pipeline concerning materialized
views:
1. Fixes unstable selection of synchronous materialized views in the
pipeline:​ The root cause was that the statistical information of the
base table was not reported promptly. This delay could lead the CBO to
estimate selectedPartitionsRowCountas zero for the materialized view,
causing it to be incorrectly bypassed during query planning. The fix
involves manually injecting the statistical information for the
synchronous materialized view​ when available, ensuring the CBO can make
a stable and accurate assessment of its cost .

2. Removes the fuzzy value setting for
preMaterializedViewRewriteStrategyin SessionVariable:​ The test cases
for the TRY_IN_RBO strategy have already been extended to cover
scenarios equivalent to both NOT_IN_RBO and FORCE_IN_RBO. Retaining the
fuzzy option can introduce unnecessary instability into the pipeline.
For instance, a PR might pass tests when the strategy is TRY_IN_RBO but
fail if the pipeline randomly selects NOT_IN_RBO, leading to
inconsistent results. Removing this fuzzy setting helps eliminate such
non-deterministic failures and enhances pipeline stability
seawinde added a commit to seawinde/doris that referenced this pull request Dec 10, 2025
… upload from be not in time (apache#58720)

This PR introduces two key modifications to improve the reliability of
the optimizer (CBO) and the testing pipeline concerning materialized
views:
1. Fixes unstable selection of synchronous materialized views in the
pipeline:​ The root cause was that the statistical information of the
base table was not reported promptly. This delay could lead the CBO to
estimate selectedPartitionsRowCountas zero for the materialized view,
causing it to be incorrectly bypassed during query planning. The fix
involves manually injecting the statistical information for the
synchronous materialized view​ when available, ensuring the CBO can make
a stable and accurate assessment of its cost .

2. Removes the fuzzy value setting for
preMaterializedViewRewriteStrategyin SessionVariable:​ The test cases
for the TRY_IN_RBO strategy have already been extended to cover
scenarios equivalent to both NOT_IN_RBO and FORCE_IN_RBO. Retaining the
fuzzy option can introduce unnecessary instability into the pipeline.
For instance, a PR might pass tests when the strategy is TRY_IN_RBO but
fail if the pipeline randomly selects NOT_IN_RBO, leading to
inconsistent results. Removing this fuzzy setting helps eliminate such
non-deterministic failures and enhances pipeline stability
yiguolei pushed a commit that referenced this pull request Dec 11, 2025
…ecause stats upload from be not in time #58720 (#58772)

Cherry-picked from #58720

Co-authored-by: seawinde <wusi@selectdb.com>
nagisa-kunhah pushed a commit to nagisa-kunhah/doris that referenced this pull request Dec 14, 2025
… upload from be not in time (apache#58720)

This PR introduces two key modifications to improve the reliability of
the optimizer (CBO) and the testing pipeline concerning materialized
views:
1. Fixes unstable selection of synchronous materialized views in the
pipeline:​ The root cause was that the statistical information of the
base table was not reported promptly. This delay could lead the CBO to
estimate selectedPartitionsRowCountas zero for the materialized view,
causing it to be incorrectly bypassed during query planning. The fix
involves manually injecting the statistical information for the
synchronous materialized view​ when available, ensuring the CBO can make
a stable and accurate assessment of its cost .

2. Removes the fuzzy value setting for
preMaterializedViewRewriteStrategyin SessionVariable:​ The test cases
for the TRY_IN_RBO strategy have already been extended to cover
scenarios equivalent to both NOT_IN_RBO and FORCE_IN_RBO. Retaining the
fuzzy option can introduce unnecessary instability into the pipeline.
For instance, a PR might pass tests when the strategy is TRY_IN_RBO but
fail if the pipeline randomly selects NOT_IN_RBO, leading to
inconsistent results. Removing this fuzzy setting helps eliminate such
non-deterministic failures and enhances pipeline stability
morrySnow pushed a commit that referenced this pull request Dec 15, 2025
…ecause stats upload from be not in time #58720 (#58915)

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

Labels

approved Indicates a PR has been approved by one committer. dev/3.1.4-merged dev/4.0.2-merged reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants