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

    https://github.com/apache/incubator-quickstep/pull/326#discussion_r154229622
  
    --- Diff: query_optimizer/rules/ReferencedBaseRelations.hpp ---
    @@ -0,0 +1,78 @@
    +/**
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + *   http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing,
    + * software distributed under the License is distributed on an
    + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    + * KIND, either express or implied.  See the License for the
    + * specific language governing permissions and limitations
    + * under the License.
    + **/
    +
    +#ifndef QUICKSTEP_QUERY_OPTIMIZER_RULES_REFERENCED_BASE_RELATIONS_HPP_
    +#define QUICKSTEP_QUERY_OPTIMIZER_RULES_REFERENCED_BASE_RELATIONS_HPP_
    +
    +#include <string>
    +#include <vector>
    +
    +#include "catalog/CatalogTypedefs.hpp"
    +#include "query_optimizer/logical/Logical.hpp"
    +#include "query_optimizer/rules/DFSTraversal.hpp"
    +#include "utility/Macros.hpp"
    +
    +namespace quickstep {
    +
    +class CatalogRelation;
    +
    +namespace optimizer {
    +
    +class OptimizerContext;
    +
    +class ReferencedBaseRelations : public DFSTraversal<logical::Logical> {
    + public:
    +  /**
    +   * @brief Constructor
    +   * @param optimizer_context The optimizer context.
    +   */
    +  explicit ReferencedBaseRelations(OptimizerContext *optimizer_context)
    +      : optimizer_context_(optimizer_context) {
    +  }
    +
    +  std::string getName() const override { return "ReferencedBaseRelations"; 
}
    +
    +  TreeNodePtr apply(const TreeNodePtr &tree) override;
    +
    +  /**
    +   * @brief Get the base relations referenced in a query.
    +   */
    +  const std::vector<const CatalogRelation *> getReferencedBaseRelations() 
const {
    --- End diff --
    
    Better remove the beginning `const`, as the method returns a temporary 
object.


---

Reply via email to