Skip to content

[fix](fe) Fix duplicate join nodes in PushDownAggThroughJoinOnPkFk tree reconstruction#65172

Open
starocean999 wants to merge 2 commits into
apache:masterfrom
starocean999:master_0403
Open

[fix](fe) Fix duplicate join nodes in PushDownAggThroughJoinOnPkFk tree reconstruction#65172
starocean999 wants to merge 2 commits into
apache:masterfrom
starocean999:master_0403

Conversation

@starocean999

@starocean999 starocean999 commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

What problem does this PR solve?

Issue Number: close #xxx

Related PR: #36035
Problem Summary:

This PR fixes two bugs in the PushDownAggThroughJoinOnPkFk rule that handles
pushing aggregates through joins using PK-FK constraints on multi-table joins.

Bug 1: Duplicate join nodes in tree reconstruction

When constructPlan rebuilt a subtree from flattened inner joins, the merge
path did currentPlan.withChildren(currentPlan, entryJoin), which inserted
currentPlan as a child of itself and also kept entryJoin with its original
two children. This produced duplicate join nodes and duplicate leaf references
in the resulting plan tree. The fix computes the new leaf set (newBits = entryBitset - currentBitset) and only attaches the genuinely new child, using
entryJoin.withChildren(newChild, currentPlan) instead.

Bug 2: First ineligible PK-FK edge aborts the entire rule

pushAgg iterates all flattened PK-FK edges, but when eliminatePrimaryOutput
returned null for an earlier edge, the code did return null — aborting the
whole rule instead of continuing to try later edges. Since HashMap<BitSet>
iteration order on Java 17 visits the lower {t_primary, t_foreign1} edge
before the root {t_other_primary, t_primary} edge, a query aggregating a
primary-side column (e.g., SUM(t_primary.pk_id)) would fail on the first
edge and never reach the valid root edge. Fixed by changing return null to
continue.

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

@starocean999

Copy link
Copy Markdown
Contributor Author

/review

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Automated review completed. I found one issue in the new negative test: it does not isolate the intended no-pushdown scenario and it lacks a negative assertion against the pushed-down shape, so the regression can miss the root FK path.

Critical checkpoint conclusions:

  • Goal/test proof: the rule change is focused on tree-join reconstruction, but the new negative test does not fully prove the intended behavior.
  • Scope: the production change is narrow and localized to InnerJoinCluster.constructPlan; no unrelated refactor was identified.
  • Concurrency/lifecycle/config/persistence: not applicable for this FE rewrite/test-only change.
  • Parallel paths: reviewed the optimizer rule registration, FK elimination ordering, pairwise join collection, and aggregate pushdown paths; no additional substantiated optimizer correctness issue was found.
  • Tests: static review only. FE tests were not run because .worktree_initialized, thirdparty/installed, and thirdparty/installed/bin/protoc are missing in this runner.
  • User focus: no additional user-provided focus was supplied.

Subagent conclusions: optimizer-rewrite found no candidates. tests-session-config proposed TSC-1; I accepted it as M-1 with narrowed rationale and dismissed the unsupported old-memo-alternative part. Convergence round 1 ended with both live subagents replying NO_NEW_VALUABLE_FINDINGS for the same final ledger/comment set.

@starocean999

Copy link
Copy Markdown
Contributor Author

/review

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reviewed PR #65172 statically. I found one blocking issue in the tree-join aggregate pushdown coverage/fix: the rule can still abort on an earlier ineligible PK/FK edge before trying a later valid edge.

Critical checkpoint conclusions:

  • Goal/test: the PR targets duplicate join tree reconstruction, but the new positive tree-join test misses the early-abort path covered by the inline comment.
  • Scope: changes are narrowly scoped to the Nereids rewrite and its unit test.
  • Concurrency/lifecycle/config/persistence: not involved; no new config, persistence, or lifecycle surface.
  • Parallel paths: multiple PK/FK edges in the same join cluster remain order-dependent because newAgg == null aborts the whole rule.
  • Testing: existing prior thread on the negative assertion is not duplicated; current head changed that SQL and added nonMatch. A new regression is still needed for MAIN-1.
  • Validation: git diff --check FETCH_HEAD..HEAD passed. FE build/tests were not run because thirdparty/installed/bin/protoc is missing, and fe/AGENTS.md says to stop before FE builds in that state.

