Files
impala/testdata/workloads/functional-query/queries/QueryTest/uda.test
Tim Armstrong d7246d64c7 IMPALA-1430,IMPALA-4108: codegen all builtin aggregate functions
This change enables codegen for all builtin aggregate functions,
e.g. timestamp functions and group_concat.

There are several parts to the change:
* Adding support for generic UDAs. Previous the codegen code did not
  handle multiple input arguments or NULL return values.
* Defaulting to using the UDA interface when there is not a special
  codegen path (we have implementations of all builtin aggregate
  functions for the interpreted path).
* Remove all the logic to disable codegen for the special cases that now
  are supported.

Also fix the generation of code to get/set NULL bits since I needed
to add functionality there anyway.

Testing:
Add tests that check that codegen was enabled for builtin aggregate
functions. Also fix some gaps in the preexisting tests.

Also add tests for UDAs that check input/output nulls are handled
correctly, in anticipation of enabling codegen for arbitrary UDAs.
The tests are run with both codegen enabled and disabled. To avoid
flaky tests, we switch the UDF tests to use "unique_database".

Perf:
Ran local TPC-H and targeted perf. Spent a lot of time on TPC-H Q1,
since my original approach regressed it ~5%. In the end the problem was
to do with the ordering of loads/stores to the slot and null bit in the
generated code: the previous version of the code exploited some
properties of the particular aggregate function. I ended up replicating
this behaviour to avoid regressing perf.

Change-Id: Id9dc21d1d676505d3617e1e4f37557397c4fb260
Reviewed-on: http://gerrit.cloudera.org:8080/4655
Reviewed-by: Tim Armstrong <tarmstrong@cloudera.com>
Tested-by: Internal Jenkins
2016-11-09 03:27:12 +00:00

72 lines
1.2 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
====