Skip to content

Commit

Permalink
feat: Allow non standard partition functions in ScaleWriterPartitioni…
Browse files Browse the repository at this point in the history
…ngLocalPartition (facebookincubator#11762)

Summary:

For example Hive connector partitioning function

Reviewed By: xiaoxmeng

Differential Revision: D66833831
  • Loading branch information
arhimondr authored and facebook-github-bot committed Dec 6, 2024
1 parent 3ead2f4 commit 37e5ae9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
8 changes: 3 additions & 5 deletions velox/exec/LocalPlanner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,13 @@ std::unique_ptr<Operator> createScaleWriterLocalPartition(
const std::shared_ptr<const core::LocalPartitionNode>& localPartitionNode,
int32_t operatorId,
DriverCtx* ctx) {
if (dynamic_cast<const HashPartitionFunctionSpec*>(
if (dynamic_cast<const RoundRobinPartitionFunctionSpec*>(
&localPartitionNode->partitionFunctionSpec())) {
return std::make_unique<ScaleWriterPartitioningLocalPartition>(
return std::make_unique<ScaleWriterLocalPartition>(
operatorId, ctx, localPartitionNode);
}

VELOX_CHECK_NOT_NULL(dynamic_cast<const RoundRobinPartitionFunctionSpec*>(
&localPartitionNode->partitionFunctionSpec()));
return std::make_unique<ScaleWriterLocalPartition>(
return std::make_unique<ScaleWriterPartitioningLocalPartition>(
operatorId, ctx, localPartitionNode);
}

Expand Down
4 changes: 0 additions & 4 deletions velox/exec/ScaleWriterLocalPartition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,6 @@ ScaleWriterPartitioningLocalPartition::ScaleWriterPartitioningLocalPartition(
: planNode->partitionFunctionSpec().create(
numTablePartitions_,
/*localExchange=*/true);
if (partitionFunction_ != nullptr) {
VELOX_CHECK_NOT_NULL(
dynamic_cast<HashPartitionFunction*>(partitionFunction_.get()));
}
}

void ScaleWriterPartitioningLocalPartition::initialize() {
Expand Down

0 comments on commit 37e5ae9

Please sign in to comment.