mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-20 08:40:50 +00:00
Add more substring with enums tests
This commit is contained in:
parent
497e5abc47
commit
ff6bdfe857
@ -144,5 +144,12 @@ Offset: -6 Length: 3 world eagle wo ea
|
||||
Offset: -6 Length: 4 world eagle wor eag
|
||||
Offset: -6 Length: 5 world eagle worl eagl
|
||||
Offset: -6 Length: 6 world eagle world eagle
|
||||
-- Zero offset/length
|
||||
Offset: 0 Length: 0
|
||||
Offset: 0 Length: 1
|
||||
Offset: 1 Length: 0 hello shark
|
||||
Offset: 0 Length: 0
|
||||
Offset: 0 Length: 1
|
||||
Offset: 1 Length: 0 world eagle
|
||||
-- Constant enums
|
||||
f fo
|
||||
|
@ -18,6 +18,14 @@ SELECT 'Offset: ', p.offset, 'Length: ', p.length,
|
||||
substring(e8, p.offset, p.length) AS s3, substring(e16, p.offset, p.length) AS s4
|
||||
FROM substring_enums_test LEFT JOIN permutations AS p ON true;
|
||||
|
||||
SELECT '-- Zero offset/length';
|
||||
WITH cte AS (SELECT number AS n FROM system.numbers LIMIT 2),
|
||||
permutations AS (SELECT c1.n AS offset, c2.n AS length FROM cte AS c1 CROSS JOIN cte AS c2 LIMIT 3)
|
||||
SELECT 'Offset: ', p.offset, 'Length: ', p.length,
|
||||
substring(e8, p.offset) AS s1, substring(e16, p.offset) AS s2,
|
||||
substring(e8, p.offset, p.length) AS s3, substring(e16, p.offset, p.length) AS s4
|
||||
FROM substring_enums_test LEFT JOIN permutations AS p ON true;
|
||||
|
||||
SELECT '-- Constant enums';
|
||||
SELECT substring(CAST('foo', 'Enum8(\'foo\' = 1)'), 1, 1), substring(CAST('foo', 'Enum16(\'foo\' = 1111)'), 1, 2);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user