2
CREATE FUNCTION metaphon RETURNS STRING SONAME "udf_example.so"
5
Query OK, 0 rows affected
8
CREATE FUNCTION myfunc_double RETURNS REAL SONAME "udf_example.so"
11
Query OK, 0 rows affected
14
CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME "udf_example.so"
17
Query OK, 0 rows affected
20
CREATE FUNCTION lookup RETURNS STRING SONAME "udf_example.so"
23
Query OK, 0 rows affected
26
CREATE FUNCTION reverse_lookup RETURNS STRING SONAME "udf_example.so"
29
Query OK, 0 rows affected
32
CREATE AGGREGATE FUNCTION avgcost RETURNS REAL SONAME "udf_example.so"
35
Query OK, 0 rows affected
38
CREATE FUNCTION myfunc_argument_name RETURNS STRING SONAME "udf_example.so"
41
Query OK, 0 rows affected
44
select metaphon("hello")
52
select myfunc_double("hello","world")
55
myfunc_double("hello","world")
60
select myfunc_int(1,2,3),myfunc_int("1","11","111")
63
myfunc_int(1,2,3) myfunc_int("1","11","111")
68
select lookup("localhost")
76
select reverse_lookup("127.0.0.1")
79
reverse_lookup("127.0.0.1")
84
create temporary table t1 (a int,b double)
87
Query OK, 0 rows affected
90
insert into t1 values (1,5),(1,4),(2,8),(3,9),(4,11)
93
Query OK, 5 rows affected
94
Records: 0 Duplicates: 5 Warnings: 0
97
select avgcost(a,b) from t1
105
select avgcost(a,b) from t1 group by a
116
select a, myfunc_argument_name(a) from t1;
119
a myfunc_argument_name(a) myfunc_argument_name(a as b)
131
Query OK, 0 rows affected
134
DROP FUNCTION metaphon
137
Query OK, 0 rows affected
140
DROP FUNCTION myfunc_double
143
Query OK, 0 rows affected
146
DROP FUNCTION myfunc_int
149
Query OK, 0 rows affected
155
Query OK, 0 rows affected
158
DROP FUNCTION reverse_lookup
161
Query OK, 0 rows affected
164
DROP FUNCTION avgcost
167
Query OK, 0 rows affected
170
DROP FUNCTION myfunc_argument_name;
173
Query OK, 0 rows affected