Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[improvement](mtmv) Materialized view partition track supports date_trunc and optimize the fail reason #35562

Merged
merged 14 commits into from
Jun 5, 2024

Conversation

seawinde
Copy link
Contributor

@seawinde seawinde commented May 29, 2024

Proposed changes

this depends on #34781

Materialized view partition track supports date_trunc and optimize the fail reason.
it supports create partition mv as following:
this mv will be partition updated by day

CREATE MATERIALIZED VIEW mv_6
BUILD IMMEDIATE REFRESH AUTO ON MANUAL
partition by(date_trunc(date_alias, 'day'))
DISTRIBUTED BY RANDOM BUCKETS 2
PROPERTIES ('replication_num' = '1')
AS
SELECT date_trunc(t1.L_SHIPDATE, 'hour') as date_alias, t2.O_ORDERDATE, t1.L_QUANTITY, t2.O_ORDERSTATUS, 
count(distinct case when t1.L_SUPPKEY > 0 then t2.O_ORDERSTATUS else null end) as cnt_1 
from 
  (select * from 
  lineitem 
  where L_SHIPDATE in ('2017-01-30')) t1 
left join 
  (select * from 
  orders 
  where O_ORDERDATE in ('2017-01-30')) t2 
on t1.L_ORDERKEY = t2.O_ORDERKEY 
group by 
t1.L_SHIPDATE, 
t2.O_ORDERDATE, 
t1.L_QUANTITY, 
t2.O_ORDERSTATUS;

@doris-robot
Copy link

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR

Since 2024-03-18, the Document has been moved to doris-website.
See Doris Document.

@seawinde
Copy link
Contributor Author

run buildall

1 similar comment
@seawinde
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17624	4736	4202	4202
q2	2025	191	200	191
q3	10466	1174	1203	1174
q4	10190	776	819	776
q5	7472	2707	2708	2707
q6	218	132	131	131
q7	954	590	614	590
q8	9223	2109	2064	2064
q9	9011	6653	6669	6653
q10	10164	3812	3815	3812
q11	442	237	247	237
q12	448	221	233	221
q13	17228	3256	3245	3245
q14	268	225	232	225
q15	502	479	462	462
q16	503	372	389	372
q17	989	643	732	643
q18	8320	7849	7652	7652
q19	5722	1584	1526	1526
q20	628	312	321	312
q21	5180	3944	3236	3236
q22	352	273	274	273
Total cold run time: 117929 ms
Total hot run time: 40704 ms

----- Round 2, with runtime_filter_mode=off -----
q1	4567	4349	4424	4349
q2	373	276	273	273
q3	3164	2933	2934	2933
q4	1964	1636	1542	1542
q5	5426	5508	5486	5486
q6	217	124	126	124
q7	2236	1817	1823	1817
q8	3243	3472	3428	3428
q9	8610	8668	8748	8668
q10	4130	3782	3694	3694
q11	589	506	492	492
q12	782	642	625	625
q13	15981	3170	3178	3170
q14	327	287	280	280
q15	543	488	497	488
q16	492	429	448	429
q17	1870	1515	1522	1515
q18	7959	7788	7778	7778
q19	2163	1602	1561	1561
q20	2097	1887	1875	1875
q21	10852	4931	5058	4931
q22	577	488	499	488
Total cold run time: 78162 ms
Total hot run time: 55946 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 170257 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 5e705fdaaf04fc93304405058c7414c0d1434b15, data reload: false

query1	1609	400	389	389
query2	7990	2433	2282	2282
query3	6647	204	207	204
query4	19264	17247	17344	17247
query5	4141	442	431	431
query6	258	157	170	157
query7	4582	322	300	300
query8	238	188	188	188
query9	8586	2353	2333	2333
query10	449	299	255	255
query11	10489	10221	10066	10066
query12	136	91	87	87
query13	1637	366	369	366
query14	10386	6834	7559	6834
query15	268	177	170	170
query16	8117	265	259	259
query17	1724	534	503	503
query18	2128	283	276	276
query19	284	150	151	150
query20	91	87	87	87
query21	205	132	130	130
query22	4027	3959	3917	3917
query23	33820	33094	32844	32844
query24	10483	2876	2862	2862
query25	588	358	372	358
query26	1144	154	154	154
query27	2393	323	311	311
query28	6629	2036	2037	2036
query29	861	618	603	603
query30	250	154	152	152
query31	945	770	743	743
query32	97	53	56	53
query33	746	270	261	261
query34	975	468	486	468
query35	747	600	623	600
query36	1064	919	897	897
query37	124	64	70	64
query38	2851	2764	2768	2764
query39	825	803	797	797
query40	197	124	123	123
query41	46	44	47	44
query42	102	98	96	96
query43	595	555	543	543
query44	1184	725	743	725
query45	182	160	159	159
query46	1059	729	710	710
query47	1838	1765	1772	1765
query48	362	302	296	296
query49	872	382	392	382
query50	773	390	390	390
query51	6855	6706	6791	6706
query52	104	90	92	90
query53	352	296	287	287
query54	898	426	431	426
query55	74	71	73	71
query56	329	252	255	252
query57	1160	1041	1029	1029
query58	230	210	224	210
query59	3413	3129	3345	3129
query60	285	264	264	264
query61	90	89	90	89
query62	628	455	479	455
query63	313	288	284	284
query64	8813	2313	1828	1828
query65	3161	3096	3098	3096
query66	796	328	327	327
query67	15062	14771	14748	14748
query68	4746	544	548	544
query69	521	270	277	270
query70	1103	1165	1124	1124
query71	423	274	281	274
query72	7205	5644	3816	3816
query73	712	322	320	320
query74	6107	5623	5535	5535
query75	3356	2640	2623	2623
query76	2805	1049	1024	1024
query77	414	273	261	261
query78	10364	9853	9823	9823
query79	2245	500	512	500
query80	906	476	427	427
query81	537	221	211	211
query82	887	89	92	89
query83	255	168	166	166
query84	254	94	83	83
query85	1556	276	260	260
query86	457	312	290	290
query87	3333	3180	3246	3180
query88	4230	2341	2317	2317
query89	476	377	392	377
query90	2058	186	192	186
query91	123	94	98	94
query92	58	48	51	48
query93	1858	499	489	489
query94	1231	180	183	180
query95	399	302	308	302
query96	579	264	263	263
query97	3200	3067	3000	3000
query98	242	223	210	210
query99	1208	860	849	849
Total cold run time: 271419 ms
Total hot run time: 170257 ms

