http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/expressions/InValueList.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/InValueList.hpp 
b/query_optimizer/expressions/InValueList.hpp
deleted file mode 100644
index 0ef3bba..0000000
--- a/query_optimizer/expressions/InValueList.hpp
+++ /dev/null
@@ -1,159 +0,0 @@
-/**
- * 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_EXPRESSIONS_IN_VALUE_LIST_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_EXPRESSIONS_IN_VALUE_LIST_HPP_
-
-#include <cstddef>
-#include <memory>
-#include <string>
-#include <unordered_map>
-#include <vector>
-
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "query_optimizer/expressions/ExprId.hpp"
-#include "query_optimizer/expressions/Expression.hpp"
-#include "query_optimizer/expressions/ExpressionType.hpp"
-#include "query_optimizer/expressions/Predicate.hpp"
-#include "query_optimizer/expressions/Scalar.hpp"
-#include "utility/Macros.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-class CatalogAttribute;
-class Predicate;
-
-namespace optimizer {
-namespace expressions {
-
-/** \addtogroup OptimizerExpressions
- *  @{
- */
-
-class InValueList;
-typedef std::shared_ptr<const InValueList> InValueListPtr;
-
-/**
- * @brief IN predicate with a value list.
- */
-class InValueList : public Predicate {
- public:
-  ExpressionType getExpressionType() const override {
-    return ExpressionType::kInValueList;
-  }
-
-  std::string getName() const override {
-    return "InValueList";
-  }
-
-  bool isConstant() const override {
-    return false;
-  }
-
-  /**
-   * @return The expression to test with a value list.
-   */
-  const ScalarPtr& test_expression() const {
-    return test_expression_;
-  }
-
-  /**
-   * @return Expressions to search for the value of the test_expression.
-   */
-  const std::vector<ScalarPtr>& match_expressions() const {
-    return match_expressions_;
-  }
-
-  ExpressionPtr copyWithNewChildren(
-      const std::vector<ExpressionPtr> &new_children) const override {
-    DCHECK_EQ(children().size(), new_children.size());
-    std::vector<ScalarPtr> new_match_expressions;
-    for (std::size_t idx = 1; idx < new_children.size(); ++idx) {
-      new_match_expressions.emplace_back(
-          std::static_pointer_cast<const Scalar>(new_children[idx]));
-    }
-    return Create(std::static_pointer_cast<const Scalar>(new_children[0]),
-                  new_match_expressions);
-  }
-
-  std::vector<AttributeReferencePtr> getReferencedAttributes() const override {
-    std::vector<AttributeReferencePtr> referenced_attrs =
-        test_expression_->getReferencedAttributes();
-    for (const ScalarPtr &match_expression : match_expressions_) {
-      const std::vector<AttributeReferencePtr> referenced_attrs_in_match_expr =
-          match_expression->getReferencedAttributes();
-      referenced_attrs.insert(referenced_attrs.end(),
-                              referenced_attrs_in_match_expr.begin(),
-                              referenced_attrs_in_match_expr.end());
-    }
-    return referenced_attrs;
-  }
-
-  ::quickstep::Predicate* concretize(
-      const std::unordered_map<ExprId, const CatalogAttribute*> 
&substitution_map) const override;
-
-  /**
-   * @brief Create an IN predicate with a value list.
-   *
-   * @param test_expression The expression to test with a value list.
-   * @param match_expressions Expressions to search for the value of the 
test_expression.
-   *
-   * @return An immutable IN predicate node with a value list.
-   */
-  static InValueListPtr Create(const ScalarPtr &test_expression,
-                               const std::vector<ScalarPtr> 
&match_expressions) {
-    return InValueListPtr(new InValueList(test_expression, match_expressions));
-  }
-
- protected:
-  void getFieldStringItems(
-      std::vector<std::string> *inline_field_names,
-      std::vector<std::string> *inline_field_values,
-      std::vector<std::string> *non_container_child_field_names,
-      std::vector<OptimizerTreeBaseNodePtr> *non_container_child_fields,
-      std::vector<std::string> *container_child_field_names,
-      std::vector<std::vector<OptimizerTreeBaseNodePtr>> 
*container_child_fields) const override;
-
- private:
-  InValueList(const ScalarPtr &test_expression,
-              const std::vector<ScalarPtr> &match_expressions)
-      : test_expression_(test_expression),
-        match_expressions_(match_expressions) {
-    addChild(test_expression_);
-    for (const ScalarPtr &match_expression : match_expressions_) {
-      addChild(match_expression);
-    }
-  }
-
-  ScalarPtr test_expression_;
-  std::vector<ScalarPtr> match_expressions_;
-
-  DISALLOW_COPY_AND_ASSIGN(InValueList);
-};
-
-/** @} */
-
-}  // namespace expressions
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_QUERY_OPTIMIZER_EXPRESSIONS_IN_VALUE_LIST_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/expressions/LogicalAnd.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/LogicalAnd.cpp 
b/query_optimizer/expressions/LogicalAnd.cpp
deleted file mode 100644
index 80ee0eb..0000000
--- a/query_optimizer/expressions/LogicalAnd.cpp
+++ /dev/null
@@ -1,125 +0,0 @@
-/**
- * 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.
- **/
-
-#include "query_optimizer/expressions/LogicalAnd.hpp"
-
-#include <string>
-#include <unordered_map>
-#include <vector>
-
-#include "expressions/predicate/ConjunctionPredicate.hpp"
-#include "expressions/predicate/TrivialPredicates.hpp"
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "query_optimizer/expressions/ExprId.hpp"
-#include "query_optimizer/expressions/Expression.hpp"
-#include "query_optimizer/expressions/PatternMatcher.hpp"
-#include "query_optimizer/expressions/Predicate.hpp"
-#include "query_optimizer/expressions/PredicateLiteral.hpp"
-#include "utility/Cast.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-namespace optimizer {
-namespace expressions {
-
-LogicalAnd::LogicalAnd(const std::vector<PredicatePtr> &operands) {
-  // Flatten the predicate tree.
-  for (const PredicatePtr &operand : operands) {
-    LogicalAndPtr logical_and;
-    PredicateLiteralPtr literal;
-    if (SomeLogicalAnd::MatchesWithConditionalCast(operand, &logical_and)) {
-      operands_.insert(operands_.end(),
-                       logical_and->operands().begin(),
-                       logical_and->operands().end());
-    } else if (!(SomePredicateLiteral::MatchesWithConditionalCast(operand, 
&literal) &&
-                 literal->is_true())) {
-      operands_.push_back(operand);
-    }
-  }
-
-  for (const PredicatePtr &operand : operands_) {
-    addChild(operand);
-  }
-}
-
-ExpressionPtr LogicalAnd::copyWithNewChildren(
-    const std::vector<ExpressionPtr> &new_children) const {
-  DCHECK_EQ(getNumChildren(), new_children.size());
-  std::vector<PredicatePtr> operands;
-  for (const ExpressionPtr &expression : new_children) {
-    PredicatePtr new_expression;
-    CHECK(SomePredicate::MatchesWithConditionalCast(expression, 
&new_expression));
-    operands.push_back(new_expression);
-  }
-  return LogicalAnd::Create(operands);
-}
-
-std::vector<AttributeReferencePtr> LogicalAnd::getReferencedAttributes() const 
{
-  std::vector<AttributeReferencePtr> referenced_attributes;
-  for (const PredicatePtr &operand : operands()) {
-    const std::vector<AttributeReferencePtr> referenced_attributes_in_operand =
-        operand->getReferencedAttributes();
-    referenced_attributes.insert(referenced_attributes.end(),
-                                 referenced_attributes_in_operand.begin(),
-                                 referenced_attributes_in_operand.end());
-  }
-  return referenced_attributes;
-}
-
-::quickstep::Predicate* LogicalAnd::concretize(
-    const std::unordered_map<ExprId, const CatalogAttribute*> 
&substitution_map) const {
-  if (operands_.empty()) {
-    return new TruePredicate();
-  }
-
-  if (operands_.size() == 1u) {
-    return operands_[0]->concretize(substitution_map);
-  }
-
-  std::unique_ptr<::quickstep::ConjunctionPredicate> concretized_predicate;
-  concretized_predicate.reset(new ::quickstep::ConjunctionPredicate());
-
-  for (const PredicatePtr &operand : operands_) {
-    concretized_predicate->addPredicate(
-        operand->concretize(substitution_map));
-  }
-
-  return concretized_predicate.release();
-}
-
-void LogicalAnd::getFieldStringItems(
-    std::vector<std::string> *inline_field_names,
-    std::vector<std::string> *inline_field_values,
-    std::vector<std::string> *non_container_child_field_names,
-    std::vector<OptimizerTreeBaseNodePtr> *non_container_child_fields,
-    std::vector<std::string> *container_child_field_names,
-    std::vector<std::vector<OptimizerTreeBaseNodePtr>> 
*container_child_fields) const {
-  if (!operands_.empty()) {
-    container_child_field_names->push_back("");
-    
container_child_fields->emplace_back(CastSharedPtrVector<OptimizerTreeBase>(operands_));
-  } else {
-    inline_field_names->push_back("static_value");
-    inline_field_values->push_back("true");
-  }
-}
-
-}  // namespace expressions
-}  // namespace optimizer
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/expressions/LogicalAnd.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/LogicalAnd.hpp 
b/query_optimizer/expressions/LogicalAnd.hpp
deleted file mode 100644
index 8152728..0000000
--- a/query_optimizer/expressions/LogicalAnd.hpp
+++ /dev/null
@@ -1,128 +0,0 @@
-/**
- * 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_EXPRESSIONS_LOGICAL_AND_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_EXPRESSIONS_LOGICAL_AND_HPP_
-
-#include <memory>
-#include <string>
-#include <unordered_map>
-#include <vector>
-
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "query_optimizer/expressions/ExprId.hpp"
-#include "query_optimizer/expressions/Expression.hpp"
-#include "query_optimizer/expressions/ExpressionType.hpp"
-#include "query_optimizer/expressions/Predicate.hpp"
-#include "utility/Macros.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-class CatalogAttribute;
-
-namespace optimizer {
-namespace expressions {
-
-/** \addtogroup OptimizerExpressions
- *  @{
- */
-
-class LogicalAnd;
-typedef std::shared_ptr<const LogicalAnd> LogicalAndPtr;
-
-/**
- * @brief A logical conjunction (AND) of a list of predicate
- * operands.
- */
-class LogicalAnd : public Predicate {
- public:
-  ExpressionType getExpressionType() const override {
-    return ExpressionType::kLogicalAnd;
-  }
-
-  std::string getName() const override {
-    return "And";
-  }
-
-  // FIXME(qzeng): isConstant() is not strictly well-defined.
-  // We do not determine the constant value for each expression.
-  // A logical AND or OR is considered as not constant
-  // only if any predicate is not constant, even it may have
-  // a static value.
-  bool isConstant() const override {
-    for (const PredicatePtr &operand : operands_) {
-      if (!operand->isConstant()) {
-        return false;
-      }
-    }
-    return true;
-  }
-
-  /**
-   * @return Operands that the logical AND is applied on.
-   */
-  const std::vector<PredicatePtr>& operands() const { return operands_; }
-
-  ExpressionPtr copyWithNewChildren(
-      const std::vector<ExpressionPtr> &new_children) const override;
-
-  std::vector<AttributeReferencePtr> getReferencedAttributes() const override;
-
-  ::quickstep::Predicate* concretize(
-      const std::unordered_map<ExprId, const CatalogAttribute*> 
&substitution_map) const override;
-
-  /**
-   * @brief Creates an immutable LogicalAnd. If any operand is also a 
LogicalAnd,
-   *        the operand is pulled out and merged into the returned predicate
-   *        (i.e. nested AND expressions are flattened).
-   *
-   * @param operands The operands to be applied to.
-   * @return An immutable LogicalAnd.
-   */
-  static LogicalAndPtr Create(const std::vector<PredicatePtr> &operands) {
-    DCHECK_GT(operands.size(), 1u);
-    return LogicalAndPtr(new LogicalAnd(operands));
-  }
-
- protected:
-  void getFieldStringItems(
-      std::vector<std::string> *inline_field_names,
-      std::vector<std::string> *inline_field_values,
-      std::vector<std::string> *non_container_child_field_names,
-      std::vector<OptimizerTreeBaseNodePtr> *non_container_child_fields,
-      std::vector<std::string> *container_child_field_names,
-      std::vector<std::vector<OptimizerTreeBaseNodePtr>> 
*container_child_fields) const override;
-
- private:
-  explicit LogicalAnd(const std::vector<PredicatePtr> &operands);
-
-  std::vector<PredicatePtr> operands_;
-  DISALLOW_COPY_AND_ASSIGN(LogicalAnd);
-};
-
-/** @} */
-
-}  // namespace expressions
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_QUERY_OPTIMIZER_EXPRESSIONS_LOGICAL_AND_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/expressions/LogicalNot.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/LogicalNot.cpp 
b/query_optimizer/expressions/LogicalNot.cpp
deleted file mode 100644
index dce13a9..0000000
--- a/query_optimizer/expressions/LogicalNot.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-/**
- * 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.
- **/
-
-#include "query_optimizer/expressions/LogicalNot.hpp"
-
-#include <string>
-#include <unordered_map>
-#include <vector>
-
-#include "expressions/predicate/NegationPredicate.hpp"
-#include "query_optimizer/expressions/ExprId.hpp"
-#include "query_optimizer/expressions/Expression.hpp"
-#include "query_optimizer/expressions/PatternMatcher.hpp"
-#include "query_optimizer/expressions/Predicate.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-namespace optimizer {
-namespace expressions {
-
-ExpressionPtr LogicalNot::copyWithNewChildren(
-    const std::vector<ExpressionPtr> &new_children) const {
-  DCHECK_EQ(new_children.size(), children().size());
-  PredicatePtr operand;
-  CHECK(SomePredicate::MatchesWithConditionalCast(new_children[0], &operand));
-  return LogicalNot::Create(operand);
-}
-
-::quickstep::Predicate* LogicalNot::concretize(
-    const std::unordered_map<ExprId, const CatalogAttribute*> 
&substitution_map) const {
-  return new ::quickstep::NegationPredicate(
-      operand_->concretize(substitution_map));
-}
-
-void LogicalNot::getFieldStringItems(
-    std::vector<std::string> *inline_field_names,
-    std::vector<std::string> *inline_field_values,
-    std::vector<std::string> *non_container_child_field_names,
-    std::vector<OptimizerTreeBaseNodePtr> *non_container_child_fields,
-    std::vector<std::string> *container_child_field_names,
-    std::vector<std::vector<OptimizerTreeBaseNodePtr>> 
*container_child_fields) const {
-  non_container_child_field_names->push_back("");
-  non_container_child_fields->push_back(operand_);
-}
-
-}  // namespace expressions
-}  // namespace optimizer
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/expressions/LogicalNot.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/LogicalNot.hpp 
b/query_optimizer/expressions/LogicalNot.hpp
deleted file mode 100644
index 90a98cd..0000000
--- a/query_optimizer/expressions/LogicalNot.hpp
+++ /dev/null
@@ -1,114 +0,0 @@
-/**
- * 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_EXPRESSIONS_LOGICAL_NOT_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_EXPRESSIONS_LOGICAL_NOT_HPP_
-
-#include <memory>
-#include <string>
-#include <unordered_map>
-#include <vector>
-
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "query_optimizer/expressions/ExprId.hpp"
-#include "query_optimizer/expressions/Expression.hpp"
-#include "query_optimizer/expressions/ExpressionType.hpp"
-#include "query_optimizer/expressions/Predicate.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-
-class CatalogAttribute;
-
-namespace optimizer {
-namespace expressions {
-
-/** \addtogroup OptimizerExpressions
- *  @{
- */
-
-class LogicalNot;
-typedef std::shared_ptr<const LogicalNot> LogicalNotPtr;
-
-/**
- * @brief Applies a logical negation (NOT) operator to a predicate expression.
- */
-class LogicalNot : public Predicate {
- public:
-  ExpressionType getExpressionType() const override {
-    return ExpressionType::kLogicalNot;
-  }
-
-  std::string getName() const override { return "NOT"; }
-
-  bool isConstant() const override { return operand_->isConstant(); }
-
-  /**
-   * @return The operand of this negation.
-   */
-  const PredicatePtr& operand() const { return operand_; }
-
-  ExpressionPtr copyWithNewChildren(
-      const std::vector<ExpressionPtr> &new_children) const override;
-
-  std::vector<AttributeReferencePtr> getReferencedAttributes() const override {
-    return operand_->getReferencedAttributes();
-  }
-
-  ::quickstep::Predicate* concretize(
-      const std::unordered_map<ExprId, const CatalogAttribute*> 
&substitution_map) const override;
-
-  /**
-   * @brief Creates an immutable LogicalNot.
-   *
-   * @param operand Operand of the logical not operator.
-   * @return  An immutable LogicalNot.
-   */
-  static LogicalNotPtr Create(const PredicatePtr &operand) {
-    return LogicalNotPtr(new LogicalNot(operand));
-  }
-
- protected:
-  void getFieldStringItems(
-      std::vector<std::string> *inline_field_names,
-      std::vector<std::string> *inline_field_values,
-      std::vector<std::string> *non_container_child_field_names,
-      std::vector<OptimizerTreeBaseNodePtr> *non_container_child_fields,
-      std::vector<std::string> *container_child_field_names,
-      std::vector<std::vector<OptimizerTreeBaseNodePtr>> 
*container_child_fields) const override;
-
- private:
-  explicit LogicalNot(const PredicatePtr &operand)
-      : operand_(operand) {
-    addChild(operand_);
-  }
-
-  PredicatePtr operand_;
-
-  DISALLOW_COPY_AND_ASSIGN(LogicalNot);
-};
-
-/** @} */
-
-}  // namespace expressions
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_QUERY_OPTIMIZER_EXPRESSIONS_LOGICAL_NOT_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/expressions/LogicalOr.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/LogicalOr.cpp 
b/query_optimizer/expressions/LogicalOr.cpp
deleted file mode 100644
index 02028e1..0000000
--- a/query_optimizer/expressions/LogicalOr.cpp
+++ /dev/null
@@ -1,123 +0,0 @@
-/**
- * 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.
- **/
-
-#include "query_optimizer/expressions/LogicalOr.hpp"
-
-#include <string>
-#include <unordered_map>
-#include <vector>
-
-#include "expressions/predicate/DisjunctionPredicate.hpp"
-#include "expressions/predicate/TrivialPredicates.hpp"
-#include "query_optimizer/expressions/ExprId.hpp"
-#include "query_optimizer/expressions/PatternMatcher.hpp"
-#include "query_optimizer/expressions/Predicate.hpp"
-#include "query_optimizer/expressions/PredicateLiteral.hpp"
-#include "utility/Cast.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-namespace optimizer {
-namespace expressions {
-
-LogicalOr::LogicalOr(const std::vector<PredicatePtr> &operands) {
-  // Flatten the predicate tree.
-  for (const PredicatePtr &operand : operands) {
-    LogicalOrPtr logical_or;
-    PredicateLiteralPtr literal;
-    if (SomeLogicalOr::MatchesWithConditionalCast(operand, &logical_or)) {
-      operands_.insert(operands_.end(),
-                       logical_or->operands().begin(),
-                       logical_or->operands().end());
-    } else if (!SomePredicateLiteral::MatchesWithConditionalCast(operand, 
&literal) ||
-               !literal->is_true()) {
-      operands_.push_back(operand);
-    }
-  }
-
-  for (const PredicatePtr &operand : operands_) {
-    addChild(operand);
-  }
-}
-
-ExpressionPtr LogicalOr::copyWithNewChildren(
-    const std::vector<ExpressionPtr> &new_children) const {
-  DCHECK_EQ(getNumChildren(), new_children.size());
-  std::vector<PredicatePtr> operands;
-  for (const ExpressionPtr &expression : new_children) {
-    PredicatePtr new_expression;
-    CHECK(SomePredicate::MatchesWithConditionalCast(expression, 
&new_expression));
-    operands.push_back(new_expression);
-  }
-  return LogicalOr::Create(operands);
-}
-
-std::vector<AttributeReferencePtr> LogicalOr::getReferencedAttributes() const {
-  std::vector<AttributeReferencePtr> referenced_attributes;
-  for (const PredicatePtr &operand : operands()) {
-    const std::vector<AttributeReferencePtr> referenced_attributes_in_operand =
-        operand->getReferencedAttributes();
-    referenced_attributes.insert(referenced_attributes.end(),
-                                 referenced_attributes_in_operand.begin(),
-                                 referenced_attributes_in_operand.end());
-  }
-  return referenced_attributes;
-}
-
-::quickstep::Predicate* LogicalOr::concretize(
-    const std::unordered_map<ExprId, const CatalogAttribute*> 
&substitution_map) const {
-  if (operands_.empty()) {
-    return new FalsePredicate();
-  }
-
-  if (operands_.size() == 1u) {
-    return operands_[0]->concretize(substitution_map);
-  }
-
-  std::unique_ptr<::quickstep::DisjunctionPredicate> concretized_predicate;
-  concretized_predicate.reset(new ::quickstep::DisjunctionPredicate());
-
-  for (const PredicatePtr &operand : operands_) {
-    concretized_predicate->addPredicate(
-        operand->concretize(substitution_map));
-  }
-
-  return concretized_predicate.release();
-}
-
-void LogicalOr::getFieldStringItems(
-    std::vector<std::string> *inline_field_names,
-    std::vector<std::string> *inline_field_values,
-    std::vector<std::string> *non_container_child_field_names,
-    std::vector<OptimizerTreeBaseNodePtr> *non_container_child_fields,
-    std::vector<std::string> *container_child_field_names,
-    std::vector<std::vector<OptimizerTreeBaseNodePtr>> 
*container_child_fields) const {
-  if (!operands_.empty()) {
-    container_child_field_names->push_back("");
-    
container_child_fields->emplace_back(CastSharedPtrVector<OptimizerTreeBase>(operands_));
-  } else {
-    inline_field_names->push_back("static_value");
-    inline_field_values->push_back("false");
-  }
-}
-
-}  // namespace expressions
-}  // namespace optimizer
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/expressions/LogicalOr.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/LogicalOr.hpp 
b/query_optimizer/expressions/LogicalOr.hpp
deleted file mode 100644
index f96b6cd..0000000
--- a/query_optimizer/expressions/LogicalOr.hpp
+++ /dev/null
@@ -1,128 +0,0 @@
-/**
- * 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_EXPRESSIONS_LOGICAL_OR_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_EXPRESSIONS_LOGICAL_OR_HPP_
-
-#include <memory>
-#include <string>
-#include <unordered_map>
-#include <vector>
-
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "query_optimizer/expressions/ExprId.hpp"
-#include "query_optimizer/expressions/Expression.hpp"
-#include "query_optimizer/expressions/ExpressionType.hpp"
-#include "query_optimizer/expressions/Predicate.hpp"
-#include "utility/Macros.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-class CatalogAttribute;
-
-namespace optimizer {
-namespace expressions {
-
-/** \addtogroup OptimizerExpressions
- *  @{
- */
-
-class LogicalOr;
-typedef std::shared_ptr<const LogicalOr> LogicalOrPtr;
-
-/**
- * @brief A logical disconjunction (OR) of a list of predicate
- * operands.
- */
-class LogicalOr : public Predicate {
- public:
-  ExpressionType getExpressionType() const override {
-    return ExpressionType::kLogicalOr;
-  }
-
-  std::string getName() const override {
-    return "Or";
-  }
-
-  // FIXME(qzeng): isConstant() is not strictly well-defined.
-  // We do not determine the constant value for each expression.
-  // A logical AND or OR is considered as not constant
-  // only if any predicate is not constant, even it may have
-  // a static value.
-  bool isConstant() const override {
-    for (const PredicatePtr &operand : operands_) {
-      if (!operand->isConstant()) {
-        return false;
-      }
-    }
-    return true;
-  }
-
-  /**
-   * @return Operands that the logical OR is applied on.
-   */
-  const std::vector<PredicatePtr>& operands() const { return operands_; }
-
-  ExpressionPtr copyWithNewChildren(
-      const std::vector<ExpressionPtr> &new_children) const override;
-
-  std::vector<AttributeReferencePtr> getReferencedAttributes() const override;
-
-  ::quickstep::Predicate* concretize(
-      const std::unordered_map<ExprId, const CatalogAttribute*> 
&substitution_map) const override;
-
-  /**
-   * @brief Creates an immutable LogicalOr. If any operand is also a LogicalOr,
-   *        the operand is pulled out and merged into the returned predicate
-   *        (i.e. nested OR expressions are flattened).
-   *
-   * @param operands The operands to be applied to.
-   * @return An immutable LogicalOr.
-   */
-  static LogicalOrPtr Create(const std::vector<PredicatePtr> &operands) {
-    DCHECK_GT(operands.size(), 1u);
-    return LogicalOrPtr(new LogicalOr(operands));
-  }
-
- protected:
-  void getFieldStringItems(
-      std::vector<std::string> *inline_field_names,
-      std::vector<std::string> *inline_field_values,
-      std::vector<std::string> *non_container_child_field_names,
-      std::vector<OptimizerTreeBaseNodePtr> *non_container_child_fields,
-      std::vector<std::string> *container_child_field_names,
-      std::vector<std::vector<OptimizerTreeBaseNodePtr>> 
*container_child_fields) const override;
-
- private:
-  explicit LogicalOr(const std::vector<PredicatePtr> &operands);
-
-  std::vector<PredicatePtr> operands_;
-  DISALLOW_COPY_AND_ASSIGN(LogicalOr);
-};
-
-/** @} */
-
-}  // namespace expressions
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_QUERY_OPTIMIZER_EXPRESSIONS_LOGICAL_OR_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/expressions/NamedExpression.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/NamedExpression.cpp 
b/query_optimizer/expressions/NamedExpression.cpp
deleted file mode 100644
index 992a84a..0000000
--- a/query_optimizer/expressions/NamedExpression.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-/**
- * 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.
- **/
-
-#include "query_optimizer/expressions/NamedExpression.hpp"
-
-#include <string>
-#include <vector>
-
-#include "query_optimizer/OptimizerTree.hpp"
-#include "types/Type.hpp"
-
-namespace quickstep {
-namespace optimizer {
-namespace expressions {
-
-void NamedExpression::getFieldStringItems(
-    std::vector<std::string> *inline_field_names,
-    std::vector<std::string> *inline_field_values,
-    std::vector<std::string> *non_container_child_field_names,
-    std::vector<OptimizerTreeBaseNodePtr> *non_container_child_fields,
-    std::vector<std::string> *container_child_field_names,
-    std::vector<std::vector<OptimizerTreeBaseNodePtr>> 
*container_child_fields) const {
-  inline_field_names->push_back("id");
-  inline_field_values->push_back(std::to_string(id_));
-
-  inline_field_names->push_back("name");
-  inline_field_values->push_back(attribute_name_);
-
-  if (attribute_name_ != attribute_alias_) {
-    inline_field_names->push_back("alias");
-    inline_field_values->push_back(attribute_alias_);
-  }
-
-  inline_field_names->push_back("relation");
-  inline_field_values->push_back(relation_name_);
-
-  inline_field_names->push_back("type");
-  inline_field_values->push_back(getValueType().getName());
-}
-
-}  // namespace expressions
-}  // namespace optimizer
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/expressions/NamedExpression.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/NamedExpression.hpp 
b/query_optimizer/expressions/NamedExpression.hpp
deleted file mode 100644
index 9de8005..0000000
--- a/query_optimizer/expressions/NamedExpression.hpp
+++ /dev/null
@@ -1,131 +0,0 @@
-/**
- * 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_EXPRESSIONS_NAMED_EXPRESSION_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_EXPRESSIONS_NAMED_EXPRESSION_HPP_
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/ExprId.hpp"
-#include "query_optimizer/expressions/Scalar.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-namespace optimizer {
-namespace expressions {
-
-/** \addtogroup OptimizerExpressions
- *  @{
- */
-
-class NamedExpression;
-typedef std::shared_ptr<const NamedExpression> NamedExpressionPtr;
-
-/**
- * @brief Expression with an expression ID and name, including Alias and
- *        AttributeReference. A NamedExpression can be referenced by other
- *        expressions.
- */
-class NamedExpression : public Scalar {
- public:
-  ~NamedExpression() override {}
-
-  /**
-   * @return The expression ID.
-   */
-  inline ExprId id() const { return id_; }
-
-  /**
-   * @return The (internal) attribute name.
-   */
-  inline const std::string& attribute_name() const { return attribute_name_; }
-
-  /**
-   * @return The attribute alias.
-   */
-  inline const std::string& attribute_alias() const { return attribute_alias_; 
}
-
-  /**
-   * @return The relation name. May be empty.
-   */
-  inline const std::string& relation_name() const { return relation_name_; }
-
-  /**
-   * @brief Compares this named expression with \p other. Two named expressions
-   *        are equal if they have the same ExprId and are both Alias or
-   *        AttributeReference.
-   *
-   * @param other Another named expression to compare with.
-   * @return True if the named expression is equal to \p other.
-   */
-  inline bool equals(const NamedExpressionPtr &other) const {
-    return getExpressionType() == other->getExpressionType() &&
-           id_ == other->id();
-  }
-
- protected:
-  /**
-   * @brief Constructor.
-   *
-   * @param id ExprId assigned to this expression.
-   * @param attribute_name The (internal) attribute name.
-   * @param attribute_alias The attribute name for display.
-   * @param relation_name A relation name indicating where it comes from. Can 
be
-   *                      empty. This is only for the printing purpose only.
-   *                      When this named expression is converted to a
-   *                      CatalogAttribute, the relation name may not be
-   *                      \p relation_name.
-   */
-  NamedExpression(const ExprId id,
-                  const std::string &attribute_name,
-                  const std::string &attribute_alias,
-                  const std::string &relation_name)
-      : id_(id),
-        attribute_name_(attribute_name),
-        attribute_alias_(attribute_alias),
-        relation_name_(relation_name) {}
-
- protected:
-  void getFieldStringItems(
-      std::vector<std::string> *inline_field_names,
-      std::vector<std::string> *inline_field_values,
-      std::vector<std::string> *non_container_child_field_names,
-      std::vector<OptimizerTreeBaseNodePtr> *non_container_child_fields,
-      std::vector<std::string> *container_child_field_names,
-      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_;
-
-  DISALLOW_COPY_AND_ASSIGN(NamedExpression);
-};
-
-/** @} */
-
-}  // namespace expressions
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_QUERY_OPTIMIZER_EXPRESSIONS_NAMED_EXPRESSION_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/expressions/OptimizerExpressionsModule.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/OptimizerExpressionsModule.hpp 
b/query_optimizer/expressions/OptimizerExpressionsModule.hpp
deleted file mode 100644
index 4462201..0000000
--- a/query_optimizer/expressions/OptimizerExpressionsModule.hpp
+++ /dev/null
@@ -1,24 +0,0 @@
-/**
- * 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.
- **/
-
-/** @defgroup OptimizerExpressions
- *  @ingroup QueryOptimizer
- *
- * Expressions used in the query optimizer.
- **/

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/expressions/PatternMatcher.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/PatternMatcher.hpp 
b/query_optimizer/expressions/PatternMatcher.hpp
deleted file mode 100644
index 18d6b1c..0000000
--- a/query_optimizer/expressions/PatternMatcher.hpp
+++ /dev/null
@@ -1,171 +0,0 @@
-/**
- * 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_EXPRESSIONS_PATTERN_MATCHER_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_EXPRESSIONS_PATTERN_MATCHER_HPP_
-
-#include <memory>
-#include <type_traits>
-
-#include "query_optimizer/expressions/ExpressionType.hpp"
-
-namespace quickstep {
-namespace optimizer {
-namespace expressions {
-
-class AggregateFunction;
-class Alias;
-class Avg;
-class AttributeReference;
-class BinaryExpression;
-class Cast;
-class ComparisonExpression;
-class Count;
-class Exists;
-class InTableQuery;
-class InValueList;
-class LogicalAnd;
-class LogicalNot;
-class LogicalOr;
-class Max;
-class Min;
-class NamedExpression;
-class Predicate;
-class PredicateLiteral;
-class Scalar;
-class ScalarLiteral;
-class Sum;
-class UnaryExpression;
-class WindowAggregateFunction;
-
-/** \addtogroup OptimizerExpressions
- *  @{
- */
-
-/**
- * @brief Templated matcher for each Expression node class.
- *
- * @param ExpressionClass The Expression class for the expression node to be 
matched with.
- * @param expression_types All the expression types of the Expression class.
- */
-template <class ExpressionClass, ExpressionType... expression_types>
-class SomeExpressionNode {
- public:
-  /**
-   * @brief Checks whether the object managed in \p expression is an instance
-   *        of the template argument ExpressionClass by checking whether
-   *        it is one of types in the given template arguments 
expression_types.
-   *
-   * @param expression The expression node to be checked.
-   * @return True for a match; otherwise false.
-   */
-  template <class OtherExpressionClass>
-  static bool Matches(const std::shared_ptr<const OtherExpressionClass> 
&expression) {
-    for (const ExpressionType expression_type : kExpressionTypes) {
-      if (expression->getExpressionType() == expression_type) {
-        return true;
-      }
-    }
-    return false;
-  }
-
-  /**
-   * @brief Checks whether the object managed in \p expression is an instance
-   *        of the template argument ExpressionClass by checking whether
-   *        it is one of types in the given template arguments 
expression_types,
-   *        If true, it additionally casts \p expression to a std::shared_ptr
-   *        \p cast_expression of the template argument ExpressionClass.
-   *
-   * @param expression The expression node to be checked.
-   * @param cast_expression The cast expression node.
-   * @return True if the object managed in \p expression is an instance of 
ExpressionClass.
-   */
-  template <class OtherExpressionClass>
-  static bool MatchesWithConditionalCast(
-      const std::shared_ptr<const OtherExpressionClass> &expression,
-      std::shared_ptr<const ExpressionClass> *cast_expression) {
-    bool is_match = Matches(expression);
-    if (is_match) {
-      *cast_expression = std::static_pointer_cast<const 
ExpressionClass>(expression);
-    }
-    return is_match;
-  }
-
- private:
-  constexpr static ExpressionType kExpressionTypes[] = {expression_types...};
-};
-
-template <class ExpressionClass, ExpressionType... expression_types>
-constexpr ExpressionType SomeExpressionNode<ExpressionClass, 
expression_types...>::kExpressionTypes[];
-
-// Specializations for all Expression classes.
-
-using SomeAlias = SomeExpressionNode<Alias, ExpressionType::kAlias>;
-using SomeAttributeReference = SomeExpressionNode<AttributeReference, 
ExpressionType::kAttributeReference>;
-using SomeBinaryExpression = SomeExpressionNode<BinaryExpression, 
ExpressionType::kBinaryExpression>;
-using SomeCast = SomeExpressionNode<Cast, ExpressionType::kCast>;
-using SomeComparisonExpression = SomeExpressionNode<ComparisonExpression, 
ExpressionType::kComparisonExpression>;
-using SomeExists = SomeExpressionNode<Exists, ExpressionType::kExists>;
-using SomeInTableQuery = SomeExpressionNode<InTableQuery, 
ExpressionType::kInTableQuery>;
-using SomeInValueList = SomeExpressionNode<InValueList, 
ExpressionType::kInValueList>;
-using SomeLogicalAnd = SomeExpressionNode<LogicalAnd, 
ExpressionType::kLogicalAnd>;
-using SomeLogicalNot = SomeExpressionNode<LogicalNot, 
ExpressionType::kLogicalNot>;
-using SomeLogicalOr = SomeExpressionNode<LogicalOr, 
ExpressionType::kLogicalOr>;
-using SomeNamedExpression = SomeExpressionNode<NamedExpression,
-                                               
ExpressionType::kAttributeReference,
-                                               ExpressionType::kAlias>;
-using SomePredicate = SomeExpressionNode<Predicate,
-                                         ExpressionType::kComparisonExpression,
-                                         ExpressionType::kExists,
-                                         ExpressionType::kInTableQuery,
-                                         ExpressionType::kInValueList,
-                                         ExpressionType::kLogicalAnd,
-                                         ExpressionType::kLogicalNot,
-                                         ExpressionType::kLogicalOr,
-                                         ExpressionType::kPredicateLiteral>;
-using SomePredicateLiteral = SomeExpressionNode<PredicateLiteral, 
ExpressionType::kPredicateLiteral>;
-using SomeScalar = SomeExpressionNode<Scalar,
-                                      ExpressionType::kAlias,
-                                      ExpressionType::kAttributeReference,
-                                      ExpressionType::kBinaryExpression,
-                                      ExpressionType::kCast,
-                                      ExpressionType::kComparisonExpression,
-                                      ExpressionType::kLogicalAnd,
-                                      ExpressionType::kLogicalNot,
-                                      ExpressionType::kLogicalOr,
-                                      ExpressionType::kPredicateLiteral,
-                                      ExpressionType::kScalarLiteral,
-                                      ExpressionType::kSearchedCase,
-                                      ExpressionType::kSimpleCase,
-                                      ExpressionType::kUnaryExpression>;
-using SomeScalarLiteral = SomeExpressionNode<ScalarLiteral, 
ExpressionType::kScalarLiteral>;
-using SomeUnaryExpression = SomeExpressionNode<UnaryExpression, 
ExpressionType::kUnaryExpression>;
-using SomeWindowAggregateFunction = SomeExpressionNode<WindowAggregateFunction,
-                                                       
ExpressionType::kWindowAggregateFunction>;
-
-using SomeAggregateFunction = SomeExpressionNode<AggregateFunction,
-                                                 
ExpressionType::kAggregateFunction>;
-
-/** @} */
-
-}  // namespace expressions
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_QUERY_OPTIMIZER_EXPRESSIONS_PATTERN_MATCHER_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/expressions/Predicate.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/Predicate.hpp 
b/query_optimizer/expressions/Predicate.hpp
deleted file mode 100644
index 444af6b..0000000
--- a/query_optimizer/expressions/Predicate.hpp
+++ /dev/null
@@ -1,91 +0,0 @@
-/**
- * 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_EXPRESSIONS_PREDICATE_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_EXPRESSIONS_PREDICATE_HPP_
-
-#include <memory>
-#include <unordered_map>
-
-#include "query_optimizer/expressions/ExprId.hpp"
-#include "query_optimizer/expressions/Expression.hpp"
-#include "types/Type.hpp"
-#include "types/TypeFactory.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-
-class CatalogAttribute;
-class Predicate;
-
-namespace optimizer {
-namespace expressions {
-
-/** \addtogroup OptimizerExpressions
- *  @{
- */
-
-class Predicate;
-typedef std::shared_ptr<const Predicate> PredicatePtr;
-
-/**
- * @brief Expression that returns boolean values.
- */
-class Predicate : public Expression {
- public:
-  /**
-   * @brief Destructor.
-   */
-  ~Predicate() override {}
-
-  const Type& getValueType() const override {
-    // The type system does not have a bool type, so we use non-nullable kInt
-    // instead.
-    return TypeFactory::GetType(kInt /* TypeID */,
-                                false /* nullable */);
-  }
-
-  /**
-   * @brief Returns a concretized predicate in the Quickstep execution
-   *        expression system with AttributeReferences replaced by
-   *        CatalogAttribute references provided in \p substitution_map.
-   * @note In the Quickstep execution expression system, Predicate is not 
Scalar
-           *type. We do not use concretize() for predicate concretization.
-   *
-   * @param substitution_map Map from ExprId to CatalogAttribute for use in
-   *                         replacing AttributeReference.
-   * @return A concretized predicate for evaluation.
-   */
-  virtual ::quickstep::Predicate* concretize(
-      const std::unordered_map<ExprId, const CatalogAttribute*>& 
substitution_map) const = 0;
-
- protected:
-  Predicate() {}
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(Predicate);
-};
-
-/** @} */
-
-}  // namespace expressions
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_QUERY_OPTIMIZER_EXPRESSIONS_PREDICATE_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/expressions/PredicateLiteral.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/PredicateLiteral.cpp 
b/query_optimizer/expressions/PredicateLiteral.cpp
deleted file mode 100644
index 724458e..0000000
--- a/query_optimizer/expressions/PredicateLiteral.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-/**
- * 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.
- **/
-
-#include "query_optimizer/expressions/PredicateLiteral.hpp"
-
-#include <string>
-#include <unordered_map>
-#include <vector>
-
-#include "expressions/predicate/TrivialPredicates.hpp"
-#include "query_optimizer/expressions/ExprId.hpp"
-#include "query_optimizer/expressions/Expression.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-namespace optimizer {
-namespace expressions {
-
-ExpressionPtr PredicateLiteral::copyWithNewChildren(
-    const std::vector<ExpressionPtr> &new_children) const {
-  DCHECK_EQ(new_children.size(), children().size());
-  return PredicateLiteral::Create(is_true_);
-}
-
-::quickstep::Predicate* PredicateLiteral::concretize(
-    const std::unordered_map<ExprId, const CatalogAttribute*> 
&substitution_map) const {
-  if (is_true()) {
-    return new TruePredicate();
-  } else {
-    return new FalsePredicate();
-  }
-}
-
-void PredicateLiteral::getFieldStringItems(
-    std::vector<std::string> *inline_field_names,
-    std::vector<std::string> *inline_field_values,
-    std::vector<std::string> *non_container_child_field_names,
-    std::vector<OptimizerTreeBaseNodePtr> *non_container_child_fields,
-    std::vector<std::string> *container_child_field_names,
-    std::vector<std::vector<OptimizerTreeBaseNodePtr>> 
*container_child_fields) const {
-  inline_field_names->push_back("value");
-  inline_field_values->push_back(is_true_ ? "true" : "false");
-}
-
-}  // namespace expressions
-}  // namespace optimizer
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/expressions/PredicateLiteral.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/PredicateLiteral.hpp 
b/query_optimizer/expressions/PredicateLiteral.hpp
deleted file mode 100644
index 234b6e1..0000000
--- a/query_optimizer/expressions/PredicateLiteral.hpp
+++ /dev/null
@@ -1,108 +0,0 @@
-/**
- * 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_EXPRESSIONS_PREDICATE_LITERAL_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_EXPRESSIONS_PREDICATE_LITERAL_HPP_
-
-#include <memory>
-#include <string>
-#include <unordered_map>
-#include <vector>
-
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "query_optimizer/expressions/ExprId.hpp"
-#include "query_optimizer/expressions/Expression.hpp"
-#include "query_optimizer/expressions/ExpressionType.hpp"
-#include "query_optimizer/expressions/Predicate.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-
-class CatalogAttribute;
-
-namespace optimizer {
-namespace expressions {
-
-/** \addtogroup OptimizerExpressions
- *  @{
- */
-
-class PredicateLiteral;
-typedef std::shared_ptr<const PredicateLiteral> PredicateLiteralPtr;
-
-/**
- * @brief A boolean true or false literal.
- */
-class PredicateLiteral : public Predicate {
- public:
-  ExpressionType getExpressionType() const override {
-    return ExpressionType::kPredicateLiteral;
-  }
-
-  std::string getName() const override { return "Literal"; }
-
-  bool isConstant() const override { return true; }
-
-  bool is_true() const { return is_true_; }
-
-  ExpressionPtr copyWithNewChildren(
-      const std::vector<ExpressionPtr> &new_children) const override;
-
-  std::vector<AttributeReferencePtr> getReferencedAttributes() const override {
-    return {};
-  }
-
-  ::quickstep::Predicate* concretize(
-      const std::unordered_map<ExprId, const CatalogAttribute*> 
&substitution_map) const override;
-
-  /**
-   * @brief Creates an immutable PredicateLiteral.
-   *
-   * @param is_true Indicates whether the value is true or false.
-   * @return An immutable PredicateLiteral with the given boolean value.
-   */
-  static PredicateLiteralPtr Create(bool is_true) {
-    return PredicateLiteralPtr(new PredicateLiteral(is_true));
-  }
-
- protected:
-  void getFieldStringItems(
-      std::vector<std::string> *inline_field_names,
-      std::vector<std::string> *inline_field_values,
-      std::vector<std::string> *non_container_child_field_names,
-      std::vector<OptimizerTreeBaseNodePtr> *non_container_child_fields,
-      std::vector<std::string> *container_child_field_names,
-      std::vector<std::vector<OptimizerTreeBaseNodePtr>> 
*container_child_fields) const override;
-
- private:
-  explicit PredicateLiteral(bool is_true) : is_true_(is_true) {}
-
-  bool is_true_;
-
-  DISALLOW_COPY_AND_ASSIGN(PredicateLiteral);
-};
-
-/** @} */
-
-}  // namespace expressions
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_QUERY_OPTIMIZER_EXPRESSIONS_PREDICATE_LITERAL_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/expressions/Scalar.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/Scalar.hpp 
b/query_optimizer/expressions/Scalar.hpp
deleted file mode 100644
index 4870118..0000000
--- a/query_optimizer/expressions/Scalar.hpp
+++ /dev/null
@@ -1,81 +0,0 @@
-/**
- * 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_EXPRESSIONS_SCALAR_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_EXPRESSIONS_SCALAR_HPP_
-
-#include <memory>
-#include <unordered_map>
-
-#include "query_optimizer/expressions/Expression.hpp"
-#include "query_optimizer/expressions/ExprId.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-
-class CatalogAttribute;
-class Scalar;
-
-namespace optimizer {
-namespace expressions {
-
-/** \addtogroup OptimizerExpressions
- *  @{
- */
-
-class Scalar;
-typedef std::shared_ptr<const Scalar> ScalarPtr;
-
-/**
- * @brief Scalar expression that returns a single value based on input values
- *        that are not across multiple rows in an input relation.
- */
-class Scalar : public Expression {
- public:
-  ~Scalar() override {}
-
-  /**
-   * @brief Converts this expression to an expression for evaluation (in
-   *        quickstep execution expressions system under /expressions)
-   *        with each attribute reference being replaced by a CatalogAttribute
-   *        reference provided in \p substitution_map.
-   *
-   * @param substitution_map Map from ExprId to CatalogAttribute for use in
-   *                         substituting CatalogAttribute for
-   *                         AttributeReference.
-   * @return Concretized expression for evaluation.
-   */
-  virtual ::quickstep::Scalar* concretize(
-      const std::unordered_map<ExprId, const CatalogAttribute*>& 
substitution_map)
-      const = 0;
-
- protected:
-  Scalar() {}
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(Scalar);
-};
-
-/** @} */
-
-}  // namespace expressions
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_QUERY_OPTIMIZER_EXPRESSIONS_SCALAR_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/expressions/ScalarLiteral.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/ScalarLiteral.cpp 
b/query_optimizer/expressions/ScalarLiteral.cpp
deleted file mode 100644
index d70c4cf..0000000
--- a/query_optimizer/expressions/ScalarLiteral.cpp
+++ /dev/null
@@ -1,74 +0,0 @@
-/**
- * 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.
- **/
-
-#include "query_optimizer/expressions/ScalarLiteral.hpp"
-
-#include <string>
-#include <unordered_map>
-#include <vector>
-
-#include "expressions/scalar/ScalarLiteral.hpp"
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "query_optimizer/expressions/ExprId.hpp"
-#include "query_optimizer/expressions/Expression.hpp"
-#include "types/Type.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-namespace optimizer {
-namespace expressions {
-
-const Type& ScalarLiteral::getValueType() const {
-  return value_type_;
-}
-
-ExpressionPtr ScalarLiteral::copyWithNewChildren(
-    const std::vector<ExpressionPtr> &new_children) const {
-  DCHECK_EQ(new_children.size(), children().size());
-  return ScalarLiteral::Create(value_, value_type_);
-}
-
-::quickstep::Scalar *ScalarLiteral::concretize(
-    const std::unordered_map<ExprId, const CatalogAttribute*> 
&substitution_map) const {
-  return new ::quickstep::ScalarLiteral(value_, value_type_);
-}
-
-void ScalarLiteral::getFieldStringItems(
-    std::vector<std::string> *inline_field_names,
-    std::vector<std::string> *inline_field_values,
-    std::vector<std::string> *non_container_child_field_names,
-    std::vector<OptimizerTreeBaseNodePtr> *non_container_child_fields,
-    std::vector<std::string> *container_child_field_names,
-    std::vector<std::vector<OptimizerTreeBaseNodePtr>> 
*container_child_fields) const {
-  inline_field_names->push_back("value");
-  if (value_.isNull()) {
-    inline_field_values->push_back("NULL");
-  } else {
-    inline_field_values->push_back(value_type_.printValueToString(value_));
-  }
-
-  inline_field_names->push_back("type");
-  inline_field_values->push_back(getValueType().getName());
-}
-
-}  // namespace expressions
-}  // namespace optimizer
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/expressions/ScalarLiteral.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/ScalarLiteral.hpp 
b/query_optimizer/expressions/ScalarLiteral.hpp
deleted file mode 100644
index 8ebc41c..0000000
--- a/query_optimizer/expressions/ScalarLiteral.hpp
+++ /dev/null
@@ -1,120 +0,0 @@
-/**
- * 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_EXPRESSIONS_SCALAR_LITERAL_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_EXPRESSIONS_SCALAR_LITERAL_HPP_
-
-#include <memory>
-#include <string>
-#include <unordered_map>
-#include <vector>
-
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "query_optimizer/expressions/ExprId.hpp"
-#include "query_optimizer/expressions/Expression.hpp"
-#include "query_optimizer/expressions/ExpressionType.hpp"
-#include "query_optimizer/expressions/Scalar.hpp"
-#include "types/TypedValue.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-
-class CatalogAttribute;
-class Type;
-
-namespace optimizer {
-namespace expressions {
-
-/** \addtogroup OptimizerExpressions
- *  @{
- */
-
-class ScalarLiteral;
-typedef std::shared_ptr<const ScalarLiteral> ScalarLiteralPtr;
-
-/**
- * @brief A non-boolean scalar literal.
- */
-class ScalarLiteral : public Scalar {
- public:
-  std::string getName() const override {
-    return "Literal";
-  }
-
-  ExpressionType getExpressionType() const override {
-    return ExpressionType::kScalarLiteral;
-  }
-
-  const Type& getValueType() const override;
-
-  bool isConstant() const override { return true; }
-
-  /**
-   * @return The literal value.
-   */
-  const TypedValue& value() const { return value_; }
-
-  ExpressionPtr copyWithNewChildren(
-      const std::vector<ExpressionPtr> &new_children) const override;
-
-  std::vector<AttributeReferencePtr> getReferencedAttributes() const override {
-    return {};
-  }
-
-  ::quickstep::Scalar* concretize(
-      const std::unordered_map<ExprId, const CatalogAttribute*> 
&substitution_map) const override;
-
-  /**
-   * @brief Creates an immutable ScalarLiteral.
-   * @param literal_value The literal value.
-   * @return An immutable ScalarLiteral with the given literal value.
-   */
-  static const ScalarLiteralPtr Create(const TypedValue &literal_value,
-                                       const Type &literal_value_type) {
-    return ScalarLiteralPtr(new ScalarLiteral(literal_value, 
literal_value_type));
-  }
-
- protected:
-  void getFieldStringItems(
-      std::vector<std::string> *inline_field_names,
-      std::vector<std::string> *inline_field_values,
-      std::vector<std::string> *non_container_child_field_names,
-      std::vector<OptimizerTreeBaseNodePtr> *non_container_child_fields,
-      std::vector<std::string> *container_child_field_names,
-      std::vector<std::vector<OptimizerTreeBaseNodePtr>> 
*container_child_fields) const override;
-
- private:
-  ScalarLiteral(const TypedValue &literal_value,
-                const Type &literal_value_type)
-      : value_(literal_value),
-        value_type_(literal_value_type) {}
-
-  const TypedValue value_;
-  const Type &value_type_;
-  DISALLOW_COPY_AND_ASSIGN(ScalarLiteral);
-};
-
-/** @} */
-
-}  // namespace expressions
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_QUERY_OPTIMIZER_EXPRESSIONS_SCALAR_LITERAL_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/expressions/SearchedCase.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/SearchedCase.cpp 
b/query_optimizer/expressions/SearchedCase.cpp
deleted file mode 100644
index 2de52c9..0000000
--- a/query_optimizer/expressions/SearchedCase.cpp
+++ /dev/null
@@ -1,166 +0,0 @@
-/**
- * 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.
- **/
-
-#include "query_optimizer/expressions/SearchedCase.hpp"
-
-#include <cstddef>
-#include <memory>
-#include <string>
-#include <utility>
-#include <vector>
-
-#include "expressions/predicate/Predicate.hpp"
-#include "expressions/scalar/ScalarCaseExpression.hpp"
-#include "expressions/scalar/ScalarLiteral.hpp"
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "query_optimizer/expressions/Expression.hpp"
-#include "query_optimizer/expressions/Predicate.hpp"
-#include "query_optimizer/expressions/Scalar.hpp"
-#include "types/Type.hpp"
-#include "utility/Cast.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-namespace optimizer {
-namespace expressions {
-
-bool SearchedCase::isConstant() const {
-  // We treat a SearchedCase as constant only if all operands are constant.
-  for (const PredicatePtr &condition_predicate : condition_predicates_) {
-    if (!condition_predicate->isConstant()) {
-      return false;
-    }
-  }
-  for (const ScalarPtr &conditional_result_expression : 
conditional_result_expressions_) {
-    if (!conditional_result_expression->isConstant()) {
-      return false;
-    }
-  }
-  return (else_result_expression_ == nullptr || 
else_result_expression_->isConstant());
-}
-
-std::vector<AttributeReferencePtr> SearchedCase::getReferencedAttributes() 
const {
-  std::vector<AttributeReferencePtr> referenced_attributes;
-  for (const PredicatePtr &condition_predicate : condition_predicates_) {
-    const std::vector<AttributeReferencePtr> 
referenced_attributes_in_condition_predicate =
-        condition_predicate->getReferencedAttributes();
-    referenced_attributes.insert(referenced_attributes.end(),
-                                 
referenced_attributes_in_condition_predicate.begin(),
-                                 
referenced_attributes_in_condition_predicate.end());
-  }
-  for (const ScalarPtr &conditional_result_expression : 
conditional_result_expressions_) {
-    const std::vector<AttributeReferencePtr> 
referenced_attributes_in_conditional_result_expression =
-        conditional_result_expression->getReferencedAttributes();
-    referenced_attributes.insert(referenced_attributes.end(),
-                                 
referenced_attributes_in_conditional_result_expression.begin(),
-                                 
referenced_attributes_in_conditional_result_expression.end());
-  }
-  if (else_result_expression_ != nullptr) {
-    const std::vector<AttributeReferencePtr> 
referenced_attributes_in_else_result_expression =
-        else_result_expression_->getReferencedAttributes();
-    referenced_attributes.insert(referenced_attributes.end(),
-                                 
referenced_attributes_in_else_result_expression.begin(),
-                                 
referenced_attributes_in_else_result_expression.end());
-  }
-  return referenced_attributes;
-}
-
-ExpressionPtr SearchedCase::copyWithNewChildren(
-    const std::vector<ExpressionPtr> &new_children) const {
-  DCHECK_EQ(getNumChildren(), new_children.size());
-
-  std::vector<PredicatePtr> new_condition_predicates;
-  std::vector<ScalarPtr> new_conditional_result_expressions;
-  ScalarPtr new_else_result_expression;
-
-  new_condition_predicates.reserve(condition_predicates_.size());
-  new_conditional_result_expressions.reserve(condition_predicates_.size());
-
-  std::size_t num_when_clauses = condition_predicates_.size();
-  for (std::size_t index = 0; index < num_when_clauses; ++index) {
-    new_condition_predicates.push_back(
-        std::static_pointer_cast<const Predicate>(new_children[index]));
-
-    new_conditional_result_expressions.push_back(
-        std::static_pointer_cast<const Scalar>(new_children[index + 
num_when_clauses]));
-  }
-  if (else_result_expression_ != nullptr) {
-    new_else_result_expression =
-        std::static_pointer_cast<const Scalar>(new_children.back());
-  }
-
-  return Create(new_condition_predicates,
-                new_conditional_result_expressions,
-                new_else_result_expression, value_type_);
-}
-
-::quickstep::Scalar* SearchedCase::concretize(
-    const std::unordered_map<ExprId, const CatalogAttribute*> 
&substitution_map) const {
-  std::vector<std::unique_ptr<quickstep::Predicate>> when_predicates;
-  for (const PredicatePtr &predicate : condition_predicates_) {
-    when_predicates.emplace_back(predicate->concretize(substitution_map));
-  }
-
-  std::vector<std::unique_ptr<quickstep::Scalar>> result_expressions;
-  for (const ScalarPtr &expression : conditional_result_expressions_) {
-    result_expressions.emplace_back(expression->concretize(substitution_map));
-  }
-
-  std::unique_ptr<quickstep::Scalar> else_result_expression;
-  if (else_result_expression_ == nullptr) {
-    else_result_expression.reset(
-        new quickstep::ScalarLiteral(value_type_.makeNullValue(), 
value_type_));
-  } else {
-    else_result_expression.reset(
-        else_result_expression_->concretize(substitution_map));
-  }
-
-  return new quickstep::ScalarCaseExpression(
-      value_type_,
-      std::move(when_predicates),
-      std::move(result_expressions),
-      else_result_expression_->concretize(substitution_map));
-}
-
-void SearchedCase::getFieldStringItems(
-    std::vector<std::string> *inline_field_names,
-    std::vector<std::string> *inline_field_values,
-    std::vector<std::string> *non_container_child_field_names,
-    std::vector<OptimizerTreeBaseNodePtr> *non_container_child_fields,
-    std::vector<std::string> *container_child_field_names,
-    std::vector<std::vector<OptimizerTreeBaseNodePtr>> 
*container_child_fields) const {
-  container_child_field_names->push_back("condition_perdicates");
-  container_child_fields->push_back(
-      CastSharedPtrVector<OptimizerTreeBase>(condition_predicates_));
-
-  container_child_field_names->push_back("conditional_result_expressions");
-  container_child_fields->push_back(
-      CastSharedPtrVector<OptimizerTreeBase>(conditional_result_expressions_));
-
-  if (else_result_expression_ != nullptr) {
-    non_container_child_field_names->push_back("else_result_expression");
-    non_container_child_fields->push_back(else_result_expression_);
-  }
-}
-
-}  // namespace expressions
-}  // namespace optimizer
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/expressions/SearchedCase.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/SearchedCase.hpp 
b/query_optimizer/expressions/SearchedCase.hpp
deleted file mode 100644
index 79c37a5..0000000
--- a/query_optimizer/expressions/SearchedCase.hpp
+++ /dev/null
@@ -1,172 +0,0 @@
-/**
- * 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_EXPRESSIONS_SEARCHED_CASE_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_EXPRESSIONS_SEARCHED_CASE_HPP_
-
-#include <memory>
-#include <string>
-#include <unordered_map>
-#include <vector>
-
-#include "expressions/scalar/Scalar.hpp"
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "query_optimizer/expressions/ExprId.hpp"
-#include "query_optimizer/expressions/Expression.hpp"
-#include "query_optimizer/expressions/ExpressionType.hpp"
-#include "query_optimizer/expressions/Predicate.hpp"
-#include "query_optimizer/expressions/Scalar.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-
-class CatalogAttribute;
-class Type;
-
-namespace optimizer {
-namespace expressions {
-
-/** \addtogroup OptimizerExpressions
- *  @{
- */
-
-class SearchedCase;
-typedef std::shared_ptr<const SearchedCase> SearchedCasePtr;
-
-/**
- * @brief A searched CASE expression. It searches the first predicate in
- *        <condition_predicates_> that evaluates to true and returns the value
- *        of the expression in <conditional_result_expressions_> at the same
- *        position; if none of <condition_predicates_> evaluate to true, 
returns
- *        the value of <else_result_expression_> when <else_result_expression_>
- *        is not NULL, otherwise returns NULL.
- */
-class SearchedCase : public Scalar {
- public:
-  ExpressionType getExpressionType() const override {
-    return ExpressionType::kSearchedCase;
-  }
-
-  std::string getName() const override {
-    return "SearchedCase";
-  }
-
-  const Type& getValueType() const override {
-    return value_type_;
-  }
-
-  /**
-   * @return The vector of condition predicates.
-   */
-  const std::vector<PredicatePtr>& condition_predicates() const {
-    return condition_predicates_;
-  }
-
-  /**
-   * @return The vector of conditional result expressions.
-   */
-  const std::vector<ScalarPtr>& conditional_result_expressions() const {
-    return conditional_result_expressions_;
-  }
-
-  /**
-   * @return The ELSE result expression.
-   */
-  const ScalarPtr& else_result_expression() const {
-    return else_result_expression_;
-  }
-
-  bool isConstant() const override;
-
-  std::vector<AttributeReferencePtr> getReferencedAttributes() const override;
-
-  ExpressionPtr copyWithNewChildren(
-      const std::vector<ExpressionPtr> &new_children) const override;
-
-  ::quickstep::Scalar* concretize(
-      const std::unordered_map<ExprId, const CatalogAttribute*>& 
substitution_map) const override;
-
-  /**
-   * @brief Creates an immutable SearchedCase.
-   *
-   * @param condition_predicates A vector of condition predicates.
-   * @param conditional_result_expressions A vector of result expressions, one
-   *        for each condition predicate.
-   * @param else_result_expression The optional ELSE expression.
-   * @param value_type The data type of this expression which should be the
-   *        unified type of all result expressions.
-   * @return An immutable SimpleCase.
-   */
-  static SearchedCasePtr Create(const std::vector<PredicatePtr> 
&condition_predicates,
-                                const std::vector<ScalarPtr> 
&conditional_result_expressions,
-                                const ScalarPtr &else_result_expression,
-                                const Type &value_type) {
-    return SearchedCasePtr(new SearchedCase(condition_predicates,
-                                            conditional_result_expressions,
-                                            else_result_expression,
-                                            value_type));
-  }
-
- protected:
-  void getFieldStringItems(std::vector<std::string> *inline_field_names,
-                           std::vector<std::string> *inline_field_values,
-                           std::vector<std::string> 
*non_container_child_field_names,
-                           std::vector<OptimizerTreeBaseNodePtr> 
*non_container_child_fields,
-                           std::vector<std::string> 
*container_child_field_names,
-                           std::vector<std::vector<OptimizerTreeBaseNodePtr>> 
*container_child_fields) const override;
-
- private:
-  SearchedCase(const std::vector<PredicatePtr> &condition_predicates,
-               const std::vector<ScalarPtr> &conditional_result_expressions,
-               const ScalarPtr &else_result_expression,
-               const Type &value_type)
-      : condition_predicates_(condition_predicates),
-        conditional_result_expressions_(conditional_result_expressions),
-        else_result_expression_(else_result_expression),
-        value_type_(value_type) {
-    for (const PredicatePtr &condition_predicate : condition_predicates_) {
-      addChild(condition_predicate);
-    }
-    for (const ScalarPtr &conditional_result_expression : 
conditional_result_expressions_) {
-      addChild(conditional_result_expression);
-    }
-    if (else_result_expression_ != nullptr) {
-      addChild(else_result_expression_);
-    }
-  }
-
-  std::vector<PredicatePtr> condition_predicates_;
-  std::vector<ScalarPtr> conditional_result_expressions_;
-
-  // May be NULL.
-  ScalarPtr else_result_expression_;
-
-  const Type &value_type_;
-
-  DISALLOW_COPY_AND_ASSIGN(SearchedCase);
-};
-
-/** @} */
-
-}  // namespace expressions
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_QUERY_OPTIMIZER_EXPRESSIONS_SEARCHED_CASE_HPP_ */

Reply via email to