forked from StarRocks/starrocks
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_array_filter
More file actions
113 lines (113 loc) · 1.59 KB
/
Copy pathtest_array_filter
File metadata and controls
113 lines (113 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
-- name: test_array_filter @mac
CREATE TABLE `t` (
`k` bigint(20) NOT NULL COMMENT "",
`arr_0` array<bigint(20)> NOT NULL COMMENT "",
`arr_1` array<bigint(20)> NULL COMMENT "",
`arr_2` array<bigint(20)> NULL COMMENT ""
) ENGINE=OLAP
DUPLICATE KEY(`k`)
DISTRIBUTED BY RANDOM BUCKETS 1
PROPERTIES (
"replication_num" = "1"
);
-- result:
-- !result
insert into t values (1,[1,2],[1,2],[0,1]),(2,[1,2],null,[1,1]),(3,[1,2],[1,2],null),(4,[1,2],[null,null],[null,null]),(5,[1],[1,2],[0,0,1]);
-- result:
-- !result
select array_filter(arr_0, arr_2) from t order by k;
-- result:
[2]
[1,2]
[]
[]
[]
-- !result
select array_filter(arr_1, arr_2) from t order by k;
-- result:
[2]
None
[]
[]
[]
-- !result
select array_filter(arr_0,[0,0,0,1]) from t order by k;
-- result:
[]
[]
[]
[]
[]
-- !result
select array_filter(arr_0,[1,0,1]) from t order by k;
-- result:
[1]
[1]
[1]
[1]
[1]
-- !result
select array_filter(arr_0,null) from t order by k;
-- result:
[]
[]
[]
[]
[]
-- !result
select array_filter(arr_1,null) from t order by k;
-- result:
[]
None
[]
[]
[]
-- !result
select array_filter([1,2,3,4],arr_2) from t order by k;
-- result:
[2]
[1,2]
[]
[]
[3]
-- !result
select array_filter(null, arr_2) from t order by k;
-- result:
None
None
None
None
None
-- !result
select array_filter([1,2,3,4],[0,0,1,1]) from t;
-- result:
[3,4]
[3,4]
[3,4]
[3,4]
[3,4]
-- !result
select array_filter(null, null) from t;
-- result:
None
None
None
None
None
-- !result
select array_filter([1,2,3,4],null) from t;
-- result:
[]
[]
[]
[]
[]
-- !result
select array_filter(null, [1,0,1,null]) from t;
-- result:
None
None
None
None
None
-- !result