Skip to content

[feature](function) Add ST_NumGeometries, ST_NumPoints, ST_Geometries functions#63049

Merged
Mryange merged 1 commit into
apache:masterfrom
acarofpigs:add-geo-functions
May 26, 2026
Merged

[feature](function) Add ST_NumGeometries, ST_NumPoints, ST_Geometries functions#63049
Mryange merged 1 commit into
apache:masterfrom
acarofpigs:add-geo-functions

Conversation

@acarofpigs
Copy link
Copy Markdown
Contributor

@acarofpigs acarofpigs commented May 7, 2026

… functions

What problem does this PR solve?

Issue Number: ref #48203

Related PR: apache/doris-website#3623

Problem Summary:
Add three new spatial functions for geometry collection operations:

  • ST_NumGeometries: Returns the number of sub-geometries in a geometry object.
  • ST_NumPoints: Returns the total number of vertices (points) in a geometry object.
  • ST_Geometries: Decomposes a geometry object into an array of its sub-geometries.

Release note

None

Check List (For Author)

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?

@acarofpigs acarofpigs force-pushed the add-geo-functions branch from 0a9a3ff to e870bd2 Compare May 7, 2026 06:33
@acarofpigs
Copy link
Copy Markdown
Contributor Author

run buildall

@acarofpigs
Copy link
Copy Markdown
Contributor Author

/review

@hello-stephen
Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 97.01% (130/134) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 73.69% (27751/37661)
Line Coverage 57.57% (300405/521787)
Region Coverage 54.85% (250579/456843)
Branch Coverage 56.33% (108273/192225)

@acarofpigs acarofpigs force-pushed the add-geo-functions branch from facf26f to 0d5d800 Compare May 15, 2026 12:59
@acarofpigs
Copy link
Copy Markdown
Contributor Author

run buildall

@hello-stephen
Copy link
Copy Markdown
Contributor

BE UT Coverage Report

Increment line coverage 4.48% (6/134) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 53.50% (20656/38606)
Line Coverage 37.16% (195159/525203)
Region Coverage 33.52% (152699/455535)
Branch Coverage 34.56% (66589/192654)

@acarofpigs acarofpigs force-pushed the add-geo-functions branch 2 times, most recently from 0fdb594 to 8feb287 Compare May 19, 2026 11:36
@acarofpigs
Copy link
Copy Markdown
Contributor Author

run buildall

1 similar comment
@acarofpigs
Copy link
Copy Markdown
Contributor Author

run buildall

@hello-stephen
Copy link
Copy Markdown
Contributor

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

------ Round 1 ----------------------------------
orders	Doris	NULL	NULL	0	0	0	NULL	0	NULL	NULL	2023-12-26 18:27:23	2023-12-26 18:42:55	NULL	utf-8	NULL	NULL	
============================================
q1	17653	3837	3825	3825
q2	q3	10768	1353	816	816
q4	4706	477	351	351
q5	7577	2297	2080	2080
q6	389	172	137	137
q7	962	788	662	662
q8	9537	1658	1636	1636
q9	7029	4960	4869	4869
q10	6462	2127	1773	1773
q11	439	271	243	243
q12	695	425	297	297
q13	18204	3456	2814	2814
q14	268	258	234	234
q15	q16	813	776	721	721
q17	1010	932	989	932
q18	7180	5680	5511	5511
q19	1194	1303	1112	1112
q20	516	420	258	258
q21	5749	2645	2353	2353
q22	429	357	300	300
Total cold run time: 101580 ms
Total hot run time: 30924 ms

----- Round 2, with runtime_filter_mode=off -----
orders	Doris	NULL	NULL	150000000	42	6422171781	NULL	22778155	NULL	NULL	2023-12-26 18:27:23	2023-12-26 18:42:55	NULL	utf-8	NULL	NULL	
============================================
q1	4163	4102	4093	4093
q2	q3	4558	4927	4367	4367
q4	2110	2190	1404	1404
q5	4399	4246	4350	4246
q6	369	235	155	155
q7	2059	1783	1667	1667
q8	2442	2096	2064	2064
q9	7801	7732	7647	7647
q10	4566	4506	4047	4047
q11	740	419	366	366
q12	731	735	539	539
q13	3232	3617	2989	2989
q14	304	295	272	272
q15	q16	700	747	668	668
q17	1343	1348	1320	1320
q18	7810	7409	6800	6800
q19	1149	1090	1127	1090
q20	2210	2228	1923	1923
q21	5331	4582	4490	4490
q22	523	459	398	398
Total cold run time: 56540 ms
Total hot run time: 50545 ms

