Skip to content

Commit 8d6ccf1

Browse files
committed
Add tests
1 parent b616378 commit 8d6ccf1

File tree

2 files changed

+42
-1
lines changed

2 files changed

+42
-1
lines changed

tests/queries/0_stateless/03357_arraySymmetricDifference.reference

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,13 @@ Array(Tuple(Nullable(UInt8), Array(Nullable(String))))
1414
Non-const arguments
1515
[(NULL,['c']),(2,['c',NULL])]
1616
[(NULL,['c']),(2,['c',NULL])]
17+
6 ['5','4']
18+
7 ['0','7']
19+
8 ['10','8','9']
20+
9 ['-1','9']
21+
10 ['5','10']
22+
1 ['1','2']
23+
2 []
24+
3 ['2']
25+
4 ['1','4']
26+
5 ['5']

tests/queries/0_stateless/03357_arraySymmetricDifference.sql

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,35 @@ SELECT arraySymmetricDifference(f, s);
2727
WITH
2828
materialize([(1, ['a', 'b']::Array(LowCardinality(String))), (NULL, ['c']::Array(LowCardinality(String)))]) AS f,
2929
materialize([(2, ['c', NULL]::Array(LowCardinality(Nullable(String)))), (1, ['a', 'b']::Array(LowCardinality(String)))]) AS s
30-
SELECT arraySymmetricDifference(f, s)
30+
SELECT arraySymmetricDifference(f, s);
31+
32+
-- Table with batch inserts
33+
DROP TABLE IF EXISTS test_arraySymmetricDifference;
34+
CREATE TABLE test_arraySymmetricDifference
35+
(
36+
`id` Int8,
37+
`arr1` Array(String),
38+
`arr2` Array(String)
39+
)
40+
ENGINE = MergeTree
41+
ORDER BY id;
42+
43+
INSERT INTO test_arraySymmetricDifference
44+
VALUES
45+
(1, ['1'], ['2']),
46+
(2, ['2'], ['2']),
47+
(3, ['3'], ['3', '2']),
48+
(4, ['4'], ['1']),
49+
(5, ['5'], []);
50+
INSERT INTO test_arraySymmetricDifference
51+
VALUES
52+
(6, ['6', '4'], ['5', '6']),
53+
(7, ['7', '0'], []),
54+
(8, ['8', '9', '10'], []),
55+
(9, ['9'], ['-1']),
56+
(10, ['10'], ['5']);
57+
58+
SELECT
59+
ta.id AS id,
60+
arraySymmetricDifference(ta.arr1, ta.arr2) AS symmetricDifference
61+
FROM test_arraySymmetricDifference ta;

0 commit comments

Comments
 (0)