Skip to content

[Feature](function) Support function DAMERAU_LEVENSHTEIN_DISTANCE - #65278

Merged
zclllyybb merged 3 commits into
apache:masterfrom
linrrzqqq:support-damerau-levenshtein-distance
Jul 9, 2026
Merged

[Feature](function) Support function DAMERAU_LEVENSHTEIN_DISTANCE#65278
zclllyybb merged 3 commits into
apache:masterfrom
linrrzqqq:support-damerau-levenshtein-distance

Conversation

@linrrzqqq

@linrrzqqqlinrrzqqq commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

Release note

Support function DAMERAU_LEVENSHTEIN_DISTANCE

doc: apache/doris-website#3971

@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
linrrzqqqforce-pushed the support-damerau-levenshtein-distance branch from 738ef39 to e875c26CompareJuly 6, 2026 13:31
@linrrzqqq

Copy link
Copy Markdown
CollaboratorAuthor

/review

@github-actionsgithub-actionsBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Automated review completed for PR #65278.

I found no blocking correctness issues and no inline comments to submit.

Critical checkpoint conclusions:

  • Goal and tests: The PR adds damerau_levenshtein_distance plus levenshtein_distance / edit_distance aliases. FE binding, FE constant folding, BE execution, and regression coverage are present for literal, vector/vector, vector/scalar, NULL, UTF-8, transposition, and oversized matrix cases.
  • Scope: The function changes are focused on the string-distance implementation, FE scalar registration, executable folding, benchmark coverage, and one regression suite.
  • Concurrency, lifecycle, persistence, and configuration: Not applicable; this is a deterministic scalar function addition with no new shared state, config, persistence, RPC, or lifecycle path.
  • FE/BE compatibility: FE and BE expose matching names and return INT; aliases map consistently, and the FE/BE Damerau implementations use the same full recurrence and 16M-cell guard.
  • Parallel paths: Runtime BE execution and FE constant folding were checked. The scalar follows the existing Levenshtein nullable/signature pattern and does not require optimizer, join, aggregate, or property-derivation changes.
  • Test result review: The added .out rows match an independent full Damerau-Levenshtein calculation for the covered cases. Patch whitespace/reverse-apply hygiene passed.
  • Validation limits: I did not run FE/BE builds or regression tests because this checkout lacks thirdparty/installed/bin/protoc.

User focus: No additional user-provided review focus was supplied.

Subagent conclusions:

  • optimizer-rewrite: no optimizer/rewrite candidate findings; convergence round 1 returned NO_NEW_VALUABLE_FINDINGS.
  • tests-session-config: no tests/session/config candidate findings; convergence round 1 returned NO_NEW_VALUABLE_FINDINGS.
  • No candidates were accepted, dismissed as duplicates, or submitted as inline comments.

@linrrzqqq

Copy link
Copy Markdown
CollaboratorAuthor

run buildall

@hello-stephen

Copy link
Copy Markdown
Contributor

FE UT Coverage Report

Increment line coverage 3.70% (2/54) 🎉
Increment coverage report
Complete coverage report

@hello-stephen