@doris-robot
Copy link

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

query1	0.04	0.04	0.03
query2	0.09	0.04	0.04
query3	0.23	0.06	0.05
query4	1.67	0.07	0.08
query5	0.51	0.49	0.52
query6	1.12	0.73	0.73
query7	0.02	0.01	0.02
query8	0.05	0.04	0.04
query9	0.55	0.49	0.51
query10	0.54	0.54	0.54
query11	0.15	0.12	0.11
query12	0.15	0.12	0.12
query13	0.59	0.58	0.59
query14	0.77	0.78	0.80
query15	0.82	0.81	0.82
query16	0.35	0.37	0.36
query17	0.99	0.94	0.98
query18	0.22	0.23	0.25
query19	1.86	1.75	1.70
query20	0.02	0.01	0.00
query21	15.54	0.69	0.68
query22	5.09	7.13	1.31
query23	18.28	1.41	1.29
query24	2.03	0.25	0.19
query25	0.14	0.08	0.08
query26	0.26	0.16	0.17
query27	0.07	0.08	0.08
query28	13.27	1.03	1.00
query29	13.28	3.30	3.33
query30	0.25	0.06	0.05
query31	2.85	0.39	0.38
query32	3.30	0.47	0.47
query33	3.01	3.00	2.92
query34	17.17	4.39	4.40
query35	4.51	4.60	4.55
query36	0.66	0.50	0.46
query37	0.19	0.16	0.16
query38	0.16	0.15	0.15
query39	0.04	0.04	0.04
query40	0.16	0.13	0.14
query41	0.09	0.04	0.04
query42	0.06	0.05	0.04
query43	0.03	0.03	0.04
Total cold run time: 111.18 s
Total hot run time: 30.02 s

@seawinde
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	18153	4475	4350	4350
q2	3013	206	202	202
q3	11124	1281	1215	1215
q4	10696	797	949	797
q5	7551	2725	2709	2709
q6	229	141	138	138
q7	969	604	606	604
q8	9367	2094	2095	2094
q9	8868	6490	6500	6490
q10	8905	3667	3715	3667
q11	455	251	241	241
q12	400	214	213	213
q13	17773	3016	2994	2994
q14	253	224	219	219
q15	529	481	476	476
q16	508	375	375	375
q17	965	657	679	657
q18	8074	7513	7271	7271
q19	6111	1555	1507	1507
q20	656	310	303	303
q21	4912	3832	3149	3149
q22	335	285	286	285
Total cold run time: 119846 ms
Total hot run time: 39956 ms

----- Round 2, with runtime_filter_mode=off -----
q1	4352	4270	4210	4210
q2	360	255	268	255
q3	3031	2782	2782	2782
q4	1873	1572	1592	1572
q5	5217	5271	5272	5271
q6	211	123	126	123
q7	2089	1767	1699	1699
q8	3194	3360	3304	3304
q9	8304	8348	8337	8337
q10	3842	3729	3653	3653
q11	592	492	504	492
q12	777	569	573	569
q13	17033	3012	3011	3011
q14	298	257	263	257
q15	522	468	484	468
q16	496	407	428	407
q17	1746	1483	1458	1458
q18	7604	7532	7594	7532
q19	1659	1598	1527	1527
q20	1958	1780	1786	1780
q21	5025	4620	4703	4620
q22	563	476	512	476
Total cold run time: 70746 ms
Total hot run time: 53803 ms

@doris-robot
Copy link

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

query1	929	373	376	373
query2	6502	2552	2393	2393
query3	6653	206	207	206
query4	19409	17069	17240	17069
query5	4167	412	421	412
query6	242	160	151	151
query7	4586	298	290	290
query8	239	176	179	176
query9	8676	2473	2454	2454
query10	460	282	267	267
query11	10622	10091	9948	9948
query12	152	87	91	87
query13	1624	361	386	361
query14	10086	7125	6594	6594
query15	209	172	183	172
query16	7842	269	258	258
query17	1811	522	508	508
query18	1953	265	273	265
query19	198	148	144	144
query20	93	81	81	81
query21	196	128	129	128
query22	4457	3972	4002	3972
query23	33673	33043	33029	33029
query24	11884	2910	2808	2808
query25	654	347	358	347
query26	1826	154	153	153
query27	3090	317	319	317
query28	7670	2071	2079	2071
query29	1125	604	605	604
query30	284	145	152	145
query31	953	736	729	729
query32	92	52	56	52
query33	781	280	279	279
query34	999	481	487	481
query35	772	612	617	612
query36	1093	921	890	890
query37	195	72	71	71
query38	2903	2764	2748	2748
query39	870	786	816	786
query40	271	125	123	123
query41	45	43	43	43
query42	105	94	92	92
query43	556	532	541	532
query44	1194	729	754	729
query45	173	160	166	160
query46	1067	698	739	698
query47	1868	1787	1787	1787
query48	369	296	300	296
query49	1216	372	391	372
query50	770	391	382	382
query51	6701	6657	6567	6567
query52	102	88	87	87
query53	353	307	283	283
query54	1005	432	425	425
query55	74	69	71	69
query56	261	239	257	239
query57	1134	1028	1046	1028
query58	246	214	205	205
query59	3497	3458	3116	3116
query60	281	262	252	252
query61	90	89	90	89
query62	653	437	465	437
query63	330	278	278	278
query64	9841	2183	1788	1788
query65	3173	3101	3116	3101
query66	1365	336	334	334
query67	15270	14838	14813	14813
query68	4575	553	556	553
query69	434	274	283	274
query70	1189	1123	1098	1098
query71	399	271	277	271
query72	7769	5506	5436	5436
query73	740	335	327	327
query74	5972	5692	5609	5609
query75	3334	2660	2584	2584
query76	2503	978	916	916
query77	416	260	276	260
query78	10296	9734	9737	9734
query79	2166	519	517	517
query80	918	425	426	425
query81	526	221	216	216
query82	642	95	93	93
query83	237	171	180	171
query84	238	92	88	88
query85	1919	337	261	261
query86	484	304	298	298
query87	3357	3086	3114	3086
query88	4145	2441	2428	2428
query89	471	386	401	386
query90	1996	187	182	182
query91	122	98	105	98
query92	62	48	48	48
query93	2381	530	519	519
query94	1245	192	186	186
query95	402	313	322	313
query96	603	274	262	262
query97	3193	3022	3033	3022
query98	240	221	209	209
query99	1134	837	833	833
Total cold run time: 276088 ms
Total hot run time: 171459 ms