Subagent conclusions: optimizer-rewrite proposed OPT-1, accepted as MAIN-1 and submitted inline. tests-session-config reported no candidates. Convergence round 1 ended with both live subagents replying NO_NEW_VALUABLE_FINDINGS for the unchanged final comment set.

@starocean999

Copy link
Copy Markdown
Contributor Author

/review

@starocean999

Copy link
Copy Markdown
Contributor Author

run buildall

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Automated review summary for current head 463c3c02c92670a46fce5d4bf63b09762393c916.

I reviewed the two changed files and the related Nereids rewrite path. I do not see a new substantiated blocking issue to raise on the current patch. The two existing inline review threads are not repeated here because the current head addresses them: newAgg == null now skips only the current PK/FK candidate, and the tree-join negative test removes the alternate PK/FK path and adds a negative pushed-down-shape assertion.

Critical checkpoint conclusions:

  • Goal/test: the patch targets tree reconstruction in PushDownAggThroughJoinOnPkFk plus the order-dependent abort when an earlier PK/FK edge cannot rewrite. The production change and added unit tests cover those scenarios at the plan-shape level.
  • Scope: the change is limited to the Nereids rule and its FE test.
  • Concurrency/lifecycle/config/persistence/data writes/FE-BE protocol compatibility: not applicable; this is a logical optimizer rewrite and test-only schema setup.
  • Parallel paths: both rule entry shapes remain covered (Aggregate(Join) and Aggregate(Project(Join))), and the multi-join PK/FK candidates are now skipped per candidate instead of aborting the whole rule.
  • Test coverage: new FE unit coverage was added for tree-join pushdown, disconnected non-primary reconstruction, and skipping an ineligible edge before succeeding on a later edge. I did not run FE tests because this checkout lacks .worktree_initialized, thirdparty/installed, and thirdparty/installed/bin/protoc.
  • Style/basic checks: git diff --check on the changed files passed.
  • User focus: no additional user-provided review focus was supplied.

Subagent conclusions: optimizer-rewrite and tests-session-config found no new valuable non-duplicate candidates. In convergence round 1, both returned NO_NEW_VALUABLE_FINDINGS for the same ledger and empty proposed inline comment set.

@hello-stephen

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

------ Round 1 ----------------------------------
============================================
q1	17879	4051	4057	4051
q2	1997	330	204	204
q3	10277	1470	833	833
q4	4733	469	340	340
q5	7974	860	576	576
q6	278	169	135	135
q7	802	852	616	616
q8	10102	1597	1600	1597
q9	5942	4426	4447	4426
q10	6773	1820	1512	1512
q11	499	348	320	320
q12	704	559	431	431
q13	18070	3366	2760	2760
q14	265	262	247	247
q15	q16	784	785	720	720
q17	1016	986	1094	986
q18	7034	5720	5660	5660
q19	1179	1245	1104	1104
q20	770	640	525	525
q21	5566	2751	2555	2555
q22	428	356	307	307
Total cold run time: 103072 ms
Total hot run time: 29905 ms

----- Round 2, with runtime_filter_mode=off -----
============================================
q1	4340	4269	4293	4269
q2	308	316	214	214
q3	4600	4962	4402	4402
q4	2074	2146	1395	1395
q5	4480	4339	4302	4302
q6	238	179	127	127
q7	2151	1999	1573	1573
q8	2585	2191	2147	2147
q9	7888	7820	7773	7773
q10	4755	4687	4257	4257
q11	578	409	384	384
q12	978	789	566	566
q13	3222	3608	2958	2958
q14	308	305	284	284
q15	q16	732	747	643	643
q17	1363	1319	1347	1319
q18	8060	7341	7147	7147
q19	1164	1102	1087	1087
q20	2241	2209	1963	1963
q21	5324	4606	4421	4421
q22	537	445	404	404
Total cold run time: 57926 ms
Total hot run time: 51635 ms

@hello-stephen

Copy link
Copy Markdown
Contributor
TPC-DS: Total hot run time: 174444 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 463c3c02c92670a46fce5d4bf63b09762393c916, data reload: false

query5	4314	650	486	486
query6	469	227	197	197
query7	4942	560	347	347
query8	338	190	175	175
query9	8767	4129	4103	4103
query10	448	348	300	300
query11	5980	2350	2183	2183
query12	163	107	105	105
query13	1250	624	447	447
query14	6266	5345	4989	4989
query14_1	4363	4356	4302	4302
query15	220	209	184	184
query16	1003	492	456	456
query17	972	735	610	610
query18	2445	496	355	355
query19	223	210	157	157
query20	114	112	111	111
query21	230	166	135	135
query22	13633	13599	13396	13396
query23	17523	16536	16257	16257
query23_1	16230	16321	16405	16321
query24	7457	1776	1313	1313
query24_1	1329	1324	1314	1314
query25	578	473	406	406
query26	1354	337	216	216
query27	2576	618	370	370
query28	4468	2047	2053	2047
query29	1091	627	527	527
query30	339	263	234	234
query31	1128	1117	988	988
query32	121	63	67	63
query33	547	320	267	267
query34	1225	1150	672	672
query35	769	783	668	668
query36	1404	1429	1209	1209
query37	152	103	95	95
query38	1886	1669	1629	1629
query39	928	929	888	888
query39_1	876	883	903	883
query40	242	164	144	144
query41	70	67	65	65
query42	95	94	92	92
query43	332	330	287	287
query44	1424	800	777	777
query45	208	190	181	181
query46	1077	1205	757	757
query47	2392	2345	2224	2224
query48	402	420	291	291
query49	585	426	318	318
query50	1125	415	331	331
query51	4433	4348	4324	4324
query52	89	86	72	72
query53	277	278	217	217
query54	287	230	217	217
query55	76	71	66	66
query56	298	307	278	278
query57	1448	1430	1321	1321
query58	294	262	252	252
query59	1572	1635	1435	1435
query60	305	277	248	248
query61	153	144	143	143
query62	698	648	586	586
query63	247	208	217	208
query64	2526	808	611	611
query65	4868	4790	4767	4767
query66	1828	514	392	392
query67	29470	29558	29352	29352
query68	3103	1621	921	921
query69	427	297	265	265
query70	1113	984	969	969
query71	344	336	321	321
query72	2916	2625	2343	2343
query73	811	724	438	438
query74	5116	4997	4733	4733
query75	2627	2591	2241	2241
query76	2322	1198	799	799
query77	355	366	285	285
query78	12350	12538	11829	11829
query79	1371	1091	750	750
query80	1257	543	482	482
query81	522	334	281	281
query82	598	158	123	123
query83	372	320	288	288
query84	328	161	127	127
query85	978	596	531	531
query86	428	285	258	258
query87	1834	1819	1745	1745
query88	3769	2828	2863	2828
query89	465	401	351	351
query90	1878	209	194	194
query91	204	194	160	160
query92	68	61	58	58
query93	1744	1578	959	959
query94	726	359	333	333
query95	794	497	510	497
query96	1059	763	330	330
query97	2699	2741	2560	2560
query98	217	212	206	206
query99	1195	1139	1024	1024
Total cold run time: 259233 ms
Total hot run time: 174444 ms

@hello-stephen

Copy link
Copy Markdown
Contributor
ClickBench: Total hot run time: 25.35 s
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit 463c3c02c92670a46fce5d4bf63b09762393c916, data reload: false

query1	0.00	0.00	0.01
query2	0.10	0.05	0.05
query3	0.25	0.14	0.14
query4	1.61	0.15	0.14
query5	0.25	0.23	0.22
query6	1.23	1.09	1.07
query7	0.04	0.01	0.01
query8	0.06	0.04	0.04
query9	0.38	0.35	0.32
query10	0.57	0.58	0.56
query11	0.20	0.14	0.14
query12	0.18	0.14	0.15
query13	0.46	0.47	0.47
query14	1.01	1.02	1.00
query15	0.61	0.58	0.59
query16	0.34	0.32	0.33
query17	1.11	1.07	1.09
query18	0.23	0.20	0.22
query19	2.02	2.01	1.99
query20	0.02	0.01	0.01
query21	15.42	0.23	0.14
query22	4.81	0.05	0.05
query23	16.11	0.30	0.13
query24	2.94	0.45	0.35
query25	0.11	0.05	0.04
query26	0.73	0.22	0.15
query27	0.04	0.05	0.04
query28	3.53	0.91	0.55
query29	12.47	4.29	3.46
query30	0.27	0.15	0.16
query31	2.77	0.60	0.32
query32	3.22	0.60	0.48
query33	3.16	3.20	3.19
query34	15.60	4.27	3.52
query35	3.52	3.53	3.58
query36	0.54	0.42	0.42
query37	0.09	0.07	0.06
query38	0.05	0.04	0.04
query39	0.04	0.03	0.03
query40	0.18	0.16	0.15
query41	0.09	0.03	0.03
query42	0.04	0.02	0.03
query43	0.04	0.04	0.03
Total cold run time: 96.44 s
Total hot run time: 25.35 s

