blob: ed7fc8eeb3799af93f2a8158afdb14acc5d4e09e (
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 'Python 'NewPerson udfType $udfScript))
(return udf)
))@@;
$persons = (select $udf(value, 100) as val from Input);
select val from $persons;
|