@doris-robot
Copy link

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

query1	0.04	0.03	0.03
query2	0.08	0.04	0.05
query3	0.23	0.06	0.05
query4	1.67	0.08	0.09
query5	0.49	0.48	0.48
query6	1.13	0.73	0.72
query7	0.02	0.01	0.01
query8	0.06	0.04	0.04
query9	0.54	0.48	0.49
query10	0.54	0.55	0.54
query11	0.16	0.11	0.12
query12	0.14	0.12	0.12
query13	0.59	0.59	0.59
query14	0.77	0.78	0.78
query15	0.84	0.81	0.80
query16	0.38	0.37	0.37
query17	0.96	0.99	0.94
query18	0.20	0.22	0.28
query19	1.75	1.72	1.69
query20	0.01	0.01	0.01
query21	15.47	0.71	0.68
query22	3.59	7.45	2.07
query23	18.31	1.38	1.37
query24	1.94	0.22	0.20
query25	0.15	0.09	0.08
query26	0.27	0.17	0.16
query27	0.08	0.08	0.08
query28	13.41	1.00	0.98
query29	12.67	3.31	3.25
query30	0.24	0.06	0.05
query31	2.87	0.39	0.38
query32	3.26	0.46	0.46
query33	2.83	2.93	2.91
query34	17.32	4.44	4.44
query35	4.52	4.48	4.49
query36	0.64	0.46	0.46
query37	0.17	0.15	0.16
query38	0.16	0.14	0.14
query39	0.04	0.04	0.03
query40	0.16	0.14	0.14
query41	0.09	0.05	0.05
query42	0.06	0.05	0.05
query43	0.04	0.04	0.03
Total cold run time: 108.89 s
Total hot run time: 30.74 s

@seawinde seawinde force-pushed the partition_track_date_trunc branch from b0f6bf8 to 706d12b Compare May 29, 2024 08:24
@seawinde
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17614	4245	4196	4196
q2	2028	196	204	196
q3	10482	1215	1192	1192
q4	10508	866	787	787
q5	7491	2717	2699	2699
q6	223	139	138	138
q7	975	610	604	604
q8	9652	2089	2130	2089
q9	9071	6591	6587	6587
q10	9085	3715	3819	3715
q11	446	246	232	232
q12	449	209	215	209
q13	18433	2957	2975	2957
q14	260	217	224	217
q15	513	457	473	457
q16	498	376	379	376
q17	960	683	690	683
q18	8033	7358	7374	7358
q19	5058	1488	1433	1433
q20	656	305	305	305
q21	4935	3121	3271	3121
q22	346	267	269	267
Total cold run time: 117716 ms
Total hot run time: 39818 ms

----- Round 2, with runtime_filter_mode=off -----
q1	4311	4181	4183	4181
q2	379	259	256	256
q3	2995	2768	2720	2720
q4	1860	1617	1560	1560
q5	5236	5287	5257	5257
q6	213	123	123	123
q7	2106	1773	1751	1751
q8	3157	3307	3334	3307
q9	8269	8312	8336	8312
q10	3911	3716	3644	3644
q11	583	490	475	475
q12	766	593	590	590
q13	16588	2933	3011	2933
q14	288	274	265	265
q15	520	473	472	472
q16	473	401	418	401
q17	1779	1500	1484	1484
q18	7575	7569	7474	7474
q19	1657	1583	1544	1544
q20	1985	1795	1794	1794
q21	4764	4614	4697	4614
q22	580	493	489	489
Total cold run time: 69995 ms
Total hot run time: 53646 ms

@doris-robot
Copy link

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

query1	930	394	366	366
query2	6451	2272	2274	2272
query3	6644	202	209	202
query4	19317	17268	17291	17268
query5	4180	420	426	420
query6	256	156	153	153
query7	4586	296	293	293
query8	237	178	183	178
query9	8454	2375	2368	2368
query10	456	281	266	266
query11	10633	10119	10054	10054
query12	142	90	87	87
query13	1638	378	377	377
query14	10104	7498	7501	7498
query15	210	172	166	166
query16	7962	264	266	264
query17	1845	514	511	511
query18	2004	272	283	272
query19	203	169	165	165
query20	90	86	81	81
query21	198	128	128	128
query22	4159	4013	3944	3944
query23	33689	33078	33114	33078
query24	11035	2856	2756	2756
query25	640	369	365	365
query26	1521	154	152	152
query27	2966	327	321	321
query28	7621	2083	2064	2064
query29	984	598	596	596
query30	293	147	150	147
query31	969	760	745	745
query32	93	52	53	52
query33	784	265	261	261
query34	1021	494	481	481
query35	740	607	624	607
query36	1084	936	885	885
query37	139	68	67	67
query38	2894	2802	2737	2737
query39	851	798	791	791
query40	284	135	124	124
query41	48	43	46	43
query42	102	92	99	92
query43	550	550	532	532
query44	1191	736	757	736
query45	178	158	159	158
query46	1055	728	723	723
query47	1830	1763	1784	1763
query48	382	298	310	298
query49	1167	383	395	383
query50	766	403	393	393
query51	6858	6783	6700	6700
query52	104	89	96	89
query53	364	280	275	275
query54	1041	430	435	430
query55	72	74	70	70
query56	254	242	238	238
query57	1114	1017	1069	1017
query58	228	205	214	205
query59	3411	3363	3108	3108
query60	265	251	252	251
query61	88	87	89	87
query62	642	461	448	448
query63	313	286	282	282
query64	9889	2293	1719	1719
query65	3209	3111	3103	3103
query66	1374	340	322	322
query67	15583	14925	14953	14925
query68	4622	542	542	542
query69	438	274	266	266
query70	1091	1157	1146	1146
query71	405	269	269	269
query72	7436	2715	2516	2516
query73	710	324	322	322
query74	6100	5580	5574	5574
query75	3470	2607	2581	2581
query76	2533	937	942	937
query77	635	263	261	261
query78	10233	9681	9843	9681
query79	2256	509	521	509
query80	873	439	424	424
query81	536	217	217	217
query82	866	90	94	90
query83	271	167	165	165
query84	233	86	82	82
query85	1544	270	258	258
query86	496	277	287	277
query87	3270	3106	3143	3106
query88	4199	2442	2453	2442
query89	464	387	378	378
query90	1973	196	185	185
query91	124	106	108	106
query92	129	48	50	48
query93	2125	517	505	505
query94	1238	191	183	183
query95	404	303	312	303
query96	587	267	269	267
query97	3187	3012	3035	3012
query98	234	216	214	214
query99	1153	845	858	845
Total cold run time: 274220 ms
Total hot run time: 169663 ms

