Skip to content

Conversation

@seawinde
Copy link
Contributor

@seawinde seawinde commented Aug 18, 2025

What problem does this PR solve?

if query as following:

select xx
from a 
left join b on a.id = b.id
left join c on b.id = c.id

the column in table a, b, c are all non nullable.
after join reorder the query is as following:

select xx
from 
b 
left join c on b.id = c.id
right join a on on a.id = b.id

the the nullable condition in join conjuncts maybe nullable wrongly.
this would cause be exec fail with err msg [INTERNAL_ERROR]Could not find function eq, arg String return Nullable(BOOL)
the pr fix this

Issue Number: close #xxx

Related PR: #xxx

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?

@seawinde
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17589	5153	5016	5016
q2	1936	272	175	175
q3	10339	1251	710	710
q4	10231	1007	529	529
q5	7494	2339	2349	2339
q6	174	155	124	124
q7	893	727	619	619
q8	9294	1280	1047	1047
q9	6915	5096	5039	5039
q10	6927	2349	1953	1953
q11	482	284	263	263
q12	331	348	218	218
q13	17761	3600	2986	2986
q14	249	232	208	208
q15	561	489	475	475
q16	415	420	372	372
q17	583	804	402	402
q18	7384	7103	7037	7037
q19	1102	945	557	557
q20	340	325	212	212
q21	3760	3141	2342	2342
q22	1076	1031	986	986
Total cold run time: 105836 ms
Total hot run time: 33609 ms

----- Round 2, with runtime_filter_mode=off -----
q1	5102	5077	5067	5067
q2	241	311	216	216
q3	2127	2650	2287	2287
q4	1333	1752	1340	1340
q5	4200	4286	4486	4286
q6	221	177	127	127
q7	1969	1983	1864	1864
q8	2639	2570	2543	2543
q9	7281	7343	7308	7308
q10	3126	3347	2851	2851
q11	586	536	488	488
q12	715	773	631	631
q13	3467	3782	3272	3272
q14	325	314	283	283
q15	536	470	470	470
q16	453	499	462	462
q17	1143	1585	1365	1365
q18	7874	7731	7534	7534
q19	776	805	837	805
q20	1893	1971	1783	1783
q21	4670	4302	4263	4263
q22	1058	1039	1012	1012
Total cold run time: 51735 ms
Total hot run time: 50257 ms

@doris-robot
Copy link

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

query1	1025	379	416	379
query2	6530	1708	1740	1708
query3	6743	223	221	221
query4	26303	23346	22941	22941
query5	4374	599	491	491
query6	295	210	205	205
query7	4638	506	287	287
query8	270	233	224	224
query9	8646	2872	2851	2851
query10	487	337	281	281
query11	15818	14919	14930	14919
query12	181	116	115	115
query13	1668	591	452	452
query14	9172	5702	5637	5637
query15	211	176	165	165
query16	7422	651	493	493
query17	1200	729	602	602
query18	2007	417	323	323
query19	193	190	168	168
query20	132	123	119	119
query21	218	124	107	107
query22	4073	4138	4137	4137
query23	34266	33296	33130	33130
query24	8117	2340	2366	2340
query25	550	477	400	400
query26	1281	267	156	156
query27	2756	502	338	338
query28	4307	2228	2201	2201
query29	766	577	442	442
query30	294	215	183	183
query31	930	803	720	720
query32	79	74	74	74
query33	590	372	334	334
query34	785	832	504	504
query35	799	831	769	769
query36	951	1014	907	907
query37	112	101	81	81
query38	4042	4053	3881	3881
query39	1480	1422	1403	1403
query40	219	125	119	119
query41	59	55	53	53
query42	117	106	110	106
query43	501	498	453	453
query44	1368	851	865	851
query45	175	175	165	165
query46	865	1013	642	642
query47	1745	1843	1725	1725
query48	377	429	309	309
query49	730	491	379	379
query50	687	686	395	395
query51	4009	4156	4191	4156
query52	112	114	105	105
query53	235	262	196	196
query54	595	583	524	524
query55	83	85	86	85
query56	305	309	296	296
query57	1211	1180	1140	1140
query58	270	264	262	262
query59	2628	2681	2535	2535
query60	348	333	351	333
query61	120	117	122	117
query62	805	716	665	665
query63	227	188	188	188
query64	4381	1003	682	682
query65	4241	4208	4215	4208
query66	1143	412	336	336
query67	15567	15262	15012	15012
query68	8119	915	579	579
query69	497	324	288	288
query70	1212	1136	1116	1116
query71	462	328	330	328
query72	5810	4804	4739	4739
query73	703	612	354	354
query74	9114	9060	8554	8554
query75	3805	3075	2658	2658
query76	3681	1151	731	731
query77	784	407	325	325
query78	9667	9542	8867	8867
query79	2510	854	612	612
query80	625	600	476	476
query81	513	256	219	219
query82	488	140	106	106
query83	254	248	238	238
query84	249	103	84	84
query85	822	373	338	338
query86	390	297	285	285
query87	4343	4233	4213	4213
query88	3552	2212	2238	2212
query89	391	320	284	284
query90	1897	230	223	223
query91	140	144	114	114
query92	93	69	67	67
query93	1818	1034	649	649
query94	689	408	308	308
query95	442	315	303	303
query96	491	567	278	278
query97	2693	2687	2600	2600
query98	250	220	205	205
query99	1433	1400	1298	1298
Total cold run time: 274771 ms
Total hot run time: 184376 ms

