Github user zuyu commented on a diff in the pull request:
https://github.com/apache/incubator-quickstep/pull/322#discussion_r149791914
--- Diff: query_optimizer/ExecutionGenerator.cpp ---
@@ -1102,6 +1121,320 @@ void ExecutionGenerator::convertHashJoin(const
P::HashJoinPtr &physical_plan) {
}
}
+void ExecutionGenerator::convertGeneralizedHashJoin(const
P::GeneralizedHashJoinPtr &physical_plan) {
+ // HashJoin is converted to three operators:
+ // BuildHash, HashJoin, DestroyHash. The second is the primary
operator.
+
+ P::PhysicalPtr probe_physical = physical_plan->left();
+ P::PhysicalPtr build_physical = physical_plan->right();
+ P::PhysicalPtr second_build_physical = physical_plan->middle();
+
+ std::vector<attribute_id> probe_attribute_ids;
+ std::vector<attribute_id> build_attribute_ids;
+ std::vector<attribute_id> second_probe_attribute_ids;
+ std::vector<attribute_id> second_build_attribute_ids;
+
+ std::size_t build_cardinality =
+ cost_model_for_hash_join_->estimateCardinality(build_physical);
+
+ std::size_t second_build_cardinality =
+
cost_model_for_hash_join_->estimateCardinality(second_build_physical);
+
+ bool any_probe_attributes_nullable = false;
+ bool any_build_attributes_nullable = false;
+ bool any_second_probe_attributes_nullable = false;
+ bool any_second_build_attributes_nullable = false;
+
+ const std::vector<E::AttributeReferencePtr> &left_join_attributes =
+ physical_plan->left_join_attributes();
+ for (const E::AttributeReferencePtr &left_join_attribute :
left_join_attributes) {
--- End diff --
We could create functions in the anonymous namespace to set these values.
---