2023-09-27 03:16:52 +00:00
|
|
|
select 'const arguments byteHammingDistance';
|
2023-09-23 04:52:31 +00:00
|
|
|
select byteHammingDistance('abcd', 'abcd');
|
2023-09-28 05:24:39 +00:00
|
|
|
select 'const arguments editDistance';
|
|
|
|
select editDistance('clickhouse', 'mouse');
|
2023-09-29 09:48:36 +00:00
|
|
|
|
|
|
|
select 'const arguments jaccardIndex';
|
|
|
|
select jaccardIndex('clickhouse', 'mouse');
|
2023-09-27 03:16:52 +00:00
|
|
|
|
2023-09-22 17:43:52 +00:00
|
|
|
drop table if exists t;
|
|
|
|
create table t
|
|
|
|
(
|
|
|
|
s1 String,
|
|
|
|
s2 String
|
|
|
|
) engine = MergeTree order by s1;
|
|
|
|
|
2023-09-23 17:17:35 +00:00
|
|
|
insert into t values ('abcdefg', 'abcdef') ('abcdefg', 'bcdefg') ('abcdefg', '') ('mouse', 'clickhouse');
|
2023-09-27 03:16:52 +00:00
|
|
|
select 'byteHammingDistance';
|
2023-09-23 04:52:31 +00:00
|
|
|
select byteHammingDistance(s1, s2) from t;
|
2023-09-27 03:16:52 +00:00
|
|
|
select 'byteHammingDistance(const, non const)';
|
2023-09-23 04:52:31 +00:00
|
|
|
select byteHammingDistance('abc', s2) from t;
|
2023-09-27 03:16:52 +00:00
|
|
|
select 'byteHammingDistance(non const, const)';
|
2023-09-23 04:52:31 +00:00
|
|
|
select byteHammingDistance(s2, 'def') from t;
|
2023-09-22 17:43:52 +00:00
|
|
|
|
2023-09-27 03:16:52 +00:00
|
|
|
select 'mismatches(alias)';
|
2023-09-23 17:17:35 +00:00
|
|
|
select mismatches(s1, s2) from t;
|
|
|
|
select mismatches('abc', s2) from t;
|
|
|
|
select mismatches(s2, 'def') from t;
|
|
|
|
|
2023-09-29 09:48:36 +00:00
|
|
|
select 'jaccardIndex';
|
|
|
|
select jaccardIndex(s1, s2) from t;
|
2023-09-28 05:24:39 +00:00
|
|
|
select 'editDistance';
|
|
|
|
select editDistance(s1, s2) from t;
|
|
|
|
select 'levenshteinDistance';
|
|
|
|
select levenshteinDistance(s1, s2) from t;
|
2023-09-23 17:17:35 +00:00
|
|
|
|
2023-09-28 05:24:39 +00:00
|
|
|
SELECT editDistance(randomString(power(2, 17)), 'abc'); -- { serverError TOO_LARGE_STRING_SIZE}
|
2023-09-23 17:17:35 +00:00
|
|
|
|
2023-09-22 17:43:52 +00:00
|
|
|
drop table t;
|