@doris-robot
Copy link

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

query1	0.04	0.04	0.04
query2	0.09	0.04	0.05
query3	0.24	0.07	0.08
query4	1.61	0.11	0.11
query5	0.41	0.43	0.40
query6	1.16	0.63	0.65
query7	0.03	0.02	0.02
query8	0.05	0.03	0.04
query9	0.61	0.51	0.50
query10	0.57	0.56	0.58
query11	0.17	0.11	0.11
query12	0.15	0.12	0.11
query13	0.64	0.61	0.61
query14	0.80	0.81	0.82
query15	0.89	0.87	0.87
query16	0.37	0.39	0.39
query17	1.03	1.01	1.02
query18	0.22	0.19	0.19
query19	1.95	1.80	1.82
query20	0.02	0.01	0.00
query21	15.39	0.96	0.58
query22	0.78	1.08	0.81
query23	14.86	1.38	0.63
query24	6.40	1.52	1.04
query25	0.50	0.17	0.16
query26	0.57	0.15	0.13
query27	0.06	0.06	0.06
query28	10.50	0.90	0.43
query29	12.57	3.86	3.22
query30	3.08	3.02	3.02
query31	2.82	0.57	0.37
query32	3.23	0.58	0.48
query33	3.01	3.10	3.08
query34	16.06	5.48	4.88
query35	4.91	4.91	4.96
query36	0.70	0.49	0.49
query37	0.09	0.08	0.07
query38	0.06	0.04	0.04
query39	0.03	0.03	0.03
query40	0.16	0.14	0.14
query41	0.08	0.03	0.03
query42	0.04	0.03	0.03
query43	0.03	0.04	0.04
Total cold run time: 106.98 s
Total hot run time: 32.97 s

}

return newJoin;
return JoinUtils.adjustJoinConjunctsNullable(newJoin);
Copy link
Contributor

Choose a reason for hiding this comment

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

should only process if the subplan contains outer join?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

have fixed

Map<Slot, Slot> childSlotMap = new HashMap<>();
for (Plan child : join.children()) {
for (Slot slot : child.getOutput()) {
childSlotMap.put(slot, slot);
Copy link
Contributor

Choose a reason for hiding this comment

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

should not replace directly, generate a new slot with correct nullable is better, could reuse or refer to fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/AdjustNullable.java

Copy link
Contributor Author

Choose a reason for hiding this comment

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

have fixed

@seawinde
Copy link
Contributor Author

run buildall

@hello-stephen
Copy link
Contributor

FE UT Coverage Report

Increment line coverage 100.00% (26/26) 🎉
Increment coverage report
Complete coverage report

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17615	5268	5075	5075
q2	1919	290	176	176
q3	10321	1278	747	747
q4	10212	1014	519	519
q5	7511	2394	2289	2289
q6	171	162	127	127
q7	899	758	606	606
q8	9317	1278	1069	1069
q9	7145	5114	5091	5091
q10	6879	2398	1973	1973
q11	480	288	268	268
q12	347	345	229	229
q13	17753	3637	3058	3058
q14	225	231	216	216
q15	545	471	480	471
q16	419	427	388	388
q17	586	844	369	369
q18	7441	7112	7111	7111
q19	1099	945	578	578
q20	346	343	224	224
q21	4304	3199	3023	3023
q22	1074	1036	964	964
Total cold run time: 106608 ms
Total hot run time: 34571 ms

----- Round 2, with runtime_filter_mode=off -----
q1	5126	5163	5121	5121
q2	237	325	219	219
q3	2184	2688	2307	2307
q4	1400	1784	1300	1300
q5	4167	4438	4532	4438
q6	216	171	132	132
q7	2040	1972	1812	1812
q8	2603	2662	2528	2528
q9	7373	7199	7456	7199
q10	3276	3289	2886	2886
q11	566	512	496	496
q12	697	777	622	622
q13	3727	3854	3225	3225
q14	284	311	282	282
q15	624	493	471	471
q16	445	504	448	448
q17	1206	1536	1448	1448
q18	7855	7580	7689	7580
q19	820	809	867	809
q20	2090	2122	1898	1898
q21	4950	4442	4354	4354
q22	1090	1044	1009	1009
Total cold run time: 52976 ms
Total hot run time: 50584 ms

@doris-robot
Copy link

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

query1	1008	400	413	400
query2	6506	1772	1685	1685
query3	6741	225	225	225
query4	26125	23965	23159	23159
query5	4378	633	478	478
query6	295	224	209	209
query7	4614	500	296	296
query8	275	240	215	215
query9	8573	2851	2820	2820
query10	497	361	291	291
query11	15682	14956	14789	14789
query12	161	113	121	113
query13	1652	550	437	437
query14	8741	5966	5965	5965
query15	223	187	166	166
query16	7149	624	453	453
query17	1045	730	604	604
query18	1991	415	315	315
query19	196	200	176	176
query20	122	117	114	114
query21	211	124	112	112
query22	4008	4188	3983	3983
query23	34256	33476	33236	33236
query24	8139	2357	2366	2357
query25	574	516	410	410
query26	1236	272	211	211
query27	2694	507	348	348
query28	4370	2205	2170	2170
query29	766	570	460	460
query30	291	220	194	194
query31	885	818	721	721
query32	84	72	73	72
query33	555	386	330	330
query34	786	879	521	521
query35	798	847	762	762
query36	988	1017	925	925
query37	121	114	83	83
query38	4031	4033	3932	3932
query39	1473	1418	1412	1412
query40	220	125	121	121
query41	60	54	54	54
query42	122	112	125	112
query43	511	499	490	490
query44	1381	847	863	847
query45	172	165	158	158
query46	891	1035	660	660
query47	1732	1781	1710	1710
query48	377	431	338	338
query49	723	499	385	385
query50	667	704	398	398
query51	4087	4096	4155	4096
query52	115	126	103	103
query53	236	264	197	197
query54	605	575	524	524
query55	90	87	83	83
query56	322	330	297	297
query57	1176	1175	1134	1134
query58	270	275	261	261
query59	2612	2616	2625	2616
query60	338	344	326	326
query61	124	122	128	122
query62	801	730	667	667
query63	229	193	191	191
query64	4342	1062	691	691
query65	4303	4232	4208	4208
query66	1170	436	327	327
query67	15324	15283	15065	15065
query68	8149	943	574	574
query69	469	315	291	291
query70	1261	1090	1096	1090
query71	454	328	318	318
query72	5597	4650	4724	4650
query73	706	601	359	359
query74	8925	8919	8615	8615
query75	3781	3171	2674	2674
query76	3707	1176	754	754
query77	799	407	327	327
query78	9563	9613	8847	8847
query79	2396	869	611	611
query80	615	616	483	483
query81	473	258	228	228
query82	473	139	111	111
query83	290	256	233	233
query84	295	99	88	88
query85	793	363	356	356
query86	346	310	292	292
query87	4362	4300	4187	4187
query88	2972	2228	2215	2215
query89	413	322	300	300
query90	1914	229	226	226
query91	142	145	113	113
query92	94	72	68	68
query93	1147	972	644	644
query94	677	409	288	288
query95	398	318	308	308
query96	480	609	276	276
query97	2653	2676	2589	2589
query98	280	228	210	210
query99	1457	1434	1316	1316
Total cold run time: 271321 ms
Total hot run time: 184971 ms

@doris-robot
Copy link

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

query1	0.04	0.03	0.04
query2	0.08	0.04	0.05
query3	0.24	0.07	0.07
query4	1.62	0.11	0.12
query5	0.43	0.41	0.42
query6	1.19	0.64	0.66
query7	0.02	0.01	0.02
query8	0.05	0.03	0.04
query9	0.61	0.53	0.50
query10	0.58	0.57	0.58
query11	0.17	0.11	0.11
query12	0.15	0.12	0.12
query13	0.62	0.60	0.60
query14	0.80	0.83	0.85
query15	0.87	0.85	0.86
query16	0.38	0.40	0.38
query17	1.06	1.05	1.01
query18	0.21	0.20	0.20
query19	1.93	1.80	1.86
query20	0.02	0.01	0.01
query21	15.39	0.94	0.59
query22	0.76	1.22	0.80
query23	14.75	1.41	0.61
query24	6.59	1.54	1.51
query25	0.52	0.23	0.15
query26	0.66	0.16	0.13
query27	0.06	0.05	0.05
query28	10.47	0.93	0.44
query29	12.53	3.94	3.26
query30	3.10	2.99	3.01
query31	2.82	0.61	0.38
query32	3.24	0.55	0.48
query33	3.11	3.09	3.08
query34	16.12	5.46	4.83
query35	4.90	4.92	5.01
query36	0.67	0.51	0.50
query37	0.10	0.08	0.06
query38	0.05	0.05	0.04
query39	0.03	0.02	0.03
query40	0.18	0.16	0.15
query41	0.09	0.03	0.03
query42	0.03	0.02	0.02
query43	0.03	0.03	0.03
Total cold run time: 107.27 s
Total hot run time: 33.39 s

@seawinde
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17579	5378	5134	5134
q2	1913	300	187	187
q3	10309	1264	729	729
q4	10216	1028	536	536
q5	7718	2486	2295	2295
q6	177	159	134	134
q7	912	765	595	595
q8	9312	1317	1171	1171
q9	6768	5099	5109	5099
q10	6896	2386	1962	1962
q11	485	298	276	276
q12	350	361	229	229
q13	17752	3652	3040	3040
q14	233	260	226	226
q15	559	488	482	482
q16	426	423	377	377
q17	607	854	351	351
q18	7558	7104	7068	7068
q19	1173	958	591	591
q20	346	337	219	219
q21	4130	3324	2461	2461
q22	1127	1011	985	985
Total cold run time: 106546 ms
Total hot run time: 34147 ms

----- Round 2, with runtime_filter_mode=off -----
q1	5223	5171	5119	5119
q2	248	319	216	216
q3	2208	2688	2285	2285
q4	1372	1792	1316	1316
q5	4252	4606	4460	4460
q6	212	178	130	130
q7	2032	1971	1799	1799
q8	2662	2627	2615	2615
q9	7347	7446	7312	7312
q10	3071	3317	2927	2927
q11	582	505	498	498
q12	660	792	621	621
q13	3622	3975	3327	3327
q14	314	292	278	278
q15	522	494	492	492
q16	431	481	428	428
q17	1273	1599	1427	1427
q18	7884	7703	7187	7187
q19	830	782	830	782
q20	1952	2057	1815	1815
q21	4810	4394	4343	4343
q22	1097	1012	998	998
Total cold run time: 52604 ms
Total hot run time: 50375 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 184779 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 3db6d3f44d1c64dd5d2b49f9b7c244543aa18b6d, data reload: false

query1	981	378	405	378
query2	6538	1746	1749	1746
query3	6748	226	221	221
query4	26174	23533	23393	23393
query5	4348	633	484	484
query6	307	243	199	199
query7	4628	517	285	285
query8	282	232	206	206
query9	8609	2862	2870	2862
query10	477	339	273	273
query11	15800	14956	14744	14744
query12	157	111	118	111
query13	1648	542	412	412
query14	8558	5776	5748	5748
query15	200	192	163	163
query16	7402	635	492	492
query17	1247	691	571	571
query18	1966	403	313	313
query19	180	183	159	159
query20	119	115	110	110
query21	212	123	109	109
query22	4104	4134	3916	3916
query23	34257	33371	33228	33228
query24	8125	2379	2325	2325
query25	548	464	397	397
query26	1221	264	155	155
query27	2767	491	342	342
query28	4339	2249	2224	2224
query29	755	568	445	445
query30	282	219	194	194
query31	882	796	710	710
query32	83	72	71	71
query33	549	394	340	340
query34	801	836	513	513
query35	785	852	741	741
query36	943	1023	904	904
query37	117	107	89	89
query38	4101	4032	3955	3955
query39	1472	1433	1401	1401
query40	221	122	119	119
query41	59	56	53	53
query42	117	109	114	109
query43	490	498	456	456
query44	1367	844	848	844
query45	173	167	162	162
query46	861	997	641	641
query47	1752	1801	1720	1720
query48	383	414	300	300
query49	722	492	391	391
query50	650	690	395	395
query51	4095	4109	4080	4080
query52	110	111	105	105
query53	233	276	197	197
query54	594	585	529	529
query55	90	89	84	84
query56	314	313	307	307
query57	1150	1172	1135	1135
query58	286	268	270	268
query59	2645	2646	2590	2590
query60	339	337	335	335
query61	160	153	148	148
query62	838	719	699	699
query63	225	187	189	187
query64	4350	1052	686	686
query65	4310	4182	4248	4182
query66	1162	434	314	314
query67	15835	15313	15103	15103
query68	7853	923	582	582
query69	478	322	278	278
query70	1228	1159	1100	1100
query71	431	327	302	302
query72	5755	4847	4774	4774
query73	659	613	345	345
query74	9104	9138	8936	8936
query75	3391	3086	2640	2640
query76	3318	1139	743	743
query77	557	397	321	321
query78	9529	9585	8824	8824
query79	1645	833	591	591
query80	595	543	467	467
query81	487	264	221	221
query82	216	139	103	103
query83	252	312	234	234
query84	250	102	84	84
query85	777	364	330	330
query86	382	311	279	279
query87	4201	4248	4148	4148
query88	2798	2167	2178	2167
query89	381	315	276	276
query90	1993	227	218	218
query91	130	139	114	114
query92	91	67	65	65
query93	1718	993	639	639
query94	669	403	301	301
query95	402	313	304	304
query96	482	595	280	280
query97	2604	2665	2568	2568
query98	237	222	216	216
query99	1350	1397	1261	1261
Total cold run time: 270206 ms
Total hot run time: 184779 ms

@doris-robot
Copy link

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

query1	0.04	0.04	0.04
query2	0.08	0.04	0.04
query3	0.24	0.07	0.07
query4	1.63	0.11	0.10
query5	0.42	0.42	0.40
query6	1.14	0.64	0.64
query7	0.02	0.02	0.02
query8	0.05	0.03	0.04
query9	0.61	0.53	0.51
query10	0.57	0.56	0.58
query11	0.16	0.11	0.11
query12	0.15	0.12	0.11
query13	0.62	0.60	0.61
query14	0.80	0.81	0.83
query15	0.88	0.84	0.86
query16	0.39	0.41	0.39
query17	1.03	1.07	1.03
query18	0.21	0.20	0.20
query19	1.90	1.79	1.82
query20	0.01	0.02	0.01
query21	15.42	0.95	0.59
query22	0.77	1.12	0.76
query23	14.89	1.43	0.63
query24	6.96	1.28	0.64
query25	0.51	0.20	0.14
query26	0.56	0.15	0.14
query27	0.06	0.05	0.05
query28	8.87	0.97	0.43
query29	12.56	3.90	3.24
query30	3.09	2.98	2.99
query31	2.82	0.60	0.38
query32	3.22	0.56	0.47
query33	3.13	3.09	3.14
query34	15.68	5.48	4.85
query35	4.95	4.91	4.94
query36	0.67	0.51	0.49
query37	0.10	0.07	0.07
query38	0.05	0.04	0.04
query39	0.03	0.02	0.02
query40	0.17	0.14	0.15
query41	0.08	0.03	0.03
query42	0.04	0.02	0.03
query43	0.04	0.03	0.03
Total cold run time: 105.62 s
Total hot run time: 32.44 s

}

if (newJoin.getJoinType().isOuterJoin()) {
return JoinUtils.adjustJoinConjunctsNullable(newJoin);
Copy link
Contributor

Choose a reason for hiding this comment

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

let newJoin = JoinUtils.adjustJoinConjunctsNullable(newJoin) ?

/**
* Adjust nullable attribute of slot reference in expression.
*/
public static Expression doUpdateExpression(AtomicBoolean changed, Expression input,
Copy link
Contributor

Choose a reason for hiding this comment

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

if doUpdateExpression make public, maybe we can remove the arg changed and return Optinal to indicate whether have changed ? what's more, combine the arg debugCheck and isAnalyzedPhase into one: needCheck, then when AdjustNullable call doUpdateExpression, needCheck = debugCheck && !isAnalyzedPhase, when JsonUtils call doUpdateExpression , let needCheck = false ?

* if the join change to '(b left join c) right a where b.condition > 1',
* the nullable property of b.condition should be false
*/
public static LogicalJoin<Plan, Plan> adjustJoinConjunctsNullable(LogicalJoin<Plan, Plan> join) {
Copy link
Contributor

Choose a reason for hiding this comment

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

the logical should be like AdjustNullable.visitLogicalJoin, but here forget to update mark join conditions. maybe can reconstruct AdjustNullable.visitLogicalJoin, and expose a public function AdjustNullable.adjustJoinNullableWithReplaceSlots(join, replaceMap)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

have fixed

@seawinde seawinde force-pushed the fix_join_condition_query_eq_err branch from 49aa1e7 to 11084de Compare August 26, 2025 09:35
@seawinde
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17556	5275	5229	5229
q2	1914	280	178	178
q3	10330	1265	706	706
q4	10216	1000	527	527
q5	7489	2417	2353	2353
q6	173	163	133	133
q7	904	754	597	597
q8	9304	1305	1163	1163
q9	6891	5277	5107	5107
q10	6883	2377	1960	1960
q11	477	291	271	271
q12	341	363	218	218
q13	17757	3631	3030	3030
q14	235	226	214	214
q15	544	499	489	489
q16	439	420	363	363
q17	587	848	367	367
q18	7486	7174	7072	7072
q19	1221	961	558	558
q20	335	328	219	219
q21	3851	2515	2342	2342
q22	1115	1034	966	966
Total cold run time: 106048 ms
Total hot run time: 34062 ms

----- Round 2, with runtime_filter_mode=off -----
q1	5181	5281	5151	5151
q2	242	325	224	224
q3	2144	2690	2362	2362
q4	1371	1783	1304	1304
q5	4197	4428	4605	4428
q6	225	176	132	132
q7	2007	1946	1765	1765
q8	2625	2645	2591	2591
q9	7438	7311	7267	7267
q10	3173	3294	2857	2857
q11	573	508	498	498
q12	706	814	646	646
q13	3482	3903	3327	3327
q14	302	324	278	278
q15	522	494	475	475
q16	453	511	446	446
q17	1207	1587	1430	1430
q18	8083	7863	7572	7572
q19	816	854	907	854
q20	2035	2103	1851	1851
q21	4705	4431	4360	4360
q22	1076	1038	999	999
Total cold run time: 52563 ms
Total hot run time: 50817 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 184650 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 11084def559dbf370c7cbb248c61f54db9f40db5, data reload: false

query1	976	389	395	389
query2	6517	1698	1670	1670
query3	6744	236	227	227
query4	26111	23751	22957	22957
query5	4340	606	509	509
query6	303	226	211	211
query7	4640	499	297	297
query8	278	230	220	220
query9	8554	2878	2903	2878
query10	489	346	273	273
query11	15817	15096	14727	14727
query12	165	114	122	114
query13	1661	543	435	435
query14	9139	5684	5661	5661
query15	208	194	165	165
query16	7696	623	484	484
query17	1196	718	591	591
query18	2037	417	320	320
query19	197	191	165	165
query20	123	125	129	125
query21	212	127	107	107
query22	4181	4290	3997	3997
query23	33986	32885	32905	32885
query24	8119	2343	2325	2325
query25	526	475	392	392
query26	1219	264	152	152
query27	2729	506	346	346
query28	4317	2249	2240	2240
query29	716	551	452	452
query30	281	225	183	183
query31	894	792	729	729
query32	84	79	71	71
query33	557	375	355	355
query34	791	831	508	508
query35	780	815	775	775
query36	938	1020	937	937
query37	127	100	84	84
query38	4060	4057	4029	4029
query39	1518	1413	1409	1409
query40	210	130	116	116
query41	60	59	54	54
query42	118	109	114	109
query43	522	528	479	479
query44	1315	854	853	853
query45	171	171	162	162
query46	854	1004	635	635
query47	1783	1814	1754	1754
query48	382	423	348	348
query49	742	470	387	387
query50	667	693	391	391
query51	4082	4177	4150	4150
query52	112	118	103	103
query53	237	269	192	192
query54	587	589	521	521
query55	96	83	87	83
query56	316	301	335	301
query57	1174	1179	1140	1140
query58	288	263	262	262
query59	2671	2695	2723	2695
query60	339	343	323	323
query61	125	121	124	121
query62	800	706	682	682
query63	226	184	184	184
query64	4256	1004	681	681
query65	4284	4225	4249	4225
query66	1090	417	327	327
query67	15443	15236	15171	15171
query68	8200	902	570	570
query69	481	329	280	280
query70	1264	1200	1126	1126
query71	497	330	313	313
query72	5551	4780	4772	4772
query73	736	630	352	352
query74	9195	9234	8924	8924
query75	3850	3096	2588	2588
query76	3711	1136	728	728
query77	800	397	329	329
query78	9623	9682	8830	8830
query79	2183	832	581	581
query80	593	544	530	530
query81	469	257	220	220
query82	434	142	106	106
query83	259	247	229	229
query84	252	96	84	84
query85	793	378	345	345
query86	354	320	308	308
query87	4226	4276	4106	4106
query88	3490	2267	2215	2215
query89	400	319	280	280
query90	1938	213	220	213
query91	139	140	108	108
query92	81	73	67	67
query93	1552	977	638	638
query94	674	387	297	297
query95	395	305	302	302
query96	499	581	272	272
query97	2642	2683	2571	2571
query98	258	212	216	212
query99	1360	1445	1311	1311
Total cold run time: 273075 ms
Total hot run time: 184650 ms

@seawinde
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17661	5259	5107	5107
q2	1969	346	220	220
q3	10228	1288	756	756
q4	10230	1028	530	530
q5	7524	2416	2368	2368
q6	188	164	136	136
q7	931	776	630	630
q8	9351	1364	1114	1114
q9	6940	5158	5220	5158
q10	6953	2369	1966	1966
q11	477	305	280	280
q12	361	373	220	220
q13	17782	3661	3027	3027
q14	250	246	222	222
q15	573	501	492	492
q16	427	427	388	388
q17	609	865	379	379
q18	7301	7152	7112	7112
q19	1410	951	569	569
q20	349	343	229	229
q21	3744	3231	2350	2350
q22	1037	1036	974	974
Total cold run time: 106295 ms
Total hot run time: 34227 ms

----- Round 2, with runtime_filter_mode=off -----
q1	5203	5159	5124	5124
q2	257	330	226	226
q3	2179	2649	2318	2318
q4	1329	1775	1365	1365
q5	4230	4374	4562	4374
q6	225	172	136	136
q7	2061	1988	1819	1819
q8	2672	2793	2683	2683
q9	7315	7444	7327	7327
q10	3128	3361	2901	2901
q11	570	524	503	503
q12	676	776	670	670
q13	3508	3911	3269	3269
q14	310	318	273	273
q15	506	466	473	466
q16	459	512	443	443
q17	1189	1612	1390	1390
q18	8174	7714	7589	7589
q19	937	887	945	887
q20	2005	2257	1886	1886
q21	4975	4346	4330	4330
q22	1078	1039	1028	1028
Total cold run time: 52986 ms
Total hot run time: 51007 ms

@doris-robot
Copy link

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

query1	1050	456	442	442
query2	6546	1727	1794	1727
query3	6771	231	229	229
query4	26672	23624	22920	22920
query5	4405	641	511	511
query6	342	255	230	230
query7	4654	522	297	297
query8	324	252	241	241
query9	8636	2952	2918	2918
query10	504	337	308	308
query11	16038	14982	15097	14982
query12	180	131	126	126
query13	1702	591	460	460
query14	9373	5828	5817	5817
query15	217	190	180	180
query16	7596	657	475	475
query17	1255	759	643	643
query18	2049	437	406	406
query19	196	195	181	181
query20	133	120	117	117
query21	224	126	115	115
query22	4300	4387	4143	4143
query23	33733	33156	33219	33156
query24	8190	2379	2418	2379
query25	591	512	451	451
query26	1232	287	187	187
query27	2687	514	349	349
query28	4367	2255	2244	2244
query29	800	599	488	488
query30	290	228	194	194
query31	915	813	729	729
query32	90	87	78	78
query33	607	404	354	354
query34	805	859	533	533
query35	813	842	743	743
query36	997	1024	939	939
query37	125	122	93	93
query38	4047	4094	4011	4011
query39	1508	1434	1432	1432
query40	225	134	130	130
query41	75	69	64	64
query42	134	114	128	114
query43	560	503	478	478
query44	1358	869	871	869
query45	182	173	167	167
query46	862	1025	652	652
query47	1794	1804	1739	1739
query48	396	431	349	349
query49	755	504	405	405
query50	679	699	395	395
query51	4146	4145	4157	4145
query52	124	108	105	105
query53	243	267	201	201
query54	617	607	534	534
query55	93	87	95	87
query56	333	344	322	322
query57	1225	1213	1149	1149
query58	295	285	276	276
query59	2630	2799	2714	2714
query60	355	351	343	343
query61	200	169	161	161
query62	807	716	696	696
query63	226	192	196	192
query64	4473	1136	833	833
query65	4323	4226	4228	4226
query66	1138	440	348	348
query67	15405	15654	15179	15179
query68	8943	927	585	585
query69	487	336	300	300
query70	1287	1099	1162	1099
query71	485	350	324	324
query72	5858	5038	5128	5038
query73	769	671	358	358
query74	8955	9186	9075	9075
query75	4172	3100	2633	2633
query76	3718	1136	755	755
query77	811	425	347	347
query78	9587	9640	8886	8886
query79	6481	831	589	589
query80	697	574	527	527
query81	481	263	225	225
query82	731	141	114	114
query83	297	266	256	256
query84	298	118	99	99
query85	894	459	427	427
query86	349	327	309	309
query87	4305	4316	4260	4260
query88	3356	2215	2245	2215
query89	463	334	291	291
query90	1953	231	219	219
query91	160	163	138	138
query92	91	72	73	72
query93	3158	975	649	649
query94	703	404	321	321
query95	414	333	325	325
query96	487	587	281	281
query97	2647	2692	2608	2608
query98	260	226	221	221
query99	1442	1416	1327	1327
Total cold run time: 283356 ms
Total hot run time: 187574 ms

@doris-robot
Copy link

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

query1	0.05	0.05	0.05
query2	0.09	0.05	0.06
query3	0.25	0.08	0.09
query4	1.61	0.12	0.12
query5	0.45	0.42	0.43
query6	1.19	0.65	0.66
query7	0.04	0.04	0.03
query8	0.06	0.05	0.05
query9	0.61	0.52	0.52
query10	0.58	0.57	0.57
query11	0.17	0.12	0.11
query12	0.15	0.12	0.12
query13	0.63	0.62	0.62
query14	0.80	0.84	0.84
query15	0.89	0.86	0.86
query16	0.39	0.41	0.40
query17	1.08	1.03	1.07
query18	0.22	0.21	0.20
query19	1.91	1.83	1.86
query20	0.01	0.01	0.01
query21	15.42	0.93	0.60
query22	0.78	1.25	1.07
query23	14.76	1.41	0.62
query24	6.71	1.16	0.38
query25	0.50	0.20	0.12
query26	0.50	0.16	0.14
query27	0.06	0.06	0.06
query28	9.98	1.00	0.44
query29	12.55	3.94	3.23
query30	3.16	3.07	2.98
query31	2.83	0.59	0.39
query32	3.26	0.57	0.47
query33	3.21	3.06	3.06
query34	16.07	5.56	4.86
query35	4.98	5.03	4.93
query36	0.70	0.52	0.50
query37	0.10	0.07	0.07
query38	0.06	0.05	0.05
query39	0.04	0.03	0.03
query40	0.19	0.16	0.14
query41	0.09	0.03	0.03
query42	0.04	0.03	0.03
query43	0.04	0.04	0.03
Total cold run time: 107.21 s
Total hot run time: 32.79 s

Copy link
Contributor

@yujun777 yujun777 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
Copy link
Contributor

PR approved by anyone and no changes requested.

@github-actions
Copy link
Contributor

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

@github-actions github-actions bot added the approved Indicates a PR has been approved by one committer. label Aug 29, 2025
@morrySnow morrySnow merged commit fb26e43 into apache:master Sep 4, 2025
30 of 31 checks passed
github-actions bot pushed a commit that referenced this pull request Sep 4, 2025
…ption when join reorder (#54953)

### What problem does this PR solve?

if query as following:

select xx
from a 
left join b on a.id = b.id
left join c on b.id = c.id

the column in table a, b, c are all non nullable.
after join reorder the query is as following:

select xx
from 
b 
left join c on b.id = c.id
right join a on on a.id = b.id

the the nullable condition  in join conjuncts maybe nullable wrongly.
this would cause be exec fail with err msg `[INTERNAL_ERROR]Could not
find function eq, arg String return Nullable(BOOL) `
the pr fix this
morrySnow pushed a commit that referenced this pull request Sep 5, 2025
…t exist exception when join reorder #54953 (#55667)

Cherry-picked from #54953

Co-authored-by: seawinde <wusi@selectdb.com>
wenzhenghu pushed a commit to wenzhenghu/doris that referenced this pull request Sep 8, 2025
…ption when join reorder (apache#54953)

### What problem does this PR solve?

if query as following:

select xx
from a 
left join b on a.id = b.id
left join c on b.id = c.id

the column in table a, b, c are all non nullable.
after join reorder the query is as following:

select xx
from 
b 
left join c on b.id = c.id
right join a on on a.id = b.id

the the nullable condition  in join conjuncts maybe nullable wrongly.
this would cause be exec fail with err msg `[INTERNAL_ERROR]Could not
find function eq, arg String return Nullable(BOOL) `
the pr fix this
@morrySnow morrySnow mentioned this pull request Sep 22, 2025
yiguolei pushed a commit to yiguolei/incubator-doris that referenced this pull request Dec 30, 2025
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.x dev/3.1.1-merged reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants