Skip to content

[chore](expr) remove useless if in is_acting_on_a_slot#63095

Merged
yiguolei merged 1 commit intoapache:masterfrom
eldenmoon:chore-1
May 10, 2026
Merged

[chore](expr) remove useless if in is_acting_on_a_slot#63095
yiguolei merged 1 commit intoapache:masterfrom
eldenmoon:chore-1

Conversation

@eldenmoon
Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings May 9, 2026 03:14
@hello-stephen
Copy link
Copy Markdown
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?

@eldenmoon
Copy link
Copy Markdown
Member Author

run buildall

@eldenmoon
Copy link
Copy Markdown
Member Author

/review

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR simplifies BE expression analysis by removing the special-case SEARCH_EXPR handling from VExpr::is_acting_on_a_slot(), relying solely on recursive detection of SLOT_REF / VIRTUAL_SLOT_REF descendants.

Changes:

  • Remove the early-return branch that treated TExprNodeType::SEARCH_EXPR as automatically “acting on a slot”.
  • Keep slot-detection logic purely recursive over the expression tree.
Comments suppressed due to low confidence (1)

be/src/exprs/vexpr.cpp:350

  • Removing the SEARCH_EXPR fast-path changes is_acting_on_a_slot() to depend solely on finding SLOT_REF/VIRTUAL_SLOT_REF in the subtree. If a SEARCH_EXPR is ever constructed without slot-ref children (e.g., due to FE/BE version skew or an upstream bug), it will no longer be treated as “acting on a slot” and won’t be moved into _common_expr_ctxs_push_down, which can later trigger VSearchExpr's runtime error path (it cannot execute without inverted index / fast_execute). Consider keeping the explicit SEARCH_EXPR handling here, or add a hard invariant (e.g., DCHECK/validation) that SEARCH_EXPR always has slot-ref descendants before relying on the recursive logic.
