Skip to content

Commit

Permalink
Add flag for sort in window (#321)
Browse files Browse the repository at this point in the history
* add flag for sort in window op

* minor change
  • Loading branch information
zhli1142015 authored Jun 20, 2023
1 parent 1711354 commit 8358991
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions velox/exec/Window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
#include "velox/exec/OperatorUtils.h"
#include "velox/exec/Task.h"

DEFINE_bool(SkipRowSortInWindowOp, false, "Skip row sort");

namespace facebook::velox::exec {

namespace {
Expand Down Expand Up @@ -277,13 +279,14 @@ void Window::sortPartitions() {
sortedRows_.resize(numRows_);
RowContainerIterator iter;
data_->listRows(&iter, numRows_, sortedRows_.data());

std::sort(
sortedRows_.begin(),
sortedRows_.end(),
[this](const char* leftRow, const char* rightRow) {
return compareRowsWithKeys(leftRow, rightRow, allKeyInfo_);
});
if (!FLAGS_SkipRowSortInWindowOp) {
std::sort(
sortedRows_.begin(),
sortedRows_.end(),
[this](const char* leftRow, const char* rightRow) {
return compareRowsWithKeys(leftRow, rightRow, allKeyInfo_);
});
}

computePartitionStartRows();

Expand Down

0 comments on commit 8358991

Please sign in to comment.