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.

38 lines
1.2 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-27 03:16:52 +00:00
select 'const arguments byteEditDistance';
select byteEditDistance('clickhouse', 'mouse');
2023-09-28 04:30:45 +00:00
/*select 'const arguments byteJaccardIndex';
select byteJaccardIndex('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-28 04:30:45 +00:00
/*select 'byteJaccardIndex';
select byteJaccardIndex(s1, s2) from t;*/
2023-09-27 03:16:52 +00:00
select 'byteEditDistance';
2023-09-23 17:17:35 +00:00
select byteEditDistance(s1, s2) from t;
2023-09-27 03:16:52 +00:00
select 'byteLevenshteinDistance';
2023-09-23 17:17:35 +00:00
select byteLevenshteinDistance(s1, s2) from t;
2023-09-27 03:16:52 +00:00
SELECT byteEditDistance(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;