impala-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Ho (Code Review)" <>
Subject [Impala-ASF-CR] IMPALA-4120: Incorrect results with LEAD() analytic function
Date Mon, 17 Oct 2016 19:30:58 GMT
Michael Ho has uploaded a new change for review.

Change subject: IMPALA-4120: Incorrect results with LEAD() analytic function

IMPALA-4120: Incorrect results with LEAD() analytic function

This change fixes a memory management problem with LEAD()/LAG()
analytic functions which led to incorrect result. In particular,
the update functions specified for these analytic functions only
make a shallow copy of StringVal (i.e. copying only the pointer
and the length of the string) without copying the string itself.
This may lead to problem if the string is created from some UDFs
which does local allocations whose buffer may be freed and reused
before the result tuple is copied out. This change fixes the problem
above by allocating a new buffer at the Init() function of
the AggFnEvaluatorthese analytic functions to track the intermediate
value. In addition, when the value is copied out in GetValue(),
it will be copied into the MemPool belonging to the AnalyticEvalNode
and it will be attached to the outgoing row batches. This change also
fixes a missing local allocations in QueryMaintenance.

Change-Id: I85bb1745232d8dd383a6047c86019c6378ab571f
M be/src/exec/
M be/src/exprs/
M be/src/exprs/agg-fn-evaluator.h
M be/src/exprs/
M be/src/udf/
M fe/src/main/java/org/apache/impala/catalog/
M testdata/workloads/functional-query/queries/QueryTest/analytic-fns.test
7 files changed, 72 insertions(+), 23 deletions(-)

  git pull ssh:// refs/changes/40/4740/1
To view, visit
To unsubscribe, visit

Gerrit-MessageType: newchange
Gerrit-Change-Id: I85bb1745232d8dd383a6047c86019c6378ab571f
Gerrit-PatchSet: 1
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: Michael Ho <>

View raw message