Files
impala/testdata/workloads/functional-query/queries/QueryTest/uda.test
Tim Armstrong d2d3f4c1a6 IMPALA-1430,IMPALA-4878,IMPALA-4879: codegen native UDAs
This uses the existing infrastructure for codegening builtin UDAs and
for codegening calls to UDFs. GetUdf() is refactored to support both
UDFs and UDAs.

IR UDAs are still not allowed by the frontend. It's unclear if we want
to enable them going forward because of the difficulties in testing and
supporting IR UDFs/UDAs.

This also fixes some bugs with the Get*Type() methods of
FunctionContext. GetArgType() and related methods now always return the
logical input types of the aggregate function. Getting the tests to pass
required fixing IMPALA-4878 because they called GetIntermediateType().

Testing:
test_udfs.py tests UDAs with codegen enabled and disabled.

Added some asserts to test UDAs to check that the correct types are
passed in via the FunctionContext.

Change-Id: Id1708eaa96eb76fb9bec5eeabf209f81c88eec2f
Reviewed-on: http://gerrit.cloudera.org:8080/5161
Reviewed-by: Dan Hecht <dhecht@cloudera.com>
Tested-by: Impala Public Jenkins
2017-02-10 02:18:32 +00:00

91 lines
1.7 KiB
Plaintext

====
---- QUERY
select hll(int_col) from functional.alltypestiny;
---- RESULTS
'2'
---- TYPES
string
====
---- QUERY
select test_count(int_col) from functional.alltypestiny;
---- RESULTS
8
---- TYPES
bigint
====
---- QUERY
select test_count(int_col) from functional.alltypesagg;
---- RESULTS
10980
---- TYPES
bigint
====
---- QUERY
select sum_small_decimal(c3) from functional.decimal_tiny;
---- RESULTS
45.00
---- TYPES
decimal
====
---- QUERY
select trunc_sum(double_col),sum(double_col) from functional_parquet.alltypes where id < 5555;
---- RESULTS
252348,252348.5
---- TYPES
bigint,double
====
---- QUERY
select arg_is_const(int_col, 1) from functional_parquet.alltypes;
---- RESULTS
true
---- TYPES
boolean
====
---- QUERY
# Test with even number of input rows.
select toggle_null(id), count(*)
from functional_parquet.alltypesagg
---- RESULTS
NULL,11000
---- TYPES
int,bigint
====
---- QUERY
# Test with odd number of input rows.
select toggle_null(id), count(*)
from functional_parquet.alltypesagg
where id <= 9998
---- RESULTS
1,10999
---- TYPES
int,bigint
====
---- QUERY
# Test that input NULLs are passed to aggregate functions ok.
select count_nulls(tinyint_col), count(*)
from functional.alltypesagg
---- RESULTS
2000,11000
---- TYPES
bigint,bigint
====
---- QUERY
# Test that all types are exposed via the FunctionContext correctly.
# This relies on asserts in the UDA funciton
select agg_intermediate(int_col), count(*)
from functional.alltypesagg
---- RESULTS
NULL,11000
---- TYPES
bigint,bigint
====
---- QUERY
# Test that all types are exposed via the FunctionContext correctly.
# This relies on asserts in the UDA funciton
select agg_decimal_intermediate(cast(d1 as decimal(2,1)), 2), count(*)
from functional.decimal_tbl
---- RESULTS
NULL,5
---- TYPES
decimal,bigint