bool VExpr::is_acting_on_a_slot(const VExpr& expr) {
    const auto& children = expr.children();

    auto is_a_slot = std::any_of(children.begin(), children.end(),
                                 [](const auto& child) { return is_acting_on_a_slot(*child); });

    return is_a_slot ? true
                     : (expr.node_type() == TExprNodeType::SLOT_REF ||
                        expr.node_type() == TExprNodeType::VIRTUAL_SLOT_REF);

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Review result: no blocking issues found.

Critical checkpoint conclusions:

  • Goal: removes a redundant special case in VExpr::is_acting_on_a_slot; current SEARCH_EXPR generation already attaches slot/slot-derived children, so the recursive logic preserves behavior.
  • Scope: the change is minimal and focused to one helper.
  • Concurrency/lifecycle/config/compatibility/persistence: not applicable; no shared state, lifecycle, config, wire/storage format, or persistence change.
  • Parallel code paths: only known caller is scan predicate normalization; reviewed search expression construction and BE VSearchExpr handling for this path.
  • Test coverage: no new test was added, but this is a narrow cleanup and existing search predicate translation tests cover slot children in generated SEARCH_EXPR nodes. I did not run tests in this review runner.
  • Observability/performance: no additional observability needed; performance impact is negligible.
  • User focus: no additional user-provided review focus.

@hello-stephen
Copy link
Copy Markdown
Contributor

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

------ Round 1 ----------------------------------
orders	Doris	NULL	NULL	0	0	0	NULL	0	NULL	NULL	2023-12-26 18:27:23	2023-12-26 18:42:55	NULL	utf-8	NULL	NULL	
============================================
q1	17748	3883	3882	3882
q2	q3	10726	867	614	614
q4	4664	457	351	351
q5	7464	1322	1153	1153
q6	193	167	140	140
q7	908	991	753	753
q8	9333	1383	1313	1313
q9	5564	5380	5329	5329
q10	6249	2066	1797	1797
q11	466	271	260	260
q12	628	413	297	297
q13	18155	3227	2676	2676
q14	295	285	264	264
q15	q16	867	873	786	786
q17	991	1114	694	694
q18	6497	5779	5668	5668
q19	1184	1274	1060	1060
q20	524	412	266	266
q21	4554	2430	1983	1983
q22	475	392	331	331
Total cold run time: 97485 ms
Total hot run time: 29617 ms

----- Round 2, with runtime_filter_mode=off -----
orders	Doris	NULL	NULL	150000000	42	6422171781	NULL	22778155	NULL	NULL	2023-12-26 18:27:23	2023-12-26 18:42:55	NULL	utf-8	NULL	NULL	
============================================
q1	4772	4770	4799	4770
q2	q3	4671	4809	4207	4207
q4	2138	2196	1439	1439
q5	5045	4983	5276	4983
q6	200	177	141	141
q7	2049	1817	1647	1647
q8	3364	3115	3105	3105
q9	8569	8449	8534	8449
q10	4489	4482	4290	4290
q11	591	413	382	382
q12	693	769	518	518
q13	3360	3602	2945	2945
q14	297	307	277	277
q15	q16	758	793	730	730
q17	1487	1356	1298	1298
q18	7930	7164	7094	7094
q19	1147	1167	1184	1167
q20	2249	2225	1931	1931
q21	6141	5438	4979	4979
q22	553	523	426	426
Total cold run time: 60503 ms
Total hot run time: 54778 ms

@hello-stephen
Copy link
Copy Markdown
Contributor

TPC-DS: Total hot run time: 171399 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 8e490341f6bddda42a026e9f423e553ffef63a89, data reload: false

query5	4333	652	529	529
query6	322	217	204	204
query7	4225	581	324	324
query8	323	227	214	214
query9	8855	3989	3972	3972
query10	453	323	295	295
query11	5811	2400	2161	2161
query12	186	131	127	127
query13	1274	608	436	436
query14	6002	5354	5058	5058
query14_1	4317	4283	4315	4283
query15	208	201	180	180
query16	978	469	404	404
query17	924	734	602	602
query18	2444	479	354	354
query19	216	195	162	162
query20	138	132	134	132
query21	216	139	120	120
query22	13601	13718	14523	13718
query23	17265	16508	16263	16263
query23_1	16310	16310	16301	16301
query24	7430	1779	1356	1356
query24_1	1362	1322	1354	1322
query25	593	519	453	453
query26	1311	309	177	177
query27	2745	570	351	351
query28	4446	2011	1950	1950
query29	1031	662	506	506
query30	293	238	192	192
query31	1096	1052	935	935
query32	85	70	70	70
query33	544	329	298	298
query34	1188	1144	634	634
query35	761	777	656	656
query36	1337	1337	1198	1198
query37	148	101	84	84
query38	3212	3132	3048	3048
query39	925	918	903	903
query39_1	900	894	882	882
query40	230	157	136	136
query41	62	59	57	57
query42	109	107	105	105
query43	317	324	288	288
query44	
query45	213	210	190	190
query46	1117	1201	723	723
query47	2354	2301	2172	2172
query48	399	424	312	312
query49	638	516	431	431
query50	701	285	217	217
query51	4224	4257	4220	4220
query52	107	105	94	94
query53	258	274	204	204
query54	338	279	254	254
query55	95	88	84	84
query56	319	308	305	305
query57	1427	1400	1357	1357
query58	300	281	267	267
query59	1578	1616	1447	1447
query60	356	333	333	333
query61	157	158	154	154
query62	666	626	558	558
query63	244	204	215	204
query64	2448	793	660	660
query65	
query66	1725	500	385	385
query67	30058	29802	29800	29800
query68	
query69	487	336	297	297
query70	1040	1041	1026	1026
query71	324	271	268	268
query72	3011	2731	2441	2441
query73	841	756	436	436
query74	5074	4868	4707	4707
query75	2786	2693	2334	2334
query76	2300	1153	761	761
query77	417	422	351	351
query78	12951	12957	12482	12482
query79	1480	1003	761	761
query80	738	618	509	509
query81	458	286	242	242
query82	1357	164	125	125
query83	360	299	265	265
query84	312	153	121	121
query85	953	631	447	447
query86	416	311	317	311
query87	3398	3341	3195	3195
query88	3580	2666	2698	2666
query89	426	378	335	335
query90	1926	184	175	175
query91	177	165	137	137
query92	82	76	74	74
query93	973	968	549	549
query94	541	335	298	298
query95	676	469	338	338
query96	1005	773	331	331
query97	2725	2703	2561	2561
query98	245	231	232	231
query99	1152	1113	986	986
Total cold run time: 253357 ms
Total hot run time: 171399 ms

@hello-stephen
Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 100% (0/0) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 73.81% (27788/37649)
Line Coverage 57.64% (300735/521721)
Region Coverage 54.73% (249993/456783)
Branch Coverage 56.39% (108383/192203)

@eldenmoon
Copy link
Copy Markdown
Member Author

@codex

@yiguolei yiguolei merged commit 8e79778 into apache:master May 10, 2026
37 of 38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants