Skip to content

Conversation

@yujun777
Copy link
Contributor

@yujun777 yujun777 commented Oct 16, 2025

For a condition expression, replace null to false, null safe equal to equal. The condition include filter condition, join condition, if condition, case when condition.

And for the condition expression, only replace those sub expression which its ancestors to the condition root are all AND / OR / CASE WHEN / IF. So, for a expression null and not(null) in a filter, the first null can be replaced, but the second null cann't be replaced because its parent is NOT, not in AND / OR / CASE WHEN / IF.

For a expression x <=> y in condition, if one of them is not-nullable, then it can rewrite to x = y. Note that if a expression is not a condition, x <=> y can rewrite to x = y require that both x and y are not-nullable.

Here is some example:

  1. replace null with false
null  and (null  or null) and not(null)   =>  false and (false or false) and not(null)

case when null and not (null) then ...   =>   case when false and not (null) then ...

if(null and not(null), ...) =>  if (false and not(null), ...)
  1. replace null safe equal to equal if at least one of its child is non-nullable
x  <=>  3 and not(x <=> 3)   => x = 3 and not(x <=> 3)

case when x <=> 3 then ...    =>  case when x = 3 then ...

if(x <=> 3, ...)  => if(x=3, ...)
  1. rewrite if expression in condition if its else branch is true / false literal.

suppose the if is in a filter, then will have

 if(c, p, true)  => not(c <=> true) or p

if(c, p, false)  => c and p

Currently, the expression rewrite framework cann't known the expression's plan, In order to indicate that the expression is on the filter / join, we add the expression's plan and source to the ExpressionRewriteContext to indicate the expression's location.

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

@Thearas
Copy link
Contributor

Thearas commented Oct 16, 2025

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?

@yujun777 yujun777 force-pushed the replace-null-for-filter branch from 7e13974 to 14f64e7 Compare October 16, 2025 06:51
@yujun777
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

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

query1	1065	454	410	410
query2	6572	1722	1681	1681
query3	6756	225	227	225
query4	26378	23623	22987	22987
query5	4371	623	463	463
query6	318	260	234	234
query7	4669	502	315	315
query8	325	296	266	266
query9	8708	2610	2604	2604
query10	475	335	299	299
query11	15998	15093	14904	14904
query12	196	126	117	117
query13	1705	559	454	454
query14	11866	9272	9489	9272
query15	236	201	189	189
query16	7886	724	541	541
query17	2429	870	719	719
query18	2149	441	350	350
query19	287	239	190	190
query20	136	130	135	130
query21	221	144	117	117
query22	4697	4815	4599	4599
query23	35064	34123	33751	33751
query24	8514	2748	2578	2578
query25	587	521	490	490
query26	1270	290	170	170
query27	2775	525	369	369
query28	4318	2224	2229	2224
query29	810	670	506	506
query30	309	229	238	229
query31	950	855	796	796
query32	83	69	70	69
query33	586	392	325	325
query34	830	856	511	511
query35	825	838	765	765
query36	953	982	900	900
query37	121	115	88	88
query38	3561	3544	3507	3507
query39	1484	1399	1410	1399
query40	224	130	115	115
query41	61	58	98	58
query42	120	110	108	108
query43	494	506	480	480
query44	1395	833	821	821
query45	186	183	174	174
query46	829	995	632	632
query47	1752	1798	1726	1726
query48	397	416	316	316
query49	777	496	391	391
query50	661	692	414	414
query51	3867	3902	3925	3902
query52	111	115	106	106
query53	248	271	208	208
query54	596	602	566	566
query55	91	85	87	85
query56	321	316	320	316
query57	1174	1190	1122	1122
query58	282	284	272	272
query59	2610	2677	2511	2511
query60	346	346	336	336
query61	158	155	149	149
query62	824	746	701	701
query63	245	200	198	198
query64	4420	1153	814	814
query65	4081	3978	3992	3978
query66	1102	431	335	335
query67	15507	15242	15050	15050
query68	8886	957	594	594
query69	480	320	287	287
query70	1350	1333	1317	1317
query71	518	336	312	312
query72	6049	4935	4862	4862
query73	575	607	370	370
query74	8938	9100	9010	9010
query75	4195	3383	2821	2821
query76	3388	1152	738	738
query77	935	402	305	305
query78	9568	9882	8859	8859
query79	6473	858	582	582
query80	759	550	499	499
query81	477	270	230	230
query82	725	166	133	133
query83	405	273	244	244
query84	296	117	95	95
query85	909	459	423	423
query86	346	309	290	290
query87	3835	3709	3606	3606
query88	3007	2275	2242	2242
query89	464	338	307	307
query90	1986	225	224	224
query91	166	160	134	134
query92	76	69	73	69
query93	3548	980	642	642
query94	703	436	310	310
query95	396	320	321	320
query96	491	597	282	282
query97	2985	2974	2905	2905
query98	248	218	209	209
query99	1458	1419	1317	1317
Total cold run time: 287997 ms
Total hot run time: 190165 ms

