Files
impala/testdata/workloads/functional-query/queries/QueryTest/functions-ddl.test
Nong Li 6b9a7de02e Add symbol resolution during analysis for create function stmts.
Before this, we had to specify the entire mangled symbol. This can be quite
long and quite tedious (take a look at some of the create UDA test cases that
specify all the symbols).

This patch adds some code to convert from the user function signature to the
mangled name. This means the user can specify the unmangled name and we can
do the symbol lookup. The mangling rules are pretty convoluted but if it is
messed up, the user can always specify the full symbol.

Some other minor cleanup in:
  - JNI from FE to BE
  - UDFs/UDAs that are loaded as test data

Change-Id: I733dbf3a72cb7b06221c27e622d161bcca0d74a8
Reviewed-on: http://gerrit.ent.cloudera.com:8080/624
Reviewed-by: Nong Li <nong@cloudera.com>
Tested-by: Nong Li <nong@cloudera.com>
2014-01-08 10:53:20 -08:00

188 lines
4.0 KiB
Plaintext

====
---- QUERY
create database if not exists function_ddl_test
====
---- QUERY
# Drop the dummy udfs this test uses.
drop function if exists function_ddl_test.fn();
drop function if exists function_ddl_test.fn(int);
drop function if exists function_ddl_test.fn(int, string);
drop function if exists function_ddl_test.fn(string, int);
drop function if exists function_ddl_test.fn2(int);
drop function if exists function_ddl_test.fn2(int, string);
drop function if exists function_ddl_test.fn_var_arg(int...);
drop function if exists function_ddl_test.agg_fn(int);
drop function if exists function_ddl_test.agg_fn(int, string);
drop function if exists function_ddl_test.agg_fn_var_arg(double, string...);
====
---- QUERY
# Verify all the test functions are removed
show functions in function_ddl_test
---- RESULTS
---- TYPES
STRING
====
---- QUERY
# Verify all the test functions are removed
show aggregate functions in function_ddl_test
---- RESULTS
---- TYPES
STRING
====
---- QUERY
# Add them and test function overloading.
create function function_ddl_test.fn() RETURNS int
LOCATION '/test-warehouse/libTestUdfs.so' SYMBOL='Fn'
====
---- QUERY
create function function_ddl_test.fn(int) RETURNS double
LOCATION '/test-warehouse/libTestUdfs.so' SYMBOL='Fn'
====
---- QUERY
create function function_ddl_test.fn(int, string) RETURNS int
LOCATION '/test-warehouse/libTestUdfs.so' SYMBOL='Fn'
====
---- QUERY
create function function_ddl_test.fn(string, int) RETURNS int
LOCATION '/test-warehouse/libTestUdfs.so' SYMBOL='Fn'
====
---- QUERY
create function function_ddl_test.fn2(int) RETURNS int
LOCATION '/test-warehouse/libTestUdfs.so' SYMBOL='Fn2'
====
---- QUERY
create function function_ddl_test.fn2(int, string) RETURNS int
LOCATION '/test-warehouse/libTestUdfs.so' SYMBOL='Fn2'
====
---- QUERY
create function function_ddl_test.fn_var_arg(int...) RETURNS int
LOCATION '/test-warehouse/libTestUdfs.so' SYMBOL='VarSum'
====
---- QUERY
create aggregate function function_ddl_test.agg_fn(int) RETURNS bigint
LOCATION '/test-warehouse/libudasample.so' UPDATE_FN='CountUpdate'
====
---- QUERY
create aggregate function function_ddl_test.agg_fn(int, string) RETURNS int
LOCATION '/test-warehouse/libTestUdas.so' UPDATE_FN='TwoArgUpdate'
====
---- QUERY
create aggregate function function_ddl_test.agg_fn_var_arg(double, string...) RETURNS int
LOCATION '/test-warehouse/libTestUdas.so' UPDATE_FN='VarArgUpdate'
====
---- QUERY
show functions in function_ddl_test
---- RESULTS
'fn()'
'fn(INT)'
'fn(INT, STRING)'
'fn(STRING, INT)'
'fn2(INT)'
'fn2(INT, STRING)'
'fn_var_arg(INT...)'
---- TYPES
STRING
====
---- QUERY
show aggregate functions in function_ddl_test
---- RESULTS
'agg_fn(INT)'
'agg_fn(INT, STRING)'
'agg_fn_var_arg(DOUBLE, STRING...)'
---- TYPES
STRING
====
---- QUERY
drop function function_ddl_test.fn2(int, string)
====
---- QUERY
show functions in function_ddl_test
---- RESULTS
'fn()'
'fn(INT)'
'fn(INT, STRING)'
'fn(STRING, INT)'
'fn2(INT)'
'fn_var_arg(INT...)'
---- TYPES
STRING
====
---- QUERY
drop function if exists function_ddl_test.fn2(int, string)
====
---- QUERY
show functions in function_ddl_test
---- RESULTS
'fn()'
'fn(INT)'
'fn(INT, STRING)'
'fn(STRING, INT)'
'fn2(INT)'
'fn_var_arg(INT...)'
---- TYPES
STRING
====
---- QUERY
use function_ddl_test
====
---- QUERY
show functions;
---- RESULTS
'fn()'
'fn(INT)'
'fn(INT, STRING)'
'fn(STRING, INT)'
'fn2(INT)'
'fn_var_arg(INT...)'
---- TYPES
STRING
====
---- QUERY
drop function fn()
====
---- QUERY
show functions;
---- RESULTS
'fn(INT)'
'fn(INT, STRING)'
'fn(STRING, INT)'
'fn2(INT)'
'fn_var_arg(INT...)'
---- TYPES
STRING
====
---- QUERY
drop function fn_var_arg(INT...)
====
---- QUERY
show functions;
---- RESULTS
'fn(INT)'
'fn(INT, STRING)'
'fn(STRING, INT)'
'fn2(INT)'
---- TYPES
STRING
====
---- QUERY
drop function agg_fn(int)
====
---- QUERY
show aggregate functions;
---- RESULTS
'agg_fn(INT, STRING)'
'agg_fn_var_arg(DOUBLE, STRING...)'
---- TYPES
STRING
====
---- QUERY
drop function agg_fn_var_arg(double, string...)
====
---- QUERY
show aggregate functions;
---- RESULTS
'agg_fn(INT, STRING)'
---- TYPES
STRING
====