@doris-robot
Copy link

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

query1	0.04	0.03	0.03
query2	0.08	0.04	0.04
query3	0.23	0.05	0.05
query4	1.68	0.06	0.06
query5	0.49	0.49	0.50
query6	1.12	0.72	0.72
query7	0.01	0.01	0.02
query8	0.04	0.04	0.04
query9	0.53	0.50	0.49
query10	0.55	0.55	0.54
query11	0.14	0.11	0.12
query12	0.15	0.12	0.11
query13	0.60	0.59	0.60
query14	0.78	0.79	0.76
query15	0.82	0.80	0.81
query16	0.37	0.36	0.36
query17	1.01	0.99	0.93
query18	0.22	0.25	0.20
query19	1.85	1.70	1.73
query20	0.02	0.01	0.01
query21	15.54	0.66	0.65
query22	4.68	7.16	1.70
query23	18.27	1.37	1.26
query24	1.57	0.26	0.20
query25	0.12	0.09	0.08
query26	0.26	0.17	0.17
query27	0.08	0.08	0.08
query28	13.50	1.01	0.98
query29	13.24	3.34	3.30
query30	0.24	0.06	0.05
query31	2.89	0.39	0.38
query32	3.27	0.46	0.47
query33	2.88	2.85	2.95
query34	17.14	4.39	4.43
query35	4.45	4.56	4.50
query36	0.64	0.47	0.46
query37	0.17	0.15	0.15
query38	0.16	0.15	0.14
query39	0.04	0.03	0.03
query40	0.16	0.14	0.14
query41	0.08	0.04	0.05
query42	0.05	0.05	0.05
query43	0.04	0.04	0.03
Total cold run time: 110.2 s
Total hot run time: 30.13 s

@seawinde
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17603	4317	4257	4257
q2	2034	201	201	201
q3	10436	1234	1154	1154
q4	10204	871	787	787
q5	7477	2705	2737	2705
q6	222	136	139	136
q7	963	609	627	609
q8	9218	2157	2132	2132
q9	9707	6777	6724	6724
q10	9296	3929	3951	3929
q11	430	243	240	240
q12	440	224	237	224
q13	17370	3211	3255	3211
q14	263	225	236	225
q15	512	470	486	470
q16	501	396	395	395
q17	977	650	727	650
q18	8363	7890	7791	7791
q19	3684	1632	1586	1586
q20	624	321	326	321
q21	5208	4025	4073	4025
q22	399	335	336	335
Total cold run time: 115931 ms
Total hot run time: 42107 ms

----- Round 2, with runtime_filter_mode=off -----
q1	4563	4431	4417	4417
q2	383	278	269	269
q3	3165	2972	2812	2812
q4	1881	1609	1633	1609
q5	5485	5536	5484	5484
q6	221	126	130	126
q7	2204	1861	1796	1796
q8	3269	3385	3382	3382
q9	8723	8720	8716	8716
q10	3973	3761	3814	3761
q11	605	491	502	491
q12	763	603	649	603
q13	16201	3171	3181	3171
q14	312	277	281	277
q15	513	481	485	481
q16	493	440	452	440
q17	1797	1494	1465	1465
q18	7802	7551	7509	7509
q19	1702	1584	1617	1584
q20	1989	1790	1775	1775
q21	8538	4902	4886	4886
q22	593	539	535	535
Total cold run time: 75175 ms
Total hot run time: 55589 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 172696 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 69d543a6b79644765c00ef3c674944fdad9845d5, data reload: false

query1	929	396	365	365
query2	7735	2577	2429	2429
query3	6643	207	204	204
query4	19609	17314	17531	17314
query5	4105	434	429	429
query6	253	156	174	156
query7	4587	302	284	284
query8	310	282	284	282
query9	8578	2364	2365	2364
query10	448	286	265	265
query11	10693	10182	10136	10136
query12	137	91	85	85
query13	1629	364	385	364
query14	10180	6813	7835	6813
query15	232	191	191	191
query16	7130	276	261	261
query17	1009	525	521	521
query18	1904	280	270	270
query19	225	149	153	149
query20	89	86	89	86
query21	196	136	129	129
query22	4245	3969	3964	3964
query23	33618	33220	33151	33151
query24	5020	2859	2861	2859
query25	468	379	378	378
query26	689	155	154	154
query27	1837	314	313	313
query28	3648	2074	2055	2055
query29	849	628	607	607
query30	224	151	158	151
query31	914	763	762	762
query32	69	57	58	57
query33	407	267	263	263
query34	846	484	463	463
query35	748	592	603	592
query36	1055	906	926	906
query37	101	64	65	64
query38	2826	2788	2767	2767
query39	876	795	799	795
query40	198	128	122	122
query41	53	55	56	55
query42	107	95	98	95
query43	605	596	574	574
query44	1073	721	728	721
query45	182	170	164	164
query46	1060	717	706	706
query47	1904	1746	1797	1746
query48	370	287	293	287
query49	764	383	380	380
query50	763	381	397	381
query51	6815	6692	6654	6654
query52	102	86	93	86
query53	360	289	286	286
query54	541	427	440	427
query55	72	76	70	70
query56	255	250	247	247
query57	1126	1063	1023	1023
query58	221	208	217	208
query59	3613	3255	3149	3149
query60	265	259	253	253
query61	90	88	87	87
query62	572	440	469	440
query63	319	285	291	285
query64	2569	1776	1721	1721
query65	3180	3092	3132	3092
query66	675	329	332	329
query67	15047	14702	14735	14702
query68	4526	535	522	522
query69	458	275	263	263
query70	1150	1074	1088	1074
query71	415	270	269	269
query72	7552	5740	5721	5721
query73	717	324	326	324
query74	6135	5675	5615	5615
query75	3350	2644	2591	2591
query76	2274	1058	1004	1004
query77	415	281	274	274
query78	10301	9774	9699	9699
query79	1590	506	518	506
query80	1035	432	427	427
query81	503	226	216	216
query82	860	92	91	91
query83	264	173	170	170
query84	266	88	82	82
query85	966	270	265	265
query86	478	327	311	311
query87	3310	3096	3114	3096
query88	3302	2335	2378	2335
query89	472	407	407	407
query90	1975	202	188	188
query91	134	110	113	110
query92	68	52	52	52
query93	1860	511	495	495
query94	1186	199	259	199
query95	401	318	317	317
query96	592	268	267	267
query97	3161	3079	3040	3040
query98	245	219	223	219
query99	1225	859	878	859
Total cold run time: 249148 ms
Total hot run time: 172696 ms

