enhance: add python udf sample that uses numpy
This commit is contained in:
parent
90f542857d
commit
ab4111b25e
|
@ -38,7 +38,6 @@ else
|
||||||
endi
|
endi
|
||||||
sql create function pybitand as '/tmp/pyudf/pybitand.py' outputtype int language 'python';
|
sql create function pybitand as '/tmp/pyudf/pybitand.py' outputtype int language 'python';
|
||||||
sql create aggregate function pyl2norm as '/tmp/pyudf/pyl2norm.py' outputtype double bufSize 128 language 'python';
|
sql create aggregate function pyl2norm as '/tmp/pyudf/pyl2norm.py' outputtype double bufSize 128 language 'python';
|
||||||
sql create aggregate function pycumsum as '/tmp/pyudf/pycumsum.py' outputtype double bufSize 128 language 'python';
|
|
||||||
|
|
||||||
sql show functions;
|
sql show functions;
|
||||||
if $rows != 4 then
|
if $rows != 4 then
|
||||||
|
@ -282,9 +281,17 @@ if $data20 != 8.000000000 then
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
|
|
||||||
|
sql create aggregate function pycumsum as '/tmp/pyudf/pycumsum.py' outputtype double bufSize 128 language 'python';
|
||||||
sql select pycumsum(f2) from udf.t2
|
sql select pycumsum(f2) from udf.t2
|
||||||
print ======= pycumsum
|
print ======= pycumsum
|
||||||
print $rows $data00
|
print $rows $data00
|
||||||
|
if $rows != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
if $data00 != 20.000000000 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
sql drop function pycumsum
|
||||||
|
|
||||||
sql create or replace function bit_and as '/tmp/udf/libbitand.so' outputtype int
|
sql create or replace function bit_and as '/tmp/udf/libbitand.so' outputtype int
|
||||||
sql select func_version from information_schema.ins_functions where name='bit_and'
|
sql select func_version from information_schema.ins_functions where name='bit_and'
|
||||||
|
|
Loading…
Reference in New Issue