ClickHouse/dbms/tests/queries/0_stateless/00672_arrayDistinct.sql
Vadim b8ae9f7951 [CLICKHOUSE-2830] add FunctionArrayDistinct (#2670)
* [CLICKHOUSE-2830] add FunctionArrayDistinct

* [#CLICKHOUSE-2830] Add tests and fix

* [CLICKHOUSE-2830] fix bug with array without NULL

* [CLICKHOUSE-2830] fix test

* [CLICKHOUSE-3844] Add suport Tuple and other types in Uniq, EnumerateUniq and Distinct

* [CLICKHOUSE-3844] Add '\n'

* [CLICKHOUSE-3844] fix

* [CLICKHOUSE-2830] del Nullable return type

* Update FunctionsArray.cpp

* [CLICKHOUSE-3844] add new tests

* [CLICKHOUSE-3844] add new tests
2018-07-19 16:53:32 +03:00

22 lines
834 B
SQL

USE test;
SELECT arrayDistinct([1, 2, 3]);
SELECT arrayDistinct([1, 2, 3, 2, 2]);
SELECT arrayDistinct([1, 2, NULL, 5, 2, NULL]);
SELECT arrayDistinct(['1212', 'sef', '343r4']);
SELECT arrayDistinct(['1212', 'sef', '343r4', '1212']);
SELECT arrayDistinct(['1212', 'sef', '343r4', NULL, NULL, '232']);
DROP TABLE IF EXISTS arrayDistinct_test;
CREATE TABLE arrayDistinct_test(arr_int Array(UInt8), arr_string Array(String)) ENGINE=Memory;
INSERT INTO arrayDistinct_test values ([1, 2, 3], ['a', 'b', 'c']), ([21, 21, 21, 21], ['123', '123', '123']);
SELECT arrayDistinct(arr_int) FROM arrayDistinct_test;
SELECT arrayDistinct(arr_string) FROM arrayDistinct_test;
DROP TABLE arrayDistinct_test;
SELECT arrayDistinct([['1212'], ['sef'], ['343r4'], ['1212']]);
SELECT arrayDistinct([(1, 2), (1, 3), (1, 2), (1, 2), (1, 2), (1, 5)]);