ClickHouse/tests/queries/0_stateless/02884_string_distance_function.sql

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

39 lines
1.1 KiB
MySQL
Raw Normal View History

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');
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;
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;