@doris-robot
Copy link

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

query1	0.05	0.05	0.05
query2	0.09	0.05	0.05
query3	0.27	0.09	0.08
query4	1.61	0.12	0.11
query5	0.26	0.27	0.25
query6	1.18	0.66	0.64
query7	0.03	0.02	0.02
query8	0.06	0.04	0.04
query9	0.64	0.52	0.53
query10	0.59	0.58	0.58
query11	0.16	0.11	0.12
query12	0.15	0.12	0.12
query13	0.64	0.61	0.62
query14	1.04	1.05	1.04
query15	0.87	0.85	0.86
query16	0.41	0.40	0.39
query17	1.01	1.03	1.04
query18	0.21	0.20	0.20
query19	1.95	1.89	1.84
query20	0.02	0.01	0.02
query21	15.43	0.92	0.57
query22	0.77	1.23	0.64
query23	14.94	1.39	0.64
query24	6.83	1.89	0.97
query25	0.43	0.08	0.06
query26	0.66	0.16	0.13
query27	0.08	0.06	0.06
query28	9.31	1.38	0.93
query29	12.57	3.89	3.30
query30	0.27	0.14	0.13
query31	2.82	0.58	0.39
query32	3.24	0.55	0.48
query33	3.08	3.14	3.18
query34	16.30	5.44	4.87
query35	4.91	4.90	4.89
query36	0.69	0.52	0.50
query37	0.10	0.08	0.07
query38	0.06	0.04	0.04
query39	0.04	0.03	0.04
query40	0.18	0.15	0.14
query41	0.09	0.04	0.03
query42	0.04	0.03	0.02
query43	0.05	0.03	0.04
Total cold run time: 104.13 s
Total hot run time: 30.6 s

@yujun777
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

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

query1	1071	423	408	408
query2	6584	1707	1701	1701
query3	6764	228	220	220
query4	26582	23370	23354	23354
query5	5099	643	493	493
query6	361	234	221	221
query7	4654	491	302	302
query8	318	311	248	248
query9	8687	2567	2577	2567
query10	532	342	303	303
query11	15498	15120	14812	14812
query12	178	130	114	114
query13	1675	556	428	428
query14	11195	9278	9408	9278
query15	221	194	176	176
query16	7720	696	543	543
query17	1951	834	675	675
query18	2975	528	326	326
query19	220	232	198	198
query20	149	138	140	138
query21	237	135	120	120
query22	4514	4521	4583	4521
query23	34956	33952	34083	33952
query24	8491	2500	2465	2465
query25	585	571	471	471
query26	1452	297	174	174
query27	3052	535	386	386
query28	4843	2254	2237	2237
query29	834	639	504	504
query30	313	246	213	213
query31	951	838	693	693
query32	83	67	70	67
query33	569	397	328	328
query34	854	843	545	545
query35	798	842	743	743
query36	962	1002	895	895
query37	125	112	86	86
query38	3491	3569	3504	3504
query39	1488	1401	1397	1397
query40	226	131	119	119
query41	61	58	59	58
query42	122	111	122	111
query43	483	481	461	461
query44	1343	822	819	819
query45	185	179	169	169
query46	861	996	633	633
query47	1767	1780	1713	1713
query48	395	418	355	355
query49	774	509	420	420
query50	661	693	411	411
query51	3868	3876	3934	3876
query52	110	105	101	101
query53	259	285	202	202
query54	622	623	527	527
query55	89	89	90	89
query56	322	315	316	315
query57	1184	1206	1096	1096
query58	290	273	280	273
query59	2612	2618	2541	2541
query60	351	343	335	335
query61	161	154	157	154
query62	788	752	671	671
query63	238	209	210	209
query64	4549	1298	978	978
query65	4045	3985	3950	3950
query66	1116	455	349	349
query67	15194	15264	14955	14955
query68	8100	951	608	608
query69	504	331	294	294
query70	1344	1291	1324	1291
query71	510	334	320	320
query72	5545	4890	4864	4864
query73	676	578	363	363
query74	9029	9048	8958	8958
query75	4012	3390	2838	2838
query76	3793	1165	767	767
query77	815	408	308	308
query78	9672	9727	8910	8910
query79	2223	835	603	603
query80	645	648	508	508
query81	527	260	232	232
query82	483	169	128	128
query83	269	273	252	252
query84	266	115	97	97
query85	895	460	432	432
query86	403	312	321	312
query87	3745	3759	3794	3759
query88	3848	2279	2269	2269
query89	398	338	303	303
query90	2017	238	231	231
query91	172	170	135	135
query92	91	80	70	70
query93	1816	1024	646	646
query94	692	457	344	344
query95	416	315	321	315
query96	498	597	289	289
query97	2966	3007	2851	2851
query98	252	220	222	220
query99	1663	1413	1297	1297
Total cold run time: 281993 ms
Total hot run time: 190510 ms