@hello-stephen

Copy link
Copy Markdown
Contributor

FE Regression Coverage Report

Increment line coverage 31.76% (27/85) 🎉
Increment coverage report
Complete coverage report

@starocean999

Copy link
Copy Markdown
Contributor Author

/review

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Automated review summary for PR #65172 at head b2a20e97f76ca03b29c0bd742f02db612678f225.

I reviewed the two changed files and the surrounding Nereids rewrite/test helpers:

  • fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/PushDownAggThroughJoinOnPkFk.java
  • fe/fe-core/src/test/java/org/apache/doris/nereids/rules/rewrite/PushDownAggThroughJoinOnPkFkTest.java

No new inline issue remains after duplicate suppression. The existing review threads already covered the earlier order-dependent newAgg == null abort, unstable HashMap iteration, invalid tree-join regression SQL, and childLeaves[1] == sharedLeaf side-selection concern; current head contains corresponding fixes.

Critical checkpoint conclusions:

  • Goal and proof: The PR targets duplicate/incorrect tree reconstruction in PushDownAggThroughJoinOnPkFk and the order-dependent abort while scanning flattened PK/FK edges. The implementation now continues past ineligible edges, uses deterministic LinkedHashMap join iteration, records child-leaf order, and reconstructs connected non-primary leaves without duplicating the accumulated subtree. Added FE unit cases cover the tree-join pushdown and skip-ineligible-edge paths by static inspection.
  • Scope: The change is limited to the Nereids rewrite rule and its focused FE unit tests.
  • Concurrency/lifecycle/config/persistence/data writes: No relevant concurrency, lifecycle, persisted metadata, FE-BE protocol, or data-write path is introduced.
  • Parallel paths: Both aggregate-over-join and aggregate-over-all-slot-project-over-join enter the same pushAgg path, so the production fix applies to both rule wrappers.
  • Special conditions: Existing inner-join, non-mark-join, empty-other-conjunct gates are preserved. InnerJoinCluster.isValid() still rejects joins whose conditions span more than two flattened leaves, and the final rewritten root checks that child outputs cover join input slots.
  • Tests: The added tests use the existing FE unit-test style and disable PRUNE_EMPTY_PARTITION,ELIMINATE_JOIN_BY_FK consistently with SessionVariable parsing. I did not run FE tests or checkstyle in this runner because .worktree_initialized, thirdparty/installed, and thirdparty/installed/bin/protoc are absent, and the local checkout lacks the base commit, so validation was static plus GitHub PR metadata.
  • Observability/performance: No additional observability is needed for this planner rewrite. The added reconstruction work is bounded by the flattened join cluster size and uses existing BitSet/plan traversal patterns.
  • Other review points: I did not find a distinct correctness, compatibility, or test issue worth a new inline comment.

Subagent conclusions:

  • optimizer-rewrite: no new candidate; checked pushAgg, eliminatePrimaryOutput, collectContiguousInnerJoins, constructJoinWithPrimary, and constructPlan.
  • tests-session-config: no new candidate; checked FE unit-test setup, PK/FK constraints, disabled-rule propagation, assertion shape, and basic style hazards.
  • Final convergence round 1 ended with both live subagents replying NO_NEW_VALUABLE_FINDINGS for the same current ledger/comment set after the last main ledger update.

User focus: .code-review.Axovz2/review_focus.txt had no additional user-provided review focus.

yx-keith
yx-keith previously approved these changes Jul 7, 2026
@github-actions github-actions Bot added the approved Indicates a PR has been approved by one committer. label Jul 7, 2026
@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

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

