Skip to content

Commit

Permalink
Add PlanBuilder::partitionedOutputArbitrary (#7060)
Browse files Browse the repository at this point in the history
Summary:
Create a PartitionedOutputNode to output the input data in arbitrary buffer.

Pull Request resolved: #7060

Reviewed By: xiaoxmeng

Differential Revision: D50308139

Pulled By: kewang1024

fbshipit-source-id: 8cf267c683f863a1def2ba775ac55eb67ce84cf6
  • Loading branch information
kewang1024 authored and facebook-github-bot committed Oct 15, 2023
1 parent a6de7e5 commit 94917a5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
10 changes: 10 additions & 0 deletions velox/exec/tests/utils/PlanBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -988,6 +988,16 @@ PlanBuilder& PlanBuilder::partitionedOutputBroadcast(
return *this;
}

PlanBuilder& PlanBuilder::partitionedOutputArbitrary(
const std::vector<std::string>& outputLayout) {
auto outputType = outputLayout.empty()
? planNode_->outputType()
: extract(planNode_->outputType(), outputLayout);
planNode_ = core::PartitionedOutputNode::arbitrary(
nextPlanNodeId(), outputType, planNode_);
return *this;
}

PlanBuilder& PlanBuilder::localPartition(
const std::vector<std::string>& keys,
const std::vector<core::PlanNodePtr>& sources) {
Expand Down
8 changes: 6 additions & 2 deletions velox/exec/tests/utils/PlanBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ class PlanBuilder {
core::PartitionFunctionSpecPtr partitionFunctionSpec,
const std::vector<std::string>& outputLayout = {});

/// Add a PartitionedOutputNode to broadcast the input data.
/// Adds a PartitionedOutputNode to broadcast the input data.
///
/// @param outputLayout Optional output layout in case it is different then
/// the input. Output columns may appear in different order from the input,
Expand All @@ -569,7 +569,11 @@ class PlanBuilder {
PlanBuilder& partitionedOutputBroadcast(
const std::vector<std::string>& outputLayout = {});

/// Add a LocalPartitionNode to hash-partition the input on the specified
/// Adds a PartitionedOutputNode to put data into arbitrary buffer.
PlanBuilder& partitionedOutputArbitrary(
const std::vector<std::string>& outputLayout = {});

/// Adds a LocalPartitionNode to hash-partition the input on the specified
/// keys using exec::HashPartitionFunction. Number of partitions is determined
/// at runtime based on parallelism of the downstream pipeline.
///
Expand Down

0 comments on commit 94917a5

Please sign in to comment.