From 4e2217e18fe8a36deb8a44194a111129ebcb297c Mon Sep 17 00:00:00 2001 From: Jia Ke Date: Wed, 25 Sep 2024 21:55:36 +0800 Subject: [PATCH] Erase the previous processed window partition when begin handle the next partition --- velox/exec/RowsStreamingWindowBuild.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/velox/exec/RowsStreamingWindowBuild.cpp b/velox/exec/RowsStreamingWindowBuild.cpp index 8c72e0babf93..82b83da325db 100644 --- a/velox/exec/RowsStreamingWindowBuild.cpp +++ b/velox/exec/RowsStreamingWindowBuild.cpp @@ -102,6 +102,15 @@ void RowsStreamingWindowBuild::noMoreInput() { std::shared_ptr RowsStreamingWindowBuild::nextPartition() { VELOX_CHECK(hasNextPartition()); + + if (outputPartition_ > 0) { + windowPartitions_.erase( + windowPartitions_.begin(), windowPartitions_.begin() + 1); + windowPartitions_.shrink_to_fit(); + --outputPartition_; + --inputPartition_; + } + return windowPartitions_[++outputPartition_]; }