UDF/UDA memory management improvements

* AggFnEvaluator now uses the UDF mem pool (I'm planning to change
  this to per-exec node pools in the expr refactoring)
* FunctionContext::TrackAllocation()/Free() actually use the UDF's mem tracker
* Added FunctionContextImpl::Close() which sets warnings for leaked allocations

Change-Id: I792ffd49102a92b57e34df18d8ff5f5d0fd27370
Reviewed-on: http://gerrit.ent.cloudera.com:8080/1792
Reviewed-by: Skye Wanderman-Milne <skye@cloudera.com>
Tested-by: Skye Wanderman-Milne <skye@cloudera.com>
(cherry picked from commit 41a5f7cfa718789fa3b2de3a31f085411fb5000c)
Reviewed-on: http://gerrit.ent.cloudera.com:8080/1954
Tested-by: jenkins
This commit is contained in:
Skye Wanderman-Milne
2014-03-17 15:04:20 -07:00
committed by jenkins
parent 4638505cba
commit 44125729dc
30 changed files with 560 additions and 188 deletions

View File

@@ -0,0 +1,12 @@
====
---- QUERY
create database if not exists native_function_test;
use native_function_test;
drop function if exists agg_memtest(bigint);
create aggregate function agg_memtest(bigint) returns bigint
location '/test-warehouse/libTestUdas.so' update_fn='MemTestUpdate';
select agg_memtest(bigint_col * 10 * 1024 * 1024) from functional.alltypes;
====

View File

@@ -0,0 +1,14 @@
====
---- QUERY
create database if not exists native_function_test;
use native_function_test;
drop function if exists memtest(bigint);
create function memtest(bigint) returns bigint
location '/test-warehouse/libTestUdfs.so' symbol='MemTest'
prepare_fn='_Z14MemTestPreparePN10impala_udf15FunctionContextENS0_18FunctionStateScopeE'
close_fn='_Z12MemTestClosePN10impala_udf15FunctionContextENS0_18FunctionStateScopeE';
select * from functional.alltypes where bigint_col > memtest(10 * 1024 * 1024)
====