blob: 82e43427d24885f86c67528924919e9674619c83 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
/* postgres can not */
use plato;
$udf = YQL::@@(block '(
(let $udfScript (String '@@@@
class Person:
def __init__(self, name, age):
self.name = name
self.age = age
def NewPerson(name, age):
return Person(name, age)
@@@@))
(let ui32 (DataType 'Uint32))
(let str (DataType 'String))
(let personType (StructType '('name str) '('age ui32)))
(let udfType (CallableType '() '(personType) '(str) '(ui32)))
(let udf (ScriptUdf 'Python3 'NewPerson udfType $udfScript))
(return udf)
))@@;
$persons = (select $udf(value, 100) as val from Input);
select val from $persons;
|