@doris-robot
Copy link

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

query1	0.06	0.05	0.05
query2	0.09	0.06	0.06
query3	0.25	0.08	0.08
query4	1.61	0.12	0.11
query5	0.29	0.27	0.25
query6	1.18	0.66	0.65
query7	0.03	0.03	0.03
query8	0.06	0.05	0.04
query9	0.66	0.52	0.51
query10	0.58	0.57	0.57
query11	0.17	0.11	0.11
query12	0.15	0.12	0.11
query13	0.63	0.63	0.61
query14	1.03	1.02	1.04
query15	0.88	0.87	0.88
query16	0.40	0.41	0.39
query17	1.05	1.04	1.08
query18	0.21	0.20	0.20
query19	1.95	1.89	1.84
query20	0.02	0.02	0.02
query21	15.42	0.92	0.58
query22	0.75	1.43	0.76
query23	14.74	1.40	0.67
query24	7.41	1.57	0.69
query25	0.41	0.22	0.10
query26	0.63	0.16	0.13
query27	0.07	0.06	0.06
query28	9.99	1.39	0.95
query29	12.57	3.95	3.32
query30	0.28	0.14	0.11
query31	2.83	0.60	0.40
query32	3.23	0.55	0.48
query33	3.13	3.13	3.05
query34	16.11	5.54	4.81
query35	4.92	4.93	4.89
query36	0.70	0.53	0.51
query37	0.10	0.08	0.08
query38	0.07	0.05	0.04
query39	0.03	0.03	0.03
query40	0.18	0.15	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: 105.04 s
Total hot run time: 30.45 s

@yujun777
Copy link
Contributor Author

run buildall

@yujun777 yujun777 force-pushed the replace-null-for-filter branch from aa203f9 to 0ec20a4 Compare October 16, 2025 11:59
@yujun777
Copy link
Contributor Author

run buildall

@yujun777 yujun777 changed the title [feat](nereids) replace null to false and null safe equal to equal for filter / join [feat](nereids) opt condition expression in filter / join Oct 16, 2025
@yujun777 yujun777 changed the title [feat](nereids) opt condition expression in filter / join [feat](nereids) opt condition expression in filter / join / if /case when Oct 16, 2025
@hello-stephen
Copy link
Contributor

FE Regression Coverage Report

Increment line coverage 36.79% (78/212) 🎉
Increment coverage report
Complete coverage report

@yujun777 yujun777 force-pushed the replace-null-for-filter branch from 0ec20a4 to 95ca6c5 Compare October 16, 2025 12:26
@yujun777
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

TPC-DS: Total hot run time: 188578 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 95ca6c5706b16ef33acd2409202ab9baa19e5715, data reload: false

