diff --git a/velox/exec/tests/utils/PlanBuilder.cpp b/velox/exec/tests/utils/PlanBuilder.cpp index aacedfd75c2b..2b07f9b06213 100644 --- a/velox/exec/tests/utils/PlanBuilder.cpp +++ b/velox/exec/tests/utils/PlanBuilder.cpp @@ -988,6 +988,16 @@ PlanBuilder& PlanBuilder::partitionedOutputBroadcast( return *this; } +PlanBuilder& PlanBuilder::partitionedOutputArbitrary( + const std::vector& 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& keys, const std::vector& sources) { diff --git a/velox/exec/tests/utils/PlanBuilder.h b/velox/exec/tests/utils/PlanBuilder.h index adb7983b0999..076435e67501 100644 --- a/velox/exec/tests/utils/PlanBuilder.h +++ b/velox/exec/tests/utils/PlanBuilder.h @@ -560,7 +560,7 @@ class PlanBuilder { core::PartitionFunctionSpecPtr partitionFunctionSpec, const std::vector& 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, @@ -569,7 +569,11 @@ class PlanBuilder { PlanBuilder& partitionedOutputBroadcast( const std::vector& 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& 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. ///