Checks that specified plan node is a partial or intermediate aggregation or local exchange over the same. Returns a pointer to core::AggregationNode.
| 746 | /// Checks that specified plan node is a partial or intermediate aggregation or |
| 747 | /// local exchange over the same. Returns a pointer to core::AggregationNode. |
| 748 | const core::AggregationNode* findPartialAggregation( |
| 749 | const core::PlanNode* planNode) { |
| 750 | const core::AggregationNode* aggNode; |
| 751 | if (auto exchange = dynamic_cast<const core::LocalPartitionNode*>(planNode)) { |
| 752 | aggNode = dynamic_cast<const core::AggregationNode*>( |
| 753 | exchange->sources()[0].get()); |
| 754 | } else if (auto merge = dynamic_cast<const core::LocalMergeNode*>(planNode)) { |
| 755 | aggNode = |
| 756 | dynamic_cast<const core::AggregationNode*>(merge->sources()[0].get()); |
| 757 | } else { |
| 758 | aggNode = dynamic_cast<const core::AggregationNode*>(planNode); |
| 759 | } |
| 760 | BOLT_CHECK_NOT_NULL( |
| 761 | aggNode, |
| 762 | "Current plan node must be one of: partial or intermediate aggregation, " |
| 763 | "local merge or exchange. Got: {}", |
| 764 | planNode->toString()); |
| 765 | BOLT_CHECK(exec::isPartialOutput(aggNode->step())); |
| 766 | return aggNode; |
| 767 | } |
| 768 | } // namespace |
| 769 | |
| 770 | PlanBuilder& PlanBuilder::intermediateAggregation(const bool useGPU) { |
no test coverage detected