@starocean999

Copy link
Copy Markdown
Contributor Author

run buildall

@hello-stephen

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

------ Round 1 ----------------------------------
============================================
q1	17806	4219	4089	4089
q2	2044	353	226	226
q3	10231	1500	845	845
q4	4759	484	338	338
q5	8113	859	580	580
q6	279	169	136	136
q7	849	854	632	632
q8	10526	1490	1643	1490
q9	5841	4386	4366	4366
q10	6795	1816	1515	1515
q11	511	349	313	313
q12	768	546	426	426
q13	18088	3464	2748	2748
q14	266	264	249	249
q15	q16	792	782	711	711
q17	1008	1022	985	985
q18	7193	5824	5657	5657
q19	1173	1258	1124	1124
q20	793	670	577	577
q21	5723	2661	2469	2469
q22	428	362	304	304
Total cold run time: 103986 ms
Total hot run time: 29780 ms

----- Round 2, with runtime_filter_mode=off -----
============================================
q1	4425	4306	4358	4306
q2	287	313	215	215
q3	4606	4965	4387	4387
q4	2066	2152	1382	1382
q5	4438	4293	4340	4293
q6	235	178	131	131
q7	1787	1620	1485	1485
q8	2408	1991	1958	1958
q9	7274	7298	7217	7217
q10	4709	4698	4258	4258
q11	546	396	373	373
q12	742	749	544	544
q13	3085	3423	2783	2783
q14	303	294	273	273
q15	q16	691	704	631	631
q17	1288	1263	1256	1256
q18	7433	6986	6788	6788
q19	1120	1056	1085	1056
q20	2226	2236	1959	1959
q21	5269	4580	4491	4491
q22	541	464	453	453
Total cold run time: 55479 ms
Total hot run time: 50239 ms

@hello-stephen

Copy link
Copy Markdown
Contributor
TPC-DS: Total hot run time: 182264 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 b2a20e97f76ca03b29c0bd742f02db612678f225, data reload: false

query5	1678	636	516	516
query6	513	251	229	229
query7	4867	641	365	365
query8	379	218	196	196
query9	8792	4120	4110	4110
query10	500	372	319	319
query11	6056	2408	2193	2193
query12	179	109	106	106
query13	1294	616	452	452
query14	6007	5360	5058	5058
query14_1	4388	4346	4343	4343
query15	216	216	189	189
query16	1049	537	500	500
query17	1197	788	647	647
query18	2477	519	382	382
query19	234	228	170	170
query20	119	119	112	112
query21	239	166	139	139
query22	13745	13608	13375	13375
query23	17555	16604	16203	16203
query23_1	16412	16410	16363	16363
query24	7475	1809	1327	1327
query24_1	1328	1369	1347	1347
query25	568	537	448	448
query26	908	361	218	218
query27	2499	616	399	399
query28	4393	2019	2017	2017
query29	887	691	558	558
query30	420	275	233	233
query31	1143	1114	1004	1004
query32	82	69	74	69
query33	505	370	299	299
query34	1200	1138	643	643
query35	802	813	685	685
query36	1403	1375	1236	1236
query37	160	118	100	100
query38	1826	1681	1673	1673
query39	944	937	946	937
query39_1	884	883	882	882
query40	248	174	148	148
query41	78	76	77	76
query42	98	90	96	90
query43	326	326	289	289
query44	1422	787	782	782
query45	215	193	185	185
query46	1103	1229	757	757
query47	2399	2365	2232	2232
query48	395	445	308	308
query49	741	445	337	337
query50	1099	421	329	329
query51	10963	10690	10400	10400
query52	88	89	78	78
query53	261	279	210	210
query54	332	269	260	260
query55	77	73	68	68
query56	311	301	301	301
query57	1445	1426	1310	1310
query58	286	280	275	275
query59	1622	1695	1472	1472
query60	298	281	270	270
query61	195	191	193	191
query62	711	658	599	599
query63	244	216	221	216
query64	1757	882	718	718
query65	4895	4819	4817	4817
query66	1592	559	435	435
query67	29902	29628	29460	29460
query68	3157	1584	962	962
query69	433	321	272	272
query70	1080	977	981	977
query71	336	327	314	314
query72	3241	2953	2648	2648
query73	837	786	456	456
query74	5141	4999	4816	4816
query75	2618	2640	2243	2243
query76	1321	1185	813	813
query77	421	412	302	302
query78	12396	12363	11923	11923
query79	1256	1292	806	806
query80	742	590	511	511
query81	496	336	282	282
query82	1062	172	130	130
query83	403	344	310	310
query84	303	174	141	141
query85	1093	711	626	626
query86	416	316	299	299
query87	1854	1827	1773	1773
query88	3727	2827	2787	2787
query89	454	411	369	369
query90	1803	217	208	208
query91	232	223	191	191
query92	85	74	64	64
query93	1662	1465	921	921
query94	627	377	342	342
query95	777	594	502	502
query96	1087	798	341	341
query97	2698	2683	2562	2562
query98	219	211	202	202
query99	1182	1172	1061	1061
Total cold run time: 256503 ms
Total hot run time: 182264 ms

@hello-stephen

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

query1	0.01	0.01	0.01
query2	0.10	0.05	0.05
query3	0.25	0.14	0.14
query4	1.61	0.15	0.13
query5	0.25	0.24	0.22
query6	1.31	1.09	1.05
query7	0.04	0.01	0.00
query8	0.06	0.04	0.04
query9	0.40	0.32	0.32
query10	0.58	0.58	0.57
query11	0.20	0.14	0.14
query12	0.18	0.14	0.14
query13	0.48	0.49	0.47
query14	1.01	1.02	1.01
query15	0.62	0.60	0.60
query16	0.32	0.34	0.34
query17	1.13	1.12	1.12
query18	0.23	0.21	0.22
query19	2.08	1.90	1.95
query20	0.02	0.01	0.01
query21	15.46	0.23	0.15
query22	4.88	0.06	0.05
query23	16.11	0.30	0.12
query24	2.94	0.44	0.32
query25	0.11	0.05	0.05
query26	0.74	0.21	0.15
query27	0.05	0.04	0.03
query28	3.47	0.93	0.52
query29	12.61	4.15	3.24
query30	0.27	0.16	0.15
query31	2.77	0.60	0.32
query32	3.22	0.60	0.49
query33	3.21	3.19	3.19
query34	15.80	4.24	3.53
query35	3.50	3.55	3.54
query36	0.56	0.44	0.43
query37	0.10	0.07	0.07
query38	0.06	0.04	0.04
query39	0.04	0.03	0.03
query40	0.17	0.17	0.15
query41	0.09	0.03	0.03
query42	0.04	0.03	0.03
query43	0.04	0.04	0.04
Total cold run time: 97.12 s
Total hot run time: 25.14 s

@hello-stephen

Copy link
Copy Markdown
Contributor

FE Regression Coverage Report

Increment line coverage 13.68% (26/190) 🎉
Increment coverage report
Complete coverage report

@github-actions github-actions Bot removed the approved Indicates a PR has been approved by one committer. label Jul 8, 2026
@starocean999

Copy link
Copy Markdown
Contributor Author

/review

@starocean999

Copy link
Copy Markdown
Contributor Author

run buildall

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Codex automated review failed and did not complete.

Error: You've hit your usage limit. Visit https://chatgpt.com/codex/settings/usage to purchase more credits or try again at Jul 10th, 2026 6:44 AM.
Workflow run: https://github.com/apache/doris/actions/runs/28932135891

Please inspect the workflow logs and rerun the review after the underlying issue is resolved.

@hello-stephen

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

------ Round 1 ----------------------------------
============================================
q1	17616	4017	4010	4010
q2	2054	325	206	206
q3	10283	1387	828	828
q4	4680	481	339	339
q5	7493	845	568	568
q6	182	173	136	136
q7	755	825	610	610
q8	9314	1520	1589	1520
q9	5684	4421	4371	4371
q10	6747	1781	1528	1528
q11	493	350	322	322
q12	701	573	443	443
q13	18169	3449	2741	2741
q14	266	268	240	240
q15	q16	777	790	712	712
q17	980	890	1042	890
q18	6914	5768	5514	5514
q19	1356	1261	1089	1089
q20	768	621	567	567
q21	6446	3019	2609	2609
q22	457	374	316	316
Total cold run time: 102135 ms
Total hot run time: 29559 ms

----- Round 2, with runtime_filter_mode=off -----
============================================
q1	5173	4851	4857	4851
q2	393	348	210	210
q3	4894	5277	4778	4778
q4	2065	2205	1362	1362
q5	5027	4655	4663	4655
q6	227	181	136	136
q7	1891	1738	1562	1562
q8	2409	2095	2052	2052
q9	7695	7202	7243	7202
q10	4632	4586	4212	4212
q11	526	383	355	355
q12	737	742	528	528
q13	3025	3424	2787	2787
q14	277	278	251	251
q15	q16	683	696	613	613
q17	1268	1244	1226	1226
q18	7276	6899	6743	6743
q19	1068	1054	1076	1054
q20	2219	2194	1950	1950
q21	5223	4527	4401	4401
q22	523	444	393	393
Total cold run time: 57231 ms
Total hot run time: 51321 ms

@hello-stephen

Copy link
Copy Markdown
Contributor
TPC-DS: Total hot run time: 181235 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 95c06022d1feb817c584d4f4a6c5f421259a7297, data reload: false

query5	4326	626	499	499
query6	486	222	209	209
query7	4836	576	339	339
query8	358	192	178	178
query9	8812	4085	4074	4074
query10	449	349	317	317
query11	5950	2347	2181	2181
query12	164	102	105	102
query13	1298	619	447	447
query14	6450	5414	5108	5108
query14_1	4389	4521	4398	4398
query15	210	215	182	182
query16	1043	502	448	448
query17	1132	746	594	594
query18	2731	491	362	362
query19	219	196	155	155
query20	118	111	109	109
query21	236	157	143	143
query22	13663	13646	13437	13437
query23	17334	16610	16318	16318
query23_1	16359	16346	16374	16346
query24	7514	1770	1315	1315
query24_1	1319	1321	1301	1301
query25	573	476	387	387
query26	1339	357	212	212
query27	2507	563	380	380
query28	4344	2045	2027	2027
query29	1084	655	523	523
query30	341	265	230	230
query31	1126	1095	995	995
query32	109	63	63	63
query33	530	338	267	267
query34	1179	1150	652	652
query35	775	808	676	676
query36	1379	1372	1207	1207
query37	155	112	93	93
query38	1872	1730	1642	1642
query39	912	914	892	892
query39_1	861	879	857	857
query40	245	155	142	142
query41	78	76	81	76
query42	92	92	91	91
query43	333	334	288	288
query44	1446	785	798	785
query45	202	188	175	175
query46	1096	1203	757	757
query47	2379	2306	2188	2188
query48	394	421	282	282
query49	578	427	309	309
query50	1026	404	342	342
query51	10824	10617	10748	10617
query52	86	93	76	76
query53	259	287	203	203
query54	310	232	227	227
query55	74	74	71	71
query56	305	300	274	274
query57	1420	1399	1285	1285
query58	281	260	253	253
query59	1599	1669	1449	1449
query60	311	265	251	251
query61	149	149	149	149
query62	689	657	579	579
query63	240	206	203	203
query64	2807	1040	914	914
query65	5166	4794	4752	4752
query66	1793	510	382	382
query67	29693	29593	29428	29428
query68	3060	1523	963	963
query69	419	291	271	271
query70	1092	999	971	971
query71	333	314	318	314
query72	3165	2722	2398	2398
query73	794	775	433	433
query74	5137	4973	4787	4787
query75	2624	2585	2231	2231
query76	2367	1219	803	803
query77	364	387	294	294
query78	12347	12352	11759	11759
query79	1445	1179	729	729
query80	1326	555	459	459
query81	502	320	284	284
query82	582	156	124	124
query83	398	316	292	292
query84	271	156	132	132
query85	976	604	533	533
query86	432	289	286	286
query87	1851	1841	1763	1763
query88	3736	2817	2784	2784
query89	461	406	352	352
query90	1934	202	202	202
query91	201	185	160	160
query92	64	61	55	55
query93	1649	1427	1011	1011
query94	741	362	299	299
query95	789	575	486	486
query96	1040	769	321	321
query97	2692	2696	2603	2603
query98	215	205	196	196
query99	1160	1176	1017	1017
Total cold run time: 266839 ms
Total hot run time: 181235 ms

