Github user jianqiao commented on a diff in the pull request:

    https://github.com/apache/incubator-quickstep/pull/73#discussion_r73078969
  
    --- 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 --
    
    `input` should be already a `HashJoinPtr` here due to the outer `if` 
statement.
    
    In fact, `BottomUpRule` does not provide a place for initializing 
`cost_model_`. One solution is to add an `initialization()` virtual method in 
`class BottomUpRule`, and implement that method in `SwapProbeBuild`.


---
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.
---

Reply via email to