Skip to content

[feature](function) Add ST_IsClosed function - #67350

Open
YanzhiJin5 wants to merge 1 commit into
apache:masterfrom
YanzhiJin5:feature/st-isclosed
Open

[feature](function) Add ST_IsClosed function#67350
YanzhiJin5 wants to merge 1 commit into
apache:masterfrom
YanzhiJin5:feature/st-isclosed

Conversation

@YanzhiJin5

@YanzhiJin5 YanzhiJin5 commented Aug 31, 2026

Copy link
Copy Markdown

What problem does this PR solve?

Issue Number: ref #48203

Related PR: apache/doris-website#4102

Problem Summary:

Add the ST_IsClosed spatial scalar function.

For a valid LineString, the function returns:

  • true when the first and last points are exactly equal
  • false when the LineString is open
  • NULL for a NULL input
  • NULL for a non-LineString or invalid encoded geometry

The implementation uses exact S2 point equality without introducing a tolerance.

This PR also adds Nereids registration and visitor support, FE and BE unit tests, and a self-asserting SQL regression suite.

Release note

Add the ST_IsClosed spatial function.

Check List (For Author)

  • Test

    • Regression test

    • Unit Test

      • FE targeted unit test passed
      • BE VGeoFunctionsTest.* passed
      • FE production build passed
      • SQL regression suite is included but was not run locally; it will be validated by CI
    • Manual test

    • No need to test or manual test

  • Behavior changed:

    • No.
    • Yes.
  • Does this need documentation?

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

@YanzhiJin5

Copy link
Copy Markdown
Author

run buildall

@YanzhiJin5

Copy link
Copy Markdown
Author

/review

@hello-stephen

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

------ Round 1 ----------------------------------
============================================
q1	17588	3046	3055	3046
q2	2131	267	220	220
q3	10214	902	521	521
q4	4665	248	203	203
q5	7683	591	380	380
q6	142	115	94	94
q7	564	501	387	387
q8	9234	964	977	964
q9	3474	2420	2405	2405
q10	6605	899	722	722
q11	402	197	184	184
q12	615	262	199	199
q13	18123	1536	1167	1167
q14	156	151	136	136
q15	q16	440	407	368	368
q17	1414	927	804	804
q18	3080	2249	2236	2236
q19	1263	877	736	736
q20	386	304	202	202
q21	5595	1606	1838	1606
q22	328	272	227	227
Total cold run time: 94102 ms
Total hot run time: 16807 ms

----- Round 2, with runtime_filter_mode=off -----
============================================
q1	3419	3352	3335	3335
q2	509	407	373	373
q3	2300	2448	2217	2217
q4	1195	1187	888	888
q5	2196	2098	2105	2098
q6	171	121	84	84
q7	1048	896	826	826
q8	1607	1410	1421	1410
q9	3157	3122	3094	3094
q10	1872	1842	1671	1671
q11	362	279	259	259
q12	452	427	352	352
q13	1500	1556	1150	1150
q14	165	173	162	162
q15	q16	394	402	356	356
q17	3544	3297	3236	3236
q18	4834	4436	4759	4436
q19	937	877	870	870
q20	1026	978	815	815
q21	3888	3230	3221	3221
q22	397	355	312	312
Total cold run time: 34973 ms
Total hot run time: 31165 ms

@hello-stephen

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

query5	4272	408	336	336
query6	384	138	122	122
query7	4957	429	238	238
query8	286	126	118	118
query9	8715	2888	2890	2888
query10	365	229	179	179
query11	5364	1039	914	914
query12	116	71	70	70
query13	1184	470	322	322
query14	6059	2199	2089	2089
query14_1	1997	1949	1969	1949
query15	174	123	119	119
query16	917	379	351	351
query17	799	486	388	388
query18	2335	351	246	246
query19	169	139	115	115
query20	74	73	72	72
query21	199	110	95	95
query22	5463	5488	5240	5240
query23	6805	6147	6121	6121
query23_1	6231	5975	6178	5975
query24	7305	1118	751	751
query24_1	782	745	786	745
query25	406	279	235	235
query26	1237	226	127	127
query27	2789	425	256	256
query28	4684	1487	1526	1487
query29	914	430	335	335
query30	249	153	129	129
query31	813	408	326	326
query32	130	67	69	67
query33	473	216	179	179
query34	998	817	502	502
query35	414	417	346	346
query36	591	552	530	530
query37	113	80	68	68
query38	1009	851	801	801
query39	491	487	475	475
query39_1	489	497	496	496
query40	202	89	77	77
query41	54	53	52	52
query42	73	73	75	73
query43	244	248	211	211
query44	1030	546	552	546
query45	108	107	97	97
query46	769	846	521	521
query47	758	778	710	710
query48	293	326	232	232
query49	533	258	181	181
query50	743	260	196	196
query51	8224	8236	8446	8236
query52	70	67	59	59
query53	191	199	154	154
query54	208	198	192	192
query55	71	60	54	54
query56	206	159	169	159
query57	687	665	660	660
query58	190	157	162	157
query59	1219	1248	1099	1099
query60	224	207	193	193
query61	141	132	121	121
query62	374	198	176	176
query63	172	140	140	140
query64	2687	712	606	606
query65	1665	1653	1594	1594
query66	1763	255	192	192
query67	10010	9847	9572	9572
query68	3008	1231	746	746
query69	359	226	190	190
query70	697	646	618	618
query71	243	180	163	163
query72	2424	1766	1565	1565
query73	643	605	347	347
query74	2002	1219	1142	1142
query75	1177	1132	949	949
query76	2376	741	541	541
query77	244	260	215	215
query78	3903	3621	3183	3183
query79	2165	843	591	591
query80	1599	335	289	289
query81	491	153	131	131
query82	624	132	99	99
query83	331	214	192	192
query84	288	111	86	86
query85	795	391	304	304
query86	382	179	174	174
query87	1007	984	880	880
query88	2784	2116	2116	2116
query89	284	198	177	177
query90	1930	129	132	129
query91	133	115	103	103
query92	81	70	65	65
query93	1410	1113	753	753
query94	640	239	217	217
query95	525	254	305	254
query96	827	579	234	234
query97	1074	1036	987	987
query98	140	133	137	133
query99	424	346	315	315
Total cold run time: 178092 ms
Total hot run time: 82164 ms

@hello-stephen

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

query1	0.00	0.01	0.00
query2	0.08	0.04	0.04
query3	0.25	0.12	0.11
query4	1.60	0.10	0.11
query5	0.18	0.16	0.16
query6	1.24	0.69	0.71
query7	0.03	0.00	0.01
query8	0.05	0.03	0.02
query9	0.28	0.21	0.22
query10	0.35	0.33	0.34
query11	0.16	0.12	0.12
query12	0.14	0.13	0.12
query13	0.31	0.31	0.31
query14	0.46	0.47	0.46
query15	0.36	0.35	0.34
query16	0.20	0.21	0.22
query17	0.65	0.69	0.68
query18	0.18	0.18	0.18
query19	1.12	1.12	1.11
query20	0.01	0.02	0.02
query21	15.43	0.16	0.13
query22	5.06	0.04	0.05
query23	16.16	0.25	0.10
query24	2.99	0.33	0.23
query25	0.10	0.05	0.03
query26	0.79	0.16	0.12
query27	0.04	0.03	0.03
query28	3.65	0.56	0.27
query29	12.46	3.21	2.58
query30	0.26	0.10	0.12
query31	2.76	0.38	0.18
query32	3.52	0.31	0.23
query33	1.38	1.52	1.52
query34	15.35	2.19	1.78
query35	1.76	1.69	1.70
query36	0.46	0.30	0.29
query37	0.06	0.04	0.04
query38	0.05	0.03	0.03
query39	0.03	0.03	0.02
query40	0.12	0.07	0.07
query41	0.07	0.03	0.02
query42	0.04	0.02	0.02
query43	0.04	0.03	0.03
Total cold run time: 90.23 s
Total hot run time: 14.76 s

@hello-stephen

Copy link
Copy Markdown
Contributor

FE UT Coverage Report

Increment line coverage 75.00% (9/12) 🎉
Increment coverage report
Complete coverage report

@hello-stephen

Copy link
Copy Markdown
Contributor

BE UT Coverage Report

Increment line coverage 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 62.83% (29445/46865)
Line Coverage 47.83% (308121/644153)
Region Coverage 43.43% (248807/572906)
Branch Coverage 44.99% (115785/257380)

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants