Skip to content

Conversation

@Mryange
Copy link
Contributor

@Mryange Mryange commented Feb 3, 2026

What problem does this PR solve?

For multi-branch expressions like CASE WHEN and COALESCE: if there are zero rows to evaluate (execution count is 0), exit immediately instead of continuing execution.

Also, hoist some Selectors out of the loop to avoid repeated work and enable memory reuse.

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

@Mryange
Copy link
Contributor Author

Mryange commented Feb 3, 2026

run buildall

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

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17663	5395	5072	5072
q2	2034	346	194	194
q3	10162	1339	744	744
q4	10219	911	318	318
q5	7837	2228	1896	1896
q6	204	181	148	148
q7	874	739	613	613
q8	9288	1369	1190	1190
q9	5435	4821	4850	4821
q10	6832	1960	1568	1568
q11	529	299	280	280
q12	378	382	222	222
q13	17800	4107	3261	3261
q14	242	246	219	219
q15	903	814	826	814
q16	680	690	631	631
q17	649	820	500	500
q18	6779	6592	6507	6507
q19	1481	1010	609	609
q20	406	345	231	231
q21	2649	2068	1927	1927
q22	350	310	272	272
Total cold run time: 103394 ms
Total hot run time: 32037 ms

----- Round 2, with runtime_filter_mode=off -----
q1	5422	5303	5312	5303
q2	261	332	252	252
q3	2177	2742	2287	2287
q4	1376	1743	1317	1317
q5	4266	4128	4167	4128
q6	223	182	146	146
q7	2365	2127	1933	1933
q8	2557	2374	2355	2355
q9	7588	7468	7531	7468
q10	2822	3085	2733	2733
q11	558	470	441	441
q12	667	750	646	646
q13	4346	4667	3503	3503
q14	295	325	342	325
q15	883	849	830	830
q16	679	719	706	706
q17	1168	1268	1299	1268
q18	8403	8011	7905	7905
q19	875	828	869	828
q20	2050	2190	2037	2037
q21	4633	4281	4151	4151
q22	597	546	497	497
Total cold run time: 54211 ms
Total hot run time: 51059 ms

@doris-robot
Copy link

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

query1	0.06	0.05	0.05
query2	0.09	0.05	0.04
query3	0.26	0.08	0.08
query4	1.61	0.11	0.10
query5	0.27	0.26	0.25
query6	1.19	0.68	0.68
query7	0.03	0.02	0.03
query8	0.06	0.04	0.04
query9	0.56	0.50	0.51
query10	0.56	0.56	0.56
query11	0.15	0.10	0.10
query12	0.15	0.11	0.11
query13	0.65	0.62	0.61
query14	1.07	1.05	1.06
query15	0.87	0.85	0.86
query16	0.39	0.38	0.39
query17	1.12	1.17	1.09
query18	0.23	0.21	0.21
query19	2.11	1.95	2.02
query20	0.02	0.02	0.01
query21	15.40	0.28	0.15
query22	5.11	0.05	0.05
query23	15.90	0.28	0.10
query24	1.03	0.62	1.70
query25	0.11	0.09	0.14
query26	0.14	0.13	0.13
query27	0.11	0.24	0.04
query28	5.05	1.13	0.96
query29	12.61	4.01	3.21
query30	0.28	0.13	0.11
query31	2.81	0.64	0.41
query32	3.23	0.60	0.50
query33	3.24	3.20	3.21
query34	16.58	5.39	4.73
query35	4.79	4.81	4.75
query36	0.67	0.50	0.49
query37	0.11	0.07	0.06
query38	0.08	0.04	0.04
query39	0.05	0.03	0.03
query40	0.19	0.17	0.15
query41	0.09	0.03	0.04
query42	0.04	0.03	0.03
query43	0.05	0.04	0.04
Total cold run time: 99.12 s
Total hot run time: 28.6 s

@hello-stephen
Copy link
Contributor

BE UT Coverage Report