@doris-robot
Copy link

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

query1	0.04	0.04	0.03
query2	0.08	0.04	0.04
query3	0.24	0.06	0.06
query4	1.66	0.09	0.08
query5	0.51	0.48	0.49
query6	1.12	0.72	0.72
query7	0.02	0.01	0.02
query8	0.05	0.04	0.04
query9	0.55	0.49	0.49
query10	0.55	0.55	0.55
query11	0.16	0.11	0.11
query12	0.14	0.12	0.11
query13	0.58	0.59	0.60
query14	0.77	0.76	0.78
query15	0.84	0.81	0.81
query16	0.37	0.35	0.37
query17	1.02	0.98	0.98
query18	0.23	0.24	0.26
query19	1.81	1.66	1.71
query20	0.02	0.01	0.00
query21	15.55	0.69	0.67
query22	4.35	7.66	1.58
query23	18.26	1.44	1.26
query24	1.67	0.29	0.21
query25	0.14	0.07	0.09
query26	0.27	0.16	0.17
query27	0.08	0.07	0.08
query28	13.35	1.02	1.01
query29	13.41	3.29	3.23
query30	0.24	0.06	0.06
query31	2.87	0.40	0.37
query32	3.28	0.47	0.48
query33	2.89	2.94	2.95
query34	16.85	4.43	4.49
query35	4.48	4.48	4.62
query36	0.70	0.47	0.46
query37	0.19	0.15	0.16
query38	0.16	0.14	0.14
query39	0.04	0.03	0.03
query40	0.18	0.14	0.15
query41	0.09	0.04	0.05
query42	0.06	0.05	0.05
query43	0.04	0.04	0.04
Total cold run time: 109.91 s
Total hot run time: 30.17 s

morrySnow
morrySnow previously approved these changes May 31, 2024
@github-actions github-actions bot added the approved Indicates a PR has been approved by one committer. label May 31, 2024
Copy link
Contributor

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

Copy link
Contributor

PR approved by anyone and no changes requested.

@seawinde
Copy link
Contributor Author

seawinde commented Jun 2, 2024

run buildall

@github-actions github-actions bot removed the approved Indicates a PR has been approved by one committer. label Jun 2, 2024
@seawinde
Copy link
Contributor Author

seawinde commented Jun 2, 2024

run buildall

@doris-robot
Copy link

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

query1	0.04	0.03	0.03
query2	0.08	0.04	0.04
query3	0.23	0.06	0.05
query4	1.66	0.07	0.08
query5	0.52	0.49	0.49
query6	1.13	0.72	0.73
query7	0.02	0.01	0.01
query8	0.06	0.05	0.04
query9	0.54	0.50	0.49
query10	0.54	0.56	0.54
query11	0.16	0.11	0.10
query12	0.15	0.12	0.12
query13	0.60	0.58	0.60
query14	0.80	0.77	0.75
query15	0.83	0.81	0.82
query16	0.38	0.36	0.36
query17	0.96	0.96	1.03
query18	0.22	0.26	0.23
query19	1.77	1.67	1.82
query20	0.01	0.01	0.01
query21	15.44	0.73	0.68
query22	4.85	6.09	2.45
query23	18.29	1.40	1.33
query24	1.38	0.37	0.24
query25	0.15	0.09	0.08
query26	0.27	0.17	0.17
query27	0.09	0.07	0.08
query28	13.32	1.02	0.99
query29	12.88	3.36	3.30
query30	0.25	0.06	0.05
query31	2.86	0.40	0.38
query32	3.30	0.47	0.47
query33	2.88	2.91	2.89
query34	17.21	4.47	4.44
query35	4.55	4.50	4.57
query36	0.66	0.46	0.46
query37	0.18	0.16	0.15
query38	0.16	0.15	0.14
query39	0.04	0.04	0.04
query40	0.16	0.14	0.14
query41	0.09	0.05	0.05
query42	0.06	0.04	0.05
query43	0.04	0.04	0.04
Total cold run time: 109.81 s
Total hot run time: 31.17 s

DISTRIBUTED BY RANDOM BUCKETS 2
PROPERTIES (
'replication_num' = '1'
)
AS
SELECT date_trunc(`k2`,'miniute') as month_alias, * FROM ${tableName};
SELECT date_trunc(`k2`,'miniute') as miniute_alias, * FROM ${tableName};
Copy link
Contributor

Choose a reason for hiding this comment

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

miniute==>minute?