Copy link
Copy Markdown
Contributor
TPC-H: Total hot run time: 29778 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit e875c261b9102d801cd77a263566867fc3e65788, data reload: false
------ Round 1 ----------------------------------
============================================
q1	17633	4070	4028	4028
q2	2096	339	204	204
q3	10308	1468	833	833
q4	4686	471	343	343
q5	7526	851	585	585
q6	176	167	143	143
q7	779	855	640	640
q8	9376	1554	1510	1510
q9	5864	4430	4413	4413
q10	6778	1790	1580	1580
q11	529	346	308	308
q12	712	541	422	422
q13	18127	3349	2729	2729
q14	264	253	237	237
q15	q16	786	785	717	717
q17	904	929	923	923
q18	7147	5726	5599	5599
q19	1309	1318	1078	1078
q20	750	681	533	533
q21	6137	2847	2635	2635
q22	443	377	318	318
Total cold run time: 102330 ms
Total hot run time: 29778 ms
----- Round 2, with runtime_filter_mode=off -----
============================================
q1	5259	4865	4853	4853
q2	304	349	214	214
q3	4962	5252	4732	4732
q4	2042	2121	1357	1357
q5	5002	4739	4667	4667
q6	251	183	128	128
q7	1892	1714	1524	1524
q8	2386	2135	2080	2080
q9	7736	7333	7241	7241
q10	4699	4641	4192	4192
q11	518	380	349	349
q12	720	747	529	529
q13	2961	3370	2758	2758
q14	286	280	247	247
q15	q16	671	687	606	606
q17	1272	1243	1230	1230
q18	7423	6791	6705	6705
q19	1081	1134	1055	1055
q20	2228	2208	1951	1951
q21	5208	4551	4377	4377
q22	510	447	406	406
Total cold run time: 57411 ms
Total hot run time: 51201 ms

@hello-stephen

Copy link
Copy Markdown
Contributor
TPC-DS: Total hot run time: 179471 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 e875c261b9102d801cd77a263566867fc3e65788, data reload: false
query5	4308	636	493	493
query6	456	225	204	204
query7	4914	594	361	361
query8	341	192	176	176
query9	8782	4067	4044	4044
query10	479	350	308	308
query11	5986	2346	2156	2156
query12	161	106	98	98
query13	1269	608	446	446
query14	6279	5265	4953	4953
query14_1	4273	4277	4280	4277
query15	217	204	179	179
query16	1011	495	452	452
query17	969	750	620	620
query18	2431	479	351	351
query19	221	190	193	190
query20	109	109	102	102
query21	228	159	134	134
query22	13584	13771	13496	13496
query23	17390	16554	16128	16128
query23_1	16255	16363	16249	16249
query24	7567	1774	1298	1298
query24_1	1301	1308	1296	1296
query25	552	438	365	365
query26	1321	358	216	216
query27	2601	593	372	372
query28	4542	2045	2021	2021
query29	1052	595	478	478
query30	344	258	220	220
query31	1125	1086	977	977
query32	148	62	64	62
query33	508	305	247	247
query34	1181	1143	643	643
query35	763	775	665	665
query36	1412	1369	1235	1235
query37	158	104	94	94
query38	1882	1682	1651	1651
query39	918	931	886	886
query39_1	863	864	876	864
query40	270	162	141	141
query41	65	62	61	61
query42	95	92	94	92
query43	317	322	277	277
query44	1417	788	788	788
query45	198	188	183	183
query46	1088	1213	733	733
query47	2378	2378	2206	2206
query48	415	426	302	302
query49	578	433	303	303
query50	1078	425	333	333
query51	10757	10755	10715	10715
query52	87	88	74	74
query53	257	273	198	198
query54	287	233	224	224
query55	76	75	67	67
query56	332	307	288	288
query57	1442	1374	1335	1335
query58	320	285	268	268
query59	1536	1674	1428	1428
query60	313	279	258	258
query61	170	166	164	164
query62	704	652	584	584
query63	246	209	215	209
query64	2595	808	660	660
query65	4882	4802	4755	4755
query66	1859	526	402	402
query67	29508	29526	29268	29268
query68	3109	1625	981	981
query69	439	313	284	284
query70	1117	970	964	964
query71	345	324	303	303
query72	2867	2584	2285	2285
query73	867	794	406	406
query74	5109	4928	4752	4752
query75	2598	2589	2225	2225
query76	2316	1198	773	773
query77	351	379	276	276
query78	12373	12283	11674	11674
query79	1429	1146	720	720
query80	1111	529	456	456
query81	504	312	278	278
query82	977	151	122	122
query83	396	314	294	294
query84	365	158	132	132
query85	993	582	492	492
query86	439	303	274	274
query87	1831	1817	1744	1744
query88	3705	2804	2783	2783
query89	468	415	361	361
query90	1849	197	198	197
query91	204	183	166	166
query92	60	60	54	54
query93	1579	1495	1019	1019
query94	729	350	318	318
query95	797	569	488	488
query96	1046	798	374	374
query97	2684	2653	2540	2540
query98	223	205	200	200
query99	1174	1156	1025	1025
Total cold run time: 265684 ms
Total hot run time: 179471 ms

