Skip to content

Conversation

@starocean999
Copy link
Contributor

@starocean999 starocean999 commented Feb 17, 2025

example sql:
SELECT * FROM t1 WHERE t1.x IN (SELECT x FROM t2 WHERE t1.y is NULL AND t1.y is NOT NULL);

the correlated filter t1.y is NULL AND t1.y is NOT NULL will be replaced as FALSE by SimplifyConflictCompound rule. So we need check if correlated filter exists before converting apply to join

Issue Number: close #xxx

Related PR: (#47385)

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?

@starocean999
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17595	5205	5072	5072
q2	2052	305	180	180
q3	10386	1365	711	711
q4	10217	1014	551	551
q5	7502	2406	2364	2364
q6	186	164	133	133
q7	914	740	617	617
q8	9305	1295	1096	1096
q9	4875	4802	4811	4802
q10	6816	2324	1899	1899
q11	473	278	254	254
q12	347	369	216	216
q13	17768	3711	3085	3085
q14	226	232	215	215
q15	517	469	464	464
q16	609	614	577	577
q17	567	879	335	335
q18	6650	6375	6238	6238
q19	1067	943	555	555
q20	319	328	187	187
q21	2914	2214	1942	1942
q22	367	330	306	306
Total cold run time: 101672 ms
Total hot run time: 31799 ms

----- Round 2, with runtime_filter_mode=off -----
q1	5117	5148	5524	5148
q2	233	330	229	229
q3	2158	2656	2258	2258
q4	1423	1837	1393	1393
q5	4258	4140	4128	4128
q6	207	163	124	124
q7	1878	1813	1686	1686
q8	2634	2688	2609	2609
q9	7270	7084	7038	7038
q10	3052	3213	2745	2745
q11	568	509	501	501
q12	676	767	603	603
q13	3578	3865	3233	3233
q14	276	290	272	272
q15	521	478	457	457
q16	641	667	627	627
q17	1139	1604	1316	1316
q18	7584	7401	7239	7239
q19	820	889	883	883
q20	1965	1997	1880	1880
q21	5364	5013	4833	4833
q22	611	578	581	578
Total cold run time: 51973 ms
Total hot run time: 49780 ms

@doris-robot
Copy link

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

query1	969	381	378	378
query2	6526	1813	1792	1792
query3	6798	211	209	209
query4	26402	23481	22890	22890
query5	4354	664	478	478
query6	304	203	184	184
query7	4613	497	293	293
query8	301	239	228	228
query9	8609	2564	2571	2564
query10	474	318	249	249
query11	15729	15053	14847	14847
query12	174	108	106	106
query13	1669	513	393	393
query14	9574	6621	6119	6119
query15	220	186	179	179
query16	7544	657	461	461
query17	1205	719	559	559
query18	2032	398	304	304
query19	200	194	160	160
query20	119	119	112	112
query21	209	131	105	105
query22	4194	4318	4382	4318
query23	34562	33263	32995	32995
query24	7676	2367	2333	2333
query25	504	442	378	378
query26	1219	279	151	151
query27	2476	476	327	327
query28	4303	2414	2386	2386
query29	696	526	407	407
query30	225	182	151	151
query31	939	840	753	753
query32	68	64	61	61
query33	572	345	287	287
query34	781	839	499	499
query35	823	797	719	719
query36	951	976	901	901
query37	123	99	74	74
query38	4010	4197	4129	4129
query39	1443	1397	1377	1377
query40	205	116	106	106
query41	55	53	51	51
query42	118	102	101	101
query43	484	523	486	486
query44	1263	784	772	772
query45	177	167	157	157
query46	868	1038	637	637
query47	1770	1782	1715	1715
query48	382	412	294	294
query49	786	494	404	404
query50	661	737	407	407
query51	4190	4240	4164	4164
query52	105	103	94	94
query53	227	253	181	181
query54	476	478	405	405
query55	85	88	77	77
query56	254	274	242	242
query57	1135	1141	1069	1069
query58	259	239	229	229
query59	2621	2814	2615	2615
query60	287	267	260	260
query61	113	116	116	116
query62	800	747	659	659
query63	228	188	189	188
query64	4142	992	690	690
query65	3198	3101	3106	3101
query66	1067	392	292	292
query67	15563	15484	15230	15230
query68	7403	757	500	500
query69	464	289	266	266
query70	1228	1181	1039	1039
query71	404	311	256	256
query72	5639	3554	3769	3554
query73	752	734	341	341
query74	8941	9097	8416	8416
query75	3273	3149	2745	2745
query76	3258	1163	749	749
query77	480	380	286	286
query78	9964	9945	9295	9295
query79	2770	809	584	584
query80	581	514	458	458
query81	501	273	233	233
query82	715	129	95	95
query83	171	167	149	149
query84	243	95	71	71
query85	777	344	362	344
query86	381	313	282	282
query87	4483	4476	4428	4428
query88	3973	2207	2190	2190
query89	405	314	293	293
query90	1887	190	196	190
query91	143	139	105	105
query92	77	58	56	56
query93	1957	997	578	578
query94	725	418	281	281
query95	341	268	248	248
query96	480	562	267	267
query97	2786	2879	2722	2722
query98	222	213	204	204
query99	1635	1383	1270	1270
Total cold run time: 272168 ms
Total hot run time: 182093 ms

@doris-robot
Copy link

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

query1	0.03	0.03	0.04
query2	0.07	0.03	0.03
query3	0.23	0.06	0.06
query4	1.63	0.10	0.10
query5	0.41	0.42	0.40
query6	1.17	0.67	0.66
query7	0.03	0.02	0.02
query8	0.04	0.03	0.02
query9	0.59	0.50	0.52
query10	0.57	0.58	0.60
query11	0.15	0.11	0.11
query12	0.15	0.12	0.11
query13	0.62	0.60	0.59
query14	2.67	2.69	2.69
query15	0.92	0.84	0.86
query16	0.37	0.38	0.38
query17	1.01	1.03	1.05
query18	0.22	0.20	0.20
query19	1.97	1.77	1.99
query20	0.01	0.01	0.01
query21	15.36	0.89	0.55
query22	0.75	1.23	0.66
query23	14.90	1.37	0.60
query24	11.42	1.36	0.54
query25	0.39	0.23	0.16
query26	0.95	0.19	0.14
query27	0.05	0.04	0.04
query28	6.02	0.78	0.43
query29	12.56	4.01	3.33
query30	0.25	0.09	0.06
query31	2.83	0.58	0.39
query32	3.23	0.54	0.47
query33	2.95	3.04	3.00
query34	15.79	5.22	4.59
query35	4.58	4.56	4.50
query36	0.66	0.49	0.49
query37	0.09	0.06	0.06
query38	0.06	0.04	0.04
query39	0.03	0.03	0.02
query40	0.16	0.14	0.13
query41	0.09	0.02	0.02
query42	0.02	0.02	0.02
query43	0.03	0.03	0.03
Total cold run time: 106.03 s
Total hot run time: 30.4 s

@starocean999 starocean999 marked this pull request as ready for review February 18, 2025 01:56
public Rule build() {
return logicalApply().when(LogicalApply::isScalar).then(apply -> {
if (apply.isCorrelated()) {
if (apply.isCorrelated() && apply.getCorrelationFilter().isPresent()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe when apply.getCorrelationFilter().isPresent() == false, apply.isCorrelated() should return false?

@starocean999
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17570	5215	5210	5210
q2	2053	291	175	175
q3	10416	1232	712	712
q4	10216	984	531	531
q5	7549	2389	2301	2301
q6	184	165	139	139
q7	903	749	584	584
q8	9343	1250	1041	1041
q9	4994	4952	4928	4928
q10	6876	2302	1868	1868
q11	469	285	266	266
q12	341	349	215	215
q13	17751	3686	3095	3095
q14	225	242	210	210
q15	505	476	459	459
q16	624	608	580	580
q17	553	861	330	330
q18	6498	6210	6277	6210
q19	1336	950	540	540
q20	322	321	189	189
q21	2700	2104	1897	1897
q22	361	329	304	304
Total cold run time: 101789 ms
Total hot run time: 31784 ms

----- Round 2, with runtime_filter_mode=off -----
q1	5091	5069	5053	5053
q2	235	326	233	233
q3	2168	2694	2323	2323
q4	1462	1832	1350	1350
q5	4199	4127	4153	4127
q6	204	163	123	123
q7	1835	1816	1639	1639
q8	2574	2639	2557	2557
q9	7320	7138	7181	7138
q10	3017	3213	2799	2799
q11	583	512	481	481
q12	689	770	611	611
q13	3370	3921	3253	3253
q14	296	305	281	281
q15	513	466	453	453
q16	640	665	643	643
q17	1110	1535	1399	1399
q18	7628	7434	7320	7320
q19	746	786	875	786
q20	1941	2014	1882	1882
q21	5478	5046	4709	4709
q22	598	574	532	532
Total cold run time: 51697 ms
Total hot run time: 49692 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 189460 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 3460d5fce41e38dcc4ad3bc95738dab6110c73dd, data reload: false

query1	1301	960	935	935
query2	6213	1837	1832	1832
query3	11081	4611	4539	4539
query4	57205	25512	23058	23058
query5	4986	507	489	489
query6	330	205	187	187
query7	4916	492	299	299
query8	316	243	236	236
query9	5550	2495	2485	2485
query10	422	310	261	261
query11	15104	15213	14846	14846
query12	164	111	107	107
query13	1027	512	383	383
query14	10549	6355	6806	6355
query15	204	195	198	195
query16	7158	650	501	501
query17	1117	749	603	603
query18	1567	421	332	332
query19	203	190	166	166
query20	137	131	118	118
query21	213	129	104	104
query22	4551	4470	4322	4322
query23	34004	33454	33295	33295
query24	5613	2447	2424	2424
query25	446	464	418	418
query26	693	267	149	149
query27	1731	514	327	327
query28	2735	2420	2403	2403
query29	550	541	443	443
query30	216	188	152	152
query31	846	852	838	838
query32	72	59	57	57
query33	440	342	299	299
query34	757	865	515	515
query35	813	825	779	779
query36	936	1001	890	890
query37	126	100	75	75
query38	4365	4307	4198	4198
query39	1484	1456	1441	1441
query40	207	118	110	110
query41	59	49	49	49
query42	125	114	101	101
query43	481	513	495	495
query44	1277	787	777	777
query45	184	176	166	166
query46	876	1065	656	656
query47	1943	1928	1793	1793
query48	373	412	309	309
query49	689	514	417	417
query50	711	746	411	411
query51	4320	4348	4169	4169
query52	104	98	91	91
query53	225	253	193	193
query54	474	489	412	412
query55	84	75	85	75
query56	278	248	273	248
query57	1200	1205	1149	1149
query58	248	240	227	227
query59	2651	2755	2661	2661
query60	282	268	261	261
query61	116	113	113	113
query62	740	746	682	682
query63	226	195	206	195
query64	1794	1059	665	665
query65	3210	3136	3126	3126
query66	730	383	288	288
query67	15863	15795	15388	15388
query68	4183	769	508	508
query69	497	296	268	268
query70	1118	1121	1104	1104
query71	425	293	271	271
query72	6437	3641	3904	3641
query73	760	740	345	345
query74	8874	9016	8886	8886
query75	3191	3122	2721	2721
query76	3373	1156	723	723
query77	548	362	273	273
query78	10034	10059	9444	9444
query79	2169	804	583	583
query80	678	537	461	461
query81	507	282	244	244
query82	252	124	94	94
query83	172	178	149	149
query84	289	93	70	70
query85	724	344	302	302
query86	328	307	277	277
query87	4440	4465	4458	4458
query88	3097	2151	2143	2143
query89	391	306	297	297
query90	1908	192	190	190
query91	131	150	115	115
query92	72	58	54	54
query93	2473	1015	568	568
query94	656	416	297	297
query95	350	265	257	257
query96	479	552	262	262
query97	2814	2862	2694	2694
query98	233	203	206	203
query99	1292	1408	1275	1275
Total cold run time: 292506 ms
Total hot run time: 189460 ms

@doris-robot
Copy link

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

query1	0.04	0.03	0.03
query2	0.07	0.03	0.03
query3	0.24	0.06	0.07
query4	1.62	0.10	0.10
query5	0.42	0.41	0.40
query6	1.19	0.65	0.66
query7	0.02	0.01	0.01
query8	0.04	0.03	0.03
query9	0.61	0.51	0.51
query10	0.58	0.58	0.57
query11	0.15	0.10	0.10
query12	0.14	0.11	0.11
query13	0.62	0.59	0.59
query14	2.69	2.67	2.72
query15	0.93	0.84	0.86
query16	0.38	0.37	0.38
query17	1.03	1.05	1.03
query18	0.21	0.19	0.20
query19	1.89	1.80	2.05
query20	0.01	0.01	0.02
query21	15.35	0.95	0.56
query22	0.74	1.20	0.76
query23	14.85	1.35	0.62
query24	9.15	1.24	0.65
query25	0.51	0.25	0.14
query26	0.69	0.17	0.14
query27	0.06	0.05	0.04
query28	9.96	0.88	0.43
query29	12.55	3.87	3.25
query30	0.27	0.09	0.06
query31	3.42	0.57	0.38
query32	3.47	0.54	0.46
query33	3.02	2.99	3.04
query34	15.76	5.17	4.59
query35	4.57	4.56	4.59
query36	0.67	0.49	0.48
query37	0.09	0.06	0.06
query38	0.04	0.04	0.04
query39	0.04	0.03	0.03
query40	0.18	0.14	0.13
query41	0.07	0.02	0.02
query42	0.04	0.02	0.02
query43	0.03	0.03	0.03
Total cold run time: 108.41 s
Total hot run time: 30.54 s

@github-actions
Copy link
Contributor

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

@github-actions github-actions bot added approved Indicates a PR has been approved by one committer. reviewed labels Feb 19, 2025
@github-actions
Copy link
Contributor

PR approved by anyone and no changes requested.

@starocean999 starocean999 merged commit a043679 into apache:master Feb 19, 2025
26 of 27 checks passed
github-actions bot pushed a commit that referenced this pull request Feb 19, 2025
…ly to join (#47985)

example sql:
`SELECT *
FROM 
    t1
WHERE 
    t1.x IN (SELECT x FROM t2 WHERE t1.y is NULL AND t1.y is NOT NULL);`

the correlated filter `t1.y is NULL AND t1.y is NOT NULL` will be
replaced as `FALSE` by SimplifyConflictCompound rule. So we need check
if correlated filter exists before converting apply to join

Related PR: (#47385)
github-actions bot pushed a commit that referenced this pull request Feb 19, 2025
…ly to join (#47985)

example sql:
`SELECT *
FROM 
    t1
WHERE 
    t1.x IN (SELECT x FROM t2 WHERE t1.y is NULL AND t1.y is NOT NULL);`

the correlated filter `t1.y is NULL AND t1.y is NOT NULL` will be
replaced as `FALSE` by SimplifyConflictCompound rule. So we need check
if correlated filter exists before converting apply to join

Related PR: (#47385)
yiguolei pushed a commit that referenced this pull request Feb 20, 2025
…nverting apply to join #47985 (#48091)

Cherry-picked from #47985

Co-authored-by: starocean999 <lichi@selectdb.com>
lzyy2024 pushed a commit to lzyy2024/doris that referenced this pull request Feb 21, 2025
…ly to join (apache#47985)

example sql:
`SELECT *
FROM 
    t1
WHERE 
    t1.x IN (SELECT x FROM t2 WHERE t1.y is NULL AND t1.y is NOT NULL);`

the correlated filter `t1.y is NULL AND t1.y is NOT NULL` will be
replaced as `FALSE` by SimplifyConflictCompound rule. So we need check
if correlated filter exists before converting apply to join

Related PR: (apache#47385)
dataroaring pushed a commit that referenced this pull request Feb 24, 2025
…nverting apply to join #47985 (#48088)

Cherry-picked from #47985

Co-authored-by: starocean999 <lichi@selectdb.com>
@gavinchou gavinchou mentioned this pull request Apr 23, 2025
koarz pushed a commit to koarz/doris that referenced this pull request Jun 4, 2025
…ly to join (apache#47985)

example sql:
`SELECT *
FROM 
    t1
WHERE 
    t1.x IN (SELECT x FROM t2 WHERE t1.y is NULL AND t1.y is NOT NULL);`

the correlated filter `t1.y is NULL AND t1.y is NOT NULL` will be
replaced as `FALSE` by SimplifyConflictCompound rule. So we need check
if correlated filter exists before converting apply to join

Related PR: (apache#47385)
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.9-merged dev/3.0.5-merged p0_b reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants