Skip to content

Commit

Permalink
Support prefix sort in spilling (facebookincubator#11384)
Browse files Browse the repository at this point in the history
Summary:
Spill uses timsort which is introduced in facebookincubator#6745.
Use the query config `spill_enable_prefix_sort` default false to control if use prefix sort in spill, prefix sort requires extra memory such as prefix data which timsort not.
Prefix sort fallbacks to stdsort when the condition is not satisfied such as sort type contains string type.
So if enable prefix sort, OOM may occur and string type performance may deteriorate depending on data pattern but sort performance is much better.
The sort performance accelerates 2 times  vs before from 561.38ms to 323.14ms in `velox_spiller_aggregate_benchmark`, total time accelerates 18% from 139.75ms to 114.38ms.
```
/mnt/DP_disk1/code/velox/build/velox/exec/tests# ./velox_spiller_aggregate_benchmark
WARNING: Logging before InitGoogleLogging() is written to STDERR
I1029 16:12:05.584403 1758176 AggregateSpillBenchmarkBase.cpp:81] ======Aggregate AGGREGATE_INPUT spilling statistics======
I1029 16:12:05.584498 1758176 AggregateSpillBenchmarkBase.cpp:83] total execution time: 139.75ms
I1029 16:12:05.584528 1758176 AggregateSpillBenchmarkBase.cpp:84] 10000 vectors each with 100 rows have been processed
I1029 16:12:05.584535 1758176 AggregateSpillBenchmarkBase.cpp:87] peak memory usage[0B] cumulative memory usage[0B]
I1029 16:12:05.584542 1758176 AggregateSpillBenchmarkBase.cpp:90] spillRuns[1] spilledInputBytes[1.49GB] spilledBytes[122.09MB] spilledRows[1000000] spilledPartitions[8] spilledFiles[8] spillFillTimeNanos[20.78ms] spillSortTimeNanos[561.38ms] spillExtractVectorTime[170.30ms] spillSerializationTimeNanos[41.86ms] spillWrites[128] spillFlushTimeNanos[13.78ms] spillWriteTimeNanos[85.34ms] maxSpillExceededLimitCount[0] spillReadBytes[0B] spillReads[0] spillReadTimeNanos[0ns] spillReadDeserializationTimeNanos[0ns]
I1029 16:12:05.584635 1758176 AggregateSpillBenchmarkBase.cpp:97] spilled file /tmp/velox_test_FMUXBc/SpillerBenchmarkTest-spill-7-0-7 size 15.12MB
I1029 16:12:05.584645 1758176 AggregateSpillBenchmarkBase.cpp:97] spilled file /tmp/velox_test_FMUXBc/SpillerBenchmarkTest-spill-4-0-3 size 15.37MB
I1029 16:12:05.584656 1758176 AggregateSpillBenchmarkBase.cpp:97] spilled file /tmp/velox_test_FMUXBc/SpillerBenchmarkTest-spill-0-0-0 size 15.30MB
I1029 16:12:05.584664 1758176 AggregateSpillBenchmarkBase.cpp:97] spilled file /tmp/velox_test_FMUXBc/SpillerBenchmarkTest-spill-5-0-4 size 15.22MB
I1029 16:12:05.584672 1758176 AggregateSpillBenchmarkBase.cpp:97] spilled file /tmp/velox_test_FMUXBc/SpillerBenchmarkTest-spill-2-0-2 size 15.28MB
I1029 16:12:05.584681 1758176 AggregateSpillBenchmarkBase.cpp:97] spilled file /tmp/velox_test_FMUXBc/SpillerBenchmarkTest-spill-3-0-6 size 15.23MB
I1029 16:12:05.584689 1758176 AggregateSpillBenchmarkBase.cpp:97] spilled file /tmp/velox_test_FMUXBc/SpillerBenchmarkTest-spill-1-0-1 size 15.35MB
I1029 16:12:05.584697 1758176 AggregateSpillBenchmarkBase.cpp:97] spilled file /tmp/velox_test_FMUXBc/SpillerBenchmarkTest-spill-6-0-5 size 15.22MB
I1029 16:12:05.584717 1758176 SpillerBenchmarkBase.cpp:143] Remove spill dir: /tmp/velox_test_FMUXBc
I1029 16:12:05.602726 1758176 TempDirectoryPath.cpp:29] TempDirectoryPath:: removing all files from /tmp/velox_test_FMUXBc
/mnt/DP_disk1/code/velox/build/velox/exec/tests# ./velox_spiller_aggregate_benchmark
WARNING: Logging before InitGoogleLogging() is written to STDERR
I1029 16:12:53.025599 1758616 AggregateSpillBenchmarkBase.cpp:81] ======Aggregate AGGREGATE_INPUT spilling statistics======
I1029 16:12:53.025705 1758616 AggregateSpillBenchmarkBase.cpp:83] total execution time: 114.38ms
I1029 16:12:53.025740 1758616 AggregateSpillBenchmarkBase.cpp:84] 10000 vectors each with 100 rows have been processed
I1029 16:12:53.025746 1758616 AggregateSpillBenchmarkBase.cpp:87] peak memory usage[0B] cumulative memory usage[0B]
I1029 16:12:53.025755 1758616 AggregateSpillBenchmarkBase.cpp:90] spillRuns[1] spilledInputBytes[1.49GB] spilledBytes[122.09MB] spilledRows[1000000] spilledPartitions[8] spilledFiles[8] spillFillTimeNanos[21.92ms] spillSortTimeNanos[323.14ms] spillExtractVectorTime[176.32ms] spillSerializationTimeNanos[46.42ms] spillWrites[128] spillFlushTimeNanos[12.87ms] spillWriteTimeNanos[92.95ms] maxSpillExceededLimitCount[0] spillReadBytes[0B] spillReads[0] spillReadTimeNanos[0ns] spillReadDeserializationTimeNanos[0ns]
I1029 16:12:53.025866 1758616 AggregateSpillBenchmarkBase.cpp:97] spilled file /tmp/velox_test_5tmfHu/SpillerBenchmarkTest-spill-0-0-0 size 15.30MB
I1029 16:12:53.025879 1758616 AggregateSpillBenchmarkBase.cpp:97] spilled file /tmp/velox_test_5tmfHu/SpillerBenchmarkTest-spill-5-0-2 size 15.22MB
I1029 16:12:53.025890 1758616 AggregateSpillBenchmarkBase.cpp:97] spilled file /tmp/velox_test_5tmfHu/SpillerBenchmarkTest-spill-4-0-4 size 15.37MB
I1029 16:12:53.025902 1758616 AggregateSpillBenchmarkBase.cpp:97] spilled file /tmp/velox_test_5tmfHu/SpillerBenchmarkTest-spill-3-0-3 size 15.23MB
I1029 16:12:53.025911 1758616 AggregateSpillBenchmarkBase.cpp:97] spilled file /tmp/velox_test_5tmfHu/SpillerBenchmarkTest-spill-2-0-5 size 15.28MB
I1029 16:12:53.025921 1758616 AggregateSpillBenchmarkBase.cpp:97] spilled file /tmp/velox_test_5tmfHu/SpillerBenchmarkTest-spill-1-0-1 size 15.35MB
I1029 16:12:53.025933 1758616 AggregateSpillBenchmarkBase.cpp:97] spilled file /tmp/velox_test_5tmfHu/SpillerBenchmarkTest-spill-6-0-7 size 15.22MB
I1029 16:12:53.025943 1758616 AggregateSpillBenchmarkBase.cpp:97] spilled file /tmp/velox_test_5tmfHu/SpillerBenchmarkTest-spill-7-0-6 size 15.12MB
I1029 16:12:53.025956 1758616 SpillerBenchmarkBase.cpp:143] Remove spill dir: /tmp/velox_test_5tmfHu
I1029 16:12:53.045596 1758616 TempDirectoryPath.cpp:29] TempDirectoryPath:: removing all files from /tmp/velox_test_5tmfHu
```

Pull Request resolved: facebookincubator#11384

Test Plan:
Meta internal experiment result:

The prefix sort on Prestissimo batch query can reduce the spill sort time by 3x from 4.24 days to 1.56 days, e2e execution
time reduced from 4.68 mins to 4.17mins. Note disk write time is actually shorter on the master run without this optimization
~3.27 days (but prefix sort run took > 4 days which is probably due to ws time variance). However the timsort doesn't help
much even though oss experiments show it has 2x improvement but for this query it actually caused the sort time increased
from 4.24 days to 5.39 days and query e2e execution time increased to 5mins.
master: 20241106_071151_00001_2t6ep
prefix sort: 20241106_224754_00001_bpzfi
timsort: 20241106_171314_00001_dwzr8

Reviewed By: tanjialiang

Differential Revision: D65408021

Pulled By: xiaoxmeng

fbshipit-source-id: dc39dc96547911cf8da9ec889e9b5d123b060999
  • Loading branch information
jinchengchenghh authored and facebook-github-bot committed Nov 7, 2024
1 parent 64661a3 commit 8c69b8b
Show file tree
Hide file tree
Showing 20 changed files with 245 additions and 86 deletions.
14 changes: 7 additions & 7 deletions velox/common/base/PrefixSortConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@ namespace facebook::velox::common {

/// Specifies the config for prefix-sort.
struct PrefixSortConfig {
explicit PrefixSortConfig(
int64_t maxNormalizedKeySize,
int32_t threshold = 130)
: maxNormalizedKeySize(maxNormalizedKeySize), threshold(threshold) {}
PrefixSortConfig() = default;

PrefixSortConfig(int64_t _maxNormalizedKeySize, int32_t _threshold)
: maxNormalizedKeySize(_maxNormalizedKeySize), threshold(_threshold) {}

/// Max number of bytes can store normalized keys in prefix-sort buffer per
/// entry.
const int64_t maxNormalizedKeySize;
/// entry. Same with QueryConfig kPrefixSortNormalizedKeyMaxBytes.
int64_t maxNormalizedKeySize{128};

/// PrefixSort will have performance regression when the dateset is too small.
const int32_t threshold;
int32_t threshold{130};
};
} // namespace facebook::velox::common
2 changes: 2 additions & 0 deletions velox/common/base/SpillConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ SpillConfig::SpillConfig(
uint64_t _maxSpillRunRows,
uint64_t _writerFlushThresholdSize,
const std::string& _compressionKind,
std::optional<PrefixSortConfig> _prefixSortConfig,
const std::string& _fileCreateConfig)
: getSpillDirPathCb(std::move(_getSpillDirPathCb)),
updateAndCheckSpillLimitCb(std::move(_updateAndCheckSpillLimitCb)),
Expand All @@ -52,6 +53,7 @@ SpillConfig::SpillConfig(
maxSpillRunRows(_maxSpillRunRows),
writerFlushThresholdSize(_writerFlushThresholdSize),
compressionKind(common::stringToCompressionKind(_compressionKind)),
prefixSortConfig(_prefixSortConfig),
fileCreateConfig(_fileCreateConfig) {
VELOX_USER_CHECK_GE(
spillableReservationGrowthPct,
Expand Down
6 changes: 6 additions & 0 deletions velox/common/base/SpillConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <string.h>

#include <folly/executors/CPUThreadPoolExecutor.h>
#include "velox/common/base/PrefixSortConfig.h"
#include "velox/common/compression/Compression.h"

namespace facebook::velox::common {
Expand Down Expand Up @@ -61,6 +62,7 @@ struct SpillConfig {
uint64_t _maxSpillRunRows,
uint64_t _writerFlushThresholdSize,
const std::string& _compressionKind,
std::optional<PrefixSortConfig> _prefixSortConfig = std::nullopt,
const std::string& _fileCreateConfig = {});

/// Returns the spilling level with given 'startBitOffset' and
Expand Down Expand Up @@ -135,6 +137,10 @@ struct SpillConfig {
/// CompressionKind when spilling, CompressionKind_NONE means no compression.
common::CompressionKind compressionKind;

/// Prefix sort config when spilling, enable prefix sort when this config is
/// set, otherwise, fallback to timsort.
std::optional<PrefixSortConfig> prefixSortConfig;

/// Custom options passed to velox::FileSystem to create spill WriteFile.
std::string fileCreateConfig;
};
Expand Down
27 changes: 21 additions & 6 deletions velox/common/base/tests/SpillConfigTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,14 @@
using namespace facebook::velox::common;
using namespace facebook::velox::exec;

TEST(SpillConfig, spillLevel) {
class SpillConfigTest : public testing::TestWithParam<bool> {
protected:
const bool enablePrefixSort_{GetParam()};
const std::optional<PrefixSortConfig> prefixSortConfig_ =
enablePrefixSort_ ? std::optional<PrefixSortConfig>({}) : std::nullopt;
};

TEST_P(SpillConfigTest, spillLevel) {
const uint8_t kInitialBitOffset = 16;
const uint8_t kNumPartitionsBits = 3;
const SpillConfig config(
Expand All @@ -40,7 +47,8 @@ TEST(SpillConfig, spillLevel) {
0,
0,
0,
"none");
"none",
prefixSortConfig_);
struct {
uint8_t bitOffset;
// Indicates an invalid if 'expectedLevel' is negative.
Expand Down Expand Up @@ -70,7 +78,7 @@ TEST(SpillConfig, spillLevel) {
}
}

TEST(SpillConfig, spillLevelLimit) {
TEST_P(SpillConfigTest, spillLevelLimit) {
struct {
uint8_t startBitOffset;
int32_t numBits;
Expand Down Expand Up @@ -125,15 +133,16 @@ TEST(SpillConfig, spillLevelLimit) {
testData.maxSpillLevel,
0,
0,
"none");
"none",
prefixSortConfig_);

ASSERT_EQ(
testData.expectedExceeds,
config.exceedSpillLevelLimit(testData.bitOffset));
}
}

TEST(SpillConfig, spillableReservationPercentages) {
TEST_P(SpillConfigTest, spillableReservationPercentages) {
struct {
uint32_t growthPct;
int32_t minPct;
Expand Down Expand Up @@ -171,7 +180,8 @@ TEST(SpillConfig, spillableReservationPercentages) {
0,
1'000'000,
0,
"none");
"none",
prefixSortConfig_);
};

if (testData.expectedError) {
Expand All @@ -183,3 +193,8 @@ TEST(SpillConfig, spillableReservationPercentages) {
}
}
}

VELOX_INSTANTIATE_TEST_SUITE_P(
SpillConfigTest,
SpillConfigTest,
testing::ValuesIn({false, true}));
10 changes: 10 additions & 0 deletions velox/core/QueryConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,12 @@ class QueryConfig {
static constexpr const char* kSpillCompressionKind =
"spill_compression_codec";

/// Enable the prefix sort or fallback to timsort in spill. The prefix sort is
/// faster than timsort but requires the memory to build prefix data, which
/// may cause out of memory.
static constexpr const char* kSpillEnablePrefixSort =
"spill_enable_prefix_sort";

/// Specifies spill write buffer size in bytes. The spiller tries to buffer
/// serialized spill data up to the specified size before write to storage
/// underneath for io efficiency. If it is set to zero, then spill write
Expand Down Expand Up @@ -656,6 +662,10 @@ class QueryConfig {
return get<std::string>(kSpillCompressionKind, "none");
}

bool spillEnablePrefixSort() const {
return get<bool>(kSpillEnablePrefixSort, false);
}

uint64_t spillWriteBufferSize() const {
// The default write buffer size set to 1MB.
return get<uint64_t>(kSpillWriteBufferSize, 1L << 20);
Expand Down
5 changes: 5 additions & 0 deletions velox/docs/configs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,11 @@ Spilling
- Specifies the compression algorithm type to compress the spilled data before write to disk to trade CPU for IO
efficiency. The supported compression codecs are: ZLIB, SNAPPY, LZO, ZSTD, LZ4 and GZIP.
NONE means no compression.
* - spill_enable_prefix_sort
- bool
- false
- Enable the prefix sort or fallback to timsort in spill. The prefix sort is faster than timsort but requires the
memory to build prefix data, which might have potential risk of running out of server memory.
* - spiller_start_partition_bit
- integer
- 29
Expand Down
3 changes: 3 additions & 0 deletions velox/exec/Driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ std::optional<common::SpillConfig> DriverCtx::makeSpillConfig(
queryConfig.maxSpillRunRows(),
queryConfig.writerFlushThresholdBytes(),
queryConfig.spillCompressionKind(),
queryConfig.spillEnablePrefixSort()
? std::optional<common::PrefixSortConfig>(prefixSortConfig())
: std::nullopt,
queryConfig.spillFileCreateConfig());
}

Expand Down
21 changes: 19 additions & 2 deletions velox/exec/PrefixSort.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,10 +217,10 @@ void PrefixSort::extractRowToPrefix(char* row, char* prefix) {

// static.
uint32_t PrefixSort::maxRequiredBytes(
memory::MemoryPool* pool,
RowContainer* rowContainer,
const std::vector<CompareFlags>& compareFlags,
const velox::common::PrefixSortConfig& config) {
const velox::common::PrefixSortConfig& config,
memory::MemoryPool* pool) {
if (rowContainer->numRows() < config.threshold) {
return 0;
}
Expand All @@ -235,6 +235,23 @@ uint32_t PrefixSort::maxRequiredBytes(
return prefixSort.maxRequiredBytes();
}

// static
void PrefixSort::stdSort(
std::vector<char*, memory::StlAllocator<char*>>& rows,
RowContainer* rowContainer,
const std::vector<CompareFlags>& compareFlags) {
std::sort(
rows.begin(), rows.end(), [&](const char* leftRow, const char* rightRow) {
for (auto i = 0; i < compareFlags.size(); ++i) {
if (auto result = rowContainer->compare(
leftRow, rightRow, i, compareFlags[i])) {
return result < 0;
}
}
return false;
});
}

uint32_t PrefixSort::maxRequiredBytes() {
const auto numRows = rowContainer_->numRows();
const auto numPages =
Expand Down
41 changes: 15 additions & 26 deletions velox/exec/PrefixSort.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,25 +23,6 @@

namespace facebook::velox::exec {

namespace detail {

FOLLY_ALWAYS_INLINE void stdSort(
std::vector<char*, memory::StlAllocator<char*>>& rows,
RowContainer* rowContainer,
const std::vector<CompareFlags>& compareFlags) {
std::sort(
rows.begin(), rows.end(), [&](const char* leftRow, const char* rightRow) {
for (auto i = 0; i < compareFlags.size(); ++i) {
if (auto result = rowContainer->compare(
leftRow, rightRow, i, compareFlags[i])) {
return result < 0;
}
}
return false;
});
}
}; // namespace detail

/// The layout of prefix-sort buffer, a prefix entry includes:
/// 1. normalized keys
/// 2. non-normalized data ptr for semi-normalized types such as
Expand Down Expand Up @@ -126,33 +107,41 @@ class PrefixSort {
const std::vector<CompareFlags>& compareFlags,
const velox::common::PrefixSortConfig& config) {
if (rowContainer->numRows() < config.threshold) {
detail::stdSort(rows, rowContainer, compareFlags);
stdSort(rows, rowContainer, compareFlags);
return;
}
VELOX_DCHECK_EQ(rowContainer->keyTypes().size(), compareFlags.size());
const auto sortLayout = PrefixSortLayout::makeSortLayout(
rowContainer->keyTypes(), compareFlags, config.maxNormalizedKeySize);
// All keys can not normalize, skip the binary string compare opt.
// Putting this outside sort-internal helps with inline std-sort.
// Putting this outside sort-internal helps with stdSort.
if (sortLayout.noNormalizedKeys) {
detail::stdSort(rows, rowContainer, compareFlags);
stdSort(rows, rowContainer, compareFlags);
return;
}

PrefixSort prefixSort(pool, rowContainer, sortLayout);
prefixSort.sortInternal(rows);
}

/// The stdsort won't require bytes while prefixsort may require buffers
/// The std::sort won't require bytes while prefix sort may require buffers
/// such as prefix data. The logic is similar to the above function
/// PrefixSort::sort but returns the maxmium buffer the sort may need.
/// PrefixSort::sort but returns the maximum buffer the sort may need.
static uint32_t maxRequiredBytes(
memory::MemoryPool* pool,
RowContainer* rowContainer,
const std::vector<CompareFlags>& compareFlags,
const velox::common::PrefixSortConfig& config);
const velox::common::PrefixSortConfig& config,
memory::MemoryPool* pool);

private:
/// Fallback to stdSort when prefix sort conditions such as config and memory
/// are not satisfied. stdSort provides >2X performance win than std::sort for
/// user experienced data.
static void stdSort(
std::vector<char*, memory::StlAllocator<char*>>& rows,
RowContainer* rowContainer,
const std::vector<CompareFlags>& compareFlags);

// Estimates the memory required for prefix sort such as prefix buffer and
// swap buffer.
uint32_t maxRequiredBytes();
Expand Down
2 changes: 1 addition & 1 deletion velox/exec/SortBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ void SortBuffer::ensureSortFits() {
uint64_t sortBufferToReserve =
numInputRows_ * sizeof(char*) +
PrefixSort::maxRequiredBytes(
pool_, data_.get(), sortCompareFlags_, prefixSortConfig_);
data_.get(), sortCompareFlags_, prefixSortConfig_, pool_);
{
memory::ReclaimableSectionGuard guard(nonReclaimableSection_);
if (pool_->maybeReserve(sortBufferToReserve)) {
Expand Down
2 changes: 1 addition & 1 deletion velox/exec/SortWindowBuild.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ void SortWindowBuild::ensureSortFits() {
uint64_t sortBufferToReserve =
numRows_ * (sizeof(char*) + sizeof(vector_size_t)) +
PrefixSort::maxRequiredBytes(
pool_, data_.get(), compareFlags_, prefixSortConfig_);
data_.get(), compareFlags_, prefixSortConfig_, pool_);
{
memory::ReclaimableSectionGuard guard(nonReclaimableSection_);
if (pool_->maybeReserve(sortBufferToReserve)) {
Expand Down
19 changes: 18 additions & 1 deletion velox/exec/Spill.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,20 @@
using facebook::velox::common::testutil::TestValue;

namespace facebook::velox::exec {
namespace {
// Returns the CompareFlags vector whose size is equal to numSortKeys. Fill in
// with default CompareFlags() if 'compareFlags' is empty.
const std::vector<CompareFlags> getCompareFlagsOrDefault(
const std::vector<CompareFlags>& compareFlags,
int32_t numSortKeys) {
VELOX_DCHECK(compareFlags.empty() || compareFlags.size() == numSortKeys);
if (compareFlags.size() == numSortKeys) {
return compareFlags;
}
return std::vector<CompareFlags>(numSortKeys);
}
} // namespace

void SpillMergeStream::pop() {
if (++index_ >= size_) {
setNextBatch();
Expand Down Expand Up @@ -74,6 +88,7 @@ SpillState::SpillState(
uint64_t targetFileSize,
uint64_t writeBufferSize,
common::CompressionKind compressionKind,
const std::optional<common::PrefixSortConfig>& prefixSortConfig,
memory::MemoryPool* pool,
folly::Synchronized<common::SpillStats>* stats,
const std::string& fileCreateConfig)
Expand All @@ -82,10 +97,12 @@ SpillState::SpillState(
fileNamePrefix_(fileNamePrefix),
maxPartitions_(maxPartitions),
numSortKeys_(numSortKeys),
sortCompareFlags_(sortCompareFlags),
sortCompareFlags_(
getCompareFlagsOrDefault(sortCompareFlags, numSortKeys)),
targetFileSize_(targetFileSize),
writeBufferSize_(writeBufferSize),
compressionKind_(compressionKind),
prefixSortConfig_(prefixSortConfig),
fileCreateConfig_(fileCreateConfig),
pool_(pool),
stats_(stats),
Expand Down
6 changes: 6 additions & 0 deletions velox/exec/Spill.h
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,7 @@ class SpillState {
uint64_t targetFileSize,
uint64_t writeBufferSize,
common::CompressionKind compressionKind,
const std::optional<common::PrefixSortConfig>& prefixSortConfig,
memory::MemoryPool* pool,
folly::Synchronized<common::SpillStats>* stats,
const std::string& fileCreateConfig = {});
Expand All @@ -369,6 +370,10 @@ class SpillState {
return compressionKind_;
}

const std::optional<common::PrefixSortConfig>& prefixSortConfig() const {
return prefixSortConfig_;
}

const std::vector<CompareFlags>& sortCompareFlags() const {
return sortCompareFlags_;
}
Expand Down Expand Up @@ -439,6 +444,7 @@ class SpillState {
const uint64_t targetFileSize_;
const uint64_t writeBufferSize_;
const common::CompressionKind compressionKind_;
const std::optional<common::PrefixSortConfig> prefixSortConfig_;
const std::string fileCreateConfig_;
memory::MemoryPool* const pool_;
folly::Synchronized<common::SpillStats>* const stats_;
Expand Down
Loading

0 comments on commit 8c69b8b

Please sign in to comment.