@hello-stephen
Copy link
Copy Markdown
Contributor

TPC-DS: Total hot run time: 170352 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 303b19f30909ae538c16ccf77a0d6b4abce7ad44, data reload: false

query5	4334	673	496	496
query6	333	217	198	198
query7	4233	547	324	324
query8	327	232	218	218
query9	8792	3993	3989	3989
query10	445	339	300	300
query11	5757	2402	2263	2263
query12	180	129	128	128
query13	1276	630	421	421
query14	5966	5335	5053	5053
query14_1	4362	4337	4332	4332
query15	214	208	185	185
query16	975	458	433	433
query17	1154	742	597	597
query18	2520	502	373	373
query19	221	210	174	174
query20	143	134	136	134
query21	218	138	120	120
query22	13580	13437	13542	13437
query23	17261	16342	16103	16103
query23_1	16170	16194	16208	16194
query24	7489	1789	1307	1307
query24_1	1354	1319	1312	1312
query25	581	487	441	441
query26	1319	339	172	172
query27	2699	551	344	344
query28	4461	1956	1935	1935
query29	1036	627	525	525
query30	315	245	201	201
query31	1111	1057	939	939
query32	88	79	75	75
query33	552	378	333	333
query34	1188	1131	647	647
query35	766	825	664	664
query36	1349	1371	1227	1227
query37	151	102	89	89
query38	3182	3153	3055	3055
query39	922	917	917	917
query39_1	868	885	875	875
query40	220	148	122	122
query41	64	61	70	61
query42	115	116	109	109
query43	316	322	283	283
query44	
query45	207	198	198	198
query46	1072	1204	694	694
query47	2345	2378	2199	2199
query48	395	445	284	284
query49	626	494	385	385
query50	943	348	247	247
query51	4288	4317	4205	4205
query52	107	103	93	93
query53	253	277	209	209
query54	303	269	255	255
query55	96	91	81	81
query56	287	309	323	309
query57	1433	1426	1334	1334
query58	296	273	280	273
query59	1560	1601	1401	1401
query60	328	362	311	311
query61	170	149	150	149
query62	666	616	562	562
query63	233	195	202	195
query64	2404	797	627	627
query65	
query66	1731	484	344	344
query67	30073	29999	29929	29929
query68	
query69	463	342	317	317
query70	1053	982	978	978
query71	301	282	268	268
query72	3003	2702	2367	2367
query73	844	786	420	420
query74	5031	4875	4712	4712
query75	2643	2564	2243	2243
query76	2326	1163	767	767
query77	415	408	330	330
query78	12098	12196	11615	11615
query79	1485	1020	719	719
query80	654	564	436	436
query81	451	276	241	241
query82	1377	158	124	124
query83	361	277	249	249
query84	263	146	109	109
query85	872	544	452	452
query86	399	351	358	351
query87	3398	3350	3213	3213
query88	3502	2657	2636	2636
query89	441	380	332	332
query90	1889	189	183	183
query91	174	175	140	140
query92	82	80	76	76
query93	1512	1406	858	858
query94	545	356	307	307
query95	670	475	356	356
query96	1002	765	330	330
query97	2720	2717	2559	2559
query98	233	238	231	231
query99	1129	1104	1000	1000
Total cold run time: 252727 ms
Total hot run time: 170352 ms

@hello-stephen
Copy link
Copy Markdown
Contributor

BE UT Coverage Report

Increment line coverage 4.48% (6/134) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 53.53% (20697/38662)
Line Coverage 37.14% (195891/527436)
Region Coverage 33.47% (153554/458717)
Branch Coverage 34.48% (66878/193963)

@acarofpigs acarofpigs force-pushed the add-geo-functions branch from 303b19f to fb632cd Compare May 21, 2026 06:17
@acarofpigs
Copy link
Copy Markdown
Contributor Author

run buildall

@acarofpigs acarofpigs force-pushed the add-geo-functions branch from fb632cd to 4eef041 Compare May 21, 2026 07:34
@acarofpigs
Copy link
Copy Markdown
Contributor Author

run buildall

@acarofpigs acarofpigs force-pushed the add-geo-functions branch from 4eef041 to fb632cd Compare May 21, 2026 08:25
@acarofpigs
Copy link
Copy Markdown
Contributor Author

run buildall

@hello-stephen
Copy link
Copy Markdown
Contributor

BE UT Coverage Report

Increment line coverage 4.48% (6/134) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 53.60% (20725/38666)
Line Coverage 37.19% (196176/527491)
Region Coverage 33.53% (153810/458780)
Branch Coverage 34.52% (66978/194008)

