Skip to content

[fix](Nereids) Add shapeInfo() override in AggregateFunction to preserve table qualifier in EXPLAIN output#65264

Merged
englefly merged 5 commits into
apache:masterfrom
englefly:aggFuncPrint
Jul 16, 2026
Merged

[fix](Nereids) Add shapeInfo() override in AggregateFunction to preserve table qualifier in EXPLAIN output#65264
englefly merged 5 commits into
apache:masterfrom
englefly:aggFuncPrint

Conversation

@englefly

@englefly englefly commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

What problem does this PR solve?

some regression case output are not stable, like query_p0/hint/multi_leading.groovy

Exception:
java.lang.IllegalStateException: Check tag 'sql5_2' failed:
Check tag 'sql5_2' failed, line 6, CHAR result mismatch.
Expect cell is: ------NestedLoopJoin[INNER_JOIN](cast(sum(c11) as DOUBLE) > avg(t1.c11) / 20.0)
But real is   : ------NestedLoopJoin[INNER_JOIN](cast(sum(c11) as DOUBLE) > (avg(c11) / 20.0))

After this pr, the explain output is fixed to avg(t1.c11)

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

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

@englefly

englefly commented Jul 6, 2026

Copy link
Copy Markdown
Contributor Author

/review

@englefly

englefly commented Jul 6, 2026

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.

Requesting changes. The direct aggregate qualifier fix helps the reported shape-plan case, but two shape-rendering regressions remain in the same AggregateFunction.shapeInfo() override.

Critical checkpoint conclusions:

  • Goal/test: the PR aims to stabilize EXPLAIN SHAPE PLAN aggregate output. It fixes direct aggregate operands, but not wrapped aggregates, and introduces a count(*) spelling regression.
  • Scope: the code change is small, but the abstraction is incomplete because shape rendering still mixes shapeInfo() and toSql() across expression wrappers.
  • Concurrency/lifecycle/config/persistence/FE-BE protocol/data writes: not involved.
  • Parallel paths: direct aggregate operands were updated; wrapper expression paths such as Cast still use toSql() and remain unfixed.
  • Tests: no new/updated regression output is included in the PR. I did not run tests because this checkout is missing the worktree/thirdparty prerequisites (thirdparty/installed/bin/protoc). Static review only.
  • User focus: no additional user-provided review focus was supplied.

Subagent conclusions:

  • optimizer-rewrite proposed OPT-1, accepted as MAIN-2, and OPT-2 as a duplicate of MAIN-1.
  • tests-session-config proposed TSC-1, merged as a duplicate source for MAIN-1.
  • Final convergence round 1 ended with both live subagents replying NO_NEW_VALUABLE_FINDINGS for the same two-comment set.

}

@Override
public String shapeInfo() {

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.

This base implementation loses the special Count(*) rendering. Count stores star-ness in the isStar flag and has zero children, then overrides computeToSql(), toString(), and toDigest() to print count(*). With this new base shapeInfo(), a Count() star aggregate never reaches those overrides: arity() is 0, the loop emits no arguments, and expression shape output such as PhysicalFilter.shapeInfo() for HAVING predicates prints count() instead of the canonical count(*). Please preserve the Count special case, for example by overriding Count.shapeInfo() or by reusing computeToSql() for the function wrapper while still calling child shapeInfo() for non-star arguments.

@hello-stephen

Copy link
Copy Markdown
Contributor

FE UT Coverage Report

Increment line coverage 0.00% (0/9) 🎉
Increment coverage report
Complete coverage report

@englefly

englefly commented Jul 7, 2026

Copy link
Copy Markdown
Contributor Author

run buildall

1 similar comment
@englefly

englefly commented Jul 8, 2026

Copy link
Copy Markdown
Contributor Author

run buildall

@hello-stephen

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

------ Round 1 ----------------------------------
============================================
q1	17621	4282	4096	4096
q2	2050	325	192	192
q3	10260	1404	824	824
q4	4686	465	341	341
q5	7488	842	551	551
q6	187	174	140	140
q7	751	827	604	604
q8	9930	1510	1530	1510
q9	5803	4345	4357	4345
q10	6845	1773	1518	1518
q11	503	341	309	309
q12	729	545	418	418
q13	18066	3384	2688	2688
q14	273	257	246	246
q15	q16	779	793	705	705
q17	1073	1093	926	926
q18	6889	5707	5636	5636
q19	1297	1356	1073	1073
q20	756	648	517	517
q21	5729	2597	2416	2416
q22	422	353	287	287
Total cold run time: 102137 ms
Total hot run time: 29342 ms

----- Round 2, with runtime_filter_mode=off -----
============================================
q1	4476	4407	4414	4407
q2	284	319	212	212
q3	4561	4901	4447	4447
q4	2050	2141	1357	1357
q5	4441	4389	4292	4292
q6	220	179	130	130
q7	1808	2035	1706	1706
q8	2498	2185	2092	2092
q9	7891	7899	7923	7899
q10	4739	4753	4280	4280
q11	567	426	376	376
q12	742	847	614	614
q13	3258	3560	2991	2991
q14	314	304	290	290
q15	q16	732	739	637	637
q17	1344	1291	1323	1291
q18	8149	7357	6941	6941
q19	1082	1103	1068	1068
q20	2219	2194	1934	1934
q21	5234	4563	4370	4370
q22	506	456	410	410
Total cold run time: 57115 ms
Total hot run time: 51744 ms

@hello-stephen

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

query5	4328	656	493	493
query6	462	231	215	215
query7	4844	587	354	354
query8	341	204	170	170
query9	8782	4016	3974	3974
query10	491	343	310	310
query11	5916	2389	2147	2147
query12	157	101	102	101
query13	1265	608	444	444
query14	6798	5303	4953	4953
query14_1	4293	4311	4268	4268
query15	214	202	180	180
query16	1013	457	428	428
query17	1128	720	572	572
query18	2703	482	344	344
query19	205	180	142	142
query20	111	107	107	107
query21	230	150	134	134
query22	13598	13574	13399	13399
query23	17381	16590	16220	16220
query23_1	16212	16298	16290	16290
query24	7396	1816	1264	1264
query24_1	1302	1340	1316	1316
query25	544	450	377	377
query26	1012	372	213	213
query27	2549	569	376	376
query28	4437	2048	1973	1973
query29	1068	643	514	514
query30	336	258	226	226
query31	1115	1103	975	975
query32	114	63	62	62
query33	539	316	293	293
query34	1199	1226	651	651
query35	782	778	671	671
query36	1403	1408	1299	1299
query37	152	109	95	95
query38	1888	1707	1648	1648
query39	928	924	913	913
query39_1	874	879	890	879
query40	246	166	137	137
query41	71	70	69	69
query42	97	102	92	92
query43	313	325	279	279
query44	1426	782	774	774
query45	206	187	177	177
query46	1105	1229	768	768
query47	2442	2359	2213	2213
query48	403	435	297	297
query49	578	432	327	327
query50	1048	415	331	331
query51	10913	10475	10429	10429
query52	88	88	77	77
query53	267	283	205	205
query54	310	269	235	235
query55	79	73	64	64
query56	268	292	274	274
query57	1426	1412	1297	1297
query58	287	250	251	250
query59	1585	1667	1403	1403
query60	302	270	248	248
query61	157	149	149	149
query62	688	647	589	589
query63	239	200	208	200
query64	2349	1047	857	857
query65	4880	4793	4779	4779
query66	1714	542	395	395
query67	29545	29486	29376	29376
query68	3114	1651	1012	1012
query69	404	293	272	272
query70	1081	943	976	943
query71	337	317	313	313
query72	3031	2767	2343	2343
query73	817	796	427	427
query74	5118	4947	4773	4773
query75	2597	2561	2227	2227
query76	2367	1201	794	794
query77	346	379	292	292
query78	12367	12334	11807	11807
query79	1407	1137	767	767
query80	1270	527	453	453
query81	529	321	287	287
query82	601	154	123	123
query83	376	340	290	290
query84	280	159	126	126
query85	978	600	512	512
query86	426	287	295	287
query87	1820	1823	1760	1760
query88	3729	2769	2747	2747
query89	455	395	360	360
query90	1889	200	190	190
query91	201	195	167	167
query92	64	63	57	57
query93	1686	1508	983	983
query94	730	358	315	315
query95	770	500	461	461
query96	1109	773	354	354
query97	2691	2680	2551	2551
query98	220	224	201	201
query99	1182	1174	1017	1017
Total cold run time: 265515 ms
Total hot run time: 179800 ms

@hello-stephen

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

query1	0.01	0.01	0.00
query2	0.10	0.04	0.05
query3	0.25	0.13	0.13
query4	1.63	0.14	0.14
query5	0.24	0.23	0.22
query6	1.28	1.06	1.09
query7	0.04	0.01	0.00
query8	0.05	0.04	0.03
query9	0.38	0.31	0.30
query10	0.54	0.54	0.55
query11	0.18	0.14	0.15
query12	0.19	0.14	0.14
query13	0.46	0.46	0.48
query14	1.01	1.03	1.01
query15	0.61	0.59	0.60
query16	0.31	0.32	0.32
query17	1.18	1.12	1.08
query18	0.22	0.21	0.21
query19	2.07	2.01	1.97
query20	0.02	0.01	0.02
query21	15.42	0.21	0.13
query22	4.89	0.05	0.06
query23	16.12	0.31	0.12
query24	2.96	0.44	0.32
query25	0.12	0.05	0.05
query26	0.73	0.20	0.14
query27	0.04	0.05	0.03
query28	3.53	0.90	0.52
query29	12.47	4.07	3.26
query30	0.27	0.15	0.16
query31	2.77	0.59	0.30
query32	3.22	0.59	0.48
query33	3.14	3.24	3.17
query34	15.58	4.23	3.57
query35	3.55	3.53	3.58
query36	0.56	0.44	0.44
query37	0.08	0.06	0.07
query38	0.05	0.05	0.04
query39	0.04	0.03	0.03
query40	0.17	0.16	0.14
query41	0.09	0.04	0.03
query42	0.04	0.03	0.03
query43	0.04	0.04	0.03
Total cold run time: 96.65 s
Total hot run time: 25.01 s

@hello-stephen

Copy link
Copy Markdown
Contributor

FE Regression Coverage Report

Increment line coverage 5.46% (32/586) 🎉
Increment coverage report
Complete coverage report

englefly and others added 4 commits July 13, 2026 10:30
### What problem does this PR solve?

Issue Number: close #xxx

Related PR: #xxx

Problem Summary: Shape-plan predicates could lose slot qualifiers when an aggregate function was wrapped by expressions whose shapeInfo() fell back to SQL rendering. Those wrappers called child.toSql(), so expressions such as cast(avg(t1.c11) as DOUBLE) could be printed as cast(avg(c11) as DOUBLE). This change adds shapeInfo() implementations for common expression wrappers and scalar functions so shape rendering recursively preserves child shape information.

### Release note

Fix shape-plan explain output to preserve qualifiers in wrapped aggregate expressions.

### Check List (For Author)

- Test: Manual test
    - Added ExpressionShapeInfoTest for wrapped aggregate shapeInfo qualifier preservation
    - Ran git diff --check
    - Attempted ./run-fe-ut.sh --run org.apache.doris.nereids.trees.expressions.ExpressionShapeInfoTest, but it failed before fe-core in fe-grpc generated protobuf compilation with missing OlapCommon.ColumnMessage
- Behavior changed: Yes (shape-plan explain output preserves qualifiers through wrappers)
- Does this need documentation: No
@englefly

Copy link
Copy Markdown
Contributor Author

run buildall

@hello-stephen

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

------ Round 1 ----------------------------------
============================================
q1	17701	4062	4119	4062
q2	2013	350	197	197
q3	10252	1390	799	799
q4	4675	476	339	339
q5	7512	867	555	555
q6	180	169	136	136
q7	766	820	636	636
q8	9352	1474	1475	1474
q9	5642	4396	4367	4367
q10	6744	1786	1506	1506
q11	499	356	317	317
q12	710	549	417	417
q13	18090	3388	2740	2740
q14	264	264	244	244
q15	q16	789	787	702	702
q17	930	899	995	899
q18	6931	5792	5619	5619
q19	1309	1319	1061	1061
q20	728	665	515	515
q21	5894	2574	2422	2422
q22	424	350	289	289
Total cold run time: 101405 ms
Total hot run time: 29296 ms

----- Round 2, with runtime_filter_mode=off -----
============================================
q1	4446	4439	4349	4349
q2	293	328	219	219
q3	4578	4972	4470	4470
q4	2052	2150	1347	1347
q5	4431	4327	4307	4307
q6	227	171	127	127
q7	1726	1613	1986	1613
q8	2620	2301	2231	2231
q9	8096	8262	7861	7861
q10	4739	4696	4253	4253
q11	591	423	420	420
q12	756	765	534	534
q13	3286	3637	2913	2913
q14	308	309	280	280
q15	q16	715	728	623	623
q17	1348	1322	1370	1322
q18	8277	7334	7472	7334
q19	1135	1117	1073	1073
q20	2178	2197	1917	1917
q21	5218	4547	4406	4406
q22	511	438	409	409
Total cold run time: 57531 ms
Total hot run time: 52008 ms

@hello-stephen

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

query5	4338	651	483	483
query6	477	235	214	214
query7	4839	597	347	347
query8	345	191	172	172
query9	8810	4046	4041	4041
query10	483	360	298	298
query11	5890	2342	2150	2150
query12	161	106	105	105
query13	1271	628	449	449
query14	6274	5291	4958	4958
query14_1	4316	4276	4272	4272
query15	223	213	183	183
query16	984	465	399	399
query17	948	742	591	591
query18	2442	486	366	366
query19	211	194	155	155
query20	116	110	108	108
query21	234	157	136	136
query22	13743	13552	13328	13328
query23	17239	16557	16093	16093
query23_1	16359	16285	16256	16256
query24	7631	1796	1296	1296
query24_1	1357	1283	1295	1283
query25	562	471	401	401
query26	1311	353	200	200
query27	2668	591	373	373
query28	4425	2025	2035	2025
query29	1103	632	481	481
query30	331	254	226	226
query31	1124	1093	978	978
query32	108	62	58	58
query33	527	320	245	245
query34	1167	1126	651	651
query35	778	794	676	676
query36	1461	1403	1260	1260
query37	148	102	89	89
query38	1862	1692	1652	1652
query39	926	924	911	911
query39_1	880	879	891	879
query40	248	164	135	135
query41	68	68	65	65
query42	95	92	92	92
query43	319	320	284	284
query44	1404	770	759	759
query45	206	192	180	180
query46	1092	1229	721	721
query47	2415	2346	2226	2226
query48	392	413	302	302
query49	589	456	323	323
query50	1042	423	337	337
query51	11030	10765	10712	10712
query52	83	89	74	74
query53	262	269	207	207
query54	294	238	219	219
query55	74	71	65	65
query56	283	288	285	285
query57	1444	1432	1350	1350
query58	264	256	249	249
query59	1568	1622	1466	1466
query60	300	264	253	253
query61	147	155	151	151
query62	704	653	591	591
query63	243	214	204	204
query64	2828	1047	869	869
query65	4859	4784	4789	4784
query66	1850	510	382	382
query67	29514	29364	29355	29355
query68	3117	1605	963	963
query69	432	319	277	277
query70	1075	951	1008	951
query71	365	331	299	299
query72	3262	2648	2371	2371
query73	840	767	414	414
query74	5131	4930	4747	4747
query75	2615	2571	2204	2204
query76	2324	1192	784	784
query77	355	373	279	279
query78	12360	12314	11757	11757
query79	1421	1106	770	770
query80	1314	559	447	447
query81	558	320	289	289
query82	936	154	120	120
query83	383	319	287	287
query84	325	160	131	131
query85	966	624	491	491
query86	440	337	284	284
query87	1820	1829	1767	1767
query88	3685	2787	2776	2776
query89	452	417	357	357
query90	1965	187	193	187
query91	200	188	161	161
query92	60	61	57	57
query93	1743	1588	1004	1004
query94	736	385	326	326
query95	776	500	534	500
query96	1077	820	341	341
query97	2696	2686	2549	2549
query98	213	207	197	197
query99	1158	1167	1027	1027
Total cold run time: 266948 ms
Total hot run time: 179714 ms

@hello-stephen

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

query1	0.01	0.00	0.00
query2	0.09	0.05	0.05
query3	0.25	0.14	0.13
query4	1.61	0.14	0.14
query5	0.23	0.22	0.22
query6	1.24	1.04	1.14
query7	0.03	0.01	0.00
query8	0.06	0.04	0.04
query9	0.39	0.32	0.32
query10	0.55	0.56	0.55
query11	0.19	0.14	0.14
query12	0.20	0.14	0.14
query13	0.48	0.47	0.47
query14	1.02	1.00	1.01
query15	0.62	0.58	0.60
query16	0.32	0.34	0.32
query17	1.10	1.05	1.08
query18	0.25	0.21	0.22
query19	2.07	1.98	1.95
query20	0.02	0.02	0.01
query21	15.44	0.23	0.13
query22	4.75	0.06	0.05
query23	16.12	0.31	0.12
query24	3.07	0.46	0.36
query25	0.12	0.05	0.04
query26	0.73	0.21	0.15
query27	0.04	0.04	0.04
query28	3.52	0.90	0.52
query29	12.45	4.07	3.20
query30	0.27	0.16	0.16
query31	2.78	0.59	0.31
query32	3.22	0.60	0.48
query33	3.14	3.18	3.15
query34	15.77	4.28	3.54
query35	3.56	3.55	3.56
query36	0.56	0.44	0.41
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.17	0.15
query41	0.09	0.04	0.03
query42	0.04	0.02	0.02
query43	0.04	0.03	0.04
Total cold run time: 96.8 s
Total hot run time: 24.93 s

@hello-stephen

Copy link
Copy Markdown
Contributor

FE Regression Coverage Report

Increment line coverage 53.85% (35/65) 🎉
Increment coverage report
Complete coverage report

@englefly

Copy link
Copy Markdown
Contributor Author

run buildall

@hello-stephen

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

------ Round 1 ----------------------------------
============================================
q1	17689	4014	4054	4014
q2	2071	317	218	218
q3	10324	1370	812	812
q4	4696	478	335	335
q5	7493	883	573	573
q6	183	176	139	139
q7	775	828	632	632
q8	9331	1495	1562	1495
q9	5719	4389	4427	4389
q10	6818	1810	1544	1544
q11	498	340	328	328
q12	689	542	422	422
q13	18140	3351	2766	2766
q14	266	262	241	241
q15	q16	798	784	723	723
q17	1017	884	887	884
q18	7102	5814	5515	5515
q19	1351	1274	1007	1007
q20	775	637	550	550
q21	5956	2614	2458	2458
q22	440	354	292	292
Total cold run time: 102131 ms
Total hot run time: 29337 ms

----- Round 2, with runtime_filter_mode=off -----
============================================
q1	4339	4292	4314	4292
q2	287	313	220	220
q3	4583	4971	4445	4445
q4	2053	2167	1351	1351
q5	4443	4324	4337	4324
q6	235	172	127	127
q7	1766	1812	1911	1812
q8	2556	2175	2193	2175
q9	8069	8199	7797	7797
q10	4788	4724	4277	4277
q11	585	419	394	394
q12	766	774	567	567
q13	3211	3670	2996	2996
q14	299	301	268	268
q15	q16	738	741	652	652
q17	1346	1316	1301	1301
q18	7961	7210	7355	7210
q19	1131	1109	1040	1040
q20	2210	2208	1935	1935
q21	5219	4606	4427	4427
q22	504	452	394	394
Total cold run time: 57089 ms
Total hot run time: 52004 ms

@hello-stephen

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

query5	4352	621	498	498
query6	469	215	213	213
query7	4844	636	357	357
query8	352	187	171	171
query9	8756	4034	4034	4034
query10	482	389	305	305
query11	5901	2372	2162	2162
query12	161	105	100	100
query13	1262	614	407	407
query14	6291	5311	4951	4951
query14_1	4285	4260	4293	4260
query15	219	209	181	181
query16	1013	493	492	492
query17	946	777	579	579
query18	2461	491	363	363
query19	216	194	162	162
query20	116	108	107	107
query21	230	157	136	136
query22	13711	13601	13425	13425
query23	17565	16563	16255	16255
query23_1	16397	16602	16756	16602
query24	7608	1780	1307	1307
query24_1	1328	1319	1307	1307
query25	589	478	404	404
query26	1362	351	212	212
query27	2582	581	371	371
query28	4491	2042	2004	2004
query29	1085	657	507	507
query30	348	273	236	236
query31	1125	1099	978	978
query32	110	65	63	63
query33	577	307	244	244
query34	1176	1139	660	660
query35	760	816	657	657
query36	1429	1404	1214	1214
query37	147	103	89	89
query38	1879	1699	1646	1646
query39	920	912	891	891
query39_1	878	893	880	880
query40	245	161	137	137
query41	63	60	61	60
query42	95	91	90	90
query43	319	319	281	281
query44	1423	791	772	772
query45	202	190	182	182
query46	1079	1176	749	749
query47	2346	2364	2271	2271
query48	410	411	301	301
query49	575	431	327	327
query50	1088	443	341	341
query51	10951	10686	10611	10611
query52	87	85	73	73
query53	260	288	211	211
query54	277	238	227	227
query55	79	74	67	67
query56	297	291	269	269
query57	1445	1430	1350	1350
query58	284	266	256	256
query59	1544	1648	1397	1397
query60	304	271	257	257
query61	150	153	149	149
query62	692	657	600	600
query63	248	204	208	204
query64	2825	1081	831	831
query65	4853	4756	4819	4756
query66	1813	501	386	386
query67	29567	29503	28847	28847
query68	3215	1582	1064	1064
query69	472	295	267	267
query70	1070	972	975	972
query71	352	321	325	321
query72	3358	2716	2409	2409
query73	881	815	433	433
query74	5114	4933	4760	4760
query75	2607	2595	2203	2203
query76	2309	1160	766	766
query77	357	386	274	274
query78	12274	12231	11724	11724
query79	1359	1143	766	766
query80	1275	532	451	451
query81	506	324	282	282
query82	572	163	124	124
query83	405	323	299	299
query84	331	156	131	131
query85	1009	621	525	525
query86	433	287	282	282
query87	1827	1826	1753	1753
query88	3727	2838	2794	2794
query89	449	415	344	344
query90	1869	201	198	198
query91	202	191	159	159
query92	66	62	59	59
query93	1592	1504	984	984
query94	691	361	307	307
query95	792	496	550	496
query96	1034	815	347	347
query97	2694	2745	2554	2554
query98	219	214	206	206
query99	1176	1164	1028	1028
Total cold run time: 266533 ms
Total hot run time: 181053 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 04969c35f401044636bcc6e87070bebbb818d5cf, data reload: false

query1	0.01	0.01	0.01
query2	0.10	0.05	0.05
query3	0.26	0.15	0.14
query4	1.62	0.14	0.14
query5	0.27	0.23	0.23
query6	1.28	1.07	1.06
query7	0.04	0.01	0.00
query8	0.05	0.04	0.03
query9	0.39	0.31	0.33
query10	0.56	0.55	0.57
query11	0.20	0.14	0.14
query12	0.18	0.15	0.15
query13	0.47	0.49	0.48
query14	1.03	1.02	1.01
query15	0.61	0.59	0.59
query16	0.31	0.32	0.30
query17	1.12	1.10	1.10
query18	0.22	0.21	0.22
query19	2.05	1.94	1.94
query20	0.02	0.01	0.02
query21	15.44	0.22	0.13
query22	4.92	0.06	0.05
query23	16.12	0.31	0.12
query24	2.98	0.43	0.29
query25	0.11	0.04	0.04
query26	0.73	0.22	0.16
query27	0.04	0.04	0.03
query28	3.46	0.96	0.53
query29	12.48	4.12	3.31
query30	0.28	0.15	0.17
query31	2.77	0.58	0.32
query32	3.22	0.60	0.48
query33	3.18	3.30	3.27
query34	15.72	4.27	3.51
query35	3.53	3.56	3.54
query36	0.55	0.42	0.46
query37	0.09	0.07	0.06
query38	0.05	0.03	0.03
query39	0.04	0.03	0.02
query40	0.18	0.16	0.15
query41	0.09	0.03	0.02
query42	0.03	0.03	0.03
query43	0.04	0.04	0.03
Total cold run time: 96.84 s
Total hot run time: 25.14 s

@hello-stephen

Copy link
Copy Markdown
Contributor

FE UT Coverage Report

Increment line coverage 55.38% (36/65) 🎉
Increment coverage report
Complete coverage report

@hello-stephen

Copy link
Copy Markdown
Contributor

FE Regression Coverage Report

Increment line coverage 24.82% (35/141) 🎉
Increment coverage report
Complete coverage report

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

Copy link
Copy Markdown
Contributor

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

@englefly

Copy link
Copy Markdown
Contributor Author

/review

@github-actions

Copy link
Copy Markdown
Contributor

PR approved by anyone and no changes requested.

@github-actions

Copy link
Copy Markdown
Contributor

Codex automated review failed and did not complete.

Error: Review step was skipped (possibly timeout or cancelled)
Workflow run: https://github.com/apache/doris/actions/runs/29304342008

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

@englefly

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 after 3 rounds. I found three blocking shape-rendering regressions and left inline comments.

Checkpoint summary:

  • Correctness/regression risk: the PR improves many wrapper paths, but special function renderers, PhysicalQuickSort detail order keys, and runtime-filter endpoints still bypass the intended shapeInfo recursion.
  • Tests/coverage: existing coverage does not exercise crypto masking, high-order Lambda recursion, detail_shape_nodes='PhysicalQuickSort', or qualified runtime-filter endpoints.
  • Scope/generated output: the source scope is focused and the broad .out churn is consistent with shape-plan text changes. The Count() / partial_count() regression remains current but was already raised in discussion_r3528093987, so I did not duplicate it.
  • Compatibility/parallel paths: missed parallel renderers are the main issue. I did not find separate concurrency, lifecycle, config, persistence, data-write, or FE/BE protocol concerns in this PR.
  • User focus: no additional user-provided review focus was supplied.
  • Validation: static review only; no builds or tests were run per the review prompt.

int arity = arity();
for (int i = 0; i < arity; i++) {
Expression arg = child(i);
sql.append(arg.shapeInfo());

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.

This generic renderer skips special rendering that previously came through toSql(), and there are at least two current regressions. CryptoFunction.computeToSql()/toString() intentionally mask argument 1 as '***', but AES/SM4 functions inherit this new shapeInfo() and now render the real key literal through arg.shapeInfo(). High-order functions have the same recursion gap: expressions such as array_map and array_filter/array_sort-style paths can reach a Lambda child, Lambda has no shapeInfo() override, and Lambda.computeToSql() renders its body and array arguments with toSql(), so qualifiers inside lambda expressions are still lost. Please keep the generic recursion, but add the needed shapeInfo() overrides for these special renderers and cover both cases with shape-info tests.

return isAsc == that.isAsc() && nullFirst == that.isNullFirst() && expr.equals(that.getExpr());
}

public String shapeInfo() {

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.

This helper fixes callers that use it, but the detailed sort shape path still bypasses it. PhysicalQuickSort.shapeInfo() renders detailed order keys with orderKeys.stream().map(OrderKey::toSql) when detail_shape_nodes contains PhysicalQuickSort, so a joined query sorted by qualified slots can still print ambiguous keys there even though adjacent project/filter expressions now use shapeInfo(). Please switch that call site to OrderKey::shapeInfo and add a detail_shape_nodes='PhysicalQuickSort' regression with qualified sort keys.

--------PhysicalTopN[LOCAL_SORT]
----------PhysicalProject
------------hashJoin[INNER_JOIN colocated] hashCondition=((ss_items.item_id = ws_items.item_id)) otherCondition=((cast(cs_item_rev as DECIMALV3(38, 3)) <= (1.1 * ws_items.ws_item_rev)) and (cast(cs_item_rev as DECIMALV3(38, 3)) >= (0.9 * ws_items.ws_item_rev)) and (cast(ss_item_rev as DECIMALV3(38, 3)) <= (1.1 * ws_items.ws_item_rev)) and (cast(ss_item_rev as DECIMALV3(38, 3)) >= (0.9 * ws_items.ws_item_rev)) and (cast(ws_item_rev as DECIMALV3(38, 3)) <= (1.1 * cs_items.cs_item_rev)) and (cast(ws_item_rev as DECIMALV3(38, 3)) <= (1.1 * ss_items.ss_item_rev)) and (cast(ws_item_rev as DECIMALV3(38, 3)) >= (0.9 * cs_items.cs_item_rev)) and (cast(ws_item_rev as DECIMALV3(38, 3)) >= (0.9 * ss_items.ss_item_rev))) build RFs:RF13 item_id->i_item_id;RF14 item_id->i_item_id
------------hashJoin[INNER_JOIN colocated] hashCondition=((ss_items.item_id = ws_items.item_id)) otherCondition=((cast(cs_items.cs_item_rev as DECIMALV3(38, 3)) <= (1.1 * ws_items.ws_item_rev)) and (cast(cs_items.cs_item_rev as DECIMALV3(38, 3)) >= (0.9 * ws_items.ws_item_rev)) and (cast(ss_items.ss_item_rev as DECIMALV3(38, 3)) <= (1.1 * ws_items.ws_item_rev)) and (cast(ss_items.ss_item_rev as DECIMALV3(38, 3)) >= (0.9 * ws_items.ws_item_rev)) and (cast(ws_items.ws_item_rev as DECIMALV3(38, 3)) <= (1.1 * cs_items.cs_item_rev)) and (cast(ws_items.ws_item_rev as DECIMALV3(38, 3)) <= (1.1 * ss_items.ss_item_rev)) and (cast(ws_items.ws_item_rev as DECIMALV3(38, 3)) >= (0.9 * cs_items.cs_item_rev)) and (cast(ws_items.ws_item_rev as DECIMALV3(38, 3)) >= (0.9 * ss_items.ss_item_rev))) build RFs:RF13 item_id->i_item_id;RF14 item_id->i_item_id

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.

This output still exposes another shape renderer that did not move from toSql() to shapeInfo(): the join predicates are now qualified, but the build RFs endpoints remain item_id->i_item_id. PhysicalHashJoin.shapeInfo() gets this text from RuntimeFilter.shapeInfo(), which currently formats both getSrcExpr() and targetExpression with toSql(). Please change that runtime-filter renderer to use shapeInfo() for both sides and refresh/add coverage with qualified RF endpoints.

@englefly
englefly merged commit b2ed598 into apache:master Jul 16, 2026
33 checks passed
@englefly
englefly deleted the aggFuncPrint branch July 16, 2026 00:26
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.

3 participants