Skip to content

Commit

Permalink
[Native] Remove redundant plan conversion for TableWriteNode
Browse files Browse the repository at this point in the history
  • Loading branch information
kewang1024 committed Oct 24, 2023
1 parent fe56f79 commit 580f2e3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1684,7 +1684,7 @@ VeloxQueryPlanConverterBase::generateAggregationNode(
statisticsAggregation,
core::AggregationNode::Step step,
const protocol::PlanNodeId& id,
const std::shared_ptr<protocol::PlanNode>& source,
const core::PlanNodePtr& sourceVeloxPlan,
const std::shared_ptr<protocol::TableWriteInfo>& tableWriteInfo,
const protocol::TaskId& taskId) {
if (statisticsAggregation == nullptr) {
Expand Down Expand Up @@ -1713,7 +1713,7 @@ VeloxQueryPlanConverterBase::generateAggregationNode(
aggregateNames,
aggregates,
false, // ignoreNullKeys
toVeloxQueryPlan(source, tableWriteInfo, taskId));
sourceVeloxPlan);
}

std::vector<protocol::VariableReferenceExpression>
Expand Down Expand Up @@ -2275,12 +2275,14 @@ VeloxQueryPlanConverterBase::toVeloxQueryPlan(
node->fragmentVariable,
node->tableCommitContextVariable},
node->statisticsAggregation));
const auto sourceVeloxPlan =
toVeloxQueryPlan(node->source, tableWriteInfo, taskId);
std::shared_ptr<core::AggregationNode> aggregationNode =
generateAggregationNode(
node->statisticsAggregation,
core::AggregationNode::Step::kPartial,
node->id,
node->source,
sourceVeloxPlan,
tableWriteInfo,
taskId);
return std::make_shared<core::TableWriteNode>(
Expand All @@ -2292,7 +2294,7 @@ VeloxQueryPlanConverterBase::toVeloxQueryPlan(
node->partitioningScheme != nullptr,
outputType,
getCommitStrategy(),
toVeloxQueryPlan(node->source, tableWriteInfo, taskId));
sourceVeloxPlan);
}

std::shared_ptr<const core::TableWriteMergeNode>
Expand All @@ -2305,20 +2307,19 @@ VeloxQueryPlanConverterBase::toVeloxQueryPlan(
node->fragmentVariable,
node->tableCommitContextVariable},
node->statisticsAggregation));
const auto sourceVeloxPlan =
toVeloxQueryPlan(node->source, tableWriteInfo, taskId);
std::shared_ptr<core::AggregationNode> aggregationNode =
generateAggregationNode(
node->statisticsAggregation,
core::AggregationNode::Step::kIntermediate,
node->id,
node->source,
sourceVeloxPlan,
tableWriteInfo,
taskId);

return std::make_shared<core::TableWriteMergeNode>(
node->id,
outputType,
aggregationNode,
toVeloxQueryPlan(node->source, tableWriteInfo, taskId));
node->id, outputType, aggregationNode, sourceVeloxPlan);
}

std::shared_ptr<const core::UnnestNode>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ class VeloxQueryPlanConverterBase {
statisticsAggregation,
velox::core::AggregationNode::Step step,
const protocol::PlanNodeId& id,
const std::shared_ptr<protocol::PlanNode>& source,
const velox::core::PlanNodePtr& sourceVeloxPlan,
const std::shared_ptr<protocol::TableWriteInfo>& tableWriteInfo,
const protocol::TaskId& taskId);

Expand Down

0 comments on commit 580f2e3

Please sign in to comment.