From 304bcebf79d61cc9a75a747c096a5ed1fc8f6b86 Mon Sep 17 00:00:00 2001 From: PHILO-HE Date: Tue, 27 Feb 2024 21:29:17 +0800 Subject: [PATCH] Initial commit --- velox/exec/Window.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/velox/exec/Window.cpp b/velox/exec/Window.cpp index 303fa045e5e8..2955ed3cbae6 100644 --- a/velox/exec/Window.cpp +++ b/velox/exec/Window.cpp @@ -300,8 +300,16 @@ void Window::updateKRowsFrameBounds( if (frameArg.index == kConstantChannel) { auto constantOffset = frameArg.constant.value(); auto startValue = - startRow + (isKPreceding ? -constantOffset : constantOffset); - std::iota(rawFrameBounds, rawFrameBounds + numRows, startValue); + (isKPreceding ? -constantOffset : constantOffset) + startRow; + // std::iota(rawFrameBounds, rawFrameBounds + numRows, startValue); + for (int i = 0; i < numRows; i++) { + if (startValue != (int32_t)startValue) { + std::fill(rawFrameBounds + i, rawFrameBounds + numRows, numRows - 1); + } else { + *(rawFrameBounds + i) = startValue; + } + startValue = startValue + 1; + } } else { currentPartition_->extractColumn( frameArg.index, partitionOffset_, numRows, 0, frameArg.value);