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 Thu, 20 Oct 2016 00:33:14 GMT
Michael Ho has uploaded a new patch set (#3).

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 do 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 buffer at the Init() functions of these
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 attached to the
outgoing row batches. This change also fixes a missing free of
local allocations in QueryMaintenance().

Change-Id: I85bb1745232d8dd383a6047c86019c6378ab571f
M be/src/exec/
M be/src/exec/analytic-eval-node.h
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, 116 insertions(+), 51 deletions(-)

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I85bb1745232d8dd383a6047c86019c6378ab571f
Gerrit-PatchSet: 3
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: Michael Ho <>
Gerrit-Reviewer: Matthew Jacobs <>
Gerrit-Reviewer: Michael Ho <>

View raw message