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

branch-3.0: [fix](nereids) fix ptopN push down under multi winexprs with partial forbidden type #44617 #44649

Merged
merged 1 commit into from
Nov 27, 2024

Conversation

github-actions[bot]
Copy link
Contributor

Cherry-picked from #44617

…forbidden type (#44617)

Related PR: #38393

Problem Summary: In the previous pr which supporting multi win expr
ptopN pushdown, it handled partial forbidden type unexpectly and will
lead some case to push down the pTopN wrongly.
plan before fixing:

explain shape plan select * from (select row_number() over(partition by c1, c2 order by c3) as rn, sum(c2) over(order by c2 range between unbounded preceding and unbounded following) as sw from push_down_multi_predicate_through_window_t) t where rn <= 1 and sw <= 1;

+------------------------------------------------------------------------------------+
| Explain String(Nereids Planner)                                                    |
+------------------------------------------------------------------------------------+
| PhysicalResultSink                                                                 |
| --PhysicalProject                                                                  |
| ----filter((rn <= 1) and (sw <= 1))                                                |
| ------PhysicalWindow                                                               |
| --------PhysicalQuickSort[MERGE_SORT]                                              |
| ----------PhysicalDistribute[DistributionSpecGather]                               |
| ------------PhysicalQuickSort[LOCAL_SORT]                                          |
| --------------PhysicalWindow                                                       |
| ----------------PhysicalQuickSort[LOCAL_SORT]                                      |
| ------------------PhysicalDistribute[DistributionSpecHash]                         |
| --------------------PhysicalPartitionTopN                                          |
| ----------------------PhysicalOlapScan[push_down_multi_predicate_through_window_t] |
+------------------------------------------------------------------------------------+

plan after fixing: 

explain shape plan select * from (select row_number() over(partition by c1, c2 order by c3) as rn, sum(c2) over(order by c2 range between unbounded preceding and unbounded following) as sw from push_down_multi_predicate_through_window_t) t where rn <= 1 and sw <= 1;

+----------------------------------------------------------------------------------+
| Explain String(Nereids Planner)                                                  |
+----------------------------------------------------------------------------------+
| PhysicalResultSink                                                               |
| --PhysicalProject                                                                |
| ----filter((rn <= 1) and (sw <= 1))                                              |
| ------PhysicalWindow                                                             |
| --------PhysicalQuickSort[MERGE_SORT]                                            |
| ----------PhysicalDistribute[DistributionSpecGather]                             |
| ------------PhysicalQuickSort[LOCAL_SORT]                                        |
| --------------PhysicalWindow                                                     |
| ----------------PhysicalQuickSort[LOCAL_SORT]                                    |
| ------------------PhysicalDistribute[DistributionSpecHash]                       |
| --------------------PhysicalOlapScan[push_down_multi_predicate_through_window_t] |
+----------------------------------------------------------------------------------+
@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.

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?

@dataroaring dataroaring reopened this Nov 27, 2024
@doris-robot
Copy link

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17560	7375	7271	7271
q2	2068	159	156	156
q3	10768	1045	1127	1045
q4	10534	765	679	679
q5	7736	2769	2770	2769
q6	260	152	148	148
q7	963	624	599	599
q8	9337	1943	1954	1943
q9	6536	6390	6350	6350
q10	6986	2242	2279	2242
q11	453	266	258	258
q12	404	213	206	206
q13	17795	2970	2967	2967
q14	252	215	205	205
q15	570	513	499	499
q16	657	589	591	589
q17	947	581	581	581
q18	7312	6525	6543	6525
q19	3364	1069	962	962
q20	459	199	192	192
q21	3998	3128	2975	2975
q22	1102	995	959	959
Total cold run time: 110061 ms
Total hot run time: 40120 ms

----- Round 2, with runtime_filter_mode=off -----
q1	7344	7287	7276	7276
q2	321	220	227	220
q3	2902	2901	2869	2869
q4	2012	1809	1757	1757
q5	5661	5708	5688	5688
q6	229	148	144	144
q7	2208	1766	1738	1738
q8	3306	3538	3422	3422
q9	8777	8826	8805	8805
q10	3550	3482	3466	3466
q11	605	509	506	506
q12	797	593	590	590
q13	16525	3124	3106	3106
q14	298	270	269	269
q15	567	511	521	511
q16	694	671	677	671
q17	1848	1623	1628	1623
q18	8129	7922	7390	7390
q19	5060	1561	1551	1551
q20	2071	1842	1837	1837
q21	5438	5284	5293	5284
q22	1121	1013	1048	1013
Total cold run time: 79463 ms
Total hot run time: 59736 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 196031 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 4697f592262d51efd5d37cefcc80e624332ca999, data reload: false

query1	1196	922	895	895
query2	6246	2147	2117	2117
query3	10796	3761	3709	3709
query4	66433	29760	23353	23353
query5	5442	465	454	454
query6	460	181	174	174
query7	5977	317	316	316
query8	317	230	220	220
query9	9082	2719	2661	2661
query10	479	265	259	259
query11	17850	15272	15707	15272
query12	162	98	103	98
query13	1564	434	420	420
query14	10905	7134	7156	7134
query15	207	183	186	183
query16	7235	515	485	485
query17	1313	582	592	582
query18	1835	323	320	320
query19	205	157	167	157
query20	118	111	118	111
query21	207	102	100	100
query22	4523	4648	4531	4531
query23	34728	34040	34310	34040
query24	5893	2915	3108	2915
query25	542	415	418	415
query26	672	177	177	177
query27	1975	306	308	306
query28	4288	2547	2538	2538
query29	724	445	437	437
query30	240	153	153	153
query31	970	824	818	818
query32	63	54	54	54
query33	416	279	270	270
query34	890	493	501	493
query35	839	733	747	733
query36	1079	949	963	949
query37	121	68	72	68
query38	4046	4015	3997	3997
query39	1500	1609	1457	1457
query40	201	97	105	97
query41	48	47	47	47
query42	112	100	97	97
query43	537	499	503	499
query44	1166	807	812	807
query45	187	167	182	167
query46	1158	748	761	748
query47	1952	1872	1923	1872
query48	484	373	369	369
query49	733	383	389	383
query50	851	424	418	418
query51	7371	7204	6994	6994
query52	92	94	89	89
query53	257	186	187	186
query54	542	446	440	440
query55	75	78	72	72
query56	248	233	240	233
query57	1178	1100	1104	1100
query58	215	204	199	199
query59	3235	3054	2959	2959
query60	271	247	243	243
query61	126	110	119	110
query62	773	661	652	652
query63	209	190	182	182
query64	1426	634	624	624
query65	3295	3227	3248	3227
query66	709	320	292	292
query67	15874	15468	15668	15468
query68	4861	539	550	539
query69	424	253	260	253
query70	1164	1012	1112	1012
query71	433	258	249	249
query72	6489	3949	3916	3916
query73	770	344	342	342
query74	10195	8905	8890	8890
query75	3297	2626	2688	2626
query76	2279	1120	1073	1073
query77	516	267	265	265
query78	10829	9556	9556	9556
query79	11186	598	610	598
query80	2474	416	406	406
query81	539	240	240	240
query82	1334	118	113	113
query83	304	136	134	134
query84	289	78	73	73
query85	1882	304	297	297
query86	485	300	291	291
query87	4651	4185	4248	4185
query88	5764	2348	2340	2340
query89	555	301	297	297
query90	2092	181	185	181
query91	183	145	145	145
query92	68	47	48	47
query93	7475	561	562	561
query94	948	287	280	280
query95	347	255	264	255
query96	638	273	275	273
query97	3364	3182	3162	3162
query98	215	200	201	200
query99	1611	1308	1287	1287
Total cold run time: 342524 ms
Total hot run time: 196031 ms

@xzj7019
Copy link
Contributor

xzj7019 commented Nov 27, 2024

run p0

@morrySnow morrySnow merged commit cd70f19 into branch-3.0 Nov 27, 2024
19 of 21 checks passed
@morrySnow morrySnow deleted the auto-pick-44617-branch-3.0 branch November 27, 2024 06:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants