Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions velox/core/PlanNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2895,7 +2895,8 @@ PartitionedOutputNode::PartitionedOutputNode(
PartitionFunctionSpecPtr partitionFunctionSpec,
RowTypePtr outputType,
VectorSerde::Kind serdeKind,
PlanNodePtr source)
PlanNodePtr source,
bool rootFragment)
: PlanNode(id),
kind_(kind),
sources_{{std::move(source)}},
Expand All @@ -2904,7 +2905,8 @@ PartitionedOutputNode::PartitionedOutputNode(
replicateNullsAndAny_(replicateNullsAndAny),
partitionFunctionSpec_(std::move(partitionFunctionSpec)),
serdeKind_(serdeKind),
outputType_(std::move(outputType)) {
outputType_(std::move(outputType)),
rootFragment_(rootFragment) {
VELOX_USER_CHECK_GT(numPartitions_, 0);
if (numPartitions_ == 1) {
VELOX_USER_CHECK(
Expand Down Expand Up @@ -2967,7 +2969,8 @@ std::shared_ptr<PartitionedOutputNode> PartitionedOutputNode::single(
const PlanNodeId& id,
RowTypePtr outputType,
VectorSerde::Kind serdeKind,
PlanNodePtr source) {
PlanNodePtr source,
bool rootFragment) {
std::vector<TypedExprPtr> noKeys;
return std::make_shared<PartitionedOutputNode>(
id,
Expand All @@ -2978,7 +2981,8 @@ std::shared_ptr<PartitionedOutputNode> PartitionedOutputNode::single(
std::make_shared<GatherPartitionFunctionSpec>(),
std::move(outputType),
serdeKind,
std::move(source));
std::move(source),
rootFragment);
}

void EnforceSingleRowNode::addDetails(std::stringstream& /* stream */) const {
Expand Down
11 changes: 9 additions & 2 deletions velox/core/PlanNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -2587,7 +2587,8 @@ class PartitionedOutputNode : public PlanNode {
PartitionFunctionSpecPtr partitionFunctionSpec,
RowTypePtr outputType,
VectorSerde::Kind serdeKind,
PlanNodePtr source);
PlanNodePtr source,
bool rootFragment = false);

static std::shared_ptr<PartitionedOutputNode> broadcast(
const PlanNodeId& id,
Expand All @@ -2606,7 +2607,8 @@ class PartitionedOutputNode : public PlanNode {
const PlanNodeId& id,
RowTypePtr outputType,
VectorSerde::Kind VectorSerde,
PlanNodePtr source);
PlanNodePtr source,
bool rootFragment = false);

class Builder {
public:
Expand Down Expand Up @@ -2721,6 +2723,10 @@ class PartitionedOutputNode : public PlanNode {
return outputType_;
}

const bool isRootFragment() const {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need to use const since the return is a scalar value here.
bool isRootFragment() const {
Similar to below
bool isPartitioned() const {

return rootFragment_;
}

const std::vector<PlanNodePtr>& sources() const override {
return sources_;
}
Expand Down Expand Up @@ -2796,6 +2802,7 @@ class PartitionedOutputNode : public PlanNode {
const PartitionFunctionSpecPtr partitionFunctionSpec_;
const VectorSerde::Kind serdeKind_;
const RowTypePtr outputType_;
const bool rootFragment_;
};

using PartitionedOutputNodePtr = std::shared_ptr<const PartitionedOutputNode>;
Expand Down
Loading