query1	1093	435	400	400
query2	6420	1710	1696	1696
query3	6618	224	228	224
query4	26268	24012	23406	23406
query5	4421	622	493	493
query6	324	230	231	230
query7	4659	507	320	320
query8	298	262	250	250
query9	8751	2580	2568	2568
query10	461	340	272	272
query11	15724	15072	14921	14921
query12	213	123	113	113
query13	1721	543	431	431
query14	11638	9488	9433	9433
query15	210	198	183	183
query16	7721	674	521	521
query17	1220	797	602	602
query18	2045	417	327	327
query19	224	199	174	174
query20	127	132	132	132
query21	217	132	114	114
query22	4117	4094	4027	4027
query23	33816	32978	33112	32978
query24	8390	2444	2370	2370
query25	593	501	444	444
query26	1245	274	162	162
query27	2754	508	361	361
query28	4409	2237	2192	2192
query29	757	633	504	504
query30	304	233	200	200
query31	914	803	734	734
query32	91	79	80	79
query33	620	394	350	350
query34	843	861	530	530
query35	814	843	748	748
query36	926	999	920	920
query37	131	111	87	87
query38	3541	3567	3462	3462
query39	1524	1462	1420	1420
query40	222	127	123	123
query41	65	61	60	60
query42	125	118	118	118
query43	497	504	487	487
query44	1348	846	835	835
query45	189	189	177	177
query46	847	1019	627	627
query47	1731	1797	1689	1689
query48	393	432	312	312
query49	785	557	423	423
query50	661	686	417	417
query51	3885	4288	3831	3831
query52	119	124	98	98
query53	246	273	204	204
query54	613	605	544	544
query55	97	85	87	85
query56	348	324	298	298
query57	1189	1168	1135	1135
query58	292	283	277	277
query59	2614	2573	2535	2535
query60	359	343	325	325
query61	183	172	158	158
query62	809	747	674	674
query63	236	204	207	204
query64	4493	1266	971	971
query65	4094	3993	4004	3993
query66	1105	465	365	365
query67	15335	15260	14863	14863
query68	8169	954	610	610
query69	505	334	305	305
query70	1330	1338	1337	1337
query71	520	422	321	321
query72	5977	4873	4895	4873
query73	668	595	373	373
query74	9283	9125	8835	8835
query75	3983	3349	2783	2783
query76	3736	1166	778	778
query77	809	415	320	320
query78	9750	9814	8821	8821
query79	2591	811	589	589
query80	646	623	508	508
query81	510	269	233	233
query82	460	166	137	137
query83	309	259	253	253
query84	311	118	100	100
query85	893	469	418	418
query86	395	306	317	306
query87	3724	3696	3591	3591
query88	3650	2229	2173	2173
query89	395	331	301	301
query90	1941	222	216	216
query91	166	182	138	138
query92	83	69	70	69
query93	2089	972	643	643
query94	679	440	358	358
query95	408	356	307	307
query96	490	592	274	274
query97	2951	2980	2889	2889
query98	259	210	222	210
query99	1473	1387	1303	1303
Total cold run time: 278195 ms
Total hot run time: 188578 ms

@doris-robot
Copy link

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

query1	0.06	0.05	0.05
query2	0.10	0.05	0.05
query3	0.25	0.08	0.09
query4	1.61	0.12	0.12
query5	0.28	0.27	0.26
query6	1.20	0.68	0.63
query7	0.03	0.03	0.03
query8	0.06	0.05	0.05
query9	0.61	0.52	0.51
query10	0.58	0.61	0.57
query11	0.17	0.11	0.11
query12	0.16	0.12	0.12
query13	0.63	0.61	0.62
query14	1.03	1.04	1.01
query15	0.87	0.83	0.85
query16	0.39	0.40	0.41
query17	1.05	1.10	1.07
query18	0.21	0.20	0.20
query19	1.97	1.89	1.86
query20	0.02	0.02	0.01
query21	15.44	0.97	0.59
query22	0.76	1.18	0.76
query23	14.87	1.38	0.62
query24	7.38	1.91	1.17
query25	0.45	0.08	0.10
query26	0.65	0.16	0.14
query27	0.07	0.05	0.06
query28	9.64	1.32	0.95
query29	12.55	3.89	3.26
query30	0.27	0.14	0.12
query31	2.83	0.59	0.37
query32	3.26	0.56	0.48
query33	3.11	3.16	3.17
query34	16.23	5.48	4.81
query35	4.91	4.96	4.90
query36	0.69	0.52	0.51
query37	0.10	0.08	0.07
query38	0.06	0.05	0.04
query39	0.04	0.03	0.03
query40	0.18	0.16	0.13
query41	0.08	0.03	0.03
query42	0.04	0.02	0.02
query43	0.04	0.04	0.03
Total cold run time: 104.93 s
Total hot run time: 30.89 s

@yujun777
Copy link
Contributor Author

run buildall

@yujun777
Copy link
Contributor Author