Increment line coverage 0.00% (0/40) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 52.54% (19356/36838)
Line Coverage 36.01% (179726/499098)
Region Coverage 32.38% (139354/430367)
Branch Coverage 33.36% (60313/180791)

@hello-stephen
Copy link
Contributor

BE Regression && UT Coverage Report

Increment line coverage 100.00% (40/40) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 71.63% (25861/36102)
Line Coverage 54.23% (270022/497900)
Region Coverage 51.59% (224291/434781)
Branch Coverage 53.10% (96382/181519)

@Mryange
Copy link
Contributor Author

Mryange commented Feb 3, 2026

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17693	5328	5087	5087
q2	1993	303	196	196
q3	10256	1326	753	753
q4	10210	842	315	315
q5	7525	2184	1859	1859
q6	202	189	153	153
q7	905	761	615	615
q8	9249	1370	1143	1143
q9	5264	4827	4872	4827
q10	6796	1932	1575	1575
q11	545	285	290	285
q12	337	382	222	222
q13	17769	4038	3190	3190
q14	235	238	223	223
q15	930	809	816	809
q16	675	668	612	612
q17	639	784	526	526
q18	6686	6453	6465	6453
q19	1310	999	640	640
q20	408	349	235	235
q21	2706	2105	1989	1989
q22	363	317	274	274
Total cold run time: 102696 ms
Total hot run time: 31981 ms

----- Round 2, with runtime_filter_mode=off -----
q1	5374	5256	5244	5244
q2	272	346	270	270
q3	2255	2750	2329	2329
q4	1371	1769	1325	1325
q5	4278	4171	4266	4171
q6	214	183	139	139
q7	2287	2104	1887	1887
q8	2579	2465	2436	2436
q9	7520	7536	7456	7456
q10	2940	3108	2607	2607
q11	574	488	457	457
q12	711	745	612	612
q13	3871	4793	3569	3569
q14	288	303	302	302
q15	871	806	833	806
q16	701	774	699	699
q17	1213	1322	1363	1322
q18	8124	7509	7810	7509
q19	924	863	919	863
q20	2106	2198	2047	2047
q21	4540	4257	4149	4149
q22	588	537	495	495
Total cold run time: 53601 ms
Total hot run time: 50694 ms

@doris-robot
Copy link

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

query1	0.05	0.05	0.05
query2	0.09	0.04	0.05
query3	0.27	0.09	0.08
query4	1.61	0.11	0.11
query5	0.26	0.24	0.26
query6	1.16	0.68	0.66
query7	0.03	0.03	0.03
query8	0.05	0.04	0.04
query9	0.56	0.50	0.49
query10	0.56	0.54	0.54
query11	0.15	0.10	0.10
query12	0.15	0.10	0.10
query13	0.64	0.62	0.61
query14	1.06	1.08	1.06
query15	0.87	0.86	0.87
query16	0.40	0.38	0.38
query17	1.08	1.10	1.10
query18	0.23	0.22	0.21
query19	2.10	2.04	2.05
query20	0.02	0.02	0.01
query21	15.40	0.28	0.15
query22	4.90	0.06	0.04
query23	15.86	0.30	0.10
query24	1.10	0.66	0.62
query25	0.06	0.08	0.05
query26	0.15	0.14	0.16
query27	0.08	0.06	0.06
query28	4.62	1.14	0.97
query29	12.64	3.93	3.12
query30	0.28	0.14	0.11
query31	2.82	0.65	0.41
query32	3.23	0.59	0.50
query33	3.23	3.18	3.17
query34	16.26	5.42	4.68
query35	4.84	4.83	4.74
query36	0.65	0.50	0.49
query37	0.12	0.07	0.07
query38	0.08	0.04	0.05
query39	0.05	0.04	0.04
query40	0.18	0.16	0.15
query41	0.08	0.04	0.03
query42	0.05	0.03	0.03
query43	0.06	0.04	0.03
Total cold run time: 98.08 s
Total hot run time: 28.49 s

@hello-stephen
Copy link
Contributor

BE UT Coverage Report

