ClickHouse/tests/queries/0_stateless/02162_array_first_last_index.sql

22 lines
888 B
MySQL
Raw Normal View History

2022-01-08 08:37:56 +00:00
SELECT 'ArrayFirstIndex constant predicate';
SELECT arrayFirstIndex(x -> 1, emptyArrayUInt8());
SELECT arrayFirstIndex(x -> 0, emptyArrayUInt8());
SELECT arrayFirstIndex(x -> 1, [1, 2, 3]);
SELECT arrayFirstIndex(x -> 0, [1, 2, 3]);
SELECT 'ArrayFirstIndex non constant predicate';
SELECT arrayFirstIndex(x -> x >= 2, emptyArrayUInt8());
SELECT arrayFirstIndex(x -> x >= 2, [1, 2, 3]);
SELECT arrayFirstIndex(x -> x >= 2, [1, 2, 3]);
SELECT 'ArrayLastIndex constant predicate';
SELECT arrayLastIndex(x -> 1, emptyArrayUInt8());
SELECT arrayLastIndex(x -> 0, emptyArrayUInt8());
SELECT arrayLastIndex(x -> 1, [1, 2, 3]);
SELECT arrayLastIndex(x -> 0, materialize([1, 2, 3]));
SELECT 'ArrayLastIndex non constant predicate';
SELECT arrayLastIndex(x -> x >= 2, emptyArrayUInt8());
SELECT arrayLastIndex(x -> x >= 2, [1, 2, 3]);
SELECT arrayLastIndex(x -> x >= 2, materialize([1, 2, 3]));