Skip to content

Conversation

@jackwener
Copy link
Member

@jackwener jackwener commented Mar 15, 2024

Proposed changes

Further comments

If this is a relatively large or complex change, kick off the discussion at dev@doris.apache.org by explaining why you chose the solution you did and what alternatives you considered, etc...

@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

@jackwener jackwener changed the title [fix](Nereids): just pull up project above join [fix](Nereids): just pull up project above join through topn Mar 15, 2024
@jackwener
Copy link
Member Author

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17688	4139	4106	4106
q2	2020	150	143	143
q3	10608	1074	902	902
q4	7071	690	734	690
q5	7471	2704	2685	2685
q6	184	123	122	122
q7	1149	821	812	812
q8	9334	2004	1953	1953
q9	7086	6412	6398	6398
q10	8483	3485	3603	3485
q11	428	221	226	221
q12	827	300	303	300
q13	18167	2838	2838	2838
q14	271	241	245	241
q15	490	446	445	445
q16	501	386	388	386
q17	926	503	593	503
q18	7009	6382	6338	6338
q19	4635	1419	1375	1375
q20	549	295	281	281
q21	6193	3498	3542	3498
q22	373	306	308	306
Total cold run time: 111463 ms
Total hot run time: 38028 ms

----- Round 2, with runtime_filter_mode=off -----
q1	4235	4076	4091	4076
q2	315	220	232	220
q3	2933	2808	2837	2808
q4	1859	1565	1540	1540
q5	5215	5211	5220	5211
q6	190	123	123	123
q7	2245	1859	1861	1859
q8	3123	3257	3277	3257
q9	8523	8526	8533	8526
q10	3707	3695	3614	3614
q11	540	434	434	434
q12	716	522	542	522
q13	16922	2861	2832	2832
q14	276	249	241	241
q15	478	450	449	449
q16	456	404	413	404
q17	1726	1464	1452	1452
q18	7518	7054	7148	7054
q19	1627	1499	1449	1449
q20	1896	1717	1674	1674
q21	4702	4648	4651	4648
q22	552	473	434	434
Total cold run time: 69754 ms
Total hot run time: 52827 ms

@wm1581066 wm1581066 added the usercase Important user case type label label Mar 19, 2024
@jackwener jackwener force-pushed the time branch 2 times, most recently from 11cc83d to 21d8b8e Compare March 19, 2024 08:51
@jackwener
Copy link
Member Author

run buildall

@jackwener
Copy link
Member Author

run buildall

