quickstep-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zu...@apache.org
Subject incubator-quickstep git commit: Code style fix.
Date Fri, 27 Apr 2018 04:23:50 GMT
Repository: incubator-quickstep
Updated Branches:
  refs/heads/master cc9ab901f -> 3c7a89c26


Code style fix.


Project: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/commit/3c7a89c2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/tree/3c7a89c2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/diff/3c7a89c2

Branch: refs/heads/master
Commit: 3c7a89c265506a7a90c3b75d4165f212cb0cc49a
Parents: cc9ab90
Author: Zuyu Zhang <zuyu@cs.wisc.edu>
Authored: Thu Apr 26 21:39:18 2018 -0500
Committer: Zuyu Zhang <zuyu@cs.wisc.edu>
Committed: Thu Apr 26 23:22:00 2018 -0500

----------------------------------------------------------------------
 query_optimizer/ExecutionGenerator.cpp          | 11 +++--
 .../expressions/AggregateFunction.hpp           |  2 +-
 query_optimizer/expressions/Alias.cpp           |  2 +-
 query_optimizer/expressions/Alias.hpp           |  4 +-
 .../expressions/AttributeReference.hpp          | 10 ++---
 .../expressions/BinaryExpression.hpp            |  4 +-
 query_optimizer/expressions/Cast.hpp            |  2 +-
 .../expressions/ComparisonExpression.hpp        |  4 +-
 query_optimizer/expressions/Exists.hpp          |  2 +-
 query_optimizer/expressions/ExpressionUtil.cpp  |  8 ++--
 query_optimizer/expressions/ExpressionUtil.hpp  |  2 +
 query_optimizer/expressions/InTableQuery.hpp    |  4 +-
 query_optimizer/expressions/InValueList.hpp     |  4 +-
 query_optimizer/expressions/LogicalAnd.cpp      |  1 +
 query_optimizer/expressions/LogicalAnd.hpp      |  1 +
 query_optimizer/expressions/LogicalNot.hpp      |  2 +-
 query_optimizer/expressions/LogicalOr.cpp       |  1 +
 query_optimizer/expressions/LogicalOr.hpp       |  1 +
 query_optimizer/expressions/NamedExpression.hpp |  8 ++--
 .../expressions/PredicateLiteral.hpp            |  2 +-
 query_optimizer/expressions/ScalarLiteral.hpp   |  1 +
 query_optimizer/expressions/SearchedCase.hpp    |  6 +--
 query_optimizer/expressions/SimpleCase.hpp      |  8 ++--
 .../expressions/SubqueryExpression.hpp          |  2 +-
 query_optimizer/expressions/UnaryExpression.hpp |  2 +-
 .../expressions/WindowAggregateFunction.hpp     |  2 +-
 query_optimizer/logical/Aggregate.hpp           | 10 ++---
 query_optimizer/logical/BinaryJoin.hpp          |  4 +-
 query_optimizer/logical/DeleteTuples.hpp        |  4 +-
 query_optimizer/logical/HashJoin.hpp            |  6 +--
 query_optimizer/logical/InsertSelection.hpp     |  4 +-
 query_optimizer/logical/InsertTuple.hpp         |  4 +-
 .../logical/MultiwayCartesianJoin.hpp           |  3 +-
 query_optimizer/logical/NestedLoopsJoin.hpp     |  2 +-
 query_optimizer/logical/Project.hpp             |  4 +-
 query_optimizer/logical/Sample.hpp              |  2 +-
 .../logical/SharedSubplanReference.hpp          | 10 ++---
 query_optimizer/logical/Sort.hpp                | 10 ++---
 query_optimizer/logical/TableGenerator.hpp      | 46 ++++++++++----------
 query_optimizer/logical/TableReference.cpp      |  1 +
 query_optimizer/logical/TableReference.hpp      |  2 +-
 query_optimizer/logical/TopLevelPlan.hpp        |  6 +--
 query_optimizer/logical/UpdateTable.hpp         |  8 ++--
 query_optimizer/physical/BinaryJoin.hpp         |  4 +-
 .../CrossReferenceCoalesceAggregate.hpp         | 18 ++++----
 query_optimizer/physical/DeleteTuples.hpp       |  4 +-
 query_optimizer/physical/HashJoin.hpp           | 10 ++---
 query_optimizer/physical/InsertSelection.hpp    |  4 +-
 query_optimizer/physical/InsertTuple.hpp        |  4 +-
 query_optimizer/physical/Join.hpp               |  4 +-
 query_optimizer/physical/NestedLoopsJoin.hpp    |  2 +-
 .../physical/SharedSubplanReference.hpp         | 10 ++---
 query_optimizer/physical/Sort.hpp               | 12 ++---
 query_optimizer/physical/TableGenerator.hpp     |  6 +--
 query_optimizer/physical/TopLevelPlan.hpp       |  8 ++--
 query_optimizer/physical/UpdateTable.hpp        |  8 ++--
 56 files changed, 164 insertions(+), 152 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/3c7a89c2/query_optimizer/ExecutionGenerator.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/ExecutionGenerator.cpp b/query_optimizer/ExecutionGenerator.cpp