@acarofpigs
Copy link
Copy Markdown
Contributor Author

run buildall

@hello-stephen
Copy link
Copy Markdown
Contributor

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

------ Round 1 ----------------------------------
orders	Doris	NULL	NULL	0	0	0	NULL	0	NULL	NULL	2023-12-26 18:27:23	2023-12-26 18:42:55	NULL	utf-8	NULL	NULL	
============================================
q1	17761	3871	3843	3843
q2	q3	10797	1412	802	802
q4	4680	470	343	343
q5	7657	2290	2062	2062
q6	239	176	141	141
q7	938	790	628	628
q8	9367	1646	1578	1578
q9	5207	4942	4902	4902
q10	6385	2077	1792	1792
q11	437	280	245	245
q12	630	414	296	296
q13	18151	3376	2748	2748
q14	264	253	238	238
q15	q16	819	783	701	701
q17	955	907	921	907
q18	6892	5729	5563	5563
q19	1288	1283	981	981
q20	518	400	258	258
q21	6458	2826	2696	2696
q22	455	383	337	337
Total cold run time: 99898 ms
Total hot run time: 31061 ms

----- Round 2, with runtime_filter_mode=off -----
orders	Doris	NULL	NULL	150000000	42	6422171781	NULL	22778155	NULL	NULL	2023-12-26 18:27:23	2023-12-26 18:42:55	NULL	utf-8	NULL	NULL	
============================================
q1	4815	4480	4581	4480
q2	q3	4806	5240	4608	4608
q4	2126	2199	1399	1399
q5	4768	4807	4717	4717
q6	233	173	125	125
q7	1884	1783	1552	1552
q8	2383	2062	2032	2032
q9	7756	7620	7252	7252
q10	4524	4450	4008	4008
q11	545	375	345	345
q12	717	720	513	513
q13	3016	3390	2791	2791
q14	272	279	251	251
q15	q16	676	702	626	626
q17	1270	1230	1228	1228
q18	7167	7035	6811	6811
q19	1099	1148	1101	1101
q20	2209	2212	1927	1927
q21	5329	4636	4438	4438
q22	526	462	410	410
Total cold run time: 56121 ms
Total hot run time: 50614 ms

@hello-stephen
Copy link
Copy Markdown
Contributor

TPC-DS: Total hot run time: 169633 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 b07854bea6e81934989f63e15185f62efa7e8ecc, data reload: false

query5	4336	650	522	522
query6	321	220	202	202
query7	4342	544	307	307
query8	333	228	218	218
query9	8803	3915	3945	3915
query10	451	328	296	296
query11	5795	2432	2187	2187
query12	186	126	125	125
query13	1331	618	441	441
query14	5944	5372	5066	5066
query14_1	4356	4636	4299	4299
query15	210	203	184	184
query16	985	436	424	424
query17	1073	716	574	574
query18	2468	476	349	349
query19	213	202	157	157
query20	139	128	127	127
query21	212	140	117	117
query22	13731	13552	13364	13364
query23	17214	16329	15990	15990
query23_1	16071	16261	16159	16159
query24	7454	1762	1279	1279
query24_1	1307	1305	1299	1299
query25	553	469	399	399
query26	1304	305	172	172
query27	2708	528	337	337
query28	4420	1942	1951	1942
query29	998	665	509	509
query30	305	244	200	200
query31	1126	1067	952	952
query32	91	77	73	73
query33	538	355	296	296
query34	1177	1107	646	646
query35	773	788	677	677
query36	1344	1342	1152	1152
query37	167	107	91	91
query38	3232	3137	3058	3058
query39	927	922	901	901
query39_1	887	879	876	876
query40	235	151	128	128
query41	71	68	68	68
query42	113	111	109	109
query43	324	329	284	284
query44	
query45	215	201	194	194
query46	1066	1214	721	721
query47	2304	2335	2221	2221
query48	403	429	311	311
query49	649	501	398	398
query50	1016	362	242	242
query51	4383	4312	4217	4217
query52	104	105	101	101
query53	251	277	205	205
query54	396	287	261	261
query55	95	94	90	90
query56	311	302	303	302
query57	1430	1381	1304	1304
query58	327	278	275	275
query59	1536	1635	1405	1405
query60	332	340	319	319
query61	183	174	184	174
query62	674	617	560	560
query63	239	210	209	209
query64	2438	786	645	645
query65	
query66	1759	472	356	356
query67	30103	30158	29989	29989
query68	
query69	459	331	300	300
query70	1038	963	964	963
query71	293	274	265	265
query72	2940	2675	2358	2358
query73	822	751	410	410
query74	5063	4877	4718	4718
query75	2649	2640	2245	2245
query76	2281	1161	756	756
query77	397	404	318	318
query78	12219	12179	11532	11532
query79	1440	1075	734	734
query80	630	547	450	450
query81	453	278	240	240
query82	1369	155	120	120
query83	352	270	250	250
query84	272	139	111	111
query85	866	546	450	450
query86	391	333	312	312
query87	3379	3376	3211	3211
query88	3520	2643	2651	2643
query89	431	383	337	337
query90	1994	184	176	176
query91	176	166	146	146
query92	79	84	73	73
query93	1466	1419	851	851
query94	548	350	330	330
query95	682	512	349	349
query96	1107	736	322	322
query97	2675	2670	2573	2573
query98	238	225	223	223
query99	1143	1080	957	957
Total cold run time: 253293 ms
Total hot run time: 169633 ms