@Override
public Rule build() {
return logicalLimit(logicalProject().whenNot(p -> p.isAllSlots()))
return logicalLimit(logicalProject(logicalJoin().when(j -> j.getJoinType().isLeftRightOuterOrCrossJoin()))
Copy link
Contributor

Choose a reason for hiding this comment

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

Does it reduce the scope of this rule if adding the join pattern?


class PullUpProjectUnderTopNTest implements MemoPatternMatchSupported {
private final LogicalOlapScan scan1 = PlanConstructor.newLogicalOlapScan(0, "t1", 0);
private final LogicalOlapScan scan2 = PlanConstructor.newLogicalOlapScan(1, "t2", 0);
Copy link
Contributor

Choose a reason for hiding this comment

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

why not add a new ut to cover the join with select alias, avoid overwrite the original one?

new Cast(scan1.getOutput().get(1), VarcharType.SYSTEM_DEFAULT).alias("cast")
);
LogicalPlan limit = new LogicalPlanBuilder(scan1)
.join(scan2, JoinType.LEFT_OUTER_JOIN, ImmutableList.of())
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to cover right outer and cross? since the code handle these two kinds.

return logicalTopN(logicalProject().whenNot(p -> p.isAllSlots()))
.whenNot(topN -> topN.child().hasPushedDownToProjectionFunctions())
return logicalTopN(
logicalProject(logicalJoin().when(j -> j.getJoinType().isLeftRightOuterOrCrossJoin()))
Copy link
Contributor

Choose a reason for hiding this comment

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

similar question, will it reduce this rule's scope if adding the join pattern judge?

@jackwener
Copy link
Member Author

run buildall

@github-actions
Copy link
Contributor

PR approved by anyone and no changes requested.

@jackwener
Copy link
Member Author

run buildall

@jackwener
Copy link
Member Author

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17670	4318	4110	4110
q2	2027	152	145	145
q3	10593	1163	1208	1163
q4	10224	791	804	791
q5	7462	2984	2947	2947
q6	203	123	119	119
q7	1026	555	580	555
q8	9317	1979	1977	1977
q9	7074	6459	6401	6401
q10	8432	3366	3458	3366
q11	438	219	217	217
q12	451	198	195	195
q13	17802	2876	2869	2869
q14	238	213	219	213
q15	512	463	460	460
q16	467	366	357	357
q17	946	581	512	512
q18	7258	6529	6405	6405
q19	3954	1383	1408	1383
q20	553	260	240	240
q21	3514	2815	3000	2815
q22	350	326	292	292
Total cold run time: 110511 ms
Total hot run time: 37532 ms

----- Round 2, with runtime_filter_mode=off -----
q1	4149	4049	4043	4043
q2	313	222	217	217
q3	2995	2872	2836	2836
q4	1865	1566	1537	1537
q5	5248	5276	5294	5276
q6	200	116	113	113
q7	2235	1823	1839	1823
q8	3144	3286	3248	3248
q9	8570	8520	8578	8520
q10	3670	3690	3699	3690
q11	537	445	454	445
q12	732	567	526	526
q13	16920	2870	2843	2843
q14	296	247	261	247
q15	481	448	454	448
q16	466	434	400	400
q17	1740	1475	1471	1471
q18	7466	7168	7077	7077
q19	1592	1521	1537	1521
q20	1888	1700	1724	1700
q21	4961	4762	4724	4724
q22	519	454	460	454
Total cold run time: 69987 ms
Total hot run time: 53159 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 181258 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 6ba5e30dcbc06dbedb90e82833fbfa843d810c76, data reload: false

query1	904	358	345	345
query2	7437	2049	2049	2049
query3	6716	207	204	204
query4	31271	20761	20811	20761
query5	4376	422	499	422
query6	263	175	183	175
query7	4643	287	290	287
query8	236	191	174	174
query9	9955	2245	2230	2230
query10	456	235	252	235
query11	14752	14335	14600	14335
query12	131	90	87	87
query13	1628	418	410	410
query14	10999	11273	10500	10500
query15	254	201	190	190
query16	8112	258	246	246
query17	1959	546	529	529
query18	2068	277	273	273
query19	235	162	150	150
query20	87	85	86	85
query21	197	142	128	128
query22	4671	4440	4506	4440
query23	31601	31157	31112	31112
query24	10778	2790	2779	2779
query25	616	375	384	375
query26	1230	152	156	152
query27	2471	349	348	348
query28	7649	1922	1846	1846
query29	869	656	629	629
query30	303	145	143	143
query31	925	721	722	721
query32	96	66	58	58
query33	766	254	331	254
query34	1014	473	472	472
query35	820	623	610	610
query36	982	895	877	877
query37	128	78	80	78
query38	3563	3458	3440	3440
query39	1430	1368	1373	1368
query40	220	112	111	111
query41	51	47	46	46
query42	111	94	95	94
query43	511	456	473	456
query44	1299	717	710	710
query45	288	270	271	270
query46	1104	699	679	679
query47	1673	1612	1570	1570
query48	439	350	365	350
query49	1134	327	334	327
query50	757	370	365	365
query51	6629	6585	6473	6473
query52	121	97	92	92
query53	344	269	274	269
query54	314	241	272	241
query55	83	77	77	77
query56	262	237	238	237
query57	1078	1025	1015	1015
query58	238	216	206	206
query59	2824	2628	2563	2563
query60	271	240	252	240
query61	97	95	101	95
query62	630	389	412	389
query63	296	268	276	268
query64	5565	3864	3906	3864
query65	3046	3028	3005	3005
query66	865	342	326	326
query67	14873	14571	14340	14340
query68	5163	517	509	509
query69	578	364	362	362
query70	1245	1166	1086	1086
query71	430	281	263	263
query72	6290	2649	2501	2501
query73	718	318	313	313
query74	8108	6530	6592	6530
query75	3566	2978	2915	2915
query76	3486	904	945	904
query77	417	258	256	256
query78	10387	9781	9622	9622
query79	8266	514	518	514
query80	1963	397	404	397
query81	552	210	222	210
query82	1170	195	209	195
query83	317	149	149	149
query84	289	77	80	77
query85	1813	376	359	359
query86	492	323	295	295
query87	3689	3555	3584	3555
query88	5018	2310	2286	2286
query89	497	357	365	357
query90	2011	179	179	179
query91	173	141	142	141
query92	65	51	49	49
query93	5907	504	470	470
query94	1244	183	184	183
query95	451	327	320	320
query96	598	271	268	268
query97	3056	2855	2855	2855
query98	224	206	209	206
query99	1096	749	737	737
Total cold run time: 300993 ms
Total hot run time: 181258 ms

@jackwener
Copy link
Member Author

run p0

@jackwener
Copy link
Member Author

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17687	4141	4127	4127
q2	2020	155	145	145
q3	10592	1114	1190	1114
q4	10227	803	766	766
q5	7448	2960	2933	2933
q6	207	125	126	125
q7	1023	590	563	563
q8	9311	1995	1984	1984
q9	7077	6460	6412	6412
q10	8459	3283	3501	3283
q11	431	250	212	212
q12	411	209	190	190
q13	17788	2839	2836	2836
q14	241	205	211	205
q15	496	454	458	454
q16	452	351	346	346
q17	943	504	575	504
q18	7093	6461	6356	6356
q19	3792	1445	1483	1445
q20	536	253	242	242
q21	3604	2927	2876	2876
q22	358	287	288	287
Total cold run time: 110196 ms
Total hot run time: 37405 ms

----- Round 2, with runtime_filter_mode=off -----
q1	4161	4128	4118	4118
q2	328	223	224	223
q3	2996	2850	2868	2850
q4	1827	1520	1560	1520
q5	5199	5191	5224	5191
q6	194	115	116	115
q7	2248	1826	1867	1826
q8	3182	3281	3276	3276
q9	8542	8508	8543	8508
q10	3657	3667	3654	3654
q11	537	439	448	439
q12	724	548	542	542
q13	16913	2840	2864	2840
q14	301	242	243	242
q15	481	439	445	439
q16	465	399	395	395
q17	1740	1471	1450	1450
q18	7463	7116	7031	7031
q19	1581	1532	1509	1509
q20	1898	1708	1716	1708
q21	4752	4673	4772	4673
q22	512	445	450	445
Total cold run time: 69701 ms
Total hot run time: 52994 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 180783 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 4c55aea7dd1384aee551ce7050cfa959c165b695, data reload: false

query1	920	349	345	345
query2	7432	2043	2088	2043
query3	6703	216	212	212
query4	31419	20544	20815	20544
query5	4305	495	408	408
query6	264	175	172	172
query7	4621	294	288	288
query8	226	163	167	163
query9	9910	2273	2259	2259
query10	463	236	240	236
query11	16989	14099	14213	14099
query12	138	89	87	87
query13	1619	407	419	407
query14	11111	10664	10480	10480
query15	257	216	196	196
query16	7975	276	250	250
query17	1935	537	516	516
query18	2006	271	277	271
query19	231	155	148	148
query20	90	85	81	81
query21	198	127	129	127
query22	4627	4476	4487	4476
query23	31604	30852	31193	30852
query24	10867	2853	2770	2770
query25	639	382	393	382
query26	1273	156	156	156
query27	2637	339	344	339
query28	7815	1888	1889	1888
query29	892	644	628	628
query30	306	147	147	147
query31	939	744	739	739
query32	96	61	54	54
query33	773	273	252	252
query34	1106	480	491	480
query35	839	617	594	594
query36	1010	866	867	866
query37	126	76	76	76
query38	3561	3398	3450	3398
query39	1431	1486	1381	1381
query40	206	113	112	112
query41	49	46	46	46
query42	102	97	93	93
query43	489	455	457	455
query44	1186	737	706	706
query45	273	255	266	255
query46	1078	694	698	694
query47	1676	1601	1593	1593
query48	442	368	353	353
query49	1136	341	341	341
query50	767	363	368	363
query51	6729	6635	6616	6616
query52	111	91	86	86
query53	347	276	270	270
query54	306	257	248	248
query55	83	75	78	75
query56	243	240	229	229
query57	1074	999	1010	999
query58	226	201	214	201
query59	2711	2539	2619	2539
query60	267	242	252	242
query61	115	114	114	114
query62	623	404	401	401
query63	297	275	275	275
query64	5718	3884	3845	3845
query65	3048	3000	3001	3000
query66	855	360	364	360
query67	14959	14526	14406	14406
query68	8893	539	538	538
query69	638	373	380	373
query70	1268	1145	1114	1114
query71	514	291	282	282
query72	6548	2649	2517	2517
query73	762	310	327	310
query74	8287	6575	6511	6511
query75	4445	2803	2846	2803
query76	5262	1015	1011	1011
query77	672	256	251	251
query78	10485	9637	9691	9637
query79	9992	528	529	528
query80	1813	392	387	387
query81	516	219	211	211
query82	842	201	191	191
query83	211	140	142	140
query84	287	78	81	78
query85	1444	334	312	312
query86	403	310	312	310
query87	3784	3571	3531	3531
query88	5044	2296	2297	2296
query89	508	362	358	358
query90	2005	177	174	174
query91	163	129	131	129
query92	58	46	49	46
query93	7188	505	480	480
query94	1208	183	172	172
query95	423	328	322	322
query96	616	271	266	266
query97	3057	2872	2830	2830
query98	224	220	200	200
query99	1107	748	779	748
Total cold run time: 313136 ms
Total hot run time: 180783 ms

@doris-robot
Copy link

Load test result on machine: 'aliyun_ecs.c7a.8xlarge_32C64G'

Load test result on commit 4c55aea7dd1384aee551ce7050cfa959c165b695 with default session variables
Stream load json:         19 seconds loaded 2358488459 Bytes, about 118 MB/s
Stream load orc:          59 seconds loaded 1101869774 Bytes, about 17 MB/s
Stream load parquet:      31 seconds loaded 861443392 Bytes, about 26 MB/s
Insert into select:       20.0 seconds inserted 10000000 Rows, about 500K ops/s

@jackwener
Copy link
Member Author

run buildall

@jackwener jackwener changed the title [fix](Nereids): just pull up project above join through topn [fix](Nereids): just pull up alias project above join through topn Mar 21, 2024
@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17665	4140	4074	4074
q2	2028	147	140	140
q3	10599	1195	1172	1172
q4	10231	749	825	749
q5	7451	2974	2922	2922
q6	204	125	124	124
q7	1015	594	577	577
q8	9308	2007	1989	1989
q9	7109	6444	6391	6391
q10	8380	3279	3459	3279
q11	427	235	227	227
q12	409	195	193	193
q13	17788	2844	2878	2844
q14	235	211	200	200
q15	501	460	458	458
q16	454	358	354	354
q17	936	502	628	502
q18	7142	6373	6390	6373
q19	3780	1419	1377	1377
q20	547	250	253	250
q21	3640	2914	2932	2914
q22	355	306	296	296
Total cold run time: 110204 ms
Total hot run time: 37405 ms

----- Round 2, with runtime_filter_mode=off -----
q1	4207	4070	4084	4070
q2	322	238	224	224
q3	2984	2856	2897	2856
q4	1853	1549	1543	1543
q5	5228	5206	5237	5206
q6	193	117	116	116
q7	2213	1867	1874	1867
q8	3156	3250	3235	3235
q9	8495	8541	8586	8541
q10	3671	3660	3690	3660
q11	559	441	449	441
q12	720	540	555	540
q13	16899	2849	2843	2843
q14	275	254	251	251
q15	489	437	444	437
q16	448	422	411	411
q17	1743	1472	1453	1453
q18	7480	7276	7030	7030
q19	1624	1574	1533	1533
q20	1902	1713	1721	1713
q21	4719	4743	4753	4743
q22	523	468	448	448
Total cold run time: 69703 ms
Total hot run time: 53161 ms

@doris-robot
Copy link

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

query1	908	356	328	328
query2	7386	1993	1913	1913
query3	6712	216	214	214
query4	31227	20729	20629	20629
query5	4425	407	410	407
query6	264	179	181	179
query7	4628	294	286	286
query8	228	166	176	166
query9	9668	2265	2243	2243
query10	469	247	253	247
query11	17191	14127	14116	14116
query12	133	84	85	84
query13	1630	417	423	417
query14	11627	10779	10250	10250
query15	246	200	197	197
query16	8134	250	243	243
query17	1968	554	513	513
query18	2077	274	277	274
query19	228	156	164	156
query20	88	86	88	86
query21	201	125	126	125
query22	4685	4430	4439	4430
query23	31635	30854	31143	30854
query24	10690	2807	2845	2807
query25	600	394	395	394
query26	1204	159	159	159
query27	2473	365	353	353
query28	7603	1865	1890	1865
query29	841	642	604	604
query30	303	139	139	139
query31	962	744	731	731
query32	90	60	54	54
query33	739	255	248	248
query34	1093	469	477	469
query35	822	609	589	589
query36	994	868	855	855
query37	115	75	72	72
query38	3599	3510	3418	3418
query39	1434	1363	1365	1363
query40	204	106	107	106
query41	46	47	42	42
query42	104	95	100	95
query43	478	459	448	448
query44	1297	723	699	699
query45	263	254	242	242
query46	1098	674	690	674
query47	1679	1624	1590	1590
query48	454	360	358	358
query49	1120	334	339	334
query50	768	379	372	372
query51	6675	6554	6583	6554
query52	108	87	85	85
query53	340	272	276	272
query54	308	242	262	242
query55	86	77	76	76
query56	259	242	248	242
query57	1079	1020	1009	1009
query58	242	211	214	211
query59	2687	2605	2667	2605
query60	273	333	256	256
query61	115	115	119	115
query62	600	391	410	391
query63	303	277	283	277
query64	5374	3977	3828	3828
query65	3072	3007	3019	3007
query66	869	360	351	351
query67	14717	14681	14276	14276
query68	7728	533	557	533
query69	611	392	386	386
query70	1260	1164	1174	1164
query71	518	285	287	285
query72	6511	2790	2621	2621
query73	733	320	316	316
query74	8218	6616	6626	6616
query75	4242	2959	2978	2959
query76	4983	978	1042	978
query77	689	259	259	259
query78	10325	9627	9684	9627
query79	11795	522	516	516
query80	1815	420	384	384
query81	494	210	210	210
query82	447	199	195	195
query83	208	146	141	141
query84	284	78	78	78
query85	1226	336	313	313
query86	376	321	289	289
query87	3780	3541	3567	3541
query88	5093	2311	2295	2295
query89	485	361	374	361
query90	2070	177	174	174
query91	160	130	129	129
query92	61	47	46	46
query93	7237	506	487	487
query94	1322	177	181	177
query95	439	329	330	329
query96	636	264	268	264
query97	3050	2862	2845	2845
query98	228	214	206	206
query99	1036	753	764	753
Total cold run time: 311998 ms
Total hot run time: 180711 ms

@doris-robot
Copy link

Load test result on machine: 'aliyun_ecs.c7a.8xlarge_32C64G'

Load test result on commit a2f742a5f4e71441f11bfcbfd04cef64b3f68ac8 with default session variables
Stream load json:         18 seconds loaded 2358488459 Bytes, about 124 MB/s
Stream load orc:          59 seconds loaded 1101869774 Bytes, about 17 MB/s
Stream load parquet:      31 seconds loaded 861443392 Bytes, about 26 MB/s
Insert into select:       20.6 seconds inserted 10000000 Rows, about 485K ops/s

@github-actions github-actions bot added the approved Indicates a PR has been approved by one committer. label Mar 22, 2024
@github-actions
Copy link
Contributor

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

@morrySnow morrySnow merged commit fae5f3e into apache:master Mar 22, 2024
jackwener added a commit that referenced this pull request Mar 22, 2024
* [enhancement](Nereids): support more condition Date/DateTime Literal (#31858)

(cherry picked from commit dbb7573)

* [fix](Nereids): slot set in condition can be empty (#32169)

(cherry picked from commit ca09213)
mongo360 pushed a commit to mongo360/doris that referenced this pull request Aug 16, 2024
* [enhancement](Nereids): support more condition Date/DateTime Literal (apache#31858)

(cherry picked from commit dbb7573)

* [fix](Nereids): slot set in condition can be empty (apache#32169)

(cherry picked from commit ca09213)
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.0.7-merged reviewed usercase Important user case type label

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants