File tree 5 files changed +211
-0
lines changed
ydb/library/yql/udfs/common/ip_base/test
5 files changed +211
-0
lines changed Original file line number Diff line number Diff line change 3
3
{
4
4
"uri" : " file://test.test_Basic_/results.txt"
5
5
}
6
+ ],
7
+ "test.test[Subnets]" : [
8
+ {
9
+ "uri" : " file://test.test_Subnets_/results.txt"
10
+ }
6
11
]
7
12
}
Original file line number Diff line number Diff line change
1
+ [
2
+ {
3
+ "Write" = [
4
+ {
5
+ "Type" = [
6
+ "ListType";
7
+ [
8
+ "StructType";
9
+ [
10
+ [
11
+ "internal1";
12
+ [
13
+ "OptionalType";
14
+ [
15
+ "DataType";
16
+ "String"
17
+ ]
18
+ ]
19
+ ];
20
+ [
21
+ "string1";
22
+ [
23
+ "OptionalType";
24
+ [
25
+ "DataType";
26
+ "String"
27
+ ]
28
+ ]
29
+ ];
30
+ [
31
+ "subnet1_subnet2_match";
32
+ [
33
+ "OptionalType";
34
+ [
35
+ "DataType";
36
+ "Bool"
37
+ ]
38
+ ]
39
+ ];
40
+ [
41
+ "subnet1_ip1_match";
42
+ [
43
+ "OptionalType";
44
+ [
45
+ "DataType";
46
+ "Bool"
47
+ ]
48
+ ]
49
+ ];
50
+ [
51
+ "subnet2_ip1_match";
52
+ [
53
+ "OptionalType";
54
+ [
55
+ "DataType";
56
+ "Bool"
57
+ ]
58
+ ]
59
+ ];
60
+ [
61
+ "ip1_ip2_mask_subnet";
62
+ [
63
+ "OptionalType";
64
+ [
65
+ "DataType";
66
+ "String"
67
+ ]
68
+ ]
69
+ ]
70
+ ]
71
+ ]
72
+ ];
73
+ "Data" = [
74
+ [
75
+ [
76
+ [
77
+ "wKgAAP///wA="
78
+ ]
79
+ ];
80
+ [
81
+ "192.168.0.0/24"
82
+ ];
83
+ [
84
+ %true
85
+ ];
86
+ [
87
+ %true
88
+ ];
89
+ [
90
+ %false
91
+ ];
92
+ [
93
+ "192.0.0.0"
94
+ ]
95
+ ];
96
+ [
97
+ [
98
+ [
99
+ "CgAAAP//AAA="
100
+ ]
101
+ ];
102
+ [
103
+ "10.0.0.0/16"
104
+ ];
105
+ [
106
+ %false
107
+ ];
108
+ [
109
+ %true
110
+ ];
111
+ [
112
+ %false
113
+ ];
114
+ [
115
+ "10.0.0.0"
116
+ ]
117
+ ];
118
+ [
119
+ [
120
+ "\0\0\0\0\0\0\0\0"
121
+ ];
122
+ [
123
+ "0.0.0.0/0"
124
+ ];
125
+ [
126
+ %true
127
+ ];
128
+ [
129
+ %true
130
+ ];
131
+ [
132
+ %true
133
+ ];
134
+ [
135
+ "0.0.0.0"
136
+ ]
137
+ ];
138
+ [
139
+ [
140
+ [
141
+ "KgIGuAweShgAAAaWAAAAAP///////////////wAAAAA="
142
+ ]
143
+ ];
144
+ [
145
+ "2a02:6b8:c1e:4a18:0:696::/96"
146
+ ];
147
+ [
148
+ %false
149
+ ];
150
+ [
151
+ %true
152
+ ];
153
+ [
154
+ %true
155
+ ];
156
+ [
157
+ "::696:0:0"
158
+ ]
159
+ ];
160
+ [
161
+ [
162
+ "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
163
+ ];
164
+ [
165
+ "::/0"
166
+ ];
167
+ [
168
+ %true
169
+ ];
170
+ [
171
+ %true
172
+ ];
173
+ [
174
+ %true
175
+ ];
176
+ [
177
+ "::ffff:192.168.0.2"
178
+ ]
179
+ ]
180
+ ]
181
+ }
182
+ ]
183
+ }
184
+ ]
Original file line number Diff line number Diff line change
1
+ {"subnet1"="192.168.0.1/24";"subnet2"="192.168.0.1/28";"ip1"="192.168.0.32";"ip2"="255.0.0.0"};
2
+ {"subnet1"="10.0.0.1/16";"subnet2"="127.0.0.1/16";"ip1"="10.0.10.128";"ip2"="255.0.240.0"};
3
+ {"subnet1"="0.0.0.0/0";"subnet2"="1.1.1.1/32";"ip1"="1.1.1.1";"ip2"="0.0.0.0"};
4
+ {"subnet1"="2a02:6b8:c1e:4a18:0:696:ec65:0/96";"subnet2"="2a02:6b8:c1e:4a18::/12";"ip1"="2a02:6b8:c1e:4a18:0:696:ec65:0";"ip2"="::ffff:ffff:0:0"};
5
+ {"subnet1"="::/0";"subnet2"="::ffff:192.168.0.1/96";"ip1"="::ffff:192.168.0.2";"ip2"="ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff"};
Original file line number Diff line number Diff line change
1
+ {schema=[{name=subnet1;type=string};{name=subnet2;type=string};{name=ip1;type=string};{name=ip2;type=string}]}
Original file line number Diff line number Diff line change
1
+ /* syntax version 1 */
2
+ SELECT
3
+ subnet1 AS internal1,
4
+ Ip::SubnetToString(subnet1) AS string1,
5
+ Ip::SubnetMatch(subnet1, subnet2) AS subnet1_subnet2_match,
6
+ Ip::SubnetMatch(subnet1, ip1) AS subnet1_ip1_match,
7
+ Ip::SubnetMatch(subnet2, ip1) AS subnet2_ip1_match,
8
+ Ip::ToString(Ip::GetSubnetByMask(ip1, ip2)) AS ip1_ip2_mask_subnet
9
+ FROM (
10
+ SELECT
11
+ Ip::SubnetFromString(subnet1) AS subnet1,
12
+ Ip::SubnetFromString(subnet2) AS subnet2,
13
+ Ip::FromString(ip1) AS ip1,
14
+ Ip::FromString(ip2) AS ip2
15
+ FROM Input
16
+ );
You can’t perform that action at this time.
0 commit comments