index 8dd93d0..f8f7c9d 100644
--- a/query_optimizer/ExecutionGenerator.cpp
+++ b/query_optimizer/ExecutionGenerator.cpp
@@ -687,7 +687,7 @@ bool ExecutionGenerator::convertSimpleProjection(
 
 void ExecutionGenerator::convertSelection(
     const P::SelectionPtr &physical_selection) {
-  const P::PhysicalPtr input = physical_selection->input();
+  const P::PhysicalPtr &input = physical_selection->input();
   const CatalogRelationInfo *input_relation_info =
       findRelationInfoOutputByPhysical(input);
   DCHECK(input_relation_info != nullptr);
@@ -829,7 +829,7 @@ void ExecutionGenerator::convertSharedSubplanReference(const physical::SharedSub
 }
 
 void ExecutionGenerator::convertFilterJoin(const P::FilterJoinPtr &physical_plan) {
-  P::PhysicalPtr probe_physical = physical_plan->left();
+  const P::PhysicalPtr &probe_physical = physical_plan->left();
   P::PhysicalPtr build_physical = physical_plan->right();
 
   // Let B denote the build side child. If B is also a FilterJoin, then the
@@ -891,13 +891,13 @@ void ExecutionGenerator::convertHashJoin(const P::HashJoinPtr &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();
+  const P::PhysicalPtr &probe_physical = physical_plan->left();
+  const P::PhysicalPtr &build_physical = physical_plan->right();
 
   std::vector<attribute_id> probe_attribute_ids;
   std::vector<attribute_id> build_attribute_ids;
 
-  std::size_t build_cardinality =
+  const std::size_t build_cardinality =
       cost_model_for_hash_join_->estimateCardinality(build_physical);
 
   bool any_probe_attributes_nullable = false;
@@ -1487,7 +1487,6 @@ void ExecutionGenerator::convertInsertTuple(
       *catalog_database_->getRelationById(
           input_relation_info->relation->getID());
 
-
   // Construct the tuple proto to be inserted.
   std::vector<QueryContext::tuple_id> tuple_indexes;
 

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/3c7a89c2/query_optimizer/expressions/AggregateFunction.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/AggregateFunction.hpp b/query_optimizer/expressions/AggregateFunction.hpp
index 108c661..22c7adb 100644
--- a/query_optimizer/expressions/AggregateFunction.hpp
+++ b/query_optimizer/expressions/AggregateFunction.hpp
@@ -164,7 +164,7 @@ class AggregateFunction : public Expression {
   }
 
   const ::quickstep::AggregateFunction &aggregate_;
-  std::vector<ScalarPtr> arguments_;
+  const std::vector<ScalarPtr> arguments_;
   const bool is_vector_aggregate_;
   const bool is_distinct_;
 

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/3c7a89c2/query_optimizer/expressions/Alias.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/Alias.cpp b/query_optimizer/expressions/Alias.cpp
index 30dade7..f2b2795 100644
--- a/query_optimizer/expressions/Alias.cpp
+++ b/query_optimizer/expressions/Alias.cpp
@@ -38,7 +38,7 @@ class Scalar;
 namespace optimizer {
 namespace expressions {
 
-Alias::Alias(attribute_id id,
+Alias::Alias(const attribute_id id,
              const ExpressionPtr &expression,
              const std::string &attribute_name,
              const std::string &attribute_alias,

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/3c7a89c2/query_optimizer/expressions/Alias.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/Alias.hpp b/query_optimizer/expressions/Alias.hpp
index e07f9fe..e0ee959 100644
--- a/query_optimizer/expressions/Alias.hpp
+++ b/query_optimizer/expressions/Alias.hpp
@@ -97,7 +97,7 @@ class Alias : public NamedExpression {
    * @param relation_name The name of the source relation.
    * @return An immutable Alias.
    */
-  static AliasPtr Create(ExprId id,
+  static AliasPtr Create(const ExprId id,
                          const ExpressionPtr &expression,
                          const std::string &attribute_name,
                          const std::string &attribute_alias,
@@ -119,7 +119,7 @@ class Alias : public NamedExpression {
       std::vector<std::vector<OptimizerTreeBaseNodePtr>> *container_child_fields) const override;
 
  private:
-  Alias(ExprId id,
+  Alias(const ExprId id,
         const ExpressionPtr &expression,
         const std::string &attribute_name,
         const std::string &attribute_alais,

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/3c7a89c2/query_optimizer/expressions/AttributeReference.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/AttributeReference.hpp b/query_optimizer/expressions/AttributeReference.hpp
index 5ace894..ca796ba 100644
--- a/query_optimizer/expressions/AttributeReference.hpp
+++ b/query_optimizer/expressions/AttributeReference.hpp
@@ -95,7 +95,7 @@ class AttributeReference : public NamedExpression {
   /**
    * @brief Creates an immutable AttributReference.
    *
-   * @param attribute_id The ExprId of the expression this AttributeReference
+   * @param attr_id The ExprId of the expression this AttributeReference
    *                     references to.
    * @param attribute_name The attribute name. This is only for printing purpose.
    * @param attribute_alias The attribute alias (or display name). This is only
@@ -107,14 +107,14 @@ class AttributeReference : public NamedExpression {
    * @param scope The scope of the referenced attribute.
    * @return An immutable AttributeReference.
    */
-  static AttributeReferencePtr Create(ExprId attribute_id,
+  static AttributeReferencePtr Create(const ExprId attr_id,
                                       const std::string &attribute_name,
                                       const std::string &attribute_alias,
                                       const std::string &relation_name,
                                       const Type &type,
                                       const AttributeReferenceScope scope) {
     return AttributeReferencePtr(new AttributeReference(
-        attribute_id, attribute_name, attribute_alias, relation_name, type, scope));
+        attr_id, attribute_name, attribute_alias, relation_name, type, scope));
   }
 
  protected:
@@ -129,13 +129,13 @@ class AttributeReference : public NamedExpression {
      std::vector<std::vector<OptimizerTreeBaseNodePtr>> *container_child_fields) const override;
 
  private:
-  AttributeReference(attribute_id attribute_id,
+  AttributeReference(const ExprId attr_id,
                      const std::string &attribute_name,
                      const std::string &attribute_alias,
                      const std::string &relation_name,
                      const Type &type,
                      const AttributeReferenceScope scope)
-      : NamedExpression(attribute_id,
+      : NamedExpression(attr_id,
                         attribute_name,
                         attribute_alias,
                         relation_name),

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/3c7a89c2/query_optimizer/expressions/BinaryExpression.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/BinaryExpression.hpp b/query_optimizer/expressions/BinaryExpression.hpp
index 6a37679..df7454c 100644
--- a/query_optimizer/expressions/BinaryExpression.hpp
+++ b/query_optimizer/expressions/BinaryExpression.hpp
@@ -116,8 +116,8 @@ class BinaryExpression : public Scalar {
 
   const BinaryOperation &operation_;
 
-  ScalarPtr left_;
-  ScalarPtr right_;
+  const ScalarPtr left_;
+  const ScalarPtr right_;
 
   DISALLOW_COPY_AND_ASSIGN(BinaryExpression);
 };

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/3c7a89c2/query_optimizer/expressions/Cast.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/Cast.hpp b/query_optimizer/expressions/Cast.hpp
index 11be775..fa40242 100644
--- a/query_optimizer/expressions/Cast.hpp
+++ b/query_optimizer/expressions/Cast.hpp
@@ -110,7 +110,7 @@ class Cast : public Scalar {
     DCHECK(target_type.isCoercibleFrom(operand->getValueType()));
   }
 
-  ScalarPtr operand_;
+  const ScalarPtr operand_;
   const Type &target_type_;
 
   DISALLOW_COPY_AND_ASSIGN(Cast);

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/3c7a89c2/query_optimizer/expressions/ComparisonExpression.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/ComparisonExpression.hpp b/query_optimizer/expressions/ComparisonExpression.hpp
index 011e04e..f119f71 100644
--- a/query_optimizer/expressions/ComparisonExpression.hpp
+++ b/query_optimizer/expressions/ComparisonExpression.hpp
@@ -121,8 +121,8 @@ class ComparisonExpression : public Predicate {
                        const ScalarPtr &right);
 
   const Comparison &comparison_;
-  ScalarPtr left_;
-  ScalarPtr right_;
+  const ScalarPtr left_;
+  const ScalarPtr right_;
 
   DISALLOW_COPY_AND_ASSIGN(ComparisonExpression);
 };

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/3c7a89c2/query_optimizer/expressions/Exists.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/Exists.hpp b/query_optimizer/expressions/Exists.hpp
index 0b75de5..e90348e 100644
--- a/query_optimizer/expressions/Exists.hpp
+++ b/query_optimizer/expressions/Exists.hpp
@@ -113,7 +113,7 @@ class Exists : public Predicate {
     addChild(exists_subquery_);
   }
 
-  SubqueryExpressionPtr exists_subquery_;
+  const SubqueryExpressionPtr exists_subquery_;
 
   DISALLOW_COPY_AND_ASSIGN(Exists);
 };

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/3c7a89c2/query_optimizer/expressions/ExpressionUtil.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/ExpressionUtil.cpp b/query_optimizer/expressions/ExpressionUtil.cpp
index c9541ef..a9f1a0d 100644
--- a/query_optimizer/expressions/ExpressionUtil.cpp
+++ b/query_optimizer/expressions/ExpressionUtil.cpp
@@ -40,8 +40,11 @@ AttributeReferencePtr ToRef(const NamedExpressionPtr &expression) {
 std::vector<AttributeReferencePtr> GetNullableAttributeVector(
     const std::vector<AttributeReferencePtr> &attributes) {
   std::vector<AttributeReferencePtr> nullable_attributes;
+  nullable_attributes.reserve(attributes.size());
   for (const auto &attr : attributes) {
-    if (!attr->getValueType().isNullable()) {
+    if (attr->getValueType().isNullable()) {
+      nullable_attributes.emplace_back(attr);
+    } else {
       nullable_attributes.emplace_back(
           AttributeReference::Create(attr->id(),
                                      attr->attribute_name(),
@@ -49,8 +52,6 @@ std::vector<AttributeReferencePtr> GetNullableAttributeVector(
                                      attr->relation_name(),
                                      attr->getValueType().getNullableVersion(),
                                      attr->scope()));
-    } else {
-      nullable_attributes.emplace_back(attr);
     }
   }
   return nullable_attributes;
@@ -60,6 +61,7 @@ std::vector<AttributeReferencePtr> GetAttributeReferencesWithinScope(
     const std::vector<AttributeReferencePtr> &attributes,
     const AttributeReferenceScope scope) {
   std::vector<AttributeReferencePtr> filtered_attributes;
+  filtered_attributes.reserve(attributes.size());
   for (const auto &attr_it : attributes) {
     if (attr_it->scope() == scope) {
       filtered_attributes.emplace_back(attr_it);

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/3c7a89c2/query_optimizer/expressions/ExpressionUtil.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/ExpressionUtil.hpp b/query_optimizer/expressions/ExpressionUtil.hpp
index 29d90f0..576d3a2 100644
--- a/query_optimizer/expressions/ExpressionUtil.hpp
+++ b/query_optimizer/expressions/ExpressionUtil.hpp
@@ -207,6 +207,7 @@ template <class NamedExpressionType>
 std::vector<AttributeReferencePtr> ToRefVector(
     const std::vector<std::shared_ptr<const NamedExpressionType>> &expressions) {
   std::vector<AttributeReferencePtr> cast_expressions;
+  cast_expressions.reserve(expressions.size());
   for (const std::shared_ptr<const NamedExpressionType> &expression :
        expressions) {
     cast_expressions.push_back(ToRef(expression));
@@ -225,6 +226,7 @@ template <class ExpressionType>
 std::vector<NamedExpressionPtr> ToNamedExpressions(
     const std::vector<std::shared_ptr<const ExpressionType>> &expressions) {
   std::vector<NamedExpressionPtr> cast_expressions;
+  cast_expressions.reserve(expressions.size());
   for (const std::shared_ptr<const ExpressionType> &expression : expressions) {
     NamedExpressionPtr cast_expression;
     CHECK(SomeNamedExpression::MatchesWithConditionalCast(expression, &cast_expression))

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/3c7a89c2/query_optimizer/expressions/InTableQuery.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/InTableQuery.hpp b/query_optimizer/expressions/InTableQuery.hpp
index 8e6d0e7..245ff0d 100644
--- a/query_optimizer/expressions/InTableQuery.hpp
+++ b/query_optimizer/expressions/InTableQuery.hpp
@@ -130,8 +130,8 @@ class InTableQuery : public Predicate {
     addChild(table_query_);
   }
 
-  ScalarPtr test_expression_;
-  SubqueryExpressionPtr table_query_;
+  const ScalarPtr test_expression_;
+  const SubqueryExpressionPtr table_query_;
 
   DISALLOW_COPY_AND_ASSIGN(InTableQuery);
 };

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/3c7a89c2/query_optimizer/expressions/InValueList.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/InValueList.hpp b/query_optimizer/expressions/InValueList.hpp
index 0ef3bba..e0f1f57 100644
--- a/query_optimizer/expressions/InValueList.hpp
+++ b/query_optimizer/expressions/InValueList.hpp
@@ -144,8 +144,8 @@ class InValueList : public Predicate {
     }
   }
 
-  ScalarPtr test_expression_;
-  std::vector<ScalarPtr> match_expressions_;
+  const ScalarPtr test_expression_;
+  const std::vector<ScalarPtr> match_expressions_;
 
   DISALLOW_COPY_AND_ASSIGN(InValueList);
 };

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/3c7a89c2/query_optimizer/expressions/LogicalAnd.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/LogicalAnd.cpp b/query_optimizer/expressions/LogicalAnd.cpp
index 1497874..a3908bd 100644
--- a/query_optimizer/expressions/LogicalAnd.cpp
+++ b/query_optimizer/expressions/LogicalAnd.cpp
@@ -42,6 +42,7 @@ namespace expressions {
 
 LogicalAnd::LogicalAnd(const std::vector<PredicatePtr> &operands) {
   // Flatten the predicate tree.
+  operands_.reserve(operands.size());
   for (const PredicatePtr &operand : operands) {
     LogicalAndPtr logical_and;
     PredicateLiteralPtr literal;

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/3c7a89c2/query_optimizer/expressions/LogicalAnd.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/LogicalAnd.hpp b/query_optimizer/expressions/LogicalAnd.hpp
index 8152728..8785fc8 100644
--- a/query_optimizer/expressions/LogicalAnd.hpp
+++ b/query_optimizer/expressions/LogicalAnd.hpp
@@ -116,6 +116,7 @@ class LogicalAnd : public Predicate {
   explicit LogicalAnd(const std::vector<PredicatePtr> &operands);
 
   std::vector<PredicatePtr> operands_;
+
   DISALLOW_COPY_AND_ASSIGN(LogicalAnd);
 };
 

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/3c7a89c2/query_optimizer/expressions/LogicalNot.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/LogicalNot.hpp b/query_optimizer/expressions/LogicalNot.hpp
index 90a98cd..7c4e660 100644
--- a/query_optimizer/expressions/LogicalNot.hpp
+++ b/query_optimizer/expressions/LogicalNot.hpp
@@ -100,7 +100,7 @@ class LogicalNot : public Predicate {
     addChild(operand_);
   }
 
-  PredicatePtr operand_;
+  const PredicatePtr operand_;
 
   DISALLOW_COPY_AND_ASSIGN(LogicalNot);
 };

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/3c7a89c2/query_optimizer/expressions/LogicalOr.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/LogicalOr.cpp b/query_optimizer/expressions/LogicalOr.cpp
index 3ae3e5d..c89fd5a 100644
--- a/query_optimizer/expressions/LogicalOr.cpp
+++ b/query_optimizer/expressions/LogicalOr.cpp
@@ -40,6 +40,7 @@ namespace expressions {
 
 LogicalOr::LogicalOr(const std::vector<PredicatePtr> &operands) {
   // Flatten the predicate tree.
+  operands_.reserve(operands.size());
   for (const PredicatePtr &operand : operands) {
     LogicalOrPtr logical_or;
     PredicateLiteralPtr literal;

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/3c7a89c2/query_optimizer/expressions/LogicalOr.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/LogicalOr.hpp b/query_optimizer/expressions/LogicalOr.hpp
index f96b6cd..2e40c56 100644
--- a/query_optimizer/expressions/LogicalOr.hpp
+++ b/query_optimizer/expressions/LogicalOr.hpp
@@ -116,6 +116,7 @@ class LogicalOr : public Predicate {
   explicit LogicalOr(const std::vector<PredicatePtr> &operands);
 
   std::vector<PredicatePtr> operands_;
+
   DISALLOW_COPY_AND_ASSIGN(LogicalOr);
 };
 

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/3c7a89c2/query_optimizer/expressions/NamedExpression.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/NamedExpression.hpp b/query_optimizer/expressions/NamedExpression.hpp
index 6725567..58fc713 100644
--- a/query_optimizer/expressions/NamedExpression.hpp
+++ b/query_optimizer/expressions/NamedExpression.hpp
@@ -101,10 +101,10 @@ class NamedExpression : public Scalar {
       std::vector<std::vector<OptimizerTreeBaseNodePtr>> *container_child_fields) const override;
 
  private:
-  ExprId id_;
-  std::string attribute_name_;
-  std::string attribute_alias_;
-  std::string relation_name_;
+  const ExprId id_;
+  const std::string attribute_name_;
+  const std::string attribute_alias_;
+  const std::string relation_name_;
 
   DISALLOW_COPY_AND_ASSIGN(NamedExpression);
 };

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/3c7a89c2/query_optimizer/expressions/PredicateLiteral.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/PredicateLiteral.hpp b/query_optimizer/expressions/PredicateLiteral.hpp
index 234b6e1..f354a83 100644
--- a/query_optimizer/expressions/PredicateLiteral.hpp
+++ b/query_optimizer/expressions/PredicateLiteral.hpp
@@ -94,7 +94,7 @@ class PredicateLiteral : public Predicate {
  private:
   explicit PredicateLiteral(bool is_true) : is_true_(is_true) {}
 
-  bool is_true_;
+  const bool is_true_;
 
   DISALLOW_COPY_AND_ASSIGN(PredicateLiteral);
 };

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/3c7a89c2/query_optimizer/expressions/ScalarLiteral.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/ScalarLiteral.hpp b/query_optimizer/expressions/ScalarLiteral.hpp
index bff52bb..7fab1d0 100644
--- a/query_optimizer/expressions/ScalarLiteral.hpp
+++ b/query_optimizer/expressions/ScalarLiteral.hpp
@@ -113,6 +113,7 @@ class ScalarLiteral : public Scalar {
 
   const TypedValue value_;
   const Type &value_type_;
+
   DISALLOW_COPY_AND_ASSIGN(ScalarLiteral);
 };
 

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/3c7a89c2/query_optimizer/expressions/SearchedCase.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/SearchedCase.hpp b/query_optimizer/expressions/SearchedCase.hpp
index 79c37a5..3466396 100644
--- a/query_optimizer/expressions/SearchedCase.hpp
+++ b/query_optimizer/expressions/SearchedCase.hpp
@@ -152,11 +152,11 @@ class SearchedCase : public Scalar {
     }
   }
 
-  std::vector<PredicatePtr> condition_predicates_;
-  std::vector<ScalarPtr> conditional_result_expressions_;
+  const std::vector<PredicatePtr> condition_predicates_;
+  const std::vector<ScalarPtr> conditional_result_expressions_;
 
   // May be NULL.
-  ScalarPtr else_result_expression_;
+  const ScalarPtr else_result_expression_;
 
   const Type &value_type_;
 

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/3c7a89c2/query_optimizer/expressions/SimpleCase.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/SimpleCase.hpp b/query_optimizer/expressions/SimpleCase.hpp
index 0820fa3..b42c034 100644
--- a/query_optimizer/expressions/SimpleCase.hpp
+++ b/query_optimizer/expressions/SimpleCase.hpp
@@ -171,12 +171,12 @@ class SimpleCase : public Scalar {
     }
   }
 
-  ScalarPtr case_operand_;
-  std::vector<ScalarPtr> condition_operands_;
-  std::vector<ScalarPtr> conditional_result_expressions_;
+  const ScalarPtr case_operand_;
+  const std::vector<ScalarPtr> condition_operands_;
+  const std::vector<ScalarPtr> conditional_result_expressions_;
 
   // May be NULL.
-  ScalarPtr else_result_expression_;
+  const ScalarPtr else_result_expression_;
 
   const Type &value_type_;
 

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/3c7a89c2/query_optimizer/expressions/SubqueryExpression.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/SubqueryExpression.hpp b/query_optimizer/expressions/SubqueryExpression.hpp
index a128e7f..184bc8c 100644
--- a/query_optimizer/expressions/SubqueryExpression.hpp
+++ b/query_optimizer/expressions/SubqueryExpression.hpp
@@ -116,7 +116,7 @@ class SubqueryExpression : public Scalar {
     DCHECK(!subquery->getOutputAttributes().empty());
   }
 
-  logical::LogicalPtr subquery_;
+  const logical::LogicalPtr subquery_;
   // Set to the first output attribute if the subquery is a multi-column table query.
   const AttributeReferencePtr output_attribute_;
 

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/3c7a89c2/query_optimizer/expressions/UnaryExpression.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/UnaryExpression.hpp b/query_optimizer/expressions/UnaryExpression.hpp
index 14201ff..9b99377 100644
--- a/query_optimizer/expressions/UnaryExpression.hpp
+++ b/query_optimizer/expressions/UnaryExpression.hpp
@@ -121,7 +121,7 @@ class UnaryExpression : public Scalar {
   }
 
   const UnaryOperation &operation_;
-  ScalarPtr operand_;
+  const ScalarPtr operand_;
 
   DISALLOW_COPY_AND_ASSIGN(UnaryExpression);
 };

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/3c7a89c2/query_optimizer/expressions/WindowAggregateFunction.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/WindowAggregateFunction.hpp b/query_optimizer/expressions/WindowAggregateFunction.hpp
index 04b4b51..e4a8154 100644
--- a/query_optimizer/expressions/WindowAggregateFunction.hpp
+++ b/query_optimizer/expressions/WindowAggregateFunction.hpp
@@ -229,7 +229,7 @@ class WindowAggregateFunction : public Expression {
   // AggregationFunction, a new class for WindowAggregationFunction should be
   // created as quickstep::WindowAggregateFunction.
   const ::quickstep::WindowAggregateFunction &window_aggregate_;
-  std::vector<ScalarPtr> arguments_;
+  const std::vector<ScalarPtr> arguments_;
   const WindowInfo window_info_;
   const std::string window_name_;
   const bool is_distinct_;

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/3c7a89c2/query_optimizer/logical/Aggregate.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/logical/Aggregate.hpp b/query_optimizer/logical/Aggregate.hpp
index d8c02ba..0100b2c 100644
--- a/query_optimizer/logical/Aggregate.hpp
+++ b/query_optimizer/logical/Aggregate.hpp
@@ -92,7 +92,7 @@ class Aggregate : public Logical {
    * @return An immutable Aggregate node.
    */
   static AggregatePtr Create(
-      LogicalPtr input,
+      const LogicalPtr &input,
       const std::vector<expressions::NamedExpressionPtr> &grouping_expressions,
       const std::vector<expressions::AliasPtr> &aggregate_expressions) {
     return AggregatePtr(
@@ -109,7 +109,7 @@ class Aggregate : public Logical {
       std::vector<std::vector<OptimizerTreeBaseNodePtr>> *container_child_fields) const override;
 
  private:
-  Aggregate(LogicalPtr input,
+  Aggregate(const LogicalPtr &input,
             const std::vector<expressions::NamedExpressionPtr> &grouping_expressions,
             const std::vector<expressions::AliasPtr> &aggregate_expressions)
       : input_(input),
@@ -120,9 +120,9 @@ class Aggregate : public Logical {
     addInputExpressions(aggregate_expressions_);
   }
 
-  LogicalPtr input_;
-  std::vector<expressions::NamedExpressionPtr> grouping_expressions_;
-  std::vector<expressions::AliasPtr> aggregate_expressions_;
+  const LogicalPtr input_;
+  const std::vector<expressions::NamedExpressionPtr> grouping_expressions_;
+  const std::vector<expressions::AliasPtr> aggregate_expressions_;
 
   DISALLOW_COPY_AND_ASSIGN(Aggregate);
 };

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/3c7a89c2/query_optimizer/logical/BinaryJoin.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/logical/BinaryJoin.hpp b/query_optimizer/logical/BinaryJoin.hpp
index ca68ced..2945899 100644
--- a/query_optimizer/logical/BinaryJoin.hpp
+++ b/query_optimizer/logical/BinaryJoin.hpp
@@ -89,8 +89,8 @@ class BinaryJoin : public Join {
       std::vector<std::vector<OptimizerTreeBaseNodePtr>> *container_child_fields) const override;
 
  private:
-  LogicalPtr left_;
-  LogicalPtr right_;
+  const LogicalPtr left_;
+  const LogicalPtr right_;
 
   DISALLOW_COPY_AND_ASSIGN(BinaryJoin);
 };

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/3c7a89c2/query_optimizer/logical/DeleteTuples.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/logical/DeleteTuples.hpp b/query_optimizer/logical/DeleteTuples.hpp
index 8ecd82f..219913b 100644
--- a/query_optimizer/logical/DeleteTuples.hpp
+++ b/query_optimizer/logical/DeleteTuples.hpp
@@ -111,8 +111,8 @@ class DeleteTuples : public Logical {
     addChild(input_);
   }
 
-  LogicalPtr input_;
-  expressions::PredicatePtr predicate_;
+  const LogicalPtr input_;
+  const expressions::PredicatePtr predicate_;
 
   DISALLOW_COPY_AND_ASSIGN(DeleteTuples);
 };

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/3c7a89c2/query_optimizer/logical/HashJoin.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/logical/HashJoin.hpp b/query_optimizer/logical/HashJoin.hpp
index b0e63e7..3676637 100644
--- a/query_optimizer/logical/HashJoin.hpp
+++ b/query_optimizer/logical/HashJoin.hpp
@@ -228,9 +228,9 @@ class HashJoin : public BinaryJoin {
     }
   }
 
-  std::vector<expressions::AttributeReferencePtr> left_join_attributes_;
-  std::vector<expressions::AttributeReferencePtr> right_join_attributes_;
-  expressions::PredicatePtr residual_predicate_;
+  const std::vector<expressions::AttributeReferencePtr> left_join_attributes_;
+  const std::vector<expressions::AttributeReferencePtr> right_join_attributes_;
+  const expressions::PredicatePtr residual_predicate_;
   const JoinType join_type_;
 
   DISALLOW_COPY_AND_ASSIGN(HashJoin);

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/3c7a89c2/query_optimizer/logical/InsertSelection.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/logical/InsertSelection.hpp b/query_optimizer/logical/InsertSelection.hpp
index 9cdbb1c..0c0a6d6 100644
--- a/query_optimizer/logical/InsertSelection.hpp
+++ b/query_optimizer/logical/InsertSelection.hpp
@@ -107,8 +107,8 @@ class InsertSelection : public Logical {
     addChild(selection);
   }
 
-  LogicalPtr destination_;
-  LogicalPtr selection_;
+  const LogicalPtr destination_;
+  const LogicalPtr selection_;
 
   DISALLOW_COPY_AND_ASSIGN(InsertSelection);
 };

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/3c7a89c2/query_optimizer/logical/InsertTuple.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/logical/InsertTuple.hpp b/query_optimizer/logical/InsertTuple.hpp
index dd35510..bd4b34d 100644
--- a/query_optimizer/logical/InsertTuple.hpp
+++ b/query_optimizer/logical/InsertTuple.hpp
@@ -108,8 +108,8 @@ class InsertTuple : public Logical {
     addChild(input_);
   }
 
-  LogicalPtr input_;
-  std::vector<std::vector<expressions::ScalarLiteralPtr>> column_values_;
+  const LogicalPtr input_;
+  const std::vector<std::vector<expressions::ScalarLiteralPtr>> column_values_;
 
   DISALLOW_COPY_AND_ASSIGN(InsertTuple);
 };

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/3c7a89c2/query_optimizer/logical/MultiwayCartesianJoin.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/logical/MultiwayCartesianJoin.hpp b/query_optimizer/logical/MultiwayCartesianJoin.hpp
index 6f9121d..99570da 100644
--- a/query_optimizer/logical/MultiwayCartesianJoin.hpp
+++ b/query_optimizer/logical/MultiwayCartesianJoin.hpp
@@ -99,7 +99,8 @@ class MultiwayCartesianJoin : public Join {
       addChild(operand);
     }
   }
-  std::vector<LogicalPtr> operands_;
+
+  const std::vector<LogicalPtr> operands_;
 
   DISALLOW_COPY_AND_ASSIGN(MultiwayCartesianJoin);
 };

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/3c7a89c2/query_optimizer/logical/NestedLoopsJoin.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/logical/NestedLoopsJoin.hpp b/query_optimizer/logical/NestedLoopsJoin.hpp
index 5950e1d..1824a1f 100644
--- a/query_optimizer/logical/NestedLoopsJoin.hpp
+++ b/query_optimizer/logical/NestedLoopsJoin.hpp
@@ -140,7 +140,7 @@ class NestedLoopsJoin : public BinaryJoin {
     addInputExpression(join_predicate);
   }
 
-  expressions::PredicatePtr join_predicate_;
+  const expressions::PredicatePtr join_predicate_;
 
   DISALLOW_COPY_AND_ASSIGN(NestedLoopsJoin);
 };

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/3c7a89c2/query_optimizer/logical/Project.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/logical/Project.hpp b/query_optimizer/logical/Project.hpp
index 83b352c..0dd6532 100644
--- a/query_optimizer/logical/Project.hpp
+++ b/query_optimizer/logical/Project.hpp
@@ -107,8 +107,8 @@ class Project : public Logical {
     addInputExpressions(project_expressions_);
   }
 
-  LogicalPtr input_;
-  std::vector<expressions::NamedExpressionPtr> project_expressions_;
+  const LogicalPtr input_;
+  const std::vector<expressions::NamedExpressionPtr> project_expressions_;
 
   DISALLOW_COPY_AND_ASSIGN(Project);
 };

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/3c7a89c2/query_optimizer/logical/Sample.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/logical/Sample.hpp b/query_optimizer/logical/Sample.hpp
index e2403c5..0e8c696 100644
--- a/query_optimizer/logical/Sample.hpp
+++ b/query_optimizer/logical/Sample.hpp
@@ -119,7 +119,7 @@ class Sample : public Logical {
      addChild(input);
   }
 
-  LogicalPtr input_;
+  const LogicalPtr input_;
   const bool is_block_sample_;
   const int percentage_;
 

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/3c7a89c2/query_optimizer/logical/SharedSubplanReference.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/logical/SharedSubplanReference.hpp b/query_optimizer/logical/SharedSubplanReference.hpp
index 79ef4ad..825953d 100644
--- a/query_optimizer/logical/SharedSubplanReference.hpp
+++ b/query_optimizer/logical/SharedSubplanReference.hpp
@@ -105,7 +105,7 @@ class SharedSubplanReference : public Logical {
    * @return An immutable SharedSubplanReference.
    */
   static SharedSubplanReferencePtr Create(
-      int subplan_id,
+      const int subplan_id,
       const std::vector<expressions::AttributeReferencePtr> &referenced_attributes,
       const std::vector<expressions::AttributeReferencePtr> &output_attributes) {
     return SharedSubplanReferencePtr(
@@ -113,7 +113,7 @@ class SharedSubplanReference : public Logical {
   }
 
  private:
-  SharedSubplanReference(int subplan_id,
+  SharedSubplanReference(const int subplan_id,
                          const std::vector<expressions::AttributeReferencePtr> &referenced_attributes,
                          const std::vector<expressions::AttributeReferencePtr> &output_attributes)
     : subplan_id_(subplan_id),
@@ -122,9 +122,9 @@ class SharedSubplanReference : public Logical {
     DCHECK_EQ(output_attributes_.size(), referenced_attributes_.size());
   }
 
-  int subplan_id_;
-  std::vector<expressions::AttributeReferencePtr> referenced_attributes_;
-  std::vector<expressions::AttributeReferencePtr> output_attributes_;
+  const int subplan_id_;
+  const std::vector<expressions::AttributeReferencePtr> referenced_attributes_;
+  const std::vector<expressions::AttributeReferencePtr> output_attributes_;
 
   DISALLOW_COPY_AND_ASSIGN(SharedSubplanReference);
 };

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/3c7a89c2/query_optimizer/logical/Sort.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/logical/Sort.hpp b/query_optimizer/logical/Sort.hpp
index 129c6d4..5be3238 100644
--- a/query_optimizer/logical/Sort.hpp
+++ b/query_optimizer/logical/Sort.hpp
@@ -166,12 +166,12 @@ class Sort : public Logical {
     addChild(input_);
   }
 
-  LogicalPtr input_;
-  std::vector<expressions::AttributeReferencePtr> sort_attributes_;
+  const LogicalPtr input_;
+  const std::vector<expressions::AttributeReferencePtr> sort_attributes_;
   // Has 1:1 matching with <sort_expressions_>.
-  std::vector<bool> sort_ascending_;
-  std::vector<bool> nulls_first_flags_;
-  int limit_;
+  const std::vector<bool> sort_ascending_;
+  const std::vector<bool> nulls_first_flags_;
+  const int limit_;
 
   DISALLOW_COPY_AND_ASSIGN(Sort);
 };

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/3c7a89c2/query_optimizer/logical/TableGenerator.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/logical/TableGenerator.hpp b/query_optimizer/logical/TableGenerator.hpp
index 15ca985..2f74ffc 100644
--- a/query_optimizer/logical/TableGenerator.hpp
+++ b/query_optimizer/logical/TableGenerator.hpp
@@ -99,6 +99,26 @@ class TableGenerator : public Logical {
     return {};
   }
 
+  /**
+   * @brief Creates a logical TableGenerator node.
+   *
+   * @param generator_function_handle The shared_ptr reference to a generator
+            function handle.
+   * @param table_alias The alias name of this table.
+   * @param optimizer_context The OptimizerContext for the query
+   * @return An immutable TableGenerator.
+   */
+  static TableGeneratorPtr Create(
+      const GeneratorFunctionHandlePtr &generator_function_handle,
+      const std::string &table_alias,
+      OptimizerContext *optimizer_context) {
+    return TableGeneratorPtr(
+        new TableGenerator(generator_function_handle,
+                           table_alias,
+                           optimizer_context));
+  }
+
+ protected:
   void getFieldStringItems(
       std::vector<std::string> *inline_field_names,
       std::vector<std::string> *inline_field_values,
@@ -119,34 +139,16 @@ class TableGenerator : public Logical {
     container_child_fields->push_back(CastSharedPtrVector<OptimizerTreeBase>(attribute_list_));
   }
 
-  /**
-   * @brief Creates a logical TableGenerator node.
-   *
-   * @param generator_function_handle The shared_ptr reference to a generator
-            function handle.
-   * @param table_alias The alias name of this table.
-   * @param optimizer_context The OptimizerContext for the query
-   * @return An immutable TableGenerator.
-   */
-  static TableGeneratorPtr Create(
-      const GeneratorFunctionHandlePtr &generator_function_handle,
-      const std::string &table_alias,
-      OptimizerContext *optimizer_context) {
-    return TableGeneratorPtr(
-        new TableGenerator(generator_function_handle,
-                           table_alias,
-                           optimizer_context));
-  }
-
  private:
   TableGenerator(const GeneratorFunctionHandlePtr &generator_function_handle,
                  const std::string &table_alias,
                  OptimizerContext *optimizer_context)
       : generator_function_handle_(generator_function_handle),
         table_alias_(table_alias) {
-    int num_attrs = generator_function_handle->getNumberOfOutputColumns();
+    const int num_attrs = generator_function_handle->getNumberOfOutputColumns();
     const std::string &table_name = generator_function_handle->getName();
 
+    attribute_list_.reserve(num_attrs);
     for (int i = 0; i < num_attrs; ++i) {
       attribute_list_.emplace_back(
         E::AttributeReference::Create(
@@ -167,8 +169,8 @@ class TableGenerator : public Logical {
         attribute_list_(attribute_list) {
   }
 
-  GeneratorFunctionHandlePtr generator_function_handle_;
-  std::string table_alias_;
+  const GeneratorFunctionHandlePtr generator_function_handle_;
+  const std::string table_alias_;
   std::vector<E::AttributeReferencePtr> attribute_list_;
 
   DISALLOW_COPY_AND_ASSIGN(TableGenerator);

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/3c7a89c2/query_optimizer/logical/TableReference.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/logical/TableReference.cpp b/query_optimizer/logical/TableReference.cpp
index 6d94665..0ee2d07 100644
--- a/query_optimizer/logical/TableReference.cpp
+++ b/query_optimizer/logical/TableReference.cpp
@@ -41,6 +41,7 @@ TableReference::TableReference(const CatalogRelation *catalog_relation,
                                OptimizerContext *optimizer_context)
     : catalog_relation_(catalog_relation),
       relation_alias_(relation_alias) {
+  attribute_list_.reserve(catalog_relation_->size());
   for (CatalogRelation::const_iterator attribute_it = catalog_relation_->begin();
        attribute_it < catalog_relation_->end();
        ++attribute_it) {

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/3c7a89c2/query_optimizer/logical/TableReference.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/logical/TableReference.hpp b/query_optimizer/logical/TableReference.hpp
index 6788c82..03033a7 100644
--- a/query_optimizer/logical/TableReference.hpp
+++ b/query_optimizer/logical/TableReference.hpp
@@ -128,7 +128,7 @@ class TableReference : public Logical {
         attribute_list_(attribute_list) {}
 
   const CatalogRelation *catalog_relation_;
-  std::string relation_alias_;
+  const std::string relation_alias_;
   std::vector<expressions::AttributeReferencePtr> attribute_list_;
 
   DISALLOW_COPY_AND_ASSIGN(TableReference);

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/3c7a89c2/query_optimizer/logical/TopLevelPlan.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/logical/TopLevelPlan.hpp b/query_optimizer/logical/TopLevelPlan.hpp
index 0b8f1a4..68b2a42 100644
--- a/query_optimizer/logical/TopLevelPlan.hpp
+++ b/query_optimizer/logical/TopLevelPlan.hpp
@@ -137,11 +137,11 @@ class TopLevelPlan : public Logical {
     }
   }
 
-  LogicalPtr plan_;
+  const LogicalPtr plan_;
   // Stored in the topological ordering based on dependencies.
-  std::vector<LogicalPtr> shared_subplans_;
+  const std::vector<LogicalPtr> shared_subplans_;
 
-  std::unordered_map<expressions::ExprId, int> uncorrelated_subquery_map_;
+  const std::unordered_map<expressions::ExprId, int> uncorrelated_subquery_map_;
 
   DISALLOW_COPY_AND_ASSIGN(TopLevelPlan);
 };

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/3c7a89c2/query_optimizer/logical/UpdateTable.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/logical/UpdateTable.hpp b/query_optimizer/logical/UpdateTable.hpp
index ec0d50f..bf84842 100644
--- a/query_optimizer/logical/UpdateTable.hpp
+++ b/query_optimizer/logical/UpdateTable.hpp
@@ -125,13 +125,13 @@ class UpdateTable : public Logical {
     addChild(input);
   }
 
-  LogicalPtr input_;
+  const LogicalPtr input_;
   // The attributes to be assigned values to.
-  std::vector<expressions::AttributeReferencePtr> assignees_;
+  const std::vector<expressions::AttributeReferencePtr> assignees_;
   // The expressions for which the values are assigned. Has 1:1 matching with
   // <assignees_>.
-  std::vector<expressions::ScalarPtr> assignment_expressions_;
-  expressions::PredicatePtr predicate_;
+  const std::vector<expressions::ScalarPtr> assignment_expressions_;
+  const expressions::PredicatePtr predicate_;
 
   DISALLOW_COPY_AND_ASSIGN(UpdateTable);
 };

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/3c7a89c2/query_optimizer/physical/BinaryJoin.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/physical/BinaryJoin.hpp b/query_optimizer/physical/BinaryJoin.hpp
index 39d5e31..a870b38 100644
--- a/query_optimizer/physical/BinaryJoin.hpp
+++ b/query_optimizer/physical/BinaryJoin.hpp
@@ -94,8 +94,8 @@ class BinaryJoin : public Join {
       std::vector<std::vector<OptimizerTreeBaseNodePtr>> *container_child_fields) const override;
 
  private:
-  PhysicalPtr left_;
-  PhysicalPtr right_;
+  const PhysicalPtr left_;
+  const PhysicalPtr right_;
 
   DISALLOW_COPY_AND_ASSIGN(BinaryJoin);
 };

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/3c7a89c2/query_optimizer/physical/CrossReferenceCoalesceAggregate.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/physical/CrossReferenceCoalesceAggregate.hpp b/query_optimizer/physical/CrossReferenceCoalesceAggregate.hpp
index 44f8a33..2ec7741 100644
--- a/query_optimizer/physical/CrossReferenceCoalesceAggregate.hpp
+++ b/query_optimizer/physical/CrossReferenceCoalesceAggregate.hpp
@@ -168,7 +168,7 @@ class CrossReferenceCoalesceAggregate : public Physical {
       const PhysicalPtr &right_child,
       const std::vector<expressions::AttributeReferencePtr> &left_join_attributes,
       const std::vector<expressions::AttributeReferencePtr> &right_join_attributes,
-      const expressions::PredicatePtr right_filter_predicate,
+      const expressions::PredicatePtr &right_filter_predicate,
       const std::vector<expressions::AliasPtr> &aggregate_expressions,
       const std::size_t group_by_key_value_range) {
     return CrossReferenceCoalesceAggregatePtr(
@@ -196,7 +196,7 @@ class CrossReferenceCoalesceAggregate : public Physical {
       const PhysicalPtr &right_child,
       const std::vector<expressions::AttributeReferencePtr> &left_join_attributes,
       const std::vector<expressions::AttributeReferencePtr> &right_join_attributes,
-      const expressions::PredicatePtr right_filter_predicate,
+      const expressions::PredicatePtr &right_filter_predicate,
       const std::vector<expressions::AliasPtr> &aggregate_expressions,
       const std::size_t group_by_key_value_range)
       : left_child_(left_child),
@@ -212,13 +212,13 @@ class CrossReferenceCoalesceAggregate : public Physical {
 
   // TODO(jianqiao): For the left child, support filter predicate fusing and
   // attachment of LIPFilters.
-  PhysicalPtr left_child_;
-  PhysicalPtr right_child_;
-  std::vector<expressions::AttributeReferencePtr> left_join_attributes_;
-  std::vector<expressions::AttributeReferencePtr> right_join_attributes_;
-  expressions::PredicatePtr right_filter_predicate_;
-  std::vector<expressions::AliasPtr> aggregate_expressions_;
-  std::size_t group_by_key_value_range_;
+  const PhysicalPtr left_child_;
+  const PhysicalPtr right_child_;
+  const std::vector<expressions::AttributeReferencePtr> left_join_attributes_;
+  const std::vector<expressions::AttributeReferencePtr> right_join_attributes_;
+  const expressions::PredicatePtr right_filter_predicate_;
+  const std::vector<expressions::AliasPtr> aggregate_expressions_;
+  const std::size_t group_by_key_value_range_;
 
   DISALLOW_COPY_AND_ASSIGN(CrossReferenceCoalesceAggregate);
 };

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/3c7a89c2/query_optimizer/physical/DeleteTuples.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/physical/DeleteTuples.hpp b/query_optimizer/physical/DeleteTuples.hpp
index bd1e847..a11f671 100644
--- a/query_optimizer/physical/DeleteTuples.hpp
+++ b/query_optimizer/physical/DeleteTuples.hpp
@@ -123,8 +123,8 @@ class DeleteTuples : public Physical {
     addChild(input_);
   }
 
-  PhysicalPtr input_;
-  expressions::PredicatePtr predicate_;
+  const PhysicalPtr input_;
+  const expressions::PredicatePtr predicate_;
 
   DISALLOW_COPY_AND_ASSIGN(DeleteTuples);
 };

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/3c7a89c2/query_optimizer/physical/HashJoin.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/physical/HashJoin.hpp b/query_optimizer/physical/HashJoin.hpp
index 1f0df0c..ee51bbb 100644
--- a/query_optimizer/physical/HashJoin.hpp
+++ b/query_optimizer/physical/HashJoin.hpp
@@ -218,11 +218,11 @@ class HashJoin : public BinaryJoin {
         join_type_(join_type) {
   }
 
-  std::vector<expressions::AttributeReferencePtr> left_join_attributes_;
-  std::vector<expressions::AttributeReferencePtr> right_join_attributes_;
-  expressions::PredicatePtr residual_predicate_;
-  expressions::PredicatePtr build_predicate_;
-  JoinType join_type_;
+  const std::vector<expressions::AttributeReferencePtr> left_join_attributes_;
+  const std::vector<expressions::AttributeReferencePtr> right_join_attributes_;
+  const expressions::PredicatePtr residual_predicate_;
+  const expressions::PredicatePtr build_predicate_;
+  const JoinType join_type_;
 
   DISALLOW_COPY_AND_ASSIGN(HashJoin);
 };

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/3c7a89c2/query_optimizer/physical/InsertSelection.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/physical/InsertSelection.hpp b/query_optimizer/physical/InsertSelection.hpp
index 4e22a6e..eb64b87 100644
--- a/query_optimizer/physical/InsertSelection.hpp
+++ b/query_optimizer/physical/InsertSelection.hpp
@@ -116,8 +116,8 @@ class InsertSelection : public Physical {
     addChild(selection_);
   }
 
-  PhysicalPtr destination_;
-  PhysicalPtr selection_;
+  const PhysicalPtr destination_;
+  const PhysicalPtr selection_;
 
   DISALLOW_COPY_AND_ASSIGN(InsertSelection);
 };

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/3c7a89c2/query_optimizer/physical/InsertTuple.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/physical/InsertTuple.hpp b/query_optimizer/physical/InsertTuple.hpp
index 10c7c5b..f1417ce 100644
--- a/query_optimizer/physical/InsertTuple.hpp
+++ b/query_optimizer/physical/InsertTuple.hpp
@@ -123,8 +123,8 @@ class InsertTuple : public Physical {
     addChild(input_);
   }
 
-  PhysicalPtr input_;
-  std::vector<std::vector<expressions::ScalarLiteralPtr>> column_values_;
+  const PhysicalPtr input_;
+  const std::vector<std::vector<expressions::ScalarLiteralPtr>> column_values_;
 
   DISALLOW_COPY_AND_ASSIGN(InsertTuple);
 };

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/3c7a89c2/query_optimizer/physical/Join.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/physical/Join.hpp b/query_optimizer/physical/Join.hpp
index 63f67c8..c50a131 100644
--- a/query_optimizer/physical/Join.hpp
+++ b/query_optimizer/physical/Join.hpp
@@ -74,14 +74,14 @@ class Join : public Physical {
    * @param partition_scheme_header The optional output partition scheme header.
    */
   explicit Join(
-      const std::vector<expressions::NamedExpressionPtr>& project_expressions,
+      const std::vector<expressions::NamedExpressionPtr> &project_expressions,
       const bool has_repartition = false,
       PartitionSchemeHeader *partition_scheme_header = nullptr)
       : Physical(has_repartition, partition_scheme_header),
         project_expressions_(project_expressions) {}
 
  private:
-  std::vector<expressions::NamedExpressionPtr> project_expressions_;
+  const std::vector<expressions::NamedExpressionPtr> project_expressions_;
 
   DISALLOW_COPY_AND_ASSIGN(Join);
 };

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/3c7a89c2/query_optimizer/physical/NestedLoopsJoin.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/physical/NestedLoopsJoin.hpp b/query_optimizer/physical/NestedLoopsJoin.hpp
index 87db5c3..92d90a7 100644
--- a/query_optimizer/physical/NestedLoopsJoin.hpp
+++ b/query_optimizer/physical/NestedLoopsJoin.hpp
@@ -140,7 +140,7 @@ class NestedLoopsJoin : public BinaryJoin {
     DCHECK(join_predicate_ != nullptr);
   }
 
-  expressions::PredicatePtr join_predicate_;
+  const expressions::PredicatePtr join_predicate_;
 
   DISALLOW_COPY_AND_ASSIGN(NestedLoopsJoin);
 };

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/3c7a89c2/query_optimizer/physical/SharedSubplanReference.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/physical/SharedSubplanReference.hpp b/query_optimizer/physical/SharedSubplanReference.hpp
index 849bd3a..a233f5f 100644
--- a/query_optimizer/physical/SharedSubplanReference.hpp
+++ b/query_optimizer/physical/SharedSubplanReference.hpp
@@ -116,7 +116,7 @@ class SharedSubplanReference : public physical::Physical {
    * @return An immutable SharedSubplanReference.
    */
   static SharedSubplanReferencePtr Create(
-      int subplan_id,
+      const int subplan_id,
       const std::vector<expressions::AttributeReferencePtr> &referenced_attributes,
       const std::vector<expressions::AttributeReferencePtr> &output_attributes) {
     return SharedSubplanReferencePtr(
@@ -124,7 +124,7 @@ class SharedSubplanReference : public physical::Physical {
   }
 
  private:
-  SharedSubplanReference(int subplan_id,
+  SharedSubplanReference(const int subplan_id,
                          const std::vector<expressions::AttributeReferencePtr> &referenced_attributes,
                          const std::vector<expressions::AttributeReferencePtr> &output_attributes)
     : subplan_id_(subplan_id),
@@ -133,9 +133,9 @@ class SharedSubplanReference : public physical::Physical {
     DCHECK_EQ(output_attributes_.size(), referenced_attributes_.size());
   }
 
-  int subplan_id_;
-  std::vector<expressions::AttributeReferencePtr> referenced_attributes_;
-  std::vector<expressions::AttributeReferencePtr> output_attributes_;
+  const int subplan_id_;
+  const std::vector<expressions::AttributeReferencePtr> referenced_attributes_;
+  const std::vector<expressions::AttributeReferencePtr> output_attributes_;
 
   DISALLOW_COPY_AND_ASSIGN(SharedSubplanReference);
 };

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/3c7a89c2/query_optimizer/physical/Sort.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/physical/Sort.hpp b/query_optimizer/physical/Sort.hpp
index 4a49aa3..acf81a8 100644
--- a/query_optimizer/physical/Sort.hpp
+++ b/query_optimizer/physical/Sort.hpp
@@ -169,17 +169,17 @@ class Sort : public Physical {
     addChild(input);
   }
 
-  PhysicalPtr input_;
-  std::vector<expressions::AttributeReferencePtr> sort_attributes_;
+  const PhysicalPtr input_;
+  const std::vector<expressions::AttributeReferencePtr> sort_attributes_;
   // non_sort_attributes_ is present only for Rule PruneColumns,
   // which need attributes referenced by Sort (i.e. sort_attributes_)
   // and others by its ancestors (i.e. non_sort_attributes_).
   // The output attributes by Sort may contain additional non-sorting attributes,
   // since the input physical of the Sort may not allow column pruning.
-  std::vector<expressions::AttributeReferencePtr> non_sort_attributes_;
-  std::vector<bool> sort_ascending_;
-  std::vector<bool> nulls_first_flags_;
-  int limit_;
+  const std::vector<expressions::AttributeReferencePtr> non_sort_attributes_;
+  const std::vector<bool> sort_ascending_;
+  const std::vector<bool> nulls_first_flags_;
+  const int limit_;
 
   DISALLOW_COPY_AND_ASSIGN(Sort);
 };

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/3c7a89c2/query_optimizer/physical/TableGenerator.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/physical/TableGenerator.hpp b/query_optimizer/physical/TableGenerator.hpp
index 0798165..ff0b6e7 100644
--- a/query_optimizer/physical/TableGenerator.hpp
+++ b/query_optimizer/physical/TableGenerator.hpp
@@ -162,9 +162,9 @@ class TableGenerator : public Physical {
         attribute_list_(attribute_list) {
   }
 
-  GeneratorFunctionHandlePtr generator_function_handle_;
-  std::string table_alias_;
-  std::vector<E::AttributeReferencePtr> attribute_list_;
+  const GeneratorFunctionHandlePtr generator_function_handle_;
+  const std::string table_alias_;
+  const std::vector<E::AttributeReferencePtr> attribute_list_;
 
   DISALLOW_COPY_AND_ASSIGN(TableGenerator);
 };

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/3c7a89c2/query_optimizer/physical/TopLevelPlan.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/physical/TopLevelPlan.hpp b/query_optimizer/physical/TopLevelPlan.hpp
index 9e567e1..059144f 100644
--- a/query_optimizer/physical/TopLevelPlan.hpp
+++ b/query_optimizer/physical/TopLevelPlan.hpp
@@ -192,11 +192,11 @@ class TopLevelPlan : public Physical {
     }
   }
 
-  PhysicalPtr plan_;
+  const PhysicalPtr plan_;
   // Stored in the topological ordering based on dependencies.
-  std::vector<PhysicalPtr> shared_subplans_;
-  std::unordered_map<expressions::ExprId, int> uncorrelated_subquery_map_;
-  LIPFilterConfigurationPtr lip_filter_configuration_;
+  const std::vector<PhysicalPtr> shared_subplans_;
+  const std::unordered_map<expressions::ExprId, int> uncorrelated_subquery_map_;
+  const LIPFilterConfigurationPtr lip_filter_configuration_;
 
   DISALLOW_COPY_AND_ASSIGN(TopLevelPlan);
 };

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/3c7a89c2/query_optimizer/physical/UpdateTable.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/physical/UpdateTable.hpp b/query_optimizer/physical/UpdateTable.hpp
index 1c93e17..943d74d 100644
--- a/query_optimizer/physical/UpdateTable.hpp
+++ b/query_optimizer/physical/UpdateTable.hpp
@@ -142,13 +142,13 @@ class UpdateTable : public Physical {
     addChild(input);
   }
 
-  PhysicalPtr input_;
+  const PhysicalPtr input_;
   // The attributes to be assigned values to.
-  std::vector<expressions::AttributeReferencePtr> assignees_;
+  const std::vector<expressions::AttributeReferencePtr> assignees_;
   // The expressions for which the values are assigned. Has 1:1 matching with
   // <assignees_>.
-  std::vector<expressions::ScalarPtr> assignment_expressions_;
-  expressions::PredicatePtr predicate_;
+  const std::vector<expressions::ScalarPtr> assignment_expressions_;
+  const expressions::PredicatePtr predicate_;
 
   DISALLOW_COPY_AND_ASSIGN(UpdateTable);
 };


Mime
View raw message