Skip to content

Conversation

@englefly
Copy link
Contributor

@englefly englefly commented Feb 9, 2026

What problem does this PR solve?

Introduce a new session variable required_group_ids to force the Nereids optimizer to pick the cheapest physical plan that includes all specified group IDs.

Key changes:

Added chooseBestPlanWithRequiredGroups to traverse the memo and find a plan covering the required IDs.
Added helper logic to compute reachable group IDs from the plan subtree.
Exposed required_group_ids as a session variable for easier debugging and testing.
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

@Thearas
Copy link
Contributor

Thearas commented Feb 9, 2026

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?

@englefly
Copy link
Contributor Author

englefly commented Feb 9, 2026

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	17603	4508	4304	4304
q2	2025	362	238	238
q3	10183	1295	741	741
q4	10191	772	308	308
q5	7495	2227	1985	1985
q6	193	177	146	146
q7	894	751	613	613
q8	9276	1364	1090	1090
q9	4793	4683	4620	4620
q10	6782	1955	1561	1561
q11	521	325	278	278
q12	345	383	230	230
q13	17811	4041	3290	3290
q14	228	245	211	211
q15	903	813	807	807
q16	681	678	632	632
q17	711	807	543	543
q18	6954	5749	5599	5599
q19	1269	992	639	639
q20	525	507	381	381
q21	2621	1804	1820	1804
q22	351	320	277	277
Total cold run time: 102355 ms
Total hot run time: 30297 ms

----- Round 2, with runtime_filter_mode=off -----
q1	5102	4323	4369	4323
q2	267	341	264	264
q3	2099	2674	2273	2273
q4	1340	1711	1287	1287
q5	4321	4099	4220	4099
q6	228	176	138	138
q7	1846	1795	1628	1628
q8	2693	2522	2472	2472
q9	7688	7707	7598	7598
q10	2906	3098	2675	2675
q11	548	489	462	462
q12	739	737	636	636
q13	3893	4482	3650	3650
q14	306	329	295	295
q15	842	799	802	799
q16	689	713	685	685
q17	1185	1360	1308	1308
q18	8280	8048	7776	7776
q19	880	864	861	861
q20	2115	2352	2053	2053
q21	4634	4306	4093	4093
q22	584	526	503	503
Total cold run time: 53185 ms
Total hot run time: 49878 ms

@doris-robot
Copy link

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

query1	0.05	0.05	0.05
query2	0.10	0.05	0.04
query3	0.25	0.09	0.08
query4	1.61	0.11	0.10
query5	0.26	0.24	0.24
query6	1.16	0.68	0.67
query7	0.03	0.02	0.03
query8	0.05	0.04	0.04
query9	0.57	0.49	0.51
query10	0.55	0.54	0.53
query11	0.15	0.10	0.10
query12	0.14	0.11	0.11
query13	0.64	0.61	0.62
query14	1.06	1.07	1.07
query15	0.88	0.87	0.88
query16	0.40	0.39	0.39
query17	1.14	1.13	1.15
query18	0.24	0.22	0.22
query19	2.06	2.00	1.98
query20	0.02	0.02	0.01
query21	15.46	0.27	0.15
query22	5.13	0.06	0.05
query23	15.90	0.29	0.11
query24	1.82	0.78	0.34
query25	0.08	0.09	0.07
query26	0.15	0.13	0.14
query27	0.09	0.06	0.05
query28	4.44	1.14	0.98
query29	12.61	3.94	3.16
query30	0.28	0.13	0.12
query31	2.83	0.66	0.42
query32	3.24	0.61	0.50
query33	3.29	3.42	3.26
query34	16.11	5.45	4.74
query35	4.79	4.75	4.83
query36	0.65	0.50	0.49
query37	0.12	0.07	0.07
query38	0.08	0.04	0.04
query39	0.05	0.03	0.03
query40	0.20	0.17	0.15
query41	0.08	0.04	0.03
query42	0.05	0.03	0.03
query43	0.04	0.04	0.03
Total cold run time: 98.85 s
Total hot run time: 28.45 s

@hello-stephen
Copy link
Contributor

FE UT Coverage Report

Increment line coverage 6.31% (7/111) 🎉
Increment coverage report
Complete coverage report

@hello-stephen
Copy link
Contributor

FE Regression Coverage Report

Increment line coverage 3.60% (4/111) 🎉
Increment coverage report
Complete coverage report

@github-actions github-actions bot added the approved Indicates a PR has been approved by one committer. label Feb 9, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Feb 9, 2026

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

@github-actions
Copy link
Contributor

github-actions bot commented Feb 9, 2026

PR approved by anyone and no changes requested.

@englefly englefly merged commit a48802b into apache:master Feb 10, 2026
30 of 31 checks passed
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