2024-03-04 11:27:12 +00:00
SET merge_tree_read_split_ranges_into_intersecting_and_non_intersecting_injection_probability = 0 . 0 ;
2019-04-16 14:13:13 +00:00
DROP TABLE IF EXISTS index_for_like ;
2022-06-23 10:58:34 +00:00
set allow_deprecated_syntax_for_merge_tree = 1 ;
2019-04-16 14:13:13 +00:00
CREATE TABLE index_for_like ( s String , d Date DEFAULT today ( ) ) ENGINE = MergeTree ( d , ( s , d ) , 1 ) ;
2016-04-02 21:21:27 +00:00
2024-03-04 11:27:12 +00:00
INSERT INTO index_for_like ( s ) VALUES ( ' Hello ' ) , ( ' Hello, World ' ) , ( ' Hello, World 1 ' ) , ( ' Hello 1 ' ) , ( ' Goodbye ' ) , ( ' Goodbye, World ' ) , ( ' Goodbye 1 ' ) , ( ' Goodbye, World 1 ' ) ;
2016-04-02 21:21:27 +00:00
SET max_rows_to_read = 3 ;
2019-04-16 14:13:13 +00:00
SELECT s FROM index_for_like WHERE s LIKE ' Hello, World% ' ;
2016-04-02 21:21:27 +00:00
SET max_rows_to_read = 2 ;
2019-04-16 14:13:13 +00:00
SELECT s FROM index_for_like WHERE s LIKE ' Hello, World % ' ;
2016-04-02 21:21:27 +00:00
SET max_rows_to_read = 2 ;
2019-04-16 14:13:13 +00:00
SELECT s FROM index_for_like WHERE s LIKE ' Hello, World 1% ' ;
2016-04-02 21:21:27 +00:00
SET max_rows_to_read = 1 ;
2019-04-16 14:13:13 +00:00
SELECT s FROM index_for_like WHERE s LIKE ' Hello, World 2% ' ;
2016-04-02 21:21:27 +00:00
SET max_rows_to_read = 1 ;
2019-04-16 14:13:13 +00:00
SELECT s FROM index_for_like WHERE s LIKE ' Hello, Worle% ' ;
2016-04-02 21:21:27 +00:00
SET max_rows_to_read = 3 ;
2019-04-16 14:13:13 +00:00
SELECT s FROM index_for_like WHERE s LIKE ' Hello, Wor% ' ;
2016-04-02 21:21:27 +00:00
SET max_rows_to_read = 5 ;
2019-04-16 14:13:13 +00:00
SELECT s FROM index_for_like WHERE s LIKE ' Hello% ' ;
2016-04-02 21:21:27 +00:00
SET max_rows_to_read = 2 ;
2019-04-16 14:13:13 +00:00
SELECT s FROM index_for_like WHERE s LIKE ' Hello % ' ;
2016-04-02 21:21:27 +00:00
SET max_rows_to_read = 3 ;
2019-04-16 14:13:13 +00:00
SELECT s FROM index_for_like WHERE s LIKE ' Hello,% ' ;
2016-04-02 21:21:27 +00:00
SET max_rows_to_read = 1 ;
2019-04-16 14:13:13 +00:00
SELECT s FROM index_for_like WHERE s LIKE ' Hello;% ' ;
2016-04-02 21:21:27 +00:00
SET max_rows_to_read = 5 ;
2019-04-16 14:13:13 +00:00
SELECT s FROM index_for_like WHERE s LIKE ' H% ' ;
2016-04-02 21:21:27 +00:00
SET max_rows_to_read = 4 ;
2019-04-16 14:13:13 +00:00
SELECT s FROM index_for_like WHERE s LIKE ' Good% ' ;
2016-04-02 21:21:27 +00:00
SET max_rows_to_read = 8 ;
2019-04-16 14:13:13 +00:00
SELECT s FROM index_for_like WHERE s LIKE ' % ' ;
SELECT s FROM index_for_like WHERE s LIKE ' %Hello% ' ;
SELECT s FROM index_for_like WHERE s LIKE ' %Hello ' ;
2016-04-02 21:21:27 +00:00
SET max_rows_to_read = 3 ;
2019-04-16 14:13:13 +00:00
SELECT s FROM index_for_like WHERE s LIKE ' Hello, World% % ' ;
SELECT s FROM index_for_like WHERE s LIKE ' Hello, Worl_% ' ;
2016-04-02 21:21:27 +00:00
SET max_rows_to_read = 1 ;
2019-04-16 14:13:13 +00:00
SELECT s FROM index_for_like WHERE s LIKE ' Hello, Worl\\_% ' ;
2016-04-02 21:21:27 +00:00
2019-04-16 14:13:13 +00:00
DROP TABLE index_for_like ;