@acarofpigs
Copy link
Copy Markdown
Contributor Author

run cloud_p0

@hello-stephen
Copy link
Copy Markdown
Contributor

FE UT Coverage Report

Increment line coverage 75.68% (28/37) 🎉
Increment coverage report
Complete coverage report

@acarofpigs
Copy link
Copy Markdown
Contributor Author

run external

@acarofpigs
Copy link
Copy Markdown
Contributor Author

run nonConcurrent

@hello-stephen
Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 4.48% (6/134) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 63.49% (24053/37883)
Line Coverage 47.18% (248304/526255)
Region Coverage 44.20% (204792/463294)
Branch Coverage 45.42% (88471/194805)

@hello-stephen
Copy link
Copy Markdown
Contributor

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

------ Round 1 ----------------------------------
orders	Doris	NULL	NULL	0	0	0	NULL	0	NULL	NULL	2023-12-26 18:27:23	2023-12-26 18:42:55	NULL	utf-8	NULL	NULL	
============================================
q1	17625	4002	3986	3986
q2	q3	10776	1533	835	835
q4	4684	478	348	348
q5	7613	2296	2099	2099
q6	239	173	135	135
q7	1011	771	648	648
q8	9410	1683	1725	1683
q9	6751	4943	4933	4933
q10	6439	2270	1928	1928
q11	458	268	241	241
q12	688	428	290	290
q13	18291	3416	2781	2781
q14	266	262	239	239
q15	q16	822	773	707	707
q17	914	950	912	912
q18	6828	5750	5565	5565
q19	1182	1290	1117	1117
q20	565	401	277	277
q21	6006	2712	2697	2697
q22	438	369	317	317
Total cold run time: 101006 ms
Total hot run time: 31738 ms

----- Round 2, with runtime_filter_mode=off -----
orders	Doris	NULL	NULL	150000000	42	6422171781	NULL	22778155	NULL	NULL	2023-12-26 18:27:23	2023-12-26 18:42:55	NULL	utf-8	NULL	NULL	
============================================
q1	4871	4932	4818	4818
q2	q3	4948	5343	4735	4735
q4	2130	2225	1439	1439
q5	4948	4753	4716	4716
q6	232	181	133	133
q7	1865	1773	1435	1435
q8	2255	1972	1973	1972
q9	7420	7439	7386	7386
q10	4752	4689	4235	4235
q11	545	394	359	359
q12	746	743	541	541
q13	2961	3476	2793	2793
q14	286	279	268	268
q15	q16	682	713	634	634
q17	1298	1282	1278	1278
q18	7484	6986	6885	6885
q19	1090	1087	1113	1087
q20	2272	2257	1968	1968
q21	5476	4742	4612	4612
q22	536	476	425	425
Total cold run time: 56797 ms
Total hot run time: 51719 ms

@hello-stephen
Copy link
Copy Markdown
Contributor

TPC-DS: Total hot run time: 173015 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 2489a347616389bd50fce7fd48fda6859e7e0f14, data reload: false

