Github user zuyu commented on a diff in the pull request: https://github.com/apache/incubator-quickstep/pull/185#discussion_r100244520 --- Diff: query_optimizer/ExecutionGenerator.cpp --- @@ -1730,6 +1631,148 @@ void ExecutionGenerator::convertAggregate( } } +void ExecutionGenerator::convertCrossReferenceCoalesceAggregate( + const P::CrossReferenceCoalesceAggregatePtr &physical_plan) { + DCHECK_EQ(1u, physical_plan->left_join_attributes().size()); + DCHECK_EQ(1u, physical_plan->right_join_attributes().size()); + + const CatalogRelationInfo *left_relation_info = + findRelationInfoOutputByPhysical(physical_plan->left_child()); + const CatalogRelationInfo *right_relation_info = + findRelationInfoOutputByPhysical(physical_plan->right_child()); + + // Create aggr state proto. + const QueryContext::aggregation_state_id aggr_state_index = + query_context_proto_->aggregation_states_size(); + S::AggregationOperationState *aggr_state_proto = query_context_proto_->add_aggregation_states(); + + aggr_state_proto->set_relation_id(right_relation_info->relation->getID()); + + // Group by the right join attribute. + std::unique_ptr<const Scalar> execution_group_by_expression( + physical_plan->right_join_attributes().front()->concretize( + attribute_substitution_map_)); + aggr_state_proto->add_group_by_expressions()->CopyFrom( --- End diff -- Use `MergeFrom` to avoid zero-out. Similarly below.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---