Github user hakanmemisoglu commented on a diff in the pull request: https://github.com/apache/incubator-quickstep/pull/73#discussion_r73118755 --- Diff: query_optimizer/rules/SwapProbeBuild.cpp --- @@ -0,0 +1,72 @@ +#include "query_optimizer/rules/SwapProbeBuild.hpp" + +#include <cstddef> +#include <vector> + +#include "query_optimizer/cost_model/StarSchemaSimpleCostModel.hpp" +#include "query_optimizer/expressions/AttributeReference.hpp" +#include "query_optimizer/physical/HashJoin.hpp" +#include "query_optimizer/physical/PatternMatcher.hpp" +#include "query_optimizer/physical/Physical.hpp" +#include "query_optimizer/physical/TopLevelPlan.hpp" +#include "query_optimizer/rules/Rule.hpp" + + +namespace quickstep { +namespace optimizer { + +P::PhysicalPtr SwapProbeBuild::applyToNode(const P::PhysicalPtr &input) { + P::HashJoinPtr hash_join; + + if (P::SomeHashJoin::MatchesWithConditionalCast(input, &hash_join)) { + P::PhysicalPtr left = hash_join->left(); + P::PhysicalPtr right = hash_join->right(); + + P::TopLevelPlanPtr top_level; + if (P::SomeTopLevelPlan::MatchesWithConditionalCast(input, &top_level)) { --- End diff -- @jianqiao , Thanks for the catch. > In fact, BottomUpRule does not provide a place for initializing cost_model_. It is the reason why, I have implemented initialization of cost model in "applyToNode". I will introduce init(const P::PhysicalPtr &top_level_plan) as you said.
--- 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. ---