From 83589915eff9a60a757ad353c1e864c1b703dfbf Mon Sep 17 00:00:00 2001 From: Zhen Li <10524738+zhli1142015@users.noreply.github.com> Date: Tue, 20 Jun 2023 20:46:20 +0800 Subject: [PATCH] Add flag for sort in window (#321) * add flag for sort in window op * minor change --- velox/exec/Window.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/velox/exec/Window.cpp b/velox/exec/Window.cpp index dd95bb9cd915..c5b11ce1fbb2 100644 --- a/velox/exec/Window.cpp +++ b/velox/exec/Window.cpp @@ -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 { @@ -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();