query5	4304	671	533	533
query6	343	222	203	203
query7	4311	550	314	314
query8	337	244	224	224
query9	8862	4115	4062	4062
query10	445	346	301	301
query11	5830	2582	2210	2210
query12	178	132	127	127
query13	1302	595	447	447
query14	6212	5556	5228	5228
query14_1	4514	4584	4519	4519
query15	222	210	187	187
query16	1015	475	464	464
query17	1177	756	619	619
query18	2659	504	363	363
query19	226	216	172	172
query20	139	133	131	131
query21	219	147	121	121
query22	13688	13560	13387	13387
query23	17503	16591	16211	16211
query23_1	16281	16496	16329	16329
query24	7431	1782	1285	1285
query24_1	1312	1298	1324	1298
query25	545	490	422	422
query26	1300	310	169	169
query27	2703	543	342	342
query28	4452	2005	2014	2005
query29	1010	624	498	498
query30	314	243	199	199
query31	1145	1084	958	958
query32	88	72	75	72
query33	560	348	299	299
query34	1178	1152	657	657
query35	790	794	689	689
query36	1426	1422	1303	1303
query37	151	102	93	93
query38	3207	3181	3090	3090
query39	937	924	895	895
query39_1	878	889	886	886
query40	227	141	120	120
query41	66	62	62	62
query42	111	108	109	108
query43	327	332	296	296
query44	
query45	213	204	204	204
query46	1071	1250	755	755
query47	2396	2400	2295	2295
query48	394	412	306	306
query49	629	496	388	388
query50	974	337	249	249
query51	4395	4444	4299	4299
query52	106	103	91	91
query53	261	278	199	199
query54	308	284	253	253
query55	92	98	83	83
query56	308	299	312	299
query57	1431	1435	1335	1335
query58	292	275	265	265
query59	1585	1661	1420	1420
query60	316	325	310	310
query61	157	153	156	153
query62	698	648	578	578
query63	249	200	208	200
query64	2375	817	622	622
query65	
query66	1677	478	360	360
query67	30154	30045	30025	30025
query68	
query69	460	349	312	312
query70	1053	1047	1024	1024
query71	313	276	273	273
query72	2970	2717	2410	2410
query73	858	757	445	445
query74	5137	4975	4826	4826
query75	2684	2631	2319	2319
query76	2312	1149	776	776
query77	405	406	343	343
query78	12416	12430	11867	11867
query79	1241	1063	739	739
query80	588	562	482	482
query81	465	284	248	248
query82	243	167	123	123
query83	286	287	257	257
query84	258	149	116	116
query85	945	620	539	539
query86	377	339	315	315
query87	3423	3410	3270	3270
query88	3673	2795	2778	2778
query89	436	394	344	344
query90	2190	183	185	183
query91	200	186	161	161
query92	81	86	79	79
query93	1397	1436	832	832
query94	538	391	316	316
query95	670	384	358	358
query96	1036	825	359	359
query97	2720	2780	2615	2615
query98	230	227	238	227
query99	1179	1140	1015	1015
Total cold run time: 253818 ms
Total hot run time: 173015 ms

@acarofpigs acarofpigs force-pushed the add-geo-functions branch from 2489a34 to b1e980e Compare May 25, 2026 10:58
@acarofpigs
Copy link
Copy Markdown
Contributor Author

run buildall

@hello-stephen
Copy link
Copy Markdown
Contributor

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

------ Round 1 ----------------------------------
orders	Doris	NULL	NULL	0	0	0	NULL	0	NULL	NULL	2023-12-26 18:27:23	2023-12-26 18:42:55	NULL	utf-8	NULL	NULL	
============================================
q1	17714	4209	4117	4117
q2	q3	10784	1413	817	817
q4	4687	477	346	346
q5	7531	2263	2061	2061
q6	330	173	137	137
q7	946	788	639	639
q8	9412	1744	1481	1481
q9	6853	4975	4985	4975
q10	6434	2208	1907	1907
q11	431	262	238	238
q12	690	423	289	289
q13	18203	3402	2779	2779
q14	270	260	240	240
q15	q16	811	774	708	708
q17	1000	911	913	911
q18	6848	5724	5487	5487
q19	1289	1262	1137	1137
q20	535	410	260	260
q21	5920	2800	2647	2647
q22	464	382	307	307
Total cold run time: 101152 ms
Total hot run time: 31483 ms

----- Round 2, with runtime_filter_mode=off -----
orders	Doris	NULL	NULL	150000000	42	6422171781	NULL	22778155	NULL	NULL	2023-12-26 18:27:23	2023-12-26 18:42:55	NULL	utf-8	NULL	NULL	
============================================
q1	4951	4934	5210	4934
q2	q3	4960	5307	4726	4726
q4	2122	2222	1511	1511
q5	5037	4790	4695	4695
q6	227	178	125	125
q7	1882	1747	1618	1618
q8	2288	1999	1972	1972
q9	7474	7575	7535	7535
q10	4773	4707	4235	4235
q11	539	387	356	356
q12	739	748	537	537
q13	3020	3400	2793	2793
q14	267	288	253	253
q15	q16	678	698	620	620
q17	1298	1266	1280	1266
q18	7561	6916	7018	6916
q19	1088	1110	1077	1077
q20	2221	2235	1940	1940
q21	5338	4623	4470	4470
q22	532	463	411	411
Total cold run time: 56995 ms
Total hot run time: 51990 ms