@hello-stephen

Copy link
Copy Markdown
Contributor
ClickBench: Total hot run time: 24.97 s
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit e875c261b9102d801cd77a263566867fc3e65788, data reload: false
query1	0.01	0.01	0.00
query2	0.10	0.04	0.04
query3	0.26	0.14	0.13
query4	1.60	0.13	0.13
query5	0.26	0.22	0.22
query6	1.23	1.08	1.10
query7	0.04	0.01	0.01
query8	0.05	0.04	0.04
query9	0.39	0.31	0.32
query10	0.55	0.53	0.54
query11	0.19	0.14	0.14
query12	0.20	0.15	0.14
query13	0.48	0.48	0.47
query14	1.02	1.02	1.00
query15	0.62	0.60	0.59
query16	0.32	0.32	0.30
query17	1.06	1.09	1.11
query18	0.22	0.21	0.20
query19	2.04	1.98	1.99
query20	0.02	0.01	0.02
query21	15.46	0.23	0.14
query22	4.82	0.06	0.05
query23	16.13	0.31	0.13
query24	3.12	0.43	0.32
query25	0.12	0.05	0.04
query26	0.79	0.21	0.14
query27	0.04	0.04	0.03
query28	3.48	0.92	0.55
query29	12.51	4.06	3.23
query30	0.27	0.17	0.15
query31	2.76	0.58	0.31
query32	3.22	0.60	0.49
query33	3.26	3.18	3.15
query34	15.42	4.31	3.55
query35	3.53	3.51	3.55
query36	0.55	0.45	0.41
query37	0.08	0.06	0.06
query38	0.05	0.04	0.04
query39	0.04	0.03	0.04
query40	0.17	0.16	0.15
query41	0.09	0.04	0.03
query42	0.04	0.02	0.03
query43	0.04	0.04	0.03
Total cold run time: 96.65 s
Total hot run time: 24.97 s

@hello-stephen

Copy link
Copy Markdown
Contributor

BE UT Coverage Report

Increment line coverage 1.24% (3/241) 🎉

Increment coverage report
Complete coverage report

CategoryCoverage
Function Coverage56.51% (23190/41036)
Line Coverage40.07% (225056/561663)
Region Coverage36.03% (177699/493193)
Branch Coverage37.08% (78954/212935)

@hello-stephen

Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 95.44% (230/241) 🎉

Increment coverage report
Complete coverage report

CategoryCoverage
Function Coverage74.71% (29908/40033)
Line Coverage58.67% (327217/557719)
Region Coverage55.56% (274631/494322)
Branch Coverage56.76% (120816/212859)

@hello-stephen

Copy link
Copy Markdown
Contributor

FE Regression Coverage Report

Increment line coverage 9.19% (51/555) 🎉
Increment coverage report
Complete coverage report

zclllyybb
zclllyybb previously approved these changes Jul 8, 2026
@github-actionsgithub-actionsBot added the approved Indicates a PR has been approved by one committer. label Jul 8, 2026
@github-actions

Copy link
Copy Markdown
Contributor

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

@github-actions

Copy link
Copy Markdown
Contributor

PR approved by anyone and no changes requested.

@linrrzqqq

Copy link
Copy Markdown
CollaboratorAuthor

run buildall

@linrrzqqq

Copy link
Copy Markdown
CollaboratorAuthor

/review

@github-actionsgithub-actionsBot removed the approved Indicates a PR has been approved by one committer. label Jul 8, 2026

@github-actionsgithub-actionsBot 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 completed for PR 65278.

