Skip to content

Commit

Permalink
s/std::stable_sort/boost::parallel_stable_sort (oap-project#303)
Browse files Browse the repository at this point in the history
Signed-off-by: Yuan Zhou <[email protected]>
  • Loading branch information
zhouyuan authored and zhejiangxiaomai committed Jul 11, 2023
1 parent 5b139de commit e069ef0
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions velox/exec/OrderBy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
#include "velox/exec/Task.h"
#include "velox/vector/FlatVector.h"

#include <boost/sort/sort.hpp>

using facebook::velox::common::testutil::TestValue;

namespace facebook::velox::exec {
Expand Down Expand Up @@ -267,7 +269,8 @@ void OrderBy::noMoreInput() {
returningRows_.resize(numRows_);
RowContainerIterator iter;
data_->listRows(&iter, numRows_, returningRows_.data());
std::stable_sort(
constexpr uint16_t kSortThreads = 8;
boost::sort::parallel_stable_sort(
returningRows_.begin(),
returningRows_.end(),
[this](const char* leftRow, const char* rightRow) {
Expand All @@ -278,7 +281,8 @@ void OrderBy::noMoreInput() {
}
}
return false;
});
},
kSortThreads);

} else {
// Finish spill, and we shouldn't get any rows from non-spilled partition as
Expand Down

0 comments on commit e069ef0

Please sign in to comment.