@hello-stephen
Copy link
Copy Markdown
Contributor

TPC-DS: Total hot run time: 173026 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 b1e980eb3dd3b7c542542852d8cbd051bf878664, data reload: false

query5	4304	664	537	537
query6	327	220	200	200
query7	4235	571	332	332
query8	341	235	220	220
query9	8822	4174	4118	4118
query10	464	350	305	305
query11	5793	2805	2238	2238
query12	182	132	127	127
query13	1285	618	433	433
query14	6184	5523	5207	5207
query14_1	4514	4528	4544	4528
query15	220	207	185	185
query16	1009	444	453	444
query17	1170	768	623	623
query18	2721	507	369	369
query19	224	206	166	166
query20	137	131	132	131
query21	221	140	130	130
query22	13718	13641	13365	13365
query23	17416	16633	16330	16330
query23_1	16334	16352	16349	16349
query24	7486	1787	1350	1350
query24_1	1334	1335	1336	1335
query25	581	501	432	432
query26	840	328	176	176
query27	2682	564	351	351
query28	4416	2008	2005	2005
query29	989	644	530	530
query30	312	237	201	201
query31	1132	1082	958	958
query32	90	80	74	74
query33	564	360	308	308
query34	1191	1173	690	690
query35	799	789	689	689
query36	1394	1428	1240	1240
query37	151	105	88	88
query38	3245	3164	3103	3103
query39	987	953	919	919
query39_1	905	904	925	904
query40	237	158	124	124
query41	66	64	65	64
query42	112	107	108	107
query43	334	337	302	302
query44	
query45	222	206	203	203
query46	1123	1257	777	777
query47	2502	2436	2338	2338
query48	414	435	305	305
query49	624	509	404	404
query50	1075	353	257	257
query51	4385	4363	4329	4329
query52	106	106	96	96
query53	259	291	211	211
query54	334	282	255	255
query55	97	97	91	91
query56	308	322	332	322
query57	1502	1453	1409	1409
query58	302	270	275	270
query59	1624	1704	1482	1482
query60	332	329	308	308
query61	163	159	160	159
query62	692	647	586	586
query63	246	209	206	206
query64	1813	789	626	626
query65	
query66	1690	474	360	360
query67	29329	30016	29845	29845
query68	
query69	485	338	307	307
query70	1077	1023	1015	1015
query71	307	272	268	268
query72	3054	2752	2405	2405
query73	855	815	442	442
query74	5167	4946	4791	4791
query75	2709	2610	2272	2272
query76	2297	1139	788	788
query77	413	441	326	326
query78	12318	12449	11845	11845
query79	1493	1065	751	751
query80	1289	541	465	465
query81	518	282	238	238
query82	945	156	122	122
query83	313	272	250	250
query84	265	141	108	108
query85	924	543	458	458
query86	464	343	339	339
query87	3443	3407	3226	3226
query88	3645	2745	2735	2735
query89	448	400	346	346
query90	1883	168	176	168
query91	174	167	148	148
query92	80	77	73	73
query93	1591	1461	884	884
query94	733	342	317	317
query95	675	471	339	339
query96	1033	879	352	352
query97	2750	2732	2619	2619
query98	234	234	232	232
query99	1188	1152	1030	1030
Total cold run time: 254166 ms
Total hot run time: 173026 ms

@hello-stephen
Copy link
Copy Markdown
Contributor

BE UT Coverage Report

Increment line coverage 92.42% (122/132) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 53.85% (20903/38815)
Line Coverage 37.41% (197932/529071)
Region Coverage 33.70% (155029/460031)
Branch Coverage 34.70% (67498/194512)

@hello-stephen
Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 96.97% (128/132) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 73.72% (28026/38015)
Line Coverage 57.67% (304325/527716)
Region Coverage 54.89% (254957/464454)
Branch Coverage 56.36% (110030/195238)

@hello-stephen
Copy link
Copy Markdown
Contributor

FE Regression Coverage Report

Increment line coverage 91.89% (34/37) 🎉
Increment coverage report
Complete coverage report

@linrrzqqq
Copy link
Copy Markdown
Collaborator

/review

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Automated review for head b1e980eb3dd3b7c542542852d8cbd051bf878664.

No additional blocking issues found beyond the already-known review context. I did not submit duplicate inline comments for the existing threads.

Critical checkpoint conclusions:

  • Goal/test coverage: The PR adds ST_NumGeometries, ST_NumPoints/ST_NPoints, and ST_Geometries; BE/FE registrations and regression/FE/BE tests cover the main point, linestring, polygon, multipolygon, circle, NULL, invalid input, alias, table, predicate, and arithmetic paths.
  • Scope/focus: The current head is focused on the geo component functions and associated type/count helpers.
  • Concurrency/lifecycle: The changed function execution paths are per-block scalar evaluation and do not introduce shared mutable state, new threads, locks, or special lifecycle management.
  • Configuration/compatibility: No new config items, storage formats, edit logs, or FE-BE protocol fields are introduced.
  • Parallel code paths: BE function registration and Nereids builtin registration both include the new functions; ST_NPoints is now registered as an alias rather than a separate implementation.
  • Error/null handling: Invalid encoded geometries and unsupported point counts return NULL; existing default nullable handling is used for NULL input.
  • Performance: Current implementation uses ColumnView for geo string access and avoids the earlier materialization concern raised in existing threads.
  • Observability/transactions/data writes: Not applicable; no transaction, persistence, or data-write path changes.
  • User focus: review_focus.txt has no additional user-provided focus points.

Testing was not run by this review job; conclusions are based on static review of the PR diff and included tests.

@acarofpigs
Copy link
Copy Markdown
Contributor Author

Hi @linrrzqqq , thanks for the review.

I have addressed the previous review comments in the latest head

Copy link
Copy Markdown
Collaborator

@linrrzqqq linrrzqqq left a comment

Choose a reason for hiding this comment

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

LGTM

@github-actions github-actions Bot added the approved Indicates a PR has been approved by one committer. label May 26, 2026
@github-actions
Copy link
Copy Markdown
Contributor

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

@Mryange Mryange merged commit b1c0133 into apache:master May 26, 2026
30 of 31 checks passed
github-actions Bot pushed a commit that referenced this pull request May 26, 2026
… functions (#63049)

… functions

### What problem does this PR solve?

Issue Number: ref #48203 

Related PR: apache/doris-website#3623

Problem Summary:
Add three new spatial functions for geometry collection operations:
- `ST_NumGeometries`: Returns the number of sub-geometries in a geometry
object.
- `ST_NumPoints`: Returns the total number of vertices (points) in a
geometry object.
- `ST_Geometries`: Decomposes a geometry object into an array of its
sub-geometries.
@Mryange Mryange mentioned this pull request May 26, 2026
16 tasks
airborne12 added a commit to airborne12/apache-doris that referenced this pull request May 27, 2026
### What problem does this PR solve?

Issue Number: close #N/A

Problem Summary:

BE-UT has been failing master-wide since both PR apache#63491 (which strongly
typed `ColumnNullable::get_null_map_column[_ptr]()` to `ColumnUInt8`) and
PR apache#63049 (which added `functions_geo_test.cpp`) landed today. The new
test calls

```cpp
assert_cast<ColumnUInt8*>(nullable_input->get_null_map_column_ptr().get())
        ->insert_value(0);
```

but the inner expression is already `ColumnUInt8*`, so the cast triggers
the same-type static_assert added by PR apache#63133 to `src/core/assert_cast.h`:

```
static assertion failed due to requirement
'!std::is_same_v<doris::ColumnVector<doris::TYPE_BOOLEAN> *,
                 doris::ColumnVector<doris::TYPE_BOOLEAN> *>':
    assert_cast is redundant for the same type after removing cv/ref qualifiers
```

That kills `doris_be_test` compilation on every PR that runs BE-UT.

Use the strongly typed `get_null_map_column()` (which returns
`ColumnUInt8&`) directly so the cast is no longer needed.

### Release note

None (test-only change, restores BE-UT compilation on master).

### Check List (For Author)

- Test:
    - Compile-check on local ASAN tree: the affected translation unit
      now builds clean (`ninja test/CMakeFiles/doris_be_test.dir/exprs/function/geo/functions_geo_test.cpp.o`).
- Behavior changed: No
- Does this need documentation: No
hello-stephen pushed a commit that referenced this pull request May 27, 2026
### What problem does this PR solve?


#63491
#63049


