Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
Impala 2.10.0
-
None
-
None
-
ghx-label-2
Description
http://community.cloudera.com/t5/Interactive-Short-cycle-SQL/Memory-handling-in-Impala-UDA-functions/m-p/59877#M3574?eid=1&aid=1 pointed out that StringConcatUpdate() uses a local allocation to store the intermediate value (returned from StringVal::CopyFrom()) when it show be using a non-local allocation from Allocate().
void StringConcatUpdate(FunctionContext* context, const StringVal& arg1, const StringVal& arg2, StringVal* val) { if (val->is_null) { val->is_null = false; *val = StringVal::CopyFrom(context, arg1.ptr, arg1.len); } else { int new_len = val->len + arg1.len + arg2.len; StringVal new_val(context, new_len); if (!new_val.is_null) { memcpy(new_val.ptr, val->ptr, val->len); memcpy(new_val.ptr + val->len, arg2.ptr, arg2.len); memcpy(new_val.ptr + val->len + arg2.len, arg1.ptr, arg1.len); } *val = new_val; } }
The bug was fixed in a different repo years ago.
https://github.com/cloudera/impala-udf-samples/commit/3fce648fddb6c41e09572e0de89d3a83b394d47a