@hello-stephen

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

query1	0.01	0.01	0.00
query2	0.09	0.05	0.05
query3	0.26	0.14	0.13
query4	1.60	0.14	0.13
query5	0.24	0.25	0.21
query6	1.22	1.04	1.05
query7	0.04	0.00	0.01
query8	0.06	0.04	0.04
query9	0.38	0.31	0.33
query10	0.54	0.55	0.60
query11	0.19	0.14	0.13
query12	0.18	0.14	0.14
query13	0.46	0.47	0.49
query14	1.01	1.02	1.00
query15	0.62	0.59	0.60
query16	0.31	0.32	0.32
query17	1.09	1.07	1.06
query18	0.23	0.22	0.22
query19	2.05	1.92	1.90
query20	0.02	0.01	0.01
query21	15.43	0.23	0.13
query22	4.76	0.05	0.06
query23	16.12	0.30	0.12
query24	3.08	0.42	0.32
query25	0.11	0.06	0.05
query26	0.73	0.22	0.16
query27	0.04	0.04	0.04
query28	3.51	0.90	0.54
query29	12.50	4.15	3.28
query30	0.27	0.16	0.16
query31	2.76	0.61	0.30
query32	3.22	0.59	0.50
query33	3.17	3.16	3.19
query34	15.60	4.24	3.55
query35	3.50	3.52	3.51
query36	0.56	0.43	0.40
query37	0.08	0.06	0.07
query38	0.05	0.04	0.03
query39	0.03	0.03	0.03
query40	0.17	0.16	0.15
query41	0.09	0.03	0.02
query42	0.03	0.02	0.02
query43	0.04	0.03	0.04
Total cold run time: 96.45 s
Total hot run time: 24.91 s

@hello-stephen

Copy link
Copy Markdown
Contributor

FE Regression Coverage Report

Increment line coverage 1.69% (9/532) 🎉
Increment coverage report
Complete coverage report

@starocean999

Copy link
Copy Markdown
Contributor Author

/review

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Automated review summary for PR #65172.

I reviewed the two changed Nereids files and the surrounding PushDownAggThroughJoinOnPkFk rewrite path. I did not find a new, distinct inline issue to add beyond the existing review threads.

Critical checkpoint conclusions:

  • Goal and tests: The patch addresses the duplicate join-tree reconstruction path and the abort-on-first-ineligible-PK/FK-edge path. The current code skips ineligible aggregate rewrites with continue, uses deterministic join-edge iteration, and adds focused FE tests for the tree-join cases.
  • Scope and focus: The change is limited to one optimizer rewrite and its FE unit test. No configuration, persistence, transaction, FE-BE protocol, lifecycle, or concurrency path is introduced.
  • Parallel paths: I checked the direct aggregate-over-join and aggregate-over-slot-project join patterns, plus flattened multi-join reconstruction. I did not find another changed path requiring an inline comment.
  • Existing threads: The earlier abort-on-first-edge and weak tree-test-shape concerns are already covered by existing inline threads. The current patch appears to address those scenarios, so I did not duplicate them.
  • Tests and CI: Local FE test execution was not attempted because this checkout lacks thirdparty/installed/bin/protoc. GitHub status for the current head shows FE UT and CheckStyle success; legacy commit status also shows External Regression failed and P0/NonConcurrent pending, which I could not attribute to the changed files from static review alone.
  • Observability and performance: No new logging/metrics need was introduced, and I did not find a substantiated hot-path regression in the changed code.
  • User focus: No additional user-provided review focus was supplied.

Subagent conclusions:

  • optimizer-rewrite: no new valuable findings; suspicious optimizer/tree-reconstruction points were already covered by existing threads or dismissed with code evidence.
  • tests-session-config: no new valuable findings after checking tests, session-rule setup, and CI/style signals.
  • Final convergence: round 2 ended with both live subagents replying NO_NEW_VALUABLE_FINDINGS for the same ledger and no-inline comment set after the CI caveat update.

@hello-stephen

Copy link
Copy Markdown
Contributor

FE Regression Coverage Report

Increment line coverage 1.51% (9/595) 🎉
Increment coverage report
Complete coverage report

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.

5 participants