mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-05 22:12:21 +00:00
e25ca139cd
With this commit, SQL functions LIKE and MATCH and their variants can work with non-const needle arguments. E.g. create table tab (id UInt32, haystack String, needle String) engine = MergeTree() order by id; insert into tab values (1, 'Hello', '%ell%') (2, 'World', '%orl%') select id, haystack, needle, like(haystack, needle) from tab; For that, methods vectorVector() and vectorFixedVector() were added to MatchImpl. The existing code for const needles has an optimization where the compiled regexp is cached. The new code expects a different needle per row and consequently does not cache the regexp.
191 lines
3.6 KiB
Plaintext
191 lines
3.6 KiB
Plaintext
LIKE
|
||
1 Hello 0
|
||
2 Hello % 1
|
||
3 Hello %% 1
|
||
4 Hello %%% 1
|
||
5 Hello %_% 1
|
||
6 Hello _ 0
|
||
7 Hello _% 1
|
||
8 Hello %_ 1
|
||
9 Hello H%o 1
|
||
10 hello H%0 0
|
||
11 hello h%o 1
|
||
12 Hello h%o 0
|
||
13 OHello %lhell% 0
|
||
14 OHello %hell% 0
|
||
15 hEllo %HEL% 0
|
||
16 abcdef %aBc%def% 0
|
||
17 ABCDDEF %abc%def% 0
|
||
18 Abc\nDef %abc%def% 0
|
||
19 abc\ntdef %abc%def% 1
|
||
20 abct\ndef %abc%dEf% 0
|
||
21 abc\n\ndeF %abc%def% 0
|
||
22 abc\n\ntdef %abc%deF% 0
|
||
23 Abc\nt\ndef %abc%def% 0
|
||
24 abct\n\ndef %abc%def% 1
|
||
25 ab\ndef %Abc%def% 0
|
||
26 aBc\nef %ABC%DEF% 0
|
||
27 ёЁё Ё%Ё 0
|
||
28 ощщЁё Щ%Ё 0
|
||
29 ощЩЁё %Щ%Ё 0
|
||
30 Щущпандер %щп%е% 1
|
||
31 Щущпандер %щП%е% 0
|
||
32 ощщЁё %щ% 1
|
||
33 ощЩЁё %ё% 1
|
||
34 Hello .* 0
|
||
35 Hello .*ell.* 0
|
||
36 Hello o$ 0
|
||
37 Hello hE.*lO 0
|
||
NOT LIKE
|
||
1 Hello 1
|
||
2 Hello % 0
|
||
3 Hello %% 0
|
||
4 Hello %%% 0
|
||
5 Hello %_% 0
|
||
6 Hello _ 1
|
||
7 Hello _% 0
|
||
8 Hello %_ 0
|
||
9 Hello H%o 0
|
||
10 hello H%0 1
|
||
11 hello h%o 0
|
||
12 Hello h%o 1
|
||
13 OHello %lhell% 1
|
||
14 OHello %hell% 1
|
||
15 hEllo %HEL% 1
|
||
16 abcdef %aBc%def% 1
|
||
17 ABCDDEF %abc%def% 1
|
||
18 Abc\nDef %abc%def% 1
|
||
19 abc\ntdef %abc%def% 0
|
||
20 abct\ndef %abc%dEf% 1
|
||
21 abc\n\ndeF %abc%def% 1
|
||
22 abc\n\ntdef %abc%deF% 1
|
||
23 Abc\nt\ndef %abc%def% 1
|
||
24 abct\n\ndef %abc%def% 0
|
||
25 ab\ndef %Abc%def% 1
|
||
26 aBc\nef %ABC%DEF% 1
|
||
27 ёЁё Ё%Ё 1
|
||
28 ощщЁё Щ%Ё 1
|
||
29 ощЩЁё %Щ%Ё 1
|
||
30 Щущпандер %щп%е% 0
|
||
31 Щущпандер %щП%е% 1
|
||
32 ощщЁё %щ% 0
|
||
33 ощЩЁё %ё% 0
|
||
34 Hello .* 1
|
||
35 Hello .*ell.* 1
|
||
36 Hello o$ 1
|
||
37 Hello hE.*lO 1
|
||
ILIKE
|
||
1 Hello 0
|
||
2 Hello % 1
|
||
3 Hello %% 1
|
||
4 Hello %%% 1
|
||
5 Hello %_% 1
|
||
6 Hello _ 0
|
||
7 Hello _% 1
|
||
8 Hello %_ 1
|
||
9 Hello H%o 1
|
||
10 hello H%0 0
|
||
11 hello h%o 1
|
||
12 Hello h%o 1
|
||
13 OHello %lhell% 0
|
||
14 OHello %hell% 1
|
||
15 hEllo %HEL% 1
|
||
16 abcdef %aBc%def% 1
|
||
17 ABCDDEF %abc%def% 1
|
||
18 Abc\nDef %abc%def% 1
|
||
19 abc\ntdef %abc%def% 1
|
||
20 abct\ndef %abc%dEf% 1
|
||
21 abc\n\ndeF %abc%def% 1
|
||
22 abc\n\ntdef %abc%deF% 1
|
||
23 Abc\nt\ndef %abc%def% 1
|
||
24 abct\n\ndef %abc%def% 1
|
||
25 ab\ndef %Abc%def% 0
|
||
26 aBc\nef %ABC%DEF% 0
|
||
27 ёЁё Ё%Ё 1
|
||
28 ощщЁё Щ%Ё 0
|
||
29 ощЩЁё %Щ%Ё 1
|
||
30 Щущпандер %щп%е% 1
|
||
31 Щущпандер %щП%е% 1
|
||
32 ощщЁё %щ% 1
|
||
33 ощЩЁё %ё% 1
|
||
34 Hello .* 0
|
||
35 Hello .*ell.* 0
|
||
36 Hello o$ 0
|
||
37 Hello hE.*lO 0
|
||
NOT ILIKE
|
||
1 Hello 1
|
||
2 Hello % 0
|
||
3 Hello %% 0
|
||
4 Hello %%% 0
|
||
5 Hello %_% 0
|
||
6 Hello _ 1
|
||
7 Hello _% 0
|
||
8 Hello %_ 0
|
||
9 Hello H%o 0
|
||
10 hello H%0 1
|
||
11 hello h%o 0
|
||
12 Hello h%o 0
|
||
13 OHello %lhell% 1
|
||
14 OHello %hell% 0
|
||
15 hEllo %HEL% 0
|
||
16 abcdef %aBc%def% 0
|
||
17 ABCDDEF %abc%def% 0
|
||
18 Abc\nDef %abc%def% 0
|
||
19 abc\ntdef %abc%def% 0
|
||
20 abct\ndef %abc%dEf% 0
|
||
21 abc\n\ndeF %abc%def% 0
|
||
22 abc\n\ntdef %abc%deF% 0
|
||
23 Abc\nt\ndef %abc%def% 0
|
||
24 abct\n\ndef %abc%def% 0
|
||
25 ab\ndef %Abc%def% 1
|
||
26 aBc\nef %ABC%DEF% 1
|
||
27 ёЁё Ё%Ё 0
|
||
28 ощщЁё Щ%Ё 1
|
||
29 ощЩЁё %Щ%Ё 0
|
||
30 Щущпандер %щп%е% 0
|
||
31 Щущпандер %щП%е% 0
|
||
32 ощщЁё %щ% 0
|
||
33 ощЩЁё %ё% 0
|
||
34 Hello .* 1
|
||
35 Hello .*ell.* 1
|
||
36 Hello o$ 1
|
||
37 Hello hE.*lO 1
|
||
MATCH
|
||
1 Hello 1
|
||
2 Hello % 0
|
||
3 Hello %% 0
|
||
4 Hello %%% 0
|
||
5 Hello %_% 0
|
||
6 Hello _ 0
|
||
7 Hello _% 0
|
||
8 Hello %_ 0
|
||
9 Hello H%o 0
|
||
10 hello H%0 0
|
||
11 hello h%o 0
|
||
12 Hello h%o 0
|
||
13 OHello %lhell% 0
|
||
14 OHello %hell% 0
|
||
15 hEllo %HEL% 0
|
||
16 abcdef %aBc%def% 0
|
||
17 ABCDDEF %abc%def% 0
|
||
18 Abc\nDef %abc%def% 0
|
||
19 abc\ntdef %abc%def% 0
|
||
20 abct\ndef %abc%dEf% 0
|
||
21 abc\n\ndeF %abc%def% 0
|
||
22 abc\n\ntdef %abc%deF% 0
|
||
23 Abc\nt\ndef %abc%def% 0
|
||
24 abct\n\ndef %abc%def% 0
|
||
25 ab\ndef %Abc%def% 0
|
||
26 aBc\nef %ABC%DEF% 0
|
||
27 ёЁё Ё%Ё 0
|
||
28 ощщЁё Щ%Ё 0
|
||
29 ощЩЁё %Щ%Ё 0
|
||
30 Щущпандер %щп%е% 0
|
||
31 Щущпандер %щП%е% 0
|
||
32 ощщЁё %щ% 0
|
||
33 ощЩЁё %ё% 0
|
||
34 Hello .* 1
|
||
35 Hello .*ell.* 1
|
||
36 Hello o$ 1
|
||
37 Hello hE.*lO 0
|