Skip to content

Conversation

@seawinde
Copy link
Contributor

@seawinde seawinde commented Aug 20, 2025

What problem does this PR solve?

Support window function rewrite when materialized view contains window function

the doc pr is apache/doris-website#3060

Such as mv def is as following:

        CREATE MATERIALIZED VIEW mv1
        BUILD IMMEDIATE REFRESH COMPLETE ON MANUAL
        DISTRIBUTED BY RANDOM BUCKETS 2
        PROPERTIES ('replication_num' = '1') 
        AS
        select *
        from (
        select 
        o_orderkey,
        FIRST_VALUE(o_custkey) OVER (
                PARTITION BY o_orderdate 
                ORDER BY o_totalprice NULLS LAST
                RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW
            ) AS first_value,
        RANK() OVER (
                PARTITION BY o_orderdate, o_orderstatus 
                ORDER BY o_totalprice NULLS LAST
                RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW
            ) AS rank_value,
        LAG(l_extendedprice, 1, 0) over (partition by o_orderdate, l_shipdate order by l_quantity) AS lag_value 
        from 
        lineitem2
        left join orders2 on l_orderkey = o_orderkey and l_shipdate = o_orderdate
        ) t
        where o_orderkey > 1;

if query as following, this can use mv to represent query

select *
            from (
            select 
            o_orderkey,
            FIRST_VALUE(o_custkey) OVER (
                    PARTITION BY o_orderdate 
                    ORDER BY o_totalprice NULLS LAST
                    RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW
                ) AS first_value,
            RANK() OVER (
                    PARTITION BY o_orderdate, o_orderstatus 
                    ORDER BY o_totalprice NULLS LAST
                    RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW
                ) AS rank_value,
            LAG(l_extendedprice, 1, 0) over (partition by o_orderdate, l_shipdate order by l_quantity) AS lag_value 
            from 
            lineitem2
            left join orders2 on l_orderkey = o_orderkey and l_shipdate = o_orderdate
            ) t
            where o_orderkey > 2;

explain result is as follwing:

+----------------------------------------------------------------------------------------+
| Explain String(Nereids Planner)                                                        |
+----------------------------------------------------------------------------------------+
| PLAN FRAGMENT 0                                                                        |
|   OUTPUT EXPRS:                                                                        |
|     o_orderkey[#4]                                                                     |
|     first_value[#5]                                                                    |
|     rank_value[#6]                                                                     |
|     lag_value[#7]                                                                      |
|   PARTITION: RANDOM                                                                    |
|                                                                                        |
|   HAS_COLO_PLAN_NODE: false                                                            |
|                                                                                        |
|   VRESULT SINK                                                                         |
|      MYSQL_PROTOCAL                                                                    |
|                                                                                        |
|   0:VOlapScanNode(445)                                                                 |
|      TABLE: regression_test_nereids_rules_p0_mv_window.mv1(mv1), PREAGGREGATION: ON    |
|      PREDICATES: (o_orderkey[#0] > 2)                                                  |
|      partitions=1/1 (mv1)                                                              |
|      tablets=2/2, tabletList=1755678381149,1755678381151                               |
|      cardinality=1, avgRowSize=0.0, numNodes=1                                         |
|      pushAggOp=NONE                                                                    |
|      final projections: o_orderkey[#0], first_value[#1], rank_value[#2], lag_value[#3] |
|      final project output tuple id: 1                                                  |
|                                                                                        |
|                                                                                        |
| ========== MATERIALIZATIONS ==========                                                 |
|                                                                                        |
| MaterializedView                                                                       |
| MaterializedViewRewriteSuccessAndChose:                                                |
|   internal.regression_test_nereids_rules_p0_mv_window.mv1 chose                        |
|                                                                                        |
| MaterializedViewRewriteSuccessButNotChose:                                             |
|                                                                                        |
| MaterializedViewRewriteFail:                                                           |
|                                                                                        |
|                                                                                        |
| ========== STATISTICS ==========                                                       |
| planed with unknown column statistics                                                  |
+----------------------------------------------------------------------------------------+

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

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	6622	5154	5028	5028
q2	1984	298	193	193
q3	10373	1299	725	725
q4	10500	1008	559	559
q5	7563	2486	2424	2424
q6	183	165	132	132
q7	910	751	627	627
q8	9309	1303	1116	1116
q9	6940	5164	5171	5164
q10	6912	2398	1969	1969
q11	475	294	275	275
q12	352	394	231	231
q13	17779	3668	3082	3082
q14	228	237	227	227
q15	542	500	498	498
q16	421	419	368	368
q17	590	880	364	364
q18	7635	7060	7089	7060
q19	1128	966	605	605
q20	350	349	232	232
q21	3986	3287	2395	2395
q22	1072	1034	980	980
Total cold run time: 95854 ms
Total hot run time: 34254 ms

----- Round 2, with runtime_filter_mode=off -----
q1	5102	5183	5202	5183
q2	248	325	220	220
q3	2228	2698	2319	2319
q4	1371	1814	1323	1323
q5	4221	4151	4172	4151
q6	208	167	127	127
q7	1900	1852	1679	1679
q8	2552	2552	2496	2496
q9	6810	6810	6865	6810
q10	2971	3172	2765	2765
q11	576	511	498	498
q12	665	756	618	618
q13	3298	3687	3113	3113
q14	276	280	267	267
q15	518	461	471	461
q16	435	459	426	426
q17	1135	1467	1362	1362
q18	7172	7129	6976	6976
q19	849	828	855	828
q20	1902	1924	1783	1783
q21	4842	4479	4300	4300
q22	1104	1036	1013	1013
Total cold run time: 50383 ms
Total hot run time: 48718 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 185180 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 93b2cf69c624e7c3934ccb9eaa7a47043a5050bf, data reload: false

query1	972	398	425	398
query2	6519	1727	1766	1727
query3	6746	219	213	213
query4	26507	23421	22985	22985
query5	4381	623	478	478
query6	318	220	198	198
query7	4640	512	288	288
query8	281	256	226	226
query9	8616	2883	2887	2883
query10	479	328	274	274
query11	15884	15518	14809	14809
query12	178	122	115	115
query13	1669	587	443	443
query14	10931	5953	5844	5844
query15	206	195	174	174
query16	7661	666	476	476
query17	1598	743	611	611
query18	2042	422	323	323
query19	202	199	172	172
query20	128	126	126	126
query21	214	125	113	113
query22	4298	4115	3967	3967
query23	34317	33315	33242	33242
query24	7841	2411	2386	2386
query25	515	478	419	419
query26	1231	266	163	163
query27	2712	498	347	347
query28	4302	2251	2244	2244
query29	780	563	464	464
query30	291	220	189	189
query31	908	840	714	714
query32	82	80	71	71
query33	551	381	342	342
query34	819	855	531	531
query35	781	827	741	741
query36	985	1026	913	913
query37	117	107	91	91
query38	4074	4076	3922	3922
query39	1495	1411	1396	1396
query40	231	128	116	116
query41	61	62	57	57
query42	116	108	112	108
query43	501	510	475	475
query44	1371	851	848	848
query45	173	171	167	167
query46	859	1002	633	633
query47	1772	1792	1705	1705
query48	377	414	317	317
query49	727	489	394	394
query50	627	683	397	397
query51	4224	4132	4119	4119
query52	114	113	103	103
query53	242	277	194	194
query54	605	598	519	519
query55	94	88	86	86
query56	313	323	298	298
query57	1204	1191	1113	1113
query58	284	268	278	268
query59	2623	2779	2581	2581
query60	343	330	334	330
query61	132	125	156	125
query62	826	717	661	661
query63	232	194	197	194
query64	4269	1009	703	703
query65	4320	4176	4234	4176
query66	1081	417	384	384
query67	15479	15347	15058	15058
query68	8184	943	582	582
query69	468	328	293	293
query70	1189	1101	1169	1101
query71	474	328	311	311
query72	5708	4715	4811	4715
query73	736	620	354	354
query74	8908	9035	9045	9035
query75	3881	3082	2599	2599
query76	3698	1178	761	761
query77	786	402	331	331
query78	9672	9620	8809	8809
query79	2432	826	582	582
query80	584	532	527	527
query81	476	257	219	219
query82	490	142	110	110
query83	251	245	231	231
query84	244	104	84	84
query85	795	374	328	328
query86	386	305	317	305
query87	4212	4269	4193	4193
query88	3486	2238	2281	2238
query89	397	313	275	275
query90	1872	216	217	216
query91	136	149	109	109
query92	89	70	66	66
query93	1794	992	631	631
query94	675	399	304	304
query95	385	309	305	305
query96	479	578	277	277
query97	2611	2630	2598	2598
query98	250	220	216	216
query99	1394	1408	1328	1328
Total cold run time: 276613 ms
Total hot run time: 185180 ms

@doris-robot
Copy link

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

query1	0.04	0.03	0.03
query2	0.09	0.05	0.04
query3	0.24	0.07	0.07
query4	1.61	0.11	0.11
query5	0.43	0.44	0.39
query6	1.21	0.64	0.66
query7	0.03	0.02	0.02
query8	0.05	0.04	0.04
query9	0.60	0.52	0.52
query10	0.58	0.58	0.59
query11	0.16	0.11	0.11
query12	0.15	0.11	0.12
query13	0.62	0.62	0.60
query14	0.80	0.82	0.83
query15	0.89	0.85	0.84
query16	0.39	0.40	0.38
query17	1.02	1.06	1.02
query18	0.21	0.20	0.19
query19	1.92	1.83	1.82
query20	0.01	0.02	0.01
query21	15.41	0.94	0.60
query22	0.77	1.13	0.69
query23	14.95	1.36	0.66
query24	5.95	1.31	1.04
query25	0.41	0.27	0.13
query26	0.56	0.16	0.14
query27	0.06	0.06	0.05
query28	8.97	0.92	0.43
query29	12.55	3.92	3.25
query30	3.08	3.02	3.01
query31	2.82	0.59	0.38
query32	3.23	0.56	0.48
query33	3.07	3.08	3.12
query34	15.79	5.45	4.89
query35	4.85	4.95	4.92
query36	0.71	0.51	0.50
query37	0.09	0.07	0.07
query38	0.05	0.04	0.03
query39	0.04	0.03	0.03
query40	0.18	0.14	0.13
query41	0.08	0.02	0.02
query42	0.04	0.02	0.03
query43	0.03	0.03	0.03
Total cold run time: 104.74 s
Total hot run time: 32.92 s

@seawinde seawinde force-pushed the support_window_rewrite_single_pr branch from 69f533d to d6cfc54 Compare August 22, 2025 11:32
@seawinde
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17591	5245	5114	5114
q2	1925	303	188	188
q3	10293	1326	712	712
q4	10208	1034	523	523
q5	7524	2464	2316	2316
q6	188	159	137	137
q7	913	753	625	625
q8	9326	1399	1127	1127
q9	6856	5136	5069	5069
q10	6904	2384	1949	1949
q11	492	296	274	274
q12	338	352	221	221
q13	17746	3607	3004	3004
q14	237	248	212	212
q15	538	493	486	486
q16	432	424	372	372
q17	588	843	380	380
q18	7583	7143	7103	7103
q19	1217	983	585	585
q20	345	344	218	218
q21	3989	3249	2368	2368
q22	1076	1015	981	981
Total cold run time: 106309 ms
Total hot run time: 33964 ms

----- Round 2, with runtime_filter_mode=off -----
q1	5151	5148	5113	5113
q2	250	342	227	227
q3	2224	2692	2328	2328
q4	1390	1813	1327	1327
q5	4217	4522	4478	4478
q6	221	173	127	127
q7	2088	2010	1789	1789
q8	2667	2680	2553	2553
q9	7285	7424	7364	7364
q10	3103	3329	2849	2849
q11	629	521	533	521
q12	763	937	611	611
q13	3495	3960	3270	3270
q14	285	323	278	278
q15	526	483	483	483
q16	430	485	432	432
q17	1184	1542	1376	1376
q18	7946	7823	7766	7766
q19	842	854	833	833
q20	1990	1929	1795	1795
q21	4795	4508	4250	4250
q22	1057	1038	972	972
Total cold run time: 52538 ms
Total hot run time: 50742 ms

@doris-robot
Copy link

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

query1	991	388	432	388
query2	6550	1755	1755	1755
query3	6748	229	215	215
query4	26656	23384	23226	23226
query5	4382	647	523	523
query6	324	237	221	221
query7	4633	509	301	301
query8	289	247	238	238
query9	8584	2875	2847	2847
query10	479	320	289	289
query11	15989	15026	15121	15026
query12	169	121	117	117
query13	1667	564	428	428
query14	9322	5812	5803	5803
query15	222	193	167	167
query16	7337	653	499	499
query17	1199	741	664	664
query18	1996	408	297	297
query19	194	221	161	161
query20	124	117	114	114
query21	213	120	104	104
query22	4124	4296	4056	4056
query23	34087	32708	32879	32708
query24	8149	2394	2392	2392
query25	579	488	416	416
query26	1233	273	163	163
query27	2739	507	351	351
query28	4334	2262	2242	2242
query29	759	597	471	471
query30	290	221	190	190
query31	889	786	730	730
query32	85	82	80	80
query33	553	397	346	346
query34	826	864	526	526
query35	815	830	751	751
query36	960	1028	930	930
query37	119	109	86	86
query38	4132	4087	3978	3978
query39	1477	1416	1390	1390
query40	216	127	116	116
query41	61	57	54	54
query42	122	112	112	112
query43	511	494	497	494
query44	1381	857	866	857
query45	181	168	168	168
query46	869	1025	661	661
query47	1785	1817	1747	1747
query48	382	441	315	315
query49	739	489	394	394
query50	688	681	413	413
query51	4176	4183	4060	4060
query52	116	121	104	104
query53	246	270	191	191
query54	611	592	527	527
query55	90	88	93	88
query56	325	323	315	315
query57	1209	1196	1155	1155
query58	285	273	270	270
query59	2679	2738	2578	2578
query60	346	344	332	332
query61	131	123	133	123
query62	834	727	668	668
query63	236	196	195	195
query64	4331	1057	720	720
query65	4318	4218	4221	4218
query66	1152	426	334	334
query67	15535	15384	15096	15096
query68	8276	926	567	567
query69	491	344	290	290
query70	1245	1153	1086	1086
query71	502	339	320	320
query72	5445	4850	4861	4850
query73	755	642	355	355
query74	8876	8830	9025	8830
query75	3869	3090	2635	2635
query76	3735	1149	742	742
query77	805	419	318	318
query78	9569	9790	8893	8893
query79	2397	841	599	599
query80	669	546	487	487
query81	471	266	229	229
query82	429	138	109	109
query83	287	260	237	237
query84	289	99	82	82
query85	790	375	390	375
query86	338	324	294	294
query87	4346	4330	4171	4171
query88	2859	2228	2219	2219
query89	392	327	293	293
query90	1906	230	238	230
query91	146	147	111	111
query92	95	75	66	66
query93	1164	982	641	641
query94	681	423	288	288
query95	401	323	316	316
query96	483	593	275	275
query97	2658	2682	2583	2583
query98	231	218	211	211
query99	1465	1446	1271	1271
Total cold run time: 273838 ms
Total hot run time: 185467 ms

@doris-robot
Copy link

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

query1	0.05	0.04	0.03
query2	0.08	0.04	0.04
query3	0.24	0.07	0.08
query4	1.63	0.11	0.11
query5	0.42	0.40	0.41
query6	1.17	0.65	0.65
query7	0.03	0.02	0.02
query8	0.05	0.03	0.03
query9	0.60	0.53	0.51
query10	0.57	0.57	0.58
query11	0.16	0.12	0.11
query12	0.15	0.12	0.12
query13	0.64	0.61	0.61
query14	0.79	0.85	0.84
query15	0.88	0.85	0.87
query16	0.39	0.39	0.40
query17	1.04	1.04	1.07
query18	0.21	0.21	0.20
query19	1.93	1.87	1.80
query20	0.02	0.01	0.01
query21	15.38	0.97	0.59
query22	0.80	1.16	0.75
query23	14.86	1.41	0.64
query24	7.11	1.05	1.39
query25	0.47	0.20	0.20
query26	0.59	0.16	0.13
query27	0.06	0.05	0.05
query28	9.77	0.95	0.43
query29	12.55	3.97	3.28
query30	3.08	3.02	2.99
query31	2.82	0.60	0.38
query32	3.24	0.56	0.49
query33	3.01	3.18	3.09
query34	16.12	5.48	4.90
query35	5.00	4.97	4.96
query36	0.68	0.53	0.49
query37	0.10	0.07	0.07
query38	0.06	0.04	0.04
query39	0.03	0.02	0.02
query40	0.18	0.15	0.14
query41	0.08	0.02	0.02
query42	0.03	0.02	0.02
query43	0.04	0.03	0.03
Total cold run time: 107.11 s
Total hot run time: 33.16 s

@hello-stephen
Copy link
Contributor

FE UT Coverage Report

Increment line coverage 47.76% (160/335) 🎉
Increment coverage report
Complete coverage report

@seawinde seawinde force-pushed the support_window_rewrite_single_pr branch from d6cfc54 to cfda5f6 Compare August 26, 2025 00:51
@seawinde
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17583	5295	5114	5114
q2	1926	297	191	191
q3	10285	1247	725	725
q4	10225	996	526	526
q5	7495	2408	2290	2290
q6	179	158	136	136
q7	886	742	603	603
q8	9298	1281	1073	1073
q9	6892	5096	5067	5067
q10	6947	2380	1945	1945
q11	468	289	267	267
q12	339	345	212	212
q13	17780	3658	3022	3022
q14	233	248	209	209
q15	569	478	485	478
q16	419	420	377	377
q17	604	842	351	351
q18	7347	7181	7194	7181
q19	1171	961	549	549
q20	332	330	215	215
q21	3752	2539	2319	2319
q22	1086	1033	985	985
Total cold run time: 105816 ms
Total hot run time: 33835 ms

----- Round 2, with runtime_filter_mode=off -----
q1	5152	5121	5060	5060
q2	242	313	224	224
q3	2143	2683	2330	2330
q4	1376	1783	1369	1369
q5	4165	4334	4548	4334
q6	216	168	130	130
q7	1994	1948	1830	1830
q8	2700	2687	2599	2599
q9	7369	7218	7250	7218
q10	3069	3340	2858	2858
q11	590	527	479	479
q12	680	784	674	674
q13	3531	3896	3394	3394
q14	279	309	288	288
q15	511	470	478	470
q16	447	489	465	465
q17	1160	1571	1358	1358
q18	8007	7813	7274	7274
q19	789	772	822	772
q20	1936	1967	1816	1816
q21	4699	4477	4365	4365
q22	1077	1029	993	993
Total cold run time: 52132 ms
Total hot run time: 50300 ms

@doris-robot
Copy link

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

query1	986	387	410	387
query2	6529	1718	1733	1718
query3	6743	215	214	214
query4	26303	23600	23449	23449
query5	4348	613	483	483
query6	300	210	203	203
query7	4635	512	291	291
query8	273	228	225	225
query9	8603	2889	2875	2875
query10	465	352	289	289
query11	15866	15007	15321	15007
query12	157	115	126	115
query13	1676	560	448	448
query14	9256	5772	5761	5761
query15	217	192	171	171
query16	7405	667	498	498
query17	1209	729	599	599
query18	2014	414	340	340
query19	193	190	170	170
query20	124	118	120	118
query21	210	125	112	112
query22	4077	4035	4160	4035
query23	33654	32799	32865	32799
query24	8173	2347	2326	2326
query25	543	484	403	403
query26	1236	269	162	162
query27	2733	511	351	351
query28	4364	2259	2222	2222
query29	795	571	448	448
query30	284	229	194	194
query31	927	828	751	751
query32	79	76	74	74
query33	560	366	337	337
query34	814	851	516	516
query35	801	799	762	762
query36	970	1040	928	928
query37	121	105	91	91
query38	4036	4079	3956	3956
query39	1475	1397	1423	1397
query40	211	131	117	117
query41	59	55	53	53
query42	117	113	117	113
query43	508	504	485	485
query44	1375	865	858	858
query45	186	178	165	165
query46	856	1015	647	647
query47	1768	1821	1709	1709
query48	396	426	308	308
query49	753	492	386	386
query50	653	686	400	400
query51	4037	4317	4100	4100
query52	115	108	102	102
query53	239	268	199	199
query54	595	603	522	522
query55	93	88	86	86
query56	310	305	299	299
query57	1193	1201	1142	1142
query58	285	261	278	261
query59	2721	2653	2652	2652
query60	343	335	316	316
query61	162	124	122	122
query62	779	719	663	663
query63	231	186	184	184
query64	4325	1019	711	711
query65	4278	4224	4197	4197
query66	1149	414	323	323
query67	15568	15294	15211	15211
query68	8457	916	569	569
query69	482	326	300	300
query70	1260	1132	1095	1095
query71	520	343	312	312
query72	5536	4647	4565	4565
query73	705	578	353	353
query74	9114	9127	8906	8906
query75	3927	3050	2661	2661
query76	3720	1126	742	742
query77	801	393	320	320
query78	9563	9688	8842	8842
query79	2384	834	609	609
query80	609	539	462	462
query81	497	262	220	220
query82	473	140	107	107
query83	247	254	234	234
query84	255	100	81	81
query85	818	469	336	336
query86	391	321	313	313
query87	4211	4230	4194	4194
query88	3411	2230	2229	2229
query89	414	309	291	291
query90	1854	221	215	215
query91	145	141	116	116
query92	84	72	72	72
query93	1700	978	649	649
query94	682	400	315	315
query95	394	323	308	308
query96	493	579	277	277
query97	2655	2667	2564	2564
query98	245	219	212	212
query99	1322	1379	1292	1292
Total cold run time: 273828 ms
Total hot run time: 185317 ms

@doris-robot
Copy link

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

query1	0.04	0.04	0.04
query2	0.08	0.05	0.04
query3	0.25	0.07	0.07
query4	1.63	0.11	0.11
query5	0.43	0.41	0.40
query6	1.18	0.64	0.63
query7	0.03	0.02	0.02
query8	0.05	0.04	0.04
query9	0.60	0.53	0.52
query10	0.58	0.57	0.57
query11	0.16	0.12	0.11
query12	0.16	0.11	0.12
query13	0.63	0.60	0.62
query14	0.79	0.82	0.86
query15	0.86	0.85	0.90
query16	0.39	0.38	0.39
query17	1.06	1.06	1.06
query18	0.20	0.19	0.20
query19	1.94	1.85	1.78
query20	0.01	0.01	0.01
query21	15.40	0.93	0.57
query22	0.80	1.15	0.85
query23	14.74	1.39	0.66
query24	6.68	1.41	1.15
query25	0.49	0.26	0.05
query26	0.61	0.17	0.13
query27	0.05	0.07	0.05
query28	9.59	0.98	0.42
query29	12.61	3.90	3.24
query30	3.05	3.01	3.00
query31	2.83	0.58	0.38
query32	3.23	0.54	0.48
query33	3.06	3.03	3.16
query34	16.16	5.43	4.92
query35	4.87	4.93	4.96
query36	0.68	0.52	0.49
query37	0.09	0.06	0.07
query38	0.05	0.04	0.04
query39	0.03	0.02	0.02
query40	0.17	0.15	0.13
query41	0.08	0.03	0.02
query42	0.03	0.03	0.02
query43	0.04	0.03	0.03
Total cold run time: 106.41 s
Total hot run time: 33.02 s

@hello-stephen
Copy link
Contributor

FE UT Coverage Report

Increment line coverage 47.76% (160/335) 🎉
Increment coverage report
Complete coverage report

@seawinde
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17634	5206	5097	5097
q2	1914	289	188	188
q3	10306	1250	713	713
q4	10226	1010	527	527
q5	7503	2660	2312	2312
q6	175	159	131	131
q7	890	735	613	613
q8	9300	1218	1079	1079
q9	6879	5074	5110	5074
q10	6926	2388	1976	1976
q11	469	302	266	266
q12	347	346	213	213
q13	17766	3618	3044	3044
q14	242	232	214	214
q15	570	485	484	484
q16	446	422	381	381
q17	594	850	360	360
q18	7385	7008	7047	7008
q19	1103	955	553	553
q20	342	327	218	218
q21	3874	2548	2381	2381
q22	1039	1020	1002	1002
Total cold run time: 105930 ms
Total hot run time: 33834 ms

----- Round 2, with runtime_filter_mode=off -----
q1	5124	5138	5114	5114
q2	241	323	225	225
q3	2200	2702	2328	2328
q4	1398	1817	1344	1344
q5	4188	4440	4572	4440
q6	228	170	127	127
q7	2011	1991	1777	1777
q8	2657	2602	2708	2602
q9	7258	7288	7319	7288
q10	3122	3333	2837	2837
q11	586	532	511	511
q12	699	800	634	634
q13	3535	3968	3378	3378
q14	295	318	281	281
q15	529	471	497	471
q16	468	514	465	465
q17	1211	1562	1432	1432
q18	7917	7697	7631	7631
q19	800	796	857	796
q20	2020	2020	1860	1860
q21	4662	4387	4448	4387
q22	1068	1036	1001	1001
Total cold run time: 52217 ms
Total hot run time: 50929 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 185154 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 14e82ba8cd83e202ddb7d77b0b8ebc115df7a0b0, data reload: false

query1	991	390	412	390
query2	6509	1735	1734	1734
query3	6739	215	218	215
query4	26100	23659	23224	23224
query5	4382	606	484	484
query6	291	205	199	199
query7	4633	493	286	286
query8	268	241	218	218
query9	8594	2856	2856	2856
query10	484	365	288	288
query11	15745	14994	14975	14975
query12	168	128	123	123
query13	1669	557	449	449
query14	8563	5991	5860	5860
query15	210	201	171	171
query16	7227	639	491	491
query17	1236	729	595	595
query18	2004	429	327	327
query19	201	185	164	164
query20	122	120	115	115
query21	218	120	107	107
query22	4089	4150	4074	4074
query23	33901	32873	32738	32738
query24	8087	2361	2348	2348
query25	543	468	400	400
query26	1240	265	156	156
query27	2764	513	349	349
query28	4359	2247	2220	2220
query29	817	567	449	449
query30	285	222	200	200
query31	875	791	735	735
query32	81	74	71	71
query33	549	367	334	334
query34	791	876	504	504
query35	788	859	730	730
query36	991	1040	902	902
query37	117	105	87	87
query38	4016	4086	3988	3988
query39	1516	1438	1431	1431
query40	214	128	113	113
query41	58	53	52	52
query42	121	120	110	110
query43	519	494	480	480
query44	1326	857	839	839
query45	175	174	168	168
query46	868	1019	631	631
query47	1753	1830	1748	1748
query48	385	438	331	331
query49	728	472	390	390
query50	630	683	403	403
query51	4021	4143	4072	4072
query52	113	106	103	103
query53	236	265	193	193
query54	594	589	522	522
query55	87	87	85	85
query56	311	294	299	294
query57	1173	1175	1121	1121
query58	281	283	265	265
query59	2671	2666	2676	2666
query60	345	324	329	324
query61	153	123	120	120
query62	797	732	646	646
query63	225	188	187	187
query64	4362	989	677	677
query65	4269	4199	4225	4199
query66	1225	436	324	324
query67	15416	15398	15240	15240
query68	8091	909	574	574
query69	503	339	288	288
query70	1244	1117	1064	1064
query71	472	328	367	328
query72	5541	4781	4892	4781
query73	768	681	364	364
query74	9196	9004	8884	8884
query75	3881	3080	2582	2582
query76	3756	1131	733	733
query77	782	398	334	334
query78	9775	9681	8898	8898
query79	2669	799	594	594
query80	646	526	475	475
query81	507	259	217	217
query82	497	139	103	103
query83	272	247	237	237
query84	246	109	87	87
query85	806	364	422	364
query86	397	311	305	305
query87	4198	4248	4112	4112
query88	3503	2230	2207	2207
query89	400	312	281	281
query90	1861	222	225	222
query91	138	137	114	114
query92	87	76	69	69
query93	1920	984	642	642
query94	646	397	305	305
query95	401	316	309	309
query96	489	569	276	276
query97	2646	2697	2634	2634
query98	248	221	216	216
query99	1443	1369	1265	1265
Total cold run time: 273248 ms
Total hot run time: 185154 ms

@doris-robot
Copy link

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

query1	0.04	0.03	0.03
query2	0.07	0.04	0.04
query3	0.24	0.07	0.07
query4	1.63	0.10	0.11
query5	0.45	0.43	0.42
query6	1.18	0.66	0.65
query7	0.02	0.02	0.02
query8	0.04	0.03	0.04
query9	0.58	0.53	0.52
query10	0.57	0.56	0.57
query11	0.16	0.11	0.11
query12	0.15	0.12	0.11
query13	0.62	0.60	0.61
query14	0.78	0.83	0.84
query15	0.85	0.84	0.83
query16	0.41	0.41	0.39
query17	1.05	1.04	1.03
query18	0.21	0.20	0.20
query19	1.94	1.82	1.80
query20	0.01	0.02	0.01
query21	15.42	0.93	0.58
query22	0.74	1.11	0.83
query23	14.81	1.38	0.65
query24	7.71	0.67	0.73
query25	0.53	0.14	0.17
query26	0.59	0.16	0.12
query27	0.06	0.06	0.06
query28	9.84	0.94	0.43
query29	12.65	3.91	3.24
query30	3.09	2.99	3.00
query31	2.82	0.59	0.38
query32	3.24	0.55	0.46
query33	3.09	3.15	3.09
query34	16.06	5.44	4.89
query35	4.91	4.92	4.92
query36	0.70	0.51	0.49
query37	0.10	0.07	0.06
query38	0.05	0.04	0.04
query39	0.04	0.03	0.02
query40	0.18	0.14	0.14
query41	0.07	0.03	0.03
query42	0.03	0.03	0.02
query43	0.04	0.03	0.04
Total cold run time: 107.77 s
Total hot run time: 32.63 s

@hello-stephen
Copy link
Contributor

FE UT Coverage Report

Increment line coverage 47.76% (160/335) 🎉
Increment coverage report
Complete coverage report

@seawinde
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17604	5333	5103	5103
q2	1994	378	214	214
q3	10192	1303	745	745
q4	10232	1033	545	545
q5	7588	2425	2360	2360
q6	187	174	141	141
q7	921	767	633	633
q8	9350	1329	1141	1141
q9	6908	5140	5106	5106
q10	6916	2391	2000	2000
q11	480	310	284	284
q12	374	359	229	229
q13	17770	3661	3093	3093
q14	239	251	220	220
q15	569	500	510	500
q16	433	426	375	375
q17	590	854	356	356
q18	7542	7257	7042	7042
q19	1249	953	567	567
q20	350	345	222	222
q21	4108	3221	2367	2367
q22	1068	1048	982	982
Total cold run time: 106664 ms
Total hot run time: 34225 ms

----- Round 2, with runtime_filter_mode=off -----
q1	5193	5175	5139	5139
q2	252	332	221	221
q3	2183	2681	2337	2337
q4	1386	1794	1325	1325
q5	4249	4524	4661	4524
q6	219	179	136	136
q7	2156	1928	1882	1882
q8	2648	2694	2581	2581
q9	7546	7414	7378	7378
q10	3108	3299	2966	2966
q11	719	534	511	511
q12	705	796	656	656
q13	3446	3939	3418	3418
q14	301	314	292	292
q15	508	521	480	480
q16	463	501	443	443
q17	1246	1685	1350	1350
q18	7755	7729	7639	7639
q19	873	872	904	872
q20	2068	2058	1977	1977
q21	5089	4613	4581	4581
q22	1081	1048	983	983
Total cold run time: 53194 ms
Total hot run time: 51691 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 184647 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 17d4d65337c01e5bc1c0ebdd6ce593443fc7ff22, data reload: false

query1	1049	465	414	414
query2	6556	1744	1748	1744
query3	6761	230	225	225
query4	26267	23236	23376	23236
query5	4454	656	507	507
query6	336	242	229	229
query7	4658	520	311	311
query8	312	267	247	247
query9	8667	2932	2971	2932
query10	503	340	309	309
query11	15881	15005	14886	14886
query12	188	121	128	121
query13	1687	600	448	448
query14	9957	5857	5872	5857
query15	225	189	167	167
query16	7657	655	482	482
query17	1301	742	619	619
query18	2035	434	334	334
query19	212	193	187	187
query20	138	128	118	118
query21	220	129	120	120
query22	4101	4089	4117	4089
query23	34071	33126	33016	33016
query24	8098	2403	2405	2403
query25	581	508	450	450
query26	1249	277	171	171
query27	2726	514	368	368
query28	4400	2284	2260	2260
query29	771	634	486	486
query30	290	228	197	197
query31	927	829	717	717
query32	90	88	79	79
query33	567	395	375	375
query34	806	843	516	516
query35	824	839	748	748
query36	970	1009	902	902
query37	127	116	96	96
query38	4227	3966	3995	3966
query39	1506	1457	1455	1455
query40	231	135	128	128
query41	69	69	68	68
query42	131	115	121	115
query43	504	546	498	498
query44	1364	880	880	880
query45	181	177	176	176
query46	893	1017	656	656
query47	1860	1812	1729	1729
query48	402	442	353	353
query49	805	510	414	414
query50	662	677	396	396
query51	4073	4121	4018	4018
query52	125	118	108	108
query53	248	265	204	204
query54	620	607	553	553
query55	97	91	90	90
query56	343	337	320	320
query57	1214	1223	1130	1130
query58	301	288	281	281
query59	2673	2719	2622	2622
query60	366	362	344	344
query61	170	155	159	155
query62	819	710	676	676
query63	231	201	198	198
query64	4447	1143	830	830
query65	4288	4246	4220	4220
query66	1078	453	361	361
query67	15635	15209	15037	15037
query68	6905	916	583	583
query69	492	331	302	302
query70	1197	1116	1125	1116
query71	443	346	336	336
query72	5841	5006	2607	2607
query73	654	606	367	367
query74	8991	9073	9066	9066
query75	3164	3081	2632	2632
query76	3247	1108	725	725
query77	502	427	335	335
query78	9604	9578	8900	8900
query79	2443	837	587	587
query80	616	564	512	512
query81	501	259	226	226
query82	456	146	113	113
query83	268	265	246	246
query84	267	116	90	90
query85	932	518	428	428
query86	387	305	288	288
query87	4296	4305	4219	4219
query88	3750	2230	2210	2210
query89	392	325	300	300
query90	1915	230	226	226
query91	160	159	130	130
query92	85	76	73	73
query93	1903	984	665	665
query94	747	417	327	327
query95	418	341	331	331
query96	489	572	278	278
query97	2652	2675	2561	2561
query98	261	226	234	226
query99	1375	1420	1295	1295
Total cold run time: 274578 ms
Total hot run time: 184647 ms

@doris-robot
Copy link

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

query1	0.06	0.05	0.05
query2	0.10	0.06	0.07
query3	0.26	0.09	0.09
query4	1.62	0.12	0.12
query5	0.46	0.43	0.44
query6	1.20	0.65	0.65
query7	0.04	0.04	0.03
query8	0.06	0.05	0.05
query9	0.61	0.53	0.53
query10	0.58	0.60	0.59
query11	0.17	0.12	0.12
query12	0.16	0.12	0.12
query13	0.64	0.63	0.63
query14	0.81	0.83	0.84
query15	0.88	0.86	0.85
query16	0.39	0.43	0.39
query17	1.10	1.07	1.06
query18	0.23	0.21	0.21
query19	1.98	1.90	1.82
query20	0.02	0.02	0.01
query21	15.41	0.93	0.58
query22	0.79	1.30	0.77
query23	14.76	1.39	0.66
query24	6.90	0.83	0.82
query25	0.52	0.23	0.08
query26	0.60	0.16	0.13
query27	0.07	0.06	0.06
query28	10.30	0.94	0.45
query29	12.55	3.87	3.22
query30	3.13	3.06	3.01
query31	2.84	0.60	0.39
query32	3.24	0.60	0.48
query33	3.08	3.09	3.08
query34	15.98	5.50	4.91
query35	4.91	4.91	4.92
query36	0.69	0.52	0.52
query37	0.11	0.08	0.07
query38	0.06	0.05	0.06
query39	0.04	0.04	0.03
query40	0.19	0.16	0.15
query41	0.09	0.04	0.03
query42	0.04	0.03	0.03
query43	0.05	0.04	0.04
Total cold run time: 107.72 s
Total hot run time: 33.11 s

@hello-stephen
Copy link
Contributor

FE UT Coverage Report

Increment line coverage 47.48% (160/337) 🎉
Increment coverage report
Complete coverage report

@seawinde seawinde force-pushed the support_window_rewrite_single_pr branch from 17d4d65 to 2a15f77 Compare October 24, 2025 09:38
@seawinde
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

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

query1	0.07	0.05	0.05
query2	0.10	0.05	0.05
query3	0.26	0.09	0.09
query4	1.62	0.12	0.12
query5	0.28	0.27	0.25
query6	1.20	0.65	0.66
query7	0.03	0.03	0.04
query8	0.06	0.05	0.05
query9	0.65	0.55	0.53
query10	0.61	0.59	0.58
query11	0.18	0.12	0.11
query12	0.17	0.13	0.12
query13	0.64	0.62	0.60
query14	1.03	1.03	1.01
query15	0.88	0.85	0.87
query16	0.44	0.39	0.41
query17	1.04	1.10	1.07
query18	0.23	0.21	0.21
query19	1.97	1.84	1.84
query20	0.02	0.02	0.01
query21	15.45	0.19	0.13
query22	5.07	0.08	0.05
query23	15.68	0.28	0.11
query24	2.56	0.63	0.41
query25	0.07	0.07	0.07
query26	0.16	0.13	0.15
query27	0.07	0.06	0.06
query28	4.17	1.16	0.96
query29	12.57	4.12	3.39
query30	0.31	0.15	0.12
query31	2.83	0.63	0.40
query32	3.25	0.56	0.48
query33	3.09	3.11	3.18
query34	16.07	5.20	4.55
query35	4.60	4.61	4.60
query36	0.68	0.53	0.52
query37	0.10	0.06	0.07
query38	0.07	0.05	0.05
query39	0.04	0.03	0.04
query40	0.18	0.16	0.14
query41	0.08	0.03	0.04
query42	0.05	0.03	0.03
query43	0.05	0.04	0.04
Total cold run time: 98.68 s
Total hot run time: 28.08 s

@seawinde
Copy link
Contributor Author

seawinde commented Nov 5, 2025

run buildall

@doris-robot
Copy link

TPC-DS: Total hot run time: 189414 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 35eb6e1ccb08cba50e6d9be4264230843197a385, data reload: false

query1	1069	400	381	381
query2	6580	1716	1675	1675
query3	6760	232	221	221
query4	26521	23529	22999	22999
query5	4518	624	470	470
query6	350	251	234	234
query7	4654	493	295	295
query8	311	264	249	249
query9	8735	2553	2574	2553
query10	510	349	294	294
query11	15544	15074	15462	15074
query12	192	121	115	115
query13	1700	569	455	455
query14	12782	9222	9288	9222
query15	211	193	177	177
query16	7712	662	521	521
query17	1652	798	627	627
query18	2066	484	395	395
query19	268	222	200	200
query20	146	136	130	130
query21	243	138	124	124
query22	4587	4576	4679	4576
query23	34632	33987	33611	33611
query24	8230	2642	2499	2499
query25	580	518	465	465
query26	1239	303	169	169
query27	3239	521	368	368
query28	4514	2276	2213	2213
query29	840	675	515	515
query30	322	233	217	217
query31	946	825	756	756
query32	93	69	74	69
query33	648	382	353	353
query34	812	890	549	549
query35	841	879	805	805
query36	991	1047	929	929
query37	132	112	84	84
query38	3615	3478	3478	3478
query39	1474	1412	1406	1406
query40	224	136	119	119
query41	59	55	61	55
query42	122	112	105	105
query43	461	491	482	482
query44	1205	727	726	726
query45	175	178	172	172
query46	873	982	628	628
query47	1786	1793	1728	1728
query48	407	423	336	336
query49	766	498	417	417
query50	633	682	404	404
query51	3924	3902	3949	3902
query52	107	112	97	97
query53	228	258	199	199
query54	303	284	278	278
query55	84	86	80	80
query56	328	332	300	300
query57	1168	1192	1144	1144
query58	288	274	274	274
query59	2525	2672	2584	2584
query60	345	353	324	324
query61	163	160	158	158
query62	811	728	638	638
query63	226	196	194	194
query64	4471	1148	841	841
query65	4004	3990	3950	3950
query66	1093	427	359	359
query67	15360	15186	15009	15009
query68	8476	926	582	582
query69	472	328	291	291
query70	1408	1300	1268	1268
query71	498	333	318	318
query72	6006	4963	5016	4963
query73	687	600	359	359
query74	9150	8989	8796	8796
query75	3995	3361	2854	2854
query76	3819	1166	744	744
query77	807	416	309	309
query78	9489	9719	8960	8960
query79	2401	818	596	596
query80	700	561	508	508
query81	488	263	228	228
query82	464	158	140	140
query83	292	264	245	245
query84	300	113	94	94
query85	907	470	431	431
query86	341	292	307	292
query87	3705	3787	3612	3612
query88	3593	2218	2193	2193
query89	379	329	292	292
query90	2035	213	213	213
query91	160	164	140	140
query92	84	68	64	64
query93	1624	965	636	636
query94	683	436	338	338
query95	408	320	317	317
query96	483	565	287	287
query97	2981	2953	2859	2859
query98	243	214	212	212
query99	1438	1457	1297	1297
Total cold run time: 280914 ms
Total hot run time: 189414 ms

@doris-robot
Copy link

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

query1	0.06	0.05	0.05
query2	0.09	0.05	0.06
query3	0.25	0.08	0.09
query4	1.61	0.12	0.11
query5	0.27	0.25	0.25
query6	1.16	0.64	0.65
query7	0.03	0.02	0.03
query8	0.05	0.04	0.04
query9	0.60	0.52	0.51
query10	0.57	0.58	0.57
query11	0.16	0.12	0.11
query12	0.15	0.13	0.12
query13	0.63	0.60	0.61
query14	1.01	0.99	0.98
query15	0.84	0.82	0.84
query16	0.40	0.39	0.40
query17	0.98	0.99	1.01
query18	0.23	0.21	0.20
query19	1.89	1.82	1.81
query20	0.01	0.01	0.01
query21	15.49	0.17	0.13
query22	5.54	0.07	0.04
query23	16.79	0.27	0.10
query24	3.72	0.60	0.63
query25	0.08	0.06	0.06
query26	0.14	0.13	0.14
query27	0.07	0.06	0.06
query28	6.08	1.21	0.94
query29	12.81	3.99	3.26
query30	0.28	0.14	0.11
query31	2.82	0.59	0.40
query32	3.23	0.55	0.48
query33	3.02	3.09	3.08
query34	15.78	5.11	4.57
query35	4.58	4.57	4.60
query36	0.69	0.50	0.50
query37	0.09	0.06	0.06
query38	0.07	0.04	0.04
query39	0.03	0.03	0.03
query40	0.17	0.15	0.14
query41	0.09	0.03	0.03
query42	0.04	0.03	0.03
query43	0.04	0.03	0.04
Total cold run time: 102.64 s
Total hot run time: 27.74 s

@hello-stephen
Copy link
Contributor

FE UT Coverage Report

Increment line coverage 51.18% (174/340) 🎉
Increment coverage report
Complete coverage report

@seawinde
Copy link
Contributor Author

seawinde commented Nov 5, 2025

run buildall

@doris-robot
Copy link

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

query1	1085	406	383	383
query2	6581	1707	1692	1692
query3	6755	230	218	218
query4	26533	23318	22993	22993
query5	4426	623	473	473
query6	334	233	214	214
query7	4654	487	306	306
query8	311	256	240	240
query9	8722	2580	2576	2576
query10	498	362	290	290
query11	15948	15057	15518	15057
query12	191	124	115	115
query13	1707	598	443	443
query14	11930	9433	9547	9433
query15	214	207	184	184
query16	7791	737	559	559
query17	1777	918	679	679
query18	2357	457	348	348
query19	253	249	181	181
query20	126	127	119	119
query21	223	134	115	115
query22	4549	4587	4830	4587
query23	34805	33785	33838	33785
query24	8332	2358	2374	2358
query25	615	508	446	446
query26	1235	272	153	153
query27	2719	493	339	339
query28	4331	2171	2158	2158
query29	796	613	484	484
query30	299	226	190	190
query31	901	828	718	718
query32	82	66	67	66
query33	589	361	321	321
query34	790	840	510	510
query35	803	815	730	730
query36	952	982	908	908
query37	119	108	80	80
query38	3576	3543	3537	3537
query39	1461	1416	1397	1397
query40	219	124	115	115
query41	60	55	56	55
query42	119	111	105	105
query43	486	483	463	463
query44	1194	717	745	717
query45	178	177	168	168
query46	891	982	632	632
query47	1767	1812	1734	1734
query48	393	424	314	314
query49	768	510	424	424
query50	626	692	409	409
query51	3941	3963	3884	3884
query52	110	104	100	100
query53	241	263	191	191
query54	295	288	273	273
query55	85	86	82	82
query56	323	332	320	320
query57	1174	1206	1126	1126
query58	286	271	279	271
query59	2543	2667	2491	2491
query60	360	350	319	319
query61	164	157	162	157
query62	796	724	654	654
query63	220	192	188	188
query64	4436	1186	871	871
query65	3995	3942	3944	3942
query66	1110	423	337	337
query67	15385	15047	15092	15047
query68	5028	895	602	602
query69	499	349	284	284
query70	1324	1327	1295	1295
query71	438	355	328	328
query72	6263	5226	5161	5161
query73	675	615	362	362
query74	8881	9227	8927	8927
query75	3327	3337	2859	2859
query76	3360	1158	719	719
query77	512	396	312	312
query78	9646	9793	8908	8908
query79	2552	813	594	594
query80	830	551	509	509
query81	528	258	218	218
query82	411	158	128	128
query83	282	258	253	253
query84	257	115	92	92
query85	909	494	457	457
query86	415	313	274	274
query87	3638	3668	3565	3565
query88	3768	2270	2258	2258
query89	385	326	292	292
query90	2004	221	218	218
query91	175	169	138	138
query92	81	66	60	60
query93	2582	965	640	640
query94	755	455	345	345
query95	401	309	314	309
query96	485	584	294	294
query97	2943	2949	2860	2860
query98	240	213	216	213
query99	1356	1379	1299	1299
Total cold run time: 276485 ms
Total hot run time: 189547 ms

@doris-robot
Copy link

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

query1	0.05	0.05	0.05
query2	0.10	0.05	0.04
query3	0.24	0.08	0.08
query4	1.60	0.12	0.11
query5	0.28	0.26	0.25
query6	1.17	0.64	0.64
query7	0.03	0.02	0.02
query8	0.05	0.04	0.03
query9	0.59	0.52	0.51
query10	0.57	0.58	0.56
query11	0.16	0.11	0.11
query12	0.15	0.11	0.12
query13	0.63	0.60	0.60
query14	1.01	1.00	0.98
query15	0.85	0.82	0.82
query16	0.41	0.38	0.39
query17	1.02	1.04	1.04
query18	0.21	0.21	0.22
query19	1.95	1.82	1.80
query20	0.02	0.01	0.01
query21	15.46	0.21	0.13
query22	5.02	0.08	0.04
query23	15.66	0.26	0.11
query24	2.74	0.49	0.88
query25	0.08	0.06	0.06
query26	0.14	0.14	0.14
query27	0.05	0.06	0.06
query28	4.31	1.15	0.92
query29	12.57	3.91	3.27
query30	0.28	0.14	0.11
query31	2.82	0.59	0.37
query32	3.24	0.55	0.47
query33	3.10	3.03	3.03
query34	15.98	5.21	4.60
query35	4.60	4.59	4.61
query36	0.66	0.50	0.49
query37	0.10	0.07	0.07
query38	0.07	0.04	0.04
query39	0.04	0.03	0.03
query40	0.16	0.15	0.14
query41	0.08	0.04	0.03
query42	0.03	0.04	0.03
query43	0.04	0.04	0.03
Total cold run time: 98.32 s
Total hot run time: 27.6 s

@hello-stephen
Copy link
Contributor

FE Regression Coverage Report

Increment line coverage 85.04% (290/341) 🎉
Increment coverage report
Complete coverage report

@github-actions github-actions bot added the approved Indicates a PR has been approved by one committer. label Nov 7, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Nov 7, 2025

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

@github-actions
Copy link
Contributor

github-actions bot commented Nov 7, 2025

PR approved by anyone and no changes requested.

@morrySnow morrySnow merged commit dfe888e into apache:master Nov 10, 2025
30 checks passed
@morrySnow morrySnow changed the title [opt](mtmv) Support window function rewrite when materialized view contains window function [opt](mtmv) Support window function rewrite when materialized view contains window function Nov 10, 2025
github-actions bot pushed a commit that referenced this pull request Nov 10, 2025
…ntains window function (#55066)

### What problem does this PR solve?

Support window function rewrite when materialized view contains window
function

Such as mv def is as following:

        CREATE MATERIALIZED VIEW mv1
        BUILD IMMEDIATE REFRESH COMPLETE ON MANUAL
        DISTRIBUTED BY RANDOM BUCKETS 2
        PROPERTIES ('replication_num' = '1') 
        AS
        select *
        from (
        select 
        o_orderkey,
        FIRST_VALUE(o_custkey) OVER (
                PARTITION BY o_orderdate 
                ORDER BY o_totalprice NULLS LAST
                RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW
            ) AS first_value,
        RANK() OVER (
                PARTITION BY o_orderdate, o_orderstatus 
                ORDER BY o_totalprice NULLS LAST
                RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW
            ) AS rank_value,
        LAG(l_extendedprice, 1, 0) over (partition by o_orderdate, l_shipdate order by l_quantity) AS lag_value 
        from 
        lineitem2
        left join orders2 on l_orderkey = o_orderkey and l_shipdate = o_orderdate
        ) t
        where o_orderkey > 1;

if query as following, this can use mv to represent query

select *
            from (
            select 
            o_orderkey,
            FIRST_VALUE(o_custkey) OVER (
                    PARTITION BY o_orderdate 
                    ORDER BY o_totalprice NULLS LAST
                    RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW
                ) AS first_value,
            RANK() OVER (
                    PARTITION BY o_orderdate, o_orderstatus 
                    ORDER BY o_totalprice NULLS LAST
                    RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW
                ) AS rank_value,
            LAG(l_extendedprice, 1, 0) over (partition by o_orderdate, l_shipdate order by l_quantity) AS lag_value 
            from 
            lineitem2
            left join orders2 on l_orderkey = o_orderkey and l_shipdate = o_orderdate
            ) t
            where o_orderkey > 2;

explain result is as follwing:

+----------------------------------------------------------------------------------------+
| Explain String(Nereids Planner)                                                        |
+----------------------------------------------------------------------------------------+
| PLAN FRAGMENT 0                                                                        |
|   OUTPUT EXPRS:                                                                        |
|     o_orderkey[#4]                                                                     |
|     first_value[#5]                                                                    |
|     rank_value[#6]                                                                     |
|     lag_value[#7]                                                                      |
|   PARTITION: RANDOM                                                                    |
|                                                                                        |
|   HAS_COLO_PLAN_NODE: false                                                            |
|                                                                                        |
|   VRESULT SINK                                                                         |
|      MYSQL_PROTOCAL                                                                    |
|                                                                                        |
|   0:VOlapScanNode(445)                                                                 |
|      TABLE: regression_test_nereids_rules_p0_mv_window.mv1(mv1), PREAGGREGATION: ON    |
|      PREDICATES: (o_orderkey[#0] > 2)                                                  |
|      partitions=1/1 (mv1)                                                              |
|      tablets=2/2, tabletList=1755678381149,1755678381151                               |
|      cardinality=1, avgRowSize=0.0, numNodes=1                                         |
|      pushAggOp=NONE                                                                    |
|      final projections: o_orderkey[#0], first_value[#1], rank_value[#2], lag_value[#3] |
|      final project output tuple id: 1                                                  |
|                                                                                        |
|                                                                                        |
| ========== MATERIALIZATIONS ==========                                                 |
|                                                                                        |
| MaterializedView                                                                       |
| MaterializedViewRewriteSuccessAndChose:                                                |
|   internal.regression_test_nereids_rules_p0_mv_window.mv1 chose                        |
|                                                                                        |
| MaterializedViewRewriteSuccessButNotChose:                                             |
|                                                                                        |
| MaterializedViewRewriteFail:                                                           |
|                                                                                        |
|                                                                                        |
| ========== STATISTICS ==========                                                       |
| planed with unknown column statistics                                                  |
+----------------------------------------------------------------------------------------+
yiguolei pushed a commit that referenced this pull request Nov 13, 2025
…ized view contains window function #55066 (#57839)

Cherry-picked from #55066

Co-authored-by: seawinde <wusi@selectdb.com>
wyxxxcat pushed a commit to wyxxxcat/doris that referenced this pull request Nov 18, 2025
…ntains window function (apache#55066)

### What problem does this PR solve?

Support window function rewrite when materialized view contains window
function

Such as mv def is as following:

        CREATE MATERIALIZED VIEW mv1
        BUILD IMMEDIATE REFRESH COMPLETE ON MANUAL
        DISTRIBUTED BY RANDOM BUCKETS 2
        PROPERTIES ('replication_num' = '1') 
        AS
        select *
        from (
        select 
        o_orderkey,
        FIRST_VALUE(o_custkey) OVER (
                PARTITION BY o_orderdate 
                ORDER BY o_totalprice NULLS LAST
                RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW
            ) AS first_value,
        RANK() OVER (
                PARTITION BY o_orderdate, o_orderstatus 
                ORDER BY o_totalprice NULLS LAST
                RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW
            ) AS rank_value,
        LAG(l_extendedprice, 1, 0) over (partition by o_orderdate, l_shipdate order by l_quantity) AS lag_value 
        from 
        lineitem2
        left join orders2 on l_orderkey = o_orderkey and l_shipdate = o_orderdate
        ) t
        where o_orderkey > 1;

if query as following, this can use mv to represent query

select *
            from (
            select 
            o_orderkey,
            FIRST_VALUE(o_custkey) OVER (
                    PARTITION BY o_orderdate 
                    ORDER BY o_totalprice NULLS LAST
                    RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW
                ) AS first_value,
            RANK() OVER (
                    PARTITION BY o_orderdate, o_orderstatus 
                    ORDER BY o_totalprice NULLS LAST
                    RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW
                ) AS rank_value,
            LAG(l_extendedprice, 1, 0) over (partition by o_orderdate, l_shipdate order by l_quantity) AS lag_value 
            from 
            lineitem2
            left join orders2 on l_orderkey = o_orderkey and l_shipdate = o_orderdate
            ) t
            where o_orderkey > 2;

explain result is as follwing:

+----------------------------------------------------------------------------------------+
| Explain String(Nereids Planner)                                                        |
+----------------------------------------------------------------------------------------+
| PLAN FRAGMENT 0                                                                        |
|   OUTPUT EXPRS:                                                                        |
|     o_orderkey[apache#4]                                                                     |
|     first_value[apache#5]                                                                    |
|     rank_value[apache#6]                                                                     |
|     lag_value[apache#7]                                                                      |
|   PARTITION: RANDOM                                                                    |
|                                                                                        |
|   HAS_COLO_PLAN_NODE: false                                                            |
|                                                                                        |
|   VRESULT SINK                                                                         |
|      MYSQL_PROTOCAL                                                                    |
|                                                                                        |
|   0:VOlapScanNode(445)                                                                 |
|      TABLE: regression_test_nereids_rules_p0_mv_window.mv1(mv1), PREAGGREGATION: ON    |
|      PREDICATES: (o_orderkey[#0] > 2)                                                  |
|      partitions=1/1 (mv1)                                                              |
|      tablets=2/2, tabletList=1755678381149,1755678381151                               |
|      cardinality=1, avgRowSize=0.0, numNodes=1                                         |
|      pushAggOp=NONE                                                                    |
|      final projections: o_orderkey[#0], first_value[#1], rank_value[apache#2], lag_value[apache#3] |
|      final project output tuple id: 1                                                  |
|                                                                                        |
|                                                                                        |
| ========== MATERIALIZATIONS ==========                                                 |
|                                                                                        |
| MaterializedView                                                                       |
| MaterializedViewRewriteSuccessAndChose:                                                |
|   internal.regression_test_nereids_rules_p0_mv_window.mv1 chose                        |
|                                                                                        |
| MaterializedViewRewriteSuccessButNotChose:                                             |
|                                                                                        |
| MaterializedViewRewriteFail:                                                           |
|                                                                                        |
|                                                                                        |
| ========== STATISTICS ==========                                                       |
| planed with unknown column statistics                                                  |
+----------------------------------------------------------------------------------------+
morrySnow pushed a commit that referenced this pull request Nov 26, 2025
This PR aims to fix several failing regression tests related to
Materialized Views (MTMV), ensuring the stability and correctness of the
MTMV feature.

The specific failing test cases addressed are:

nereids_rules_p0.mv.pre_rewrite.limit.query_with_limit
nested_materialized_view
mv_tpch_test

Related PR: 
#55066 
#55674
github-actions bot pushed a commit that referenced this pull request Nov 26, 2025
This PR aims to fix several failing regression tests related to
Materialized Views (MTMV), ensuring the stability and correctness of the
MTMV feature.

The specific failing test cases addressed are:

nereids_rules_p0.mv.pre_rewrite.limit.query_with_limit
nested_materialized_view
mv_tpch_test

Related PR: 
#55066 
#55674
@yiguolei yiguolei mentioned this pull request Dec 2, 2025
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/4.0.2-merged reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants