123456789101112131415161718192021222324 |
- (
- (let config (DataSource 'config))
- # prepare python udf
- (let i64 (DataType 'Int64))
- (let udfType (CallableType '() '((ListType i64)) '((ListType i64))))
- (let udfScript (String '@@
- def g(input):
- def gen():
- return (int(x + 42) for x in input)
- return gen
- @@))
- (let udf (ScriptUdf 'Python3 'g udfType udfScript))
- # call udf
- (let result (Apply udf (AsList (Int64 '1) (Int64 '2) (Int64 '3))))
- # output result with type
- (let sink (DataSink 'result))
- (let world (Write! world sink (Key) result '( '('type) )))
- # finish
- (return (Commit! world sink))
- )
|