run buildall

@yujun777
Copy link
Contributor Author

run buildall

@yujun777
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

TPC-DS: Total hot run time: 190321 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 79b4350af3f27ce212abea8b7f97a19bdfc43916, data reload: false

query1	1088	431	398	398
query2	6559	1736	1694	1694
query3	6751	223	224	223
query4	26126	23521	23522	23521
query5	5904	672	489	489
query6	341	243	221	221
query7	4650	507	302	302
query8	303	293	266	266
query9	9379	2539	2566	2539
query10	528	360	286	286
query11	15969	15128	14804	14804
query12	192	120	121	120
query13	1667	543	433	433
query14	12571	9413	9442	9413
query15	249	191	178	178
query16	7816	693	500	500
query17	1598	835	711	711
query18	2095	496	366	366
query19	289	221	191	191
query20	152	138	137	137
query21	265	156	124	124
query22	4734	4672	4565	4565
query23	34598	33876	34104	33876
query24	8157	2544	2566	2544
query25	569	521	474	474
query26	1297	290	165	165
query27	2974	522	367	367
query28	4471	2246	2229	2229
query29	800	623	532	532
query30	399	238	213	213
query31	917	926	779	779
query32	89	73	75	73
query33	584	412	359	359
query34	1131	887	527	527
query35	897	876	818	818
query36	990	1059	891	891
query37	126	109	82	82
query38	3578	3572	3469	3469
query39	1491	1431	1434	1431
query40	216	132	116	116
query41	60	59	94	59
query42	120	117	127	117
query43	490	513	456	456
query44	1338	846	825	825
query45	188	180	178	178
query46	835	1004	658	658
query47	1725	1814	1702	1702
query48	392	471	313	313
query49	769	505	424	424
query50	663	690	409	409
query51	3918	3896	3818	3818
query52	113	111	105	105
query53	242	286	206	206
query54	610	591	542	542
query55	91	86	86	86
query56	322	308	312	308
query57	1173	1203	1137	1137
query58	327	289	277	277
query59	2655	2621	2486	2486
query60	357	344	340	340
query61	165	157	162	157
query62	797	727	671	671
query63	237	209	194	194
query64	4425	1159	831	831
query65	4032	4003	3998	3998
query66	1024	435	337	337
query67	15448	15113	14863	14863
query68	6620	948	602	602
query69	504	331	312	312
query70	1355	1236	1273	1236
query71	456	351	317	317
query72	6058	5060	4851	4851
query73	625	592	362	362
query74	8882	9111	8687	8687
query75	3341	3342	2803	2803
query76	3108	1172	749	749
query77	500	415	320	320
query78	9578	9804	9000	9000
query79	2891	811	613	613
query80	1538	600	518	518
query81	569	267	228	228
query82	430	172	152	152
query83	398	269	253	253
query84	264	114	92	92
query85	890	489	437	437
query86	415	309	297	297
query87	3715	3774	3627	3627
query88	4114	2267	2252	2252
query89	402	326	300	300
query90	2087	225	231	225
query91	168	172	135	135
query92	91	67	70	67
query93	2638	995	634	634
query94	782	450	343	343
query95	396	335	310	310
query96	494	575	291	291
query97	2921	2965	2871	2871
query98	244	229	226	226
query99	1341	1463	1288	1288
Total cold run time: 282841 ms
Total hot run time: 190321 ms

@doris-robot
Copy link

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

query1	0.05	0.05	0.05
query2	0.10	0.06	0.06
query3	0.26	0.09	0.09
query4	1.61	0.12	0.12
query5	0.28	0.28	0.25
query6	1.19	0.67	0.64
query7	0.03	0.03	0.03
query8	0.06	0.05	0.05
query9	0.63	0.54	0.52
query10	0.59	0.62	0.57
query11	0.16	0.11	0.12
query12	0.15	0.13	0.12
query13	0.63	0.62	0.61
query14	1.04	1.02	1.01
query15	0.89	0.85	0.89
query16	0.40	0.39	0.38
query17	1.04	1.04	1.05
query18	0.21	0.20	0.20
query19	1.99	1.82	1.81
query20	0.01	0.02	0.01
query21	15.47	0.92	0.60
query22	0.78	1.24	0.66
query23	14.89	1.43	0.60
query24	6.68	1.50	1.49
query25	0.51	0.25	0.09
query26	0.53	0.15	0.13
query27	0.07	0.06	0.06
query28	10.23	1.39	0.95
query29	12.57	4.06	3.31
query30	0.28	0.14	0.11
query31	2.82	0.59	0.38
query32	3.25	0.56	0.47
query33	3.07	3.07	3.21
query34	16.03	5.45	4.81
query35	4.92	4.90	4.91
query36	0.69	0.52	0.51
query37	0.10	0.08	0.07
query38	0.06	0.05	0.04
query39	0.03	0.03	0.03
query40	0.18	0.14	0.15
query41	0.09	0.03	0.03
query42	0.03	0.03	0.03
query43	0.05	0.04	0.03
Total cold run time: 104.65 s
Total hot run time: 31.03 s

