Function arrayLast added tests

This commit is contained in:
Maksim Kita 2022-01-07 19:00:27 +03:00
parent 6b9703446d
commit fb179a45a1
2 changed files with 39 additions and 0 deletions

View File

@ -0,0 +1,18 @@
ArrayFirst constant predicate
0
0
1
0
ArrayFirst non constant predicate
0
2
2
ArrayLast constant predicate
0
0
3
0
ArrayLast non constant predicate
0
3
3

View File

@ -0,0 +1,21 @@
SELECT 'ArrayFirst constant predicate';
SELECT arrayFirst(x -> 1, emptyArrayUInt8());
SELECT arrayFirst(x -> 0, emptyArrayUInt8());
SELECT arrayFirst(x -> 1, [1, 2, 3]);
SELECT arrayFirst(x -> 0, [1, 2, 3]);
SELECT 'ArrayFirst non constant predicate';
SELECT arrayFirst(x -> x >= 2, emptyArrayUInt8());
SELECT arrayFirst(x -> x >= 2, [1, 2, 3]);
SELECT arrayFirst(x -> x >= 2, [1, 2, 3]);
SELECT 'ArrayLast constant predicate';
SELECT arrayLast(x -> 1, emptyArrayUInt8());
SELECT arrayLast(x -> 0, emptyArrayUInt8());
SELECT arrayLast(x -> 1, [1, 2, 3]);
SELECT arrayLast(x -> 0, [1, 2, 3]);
SELECT 'ArrayLast non constant predicate';
SELECT arrayLast(x -> x >= 2, emptyArrayUInt8());
SELECT arrayLast(x -> x >= 2, [1, 2, 3]);
SELECT arrayLast(x -> x >= 2, [1, 2, 3]);