Increment line coverage 0.00% (0/30) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 52.58% (19372/36840)
Line Coverage 36.05% (179927/499149)
Region Coverage 32.43% (139590/430401)
Branch Coverage 33.40% (60401/180817)

@Mryange Mryange force-pushed the opt-ShortCircuitExpr branch from 56a9ba4 to 19f3e7c Compare February 3, 2026 13:30
@Mryange
Copy link
Contributor Author

Mryange commented Feb 3, 2026

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17622	5287	5062	5062
q2	2013	314	192	192
q3	10215	1301	755	755
q4	10201	792	322	322
q5	7508	2215	1879	1879
q6	199	184	152	152
q7	899	748	612	612
q8	9287	1378	1046	1046
q9	5187	4758	4783	4758
q10	6829	1941	1558	1558
q11	507	298	274	274
q12	350	386	226	226
q13	17796	4068	3228	3228
q14	236	235	223	223
q15	914	828	814	814
q16	681	676	638	638
q17	635	844	455	455
q18	6799	6645	6659	6645
q19	1237	984	627	627
q20	387	348	229	229
q21	2649	2103	1878	1878
q22	355	313	266	266
Total cold run time: 102506 ms
Total hot run time: 31839 ms

----- Round 2, with runtime_filter_mode=off -----
q1	5290	5320	5314	5314
q2	259	345	263	263
q3	2161	2705	2334	2334
q4	1469	1754	1297	1297
q5	4389	4251	4283	4251
q6	225	187	148	148
q7	2345	2214	1863	1863
q8	2589	2520	2435	2435
q9	7459	7412	7532	7412
q10	2923	3159	2555	2555
q11	554	460	449	449
q12	713	751	629	629
q13	3817	4409	3496	3496
q14	316	326	320	320
q15	886	814	796	796
q16	695	727	699	699
q17	1238	1386	1421	1386
q18	8298	8119	7671	7671
q19	934	1075	898	898
q20	2074	2177	2006	2006
q21	4495	4247	4132	4132
q22	577	530	521	521
Total cold run time: 53706 ms
Total hot run time: 50875 ms

@doris-robot
Copy link

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

query1	0.05	0.05	0.05
query2	0.09	0.04	0.04
query3	0.26	0.09	0.09
query4	1.61	0.12	0.11
query5	0.27	0.25	0.26
query6	1.16	0.69	0.68
query7	0.03	0.03	0.02
query8	0.06	0.04	0.04
query9	0.56	0.50	0.50
query10	0.55	0.55	0.54
query11	0.14	0.10	0.10
query12	0.14	0.10	0.10
query13	0.64	0.62	0.63
query14	1.07	1.04	1.05
query15	0.88	0.88	0.88
query16	0.41	0.39	0.39
query17	1.17	1.08	1.11
query18	0.23	0.22	0.21
query19	2.11	2.02	2.02
query20	0.02	0.01	0.02
query21	15.40	0.27	0.15
query22	5.06	0.06	0.05
query23	15.76	0.30	0.10
query24	1.19	0.46	0.19
query25	0.09	0.06	0.12
query26	0.14	0.13	0.13
query27	0.09	0.07	0.06
query28	3.66	1.14	0.96
query29	12.62	3.88	3.14
query30	0.28	0.13	0.12
query31	2.80	0.69	0.40
query32	3.24	0.61	0.51
query33	3.24	3.24	3.21
query34	16.30	5.55	4.73
query35	4.80	4.79	4.80
query36	0.67	0.51	0.50
query37	0.11	0.07	0.07
query38	0.08	0.04	0.04
query39	0.05	0.03	0.04
query40	0.20	0.17	0.16
query41	0.08	0.03	0.03
query42	0.05	0.03	0.03
query43	0.05	0.04	0.03
Total cold run time: 97.41 s
Total hot run time: 28.26 s

@hello-stephen
Copy link
Contributor

BE UT Coverage Report

Increment line coverage 0.00% (0/30) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 52.58% (19372/36840)
Line Coverage 36.04% (179913/499149)
Region Coverage 32.44% (139607/430401)
Branch Coverage 33.41% (60417/180817)

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