@hello-stephen
Copy link
Contributor

FE UT Coverage Report

Increment line coverage 91.55% (195/213) 🎉
Increment coverage report
Complete coverage report

@yujun777
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

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

query1	0.06	0.05	0.05
query2	0.09	0.06	0.07
query3	0.26	0.08	0.08
query4	1.61	0.12	0.12
query5	0.30	0.27	0.26
query6	1.17	0.67	0.64
query7	0.03	0.03	0.03
query8	0.06	0.04	0.05
query9	0.63	0.54	0.52
query10	0.58	0.59	0.60
query11	0.17	0.12	0.11
query12	0.15	0.12	0.12
query13	0.62	0.63	0.61
query14	1.03	1.02	1.03
query15	0.86	0.86	0.83
query16	0.41	0.41	0.40
query17	1.03	1.04	1.09
query18	0.21	0.20	0.20
query19	1.92	1.85	1.84
query20	0.01	0.02	0.01
query21	15.42	0.94	0.57
query22	0.75	1.19	0.74
query23	14.85	1.40	0.61
query24	6.71	1.88	0.63
query25	0.50	0.09	0.13
query26	0.61	0.16	0.13
query27	0.06	0.06	0.06
query28	9.76	1.38	0.94
query29	12.64	4.05	3.31
query30	0.28	0.14	0.11
query31	2.83	0.60	0.38
query32	3.26	0.56	0.49
query33	3.14	3.05	3.09
query34	15.93	5.55	4.88
query35	4.96	4.94	4.89
query36	0.69	0.51	0.51
query37	0.11	0.08	0.07
query38	0.07	0.06	0.05
query39	0.04	0.04	0.03
query40	0.19	0.16	0.15
query41	0.09	0.04	0.04
query42	0.04	0.03	0.02
query43	0.05	0.04	0.04
Total cold run time: 104.18 s
Total hot run time: 30.36 s

@github-actions github-actions bot added the approved Indicates a PR has been approved by one committer. label Oct 20, 2025
@github-actions
Copy link
Contributor

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

@github-actions
Copy link
Contributor

PR approved by anyone and no changes requested.

@starocean999 starocean999 merged commit cb1e3bd into apache:master Oct 22, 2025
28 of 30 checks passed
dwdwqfwe pushed a commit to dwdwqfwe/doris that referenced this pull request Oct 24, 2025
…when (apache#57025)

For a condition expression, replace null to false, null safe equal to
equal. The condition include filter condition, join condition, if
condition, case when condition.

And for the condition expression, only replace those sub expression
which its ancestors to the condition root are all AND / OR / CASE WHEN /
IF. So, for a expression `null and not(null)` in a filter, the first
null can be replaced, but the second null cann't be replaced because its
parent is NOT, not in AND / OR / CASE WHEN / IF.

For a expression `x <=> y` in condition, if one of them is not-nullable,
then it can rewrite to `x = y`. Note that if a expression is not a
condition, `x <=> y` can rewrite to `x = y` require that both x and y
are not-nullable.

Here is some example:

1. replace null with false

```
null  and (null  or null) and not(null)   =>  false and (false or false) and not(null)

case when null and not (null) then ...   =>   case when false and not (null) then ...

if(null and not(null), ...) =>  if (false and not(null), ...)
```

2. replace null safe equal to equal if at least one of its child is
non-nullable

```
x  <=>  3 and not(x <=> 3)   => x = 3 and not(x <=> 3)

case when x <=> 3 then ...    =>  case when x = 3 then ...

if(x <=> 3, ...)  => if(x=3, ...)
```

3. rewrite if expression in condition if its else branch is true / false
literal.

suppose the if is in a filter, then will have
```
 if(c, p, true)  => not(c <=> true) or p

if(c, p, false)  => c and p
```

Currently, the expression rewrite framework cann't known the
expression's plan, In order to indicate that the expression is on the
filter / join, we add the expression's plan and source to the
ExpressionRewriteContext to indicate the expression's location.
yujun777 added a commit to yujun777/doris that referenced this pull request Nov 20, 2025
…when (apache#57025)

For a condition expression, replace null to false, null safe equal to
equal. The condition include filter condition, join condition, if
condition, case when condition.

And for the condition expression, only replace those sub expression
which its ancestors to the condition root are all AND / OR / CASE WHEN /
IF. So, for a expression  in a filter, the first
null can be replaced, but the second null cann't be replaced because its
parent is NOT, not in AND / OR / CASE WHEN / IF.

For a expression  in condition, if one of them is not-nullable,
then it can rewrite to . Note that if a expression is not a
condition,  can rewrite to  require that both x and y
are not-nullable.
yujun777 added a commit to yujun777/doris that referenced this pull request Dec 1, 2025
…when (apache#57025)

For a condition expression, replace null to false, null safe equal to
equal. The condition include filter condition, join condition, if
condition, case when condition.

And for the condition expression, only replace those sub expression
which its ancestors to the condition root are all AND / OR / CASE WHEN /
IF. So, for a expression  in a filter, the first
null can be replaced, but the second null cann't be replaced because its
parent is NOT, not in AND / OR / CASE WHEN / IF.

For a expression  in condition, if one of them is not-nullable,
then it can rewrite to . Note that if a expression is not a
condition,  can rewrite to  require that both x and y
are not-nullable.
yujun777 added a commit to yujun777/doris that referenced this pull request Dec 2, 2025
…when (apache#57025)

For a condition expression, replace null to false, null safe equal to
equal. The condition include filter condition, join condition, if
condition, case when condition.

And for the condition expression, only replace those sub expression
which its ancestors to the condition root are all AND / OR / CASE WHEN /
IF. So, for a expression  in a filter, the first
null can be replaced, but the second null cann't be replaced because its
parent is NOT, not in AND / OR / CASE WHEN / IF.

For a expression  in condition, if one of them is not-nullable,
then it can rewrite to . Note that if a expression is not a
condition,  can rewrite to  require that both x and y
are not-nullable.
yujun777 added a commit to yujun777/doris that referenced this pull request Dec 8, 2025
…when (apache#57025)

For a condition expression, replace null to false, null safe equal to
equal. The condition include filter condition, join condition, if
condition, case when condition.

And for the condition expression, only replace those sub expression
which its ancestors to the condition root are all AND / OR / CASE WHEN /
IF. So, for a expression  in a filter, the first
null can be replaced, but the second null cann't be replaced because its
parent is NOT, not in AND / OR / CASE WHEN / IF.

For a expression  in condition, if one of them is not-nullable,
then it can rewrite to . Note that if a expression is not a
condition,  can rewrite to  require that both x and y
are not-nullable.
yujun777 added a commit to yujun777/doris that referenced this pull request Jan 9, 2026
…when (apache#57025)

For a condition expression, replace null to false, null safe equal to
equal. The condition include filter condition, join condition, if
condition, case when condition.

And for the condition expression, only replace those sub expression
which its ancestors to the condition root are all AND / OR / CASE WHEN /
IF. So, for a expression  in a filter, the first
null can be replaced, but the second null cann't be replaced because its
parent is NOT, not in AND / OR / CASE WHEN / IF.

For a expression  in condition, if one of them is not-nullable,
then it can rewrite to . Note that if a expression is not a
condition,  can rewrite to  require that both x and y
are not-nullable.
yujun777 added a commit to yujun777/doris that referenced this pull request Jan 12, 2026
…when (apache#57025)

For a condition expression, replace null to false, null safe equal to
equal. The condition include filter condition, join condition, if
condition, case when condition.

And for the condition expression, only replace those sub expression
which its ancestors to the condition root are all AND / OR / CASE WHEN /
IF. So, for a expression  in a filter, the first
null can be replaced, but the second null cann't be replaced because its
parent is NOT, not in AND / OR / CASE WHEN / IF.

For a expression  in condition, if one of them is not-nullable,
then it can rewrite to . Note that if a expression is not a
condition,  can rewrite to  require that both x and y
are not-nullable.
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. reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants