Skip to content

Commit

Permalink
style fix
Browse files Browse the repository at this point in the history
  • Loading branch information
zhli1142015 committed Nov 25, 2023
1 parent 3032d11 commit 4724acf
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 14 deletions.
5 changes: 1 addition & 4 deletions cpp/core/shuffle/Partitioner.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,7 @@

namespace gluten {

arrow::Result<std::shared_ptr<Partitioner>> Partitioner::make(
Partitioning partitioning,
int32_t numPartitions,
int32_t partitionKeySeed) {
arrow::Result<std::shared_ptr<Partitioner>> Partitioner::make(Partitioning partitioning, int32_t numPartitions, int32_t partitionKeySeed) {
switch (partitioning) {
case Partitioning::kHash:
return std::make_shared<HashPartitioner>(numPartitions);
Expand Down
5 changes: 1 addition & 4 deletions cpp/core/shuffle/Partitioner.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,7 @@ namespace gluten {

class Partitioner {
public:
static arrow::Result<std::shared_ptr<Partitioner>> make(
Partitioning partitioning,
int32_t numPartitions,
int32_t partitionKeySeed);
static arrow::Result<std::shared_ptr<Partitioner>> make(Partitioning partitioning, int32_t numPartitions, int32_t partitionKeySeed);

// Whether the first column is partition key.
bool hasPid() const {
Expand Down
4 changes: 2 additions & 2 deletions cpp/core/shuffle/RoundRobinPartitioner.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ namespace gluten {

class RoundRobinPartitioner final : public Partitioner {
public:
RoundRobinPartitioner(int32_t numPartitions, int32_t partitionKeySeed)
: Partitioner(numPartitions, false), pidSelection_(partitionKeySeed) {}
RoundRobinPartitioner(int32_t numPartitions, int32_t partitionKeySeed)
: Partitioner(numPartitions, false), pidSelection_(partitionKeySeed % numPartitions) {}

arrow::Status compute(
const int32_t* pidArr,
Expand Down
2 changes: 1 addition & 1 deletion cpp/core/tests/RoundRobinPartitionerTest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class RoundRobinPartitionerTest : public ::testing::Test {

TEST_F(RoundRobinPartitionerTest, TestInit) {
int numPart = 2;
prepareData(numPart, 1);
prepareData(numPart, 3);
ASSERT_NE(partitioner_, nullptr);
int32_t pidSelection = getPidSelection();
ASSERT_EQ(pidSelection, 1);
Expand Down
4 changes: 1 addition & 3 deletions cpp/velox/shuffle/VeloxShuffleWriter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -411,9 +411,7 @@ arrow::Status VeloxShuffleWriter::init() {
VELOX_CHECK_NOT_NULL(options_.memory_pool);

ARROW_ASSIGN_OR_RAISE(partitionWriter_, partitionWriterCreator_->make(this));
ARROW_ASSIGN_OR_RAISE(
partitioner_,
Partitioner::make(options_.partitioning, numPartitions_, options_.partition_key_seed));
ARROW_ASSIGN_OR_RAISE(partitioner_, Partitioner::make(options_.partitioning, numPartitions_, options_.partition_key_seed));

// pre-allocated buffer size for each partition, unit is row count
// when partitioner is SinglePart, partial variables don`t need init
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ class VeloxCelebornHashBasedColumnarShuffleWriter[K, V](
.getNativeInstanceHandle,
handle,
context.taskAttemptId(),
partitionKeySeed,
"celeborn",
GlutenConfig.getConf.columnarShuffleReallocThreshold
)
Expand Down

0 comments on commit 4724acf

Please sign in to comment.