@morrySnow morrySnow merged commit 43d0f19 into apache:master Jun 5, 2024
31 of 32 checks passed
dataroaring pushed a commit that referenced this pull request Jun 7, 2024
… optimize the fail reason (#35562)

this depends on #34781

1. Materialized view partition track supports date_trunc and optimize the fail reason.

2. it supports create partition mv as following:
this mv will be partition updated by day

CREATE MATERIALIZED VIEW mv_6
BUILD IMMEDIATE REFRESH AUTO ON MANUAL
partition by(date_trunc(date_alias, 'day'))
DISTRIBUTED BY RANDOM BUCKETS 2
PROPERTIES ('replication_num' = '1')
AS
SELECT date_trunc(t1.L_SHIPDATE, 'hour') as date_alias, t2.O_ORDERDATE, t1.L_QUANTITY, t2.O_ORDERSTATUS, 
count(distinct case when t1.L_SUPPKEY > 0 then t2.O_ORDERSTATUS else null end) as cnt_1 
from 
  (select * from 
  lineitem 
  where L_SHIPDATE in ('2017-01-30')) t1 
left join 
  (select * from 
  orders 
  where O_ORDERDATE in ('2017-01-30')) t2 
on t1.L_ORDERKEY = t2.O_ORDERKEY 
group by 
t1.L_SHIPDATE, 
t2.O_ORDERDATE, 
t1.L_QUANTITY, 
t2.O_ORDERSTATUS;
seawinde added a commit to seawinde/doris that referenced this pull request Jun 7, 2024
… optimize the fail reason (apache#35562)

this depends on apache#34781

1. Materialized view partition track supports date_trunc and optimize the fail reason.

2. it supports create partition mv as following:
this mv will be partition updated by day

CREATE MATERIALIZED VIEW mv_6
BUILD IMMEDIATE REFRESH AUTO ON MANUAL
partition by(date_trunc(date_alias, 'day'))
DISTRIBUTED BY RANDOM BUCKETS 2
PROPERTIES ('replication_num' = '1')
AS
SELECT date_trunc(t1.L_SHIPDATE, 'hour') as date_alias, t2.O_ORDERDATE, t1.L_QUANTITY, t2.O_ORDERSTATUS, 
count(distinct case when t1.L_SUPPKEY > 0 then t2.O_ORDERSTATUS else null end) as cnt_1 
from 
  (select * from 
  lineitem 
  where L_SHIPDATE in ('2017-01-30')) t1 
left join 
  (select * from 
  orders 
  where O_ORDERDATE in ('2017-01-30')) t2 
on t1.L_ORDERKEY = t2.O_ORDERKEY 
group by 
t1.L_SHIPDATE, 
t2.O_ORDERDATE, 
t1.L_QUANTITY, 
t2.O_ORDERSTATUS;
seawinde added a commit to seawinde/doris that referenced this pull request Jun 20, 2024
… optimize the fail reason (apache#35562)

this depends on apache#34781

1. Materialized view partition track supports date_trunc and optimize the fail reason.

2. it supports create partition mv as following:
this mv will be partition updated by day

CREATE MATERIALIZED VIEW mv_6
BUILD IMMEDIATE REFRESH AUTO ON MANUAL
partition by(date_trunc(date_alias, 'day'))
DISTRIBUTED BY RANDOM BUCKETS 2
PROPERTIES ('replication_num' = '1')
AS
SELECT date_trunc(t1.L_SHIPDATE, 'hour') as date_alias, t2.O_ORDERDATE, t1.L_QUANTITY, t2.O_ORDERSTATUS, 
count(distinct case when t1.L_SUPPKEY > 0 then t2.O_ORDERSTATUS else null end) as cnt_1 
from 
  (select * from 
  lineitem 
  where L_SHIPDATE in ('2017-01-30')) t1 
left join 
  (select * from 
  orders 
  where O_ORDERDATE in ('2017-01-30')) t2 
on t1.L_ORDERKEY = t2.O_ORDERKEY 
group by 
t1.L_SHIPDATE, 
t2.O_ORDERDATE, 
t1.L_QUANTITY, 
t2.O_ORDERSTATUS;
seawinde added a commit to seawinde/doris that referenced this pull request Jun 20, 2024
… optimize the fail reason (apache#35562)

this depends on apache#34781

1. Materialized view partition track supports date_trunc and optimize the fail reason.

2. it supports create partition mv as following:
this mv will be partition updated by day

CREATE MATERIALIZED VIEW mv_6
BUILD IMMEDIATE REFRESH AUTO ON MANUAL
partition by(date_trunc(date_alias, 'day'))
DISTRIBUTED BY RANDOM BUCKETS 2
PROPERTIES ('replication_num' = '1')
AS
SELECT date_trunc(t1.L_SHIPDATE, 'hour') as date_alias, t2.O_ORDERDATE, t1.L_QUANTITY, t2.O_ORDERSTATUS, 
count(distinct case when t1.L_SUPPKEY > 0 then t2.O_ORDERSTATUS else null end) as cnt_1 
from 
  (select * from 
  lineitem 
  where L_SHIPDATE in ('2017-01-30')) t1 
left join 
  (select * from 
  orders 
  where O_ORDERDATE in ('2017-01-30')) t2 
on t1.L_ORDERKEY = t2.O_ORDERKEY 
group by 
t1.L_SHIPDATE, 
t2.O_ORDERDATE, 
t1.L_QUANTITY, 
t2.O_ORDERSTATUS;
morrySnow pushed a commit that referenced this pull request Jun 21, 2024
…by (#36175)

This is brought by #35562

At the pr above when you create partition materialized view as
following, which would fail with the message:
Unable to find a suitable base table for partitioning

CREATE MATERIALIZED VIEW mvName
BUILD IMMEDIATE REFRESH AUTO ON MANUAL
PARTITION BY (date_trunc(month_alias, 'month'))
DISTRIBUTED BY RANDOM BUCKETS 2
PROPERTIES (
  'replication_num' = '1'
)
AS
SELECT date_trunc(`k2`,'day') AS month_alias, k3, count(*) 
FROM tableName GROUP BY date_trunc(`k2`,'day'), k3;

This pr supports to create partition materialized view when `date_trunc`
in group by cluause.
morrySnow pushed a commit that referenced this pull request Jun 21, 2024
… rewrite by partition rolled up mv (#36414)

This is brought by #35562 

When mv is partition rolled up mv, which is rolled up by date_trunc. If
base table add new partition.
if query rewrite successfully by the partition mv, the data will lost
the new partition data. This pr fix this problem. For example as following:

mv def is:

CREATE MATERIALIZED VIEW roll_up_mv
BUILD IMMEDIATE REFRESH AUTO ON MANUAL
partition by (date_trunc(`col1`, 'month'))
DISTRIBUTED BY RANDOM BUCKETS 2
PROPERTIES ('replication_num' = '1')
AS
select date_trunc(`l_shipdate`, 'day') as col1, l_shipdate, o_orderdate, l_partkey,
   l_suppkey, sum(o_totalprice) as sum_total
   from lineitem
left join orders on lineitem.l_orderkey = orders.o_orderkey and l_shipdate = o_orderdate
   group by
   col1,
   l_shipdate,
   o_orderdate,
   l_partkey,
   l_suppkey;

if run the insert comand

insert into lineitem values
    (1, 2, 3, 4, 5.5, 6.5, 7.5, 8.5, 'o', 'k', '2023-11-21', '2023-11-21', '2023-11-21', 'a', 'b', 'yyyyyyyyy');

then run query as following, result will not return the 2023-11-21 partition data

select date_trunc(`l_shipdate`, 'day') as col1, l_shipdate, o_orderdate, l_partkey,
   l_suppkey, sum(o_totalprice) as sum_total
   from lineitem
left join orders on lineitem.l_orderkey = orders.o_orderkey and l_shipdate = o_orderdate
   group by
   col1,
   l_shipdate,
   o_orderdate,
   l_partkey,
   l_suppkey;
iszhangpch pushed a commit to iszhangpch/doris-p that referenced this pull request Jun 21, 2024
…by (apache#36175)

This is brought by apache#35562

At the pr above when you create partition materialized view as
following, which would fail with the message:
Unable to find a suitable base table for partitioning

CREATE MATERIALIZED VIEW mvName
BUILD IMMEDIATE REFRESH AUTO ON MANUAL
PARTITION BY (date_trunc(month_alias, 'month'))
DISTRIBUTED BY RANDOM BUCKETS 2
PROPERTIES (
  'replication_num' = '1'
)
AS
SELECT date_trunc(`k2`,'day') AS month_alias, k3, count(*) 
FROM tableName GROUP BY date_trunc(`k2`,'day'), k3;

This pr supports to create partition materialized view when `date_trunc`
in group by cluause.
iszhangpch pushed a commit to iszhangpch/doris-p that referenced this pull request Jun 21, 2024
… rewrite by partition rolled up mv (apache#36414)

This is brought by apache#35562 

When mv is partition rolled up mv, which is rolled up by date_trunc. If
base table add new partition.
if query rewrite successfully by the partition mv, the data will lost
the new partition data. This pr fix this problem. For example as following:

mv def is:

CREATE MATERIALIZED VIEW roll_up_mv
BUILD IMMEDIATE REFRESH AUTO ON MANUAL
partition by (date_trunc(`col1`, 'month'))
DISTRIBUTED BY RANDOM BUCKETS 2
PROPERTIES ('replication_num' = '1')
AS
select date_trunc(`l_shipdate`, 'day') as col1, l_shipdate, o_orderdate, l_partkey,
   l_suppkey, sum(o_totalprice) as sum_total
   from lineitem
left join orders on lineitem.l_orderkey = orders.o_orderkey and l_shipdate = o_orderdate
   group by
   col1,
   l_shipdate,
   o_orderdate,
   l_partkey,
   l_suppkey;

if run the insert comand

insert into lineitem values
    (1, 2, 3, 4, 5.5, 6.5, 7.5, 8.5, 'o', 'k', '2023-11-21', '2023-11-21', '2023-11-21', 'a', 'b', 'yyyyyyyyy');

then run query as following, result will not return the 2023-11-21 partition data

select date_trunc(`l_shipdate`, 'day') as col1, l_shipdate, o_orderdate, l_partkey,
   l_suppkey, sum(o_totalprice) as sum_total
   from lineitem
left join orders on lineitem.l_orderkey = orders.o_orderkey and l_shipdate = o_orderdate
   group by
   col1,
   l_shipdate,
   o_orderdate,
   l_partkey,
   l_suppkey;
dataroaring pushed a commit that referenced this pull request Jun 21, 2024
…by (#36175)

This is brought by #35562

At the pr above when you create partition materialized view as
following, which would fail with the message:
Unable to find a suitable base table for partitioning

CREATE MATERIALIZED VIEW mvName
BUILD IMMEDIATE REFRESH AUTO ON MANUAL
PARTITION BY (date_trunc(month_alias, 'month'))
DISTRIBUTED BY RANDOM BUCKETS 2
PROPERTIES (
  'replication_num' = '1'
)
AS
SELECT date_trunc(`k2`,'day') AS month_alias, k3, count(*) 
FROM tableName GROUP BY date_trunc(`k2`,'day'), k3;

This pr supports to create partition materialized view when `date_trunc`
in group by cluause.
dataroaring pushed a commit that referenced this pull request Jun 21, 2024
… rewrite by partition rolled up mv (#36414)

This is brought by #35562 

When mv is partition rolled up mv, which is rolled up by date_trunc. If
base table add new partition.
if query rewrite successfully by the partition mv, the data will lost
the new partition data. This pr fix this problem. For example as following:

mv def is:

CREATE MATERIALIZED VIEW roll_up_mv
BUILD IMMEDIATE REFRESH AUTO ON MANUAL
partition by (date_trunc(`col1`, 'month'))
DISTRIBUTED BY RANDOM BUCKETS 2
PROPERTIES ('replication_num' = '1')
AS
select date_trunc(`l_shipdate`, 'day') as col1, l_shipdate, o_orderdate, l_partkey,
   l_suppkey, sum(o_totalprice) as sum_total
   from lineitem
left join orders on lineitem.l_orderkey = orders.o_orderkey and l_shipdate = o_orderdate
   group by
   col1,
   l_shipdate,
   o_orderdate,
   l_partkey,
   l_suppkey;

if run the insert comand

insert into lineitem values
    (1, 2, 3, 4, 5.5, 6.5, 7.5, 8.5, 'o', 'k', '2023-11-21', '2023-11-21', '2023-11-21', 'a', 'b', 'yyyyyyyyy');

then run query as following, result will not return the 2023-11-21 partition data

select date_trunc(`l_shipdate`, 'day') as col1, l_shipdate, o_orderdate, l_partkey,
   l_suppkey, sum(o_totalprice) as sum_total
   from lineitem
left join orders on lineitem.l_orderkey = orders.o_orderkey and l_shipdate = o_orderdate
   group by
   col1,
   l_shipdate,
   o_orderdate,
   l_partkey,
   l_suppkey;
seawinde added a commit to seawinde/doris that referenced this pull request Jun 27, 2024
… optimize the fail reason (apache#35562)

this depends on apache#34781

1. Materialized view partition track supports date_trunc and optimize the fail reason.

2. it supports create partition mv as following:
this mv will be partition updated by day

CREATE MATERIALIZED VIEW mv_6
BUILD IMMEDIATE REFRESH AUTO ON MANUAL
partition by(date_trunc(date_alias, 'day'))
DISTRIBUTED BY RANDOM BUCKETS 2
PROPERTIES ('replication_num' = '1')
AS
SELECT date_trunc(t1.L_SHIPDATE, 'hour') as date_alias, t2.O_ORDERDATE, t1.L_QUANTITY, t2.O_ORDERSTATUS, 
count(distinct case when t1.L_SUPPKEY > 0 then t2.O_ORDERSTATUS else null end) as cnt_1 
from 
  (select * from 
  lineitem 
  where L_SHIPDATE in ('2017-01-30')) t1 
left join 
  (select * from 
  orders 
  where O_ORDERDATE in ('2017-01-30')) t2 
on t1.L_ORDERKEY = t2.O_ORDERKEY 
group by 
t1.L_SHIPDATE, 
t2.O_ORDERDATE, 
t1.L_QUANTITY, 
t2.O_ORDERSTATUS;
morrySnow pushed a commit that referenced this pull request Jul 5, 2024
… optimize the fail reason (#35562) (#36947)

cherry pick from master #35562
commitId: 43d0f19
seawinde added a commit to seawinde/doris that referenced this pull request Jul 11, 2024
…by (apache#36175)

This is brought by apache#35562

At the pr above when you create partition materialized view as
following, which would fail with the message:
Unable to find a suitable base table for partitioning

CREATE MATERIALIZED VIEW mvName
BUILD IMMEDIATE REFRESH AUTO ON MANUAL
PARTITION BY (date_trunc(month_alias, 'month'))
DISTRIBUTED BY RANDOM BUCKETS 2
PROPERTIES (
  'replication_num' = '1'
)
AS
SELECT date_trunc(`k2`,'day') AS month_alias, k3, count(*) 
FROM tableName GROUP BY date_trunc(`k2`,'day'), k3;

This pr supports to create partition materialized view when `date_trunc`
in group by cluause.
seawinde added a commit to seawinde/doris that referenced this pull request Jul 11, 2024
… rewrite by partition rolled up mv (apache#36414)

This is brought by apache#35562 

When mv is partition rolled up mv, which is rolled up by date_trunc. If
base table add new partition.
if query rewrite successfully by the partition mv, the data will lost
the new partition data. This pr fix this problem. For example as following:

mv def is:

CREATE MATERIALIZED VIEW roll_up_mv
BUILD IMMEDIATE REFRESH AUTO ON MANUAL
partition by (date_trunc(`col1`, 'month'))
DISTRIBUTED BY RANDOM BUCKETS 2
PROPERTIES ('replication_num' = '1')
AS
select date_trunc(`l_shipdate`, 'day') as col1, l_shipdate, o_orderdate, l_partkey,
   l_suppkey, sum(o_totalprice) as sum_total
   from lineitem
left join orders on lineitem.l_orderkey = orders.o_orderkey and l_shipdate = o_orderdate
   group by
   col1,
   l_shipdate,
   o_orderdate,
   l_partkey,
   l_suppkey;

if run the insert comand

insert into lineitem values
    (1, 2, 3, 4, 5.5, 6.5, 7.5, 8.5, 'o', 'k', '2023-11-21', '2023-11-21', '2023-11-21', 'a', 'b', 'yyyyyyyyy');

then run query as following, result will not return the 2023-11-21 partition data

select date_trunc(`l_shipdate`, 'day') as col1, l_shipdate, o_orderdate, l_partkey,
   l_suppkey, sum(o_totalprice) as sum_total
   from lineitem
left join orders on lineitem.l_orderkey = orders.o_orderkey and l_shipdate = o_orderdate
   group by
   col1,
   l_shipdate,
   o_orderdate,
   l_partkey,
   l_suppkey;
@yiguolei yiguolei mentioned this pull request Jul 19, 2024
1 task
morrySnow pushed a commit that referenced this pull request Sep 13, 2024
…m both side of join (#40485)

This is brought by #35562
if partition mv def is as following:

        CREATE MATERIALIZED VIEW mv1
        BUILD IMMEDIATE REFRESH COMPLETE ON MANUAL
        PARTITION BY (upgrade_day)
        DISTRIBUTED BY RANDOM BUCKETS 2
        PROPERTIES ('replication_num' = '1') 
        AS
       select t1.upgrade_day, t2.batch_no, count(*) 
       from test2 t2 join test1 t1 on
       t1.upgrade_day = t2.upgrade_day
       group by t1.upgrade_day, t2.batch_no;

the mv related partition table should `test1`, but now is `test2`, this pr fix this.
seawinde added a commit to seawinde/doris that referenced this pull request Sep 13, 2024
…m both side of join (apache#40485)

This is brought by apache#35562
if partition mv def is as following:

        CREATE MATERIALIZED VIEW mv1
        BUILD IMMEDIATE REFRESH COMPLETE ON MANUAL
        PARTITION BY (upgrade_day)
        DISTRIBUTED BY RANDOM BUCKETS 2
        PROPERTIES ('replication_num' = '1') 
        AS
       select t1.upgrade_day, t2.batch_no, count(*) 
       from test2 t2 join test1 t1 on
       t1.upgrade_day = t2.upgrade_day
       group by t1.upgrade_day, t2.batch_no;

the mv related partition table should `test1`, but now is `test2`, this pr fix this.
seawinde added a commit to seawinde/doris that referenced this pull request Sep 14, 2024
…m both side of join (apache#40485)

This is brought by apache#35562
if partition mv def is as following:

        CREATE MATERIALIZED VIEW mv1
        BUILD IMMEDIATE REFRESH COMPLETE ON MANUAL
        PARTITION BY (upgrade_day)
        DISTRIBUTED BY RANDOM BUCKETS 2
        PROPERTIES ('replication_num' = '1')
        AS
       select t1.upgrade_day, t2.batch_no, count(*)
       from test2 t2 join test1 t1 on
       t1.upgrade_day = t2.upgrade_day
       group by t1.upgrade_day, t2.batch_no;

the mv related partition table should `test1`, but now is `test2`, this pr fix this.
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/2.1.5-merged dev/3.0.0-merged reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants