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

[draft] Collect bloom runtime filter filtering statistics. #47305

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Mryange
Copy link
Contributor

@Mryange Mryange commented Jan 22, 2025

What problem does this PR solve?

Runtime filters can be executed either as expressions or predicates.
When executed as predicates, some filters may be transformed into other predicates
(e.g., minmax filters become max/min predicates for index lookup, or combined with
other predicates into key ranges). In such cases, it's difficult to track the filter id.
Therefore, we only collect statistics for bloom filters here to help optimizer analysis.

like this

   -  BloomRuntimeFilterInfo:  
                                                      -  bloom  filter  id  =  3  filtered:  1.004809288B  (1004809288)
                                                      -  bloom  filter  id  =  3  input:  1.005995884B  (1005995884)
                                                      -  bloom  filter  id  =  5  filtered:  1.000712946B  (1000712946)
                                                      -  bloom  filter  id  =  5  input:  1.001186596B  (1001186596)

data from

 // predicates
                                                  -  RuntimeFilterInfo:  
                                                      -  filter  id  =  1  filtered:  384.144K  (384144)
                                                      -  filter  id  =  1  input:  473.65K  (473650)
                                                      -  filter  id  =  3  filtered:  4.809288M  (4809288)
                                                      -  filter  id  =  3  input:  5.995884M  (5995884)
                                                      -  filter  id  =  5  filtered:  712.946K  (712946)
                                                      -  filter  id  =  5  input:  1.186596M  (1186596)
 // expr 
                                                RuntimeFilter:  (id  =  0,  type  =  minmax):
                                                      -  Info:  [Id  =  0,  IsPushDown  =  true,  RuntimeFilterState  =  READY,  HasRemoteTarget  =  false,  HasLocalTarget  =  true,  Ignored  =  false,  Disabled  =  false,  Type  =  1,  WaitTimeMS  =  1000]
                                                      -  RealRuntimeFilterType:  minmax
                                                      -  LocalMergeTime:  0.000000  s
                                                      -  AlwaysTruePassRows:  0
                                                      -  ExprFilteredRows:  1.0B  (1000000000)
                                                      -  ExprInputRows:  1.0B  (1000000000)
                                                      -  WaitTime:  84.0ms
                                                RuntimeFilter:  (id  =  1,  type  =  in_or_bloomfilter):
                                                      -  Info:  [Id  =  1,  IsPushDown  =  true,  RuntimeFilterState  =  READY,  HasRemoteTarget  =  false,  HasLocalTarget  =  true,  Ignored  =  false,  Disabled  =  false,  Type  =  0,  WaitTimeMS  =  1000]
                                                      -  RealRuntimeFilterType:  in
                                                      -  LocalMergeTime:  0.000000  s
                                                      -  InFilterSize:  378
                                                      -  AlwaysTruePassRows:  0
                                                      -  ExprFilteredRows:  1.0B  (1000000000)
                                                      -  ExprInputRows:  1.0B  (1000000000)
                                                      -  WaitTime:  83.0ms
                                                RuntimeFilter:  (id  =  2,  type  =  minmax):
                                                      -  Info:  [Id  =  2,  IsPushDown  =  true,  RuntimeFilterState  =  READY,  HasRemoteTarget  =  false,  HasLocalTarget  =  true,  Ignored  =  false,  Disabled  =  false,  Type  =  1,  WaitTimeMS  =  1000]
                                                      -  RealRuntimeFilterType:  minmax
                                                      -  LocalMergeTime:  0.000000  s
                                                      -  AlwaysTruePassRows:  0
                                                      -  ExprFilteredRows:  1.0B  (1000000000)
                                                      -  ExprInputRows:  1.0B  (1000000000)
                                                      -  WaitTime:  86.0ms
                                                RuntimeFilter:  (id  =  3,  type  =  in_or_bloomfilter):
                                                      -  Info:  [Id  =  3,  IsPushDown  =  true,  RuntimeFilterState  =  READY,  HasRemoteTarget  =  false,  HasLocalTarget  =  true,  Ignored  =  false,  Disabled  =  false,  Type  =  2,  WaitTimeMS  =  1000]
                                                      -  RealRuntimeFilterType:  bloomfilter
                                                      -  LocalMergeTime:  0.000000  s
                                                      -  BloomFilterSize:  1048576
                                                      -  AlwaysTruePassRows:  0
                                                      -  ExprFilteredRows:  1.0B  (1000000000)
                                                      -  ExprInputRows:  1.0B  (1000000000)
                                                      -  WaitTime:  86.0ms
                                                RuntimeFilter:  (id  =  4,  type  =  minmax):
                                                      -  Info:  [Id  =  4,  IsPushDown  =  true,  RuntimeFilterState  =  READY,  HasRemoteTarget  =  false,  HasLocalTarget  =  true,  Ignored  =  false,  Disabled  =  false,  Type  =  1,  WaitTimeMS  =  1000]
                                                      -  RealRuntimeFilterType:  minmax
                                                      -  LocalMergeTime:  0.000000  s
                                                      -  AlwaysTruePassRows:  0
                                                      -  ExprFilteredRows:  1.0B  (1000000000)
                                                      -  ExprInputRows:  1.0B  (1000000000)
                                                      -  WaitTime:  112.0ms
                                                RuntimeFilter:  (id  =  5,  type  =  in_or_bloomfilter):
                                                      -  Info:  [Id  =  5,  IsPushDown  =  true,  RuntimeFilterState  =  READY,  HasRemoteTarget  =  false,  HasLocalTarget  =  true,  Ignored  =  false,  Disabled  =  false,  Type  =  2,  WaitTimeMS  =  1000]
                                                      -  RealRuntimeFilterType:  bloomfilter
                                                      -  LocalMergeTime:  0.000000  s
                                                      -  BloomFilterSize:  1048576
                                                      -  AlwaysTruePassRows:  0
                                                      -  ExprFilteredRows:  1.0B  (1000000000)
                                                      -  ExprInputRows:  1.0B  (1000000000)
                                                      -  WaitTime:  112.0ms

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?

@Mryange
Copy link
Contributor Author

Mryange commented Jan 22, 2025

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17583	5699	5413	5413
q2	2061	312	179	179
q3	10472	1287	735	735
q4	10218	984	568	568
q5	7610	2422	2206	2206
q6	198	172	137	137
q7	911	773	627	627
q8	9257	1389	1142	1142
q9	5183	5079	4869	4869
q10	6846	2350	1890	1890
q11	481	270	263	263
q12	345	357	223	223
q13	17783	3726	3121	3121
q14	240	252	212	212
q15	513	488	475	475
q16	637	640	587	587
q17	585	879	330	330
q18	7466	6458	6586	6458
q19	2628	950	554	554
q20	302	317	204	204
q21	2907	2193	2009	2009
q22	368	336	318	318
Total cold run time: 104594 ms
Total hot run time: 32520 ms

----- Round 2, with runtime_filter_mode=off -----
q1	5630	5580	5537	5537
q2	241	338	235	235
q3	2263	2676	2361	2361
q4	1434	1850	1403	1403
q5	4360	4778	4873	4778
q6	171	169	131	131
q7	2128	2026	1897	1897
q8	2609	2858	2733	2733
q9	7352	7154	7262	7154
q10	3015	3307	2794	2794
q11	625	510	512	510
q12	696	815	627	627
q13	3581	3904	3226	3226
q14	289	299	287	287
q15	521	478	486	478
q16	637	709	644	644
q17	1213	1736	1243	1243
q18	7732	7589	7343	7343
q19	790	1201	1090	1090
q20	2011	2023	1908	1908
q21	5705	5274	4877	4877
q22	616	632	568	568
Total cold run time: 53619 ms
Total hot run time: 51824 ms

@doris-robot
Copy link

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

query1	973	376	382	376
query2	6529	1961	2010	1961
query3	6795	214	217	214
query4	33507	23328	22929	22929
query5	4359	611	449	449
query6	294	218	183	183
query7	4600	503	327	327
query8	296	254	228	228
query9	9673	2604	2581	2581
query10	479	331	248	248
query11	18110	15054	15086	15054
query12	156	110	112	110
query13	1668	516	400	400
query14	9501	6575	7508	6575
query15	252	195	208	195
query16	7864	579	462	462
query17	1621	694	566	566
query18	1287	350	283	283
query19	222	175	149	149
query20	121	109	107	107
query21	206	122	101	101
query22	4371	4459	4341	4341
query23	34665	33069	33182	33069
query24	6789	2237	2243	2237
query25	498	450	394	394
query26	1085	277	149	149
query27	2121	462	329	329
query28	5341	2421	2391	2391
query29	629	542	406	406
query30	237	182	158	158
query31	971	880	773	773
query32	84	61	67	61
query33	545	345	329	329
query34	735	865	498	498
query35	822	812	731	731
query36	1018	1030	964	964
query37	132	104	83	83
query38	4077	4210	4098	4098
query39	1435	1408	1397	1397
query40	205	114	100	100
query41	52	52	54	52
query42	123	101	102	101
query43	501	510	476	476
query44	1352	812	810	810
query45	182	177	167	167
query46	850	1058	642	642
query47	1838	1826	1769	1769
query48	385	394	320	320
query49	770	501	401	401
query50	615	645	394	394
query51	6843	6907	6778	6778
query52	100	102	94	94
query53	217	244	197	197
query54	480	477	416	416
query55	80	78	81	78
query56	265	270	247	247
query57	1191	1137	1065	1065
query58	253	222	232	222
query59	3004	2990	2804	2804
query60	281	277	263	263
query61	116	120	112	112
query62	823	726	634	634
query63	220	191	185	185
query64	4108	1026	673	673
query65	3230	3197	3197	3197
query66	838	408	303	303
query67	15864	15586	15373	15373
query68	4345	810	527	527
query69	446	281	263	263
query70	1171	1189	1164	1164
query71	372	285	268	268
query72	5979	3797	3892	3797
query73	634	757	356	356
query74	9840	9207	8655	8655
query75	3177	3157	2691	2691
query76	3072	1196	774	774
query77	458	355	287	287
query78	9969	10115	9376	9376
query79	2322	816	582	582
query80	650	521	452	452
query81	522	271	243	243
query82	226	154	124	124
query83	178	173	148	148
query84	253	97	74	74
query85	816	440	291	291
query86	392	318	297	297
query87	4386	4488	4512	4488
query88	3549	2208	2146	2146
query89	399	325	296	296
query90	1724	191	190	190
query91	137	138	109	109
query92	62	56	52	52
query93	1258	862	526	526
query94	587	414	309	309
query95	325	263	250	250
query96	492	612	284	284
query97	2768	2856	2701	2701
query98	240	197	195	195
query99	1286	1380	1269	1269
Total cold run time: 280889 ms
Total hot run time: 186963 ms

@doris-robot
Copy link

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

query1	0.04	0.03	0.02
query2	0.07	0.04	0.03
query3	0.24	0.07	0.06
query4	1.61	0.11	0.10
query5	0.42	0.43	0.43
query6	1.16	0.66	0.65
query7	0.03	0.02	0.01
query8	0.04	0.03	0.03
query9	0.59	0.52	0.52
query10	0.54	0.59	0.55
query11	0.13	0.11	0.10
query12	0.13	0.11	0.10
query13	0.61	0.59	0.61
query14	2.80	2.73	2.79
query15	0.89	0.82	0.82
query16	0.38	0.38	0.38
query17	1.08	1.06	1.01
query18	0.24	0.20	0.20
query19	1.91	1.80	2.04
query20	0.01	0.02	0.01
query21	15.37	0.93	0.58
query22	0.76	0.86	0.74
query23	15.21	1.42	0.57
query24	2.69	0.34	1.51
query25	0.20	0.17	0.10
query26	0.26	0.15	0.14
query27	0.04	0.06	0.04
query28	13.76	1.14	0.44
query29	12.59	4.07	3.33
query30	0.24	0.09	0.07
query31	2.82	0.61	0.38
query32	3.22	0.54	0.45
query33	3.03	3.02	3.03
query34	16.65	5.16	4.52
query35	4.54	4.49	4.62
query36	0.66	0.49	0.48
query37	0.10	0.06	0.06
query38	0.04	0.04	0.04
query39	0.03	0.03	0.03
query40	0.16	0.13	0.13
query41	0.08	0.02	0.02
query42	0.04	0.02	0.02
query43	0.04	0.03	0.03
Total cold run time: 105.45 s
Total hot run time: 30.16 s

@doris-robot
Copy link

TeamCity be ut coverage result:
Function Coverage: 41.56% (10835/26069)
Line Coverage: 31.96% (91573/286554)
Region Coverage: 31.09% (46903/150849)
Branch Coverage: 27.18% (23756/87392)
Coverage Report: http://coverage.selectdb-in.cc/coverage/14f578fc2bd97d39702c981ca30003460d247875_14f578fc2bd97d39702c981ca30003460d247875/report/index.html

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.

3 participants