Skip to content

Conversation

@linrrzqqq
Copy link
Contributor

@linrrzqqq linrrzqqq commented Apr 16, 2025

What problem does this PR solve?

  1. According to the OGC standard, a point lying exactly on the boundary of a polygon no longer returns true for ST_Contains. This behavior has been changed to return false.
  2. Fix the inconsistency in polygon Contains linestring caused by differing linestring directions.
  3. Fixed a logical error in multipolygon Contains multipolygon

Issue Number: close #xxx

Related PR: #xxx

Problem Summary:

Release note

None

Check List (For Author)

  • Test

    • Regression test
    • Unit Test
    • Manual test (add detailed scripts or steps below)
    • No need to test or manual test. Explain why:
      • This is a refactor/code format and no logic has been changed.
      • Previous test can cover this change.
      • No code files have been changed.
      • Other reason
  • Behavior changed:

    • No.
    • Yes. For a point lying exactly on the boundary of a polygon, the 'ST_Touches' result changed from 'true' to 'false'
  • Does this need documentation?

    • No.
    • Yes.

Check List (For Reviewer who merge this PR)

  • Confirm the release note
  • Confirm test cases
  • Confirm document
  • Add branch pick label

@hello-stephen
Copy link
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
Contributor Author

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	25729	5054	4995	4995
q2	2051	280	192	192
q3	10378	1253	663	663
q4	10229	1008	526	526
q5	7530	2302	2352	2302
q6	178	162	135	135
q7	890	752	635	635
q8	9319	1294	1090	1090
q9	6761	5081	5148	5081
q10	7084	2303	1892	1892
q11	473	283	268	268
q12	345	357	217	217
q13	17765	3700	3064	3064
q14	220	233	203	203
q15	532	495	502	495
q16	447	442	398	398
q17	592	845	343	343
q18	7501	7175	7202	7175
q19	1224	983	576	576
q20	334	343	219	219
q21	3918	3381	2430	2430
q22	1040	1046	970	970
Total cold run time: 114540 ms
Total hot run time: 33869 ms

----- Round 2, with runtime_filter_mode=off -----
q1	5101	5102	5087	5087
q2	241	333	232	232
q3	2217	2677	2277	2277
q4	1454	1854	1422	1422
q5	4458	4400	4413	4400
q6	218	169	130	130
q7	2023	1930	1802	1802
q8	2594	2570	2465	2465
q9	7454	7581	7416	7416
q10	3074	3293	2880	2880
q11	604	525	496	496
q12	750	822	664	664
q13	3847	4283	3505	3505
q14	291	308	295	295
q15	553	484	497	484
q16	484	512	470	470
q17	1168	1643	1410	1410
q18	7856	7477	7465	7465
q19	2059	868	783	783
q20	1977	2086	1894	1894
q21	5160	4822	4697	4697
q22	1074	1058	1048	1048
Total cold run time: 54657 ms
Total hot run time: 51322 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 192012 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 68be68bfce426848c7b2ab71fed3823ab5243ba1, data reload: false