I reviewed the full changed-file set for the new damerau_levenshtein_distance function, the levenshtein_distance / edit_distance aliases, FE/Nereids registration and constant folding, BE vectorized execution, benchmark wiring, and regression expected output. I did not find a substantiated issue that needs an inline review comment.

Critical checkpoint conclusions:

  • Goal/test coverage: the PR adds the FE and BE function surfaces plus regression coverage for constants, aliases, nulls, ASCII/UTF-8 values, vector-vector, vector-scalar, scalar-vector, and the matrix-size error path.
  • Scope/focus: the implementation is focused on the string-distance function family and reuses the existing levenshtein registration and execution patterns.
  • Concurrency/lifecycle/config/persistence: no new concurrency, lifecycle, dynamic config, persistence, storage format, or transaction path was introduced.
  • Compatibility/parallel paths: FE and BE register the new function consistently; the new aliases are registered in both FE and BE. The Nereids scalar class, visitor, and executable folding path are wired.
  • Function correctness: representative expected results were cross-checked against full Damerau-Levenshtein semantics, including transposition cases and UTF-8 cases.
  • Performance/resource behavior: the BE and FE paths both enforce the 16,777,216-cell matrix guard for Damerau-Levenshtein. No additional actionable performance finding was identified.
  • Tests/style: added outputs match the added queries in the reviewed diff, and added patch lines had no trailing whitespace.

Validation limits: this runner is a shallow checkout without the base commit locally, and thirdparty/installed / thirdparty/installed/bin/protoc are absent, so I used GitHub PR metadata/patches as the authoritative diff and did not run FE/BE builds or regression tests.

Subagent conclusions:

  • optimizer-rewrite reviewed optimizer/rewrite, scalar registration, visitor integration, FE executable folding, translator path, alias behavior, and FE/BE semantic parity. It reported NO_NEW_VALUABLE_FINDINGS.
  • tests-session-config reviewed regression tests, expected outputs, session/config propagation, compatibility, CI/style basics, and build/test prerequisites. It reported NO_NEW_VALUABLE_FINDINGS.
  • Final convergence round 1 used the current shared ledger and empty proposed inline comment set; both live subagents replied NO_NEW_VALUABLE_FINDINGS.

User focus: no additional user-provided focus points were present.

@hello-stephen

Copy link
Copy Markdown
Contributor

BE UT Coverage Report

Increment line coverage 1.24% (3/241) 🎉

Increment coverage report
Complete coverage report

CategoryCoverage
Function Coverage56.53% (23209/41055)
Line Coverage40.09% (225220/561726)
Region Coverage36.05% (177889/493406)
Branch Coverage37.10% (79053/213105)

@linrrzqqq

Copy link
Copy Markdown
CollaboratorAuthor

run buildall

@hello-stephen

Copy link
Copy Markdown
Contributor

FE UT Coverage Report

Increment line coverage 3.70% (2/54) 🎉
Increment coverage report
Complete coverage report

@hello-stephen

Copy link
Copy Markdown
Contributor
TPC-H: Total hot run time: 29616 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit d7d8e95eb408e7310d3e0dcfd92f25d534486124, data reload: false
------ Round 1 ----------------------------------
============================================
q1	17639	4238	4141	4141
q2	2097	331	205	205
q3	10229	1358	828	828
q4	4678	471	337	337
q5	7503	841	564	564
q6	187	181	141	141
q7	782	834	629	629
q8	9373	1625	1536	1536
q9	5746	4433	4399	4399
q10	6818	1785	1539	1539
q11	526	341	316	316
q12	734	566	454	454
q13	18121	3384	2762	2762
q14	283	274	264	264
q15	q16	789	788	703	703
q17	1009	1095	882	882
q18	7140	5769	5674	5674
q19	1299	1264	1041	1041
q20	767	662	531	531
q21	6051	2625	2370	2370
q22	447	364	300	300
Total cold run time: 102218 ms
Total hot run time: 29616 ms
----- Round 2, with runtime_filter_mode=off -----
============================================
q1	4499	4445	4396	4396
q2	286	323	213	213
q3	4657	4972	4426	4426
q4	2087	2166	1379	1379
q5	4505	4320	4328	4320
q6	236	176	133	133
q7	1963	2066	1699	1699
q8	2607	2219	2294	2219
q9	8034	8266	7833	7833
q10	4806	4772	4279	4279
q11	587	422	400	400
q12	755	791	564	564
q13	3371	3603	2929	2929
q14	290	294	265	265
q15	q16	698	716	638	638
q17	1369	1367	1486	1367
q18	7707	7497	7162	7162
q19	1118	1046	1088	1046
q20	2224	2211	1927	1927
q21	5291	4673	4505	4505
q22	517	481	401	401
Total cold run time: 57607 ms
Total hot run time: 52101 ms

@linrrzqqq

Copy link
Copy Markdown
CollaboratorAuthor

/review

@hello-stephen

Copy link
Copy Markdown
Contributor
TPC-DS: Total hot run time: 181061 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 d7d8e95eb408e7310d3e0dcfd92f25d534486124, data reload: false
query5	4317	633	504	504
query6	453	219	195	195
query7	4892	589	333	333
query8	351	195	175	175
query9	8772	4145	4099	4099
query10	456	352	308	308
query11	5902	2350	2165	2165
query12	155	102	100	100
query13	1246	613	435	435
query14	6225	5351	4981	4981
query14_1	4384	4369	4314	4314
query15	216	216	176	176
query16	1016	479	495	479
query17	973	739	613	613
query18	2472	483	364	364
query19	214	196	161	161
query20	110	111	110	110
query21	239	160	141	141
query22	13629	13551	13471	13471
query23	17489	16637	16255	16255
query23_1	16280	16320	16286	16286
query24	7457	1770	1309	1309
query24_1	1278	1308	1314	1308
query25	544	438	368	368
query26	1355	342	204	204
query27	2595	602	385	385
query28	4477	2050	1996	1996
query29	1072	612	474	474
query30	337	263	222	222
query31	1131	1098	989	989
query32	109	61	61	61
query33	522	318	277	277
query34	1204	1121	652	652
query35	751	822	666	666
query36	1386	1371	1221	1221
query37	153	110	96	96
query38	1919	1693	1665	1665
query39	924	923	892	892
query39_1	885	891	892	891
query40	254	171	143	143
query41	64	63	63	63
query42	95	90	92	90
query43	320	328	287	287
query44	1445	783	751	751
query45	198	184	185	184
query46	1083	1220	750	750
query47	2373	2329	2263	2263
query48	401	432	283	283
query49	585	435	327	327
query50	1049	430	347	347
query51	10877	10716	10588	10588
query52	84	86	75	75
query53	256	286	209	209
query54	292	231	220	220
query55	79	73	69	69
query56	278	303	300	300
query57	1442	1373	1302	1302
query58	288	261	255	255
query59	1592	1633	1495	1495
query60	318	271	254	254
query61	154	151	151	151
query62	692	653	587	587
query63	243	213	210	210
query64	2841	1020	884	884
query65	4879	4789	4803	4789
query66	1845	509	398	398
query67	29760	29745	29376	29376
query68	2973	1552	981	981
query69	414	308	277	277
query70	1123	930	997	930
query71	343	309	296	296
query72	3155	2677	2368	2368
query73	831	755	447	447
query74	5131	4979	4788	4788
query75	2659	2598	2256	2256
query76	2339	1187	798	798
query77	364	384	281	281
query78	12554	12392	11782	11782
query79	1241	1120	773	773
query80	612	546	451	451
query81	455	326	286	286
query82	234	162	127	127
query83	312	317	292	292
query84	308	159	132	132
query85	911	595	503	503
query86	332	299	271	271
query87	1825	1829	1733	1733
query88	3740	2824	2826	2824
query89	441	401	353	353
query90	2175	195	203	195
query91	202	186	163	163
query92	65	60	57	57
query93	1673	1525	945	945
query94	577	379	349	349
query95	799	620	455	455
query96	1089	812	357	357
query97	2691	2713	2548	2548
query98	226	213	207	207
query99	1150	1185	1040	1040
Total cold run time: 265011 ms
Total hot run time: 181061 ms

@hello-stephen

Copy link
Copy Markdown
Contributor
ClickBench: Total hot run time: 24.97 s
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit d7d8e95eb408e7310d3e0dcfd92f25d534486124, data reload: false
query1	0.01	0.01	0.00
query2	0.10	0.05	0.04
query3	0.26	0.14	0.14
query4	1.62	0.15	0.15
query5	0.24	0.25	0.22
query6	1.26	1.08	1.10
query7	0.04	0.00	0.01
query8	0.05	0.03	0.04
query9	0.41	0.32	0.32
query10	0.57	0.56	0.57
query11	0.20	0.13	0.13
query12	0.18	0.14	0.15
query13	0.48	0.49	0.49
query14	1.02	1.01	1.01
query15	0.61	0.59	0.61
query16	0.32	0.33	0.30
query17	1.14	1.09	1.11
query18	0.23	0.21	0.22
query19	2.09	1.88	1.91
query20	0.02	0.01	0.01
query21	15.43	0.23	0.14
query22	4.80	0.05	0.05
query23	16.14	0.31	0.12
query24	2.90	0.44	0.32
query25	0.11	0.04	0.04
query26	0.72	0.22	0.17
query27	0.04	0.03	0.03
query28	3.46	1.04	0.53
query29	12.51	4.14	3.22
query30	0.29	0.16	0.17
query31	2.78	0.65	0.32
query32	3.22	0.61	0.49
query33	3.12	3.22	3.15
query34	15.56	4.45	3.52
query35	3.55	3.50	3.54
query36	0.58	0.43	0.44
query37	0.09	0.07	0.07
query38	0.06	0.04	0.04
query39	0.04	0.03	0.04
query40	0.18	0.16	0.16
query41	0.09	0.04	0.03
query42	0.04	0.03	0.03
query43	0.04	0.04	0.03
Total cold run time: 96.6 s
Total hot run time: 24.97 s

@github-actionsgithub-actionsBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Automated review completed for PR 65278.

I did not find a new, distinct correctness issue that should be submitted as an inline review comment. The two ordering concerns in BuiltinScalarFunctions.java are already covered by existing inline threads:

  • DamerauLevenshteinDistance.class ordering before Database.class
  • Levenshtein.class ordering after Length.class

Critical checkpoint conclusions:

  • Goal and coverage: the PR adds damerau_levenshtein_distance, Levenshtein aliases, FE/Nereids registration, BE execution, benchmark coverage, and regression coverage. Tests cover constant folding, nullable inputs, table/vector paths, UTF-8 transpositions, aliases, and the large matrix error path.
  • Scope: the implementation is focused on string distance functions and their registration/tests.
  • FE/BE consistency: BE registration, FE BuiltinScalarFunctions, Nereids scalar class, visitor, and executable constant-folding path all use matching names and compatible integer return semantics.
  • Parallel paths: scalar/scalar constant folding and BE vector/vector, vector/scalar, and scalar/vector paths were checked. The new Status errors from the BE matrix-size guard are propagated by FunctionBinaryToType.
  • Concurrency and lifecycle: no new runtime shared mutable state, locks, async paths, persistence, edit logs, storage formats, or config items are introduced.
  • Memory/performance: the Damerau implementation has an explicit 16M-cell matrix guard, uses allocator-aware containers for the new BE-owned buffers, and avoids the slower UTF-8 direct-comparison inner loop.
  • Observability: no additional logs or metrics appear necessary for this scalar function.
  • Tests: regression cases and expected output are present, but I did not run them locally because this runner is missing .worktree_initialized, thirdparty/installed, and thirdparty/installed/bin/protoc.

User focus: no additional user-provided review focus was present.

Subagent conclusions:

  • optimizer-rewrite: no candidates appended; final convergence round 1 returned NO_NEW_VALUABLE_FINDINGS.
  • tests-session-config: no candidates appended; final convergence round 1 returned NO_NEW_VALUABLE_FINDINGS.
  • Main duplicate suppression: MAIN-DUP-001 and MAIN-DUP-002 were not resubmitted because they duplicate existing inline review threads.
  • Main dismissed checks: MAIN-DISMISS-001 and MAIN-DISMISS-002 were dismissed with code evidence for FE/BE matrix-limit and UTF-8 folding/runtime consistency.

@hello-stephen

Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 95.44% (230/241) 🎉

Increment coverage report
Complete coverage report

CategoryCoverage
Function Coverage73.11% (29301/40079)
Line Coverage56.67% (316577/558615)
Region Coverage53.06% (262958/495623)
Branch Coverage54.13% (115516/213386)

@hello-stephen

Copy link
Copy Markdown
Contributor

FE Regression Coverage Report

Increment line coverage 8.87% (51/575) 🎉
Increment coverage report
Complete coverage report

1 similar comment
@hello-stephen

Copy link
Copy Markdown
Contributor

FE Regression Coverage Report

Increment line coverage 8.87% (51/575) 🎉
Increment coverage report
Complete coverage report

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

Copy link
Copy Markdown
Contributor

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

@zclllyybb
zclllyybb merged commit 4dfcb4f into apache:masterJul 9, 2026
30 of 31 checks passed
@linrrzqqq
linrrzqqq deleted the support-damerau-levenshtein-distance branch July 9, 2026 12:44
puranjay2597 pushed a commit to puranjay2597/doris that referenced this pull request Sep 2, 2026
…ing functions
Rebuilds the string-similarity functions proposed in apache#60799 on top of current
master, addressing prior review feedback:
- levenshtein and damerau_levenshtein are dropped: both now exist on master
(apache#60412, apache#65278) under levenshtein/damerau_levenshtein_distance, so keeping
ours would only collide.
- All three functions get full UTF-8 support (ASCII fast path + character-
aware path via VStringFunctions::get_utf8_char_offsets/utf8_char_equal),
matching the pattern established by levenshtein/damerau_levenshtein_distance
instead of operating on raw bytes.
- jaro_winkler now shares its Jaro computation with the new jaro function
instead of duplicating the matching/transposition logic.
- jaccard_similarity is redefined as a character-set Jaccard index (bitset for
the ASCII path, hash set of UTF-8 characters otherwise), matching
ClickHouse's stringJaccardIndex semantics, rather than an unexplained
byte-bigram scheme.
- Added FE constant-folding (StringArithmetic.java) for all three functions,
and BE unit tests plus expanded regression coverage (column/constant
combinations, nullable columns, UTF-8, over-length-input errors).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
puranjay2597 pushed a commit to puranjay2597/doris that referenced this pull request Sep 2, 2026
…ing functions
Rebuilds the string-similarity functions proposed in apache#60799 on top of current
master, addressing prior review feedback:
- levenshtein and damerau_levenshtein are dropped: both now exist on master
(apache#60412, apache#65278) under levenshtein/damerau_levenshtein_distance, so keeping
ours would only collide.
- All three functions get full UTF-8 support (ASCII fast path + character-
aware path via VStringFunctions::get_utf8_char_offsets/utf8_char_equal),
matching the pattern established by levenshtein/damerau_levenshtein_distance
instead of operating on raw bytes.
- jaro_winkler now shares its Jaro computation with the new jaro function
instead of duplicating the matching/transposition logic.
- jaccard_similarity is redefined as a character-set Jaccard index (bitset for
the ASCII path, hash set of UTF-8 characters otherwise), matching
ClickHouse's stringJaccardIndex semantics, rather than an unexplained
byte-bigram scheme.
- Added FE constant-folding (StringArithmetic.java) for all three functions,
and BE unit tests plus expanded regression coverage (column/constant
combinations, nullable columns, UTF-8, over-length-input errors).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
puranjay2597 pushed a commit to puranjay2597/doris that referenced this pull request Sep 2, 2026
…ing functions
Rebuilds the string-similarity functions proposed in apache#60799 on top of current
master, addressing prior review feedback:
- levenshtein and damerau_levenshtein are dropped: both now exist on master
(apache#60412, apache#65278) under levenshtein/damerau_levenshtein_distance, so keeping
ours would only collide.
- All three functions get full UTF-8 support (ASCII fast path + character-
aware path via VStringFunctions::get_utf8_char_offsets/utf8_char_equal),
matching the pattern established by levenshtein/damerau_levenshtein_distance
instead of operating on raw bytes.
- jaro_winkler now shares its Jaro computation with the new jaro function
instead of duplicating the matching/transposition logic.
- jaccard_similarity is redefined as a character-set Jaccard index (bitset for
the ASCII path, hash set of UTF-8 characters otherwise), matching
ClickHouse's stringJaccardIndex semantics, rather than an unexplained
byte-bigram scheme.
- Added FE constant-folding (StringArithmetic.java) for all three functions,
and BE unit tests plus expanded regression coverage (column/constant
combinations, nullable columns, UTF-8, over-length-input errors).
puranjay2597 pushed a commit to puranjay2597/doris that referenced this pull request Sep 2, 2026
…ing functions
Rebuilds the string-similarity functions proposed in apache#60799 on top of current
master, addressing prior review feedback:
- levenshtein and damerau_levenshtein are dropped: both now exist on master
(apache#60412, apache#65278) under levenshtein/damerau_levenshtein_distance, so keeping
ours would only collide.
- All three functions get full UTF-8 support (ASCII fast path + character-
aware path via VStringFunctions::get_utf8_char_offsets/utf8_char_equal),
matching the pattern established by levenshtein/damerau_levenshtein_distance
instead of operating on raw bytes.
- jaro_winkler now shares its Jaro computation with the new jaro function
instead of duplicating the matching/transposition logic.
- jaccard_similarity is redefined as a character-set Jaccard index (bitset for
the ASCII path, hash set of UTF-8 characters otherwise), matching
ClickHouse's stringJaccardIndex semantics, rather than an unexplained
byte-bigram scheme.
- Added FE constant-folding (StringArithmetic.java) for all three functions,
and BE unit tests plus expanded regression coverage (column/constant
combinations, nullable columns, UTF-8, over-length-input errors).
puranjay2597 pushed a commit to puranjay2597/doris that referenced this pull request Sep 3, 2026
…rd with BE
Reviewed the merged levenshtein/hamming_distance (apache#60412) and
damerau_levenshtein_distance (apache#65278, apache#66236) PRs for consistency with this
one. Found and fixed a real FE/BE divergence in the process:
- The FE constant-fold length guard checked Java code point count, while the
BE guard checks UTF-8 byte length. For multi-byte input the two disagree
(e.g. ~30000 3-byte characters is under the FE's 65535 code-point cap but
over BE's 65535-byte cap), so a literal expression could fold successfully
on FE while the same value would be rejected by BE if read from a column.
FE now measures UTF-8 bytes too, matching function_string_similarity.cpp
exactly (mirrors the fix pattern in apache#64881, "Align constant folding with
BE results").
- Added regression coverage for astral-plane (surrogate-pair/4-byte UTF-8)
characters on all three functions, matching the precedent set for
RIGHT/INSTR in apache#64881.
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approvedIndicates a PR has been approved by one committer.dev/4.2.xreviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@linrrzqqq@hello-stephen@924060929@zclllyybb