```
../src/core/assert_cast.h:54:19: error: static assertion failed due to requirement '!std::is_same_v<doris::ColumnVector<doris::TYPE_BOOLEAN> *, doris::ColumnVector<doris::TYPE_BOOLEAN> *>': assert_cast is redundant for the same type after removing cv/ref qualifiers
   54 |     static_assert(!std::is_same_v<AssertCastNormalizedType_t<To>, AssertCastNormalizedType_t<From>>,
      |                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../test/exprs/function/geo/functions_geo_test.cpp:375:5: note: in instantiation of function template specialization 'assert_cast<doris::ColumnVector<doris::TYPE_BOOLEAN> *, TypeCheckOnRelease::ENABLE, doris::ColumnVector<doris::TYPE_BOOLEAN> *>' requested here
  375 |     assert_cast<ColumnUInt8*>(nullable_input->get_null_map_column_ptr().get())->insert_value(0);
      |     ^
1 error generated.
```
csun5285 added a commit to csun5285/doris that referenced this pull request May 27, 2026
The same-type assert_cast static_assert added by apache#63059 rejects the
ColumnUInt8* -> ColumnUInt8* cast at functions_geo_test.cpp:375, breaking
BE UT compilation since the geo test was added (apache#63049). Unblocks BE UT
on this branch.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
yiguolei pushed a commit that referenced this pull request May 28, 2026
…ine_similarity (#62840)

### What problem does this PR solve?

Two defensive hardening fixes in CosineDistance::distance and
CosineSimilarity::distance to guarantee correct results across the full
range of valid float inputs.

Fix 1: Use double-precision intermediate when computing the norm
Before:

return 1 - dot_prod / sqrt(squared_x * squared_y);
After:

const double norm = std::sqrt(static_cast<double>(squared_x) *
static_cast<double>(squared_y));
Why: squared_x * squared_y is a float multiplication. When squared_x and
squared_y are both large (e.g. input elements around 1e19), the product
exceeds FLT_MAX (~3.4e38) and overflows to +inf. Then sqrt(+inf) = +inf
and dot_prod / +inf = 0, so two parallel vectors silently get
cosine_distance = 1.0 (should be 0.0) — a wrong result with no warning.

For typical L2-normalized embedding vectors this never triggers. But
cosine_distance accepts arbitrary float* arrays, not just normalized
embeddings, so the function should be safe for any finite float input.
The cost is two static_cast<double> ops; double's range (~1.8e308)
cannot overflow on any finite float input.

For non-overflow inputs the result is bit-for-bit equivalent (verified
by existing tests, which match the same static_cast<float>(34.0 /
std::sqrt(14.0 * 83.0)) formula).

Fix 2: Clamp cosine to [-1, 1]
After:

return std::clamp(static_cast<float>(dot_prod / norm), -1.0f, 1.0f);
Why: Float rounding can make the computed cosine slightly exceed 1.0 for
identical (or near-identical) vectors. For example with x = y = (0.1f,
0.2f, 0.3f), accumulation rounding can yield cosine = 1.0000001, then
1.0f - cosine = -1e-7 — a negative cosine_distance that violates the
metric contract d >= 0 and may break downstream code (DCHECK(distance >=
0), threshold filters, distance aggregation).

std::clamp is a one-op guarantee that costs nothing for in-range values.


BE UT 编译失败修复(独立于本 PR 余弦修复)
问题:merge 最新 master 后,BE UT 在 functions_geo_test.cpp:375 编译失败:


error: static assertion failed: assert_cast is redundant for the same
type
'!std::is_same_v<ColumnVector<TYPE_BOOLEAN>*,
ColumnVector<TYPE_BOOLEAN>*>'
根因:master 上三个 PR 叠加副作用:

#63491 把 _null_map 改为强类型 ColumnUInt8::WrappedPtr
#63059 加 static_assert 拒绝 same-type assert_cast
#63049(5/26 刚合入)新写的 geo 测试还按老接口加了冗余 cast
修复:去掉冗余包装


-
assert_cast<ColumnUInt8*>(nullable_input->get_null_map_column_ptr().get())->insert_value(0);
+ nullable_input->get_null_map_column_ptr()->insert_value(0);
get_null_map_column_ptr() 现在直接返回
ColumnUInt8::MutablePtr,->insert_value() 语义不变。

影响:一行改动,仅修复编译报错,不涉及测试语义和余弦相关代码。



### Release note

None

### Check List (For Author)

- Test <!-- At least one of them must be included. -->
    - [ ] 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 <!-- Add your reason?  -->

- Behavior changed:
    - [ ] No.
    - [ ] Yes. <!-- Explain the behavior change -->

- Does this need documentation?
    - [ ] No.
- [ ] Yes. <!-- Add document PR link here. eg:
apache/doris-website#1214 -->

### Check List (For Reviewer who merge this PR)

- [ ] Confirm the release note
- [ ] Confirm test cases
- [ ] Confirm document
- [ ] Add branch pick label <!-- Add branch pick label that this PR
should merge into -->

---------

Co-authored-by: yaoxiao <yaoxiao@fosun.com>
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. dev/4.1.x

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants