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
This commit is contained in:
Tim Armstrong
2016-11-18 13:34:15 -08:00
committed by Impala Public Jenkins
parent 1335af3684
commit d2d3f4c1a6
26 changed files with 501 additions and 248 deletions

View File

@@ -69,3 +69,22 @@ from functional.alltypesagg
---- 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