query1	1412	1082	1096	1082
query2	6474	1797	1798	1797
query3	11061	4689	4393	4393
query4	54296	25570	23324	23324
query5	5123	487	445	445
query6	398	189	195	189
query7	5208	506	276	276
query8	327	276	232	232
query9	6834	2571	2577	2571
query10	439	329	259	259
query11	15068	15035	15133	15035
query12	157	116	103	103
query13	1214	512	393	393
query14	10066	6318	6280	6280
query15	193	198	176	176
query16	7045	651	518	518
query17	1102	778	606	606
query18	1575	415	326	326
query19	208	203	171	171
query20	125	126	121	121
query21	211	130	105	105
query22	4448	4532	4415	4415
query23	34172	33414	33527	33414
query24	6624	2396	2404	2396
query25	476	457	404	404
query26	722	278	146	146
query27	2328	522	333	333
query28	2978	2158	2146	2146
query29	583	569	428	428
query30	267	225	191	191
query31	868	864	790	790
query32	71	64	63	63
query33	430	376	302	302
query34	760	867	515	515
query35	795	831	737	737
query36	942	1011	883	883
query37	118	105	78	78
query38	4201	4259	4172	4172
query39	1506	1419	1436	1419
query40	238	119	109	109
query41	57	50	50	50
query42	122	105	107	105
query43	501	487	460	460
query44	1331	817	815	815
query45	179	172	167	167
query46	856	1031	644	644
query47	1848	1926	1796	1796
query48	372	411	330	330
query49	697	499	421	421
query50	651	686	419	419
query51	4193	4204	4288	4204
query52	103	104	98	98
query53	227	254	185	185
query54	582	582	523	523
query55	86	87	88	87
query56	294	324	290	290
query57	1149	1199	1126	1126
query58	261	258	265	258
query59	2734	2743	2712	2712
query60	345	310	297	297
query61	131	124	128	124
query62	765	753	678	678
query63	223	192	183	183
query64	1760	1042	708	708
query65	4513	4278	4234	4234
query66	711	407	314	314
query67	15715	15580	15145	15145
query68	6883	881	502	502
query69	536	304	261	261
query70	1185	1094	1061	1061
query71	499	357	279	279
query72	5956	4853	4876	4853
query73	1236	668	341	341
query74	9078	9083	8638	8638
query75	3879	3182	2690	2690
query76	4286	1189	752	752
query77	625	369	275	275
query78	10091	10064	9252	9252
query79	5073	830	545	545
query80	614	497	437	437
query81	481	256	209	209
query82	539	126	94	94
query83	343	255	226	226
query84	298	106	79	79
query85	806	347	305	305
query86	371	294	292	292
query87	4386	4385	4405	4385
query88	3594	2216	2243	2216
query89	444	304	275	275
query90	1854	216	213	213
query91	142	141	108	108
query92	72	58	55	55
query93	3302	907	571	571
query94	673	398	303	303
query95	372	297	278	278
query96	478	575	271	271
query97	3145	3165	3080	3080
query98	240	217	201	201
query99	1451	1409	1249	1249
Total cold run time: 304401 ms
Total hot run time: 192012 ms

@doris-robot
Copy link

ClickBench: Total hot run time: 29.65 s
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit 68be68bfce426848c7b2ab71fed3823ab5243ba1, data reload: false

query1	0.04	0.04	0.03
query2	0.13	0.11	0.11
query3	0.25	0.20	0.19
query4	1.60	0.19	0.19
query5	0.58	0.57	0.59
query6	1.19	0.72	0.73
query7	0.02	0.02	0.02
query8	0.04	0.04	0.04
query9	0.57	0.52	0.50
query10	0.56	0.56	0.56
query11	0.15	0.10	0.11
query12	0.14	0.11	0.11
query13	0.62	0.60	0.59
query14	1.20	1.19	1.19
query15	0.88	0.84	0.86
query16	0.38	0.38	0.38
query17	1.01	1.04	1.00
query18	0.21	0.20	0.20
query19	1.88	1.75	1.77
query20	0.01	0.02	0.01
query21	15.47	0.88	0.56
query22	0.77	1.26	0.80
query23	14.69	1.37	0.69
query24	6.64	1.62	0.93
query25	0.46	0.29	0.06
query26	0.60	0.16	0.13
query27	0.05	0.04	0.05
query28	9.62	0.89	0.44
query29	12.60	4.00	3.34
query30	0.24	0.08	0.06
query31	2.83	0.57	0.39
query32	3.23	0.55	0.47
query33	3.04	3.02	3.07
query34	15.78	5.08	4.41
query35	4.48	4.50	4.42
query36	0.65	0.49	0.48
query37	0.09	0.06	0.06
query38	0.04	0.04	0.03
query39	0.03	0.02	0.03
query40	0.17	0.14	0.13
query41	0.08	0.02	0.02
query42	0.03	0.02	0.02
query43	0.03	0.04	0.03
Total cold run time: 103.08 s
Total hot run time: 29.65 s

@hello-stephen
Copy link
Contributor

BE UT Coverage Report

Increment line coverage 100.00% (14/14) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 53.15% (14422/27134)
Line Coverage 42.02% (125017/297511)
Region Coverage 40.82% (63863/156458)
Branch Coverage 35.45% (32116/90598)

@linrrzqqq linrrzqqq changed the title [fix](geo) ST_Contains returns false for point on polygon boundary [fix](geo) Fix ST_Contains behavior Apr 19, 2025
@zclllyybb
Copy link
Contributor

run buildall

@doris-robot
Copy link

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

------ Round 1 ----------------------------------
q1	25963	5134	4985	4985
q2	2067	269	177	177
q3	10556	1231	708	708
q4	10288	1016	546	546
q5	9112	2411	2371	2371
q6	187	160	131	131
q7	919	757	601	601
q8	9310	1323	1101	1101
q9	6758	5046	5086	5046
q10	6884	2331	1850	1850
q11	497	296	272	272
q12	345	350	215	215
q13	17776	3754	3513	3513
q14	233	222	210	210
q15	525	498	485	485
q16	444	423	383	383
q17	592	853	388	388
q18	7567	7124	7151	7124
q19	1479	964	545	545
q20	330	342	227	227
q21	4181	3389	2503	2503
q22	1066	1004	922	922
Total cold run time: 117079 ms
Total hot run time: 34303 ms

----- Round 2, with runtime_filter_mode=off -----
q1	5158	5040	5087	5040
q2	236	333	229	229
q3	2183	2629	2331	2331
q4	1355	1839	1445	1445
q5	4538	4448	4338	4338
q6	220	167	124	124
q7	1985	1868	1714	1714
q8	2589	2561	2455	2455
q9	7156	7079	7127	7079
q10	2973	3200	2720	2720
q11	560	510	499	499
q12	702	758	590	590
q13	3545	4004	3333	3333
q14	278	282	259	259
q15	537	464	488	464
q16	449	497	456	456
q17	1151	1604	1367	1367
q18	7630	7508	7420	7420
q19	798	821	933	821
q20	1964	1988	1807	1807
q21	4990	4682	4590	4590
q22	1099	1018	976	976
Total cold run time: 52096 ms
Total hot run time: 50057 ms

@doris-robot
Copy link

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

query1	1020	480	483	480
query2	6557	1804	1791	1791
query3	6765	216	217	216
query4	26048	23262	23478	23262
query5	4320	642	443	443
query6	270	206	190	190
query7	4623	485	276	276
query8	306	254	234	234
query9	8621	2594	2618	2594
query10	491	321	255	255
query11	15184	15106	14821	14821
query12	159	112	104	104
query13	1658	530	400	400
query14	8955	6126	6917	6126
query15	205	196	184	184
query16	7683	666	498	498
query17	1208	725	603	603
query18	2018	401	297	297
query19	195	182	158	158
query20	119	114	114	114
query21	206	137	108	108
query22	4059	4219	4053	4053
query23	34146	33072	32874	32874
query24	7836	2359	2360	2359
query25	520	462	386	386
query26	1234	268	156	156
query27	2625	464	329	329
query28	4388	2072	2057	2057
query29	756	551	425	425
query30	279	217	198	198
query31	917	871	746	746
query32	77	60	65	60
query33	553	361	311	311
query34	795	826	514	514
query35	777	812	708	708
query36	938	992	904	904
query37	111	100	74	74
query38	4205	4157	4168	4157
query39	1460	1383	1389	1383
query40	218	122	107	107
query41	58	53	52	52
query42	118	102	107	102
query43	485	507	477	477
query44	1254	802	791	791
query45	180	169	169	169
query46	829	1031	623	623
query47	1754	1782	1707	1707
query48	369	407	320	320
query49	775	505	412	412
query50	624	682	418	418
query51	4096	4097	4045	4045
query52	109	106	93	93
query53	221	246	181	181
query54	577	559	510	510
query55	82	80	81	80
query56	306	304	288	288
query57	1149	1149	1081	1081
query58	268	246	249	246
query59	2556	2630	2476	2476
query60	336	316	316	316
query61	134	130	128	128
query62	792	756	659	659
query63	229	187	183	183
query64	4311	998	681	681
query65	4379	4247	4247	4247
query66	1098	404	305	305
query67	15975	15482	15227	15227
query68	8052	882	510	510
query69	487	302	258	258
query70	1189	1093	1108	1093
query71	462	296	292	292
query72	5555	4669	2340	2340
query73	708	611	348	348
query74	8906	9007	8992	8992
query75	3784	3222	2698	2698
query76	3649	1164	740	740
query77	796	362	307	307
query78	9904	10157	9242	9242
query79	2546	801	560	560
query80	656	508	432	432
query81	491	253	223	223
query82	637	126	97	97
query83	290	249	234	234
query84	280	109	82	82
query85	794	362	328	328
query86	393	321	293	293
query87	4405	4451	4377	4377
query88	3398	2222	2232	2222
query89	395	315	281	281
query90	1904	212	214	212
query91	152	143	108	108
query92	75	60	56	56
query93	1638	948	577	577
query94	666	401	299	299
query95	375	291	288	288
query96	472	570	271	271
query97	3175	3193	3133	3133
query98	223	210	198	198
query99	1448	1412	1274	1274
Total cold run time: 273474 ms
Total hot run time: 183137 ms

@doris-robot
Copy link

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

query1	0.04	0.03	0.03
query2	0.13	0.10	0.11
query3	0.25	0.19	0.19
query4	1.59	0.19	0.18
query5	0.59	0.60	0.59
query6	1.18	0.71	0.72
query7	0.02	0.01	0.02
query8	0.05	0.04	0.04
query9	0.56	0.52	0.52
query10	0.56	0.57	0.57
query11	0.15	0.12	0.11
query12	0.14	0.11	0.11
query13	0.61	0.59	0.59
query14	0.78	0.80	0.80
query15	0.86	0.85	0.85
query16	0.39	0.38	0.38
query17	1.01	1.02	1.05
query18	0.21	0.20	0.20
query19	1.89	1.76	1.86
query20	0.01	0.01	0.02
query21	15.41	0.90	0.53
query22	0.75	1.22	0.82
query23	14.75	1.35	0.62
query24	6.69	2.28	1.07
query25	0.49	0.29	0.07
query26	0.64	0.16	0.15
query27	0.05	0.05	0.05
query28	10.16	0.88	0.44
query29	12.53	3.88	3.28
query30	0.25	0.08	0.06
query31	2.84	0.59	0.36
query32	3.23	0.54	0.47
query33	3.04	3.05	3.04
query34	15.80	5.09	4.48
query35	4.52	4.49	4.47
query36	0.67	0.51	0.48
query37	0.08	0.07	0.06
query38	0.06	0.04	0.04
query39	0.03	0.03	0.02
query40	0.16	0.13	0.13
query41	0.08	0.02	0.02
query42	0.03	0.02	0.02
query43	0.04	0.04	0.03
Total cold run time: 103.32 s
Total hot run time: 29.48 s

@doris-robot
Copy link

BE UT Coverage Report

Increment line coverage 40.00% (14/35) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 54.67% (14741/26962)
Line Coverage 43.77% (129234/295234)
Region Coverage 42.49% (65982/155273)
Branch Coverage 37.07% (33272/89748)

@hello-stephen
Copy link
Contributor

BE Regression P0 && UT Coverage Report

Increment line coverage 100.00% (35/35) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 78.06% (20660/26466)
Line Coverage 71.60% (211032/294752)
Region Coverage 69.78% (126783/181687)
Branch Coverage 63.04% (64492/102310)

Copy link
Contributor

@zclllyybb zclllyybb 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
Copy link
Contributor

PR approved by anyone and no changes requested.

Copy link
Contributor

@HappenLee HappenLee 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
Copy link
Contributor

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

@github-actions github-actions bot added the approved Indicates a PR has been approved by one committer. label Apr 30, 2025
@HappenLee HappenLee merged commit 909a95d into apache:master Apr 30, 2025
27 of 28 checks passed
github-actions bot pushed a commit that referenced this pull request Apr 30, 2025
1. According to the OGC standard, a point lying exactly on the boundary
of a polygon no longer returns `true` for `ST_Contains`. This behavior
has been changed to return `false`.
2. Fix the inconsistency in `polygon Contains linestring` caused by
differing linestring directions.
3. Fixed a logical error in `multipolygon Contains multipolygon`
github-actions bot pushed a commit that referenced this pull request Apr 30, 2025
1. According to the OGC standard, a point lying exactly on the boundary
of a polygon no longer returns `true` for `ST_Contains`. This behavior
has been changed to return `false`.
2. Fix the inconsistency in `polygon Contains linestring` caused by
differing linestring directions.
3. Fixed a logical error in `multipolygon Contains multipolygon`
yiguolei pushed a commit that referenced this pull request May 3, 2025
Cherry-picked from #50115

Co-authored-by: linrrarity <142187136+linrrzqqq@users.noreply.github.com>
dataroaring pushed a commit that referenced this pull request May 6, 2025
Cherry-picked from #50115

Co-authored-by: linrrarity <142187136+linrrzqqq@users.noreply.github.com>
BePPPower pushed a commit to BePPPower/doris that referenced this pull request May 7, 2025
1. According to the OGC standard, a point lying exactly on the boundary
of a polygon no longer returns `true` for `ST_Contains`. This behavior
has been changed to return `false`.
2. Fix the inconsistency in `polygon Contains linestring` caused by
differing linestring directions.
3. Fixed a logical error in `multipolygon Contains multipolygon`
@yiguolei yiguolei mentioned this pull request May 13, 2025
koarz pushed a commit to koarz/doris that referenced this pull request Jun 4, 2025
1. According to the OGC standard, a point lying exactly on the boundary
of a polygon no longer returns `true` for `ST_Contains`. This behavior
has been changed to return `false`.
2. Fix the inconsistency in `polygon Contains linestring` caused by
differing linestring directions.
3. Fixed a logical error in `multipolygon Contains multipolygon`
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/2.1.10-merged dev/3.0.6-merged p0_w reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants