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

[improve](scan)scanner could eos early when reached limit #36535

Merged
merged 3 commits into from
Jun 24, 2024

Conversation

zhangstar333
Copy link
Contributor

@zhangstar333 zhangstar333 commented Jun 19, 2024

Proposed changes

two point have change:

  1. iff should_run_serial, it's could set _max_thread_num = 1
    // For select * from table limit 10; should just use one thread.
    if (_local_state && _local_state->should_run_serial()) {
        _max_thread_num = 1;
    }
  1. scan operator have two limit, one is _limit, another is _limit_per_scanner
    could set eos when scan rows reached limit, it should use _limit variables.
    // If sort info is set, push limit to each scanner;
    int64_t _limit_per_scanner = -1;
    if (_olap_scan_node.__isset.sort_info && _olap_scan_node.__isset.sort_limit) {
        _limit_per_scanner = _olap_scan_node.sort_limit;
    }
before and after:
mysql [ssb]>select from_days(u32) from nums_all limit 1;
+----------------+
| from_days(u32) |
+----------------+
| 0090-01-24     |
+----------------+
1 row in set (0.13 sec)


mysql [ssb]>select from_days(u32) from nums_all limit 1;
+----------------+
| from_days(u32) |
+----------------+
| 0090-01-28     |
+----------------+
1 row in set (0.02 sec)

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

@zhangstar333
Copy link
Contributor Author

run buildall

@zhangstar333
Copy link
Contributor Author

run buildall

Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

1 similar comment
Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@doris-robot
Copy link

TeamCity be ut coverage result:
Function Coverage: 36.46% (9005/24696)
Line Coverage: 28.01% (73801/263452)
Region Coverage: 27.49% (38337/139438)
Branch Coverage: 24.19% (19544/80790)
Coverage Report: http://coverage.selectdb-in.cc/coverage/44252a4cf9905e09ab10c75e7ade9fd89541b1cf_44252a4cf9905e09ab10c75e7ade9fd89541b1cf/report/index.html

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17633	4317	4331	4317
q2	2014	189	191	189
q3	10453	1077	1122	1077
q4	10198	791	715	715
q5	7454	2612	2640	2612
q6	231	136	132	132
q7	966	611	604	604
q8	9218	2050	2042	2042
q9	8856	6463	6488	6463
q10	9000	3713	3767	3713
q11	444	240	233	233
q12	483	233	218	218
q13	17763	3007	2951	2951
q14	264	218	223	218
q15	509	488	477	477
q16	504	381	378	378
q17	963	731	695	695
q18	7899	7453	7479	7453
q19	3068	1537	1402	1402
q20	644	309	331	309
q21	4976	3117	3836	3117
q22	391	333	346	333
Total cold run time: 113931 ms
Total hot run time: 39648 ms

----- Round 2, with runtime_filter_mode=off -----
q1	4358	4228	4277	4228
q2	379	279	258	258
q3	2993	2751	2883	2751
q4	1989	1739	1731	1731
q5	5582	5575	5508	5508
q6	235	133	126	126
q7	2171	1778	1893	1778
q8	3270	3427	3379	3379
q9	8737	8700	8842	8700
q10	4033	3938	3740	3740
q11	575	491	482	482
q12	816	652	657	652
q13	17274	3154	3172	3154
q14	319	270	278	270
q15	518	482	478	478
q16	472	432	429	429
q17	1811	1506	1486	1486
q18	8268	7917	7764	7764
q19	2947	1759	1526	1526
q20	3083	1879	1828	1828
q21	4970	4967	4753	4753
q22	713	519	572	519
Total cold run time: 75513 ms
Total hot run time: 55540 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 174097 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 44252a4cf9905e09ab10c75e7ade9fd89541b1cf, data reload: false

query1	932	377	376	376
query2	6464	2490	2391	2391
query3	6623	205	208	205
query4	18981	17212	17186	17186
query5	3544	481	486	481
query6	238	157	158	157
query7	4587	302	307	302
query8	329	291	300	291
query9	8440	2393	2358	2358
query10	556	308	291	291
query11	10506	10088	10151	10088
query12	120	91	85	85
query13	1642	374	369	369
query14	10275	7697	7760	7697
query15	237	190	184	184
query16	7803	275	283	275
query17	1870	544	512	512
query18	2000	271	267	267
query19	190	155	159	155
query20	96	84	84	84
query21	205	129	129	129
query22	4396	4046	4027	4027
query23	33876	33454	33825	33454
query24	11040	2891	2849	2849
query25	621	392	371	371
query26	1287	165	158	158
query27	2429	354	335	335
query28	7399	2114	2120	2114
query29	892	631	654	631
query30	262	159	159	159
query31	953	758	755	755
query32	92	51	53	51
query33	745	286	287	286
query34	1045	485	492	485
query35	740	655	634	634
query36	1125	1014	946	946
query37	158	71	74	71
query38	2914	2850	2801	2801
query39	897	835	864	835
query40	212	127	128	127
query41	53	54	55	54
query42	119	98	100	98
query43	592	559	539	539
query44	1201	711	723	711
query45	194	163	165	163
query46	1071	706	720	706
query47	1906	1770	1752	1752
query48	392	296	293	293
query49	852	400	401	400
query50	759	393	396	393
query51	6838	6681	6670	6670
query52	102	88	94	88
query53	358	293	292	292
query54	889	447	448	447
query55	74	74	72	72
query56	270	258	259	258
query57	1107	1058	1057	1057
query58	249	269	261	261
query59	3421	3240	3169	3169
query60	313	277	283	277
query61	91	90	88	88
query62	605	432	450	432
query63	323	292	289	289
query64	8897	2289	1754	1754
query65	3174	3106	3081	3081
query66	751	325	328	325
query67	15757	14971	15044	14971
query68	4538	541	541	541
query69	513	411	368	368
query70	1158	1100	1110	1100
query71	411	270	272	270
query72	7165	5248	5615	5248
query73	744	326	326	326
query74	5867	5589	5469	5469
query75	3326	2691	2646	2646
query76	2481	964	923	923
query77	411	297	303	297
query78	10468	9845	9758	9758
query79	2308	514	506	506
query80	2277	460	455	455
query81	572	214	276	214
query82	834	103	98	98
query83	294	166	166	166
query84	259	88	86	86
query85	2022	270	264	264
query86	496	338	311	311
query87	3282	3063	3112	3063
query88	4022	2349	2334	2334
query89	476	371	377	371
query90	1717	184	188	184
query91	130	100	103	100
query92	58	49	53	49
query93	2471	505	499	499
query94	1115	183	186	183
query95	399	307	304	304
query96	580	261	259	259
query97	3244	3053	3074	3053
query98	228	199	199	199
query99	1138	853	841	841
Total cold run time: 272083 ms
Total hot run time: 174097 ms

@doris-robot
Copy link

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

query1	0.04	0.03	0.03
query2	0.09	0.04	0.04
query3	0.23	0.06	0.07
query4	1.66	0.10	0.10
query5	0.51	0.50	0.49
query6	1.12	0.72	0.72
query7	0.02	0.01	0.01
query8	0.05	0.04	0.05
query9	0.54	0.49	0.49
query10	0.55	0.55	0.54
query11	0.16	0.11	0.12
query12	0.15	0.12	0.13
query13	0.59	0.58	0.60
query14	0.77	0.79	0.78
query15	0.84	0.83	0.81
query16	0.35	0.35	0.38
query17	0.96	1.02	0.97
query18	0.22	0.27	0.23
query19	1.76	1.72	1.73
query20	0.02	0.01	0.01
query21	15.41	0.66	0.65
query22	4.50	7.61	1.49
query23	18.30	1.38	1.26
query24	2.11	0.22	0.21
query25	0.15	0.09	0.08
query26	0.25	0.17	0.18
query27	0.08	0.09	0.09
query28	13.30	1.03	1.01
query29	12.67	3.31	3.25
query30	0.27	0.07	0.07
query31	2.85	0.40	0.38
query32	3.27	0.48	0.47
query33	2.86	2.90	2.92
query34	17.18	4.47	4.48
query35	4.54	4.57	4.54
query36	0.65	0.47	0.46
query37	0.19	0.15	0.15
query38	0.15	0.14	0.14
query39	0.04	0.03	0.04
query40	0.17	0.14	0.15
query41	0.09	0.05	0.04
query42	0.05	0.04	0.05
query43	0.05	0.04	0.04
Total cold run time: 109.76 s
Total hot run time: 30.28 s

Copy link
Contributor

@HappenLee HappenLee left a comment

Choose a reason for hiding this comment

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

LGTM

@github-actions github-actions bot added the approved Indicates a PR has been approved by one committer. label Jun 20, 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.

Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@zhangstar333
Copy link
Contributor Author

run buildall

Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	6778	4381	4343	4343
q2	484	195	194	194
q3	1412	1228	1185	1185
q4	1158	781	674	674
q5	2710	2672	2668	2668
q6	236	138	137	137
q7	949	604	608	604
q8	2024	2288	2233	2233
q9	6624	6558	6529	6529
q10	3917	3755	3753	3753
q11	407	235	249	235
q12	399	242	235	235
q13	17774	2981	3003	2981
q14	256	221	210	210
q15	519	468	482	468
q16	510	382	375	375
q17	994	629	698	629
q18	8200	7595	7443	7443
q19	1680	1540	1422	1422
q20	523	302	359	302
q21	7847	3252	3321	3252
q22	397	334	343	334
Total cold run time: 65798 ms
Total hot run time: 40206 ms

----- Round 2, with runtime_filter_mode=off -----
q1	4249	4213	4219	4213
q2	361	277	278	277
q3	2980	2747	2753	2747
q4	1927	1614	1599	1599
q5	5325	5287	5289	5287
q6	215	127	128	127
q7	2113	1686	1734	1686
q8	3162	3334	3340	3334
q9	8384	8359	8388	8359
q10	3877	3657	3620	3620
q11	574	482	480	480
q12	747	599	591	591
q13	16289	2968	2982	2968
q14	296	288	271	271
q15	525	472	469	469
q16	466	424	409	409
q17	1789	1488	1490	1488
q18	7711	7535	7368	7368
q19	1694	1615	1514	1514
q20	1987	1778	1763	1763
q21	4801	4659	4588	4588
q22	574	548	533	533
Total cold run time: 70046 ms
Total hot run time: 53691 ms

@doris-robot
Copy link

TeamCity be ut coverage result:
Function Coverage: 36.47% (9004/24692)
Line Coverage: 28.02% (73834/263541)
Region Coverage: 27.50% (38346/139415)
Branch Coverage: 24.21% (19551/80764)
Coverage Report: http://coverage.selectdb-in.cc/coverage/4a89bfa780496db77cbe71ce6b0391ff9497e447_4a89bfa780496db77cbe71ce6b0391ff9497e447/report/index.html

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	18082	4558	4417	4417
q2	2436	195	196	195
q3	11037	1121	1047	1047
q4	10882	862	930	862
q5	7841	2733	2645	2645
q6	230	142	135	135
q7	964	629	614	614
q8	9772	2094	2101	2094
q9	9061	6495	6483	6483
q10	8974	3737	3734	3734
q11	448	244	242	242
q12	429	230	228	228
q13	18693	2960	2998	2960
q14	271	217	223	217
q15	533	501	480	480
q16	531	393	395	393
q17	986	669	734	669
q18	8069	7564	7448	7448
q19	6349	1476	1427	1427
q20	646	315	317	315
q21	4847	3076	3921	3076
q22	400	343	337	337
Total cold run time: 121481 ms
Total hot run time: 40018 ms

----- Round 2, with runtime_filter_mode=off -----
q1	4397	4253	4226	4226
q2	366	269	261	261
q3	2950	2734	2722	2722
q4	1891	1628	1588	1588
q5	5242	5308	5286	5286
q6	215	123	127	123
q7	2089	1787	1713	1713
q8	3193	3356	3344	3344
q9	8396	8317	8308	8308
q10	3848	3673	3674	3673
q11	572	475	489	475
q12	777	597	579	579
q13	16343	2981	2963	2963
q14	300	258	259	258
q15	519	476	481	476
q16	464	417	407	407
q17	1777	1481	1470	1470
q18	7619	7678	7449	7449
q19	1684	1651	1511	1511
q20	1986	1802	1800	1800
q21	4896	4897	4812	4812
q22	614	534	558	534
Total cold run time: 70138 ms
Total hot run time: 53978 ms

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17918	4323	4283	4283
q2	2029	198	191	191
q3	10461	1164	1055	1055
q4	10492	817	799	799
q5	8601	2725	2685	2685
q6	230	138	137	137
q7	983	650	632	632
q8	9239	2069	2096	2069
q9	9117	6564	6531	6531
q10	9235	3957	3869	3869
q11	485	261	239	239
q12	506	246	237	237
q13	18191	3250	3178	3178
q14	269	229	246	229
q15	546	503	482	482
q16	516	390	386	386
q17	972	688	687	687
q18	8436	7646	7471	7471
q19	8251	1427	1531	1427
q20	657	324	323	323
q21	4919	3227	4005	3227
q22	387	341	350	341
Total cold run time: 122440 ms
Total hot run time: 40478 ms

----- Round 2, with runtime_filter_mode=off -----
q1	4358	4221	4346	4221
q2	392	275	274	274
q3	3155	2858	2953	2858
q4	2027	1696	1700	1696
q5	5498	5497	5576	5497
q6	217	131	133	131
q7	2210	1873	1848	1848
q8	3270	3434	3397	3397
q9	8763	8746	8769	8746
q10	3909	3812	3825	3812
q11	608	496	489	489
q12	822	646	652	646
q13	15974	3205	3229	3205
q14	303	281	269	269
q15	542	475	485	475
q16	504	431	433	431
q17	1822	1507	1529	1507
q18	8120	7987	7669	7669
q19	1807	1715	1529	1529
q20	3107	1887	1872	1872
q21	7702	4967	4808	4808
q22	644	551	586	551
Total cold run time: 75754 ms
Total hot run time: 55931 ms

@doris-robot
Copy link

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

query1	932	383	373	373
query2	6465	2355	2364	2355
query3	6639	208	219	208
query4	19215	17256	17163	17163
query5	3618	500	478	478
query6	241	166	161	161
query7	4583	302	300	300
query8	331	307	308	307
query9	8415	2415	2401	2401
query10	580	321	282	282
query11	10455	10099	10001	10001
query12	120	88	84	84
query13	1629	365	370	365
query14	9411	7103	7808	7103
query15	225	196	185	185
query16	7745	269	253	253
query17	1847	528	525	525
query18	1903	272	293	272
query19	189	159	151	151
query20	95	84	84	84
query21	208	128	127	127
query22	4299	4171	4148	4148
query23	33758	33909	33724	33724
query24	11093	2927	2862	2862
query25	592	377	394	377
query26	891	158	165	158
query27	2369	332	329	329
query28	6593	2138	2105	2105
query29	895	633	601	601
query30	259	152	159	152
query31	956	776	754	754
query32	94	54	57	54
query33	782	280	292	280
query34	1088	488	487	487
query35	779	647	664	647
query36	1108	935	980	935
query37	153	77	76	76
query38	2995	2865	2805	2805
query39	920	865	826	826
query40	205	128	125	125
query41	53	53	53	53
query42	109	110	104	104
query43	611	595	534	534
query44	1230	724	736	724
query45	197	165	163	163
query46	1063	727	758	727
query47	1853	1734	1757	1734
query48	379	298	295	295
query49	837	402	404	402
query50	762	403	390	390
query51	6950	6798	6708	6708
query52	104	90	93	90
query53	368	301	291	291
query54	911	448	435	435
query55	78	74	73	73
query56	283	261	280	261
query57	1114	1034	1049	1034
query58	259	288	254	254
query59	3353	3135	3050	3050
query60	289	269	278	269
query61	92	103	88	88
query62	594	452	434	434
query63	321	288	300	288
query64	8736	2284	1873	1873
query65	3158	3119	3093	3093
query66	756	334	381	334
query67	15524	14815	14792	14792
query68	4608	529	534	529
query69	568	336	309	309
query70	1183	1150	1117	1117
query71	408	283	283	283
query72	8325	5528	5486	5486
query73	744	324	320	320
query74	5966	5472	5561	5472
query75	3491	2677	2635	2635
query76	2439	925	940	925
query77	659	300	309	300
query78	10595	9762	9768	9762
query79	2129	522	522	522
query80	1095	482	466	466
query81	589	218	219	218
query82	665	106	102	102
query83	324	173	172	172
query84	260	85	87	85
query85	1842	288	268	268
query86	457	352	295	295
query87	3285	3059	3082	3059
query88	4260	2331	2326	2326
query89	472	376	382	376
query90	1856	187	187	187
query91	127	99	101	99
query92	58	49	48	48
query93	2297	499	505	499
query94	1240	190	185	185
query95	403	313	324	313
query96	589	263	267	263
query97	3251	2986	3049	2986
query98	212	200	190	190
query99	1121	834	852	834
Total cold run time: 270177 ms
Total hot run time: 173747 ms

@doris-robot
Copy link

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

query1	0.04	0.03	0.03
query2	0.08	0.04	0.04
query3	0.23	0.04	0.04
query4	1.68	0.07	0.07
query5	0.49	0.49	0.49
query6	1.13	0.73	0.73
query7	0.02	0.02	0.02
query8	0.05	0.05	0.06
query9	0.55	0.49	0.49
query10	0.56	0.54	0.55
query11	0.15	0.12	0.11
query12	0.15	0.12	0.12
query13	0.60	0.58	0.60
query14	0.78	0.76	0.79
query15	0.85	0.83	0.81
query16	0.36	0.36	0.38
query17	1.01	0.95	0.98
query18	0.22	0.22	0.25
query19	1.80	1.70	1.78
query20	0.01	0.01	0.02
query21	15.41	0.66	0.65
query22	4.01	8.25	1.51
query23	18.24	1.30	1.29
query24	2.07	0.23	0.26
query25	0.14	0.09	0.08
query26	0.28	0.18	0.18
query27	0.08	0.08	0.08
query28	13.19	1.03	1.01
query29	12.69	3.30	3.27
query30	0.27	0.07	0.06
query31	2.88	0.39	0.39
query32	3.23	0.47	0.48
query33	2.90	2.91	2.88
query34	17.04	4.46	4.45
query35	4.46	4.48	4.49
query36	0.65	0.46	0.49
query37	0.19	0.16	0.16
query38	0.15	0.14	0.15
query39	0.05	0.03	0.04
query40	0.17	0.14	0.13
query41	0.10	0.05	0.04
query42	0.06	0.05	0.05
query43	0.05	0.04	0.05
Total cold run time: 109.07 s
Total hot run time: 30.2 s

@HappenLee HappenLee merged commit adde9ab into apache:master Jun 24, 2024
25 of 29 checks passed
zhangstar333 added a commit to zhangstar333/incubator-doris that referenced this pull request Jun 24, 2024
zhangstar333 added a commit to zhangstar333/incubator-doris that referenced this pull request Jun 24, 2024
zhangstar333 added a commit that referenced this pull request Jun 25, 2024
zhangstar333 added a commit that referenced this pull request Jun 26, 2024
Gabriel39 pushed a commit to Gabriel39/incubator-doris that referenced this pull request Jul 2, 2024
@xiaokang xiaokang mentioned this pull request Jul 14, 2024
mongo360 pushed a commit to mongo360/doris that referenced this pull request Aug 16, 2024
zhiqiang-hhhh added a commit to zhiqiang-hhhh/doris that referenced this pull request Aug 22, 2024
yiguolei pushed a commit that referenced this pull request Sep 4, 2024
… limit involved (#39927)

For queries like `select * from tbl limit 100;`, we should limit the
parallelism to 1.

We already have strategies in our code, but we can not control its
behavior. So add session variables to control them.

Previous pr like #33888 #36535 already has done something similar, this
pr integrates them.
zhiqiang-hhhh added a commit to zhiqiang-hhhh/doris that referenced this pull request Sep 4, 2024
… limit involved (apache#39927)

For queries like `select * from tbl limit 100;`, we should limit the
parallelism to 1.

We already have strategies in our code, but we can not control its
behavior. So add session variables to control them.

Previous pr like apache#33888 apache#36535 already has done something similar, this
pr integrates them.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants