From ce48e4e4ed63f0259082156ca501b591ed3fa5d3 Mon Sep 17 00:00:00 2001 From: zhli1142015 Date: Tue, 20 Jun 2023 15:35:51 +0800 Subject: [PATCH 1/2] add flag for sort in window op --- 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..8b8c7e164c5e 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(IgnoreRowSortInWindowOp, false, "Ignore 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_IgnoreRowSortInWindowOp) { + std::sort( + sortedRows_.begin(), + sortedRows_.end(), + [this](const char* leftRow, const char* rightRow) { + return compareRowsWithKeys(leftRow, rightRow, allKeyInfo_); + }); + } computePartitionStartRows(); From 4858ddaa65f5f3b87dd7c32839a267025633d7ec Mon Sep 17 00:00:00 2001 From: zhli1142015 Date: Tue, 20 Jun 2023 18:41:55 +0800 Subject: [PATCH 2/2] minor change --- velox/exec/Window.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/velox/exec/Window.cpp b/velox/exec/Window.cpp index 8b8c7e164c5e..c5b11ce1fbb2 100644 --- a/velox/exec/Window.cpp +++ b/velox/exec/Window.cpp @@ -17,7 +17,7 @@ #include "velox/exec/OperatorUtils.h" #include "velox/exec/Task.h" -DEFINE_bool(IgnoreRowSortInWindowOp, false, "Ignore row sort"); +DEFINE_bool(SkipRowSortInWindowOp, false, "Skip row sort"); namespace facebook::velox::exec { @@ -279,7 +279,7 @@ void Window::sortPartitions() { sortedRows_.resize(numRows_); RowContainerIterator iter; data_->listRows(&iter, numRows_, sortedRows_.data()); - if (!FLAGS_IgnoreRowSortInWindowOp) { + if (!FLAGS_SkipRowSortInWindowOp) { std::sort( sortedRows_.begin(), sortedRows_.end(),