Impala Public Jenkins has submitted this change and it was merged. (
http://gerrit.cloudera.org:8080/24893 )
Change subject: IMPALA-15376: Fix SIGABRT in AnalyticEvalNode::GetNext on empty
window_tuples_
......................................................................
IMPALA-15376: Fix SIGABRT in AnalyticEvalNode::GetNext on empty window_tuples_
AnalyticEvalNode::GetNext() unconditionally called
window_tuples_.front() when deciding whether to transfer the prev
tuple pool to the output batch. window_tuples_ can legitimately be
empty at that point (e.g. right after all window tuples have been
popped, or when prev_pool_last_window_idx_ was recorded as the -1
sentinel), so calling front() on the empty deque is undefined
behavior. Under _GLIBCXX_ASSERTIONS on GCC 15+ (enabled whenever
__OPTIMIZE__ is unset, e.g. -O0/UBSAN/DEBUG_NOOPT builds) this
aborts the process.
Reproduced by a query combining an analytic/window function with an
outer ORDER BY + LIMIT, e.g.:
select * from (
select l_partkey, l_quantity, l_orderkey,
rank() over (partition by l_partkey, l_quantity
order by l_orderkey desc) rk
from lineitem) dt
order by l_partkey, l_quantity, l_orderkey, rk
limit 10
which plans to a local TopNNode pulling rows from AnalyticEvalNode via
GetNext() in TopNNode::Open().
Guard the front() access by short-circuiting when window_tuples_ is
empty, since an empty window_tuples_ means nothing remains that could
still reference prev_tuple_pool_, so it's always safe to transfer.
Change-Id: Ic17c5a6ea4cfada1faf7a1715aa83489c2db7658
Assisted-by: Claude Sonnet 5 (GitHub Copilot)
Reviewed-on: http://gerrit.cloudera.org:8080/24893
Reviewed-by: Impala Public Jenkins <[email protected]>
Tested-by: Impala Public Jenkins <[email protected]>
---
M be/src/exec/analytic-eval-node.cc
1 file changed, 2 insertions(+), 1 deletion(-)
Approvals:
Impala Public Jenkins: Looks good to me, approved; Verified
--
To view, visit http://gerrit.cloudera.org:8080/24893
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ic17c5a6ea4cfada1faf7a1715aa83489c2db7658
Gerrit-Change-Number: 24893
Gerrit-PatchSet: 4
Gerrit-Owner: Michael Smith <[email protected]>
Gerrit-Reviewer: Impala Public Jenkins <[email protected]>
Gerrit-Reviewer: Jiyoung Yoo <[email protected]>
Gerrit-Reviewer: Joe McDonnell <[email protected]>
Gerrit-Reviewer: Michael Smith <[email protected]>
Gerrit-Reviewer: Zoltan Borok-Nagy <[email protected]>