Skip to content

[Enhance](ai_func) Support dedicate embed properties in AI RESOURCE - #67673

Open
linrrzqqq wants to merge 6 commits into
apache:masterfrom
linrrzqqq:embed-resource
Open

linrrzqqq wants to merge 6 commits into
apache:masterfrom
linrrzqqq:embed-resource

Conversation

@linrrzqqq

@linrrzqqq linrrzqqq commented Sep 8, 2026

Copy link
Copy Markdown
Collaborator

What problem does this PR solve?

Issue Number: close #xxx

Related PR: #xxx

Problem Summary:

  • Add dedicated embedding properties to AI resources:
    • ai.embed.endpoint
    • ai.embed.provider_type
    • ai.embed.model_name
    • ai.embed.api_key
  • Require at least one complete property group when creating an AI resource:
    • the general ai.* group, or
    • the ai.embed.* group
  • Use ai.embed.* when executing the EMBED function if the embed property group is configured.
  • Fall back to the general ai.* properties otherwise.
  • Mask ai.embed.api_key when displaying resource properties.
  • Keep other AI functions using the general ai.* properties.
Doris> CREATE RESOURCE 'default_combine_resource'
    -> PROPERTIES (
    ->     'type'='ai',
    ->     'ai.provider_type'='deepseek',
    ->     'ai.endpoint'='https://api.deepseek.com/chat/completions',
    ->     'ai.model_name' = 'deepseek-v4-flash',
    ->     'ai.api_key' = 'sk-aaa',
    ->     'ai.embed.provider_type'='qwen',
    ->     'ai.embed.endpoint'='https://dashscope.aliyuncs.com/compatible-mode/v1/embeddings',
    ->     'ai.embed.model_name' = 'text-embedding-v4',
    ->     'ai.embed.api_key' = 'sk-bbb',
    ->     'ai.dimensions' = '1024'
    -> );
Query OK, 0 rows affected (0.026 sec)

Doris> set default_ai_resource = 'default_combine_resource';
Query OK, 0 rows affected (0.009 sec)

Doris> SELECT array_size(EMBED('this is a test'));
+-------------------------------------+
| array_size(EMBED('this is a test')) |
+-------------------------------------+
|                                1024 |
+-------------------------------------+
1 row in set (1.729 sec)

Doris> EXPLAIN SELECT array_size(EMBED('this is a test'));
+---------------------------------------------------------------------------+
| Explain String(Nereids Planner)                                           |
+---------------------------------------------------------------------------+
| PLAN FRAGMENT 0                                                           |
|   OUTPUT EXPRS:                                                           |
|     array_size(EMBED('this is a test'))[#0]                               |
|   PARTITION: UNPARTITIONED                                                |
|                                                                           |
|   HAS_COLO_PLAN_NODE: false                                               |
|                                                                           |
|   VRESULT SINK                                                            |
|      MYSQL_PROTOCOL                                                       |
|                                                                           |
|   0:VUNION(11)                                                            |
|      constant exprs:                                                      |
|          cardinality(embed('default_combine_resource', 'this is a test')) |
|                                                                           |
|                                                                           |
|                                                                           |
| ========== STATISTICS ==========                                          |
+---------------------------------------------------------------------------+
17 rows in set (0.030 sec)

Doris> SELECT AI_TRANSLATE('this is a test', 'chinese');
+-------------------------------------------+
| AI_TRANSLATE('this is a test', 'chinese') |
+-------------------------------------------+
| 这是一个测试                              |
+-------------------------------------------+
1 row in set (1.269 sec)

Doris> EXPLAIN SELECT AI_TRANSLATE('this is a test', 'chinese');
+--------------------------------------------------------------------------------+
| Explain String(Nereids Planner)                                                |
+--------------------------------------------------------------------------------+
| PLAN FRAGMENT 0                                                                |
|   OUTPUT EXPRS:                                                                |
|     AI_TRANSLATE('this is a test', 'chinese')[#0]                              |
|   PARTITION: UNPARTITIONED                                                     |
|                                                                                |
|   HAS_COLO_PLAN_NODE: false                                                    |
|                                                                                |
|   VRESULT SINK                                                                 |
|      MYSQL_PROTOCOL                                                            |
|                                                                                |
|   0:VUNION(11)                                                                 |
|      constant exprs:                                                           |
|          ai_translate('default_combine_resource', 'this is a test', 'chinese') |
|                                                                                |
|                                                                                |
|                                                                                |
| ========== STATISTICS ==========                                               |
+--------------------------------------------------------------------------------+
17 rows in set (0.010 sec)

Release note

None

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

@linrrzqqq

Copy link
Copy Markdown
Collaborator Author

run buildall

@hello-stephen

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

------ Round 1 ----------------------------------
============================================
q1	17562	3116	3059	3059
q2	2114	292	221	221
q3	10180	908	536	536
q4	4670	253	202	202
q5	7675	574	410	410
q6	141	121	95	95
q7	536	506	385	385
q8	9223	874	890	874
q9	3420	2386	2395	2386
q10	6513	851	715	715
q11	401	198	178	178
q12	614	271	209	209
q13	18105	1517	1148	1148
q14	155	153	138	138
q15	q16	437	400	372	372
q17	1336	849	755	755
q18	3067	2252	2248	2248
q19	1106	948	721	721
q20	370	284	200	200
q21	4818	1820	1931	1820
q22	329	275	230	230
Total cold run time: 92772 ms
Total hot run time: 16902 ms

----- Round 2, with runtime_filter_mode=off -----
============================================
q1	3442	3423	3387	3387
q2	506	406	381	381
q3	2237	2312	2144	2144
q4	1201	1181	903	903
q5	2198	2155	2141	2141
q6	175	120	89	89
q7	1034	951	856	856
q8	1611	1422	1423	1422
q9	3147	3140	3125	3125
q10	1862	1810	1631	1631
q11	364	281	262	262
q12	457	437	342	342
q13	1479	1541	1163	1163
q14	183	165	169	165
q15	q16	402	410	364	364
q17	3641	3389	3325	3325
q18	4823	4417	4773	4417
q19	853	891	880	880
q20	1005	952	843	843
q21	3943	3185	3337	3185
q22	400	341	316	316
Total cold run time: 34963 ms
Total hot run time: 31341 ms

@hello-stephen

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

query5	4243	420	356	356
query6	385	134	121	121
query7	4939	420	221	221
query8	290	129	123	123
query9	8681	2956	2960	2956
query10	381	235	183	183
query11	5374	1043	954	954
query12	122	76	69	69
query13	1191	426	285	285
query14	6174	2215	2100	2100
query14_1	1995	1972	1992	1972
query15	173	120	111	111
query16	923	411	381	381
query17	788	472	368	368
query18	2352	328	242	242
query19	164	140	113	113
query20	74	71	70	70
query21	203	102	89	89
query22	5301	5402	5415	5402
query23	6730	6291	6047	6047
query23_1	6067	6039	6153	6039
query24	7257	1114	792	792
query24_1	800	764	771	764
query25	428	301	265	265
query26	1241	228	136	136
query27	2798	430	265	265
query28	4652	1521	1514	1514
query29	938	443	365	365
query30	253	154	133	133
query31	842	427	331	331
query32	133	75	81	75
query33	466	224	182	182
query34	1000	845	471	471
query35	418	410	353	353
query36	567	562	542	542
query37	120	90	74	74
query38	1013	850	835	835
query39	509	508	478	478
query39_1	494	465	474	465
query40	201	94	92	92
query41	61	58	57	57
query42	76	74	77	74
query43	244	244	212	212
query44	1017	542	568	542
query45	119	106	108	106
query46	757	818	520	520
query47	777	777	710	710
query48	307	315	248	248
query49	544	249	241	241
query50	797	275	198	198
query51	8047	7930	8011	7930
query52	66	67	63	63
query53	192	202	144	144
query54	202	160	146	146
query55	76	59	61	59
query56	185	157	216	157
query57	720	674	653	653
query58	198	168	161	161
query59	1223	1241	1106	1106
query60	233	176	178	176
query61	122	118	119	118
query62	345	205	183	183
query63	170	138	142	138
query64	2826	694	603	603
query65	1650	1543	1589	1543
query66	1951	268	212	212
query67	9976	9896	9708	9708
query68	3013	1114	702	702
query69	358	222	200	200
query70	656	631	639	631
query71	259	182	168	168
query72	2338	1715	1538	1538
query73	637	646	356	356
query74	2006	1237	1147	1147
query75	1195	1105	970	970
query76	2380	740	537	537
query77	259	274	219	219
query78	3839	3727	3316	3316
query79	2226	825	621	621
query80	1619	341	287	287
query81	494	157	138	138
query82	620	116	100	100
query83	284	215	195	195
query84	294	111	89	89
query85	774	338	288	288
query86	391	175	169	169
query87	1033	976	917	917
query88	2771	2102	2130	2102
query89	276	197	178	178
query90	1993	136	130	130
query91	131	117	102	102
query92	83	66	60	60
query93	1405	1056	720	720
query94	640	288	220	220
query95	543	335	224	224
query96	799	584	265	265
query97	1091	1040	1016	1016
query98	146	140	132	132
query99	424	360	313	313
Total cold run time: 177972 ms
Total hot run time: 82606 ms

@hello-stephen

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

query1	0.01	0.00	0.01
query2	0.07	0.04	0.04
query3	0.24	0.11	0.11
query4	1.61	0.10	0.09
query5	0.18	0.17	0.16
query6	1.28	0.72	0.68
query7	0.03	0.01	0.01
query8	0.05	0.03	0.03
query9	0.29	0.21	0.23
query10	0.36	0.35	0.36
query11	0.16	0.13	0.11
query12	0.15	0.13	0.13
query13	0.32	0.32	0.32
query14	0.46	0.45	0.46
query15	0.39	0.35	0.37
query16	0.24	0.23	0.24
query17	0.72	0.70	0.69
query18	0.20	0.17	0.17
query19	1.27	1.13	1.20
query20	0.02	0.01	0.01
query21	15.44	0.16	0.11
query22	5.09	0.05	0.04
query23	16.16	0.26	0.10
query24	2.95	0.33	0.26
query25	0.10	0.06	0.03
query26	0.76	0.17	0.13
query27	0.04	0.03	0.03
query28	3.64	0.57	0.28
query29	12.44	3.19	2.58
query30	0.27	0.11	0.12
query31	2.76	0.35	0.17
query32	3.54	0.31	0.23
query33	1.51	1.40	1.41
query34	15.43	2.18	1.78
query35	1.79	1.76	1.77
query36	0.45	0.30	0.29
query37	0.06	0.03	0.03
query38	0.04	0.03	0.02
query39	0.04	0.02	0.02
query40	0.12	0.07	0.08
query41	0.08	0.03	0.03
query42	0.04	0.02	0.02
query43	0.03	0.03	0.03
Total cold run time: 90.83 s
Total hot run time: 14.79 s

@hello-stephen

Copy link
Copy Markdown
Contributor

FE UT Coverage Report

Increment line coverage 87.50% (7/8) 🎉
Increment coverage report
Complete coverage report

@hello-stephen

Copy link
Copy Markdown
Contributor

FE Regression Coverage Report

Increment line coverage 25.00% (2/8) 🎉
Increment coverage report
Complete coverage report

@linrrzqqq linrrzqqq changed the title [Enhance](ai_func) Support two default embed resource session var [Enhance](ai_func) Support dedicate embed properties in AI RESOURCE Sep 9, 2026
@linrrzqqq

Copy link
Copy Markdown
Collaborator 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 code review status: complete after two rounds; requesting changes on exact head 484656bbabce227f611309fa8f58a41efe6f6ee3 for five issues.

Findings: embed-only resources can crash non-EMBED scalar and aggregate consumers; the new embed API key is omitted from statement/audit masking; ALTER discards provider normalization; ALTER can persist a partial dedicated group that the BE selects; and concurrent ALTER/query planning can serialize a partial or mixed group.

Checkpoint conclusions:

  • Goal and correctness: dedicated EMBED routing, legacy fallback, and shared tuning-field copying are present, but the five inline findings prevent the feature from being safe across its legal resource lifecycle.
  • Scope and simplicity: the nine-file change is focused; no unrelated refactor was found.
  • Concurrency: the new multi-key group exposes the existing lock-free toThrift reader as an actionable partial-snapshot race (inline finding). No separate BE query-context race or lock-order issue was found.
  • Lifecycle, configuration, performance, and observability: no new static/thread lifecycle, configuration item, material hot-path cost, or metric requirement was introduced.
  • Compatibility and FE/BE propagation: both production FE send paths populate the new fields. Legacy resources fall back correctly. The documented BE-first rolling-upgrade direction (old FE to new BE) is safe; the technically unsafe FE-first direction is not a supported topology, so no compatibility comment was filed.
  • Parallel and conditional paths: non-EMBED scalar functions and AI_AGG lack the new group-capability check, and the any-field selector is unsafe when validity checks are skipped; both are inline findings. Text and multimodal EMBED otherwise share the selected resource correctly.
  • Persistence, transactions, and writes: the property-map image/journal path preserves the new keys and aggregate state bytes are unchanged; no table-data or transaction path is involved. ALTER normalization, structural validation, and snapshot atomicity are covered by the inline findings.
  • Tests and results: the added tests cover create-time validation, create-time normalization, proc masking, dedicated selection, shared dimensions, and legacy fallback, but miss the five negative/audit/ALTER/concurrency cases. Per the review prompt, no local build or test suite was run; git diff --check passes. Current CI shows CheckStyle and secret scanning passing, Clang Formatter failing, and build/test jobs skipped.

Comment thread be/src/exprs/function/ai/embed.h Outdated
Comment thread fe/fe-core/src/main/java/org/apache/doris/catalog/AIResource.java
@linrrzqqq

Copy link
Copy Markdown
Collaborator Author

run buildall

@hello-stephen

Copy link
Copy Markdown
Contributor

Cloud UT Coverage Report

Increment line coverage 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 77.53% (2056/2652)
Line Coverage 65.75% (37613/57205)
Region Coverage 52.96% (35051/66180)
Branch Coverage 56.44% (11264/19958)

@hello-stephen

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

------ Round 1 ----------------------------------
============================================
q1	17634	3049	3025	3025
q2	2086	264	270	264
q3	10195	850	506	506
q4	4676	264	204	204
q5	7659	575	383	383
q6	143	117	98	98
q7	539	552	386	386
q8	9232	915	862	862
q9	3456	2443	2405	2405
q10	6504	872	737	737
q11	395	196	181	181
q12	609	263	198	198
q13	18143	1555	1157	1157
q14	161	152	142	142
q15	q16	445	401	368	368
q17	1406	984	839	839
q18	3161	2346	2314	2314
q19	1124	877	777	777
q20	376	286	209	209
q21	5273	1767	1849	1767
q22	333	274	235	235
Total cold run time: 93550 ms
Total hot run time: 17057 ms

----- Round 2, with runtime_filter_mode=off -----
============================================
q1	3392	3311	3287	3287
q2	510	386	397	386
q3	2260	2341	2178	2178
q4	1220	1199	904	904
q5	2215	2198	2141	2141
q6	169	118	87	87
q7	1052	924	866	866
q8	1579	1394	1403	1394
q9	3239	3203	3207	3203
q10	1903	1838	1683	1683
q11	355	274	258	258
q12	457	434	344	344
q13	1482	1565	1175	1175
q14	181	173	156	156
q15	q16	394	399	364	364
q17	3697	3331	3211	3211
q18	4944	4563	4843	4563
q19	1036	855	867	855
q20	1042	993	866	866
q21	3826	3198	3262	3198
q22	397	340	330	330
Total cold run time: 35350 ms
Total hot run time: 31449 ms

@hello-stephen

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

query5	4279	418	340	340
query6	383	139	125	125
query7	4952	410	228	228
query8	281	127	121	121
query9	8705	2869	2877	2869
query10	390	228	187	187
query11	5375	1064	926	926
query12	116	74	70	70
query13	1190	445	315	315
query14	6160	2319	2183	2183
query14_1	2082	2061	2110	2061
query15	172	121	117	117
query16	928	394	359	359
query17	793	475	340	340
query18	2320	307	231	231
query19	164	130	101	101
query20	74	68	70	68
query21	200	100	85	85
query22	5716	5526	5437	5437
query23	6828	6487	6198	6198
query23_1	6220	6021	6240	6021
query24	7254	1112	744	744
query24_1	747	765	771	765
query25	395	273	230	230
query26	1233	216	131	131
query27	2804	379	244	244
query28	4756	1475	1484	1475
query29	915	443	329	329
query30	246	156	130	130
query31	821	412	344	344
query32	129	79	86	79
query33	468	215	170	170
query34	1010	838	477	477
query35	411	411	353	353
query36	566	581	520	520
query37	121	84	68	68
query38	1027	889	833	833
query39	486	483	492	483
query39_1	442	474	463	463
query40	205	90	78	78
query41	55	57	57	57
query42	74	78	73	73
query43	248	249	216	216
query44	993	542	542	542
query45	115	106	106	106
query46	822	811	515	515
query47	760	779	716	716
query48	312	320	250	250
query49	566	256	204	204
query50	759	265	198	198
query51	8042	8002	8081	8002
query52	72	76	62	62
query53	197	205	173	173
query54	301	188	169	169
query55	88	67	65	65
query56	204	175	186	175
query57	716	685	669	669
query58	207	173	169	169
query59	1262	1279	1124	1124
query60	237	174	183	174
query61	126	107	107	107
query62	349	203	193	193
query63	174	143	139	139
query64	2681	678	597	597
query65	1689	1658	1687	1658
query66	1786	252	198	198
query67	9986	11355	10982	10982
query68	2995	1234	728	728
query69	328	218	202	202
query70	657	632	618	618
query71	242	183	166	166
query72	2267	1671	1521	1521
query73	655	602	322	322
query74	2011	1241	1150	1150
query75	1183	1108	966	966
query76	2343	744	524	524
query77	254	273	220	220
query78	4244	3840	3299	3299
query79	2766	823	580	580
query80	1570	312	280	280
query81	515	154	136	136
query82	616	126	97	97
query83	274	215	199	199
query84	301	109	90	90
query85	795	349	281	281
query86	497	178	161	161
query87	1039	998	906	906
query88	3029	2134	2117	2117
query89	274	197	176	176
query90	2158	139	130	130
query91	129	117	99	99
query92	99	73	71	71
query93	2020	1038	733	733
query94	643	249	225	225
query95	527	334	231	231
query96	818	592	281	281
query97	1095	1105	1051	1051
query98	177	145	135	135
query99	423	359	320	320
Total cold run time: 180556 ms
Total hot run time: 84058 ms

@hello-stephen

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

query1	0.01	0.00	0.01
query2	0.08	0.03	0.04
query3	0.25	0.11	0.11
query4	1.60	0.09	0.10
query5	0.17	0.17	0.15
query6	1.24	0.71	0.72
query7	0.04	0.01	0.00
query8	0.04	0.03	0.03
query9	0.28	0.20	0.21
query10	0.34	0.35	0.38
query11	0.16	0.12	0.12
query12	0.16	0.12	0.13
query13	0.31	0.31	0.30
query14	0.48	0.46	0.46
query15	0.39	0.36	0.36
query16	0.21	0.23	0.23
query17	0.74	0.73	0.70
query18	0.17	0.17	0.16
query19	1.20	1.18	1.13
query20	0.02	0.01	0.01
query21	15.46	0.17	0.11
query22	5.05	0.05	0.04
query23	16.17	0.25	0.10
query24	3.02	0.30	0.27
query25	0.12	0.04	0.04
query26	0.83	0.16	0.12
query27	0.04	0.02	0.03
query28	3.64	0.54	0.29
query29	12.47	3.16	2.58
query30	0.26	0.11	0.12
query31	2.76	0.38	0.17
query32	3.52	0.32	0.25
query33	1.39	1.48	1.50
query34	15.34	2.20	1.77
query35	1.77	1.72	1.75
query36	0.46	0.29	0.29
query37	0.06	0.04	0.03
query38	0.05	0.03	0.03
query39	0.03	0.02	0.02
query40	0.12	0.08	0.08
query41	0.07	0.02	0.02
query42	0.03	0.02	0.02
query43	0.03	0.03	0.03
Total cold run time: 90.58 s
Total hot run time: 14.85 s

@hello-stephen

Copy link
Copy Markdown
Contributor

FE UT Coverage Report

Increment line coverage 88.33% (53/60) 🎉
Increment coverage report
Complete coverage report

@hello-stephen

Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 100.00% (52/52) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 76.36% (34884/45684)
Line Coverage 61.49% (393961/640738)
Region Coverage 57.72% (331305/573949)
Branch Coverage 58.49% (151173/258442)

@hello-stephen

Copy link
Copy Markdown
Contributor

FE Regression Coverage Report

Increment line coverage 43.33% (26/60) 🎉
Increment coverage report
Complete coverage report

@linrrzqqq
linrrzqqq force-pushed the embed-resource branch 2 times, most recently from 938e698 to 064a5ba Compare September 10, 2026 03:13
@linrrzqqq

Copy link
Copy Markdown
Collaborator Author

run buildall

@hello-stephen

Copy link
Copy Markdown
Contributor

Cloud UT Coverage Report

Increment line coverage 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 77.53% (2056/2652)
Line Coverage 65.84% (37662/57205)
Region Coverage 53.06% (35113/66180)
Branch Coverage 56.48% (11272/19958)

@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 of 064a5ba559ae73b5ec73bd6fc297f916df21e53d: requesting changes for two distinct current-head issues.

The dedicated embedding-property flow is coherent in its basic CREATE, planning, Thrift, and BE selection paths, but the new effort member breaks the existing distributed AI_AGG state format during a supported mixed-BE rollout, and the shared effort allowlist accepts configurations that a selected provider rejects. No additional user focus was supplied, so the full 15-file change was reviewed.

Checkpoint conclusions:

  • Goal/tests: basic dedicated-group selection, masking, transport, and request-shape cases are covered; mixed-version aggregate state and provider-negative effort cases are missing.
  • Focus/scope: the patch is feature-focused, but it changes a private distributed state format and several provider contracts without their compatibility/validation mechanisms.
  • Concurrency: no new distinct issue survived; ALTER/serialization snapshot variants are already covered by existing review threads.
  • Lifecycle/static initialization: no static-init or dependency-cycle concern; the aggregate intermediate-state lifecycle exposes the P1 compatibility defect.
  • Configuration/dynamic behavior: ai.effort is persisted resource metadata, not a dynamic server config; its provider/model validation is the P2 issue.
  • Compatibility/rolling upgrade: M1 is reachable during the documented BE-first mixed-version phase. The raw embed-only Thrift mismatch was checked and dismissed because all BEs are upgraded before any FE under the supported procedure.
  • Parallel paths: both fragment builders, scalar AI functions, EMBED, AI_AGG, and OpenAI/Gemini/Anthropic-compatible request builders were traced.
  • Conditionals/invariants: dedicated-versus-general fallback and partial groups were checked; surviving partial-group cases are duplicate-fenced by existing threads.
  • Testing: FE UT and Cloud UT currently pass, as do formatter/style/license checks. Compile and performance statuses currently fail with authenticated TeamCity details unavailable, and BE UT is pending. No local build or tests were run for this read-only review.
  • Observability/errors: provider HTTP errors propagate through the existing status path; no separate logging/metrics defect was found.
  • Persistence/transactions/data writes: resource-map persistence and replay were reviewed; no new distinct transaction or table-write issue survived the existing ALTER threads.
  • FE/BE variables: the public Thrift fields are updated on both sides, but the separate AI_AGG byte format has no version route.
  • Performance: no material hot-path regression or new long-lived allocation was identified.
  • Final sweep: two review rounds converged with all Round 2 agents reporting NO_NEW_VALUABLE_FINDINGS; live threads were refreshed and both comments are non-duplicates.

Comment thread be/src/exprs/function/ai/ai_adapter.h
@linrrzqqq

Copy link
Copy Markdown
Collaborator 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.

Requesting changes on exact head f62b9872f5a8780e720f914a0ece336f565f0b57. I found five new, non-duplicated issues: one P1 lifecycle race that can reach fatal BE invariants and four P2 correctness/gate issues. Existing review threads were treated as hard duplicate fences.

Checkpoint conclusions:

  • Goal and proof: dedicated embed properties, fallback selection, general-consumer guards, key masking, effort transport, and version gating are present; direct unit tests cover the main happy paths, but the five inline findings prevent approval.
  • Scope/focus: all 20 authoritative changed-file entries match the diff. The embed work is localized, while the bundled effort field and exec-version bump expand the compatibility surface. No additional review focus was supplied.
  • Concurrency/lifecycle: AIResource.properties and the global resource-name map are shared across sessions. Mutation is locked, but validate/install and analysis/transport are not atomic; two inline findings cover those distinct gaps. Per-query BE copies and adapter ownership otherwise introduce no new leak or static-init issue.
  • Configuration/compatibility: no new dynamic server setting is added. FE and BE maximum exec versions both move from 14 to 15. Optional Thrift fields and the version-15 AI_AGG state format are internally matched for the supported BE-first rollout, and inspected aggregate paths propagate the negotiated version. The existing same-field wire-format thread is not repeated.
  • Parallel paths/conditions: both FE transport builders, explicit/default resources, both legality phases, scalar AI, AI_AGG, EMBED, dedicated/fallback selection, and normal/bucketed/streaming/spill/analytic/nullable aggregate paths were traced. Dedicated provider validation still lacks an embedding-capability contract.
  • Tests/results: test assertions and oracles were inspected. Exact-head CheckStyle and BE header hygiene pass. Exact-head Clang Formatter fails, reproduced non-mutatingly at the inline test line. No build or unit suite was run under the review-only prompt. Missing coverage includes the accepted concurrent ALTER, same-name replacement, unsupported embed provider, and effort-clear transitions.
  • Observability/persistence/writes: existing provider status/logging is adequate. Whole-resource Gson logging/replay carries the new keys, but atomic metadata mutation and optional-property clearing are defective as commented. No table-data write path changes.
  • FE-BE state/performance: both FE senders, generated Thrift presence, QueryContext installation, BE conversion, adapter configuration, and aggregate serialization were checked. No material hot-path CPU, allocation, or network-amplification regression was found.
  • Other: dedicated API-key masking is fixed on this head; no additional distinct issue survived three convergence rounds.

Comment thread fe/fe-core/src/main/java/org/apache/doris/catalog/AIResource.java
Comment thread be/test/ai/aggregate_function_ai_agg_test.cpp Outdated
Comment thread fe/fe-core/src/main/java/org/apache/doris/catalog/AIResource.java
@linrrzqqq

Copy link
Copy Markdown
Collaborator Author

run buildall

@hello-stephen

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

------ Round 1 ----------------------------------
============================================
q1	17559	3042	3044	3042
q2	2082	264	230	230
q3	10240	918	517	517
q4	4672	255	205	205
q5	7663	603	399	399
q6	138	113	96	96
q7	520	513	469	469
q8	9228	947	932	932
q9	3472	2429	2440	2429
q10	6541	881	736	736
q11	399	194	182	182
q12	616	268	201	201
q13	18120	1546	1174	1174
q14	159	156	149	149
q15	q16	442	403	373	373
q17	1391	816	835	816
q18	3101	2323	2314	2314
q19	1106	934	789	789
q20	376	287	199	199
q21	5391	1656	1878	1656
q22	332	271	227	227
Total cold run time: 93548 ms
Total hot run time: 17135 ms

----- Round 2, with runtime_filter_mode=off -----
============================================
q1	3441	3337	3346	3337
q2	506	396	383	383
q3	2273	2339	2198	2198
q4	1203	1195	906	906
q5	2213	2166	2142	2142
q6	169	129	91	91
q7	1055	964	896	896
q8	1613	1416	1407	1407
q9	3206	3182	3151	3151
q10	1903	1839	1639	1639
q11	360	278	251	251
q12	464	443	342	342
q13	1497	1545	1177	1177
q14	169	162	166	162
q15	q16	394	393	354	354
q17	3671	3394	3418	3394
q18	4867	4518	4943	4518
q19	964	878	877	877
q20	1045	977	840	840
q21	3892	3212	3239	3212
q22	401	346	320	320
Total cold run time: 35306 ms
Total hot run time: 31597 ms

@hello-stephen

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

query5	4247	411	341	341
query6	389	139	125	125
query7	4941	415	234	234
query8	308	131	131	131
query9	8695	2917	2932	2917
query10	395	221	175	175
query11	5368	1066	927	927
query12	121	73	72	72
query13	1199	445	320	320
query14	5973	2228	2113	2113
query14_1	2002	1983	1979	1979
query15	172	118	112	112
query16	916	390	354	354
query17	805	465	345	345
query18	2320	312	235	235
query19	150	131	105	105
query20	70	67	75	67
query21	197	102	86	86
query22	5504	5406	5354	5354
query23	6790	6185	6084	6084
query23_1	6144	6197	6396	6197
query24	7285	1098	758	758
query24_1	781	774	776	774
query25	421	278	229	229
query26	1241	237	131	131
query27	2790	419	244	244
query28	4699	1495	1510	1495
query29	908	420	326	326
query30	246	157	130	130
query31	812	403	330	330
query32	131	77	74	74
query33	459	216	182	182
query34	996	823	471	471
query35	398	397	344	344
query36	574	582	537	537
query37	119	83	66	66
query38	1013	873	834	834
query39	512	495	472	472
query39_1	492	445	474	445
query40	193	88	73	73
query41	55	51	52	51
query42	73	70	71	70
query43	237	240	209	209
query44	985	538	570	538
query45	114	103	100	100
query46	740	845	510	510
query47	770	762	712	712
query48	317	314	227	227
query49	541	250	191	191
query50	733	259	193	193
query51	8227	8197	8300	8197
query52	68	66	62	62
query53	199	203	155	155
query54	214	175	200	175
query55	74	58	56	56
query56	212	179	176	176
query57	701	668	647	647
query58	219	168	182	168
query59	1233	1244	1107	1107
query60	243	200	184	184
query61	132	133	132	132
query62	409	211	189	189
query63	177	139	152	139
query64	2937	774	659	659
query65	1668	1601	1633	1601
query66	1775	252	211	211
query67	10087	9980	9819	9819
query68	3037	1151	780	780
query69	345	226	189	189
query70	670	624	595	595
query71	249	184	160	160
query72	2282	1699	1519	1519
query73	669	612	328	328
query74	2014	1241	1141	1141
query75	1179	1130	979	979
query76	2396	722	536	536
query77	259	262	215	215
query78	4221	3804	3318	3318
query79	2723	841	615	615
query80	1576	333	282	282
query81	515	159	135	135
query82	612	122	99	99
query83	279	208	187	187
query84	298	114	88	88
query85	811	334	273	273
query86	472	197	161	161
query87	1023	981	923	923
query88	3060	2152	2108	2108
query89	279	199	178	178
query90	2142	134	130	130
query91	133	117	98	98
query92	98	61	71	61
query93	2138	1059	700	700
query94	653	259	216	216
query95	525	316	226	226
query96	841	610	266	266
query97	1098	1069	1023	1023
query98	176	134	140	134
query99	420	344	315	315
Total cold run time: 180532 ms
Total hot run time: 82809 ms

@hello-stephen

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

query1	0.01	0.01	0.01
query2	0.09	0.04	0.05
query3	0.26	0.12	0.11
query4	1.60	0.08	0.09
query5	0.18	0.16	0.16
query6	1.27	0.69	0.69
query7	0.04	0.01	0.01
query8	0.04	0.03	0.04
query9	0.29	0.22	0.21
query10	0.35	0.34	0.34
query11	0.17	0.12	0.12
query12	0.15	0.12	0.11
query13	0.31	0.30	0.31
query14	0.45	0.45	0.45
query15	0.37	0.35	0.36
query16	0.22	0.25	0.24
query17	0.71	0.70	0.69
query18	0.16	0.15	0.16
query19	1.17	1.22	1.15
query20	0.02	0.01	0.01
query21	15.45	0.17	0.11
query22	5.04	0.04	0.05
query23	16.19	0.26	0.11
query24	2.97	0.31	0.24
query25	0.11	0.04	0.04
query26	0.78	0.16	0.11
query27	0.04	0.03	0.03
query28	3.62	0.58	0.27
query29	12.45	3.20	2.56
query30	0.26	0.12	0.12
query31	2.76	0.38	0.17
query32	3.51	0.33	0.22
query33	1.50	1.44	1.52
query34	15.35	2.24	1.81
query35	1.81	1.76	1.76
query36	0.46	0.29	0.29
query37	0.06	0.04	0.04
query38	0.05	0.03	0.02
query39	0.03	0.03	0.02
query40	0.12	0.08	0.08
query41	0.08	0.02	0.02
query42	0.03	0.02	0.02
query43	0.03	0.03	0.03
Total cold run time: 90.56 s
Total hot run time: 14.8 s

@HappenLee

Copy link
Copy Markdown
Contributor

Reviewed commit 83a2ac73e5e5469ea3f1c83cafc31dbbb61dd89c. The dedicated embedding selection is straightforward, but I think the following resource validation and consistency issues need to be addressed.

  1. [P1] Keep the resource validated during analysis consistent with the resource sent to BE.

    The new general-group check validates one resource object, but the statement records only its name. A possible interleaving is: an AI_AGG query passes analysis against a resource with a complete general group; another session drops that resource and creates a valid embed-only resource with the same name; Coordinator.getNeededAiResources() or ThriftPlansBuilder.collectAiResources() then looks up the replacement and checks only its type. BE receives an empty general provider, and AggregateFunctionAIAggData::prepare() dereferences the null adapter returned by the factory. This is a less common concurrency scenario, but it is a direct null dereference, including in Release builds.

    Please retain the validated resource snapshot in the statement, or revalidate the required capabilities and obtain the same snapshot at transport time. Add a DROP/CREATE interleaving test. Taking a read lock only inside toThrift() would not address the identity change.

    References: analysis check, transport lookup, BE initialization.

  2. [P2] Persist the normalized provider produced by ALTER validation.

    requiredAIProperties(changedProperties) normalizes the provider in a temporary merged map, but modifyProperties() subsequently writes the original ALTER map. Consequently, lowercase openai passes validation but is persisted and forwarded unchanged. The BE adapter factory is case-sensitive and cannot resolve it.

    Concrete input:

    CREATE RESOURCE 'review_embed_case' PROPERTIES (
      'type'='ai',
      'ai.embed.provider_type'='OPENAI',
      'ai.embed.endpoint'='https://example.com/v1/embeddings',
      'ai.embed.model_name'='embedding-model',
      'ai.embed.api_key'='dummy-key',
      'ai.dimensions'='8'
    );
    ALTER RESOURCE 'review_embed_case' PROPERTIES (
      'ai.embed.provider_type'='openai'
    );
    SELECT EMBED('review_embed_case', 'hello');

    Positive dimensions intentionally avoid the pre-existing default-dimensions validation issue. Please install the validated and normalized merged snapshot, and cover ALTER plus persistence/replay and toThrift() in tests.

    References: normalization, ALTER implementation.

  3. [P2] Validate group completeness on ALTER regardless of ai.validity_check or LOCAL.

    When the general provider is LOCAL, or ai.validity_check=false, ALTER skips requiredAIProperties(). It can therefore persist only ai.embed.endpoint. The new selector treats any dedicated field as sufficient to select the entire dedicated group, resulting in an empty provider and a failed adapter invariant.

    CREATE RESOURCE 'review_embed_partial' PROPERTIES (
      'type'='ai',
      'ai.provider_type'='LOCAL',
      'ai.endpoint'='http://localhost:8000/v1/embeddings',
      'ai.model_name'='local-model'
    );
    ALTER RESOURCE 'review_embed_partial' PROPERTIES (
      'ai.embed.endpoint'='http://localhost:8001/v1/embeddings'
    );
    SELECT EMBED('review_embed_partial', 'hello');

    This fails before an HTTP request is made. Please separate mandatory structural validation from optional validity checking and reject partial groups during ALTER. Silently falling back to another model would hide the invalid configuration. The ALTER framework predates this PR, but the new group-selection logic relies on an invariant that this framework does not guarantee.

    References: conditional validation, dedicated-group selector.

  4. [P2] Serialize a consistent resource snapshot under the resource read lock.

    ALTER mutates properties under writeLock(), but toThrift() takes no read lock, and both transport callers invoke it directly. Even a completely valid ALTER can produce this interleaving:

    Query: check embed_provider_type -> absent; skip it
    ALTER: install a complete dedicated group and finish
    Query: read embed_endpoint, embed_api_key, embed_model_name -> present
    BE: select the dedicated group, but its provider is empty
    

    Please copy the properties under readLock() and serialize that snapshot. The merged ALTER state should also be validated and installed within one write-locked transition: two requests validating the same old OPENAI/key state can otherwise commit LOCAL/empty-key followed by GEMINI, leaving GEMINI without a key. Add deterministic interleaving tests for both cases.

    Reference: unlocked serialization.

  5. [P2] Validate dedicated providers against embedding capabilities.

    The dedicated group uses the general provider allowlist, so an embed-only resource with DEEPSEEK or MOONSHOT passes CREATE and expression analysis. However, both corresponding BE adapters unconditionally return NotSupported for embedding construction and parsing. Such a resource cannot execute EMBED even with an otherwise usable endpoint.

    Please reject explicitly unsupported providers for the dedicated group and add negative tests. A small shared capability description would be sufficient.

    References: group validation, unsupported adapters.

For findings 2–4, the EMBED path reaches DORIS_CHECK(adapter): Release builds convert this to a query error, while Debug/ASAN builds terminate through Status::FatalError(). These should not all be described as production BE crashes. Finding 1's AI_AGG null dereference is a separate failure path.

From a reuse and scope perspective, I would keep the single configuration-selection hook and make CREATE/ALTER share the validated snapshot logic. I would also split ai.effort into a separate PR: it is independent of embedding routing and additionally changes provider payloads, aggregate-state serialization, and the execution version. The current effort version gate and empty-value clearing fix are present; I am not reporting those as unresolved issues. The PR description and release note should reflect the final scope.

Validation: the existing AIResourceTest (20 tests) and RepositoryAuditEncryptionTest (5 tests) passed locally, as did changed-file clang-format 16.0.6, build hygiene, and diff checks. The failure scenarios above are based on source tracing and concrete inputs/interleavings; I did not run them against a live FE/BE cluster. The existing tests do not cover these ALTER/concurrency cases. I did not identify an obvious new per-row performance regression; no benchmark was run.

@hello-stephen

Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 97.01% (65/67) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 76.22% (34572/45357)
Line Coverage 61.10% (388065/635145)
Region Coverage 57.43% (326063/567798)
Branch Coverage 58.12% (148396/255309)

@linrrzqqq

Copy link
Copy Markdown
Collaborator Author

The above comments are not caused by this pr, and the subsequent fix of ai resource will continue from #68023

@HappenLee

Copy link
Copy Markdown
Contributor

One remaining [P2] issue outside the five resource validation/consistency findings in my earlier comment: validate ai.effort against the selected provider, rather than a union of all providers' values.

On the current head (83a2ac73e5e5469ea3f1c83cafc31dbbb61dd89c), AIProperties.requiredAIProperties() accepts none|minimal|low|medium|high|xhigh|max for every provider. For example, an otherwise valid ANTHROPIC resource with ai.effort='none' passes CREATE validation. AnthropicAdapter then forwards it unchanged as output_config.effort, although the Anthropic API contract only supports low|medium|high|xhigh|max, with additional model-specific restrictions.

References:

This affects requests that explicitly configure an unsupported effort value; existing usage that omits effort is unaffected by this issue. The expected upstream rejection follows from the code and API contract; I did not reproduce it against a live provider endpoint.

This was previously reported by the automated reviewer, so it is not a newly discovered finding. The current diff of #68023 does not cover effort validation. Please include provider-specific effort validation and negative tests in the follow-up, or separate the effort feature from this PR.

Apart from the previously discussed resource issues and this P2, this re-review did not identify an additional P1 blocker. If these known issues are accepted for follow-up, I have no additional code-level objection to merging this PR first. This is not a claim that the outstanding issues are fixed.

Validation for this re-review: changed-file clang-format 16.0.6, BE build hygiene, and diff whitespace checks passed. Builds and runtime tests were not rerun.

@linrrzqqq

Copy link
Copy Markdown
Collaborator 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.

Requested changes for one new P2 correctness issue: AI_AGG silently applies different request semantics at supported execution version 14 depending on whether the optimizer chooses a one- or two-phase plan. The inline comment contains the trace and remediation options.

Critical checkpoint conclusions:

  • Goal and proof: dedicated embedding properties are wired through FE validation/transport and BE selection, with focused unit coverage. The bundled ai.effort addition is not correct for every supported AI_AGG plan because of the inline issue.
  • Scope/focus: the PR is broader than its stated embedding goal because it also adds effort handling and an aggregate-state version. That compatibility-sensitive addition is where the new defect lies.
  • Concurrency/thread safety: resource mutation, snapshot, and identity paths were traced. Remaining concerns are already covered by existing review threads; no distinct deadlock, lock-order, or new race finding was added.
  • Lifecycle/static initialization: no new non-intuitive ownership, release, cross-TU initialization-order, or static-lifecycle defect was found.
  • Configuration: be_exec_version is mutable and version 14 remains supported, so silently dropping a configured property only in serialized plans is not a safe dynamic-configuration behavior.
  • Compatibility: version propagation is consistent across operators and wrappers, and the new guard bounds legacy rows, but version 14 now has plan-dependent effort semantics. This is distinct from the existing legacy-state overread thread.
  • Parallel paths: both FE resource transports, scalar AI, embedding, aggregate, regular/streaming/bucketed/analytic aggregation, and relevant wrappers were checked. No additional omitted path survived duplicate fencing.
  • Conditional checks/error handling: general/embed group selection and provider capability paths were checked; remaining defects in those checks are already covered by existing comments.
  • Tests: changed unit tests cover resource masking/normalization, payloads, and versioned state bytes, but no distributed version-14 test catches the one-phase/two-phase semantic split.
  • Test results: review was static-only as required; no builds or tests were run. Current CheckStyle and Clang Formatter CI checks pass, the local text-only build-hygiene check passed, and substantive build/test jobs shown for this head are skipped.
  • Observability: existing error propagation is adequate for the changed paths; no separate logging/metrics gap was substantiated.
  • Persistence/transactions/data writes: resource persistence/replay was traced and remaining concerns are already-commented duplicates. This PR does not introduce a database transaction or data-write path requiring another finding.
  • FE-BE variables/protocol: all identified resource senders and Thrift consumers were checked. Optional-field and BE-first rolling-upgrade paths produced no additional distinct issue.
  • Performance: no material CPU, memory, allocation, or complexity regression was substantiated.
  • Other: the PR body says Release note: None despite user-visible resource properties and behavior; please reconsider the release-note/documentation status.

User focus: no additional focus was provided. The full 20-file authoritative diff was reviewed.

buf.write_binary(_task);

_ai_config.serialize(buf);
_ai_config.serialize(buf, be_exec_version >= SUPPORT_AI_AGG_EFFORT_VERSION);

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.

[P2] Do not silently discard effort in version-14 partial states. Version 14 is still a supported mutable be_exec_version, and AI_AGG supports two-phase plans. In a LOCAL/partial stage, prepare() loads the configured effort, but this serialization omits it; the GLOBAL stage then rebuilds the adapter with an empty effort and sends a different request. The equivalent one-phase plan never serializes the state and keeps the effort, so behavior depends on plan shape. Please either reject AI_AGG resources with effort when be_exec_version < 15, or preserve the setting outside the legacy state format, and cover the distributed v14 path.

@linrrzqqq

Copy link
Copy Markdown
Collaborator 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.

Static review of exact head 080606663f8f4c8f9f6a8f3d5a06ebe38ea27766 against base af525d567d5352fb8ee2bead6aab3dbc9b23984c found no new valuable issue distinct from the existing inline review threads. This is a summary-only COMMENT review; it does not resolve or duplicate those threads.

Critical checkpoint conclusions:

  • Goal and correctness: dedicated ai.embed.* selection and general fallback, API-key masking, and ai.effort propagation were traced across FE validation and persistence, both FE transport builders, Thrift, BE resource selection, provider payload construction, and AI_AGG state handling. No new correctness issue survived the duplicate fence.
  • Scope and user focus: the authoritative 17-file diff exactly matches the supplied changed-file list. The change also carries effort support beyond the title's embedding-property focus. No additional user-provided focus was supplied.
  • Concurrency and lifecycle: whole-map publication avoids entry-by-entry mixing, but the already-raised pre-lock concurrent ALTER, lock-free/name-only transport, and same-name DROP/CREATE identity concerns remain covered by existing threads. No distinct BE ownership, static-lifecycle, or lock-order issue was found.
  • Configuration, compatibility, persistence, and writes: legacy Thrift IDs are retained and the supported BE-first upgrade direction remains readable. The optional row-framed trailing effort field is bounded by each AI_AGG state row and supports old-writer/new-reader handling at this head. Resource keys persist through snapshot/journal paths. No database transaction or table-data write path is changed.
  • Parallel and conditional paths: general-only, embed-only, combined, partial-group, scalar, aggregate, text-embedding, multimodal-embedding, one-phase, and two-phase paths were checked. Remaining partial-group, provider-capability, value-domain, resource-identity, and version-specific concerns are already represented by existing threads.
  • Error handling, security, performance, and observability: provider status propagation, nullable/COW behavior, audit/SHOW secret masking, and relevant invariants were inspected. No new silent error loss, in-scope credential disclosure, material hot-path regression, or observability gap was substantiated.
  • Tests: added FE and BE unit tests cover group validation, masking, persistence, provider payloads, state serialization, and dedicated-versus-fallback selection. Missing concurrency, unsupported-provider, and mixed-version coverage is already requested in existing threads. Per the review instructions, this review was static-only; no builds or tests were run.

All three bounded review tracks returned NO_NEW_VALUABLE_FINDINGS, and the final changed-file, unresolved-candidate, live-head, and live-comment sweeps were clean.

@linrrzqqq

Copy link
Copy Markdown
Collaborator Author

run buildall

@hello-stephen

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

------ Round 1 ----------------------------------
============================================
q1	17606	4165	4027	4027
q2	2310	377	322	322
q3	9943	1444	801	801
q4	4684	490	361	361
q5	7526	837	558	558
q6	194	179	143	143
q7	774	806	596	596
q8	9349	1501	1556	1501
q9	5648	4300	4246	4246
q10	6766	1640	1390	1390
q11	445	277	258	258
q12	635	413	316	316
q13	18031	2686	2051	2051
q14	261	256	238	238
q15	q16	746	756	663	663
q17	1857	1180	1049	1049
q18	6542	5611	5568	5568
q19	1177	1241	1103	1103
q20	488	395	273	273
q21	5755	2999	2788	2788
q22	483	380	326	326
Total cold run time: 101220 ms
Total hot run time: 28578 ms

----- Round 2, with runtime_filter_mode=off -----
============================================
q1	5088	4929	4721	4721
q2	826	623	588	588
q3	4967	5237	4643	4643
q4	2319	2389	1502	1502
q5	4617	4462	4687	4462
q6	255	189	136	136
q7	1842	1723	1493	1493
q8	2555	2319	2191	2191
q9	7493	7307	7303	7303
q10	4347	4306	3830	3830
q11	545	420	374	374
q12	710	722	523	523
q13	2393	2694	2028	2028
q14	266	283	248	248
q15	q16	695	690	619	619
q17	7492	6837	6675	6675
q18	11963	11056	11874	11056
q19	1088	1032	1015	1015
q20	2222	2213	1921	1921
q21	5525	4585	4742	4585
q22	531	472	399	399
Total cold run time: 67739 ms
Total hot run time: 60312 ms

@hello-stephen

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

query5	4334	593	483	483
query6	448	181	164	164
query7	4837	540	310	310
query8	327	180	171	171
query9	8814	4019	4035	4019
query10	487	323	265	265
query11	5836	2222	2006	2006
query12	157	98	105	98
query13	1278	610	430	430
query14	6510	4666	4337	4337
query14_1	4133	4106	4130	4106
query15	210	206	181	181
query16	988	464	430	430
query17	919	697	558	558
query18	2427	461	349	349
query19	198	186	145	145
query20	107	104	107	104
query21	219	141	120	120
query22	13109	12974	12741	12741
query23	15640	14612	14020	14020
query23_1	14198	14242	14155	14155
query24	7510	1715	1261	1261
query24_1	1270	1302	1272	1272
query25	567	477	373	373
query26	1265	355	177	177
query27	2644	558	341	341
query28	4633	2000	1985	1985
query29	1063	633	490	490
query30	318	246	204	204
query31	895	776	637	637
query32	143	97	94	94
query33	541	331	263	263
query34	1220	1143	653	653
query35	746	771	663	663
query36	802	803	709	709
query37	158	106	98	98
query38	1848	1773	1715	1715
query39	693	711	681	681
query39_1	661	672	655	655
query40	230	127	111	111
query41	73	71	70	70
query42	98	95	91	91
query43	358	378	337	337
query44	1431	696	701	696
query45	195	185	172	172
query46	1081	1145	736	736
query47	1510	1513	1416	1416
query48	410	385	308	308
query49	587	425	348	348
query50	987	355	248	248
query51	10357	10286	10306	10286
query52	84	90	73	73
query53	242	269	187	187
query54	248	204	200	200
query55	78	72	68	68
query56	237	213	206	206
query57	1413	1438	1258	1258
query58	239	209	212	209
query59	2024	2039	1825	1825
query60	277	241	229	229
query61	144	141	144	141
query62	398	325	272	272
query63	224	175	178	175
query64	2852	988	829	829
query65	4088	3959	3933	3933
query66	1816	425	301	301
query67	20091	19931	19906	19906
query68	3464	1597	960	960
query69	402	302	256	256
query70	1001	922	867	867
query71	287	236	215	215
query72	2975	2479	2475	2475
query73	811	780	425	425
query74	4676	4528	4292	4292
query75	2314	2287	1951	1951
query76	2398	1124	708	708
query77	368	403	314	314
query78	9331	9033	8536	8536
query79	1312	1209	737	737
query80	562	469	380	380
query81	461	285	239	239
query82	623	169	130	130
query83	364	278	243	243
query84	319	142	110	110
query85	822	475	380	380
query86	326	241	228	228
query87	2020	1987	1843	1843
query88	3716	2738	2737	2737
query89	368	298	258	258
query90	1953	184	182	182
query91	167	153	128	128
query92	99	90	91	90
query93	1480	1442	889	889
query94	538	348	313	313
query95	669	484	337	337
query96	1012	803	329	329
query97	2440	2431	2353	2353
query98	206	198	183	183
query99	740	721	617	617
Total cold run time: 242345 ms
Total hot run time: 154922 ms

@hello-stephen

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

query1	0.01	0.00	0.01
query2	0.09	0.05	0.05
query3	0.26	0.14	0.13
query4	1.61	0.14	0.14
query5	0.25	0.23	0.23
query6	1.16	0.97	0.98
query7	0.04	0.01	0.01
query8	0.06	0.04	0.04
query9	0.40	0.34	0.34
query10	0.54	0.58	0.56
query11	0.21	0.16	0.15
query12	0.18	0.15	0.15
query13	0.48	0.47	0.49
query14	0.96	0.97	0.94
query15	0.62	0.60	0.60
query16	0.32	0.32	0.33
query17	1.06	1.06	1.12
query18	0.21	0.20	0.19
query19	2.06	2.01	1.92
query20	0.02	0.01	0.02
query21	15.44	0.22	0.14
query22	4.92	0.05	0.05
query23	16.11	0.30	0.13
query24	3.01	0.45	0.35
query25	0.12	0.04	0.05
query26	0.74	0.21	0.15
query27	0.05	0.03	0.03
query28	3.52	0.79	0.36
query29	12.47	4.17	3.23
query30	0.28	0.16	0.14
query31	2.77	0.55	0.32
query32	3.22	0.60	0.48
query33	3.14	3.29	3.14
query34	15.80	3.93	3.32
query35	3.25	3.22	3.23
query36	0.55	0.43	0.43
query37	0.09	0.06	0.06
query38	0.05	0.04	0.03
query39	0.03	0.04	0.03
query40	0.18	0.15	0.14
query41	0.09	0.04	0.03
query42	0.04	0.03	0.03
query43	0.04	0.04	0.04
Total cold run time: 96.45 s
Total hot run time: 24.17 s

@hello-stephen

Copy link
Copy Markdown
Contributor

FE UT Coverage Report

Increment line coverage 90.00% (72/80) 🎉
Increment coverage report
Complete coverage report

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Assignees

Couldn't load assignees.