58
58
import java .util .Optional ;
59
59
60
60
import static com .facebook .presto .common .type .TypeSignature .parseTypeSignature ;
61
+ import static java .util .Collections .emptyList ;
61
62
import static org .testng .Assert .assertEquals ;
62
63
import static org .testng .Assert .assertNotNull ;
63
64
@@ -140,20 +141,24 @@ public static Map<String, List<JsonBasedUdfFunctionMetadata>> createUdfSignature
140
141
new TypeSignature ("integer" ),
141
142
Collections .singletonList (new TypeSignature ("integer" )),
142
143
"default" ,
144
+ false ,
143
145
new RoutineCharacteristics (RoutineCharacteristics .Language .CPP , RoutineCharacteristics .Determinism .DETERMINISTIC , RoutineCharacteristics .NullCallClause .CALLED_ON_NULL_INPUT ),
144
146
Optional .empty (),
145
147
Optional .of (new SqlFunctionId (QualifiedObjectName .valueOf ("unittest.default.square" ), ImmutableList .of (parseTypeSignature ("integer" )))),
146
- Optional .of ("1" )));
148
+ Optional .of ("1" ),
149
+ Optional .of (emptyList ())));
147
150
squareFunctions .add (new JsonBasedUdfFunctionMetadata (
148
151
"square a double" ,
149
152
FunctionKind .SCALAR ,
150
153
new TypeSignature ("double" ),
151
154
Collections .singletonList (new TypeSignature ("double" )),
152
155
"test_schema" ,
156
+ false ,
153
157
new RoutineCharacteristics (RoutineCharacteristics .Language .CPP , RoutineCharacteristics .Determinism .DETERMINISTIC , RoutineCharacteristics .NullCallClause .CALLED_ON_NULL_INPUT ),
154
158
Optional .empty (),
155
159
Optional .of (new SqlFunctionId (QualifiedObjectName .valueOf ("unittest.test_schema.square" ), ImmutableList .of (parseTypeSignature ("double" )))),
156
- Optional .of ("1" )));
160
+ Optional .of ("1" ),
161
+ Optional .of (emptyList ())));
157
162
udfSignatureMap .put ("square" , squareFunctions );
158
163
159
164
// array_function_1
@@ -164,30 +169,36 @@ public static Map<String, List<JsonBasedUdfFunctionMetadata>> createUdfSignature
164
169
parseTypeSignature ("ARRAY<ARRAY<BOOLEAN>>" ),
165
170
Arrays .asList (parseTypeSignature ("ARRAY<ARRAY<BOOLEAN>>" ), parseTypeSignature ("ARRAY<ARRAY<BOOLEAN>>" )),
166
171
"default" ,
172
+ false ,
167
173
new RoutineCharacteristics (RoutineCharacteristics .Language .CPP , RoutineCharacteristics .Determinism .DETERMINISTIC , RoutineCharacteristics .NullCallClause .CALLED_ON_NULL_INPUT ),
168
174
Optional .empty (),
169
175
Optional .of (new SqlFunctionId (QualifiedObjectName .valueOf ("unittest.default.array_function_1" ), ImmutableList .of (parseTypeSignature ("ARRAY<ARRAY<BOOLEAN>>" ), parseTypeSignature ("ARRAY<ARRAY<BOOLEAN>>" )))),
170
- Optional .of ("1" )));
176
+ Optional .of ("1" ),
177
+ Optional .of (emptyList ())));
171
178
arrayFunction1 .add (new JsonBasedUdfFunctionMetadata (
172
179
"combines two float arrays into one" ,
173
180
FunctionKind .SCALAR ,
174
181
parseTypeSignature ("ARRAY<ARRAY<BIGINT>>" ),
175
182
Arrays .asList (parseTypeSignature ("ARRAY<ARRAY<BIGINT>>" ), parseTypeSignature ("ARRAY<ARRAY<BIGINT>>" )),
176
183
"test_schema" ,
184
+ false ,
177
185
new RoutineCharacteristics (RoutineCharacteristics .Language .CPP , RoutineCharacteristics .Determinism .DETERMINISTIC , RoutineCharacteristics .NullCallClause .CALLED_ON_NULL_INPUT ),
178
186
Optional .empty (),
179
187
Optional .of (new SqlFunctionId (QualifiedObjectName .valueOf ("unittest.test_schema.array_function_1" ), ImmutableList .of (parseTypeSignature ("ARRAY<ARRAY<BIGINT>>" ), parseTypeSignature ("ARRAY<ARRAY<BIGINT>>" )))),
180
- Optional .of ("1" )));
188
+ Optional .of ("1" ),
189
+ Optional .of (emptyList ())));
181
190
arrayFunction1 .add (new JsonBasedUdfFunctionMetadata (
182
191
"combines two double arrays into one" ,
183
192
FunctionKind .SCALAR ,
184
193
parseTypeSignature ("ARRAY<DOUBLE>" ),
185
194
Arrays .asList (parseTypeSignature ("ARRAY<DOUBLE>" ), TypeSignature .parseTypeSignature ("ARRAY<DOUBLE>" )),
186
195
"test_schema" ,
196
+ false ,
187
197
new RoutineCharacteristics (RoutineCharacteristics .Language .CPP , RoutineCharacteristics .Determinism .DETERMINISTIC , RoutineCharacteristics .NullCallClause .CALLED_ON_NULL_INPUT ),
188
198
Optional .empty (),
189
199
Optional .of (new SqlFunctionId (QualifiedObjectName .valueOf ("unittest.test_schema.array_function_1" ), ImmutableList .of (parseTypeSignature ("ARRAY<DOUBLE>" ), parseTypeSignature ("ARRAY<DOUBLE>" )))),
190
- Optional .of ("1" )));
200
+ Optional .of ("1" ),
201
+ Optional .of (emptyList ())));
191
202
udfSignatureMap .put ("array_function_1" , arrayFunction1 );
192
203
193
204
// array_function_2
@@ -198,20 +209,24 @@ public static Map<String, List<JsonBasedUdfFunctionMetadata>> createUdfSignature
198
209
TypeSignature .parseTypeSignature ("ARRAY<map<BIGINT, DOUBLE>>" ),
199
210
Arrays .asList (TypeSignature .parseTypeSignature ("ARRAY<map<BIGINT, DOUBLE>>" ), TypeSignature .parseTypeSignature ("ARRAY<varchar>" )),
200
211
"default" ,
212
+ false ,
201
213
new RoutineCharacteristics (RoutineCharacteristics .Language .CPP , RoutineCharacteristics .Determinism .DETERMINISTIC , RoutineCharacteristics .NullCallClause .CALLED_ON_NULL_INPUT ),
202
214
Optional .empty (),
203
215
Optional .of (new SqlFunctionId (QualifiedObjectName .valueOf ("unittest.default.array_function_2" ), ImmutableList .of (parseTypeSignature ("ARRAY<map<BIGINT, DOUBLE>>" ), parseTypeSignature ("ARRAY<varchar>" )))),
204
- Optional .of ("1" )));
216
+ Optional .of ("1" ),
217
+ Optional .of (emptyList ())));
205
218
arrayFunction2 .add (new JsonBasedUdfFunctionMetadata (
206
219
"transforms inputs into the output" ,
207
220
FunctionKind .SCALAR ,
208
221
TypeSignature .parseTypeSignature ("ARRAY<map<BIGINT, DOUBLE>>" ),
209
222
Arrays .asList (TypeSignature .parseTypeSignature ("ARRAY<map<BIGINT, DOUBLE>>" ), TypeSignature .parseTypeSignature ("ARRAY<ARRAY<BOOLEAN>>" ), TypeSignature .parseTypeSignature ("ARRAY<varchar>" )),
210
223
"test_schema" ,
224
+ false ,
211
225
new RoutineCharacteristics (RoutineCharacteristics .Language .CPP , RoutineCharacteristics .Determinism .DETERMINISTIC , RoutineCharacteristics .NullCallClause .CALLED_ON_NULL_INPUT ),
212
226
Optional .empty (),
213
227
Optional .of (new SqlFunctionId (QualifiedObjectName .valueOf ("unittest.test_schema.array_function_2" ), ImmutableList .of (parseTypeSignature ("ARRAY<map<BIGINT, DOUBLE>>" ), parseTypeSignature ("ARRAY<ARRAY<BOOLEAN>>" ), parseTypeSignature ("ARRAY<varchar>" )))),
214
- Optional .of ("1" )));
228
+ Optional .of ("1" ),
229
+ Optional .of (emptyList ())));
215
230
udfSignatureMap .put ("array_function_2" , arrayFunction2 );
216
231
217
232
return udfSignatureMap ;
@@ -229,20 +244,24 @@ public static Map<String, List<JsonBasedUdfFunctionMetadata>> createUpdatedUdfSi
229
244
new TypeSignature ("integer" ),
230
245
Collections .singletonList (new TypeSignature ("integer" )),
231
246
"default" ,
247
+ false ,
232
248
new RoutineCharacteristics (RoutineCharacteristics .Language .CPP , RoutineCharacteristics .Determinism .DETERMINISTIC , RoutineCharacteristics .NullCallClause .CALLED_ON_NULL_INPUT ),
233
249
Optional .empty (),
234
250
Optional .of (new SqlFunctionId (QualifiedObjectName .valueOf ("unittest.default.square" ), ImmutableList .of (parseTypeSignature ("integer" )))),
235
- Optional .of ("1" )));
251
+ Optional .of ("1" ),
252
+ Optional .of (emptyList ())));
236
253
squareFunctions .add (new JsonBasedUdfFunctionMetadata (
237
254
"square a double" ,
238
255
FunctionKind .SCALAR ,
239
256
new TypeSignature ("double" ),
240
257
Collections .singletonList (new TypeSignature ("double" )),
241
258
"test_schema" ,
259
+ false ,
242
260
new RoutineCharacteristics (RoutineCharacteristics .Language .CPP , RoutineCharacteristics .Determinism .DETERMINISTIC , RoutineCharacteristics .NullCallClause .CALLED_ON_NULL_INPUT ),
243
261
Optional .empty (),
244
262
Optional .of (new SqlFunctionId (QualifiedObjectName .valueOf ("unittest.test_schema.square" ), ImmutableList .of (parseTypeSignature ("double" )))),
245
- Optional .of ("1" )));
263
+ Optional .of ("1" ),
264
+ Optional .of (emptyList ())));
246
265
udfSignatureMap .put ("square" , squareFunctions );
247
266
248
267
return udfSignatureMap ;
0 commit comments