Arnab Karmakar created IMPALA-15431:
---------------------------------------
Summary: Optimize the StringVal Min/Max templates
Key: IMPALA-15431
URL: https://issues.apache.org/jira/browse/IMPALA-15431
Project: IMPALA
Issue Type: Improvement
Components: Backend
Reporter: Arnab Karmakar
The generic {{{}Min()/Max(){}}} templates for StringVal
([aggregate-functions-ir.cc|https://github.com/apache/impala/blob/6a8a5a52ba77b644e4b8a25f38c4c0a30217431b/be/src/exprs/aggregate-functions-ir.cc#L1301-L1319])
compare values using StringValue ordering. When a new min/max is found and dst
is non-null, they call {{{}ctx->Free(dst->ptr){}}} followed by
{{{}CopyStringVal(ctx, src, dst){}}}, which allocates a new buffer.
When {{{}src.len == dst->len{}}}, this could instead memcpy src into the
existing dst buffer and avoid a free+allocate per update.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)