Michael Ho has uploaded a new change for review. http://gerrit.cloudera.org:8080/4740
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/analytic-eval-node.cc M be/src/exprs/agg-fn-evaluator.cc M be/src/exprs/agg-fn-evaluator.h M be/src/exprs/aggregate-functions-ir.cc M be/src/udf/udf.cc M fe/src/main/java/org/apache/impala/catalog/BuiltinsDb.java M testdata/workloads/functional-query/queries/QueryTest/analytic-fns.test 7 files changed, 72 insertions(+), 23 deletions(-) git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/40/4740/1 -- To view, visit http://gerrit.cloudera.org:8080/4740 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I85bb1745232d8dd383a6047c86019c6378ab571f Gerrit-PatchSet: 1 Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-Owner: Michael Ho <k...@cloudera.com>