ClickHouse/tests/queries/0_stateless/02162_array_first_last_index.sql
2022-01-08 11:37:56 +03:00

22 lines
888 B
SQL

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]));