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

    https://github.com/apache/incubator-quickstep/pull/282#discussion_r135634116
  
    --- Diff: utility/ExecutionDAGVisualizer.cpp ---
    @@ -57,39 +72,123 @@ ExecutionDAGVisualizer::ExecutionDAGVisualizer(const 
QueryPlan &plan) {
       std::vector<bool> display_ops(num_nodes_, false);
       for (std::size_t node_index = 0; node_index < num_nodes_; ++node_index) {
         const auto &node = dag.getNodePayload(node_index);
    -    const std::string relop_name = node.getName();
    -    if (no_display_op_names.find(relop_name) == no_display_op_names.end()) 
{
    -      display_ops[node_index] = true;
    -      NodeInfo &node_info = nodes_[node_index];
    -      node_info.id = node_index;
    -      node_info.labels.emplace_back(
    -          "[" + std::to_string(node.getOperatorIndex()) + "] " + 
relop_name);
    +    const RelationalOperator::OperatorType node_type = 
node.getOperatorType();
    +    if (no_display_op_types.find(node_type) != no_display_op_types.end()) {
    +      continue;
    +    }
    +
    +    display_ops[node_index] = true;
    +    NodeInfo &node_info = nodes_[node_index];
    +    node_info.id = node_index;
    +    node_info.labels.emplace_back(
    +        "[" + std::to_string(node_index) + "] " + node.getName());
     
    -      std::vector<std::pair<std::string, const CatalogRelationSchema*>> 
input_relations;
    -      if (relop_name == "AggregationOperator") {
    +    const CatalogRelationSchema *input_relation = nullptr;
    +    std::string input_relation_info;
    +    switch (node_type) {
    +      case RelationalOperator::kAggregation: {
             const AggregationOperator &aggregation_op =
                 static_cast<const AggregationOperator&>(node);
    -        input_relations.emplace_back("input", 
&aggregation_op.input_relation());
    -      } else if (relop_name == "BuildHashOperator") {
    +        input_relation = &aggregation_op.input_relation();
    +        input_relation_info = "input";
    +        break;
    +      }
    +      case RelationalOperator::kBuildHash: {
             const BuildHashOperator &build_hash_op =
                 static_cast<const BuildHashOperator&>(node);
    -        input_relations.emplace_back("input", 
&build_hash_op.input_relation());
    -      } else if (relop_name == "HashJoinOperator") {
    +        input_relation = &build_hash_op.input_relation();
    +        input_relation_info = "input";
    +        break;
    +      }
    +      case RelationalOperator::kBuildLIPFilter: {
    +        const BuildLIPFilterOperator &build_lip_filter_op =
    +            static_cast<const BuildLIPFilterOperator&>(node);
    +        input_relation = &build_lip_filter_op.input_relation();
    +        input_relation_info = "input";
    +        break;
    +      }
    +      case RelationalOperator::kInnerJoin:
    +      case RelationalOperator::kLeftAntiJoin:
    +      case RelationalOperator::kLeftOuterJoin:
    +      case RelationalOperator::kLeftSemiJoin: {
             const HashJoinOperator &hash_join_op =
                 static_cast<const HashJoinOperator&>(node);
    -        input_relations.emplace_back("probe side", 
&hash_join_op.probe_relation());
    -      } else if (relop_name == "SelectOperator") {
    +        input_relation = &hash_join_op.probe_relation();
    +        input_relation_info = "probe side";
    +        break;
    +      }
    +      case RelationalOperator::kNestedLoopsJoin: {
    +        const NestedLoopsJoinOperator &nlj_op =
    +            static_cast<const NestedLoopsJoinOperator&>(node);
    +
    +        const CatalogRelation &left_input_relation = 
nlj_op.left_input_relation();
    +        if (!left_input_relation.isTemporary()) {
    +          node_info.labels.emplace_back(
    +              "left input stored relation [" + 
left_input_relation.getName() + "]");
    +        }
    +
    +        const CatalogRelation &right_input_relation = 
nlj_op.right_input_relation();
    +        if (!right_input_relation.isTemporary()) {
    +          node_info.labels.emplace_back(
    +              "right input stored relation [" + 
right_input_relation.getName() + "]");
    +        }
    +        break;
    +      }
    +      case RelationalOperator::kSelect: {
             const SelectOperator &select_op =
                 static_cast<const SelectOperator&>(node);
    -        input_relations.emplace_back("input", &select_op.input_relation());
    +        input_relation = &select_op.input_relation();
    +        input_relation_info = "input";
    +        break;
           }
    -      for (const auto &rel_pair : input_relations) {
    -        if (!rel_pair.second->isTemporary()) {
    +      case RelationalOperator::kSortRunGeneration: {
    +        const SortRunGenerationOperator &sort_op =
    +            static_cast<const SortRunGenerationOperator&>(node);
    +        input_relation = &sort_op.input_relation();
    +        input_relation_info = "input";
    +        break;
    +      }
    +      case RelationalOperator::kUnionAll: {
    +        const UnionAllOperator &union_all_op = static_cast<const 
UnionAllOperator&>(node);
    +
    +        std::string input_stored_relation_names;
    +        std::size_t num_input_stored_relations = 0;
    +        for (const auto &input_relation : union_all_op.input_relations()) {
    +          if (!input_relation->isTemporary()) {
    --- End diff --
    
    Sorry, my minor bug.


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