Skip to content

Commit

Permalink
Detect pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
PHILO-HE committed Dec 10, 2024
1 parent 9788057 commit 362ba07
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions velox/exec/WindowPartition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,8 @@ void WindowPartition::updateKRangeFrameBounds(

vector_size_t start = 0;
vector_size_t end;
vector_size_t lastFoundIndex = isPreceding ? 0 : -1;
// vector_size_t lastFoundIndex = isPreceding ? 0 : -1;
vector_size_t lastFoundIndex = 0;
// frameColumn is a column index into the original input rows, while
// orderByColumn and mappedFrameColumn are column indices into rows in data_
// after the columns are reordered as per inputMapping_.
Expand Down Expand Up @@ -413,12 +414,24 @@ void WindowPartition::updateKRangeFrameBounds(
// [0, currentRow] are examined. For following bounds, rows between
// [currentRow, numRows()) are checked.
if (isPreceding) {
start =
lastFoundIndex == -1 ? 0 : std::min(lastFoundIndex, numRows - 1);
// start =
// lastFoundIndex == -1 ? 0 : std::min(lastFoundIndex, numRows - 1);
if (i == 0) {
start = 0;
} else {
auto compareResult = data_->compare(
partition_[currentRow - 1], partition_[currentRow], mappedFrameColumn, mappedFrameColumn, flags);
if (compareResult <= 0) {
start = lastFoundIndex;
} else {
start = 0;
}
}
end = currentRow + 1;
} else {
start = lastFoundIndex == -1 ? currentRow
: std::min(lastFoundIndex, numRows - 1);
// start = lastFoundIndex == -1 ? currentRow
// : std::min(lastFoundIndex, numRows - 1);
start = currentRow;
end = partition_.size();
}
rawFrameBounds[i] = searchFrameValue(
Expand Down

0 comments on commit 362ba07

Please sign in to comment.