You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@quickstep.apache.org by sp...@apache.org on 2016/12/11 17:45:24 UTC

[01/51] [abbrv] [partial] incubator-quickstep git commit: remove c++ files

Repository: incubator-quickstep
Updated Branches:
  refs/heads/gh-pages [created] 156290a4e


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/rules/GenerateJoins.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/rules/GenerateJoins.cpp b/query_optimizer/rules/GenerateJoins.cpp
deleted file mode 100644
index 2e5baf0..0000000
--- a/query_optimizer/rules/GenerateJoins.cpp
+++ /dev/null
@@ -1,491 +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/rules/GenerateJoins.hpp"
-
-#include <memory>
-#include <unordered_map>
-#include <utility>
-#include <vector>
-
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "query_optimizer/expressions/ComparisonExpression.hpp"
-#include "query_optimizer/expressions/ExpressionUtil.hpp"
-#include "query_optimizer/expressions/LogicalAnd.hpp"
-#include "query_optimizer/expressions/PatternMatcher.hpp"
-#include "query_optimizer/expressions/Predicate.hpp"
-#include "query_optimizer/logical/Filter.hpp"
-#include "query_optimizer/logical/HashJoin.hpp"
-#include "query_optimizer/logical/Logical.hpp"
-#include "query_optimizer/logical/MultiwayCartesianJoin.hpp"
-#include "query_optimizer/logical/NestedLoopsJoin.hpp"
-#include "query_optimizer/logical/PatternMatcher.hpp"
-#include "query_optimizer/rules/Rule.hpp"
-#include "query_optimizer/rules/RuleHelper.hpp"
-#include "types/operations/comparisons/ComparisonFactory.hpp"
-#include "types/operations/comparisons/ComparisonID.hpp"
-#include "utility/SqlError.hpp"
-#include "utility/VectorUtil.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-namespace optimizer {
-
-namespace E = ::quickstep::optimizer::expressions;
-namespace L = ::quickstep::optimizer::logical;
-
-typedef std::unordered_map<E::AttributeReferencePtr,
-                           L::LogicalPtr,
-                           E::NamedExpressionHash,
-                           E::NamedExpressionEqual> AttributeToLogicalMap;
-
-namespace {
-
-// Info for a hash join predicate.
-struct HashJoinPredicateInfo {
-  HashJoinPredicateInfo(const E::AttributeReferencePtr &left_attribute_in,
-                        const E::AttributeReferencePtr &right_attribute_in)
-      : left_join_attributes({left_attribute_in}),
-        right_join_attributes({right_attribute_in}) {}
-
-  std::vector<E::AttributeReferencePtr> left_join_attributes;
-  std::vector<E::AttributeReferencePtr> right_join_attributes;
-};
-
-typedef std::unordered_map<std::pair<L::LogicalPtr, L::LogicalPtr>,
-                           HashJoinPredicateInfo*> HashJoinPredicateInfoMap;
-
-// Info for a non-hash join predicate.
-struct NonHashJoinPredicateInfo {
-  explicit NonHashJoinPredicateInfo(const E::PredicatePtr &predicate_in)
-      : predicate(predicate_in),
-        referenced_attributes(predicate->getReferencedAttributes()) {}
-
-  // Returns true if the predicate is a binary predicate and returns the two
-  // referenced logical nodes in <updated_referenced_logical_list>.
-  // If the predicate involves only a single logical node, returns the node in
-  // <updated_referenced_logical_list>. Otherwise, <updated_referenced_logical_list>
-  // is empty.
-  bool isBinaryJoin(
-      const AttributeToLogicalMap &attribute_to_logical_map,
-      std::vector<L::LogicalPtr> *updated_referenced_logical_list) const {
-    for (const E::AttributeReferencePtr &referenced_attribute :
-         referenced_attributes) {
-      const AttributeToLogicalMap::const_iterator found_it =
-          attribute_to_logical_map.find(referenced_attribute);
-      DCHECK(found_it != attribute_to_logical_map.end());
-      if (AppendToVectorIfNotPresent(found_it->second,
-                                     updated_referenced_logical_list) &&
-          updated_referenced_logical_list->size() > 2u) {
-        updated_referenced_logical_list->clear();
-        return false;
-      }
-    }
-    return updated_referenced_logical_list->size() == 2u;
-  }
-
-  const E::PredicatePtr predicate;
-  const std::vector<E::AttributeReferencePtr> referenced_attributes;
-};
-
-// Maps the output attributes of <logical_operator> to <logical_operator>.
-void MapAttributeToLogical(const L::LogicalPtr &logical_operator,
-                           AttributeToLogicalMap *attribute_to_logical_map) {
-  for (const E::AttributeReferencePtr &output_attribute :
-       logical_operator->getOutputAttributes()) {
-    (*attribute_to_logical_map)[output_attribute] = logical_operator;
-  }
-}
-
-// Generates n-1 NestedLoopsJoin with an empty predicate to combine all n
-// logical nodes in <inputs>.
-template <class Container>
-L::LogicalPtr MaybeGenerateNestedLoopsCartesianJoin(const Container &inputs) {
-  typename Container::const_iterator non_joined_logical_it = inputs.begin();
-  L::LogicalPtr output = *non_joined_logical_it;
-  ++non_joined_logical_it;
-  while (non_joined_logical_it != inputs.end()) {
-    output = L::NestedLoopsJoin::Create(output,
-                                        *non_joined_logical_it,
-                                        E::PredicatePtr());
-    ++non_joined_logical_it;
-  }
-  return output;
-}
-
-// Classifies the predicates in <predicates> into hash join predicates and
-// non-hash join predicates.
-void ClassifyPredicates(
-    const std::vector<E::PredicatePtr> &predicates,
-    const AttributeToLogicalMap &attribute_to_logical_map,
-    std::vector<std::unique_ptr<const HashJoinPredicateInfo>> *hash_join_predicates,
-    std::vector<std::unique_ptr<const NonHashJoinPredicateInfo>> *non_hash_join_predicates) {
-  DCHECK(hash_join_predicates->empty());
-  DCHECK(non_hash_join_predicates->empty());
-
-  HashJoinPredicateInfoMap hash_join_predicate_map;
-  for (const E::PredicatePtr &predicate : predicates) {
-    E::ComparisonExpressionPtr comparison_predicate;
-    bool is_hash_join_predicate = false;
-
-    // Determine whether it is a hash join predicate which should be an equality
-    // predicate between two attribute references.
-    if (E::SomeComparisonExpression::MatchesWithConditionalCast(predicate,
-                                                                &comparison_predicate)) {
-      E::AttributeReferencePtr left_attribute_reference;
-      E::AttributeReferencePtr right_attribute_reference;
-      if (comparison_predicate->isEqualityComparisonPredicate() &&
-          E::SomeAttributeReference::MatchesWithConditionalCast(comparison_predicate->left(),
-                                                                &left_attribute_reference) &&
-          E::SomeAttributeReference::MatchesWithConditionalCast(comparison_predicate->right(),
-                                                                &right_attribute_reference)) {
-        AttributeToLogicalMap::const_iterator left_logical_it =
-            attribute_to_logical_map.find(left_attribute_reference);
-        AttributeToLogicalMap::const_iterator right_logical_it =
-            attribute_to_logical_map.find(right_attribute_reference);
-
-        if (left_logical_it->second != right_logical_it->second) {
-          // Update join attributes if we have added the logical pair.
-          const std::pair<L::LogicalPtr, L::LogicalPtr> logical_pair(left_logical_it->second,
-                                                                     right_logical_it->second);
-          const HashJoinPredicateInfoMap::iterator predicate_it =
-              hash_join_predicate_map.find(logical_pair);
-          if (predicate_it != hash_join_predicate_map.end()) {
-            predicate_it->second->left_join_attributes.emplace_back(left_attribute_reference);
-            predicate_it->second->right_join_attributes.emplace_back(right_attribute_reference);
-          } else {
-            const std::pair<L::LogicalPtr, L::LogicalPtr> reversed_logical_pair(right_logical_it->second,
-                                                                                left_logical_it->second);
-            const HashJoinPredicateInfoMap::iterator reversed_predicate_it =
-                hash_join_predicate_map.find(reversed_logical_pair);
-            if (reversed_predicate_it != hash_join_predicate_map.end()) {
-              reversed_predicate_it->second->left_join_attributes.emplace_back(right_attribute_reference);
-              reversed_predicate_it->second->right_join_attributes.emplace_back(left_attribute_reference);
-            } else {
-              // Create a new logical pair.
-              std::unique_ptr<HashJoinPredicateInfo> hash_join_predicate(
-                  new HashJoinPredicateInfo(left_attribute_reference,
-                                            right_attribute_reference));
-              hash_join_predicate_map.emplace(
-                  std::piecewise_construct,
-                  std::forward_as_tuple(left_logical_it->second,
-                                        right_logical_it->second),
-                  std::forward_as_tuple(hash_join_predicate.get()));
-              hash_join_predicates->emplace_back(hash_join_predicate.release());
-            }
-          }
-          is_hash_join_predicate = true;
-        }
-      }
-    }
-
-    // Add it to <non_hash_join_predicates> if it is not a hash join predicate.
-    if (!is_hash_join_predicate) {
-      non_hash_join_predicates->emplace_back(
-          new NonHashJoinPredicateInfo(predicate));
-    }
-  }
-}
-
-// Removes <left_logical> and <right_logical> from <logical_vec> and adds
-// <logical_join> into it.
-void UpdateLogicalVectors(const L::LogicalPtr &left_logical,
-                          const L::LogicalPtr &right_logical,
-                          const L::LogicalPtr &logical_join,
-                          std::vector<L::LogicalPtr> *logical_vec) {
-  int num_removed_logical = 0;
-  for (std::vector<L::LogicalPtr>::iterator logical_it =
-           logical_vec->begin();
-       logical_it != logical_vec->end();) {
-    if (*logical_it == left_logical || *logical_it == right_logical) {
-      logical_it = logical_vec->erase(logical_it);
-      ++num_removed_logical;
-      if (num_removed_logical == 2) {
-        break;
-      }
-    } else {
-      ++logical_it;
-    }
-  }
-  logical_vec->push_back(logical_join);
-}
-
-// Creates a nested loops join between <left_logical> and <right_logical>,
-// updates the vector of unjoined logical nodes <unjoined_logical_vec>
-// and the map from attributes to unjoined logical nodes <attribute_logical_map>.
-// Note that we do not pass references for the first two arguments because they
-// may come from the fourth argument which is subject to change.
-void AddNestedLoopsJoin(const L::LogicalPtr left_logical,
-                        const L::LogicalPtr right_logical,
-                        const E::PredicatePtr &predicate,
-                        std::vector<L::LogicalPtr> *unjoined_logical_vec,
-                        AttributeToLogicalMap *attribute_logical_map) {
-  const L::LogicalPtr join_logical =
-      L::NestedLoopsJoin::Create(left_logical, right_logical, predicate);
-  UpdateLogicalVectors(left_logical, right_logical, join_logical,
-                       unjoined_logical_vec);
-  MapAttributeToLogical(join_logical, attribute_logical_map);
-}
-
-}  // namespace
-
-L::LogicalPtr GenerateJoins::applyToNode(const L::LogicalPtr &input) {
-  L::FilterPtr filter;
-  L::MultiwayCartesianJoinPtr cartesian_join;
-  L::HashJoinPtr hash_join;
-
-  // Merge filter predicates with cartesian joins to generate NestedLoopsJoin or
-  // HashJoin.
-  // TODO(qzeng): Maybe pull up MultiwayCartesianJoin first if there are
-  // multiple MultiwayCartesianJoin and generate joins holistically for
-  // all MultiwayCartesianJoin nodes. It have some benefits when tables in
-  // the nested queries can only be hash joined with outer query tables.
-  // However the case can be deemed as rare and it is low priority.
-  if (L::SomeFilter::MatchesWithConditionalCast(input, &filter) &&
-      L::SomeMultiwayCartesianJoin::MatchesWithConditionalCast(filter->input(), &cartesian_join)) {
-    const std::vector<L::LogicalPtr> join_inputs = cartesian_join->children();
-    // Logical nodes that have not participated in a join.
-    std::vector<L::LogicalPtr> non_joined_logical_list(join_inputs.begin(),
-                                                       join_inputs.end());
-
-    // Map from each attribute to the logical node that outputs the attribute.
-    AttributeToLogicalMap attribute_to_logical_map;
-    // Populate <attribute_to_logical_map>.
-    for (const L::LogicalPtr &join_input : join_inputs) {
-      MapAttributeToLogical(join_input, &attribute_to_logical_map);
-    }
-
-    std::vector<std::unique_ptr<const HashJoinPredicateInfo>>
-        hash_join_predicates;
-    std::vector<std::unique_ptr<const NonHashJoinPredicateInfo>>
-        non_hash_join_predicates;
-    // Classify the predicates in Filter to either hash join predicates or non
-    // hash join predicates.
-    ClassifyPredicates(GetConjunctivePredicates(filter->filter_predicate()),
-                       attribute_to_logical_map,
-                       &hash_join_predicates,
-                       &non_hash_join_predicates);
-
-    // The predicates that are not used in any joins.
-    std::vector<E::PredicatePtr> filter_predicates;
-
-    // First, create an inner HashJoin for each hash join predicate in the order
-    // as specified in the query.
-    for (const std::unique_ptr<const HashJoinPredicateInfo> &
-             hash_join_predicate_info : hash_join_predicates) {
-      const L::LogicalPtr left_logical =
-          attribute_to_logical_map[hash_join_predicate_info->left_join_attributes[0]];
-      const L::LogicalPtr right_logical =
-          attribute_to_logical_map[hash_join_predicate_info->right_join_attributes[0]];
-      DCHECK(left_logical != nullptr);
-      DCHECK(right_logical != nullptr);
-
-      if (left_logical != right_logical) {
-        L::LogicalPtr logical_join = L::HashJoin::Create(
-            left_logical,
-            right_logical,
-            hash_join_predicate_info->left_join_attributes,
-            hash_join_predicate_info->right_join_attributes,
-            nullptr /* residual_predicate */,
-            L::HashJoin::JoinType::kInnerJoin);
-        UpdateLogicalVectors(left_logical,
-                             right_logical,
-                             logical_join,
-                             &non_joined_logical_list);
-        MapAttributeToLogical(logical_join, &attribute_to_logical_map);
-      } else {
-        std::vector<E::PredicatePtr> equality_predicates;
-        for (std::vector<E::AttributeReferencePtr>::size_type attr_idx = 0;
-             attr_idx < hash_join_predicate_info->left_join_attributes.size();
-             ++attr_idx) {
-          filter_predicates.emplace_back(
-              E::ComparisonExpression::Create(ComparisonFactory::GetComparison(ComparisonID::kEqual),
-                                              hash_join_predicate_info->left_join_attributes[attr_idx],
-                                              hash_join_predicate_info->right_join_attributes[attr_idx]));
-        }
-      }
-    }
-
-    // Second, add NestedLoopsJoin until there is no join predicates left. The
-    // loop is guaranteed to be terminated, since each iteration will eliminate
-    // at least one predicate.
-    while (!non_hash_join_predicates.empty()) {
-      bool has_new_join = false;
-      std::vector<std::unique_ptr<const NonHashJoinPredicateInfo>>
-          new_non_hash_join_predicates;
-      for (std::unique_ptr<const NonHashJoinPredicateInfo> &non_hash_join_predicate : non_hash_join_predicates) {
-        std::vector<L::LogicalPtr> referenced_logical_list;
-
-        // 1. If the join predicate is binary, join the two referenced logical
-        //    nodes.
-        // 2. If the join predicate involves more than two logical nodes, keep
-        //    it in <new_non_hash_join_predicates> for consideration in the next iteration.
-        // 3. If the join predicate can be applied to exactly one logical node,
-        //    add it to unused_predicates which will be later added into a Filter.
-        if (non_hash_join_predicate->isBinaryJoin(attribute_to_logical_map,
-                                                  &referenced_logical_list)) {
-          AddNestedLoopsJoin(
-              referenced_logical_list[0],
-              referenced_logical_list[1],
-              non_hash_join_predicate->predicate,
-              &non_joined_logical_list,
-              &attribute_to_logical_map);
-          has_new_join = true;
-        } else if (!referenced_logical_list.empty()) {
-          DCHECK_EQ(referenced_logical_list.size(), 1u);
-          filter_predicates.push_back(non_hash_join_predicate->predicate);
-        } else {
-          new_non_hash_join_predicates.emplace_back(
-              non_hash_join_predicate.release());
-        }
-      }
-
-      // Update non_hash_join_predicates with new_non_hash_join_predicate for
-      // use in the next iteration.
-      non_hash_join_predicates.clear();
-      for (std::unique_ptr<const NonHashJoinPredicateInfo> &new_non_hash_join_predicate :
-           new_non_hash_join_predicates) {
-        non_hash_join_predicates.emplace_back(
-            new_non_hash_join_predicate.release());
-      }
-
-      // If we did not find a binary join predicate, join the first two logical
-      // nodes in <non_joined_logical_list>.
-      if (!has_new_join && non_joined_logical_list.size() >= 2u) {
-        AddNestedLoopsJoin(non_joined_logical_list[0],
-                           non_joined_logical_list[1],
-                           E::PredicatePtr(),
-                           &non_joined_logical_list,
-                           &attribute_to_logical_map);
-      }
-    }
-
-    DCHECK(non_hash_join_predicates.empty());
-    // Assert that there must be one remaining logical node.
-    DCHECK(!non_joined_logical_list.empty());
-
-    // Cross product all remaining logical nodes.
-    L::LogicalPtr output = MaybeGenerateNestedLoopsCartesianJoin(non_joined_logical_list);
-
-    if (!filter_predicates.empty()) {
-      output = L::Filter::Create(output, filter_predicates);
-    }
-
-    LOG_APPLYING_RULE(input, output);
-    return output;
-  } else if (L::SomeMultiwayCartesianJoin::MatchesWithConditionalCast(input, &cartesian_join)) {
-    // If there is no filter upon the cartesian join node, convert it to nested
-    // loop cartesian joins.
-    L::LogicalPtr output = MaybeGenerateNestedLoopsCartesianJoin(cartesian_join->operands());
-    LOG_APPLYING_RULE(input, output);
-    return output;
-  } else if (L::SomeHashJoin::MatchesWithConditionalCast(input, &hash_join) &&
-             hash_join->join_type() == L::HashJoin::JoinType::kLeftOuterJoin) {
-    L::LogicalPtr left_logical = hash_join->left();
-    L::LogicalPtr right_logical = hash_join->right();
-
-    const std::vector<E::AttributeReferencePtr> left_relation_attributes =
-        left_logical->getOutputAttributes();
-    const std::vector<E::AttributeReferencePtr> right_relation_attributes =
-        right_logical->getOutputAttributes();
-
-    DCHECK(hash_join->residual_predicate() != nullptr);
-    const std::vector<E::PredicatePtr> on_predicate_items =
-        GetConjunctivePredicates(hash_join->residual_predicate());
-
-    std::vector<E::AttributeReferencePtr> left_join_attributes;
-    std::vector<E::AttributeReferencePtr> right_join_attributes;
-    std::vector<E::PredicatePtr> left_filter_predicates;
-    std::vector<E::PredicatePtr> right_filter_predicates;
-
-    for (const E::PredicatePtr &predicate_item : on_predicate_items) {
-      std::vector<E::AttributeReferencePtr> referenced_attrs =
-          predicate_item->getReferencedAttributes();
-
-      if (E::SubsetOfExpressions(referenced_attrs, left_relation_attributes)) {
-        // The predicate refers attributes only from the left relation.
-        left_filter_predicates.emplace_back(predicate_item);
-      } else if (E::SubsetOfExpressions(referenced_attrs, right_relation_attributes)) {
-        // The predicate refers attributes only from the right relation.
-        right_filter_predicates.emplace_back(predicate_item);
-      } else {
-        // The predicate refers attributes from both relations.
-        //
-        // NOTE(jianqiao): In this case, since currently in the backend we do not
-        // support residual predicates for hash outer joins, so the predicate can
-        // only be an equal comparison between two attributes (one from left and
-        // one from right).
-        E::ComparisonExpressionPtr comp_expr;
-        if (E::SomeComparisonExpression::MatchesWithConditionalCast(predicate_item,
-                                                                    &comp_expr)) {
-          E::AttributeReferencePtr left_attr;
-          E::AttributeReferencePtr right_attr;
-          if (comp_expr->isEqualityComparisonPredicate() &&
-              E::SomeAttributeReference::MatchesWithConditionalCast(comp_expr->left(), &left_attr) &&
-              E::SomeAttributeReference::MatchesWithConditionalCast(comp_expr->right(), &right_attr)) {
-            if (E::ContainsExpression(left_relation_attributes, left_attr)) {
-              DCHECK(E::ContainsExpression(right_relation_attributes, right_attr));
-
-              left_join_attributes.emplace_back(left_attr);
-              right_join_attributes.emplace_back(right_attr);
-            } else {
-              DCHECK(E::ContainsExpression(left_relation_attributes, right_attr));
-              DCHECK(E::ContainsExpression(right_relation_attributes, left_attr));
-
-              left_join_attributes.emplace_back(right_attr);
-              right_join_attributes.emplace_back(left_attr);
-            }
-          } else {
-            THROW_SQL_ERROR() << "Join predicate for outer joins must be an "
-                              << "equality comparison between attributes";
-          }
-        } else {
-          THROW_SQL_ERROR() << "Non-equality join predicate is not allowed for outer joins";
-        }
-      }
-    }
-
-    if (!left_filter_predicates.empty()) {
-        // NOTE(jianqiao): Filter predicates on left table cannot be pushed down
-        // but can be treated as residual predicates once we have support for that.
-        THROW_SQL_ERROR() << "Filter predicates on left table is not allowed for outer joins";
-    }
-
-    if (!right_filter_predicates.empty()) {
-      const E::PredicatePtr right_predicate =
-          (right_filter_predicates.size() == 1u ? right_filter_predicates[0]
-                                                : E::LogicalAnd::Create(right_filter_predicates));
-      right_logical = L::Filter::Create(right_logical, right_predicate);
-    }
-
-    return L::HashJoin::Create(left_logical,
-                               right_logical,
-                               left_join_attributes,
-                               right_join_attributes,
-                               nullptr /* residual_predicate */,
-                               L::HashJoin::JoinType::kLeftOuterJoin);
-  }
-
-  LOG_IGNORING_RULE(input);
-  return input;
-}
-
-}  // namespace optimizer
-}  // namespace quickstep


[49/51] [abbrv] [partial] incubator-quickstep git commit: remove c++ files

Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/Doxyfile
----------------------------------------------------------------------
diff --git a/Doxyfile b/Doxyfile
deleted file mode 100644
index c010927..0000000
--- a/Doxyfile
+++ /dev/null
@@ -1,2280 +0,0 @@
-# Doxyfile 1.8.5
-
-# This file describes the settings to be used by the documentation system
-# doxygen (www.doxygen.org) for a project.
-#
-# All text after a double hash (##) is considered a comment and is placed in
-# front of the TAG it is preceding.
-#
-# All text after a single hash (#) is considered a comment and will be ignored.
-# The format is:
-# TAG = value [value, ...]
-# For lists, items can also be appended using:
-# TAG += value [value, ...]
-# Values that contain spaces should be placed between quotes (\" \").
-
-#---------------------------------------------------------------------------
-# Project related configuration options
-#---------------------------------------------------------------------------
-
-# This tag specifies the encoding used for all characters in the config file
-# that follow. The default is UTF-8 which is also the encoding used for all text
-# before the first occurrence of this tag. Doxygen uses libiconv (or the iconv
-# built into libc) for the transcoding. See http://www.gnu.org/software/libiconv
-# for the list of possible encodings.
-# The default value is: UTF-8.
-
-DOXYFILE_ENCODING      = UTF-8
-
-# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by
-# double-quotes, unless you are using Doxywizard) that should identify the
-# project for which the documentation is generated. This name is used in the
-# title of most generated pages and in a few other places.
-# The default value is: My Project.
-
-PROJECT_NAME           = "Quickstep"
-
-# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
-# could be handy for archiving the generated documentation or if some version
-# control system is used.
-
-PROJECT_NUMBER         =
-
-# Using the PROJECT_BRIEF tag one can provide an optional one line description
-# for a project that appears at the top of each page and should give viewer a
-# quick idea about the purpose of the project. Keep the description short.
-
-PROJECT_BRIEF          = "Data @ Bare-Metal Speed"
-
-# With the PROJECT_LOGO tag one can specify an logo or icon that is included in
-# the documentation. The maximum height of the logo should not exceed 55 pixels
-# and the maximum width should not exceed 200 pixels. Doxygen will copy the logo
-# to the output directory.
-
-PROJECT_LOGO           =
-
-# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path
-# into which the generated documentation will be written. If a relative path is
-# entered, it will be relative to the location where doxygen was started. If
-# left blank the current directory will be used.
-
-OUTPUT_DIRECTORY       =
-
-# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create 4096 sub-
-# directories (in 2 levels) under the output directory of each output format and
-# will distribute the generated files over these directories. Enabling this
-# option can be useful when feeding doxygen a huge amount of source files, where
-# putting all generated files in the same directory would otherwise causes
-# performance problems for the file system.
-# The default value is: NO.
-
-CREATE_SUBDIRS         = NO
-
-# The OUTPUT_LANGUAGE tag is used to specify the language in which all
-# documentation generated by doxygen is written. Doxygen will use this
-# information to generate all constant output in the proper language.
-# Possible values are: Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-
-# Traditional, Croatian, Czech, Danish, Dutch, English, Esperanto, Farsi,
-# Finnish, French, German, Greek, Hungarian, Italian, Japanese, Japanese-en,
-# Korean, Korean-en, Latvian, Norwegian, Macedonian, Persian, Polish,
-# Portuguese, Romanian, Russian, Serbian, Slovak, Slovene, Spanish, Swedish,
-# Turkish, Ukrainian and Vietnamese.
-# The default value is: English.
-
-OUTPUT_LANGUAGE        = English
-
-# If the BRIEF_MEMBER_DESC tag is set to YES doxygen will include brief member
-# descriptions after the members that are listed in the file and class
-# documentation (similar to Javadoc). Set to NO to disable this.
-# The default value is: YES.
-
-BRIEF_MEMBER_DESC      = YES
-
-# If the REPEAT_BRIEF tag is set to YES doxygen will prepend the brief
-# description of a member or function before the detailed description
-#
-# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
-# brief descriptions will be completely suppressed.
-# The default value is: YES.
-
-REPEAT_BRIEF           = YES
-
-# This tag implements a quasi-intelligent brief description abbreviator that is
-# used to form the text in various listings. Each string in this list, if found
-# as the leading text of the brief description, will be stripped from the text
-# and the result, after processing the whole list, is used as the annotated
-# text. Otherwise, the brief description is used as-is. If left blank, the
-# following values are used ($name is automatically replaced with the name of
-# the entity):The $name class, The $name widget, The $name file, is, provides,
-# specifies, contains, represents, a, an and the.
-
-ABBREVIATE_BRIEF       =
-
-# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
-# doxygen will generate a detailed section even if there is only a brief
-# description.
-# The default value is: NO.
-
-ALWAYS_DETAILED_SEC    = NO
-
-# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
-# inherited members of a class in the documentation of that class as if those
-# members were ordinary class members. Constructors, destructors and assignment
-# operators of the base classes will not be shown.
-# The default value is: NO.
-
-INLINE_INHERITED_MEMB  = YES
-
-# If the FULL_PATH_NAMES tag is set to YES doxygen will prepend the full path
-# before files name in the file list and in the header files. If set to NO the
-# shortest path that makes the file name unique will be used
-# The default value is: YES.
-
-FULL_PATH_NAMES        = YES
-
-# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path.
-# Stripping is only done if one of the specified strings matches the left-hand
-# part of the path. The tag can be used to show relative paths in the file list.
-# If left blank the directory from which doxygen is run is used as the path to
-# strip.
-#
-# Note that you can specify absolute paths here, but also relative paths, which
-# will be relative from the directory where doxygen is started.
-# This tag requires that the tag FULL_PATH_NAMES is set to YES.
-
-STRIP_FROM_PATH        =
-
-# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the
-# path mentioned in the documentation of a class, which tells the reader which
-# header file to include in order to use a class. If left blank only the name of
-# the header file containing the class definition is used. Otherwise one should
-# specify the list of include paths that are normally passed to the compiler
-# using the -I flag.
-
-STRIP_FROM_INC_PATH    =
-
-# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but
-# less readable) file names. This can be useful is your file systems doesn't
-# support long names like on DOS, Mac, or CD-ROM.
-# The default value is: NO.
-
-SHORT_NAMES            = NO
-
-# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the
-# first line (until the first dot) of a Javadoc-style comment as the brief
-# description. If set to NO, the Javadoc-style will behave just like regular Qt-
-# style comments (thus requiring an explicit @brief command for a brief
-# description.)
-# The default value is: NO.
-
-JAVADOC_AUTOBRIEF      = NO
-
-# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first
-# line (until the first dot) of a Qt-style comment as the brief description. If
-# set to NO, the Qt-style will behave just like regular Qt-style comments (thus
-# requiring an explicit \brief command for a brief description.)
-# The default value is: NO.
-
-QT_AUTOBRIEF           = NO
-
-# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a
-# multi-line C++ special comment block (i.e. a block of //! or /// comments) as
-# a brief description. This used to be the default behavior. The new default is
-# to treat a multi-line C++ comment block as a detailed description. Set this
-# tag to YES if you prefer the old behavior instead.
-#
-# Note that setting this tag to YES also means that rational rose comments are
-# not recognized any more.
-# The default value is: NO.
-
-MULTILINE_CPP_IS_BRIEF = NO
-
-# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the
-# documentation from any documented member that it re-implements.
-# The default value is: YES.
-
-INHERIT_DOCS           = YES
-
-# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce a
-# new page for each member. If set to NO, the documentation of a member will be
-# part of the file/class/namespace that contains it.
-# The default value is: NO.
-
-SEPARATE_MEMBER_PAGES  = NO
-
-# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen
-# uses this value to replace tabs by spaces in code fragments.
-# Minimum value: 1, maximum value: 16, default value: 4.
-
-TAB_SIZE               = 4
-
-# This tag can be used to specify a number of aliases that act as commands in
-# the documentation. An alias has the form:
-# name=value
-# For example adding
-# "sideeffect=@par Side Effects:\n"
-# will allow you to put the command \sideeffect (or @sideeffect) in the
-# documentation, which will result in a user-defined paragraph with heading
-# "Side Effects:". You can put \n's in the value part of an alias to insert
-# newlines.
-
-ALIASES                =
-
-# This tag can be used to specify a number of word-keyword mappings (TCL only).
-# A mapping has the form "name=value". For example adding "class=itcl::class"
-# will allow you to use the command class in the itcl::class meaning.
-
-TCL_SUBST              =
-
-# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources
-# only. Doxygen will then generate output that is more tailored for C. For
-# instance, some of the names that are used will be different. The list of all
-# members will be omitted, etc.
-# The default value is: NO.
-
-OPTIMIZE_OUTPUT_FOR_C  = NO
-
-# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or
-# Python sources only. Doxygen will then generate output that is more tailored
-# for that language. For instance, namespaces will be presented as packages,
-# qualified scopes will look different, etc.
-# The default value is: NO.
-
-OPTIMIZE_OUTPUT_JAVA   = NO
-
-# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
-# sources. Doxygen will then generate output that is tailored for Fortran.
-# The default value is: NO.
-
-OPTIMIZE_FOR_FORTRAN   = NO
-
-# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
-# sources. Doxygen will then generate output that is tailored for VHDL.
-# The default value is: NO.
-
-OPTIMIZE_OUTPUT_VHDL   = NO
-
-# Doxygen selects the parser to use depending on the extension of the files it
-# parses. With this tag you can assign which parser to use for a given
-# extension. Doxygen has a built-in mapping, but you can override or extend it
-# using this tag. The format is ext=language, where ext is a file extension, and
-# language is one of the parsers supported by doxygen: IDL, Java, Javascript,
-# C#, C, C++, D, PHP, Objective-C, Python, Fortran, VHDL. For instance to make
-# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C
-# (default is Fortran), use: inc=Fortran f=C.
-#
-# Note For files without extension you can use no_extension as a placeholder.
-#
-# Note that for custom extensions you also need to set FILE_PATTERNS otherwise
-# the files are not read by doxygen.
-
-EXTENSION_MAPPING      =
-
-# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments
-# according to the Markdown format, which allows for more readable
-# documentation. See http://daringfireball.net/projects/markdown/ for details.
-# The output of markdown processing is further processed by doxygen, so you can
-# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in
-# case of backward compatibilities issues.
-# The default value is: YES.
-
-MARKDOWN_SUPPORT       = YES
-
-# When enabled doxygen tries to link words that correspond to documented
-# classes, or namespaces to their corresponding documentation. Such a link can
-# be prevented in individual cases by by putting a % sign in front of the word
-# or globally by setting AUTOLINK_SUPPORT to NO.
-# The default value is: YES.
-
-AUTOLINK_SUPPORT       = YES
-
-# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
-# to include (a tag file for) the STL sources as input, then you should set this
-# tag to YES in order to let doxygen match functions declarations and
-# definitions whose arguments contain STL classes (e.g. func(std::string);
-# versus func(std::string) {}). This also make the inheritance and collaboration
-# diagrams that involve STL classes more complete and accurate.
-# The default value is: NO.
-
-BUILTIN_STL_SUPPORT    = YES
-
-# If you use Microsoft's C++/CLI language, you should set this option to YES to
-# enable parsing support.
-# The default value is: NO.
-
-CPP_CLI_SUPPORT        = NO
-
-# Set the SIP_SUPPORT tag to YES if your project consists of sip (see:
-# http://www.riverbankcomputing.co.uk/software/sip/intro) sources only. Doxygen
-# will parse them like normal C++ but will assume all classes use public instead
-# of private inheritance when no explicit protection keyword is present.
-# The default value is: NO.
-
-SIP_SUPPORT            = NO
-
-# For Microsoft's IDL there are propget and propput attributes to indicate
-# getter and setter methods for a property. Setting this option to YES will make
-# doxygen to replace the get and set methods by a property in the documentation.
-# This will only work if the methods are indeed getting or setting a simple
-# type. If this is not the case, or you want to show the methods anyway, you
-# should set this option to NO.
-# The default value is: YES.
-
-IDL_PROPERTY_SUPPORT   = YES
-
-# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
-# tag is set to YES, then doxygen will reuse the documentation of the first
-# member in the group (if any) for the other members of the group. By default
-# all members of a group must be documented explicitly.
-# The default value is: NO.
-
-DISTRIBUTE_GROUP_DOC   = NO
-
-# Set the SUBGROUPING tag to YES to allow class member groups of the same type
-# (for instance a group of public functions) to be put as a subgroup of that
-# type (e.g. under the Public Functions section). Set it to NO to prevent
-# subgrouping. Alternatively, this can be done per class using the
-# \nosubgrouping command.
-# The default value is: YES.
-
-SUBGROUPING            = YES
-
-# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions
-# are shown inside the group in which they are included (e.g. using \ingroup)
-# instead of on a separate page (for HTML and Man pages) or section (for LaTeX
-# and RTF).
-#
-# Note that this feature does not work in combination with
-# SEPARATE_MEMBER_PAGES.
-# The default value is: NO.
-
-INLINE_GROUPED_CLASSES = NO
-
-# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions
-# with only public data fields or simple typedef fields will be shown inline in
-# the documentation of the scope in which they are defined (i.e. file,
-# namespace, or group documentation), provided this scope is documented. If set
-# to NO, structs, classes, and unions are shown on a separate page (for HTML and
-# Man pages) or section (for LaTeX and RTF).
-# The default value is: NO.
-
-INLINE_SIMPLE_STRUCTS  = NO
-
-# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or
-# enum is documented as struct, union, or enum with the name of the typedef. So
-# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
-# with name TypeT. When disabled the typedef will appear as a member of a file,
-# namespace, or class. And the struct will be named TypeS. This can typically be
-# useful for C code in case the coding convention dictates that all compound
-# types are typedef'ed and only the typedef is referenced, never the tag name.
-# The default value is: NO.
-
-TYPEDEF_HIDES_STRUCT   = NO
-
-# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This
-# cache is used to resolve symbols given their name and scope. Since this can be
-# an expensive process and often the same symbol appears multiple times in the
-# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small
-# doxygen will become slower. If the cache is too large, memory is wasted. The
-# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range
-# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536
-# symbols. At the end of a run doxygen will report the cache usage and suggest
-# the optimal cache size from a speed point of view.
-# Minimum value: 0, maximum value: 9, default value: 0.
-
-LOOKUP_CACHE_SIZE      = 0
-
-#---------------------------------------------------------------------------
-# Build related configuration options
-#---------------------------------------------------------------------------
-
-# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
-# documentation are documented, even if no documentation was available. Private
-# class members and static file members will be hidden unless the
-# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES.
-# Note: This will also disable the warnings about undocumented members that are
-# normally produced when WARNINGS is set to YES.
-# The default value is: NO.
-
-EXTRACT_ALL            = NO
-
-# If the EXTRACT_PRIVATE tag is set to YES all private members of a class will
-# be included in the documentation.
-# The default value is: NO.
-
-EXTRACT_PRIVATE        = NO
-
-# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal
-# scope will be included in the documentation.
-# The default value is: NO.
-
-EXTRACT_PACKAGE        = NO
-
-# If the EXTRACT_STATIC tag is set to YES all static members of a file will be
-# included in the documentation.
-# The default value is: NO.
-
-EXTRACT_STATIC         = NO
-
-# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) defined
-# locally in source files will be included in the documentation. If set to NO
-# only classes defined in header files are included. Does not have any effect
-# for Java sources.
-# The default value is: YES.
-
-EXTRACT_LOCAL_CLASSES  = YES
-
-# This flag is only useful for Objective-C code. When set to YES local methods,
-# which are defined in the implementation section but not in the interface are
-# included in the documentation. If set to NO only methods in the interface are
-# included.
-# The default value is: NO.
-
-EXTRACT_LOCAL_METHODS  = NO
-
-# If this flag is set to YES, the members of anonymous namespaces will be
-# extracted and appear in the documentation as a namespace called
-# 'anonymous_namespace{file}', where file will be replaced with the base name of
-# the file that contains the anonymous namespace. By default anonymous namespace
-# are hidden.
-# The default value is: NO.
-
-EXTRACT_ANON_NSPACES   = NO
-
-# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all
-# undocumented members inside documented classes or files. If set to NO these
-# members will be included in the various overviews, but no documentation
-# section is generated. This option has no effect if EXTRACT_ALL is enabled.
-# The default value is: NO.
-
-HIDE_UNDOC_MEMBERS     = NO
-
-# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all
-# undocumented classes that are normally visible in the class hierarchy. If set
-# to NO these classes will be included in the various overviews. This option has
-# no effect if EXTRACT_ALL is enabled.
-# The default value is: NO.
-
-HIDE_UNDOC_CLASSES     = NO
-
-# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend
-# (class|struct|union) declarations. If set to NO these declarations will be
-# included in the documentation.
-# The default value is: NO.
-
-HIDE_FRIEND_COMPOUNDS  = NO
-
-# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any
-# documentation blocks found inside the body of a function. If set to NO these
-# blocks will be appended to the function's detailed documentation block.
-# The default value is: NO.
-
-HIDE_IN_BODY_DOCS      = NO
-
-# The INTERNAL_DOCS tag determines if documentation that is typed after a
-# \internal command is included. If the tag is set to NO then the documentation
-# will be excluded. Set it to YES to include the internal documentation.
-# The default value is: NO.
-
-INTERNAL_DOCS          = NO
-
-# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file
-# names in lower-case letters. If set to YES upper-case letters are also
-# allowed. This is useful if you have classes or files whose names only differ
-# in case and if your file system supports case sensitive file names. Windows
-# and Mac users are advised to set this option to NO.
-# The default value is: system dependent.
-
-CASE_SENSE_NAMES       = YES
-
-# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with
-# their full class and namespace scopes in the documentation. If set to YES the
-# scope will be hidden.
-# The default value is: NO.
-
-HIDE_SCOPE_NAMES       = NO
-
-# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of
-# the files that are included by a file in the documentation of that file.
-# The default value is: YES.
-
-SHOW_INCLUDE_FILES     = YES
-
-# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include
-# files with double quotes in the documentation rather than with sharp brackets.
-# The default value is: NO.
-
-FORCE_LOCAL_INCLUDES   = NO
-
-# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the
-# documentation for inline members.
-# The default value is: YES.
-
-INLINE_INFO            = YES
-
-# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the
-# (detailed) documentation of file and class members alphabetically by member
-# name. If set to NO the members will appear in declaration order.
-# The default value is: YES.
-
-SORT_MEMBER_DOCS       = YES
-
-# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief
-# descriptions of file, namespace and class members alphabetically by member
-# name. If set to NO the members will appear in declaration order.
-# The default value is: NO.
-
-SORT_BRIEF_DOCS        = NO
-
-# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the
-# (brief and detailed) documentation of class members so that constructors and
-# destructors are listed first. If set to NO the constructors will appear in the
-# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS.
-# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief
-# member documentation.
-# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting
-# detailed member documentation.
-# The default value is: NO.
-
-SORT_MEMBERS_CTORS_1ST = NO
-
-# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy
-# of group names into alphabetical order. If set to NO the group names will
-# appear in their defined order.
-# The default value is: NO.
-
-SORT_GROUP_NAMES       = NO
-
-# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by
-# fully-qualified names, including namespaces. If set to NO, the class list will
-# be sorted only by class name, not including the namespace part.
-# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
-# Note: This option applies only to the class list, not to the alphabetical
-# list.
-# The default value is: NO.
-
-SORT_BY_SCOPE_NAME     = NO
-
-# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper
-# type resolution of all parameters of a function it will reject a match between
-# the prototype and the implementation of a member function even if there is
-# only one candidate or it is obvious which candidate to choose by doing a
-# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still
-# accept a match between prototype and implementation in such cases.
-# The default value is: NO.
-
-STRICT_PROTO_MATCHING  = NO
-
-# The GENERATE_TODOLIST tag can be used to enable ( YES) or disable ( NO) the
-# todo list. This list is created by putting \todo commands in the
-# documentation.
-# The default value is: YES.
-
-GENERATE_TODOLIST      = YES
-
-# The GENERATE_TESTLIST tag can be used to enable ( YES) or disable ( NO) the
-# test list. This list is created by putting \test commands in the
-# documentation.
-# The default value is: YES.
-
-GENERATE_TESTLIST      = YES
-
-# The GENERATE_BUGLIST tag can be used to enable ( YES) or disable ( NO) the bug
-# list. This list is created by putting \bug commands in the documentation.
-# The default value is: YES.
-
-GENERATE_BUGLIST       = YES
-
-# The GENERATE_DEPRECATEDLIST tag can be used to enable ( YES) or disable ( NO)
-# the deprecated list. This list is created by putting \deprecated commands in
-# the documentation.
-# The default value is: YES.
-
-GENERATE_DEPRECATEDLIST= YES
-
-# The ENABLED_SECTIONS tag can be used to enable conditional documentation
-# sections, marked by \if <section_label> ... \endif and \cond <section_label>
-# ... \endcond blocks.
-
-ENABLED_SECTIONS       =
-
-# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the
-# initial value of a variable or macro / define can have for it to appear in the
-# documentation. If the initializer consists of more lines than specified here
-# it will be hidden. Use a value of 0 to hide initializers completely. The
-# appearance of the value of individual variables and macros / defines can be
-# controlled using \showinitializer or \hideinitializer command in the
-# documentation regardless of this setting.
-# Minimum value: 0, maximum value: 10000, default value: 30.
-
-MAX_INITIALIZER_LINES  = 30
-
-# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at
-# the bottom of the documentation of classes and structs. If set to YES the list
-# will mention the files that were used to generate the documentation.
-# The default value is: YES.
-
-SHOW_USED_FILES        = YES
-
-# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This
-# will remove the Files entry from the Quick Index and from the Folder Tree View
-# (if specified).
-# The default value is: YES.
-
-SHOW_FILES             = YES
-
-# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces
-# page. This will remove the Namespaces entry from the Quick Index and from the
-# Folder Tree View (if specified).
-# The default value is: YES.
-
-SHOW_NAMESPACES        = YES
-
-# The FILE_VERSION_FILTER tag can be used to specify a program or script that
-# doxygen should invoke to get the current version for each file (typically from
-# the version control system). Doxygen will invoke the program by executing (via
-# popen()) the command command input-file, where command is the value of the
-# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided
-# by doxygen. Whatever the program writes to standard output is used as the file
-# version. For an example see the documentation.
-
-FILE_VERSION_FILTER    =
-
-# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed
-# by doxygen. The layout file controls the global structure of the generated
-# output files in an output format independent way. To create the layout file
-# that represents doxygen's defaults, run doxygen with the -l option. You can
-# optionally specify a file name after the option, if omitted DoxygenLayout.xml
-# will be used as the name of the layout file.
-#
-# Note that if you run doxygen from a directory containing a file called
-# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE
-# tag is left empty.
-
-LAYOUT_FILE            =
-
-# The CITE_BIB_FILES tag can be used to specify one or more bib files containing
-# the reference definitions. This must be a list of .bib files. The .bib
-# extension is automatically appended if omitted. This requires the bibtex tool
-# to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info.
-# For LaTeX the style of the bibliography can be controlled using
-# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the
-# search path. Do not use file names with spaces, bibtex cannot handle them. See
-# also \cite for info how to create references.
-
-CITE_BIB_FILES         =
-
-#---------------------------------------------------------------------------
-# Configuration options related to warning and progress messages
-#---------------------------------------------------------------------------
-
-# The QUIET tag can be used to turn on/off the messages that are generated to
-# standard output by doxygen. If QUIET is set to YES this implies that the
-# messages are off.
-# The default value is: NO.
-
-QUIET                  = NO
-
-# The WARNINGS tag can be used to turn on/off the warning messages that are
-# generated to standard error ( stderr) by doxygen. If WARNINGS is set to YES
-# this implies that the warnings are on.
-#
-# Tip: Turn warnings on while writing the documentation.
-# The default value is: YES.
-
-WARNINGS               = YES
-
-# If the WARN_IF_UNDOCUMENTED tag is set to YES, then doxygen will generate
-# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag
-# will automatically be disabled.
-# The default value is: YES.
-
-WARN_IF_UNDOCUMENTED   = YES
-
-# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for
-# potential errors in the documentation, such as not documenting some parameters
-# in a documented function, or documenting parameters that don't exist or using
-# markup commands wrongly.
-# The default value is: YES.
-
-WARN_IF_DOC_ERROR      = YES
-
-# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that
-# are documented, but have no documentation for their parameters or return
-# value. If set to NO doxygen will only warn about wrong or incomplete parameter
-# documentation, but not about the absence of documentation.
-# The default value is: NO.
-
-WARN_NO_PARAMDOC       = NO
-
-# The WARN_FORMAT tag determines the format of the warning messages that doxygen
-# can produce. The string should contain the $file, $line, and $text tags, which
-# will be replaced by the file and line number from which the warning originated
-# and the warning text. Optionally the format may contain $version, which will
-# be replaced by the version of the file (if it could be obtained via
-# FILE_VERSION_FILTER)
-# The default value is: $file:$line: $text.
-
-WARN_FORMAT            = "$file:$line: $text"
-
-# The WARN_LOGFILE tag can be used to specify a file to which warning and error
-# messages should be written. If left blank the output is written to standard
-# error (stderr).
-
-WARN_LOGFILE           =
-
-#---------------------------------------------------------------------------
-# Configuration options related to the input files
-#---------------------------------------------------------------------------
-
-# The INPUT tag is used to specify the files and/or directories that contain
-# documented source files. You may enter file names like myfile.cpp or
-# directories like /usr/src/myproject. Separate the files or directories with
-# spaces.
-# Note: If this tag is empty the current directory is searched.
-
-INPUT                  =
-
-# This tag can be used to specify the character encoding of the source files
-# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
-# libiconv (or the iconv built into libc) for the transcoding. See the libiconv
-# documentation (see: http://www.gnu.org/software/libiconv) for the list of
-# possible encodings.
-# The default value is: UTF-8.
-
-INPUT_ENCODING         = UTF-8
-
-# If the value of the INPUT tag contains directories, you can use the
-# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and
-# *.h) to filter out the source-files in the directories. If left blank the
-# following patterns are tested:*.c, *.cc, *.cxx, *.cpp, *.c++, *.java, *.ii,
-# *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, *.hh, *.hxx, *.hpp,
-# *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, *.m, *.markdown,
-# *.md, *.mm, *.dox, *.py, *.f90, *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf,
-# *.qsf, *.as and *.js.
-
-FILE_PATTERNS          =
-
-# The RECURSIVE tag can be used to specify whether or not subdirectories should
-# be searched for input files as well.
-# The default value is: NO.
-
-RECURSIVE              = YES
-
-# The EXCLUDE tag can be used to specify files and/or directories that should be
-# excluded from the INPUT source files. This way you can easily exclude a
-# subdirectory from a directory tree whose root is specified with the INPUT tag.
-#
-# Note that relative paths are relative to the directory from which doxygen is
-# run.
-
-EXCLUDE                = third_party
-
-# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
-# directories that are symbolic links (a Unix file system feature) are excluded
-# from the input.
-# The default value is: NO.
-
-EXCLUDE_SYMLINKS       = NO
-
-# If the value of the INPUT tag contains directories, you can use the
-# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
-# certain files from those directories.
-#
-# Note that the wildcards are matched against the file with absolute path, so to
-# exclude all test directories for example use the pattern */test/*
-
-EXCLUDE_PATTERNS       = */tests/*
-
-# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
-# (namespaces, classes, functions, etc.) that should be excluded from the
-# output. The symbol name can be a fully qualified name, a word, or if the
-# wildcard * is used, a substring. Examples: ANamespace, AClass,
-# AClass::ANamespace, ANamespace::*Test
-#
-# Note that the wildcards are matched against the file with absolute path, so to
-# exclude all test directories use the pattern */test/*
-
-EXCLUDE_SYMBOLS        =
-
-# The EXAMPLE_PATH tag can be used to specify one or more files or directories
-# that contain example code fragments that are included (see the \include
-# command).
-
-EXAMPLE_PATH           =
-
-# If the value of the EXAMPLE_PATH tag contains directories, you can use the
-# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and
-# *.h) to filter out the source-files in the directories. If left blank all
-# files are included.
-
-EXAMPLE_PATTERNS       =
-
-# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
-# searched for input files to be used with the \include or \dontinclude commands
-# irrespective of the value of the RECURSIVE tag.
-# The default value is: NO.
-
-EXAMPLE_RECURSIVE      = NO
-
-# The IMAGE_PATH tag can be used to specify one or more files or directories
-# that contain images that are to be included in the documentation (see the
-# \image command).
-
-IMAGE_PATH             =
-
-# The INPUT_FILTER tag can be used to specify a program that doxygen should
-# invoke to filter for each input file. Doxygen will invoke the filter program
-# by executing (via popen()) the command:
-#
-# <filter> <input-file>
-#
-# where <filter> is the value of the INPUT_FILTER tag, and <input-file> is the
-# name of an input file. Doxygen will then use the output that the filter
-# program writes to standard output. If FILTER_PATTERNS is specified, this tag
-# will be ignored.
-#
-# Note that the filter must not add or remove lines; it is applied before the
-# code is scanned, but not when the output code is generated. If lines are added
-# or removed, the anchors will not be placed correctly.
-
-INPUT_FILTER           =
-
-# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
-# basis. Doxygen will compare the file name with each pattern and apply the
-# filter if there is a match. The filters are a list of the form: pattern=filter
-# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how
-# filters are used. If the FILTER_PATTERNS tag is empty or if none of the
-# patterns match the file name, INPUT_FILTER is applied.
-
-FILTER_PATTERNS        =
-
-# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
-# INPUT_FILTER ) will also be used to filter the input files that are used for
-# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES).
-# The default value is: NO.
-
-FILTER_SOURCE_FILES    = NO
-
-# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file
-# pattern. A pattern will override the setting for FILTER_PATTERN (if any) and
-# it is also possible to disable source filtering for a specific pattern using
-# *.ext= (so without naming a filter).
-# This tag requires that the tag FILTER_SOURCE_FILES is set to YES.
-
-FILTER_SOURCE_PATTERNS =
-
-# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that
-# is part of the input, its contents will be placed on the main page
-# (index.html). This can be useful if you have a project on for instance GitHub
-# and want to reuse the introduction page also for the doxygen output.
-
-USE_MDFILE_AS_MAINPAGE =
-
-#---------------------------------------------------------------------------
-# Configuration options related to source browsing
-#---------------------------------------------------------------------------
-
-# If the SOURCE_BROWSER tag is set to YES then a list of source files will be
-# generated. Documented entities will be cross-referenced with these sources.
-#
-# Note: To get rid of all source code in the generated output, make sure that
-# also VERBATIM_HEADERS is set to NO.
-# The default value is: NO.
-
-SOURCE_BROWSER         = NO
-
-# Setting the INLINE_SOURCES tag to YES will include the body of functions,
-# classes and enums directly into the documentation.
-# The default value is: NO.
-
-INLINE_SOURCES         = NO
-
-# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any
-# special comment blocks from generated source code fragments. Normal C, C++ and
-# Fortran comments will always remain visible.
-# The default value is: YES.
-
-STRIP_CODE_COMMENTS    = YES
-
-# If the REFERENCED_BY_RELATION tag is set to YES then for each documented
-# function all documented functions referencing it will be listed.
-# The default value is: NO.
-
-REFERENCED_BY_RELATION = NO
-
-# If the REFERENCES_RELATION tag is set to YES then for each documented function
-# all documented entities called/used by that function will be listed.
-# The default value is: NO.
-
-REFERENCES_RELATION    = NO
-
-# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set
-# to YES, then the hyperlinks from functions in REFERENCES_RELATION and
-# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will
-# link to the documentation.
-# The default value is: YES.
-
-REFERENCES_LINK_SOURCE = YES
-
-# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the
-# source code will show a tooltip with additional information such as prototype,
-# brief description and links to the definition and documentation. Since this
-# will make the HTML file larger and loading of large files a bit slower, you
-# can opt to disable this feature.
-# The default value is: YES.
-# This tag requires that the tag SOURCE_BROWSER is set to YES.
-
-SOURCE_TOOLTIPS        = YES
-
-# If the USE_HTAGS tag is set to YES then the references to source code will
-# point to the HTML generated by the htags(1) tool instead of doxygen built-in
-# source browser. The htags tool is part of GNU's global source tagging system
-# (see http://www.gnu.org/software/global/global.html). You will need version
-# 4.8.6 or higher.
-#
-# To use it do the following:
-# - Install the latest version of global
-# - Enable SOURCE_BROWSER and USE_HTAGS in the config file
-# - Make sure the INPUT points to the root of the source tree
-# - Run doxygen as normal
-#
-# Doxygen will invoke htags (and that will in turn invoke gtags), so these
-# tools must be available from the command line (i.e. in the search path).
-#
-# The result: instead of the source browser generated by doxygen, the links to
-# source code will now point to the output of htags.
-# The default value is: NO.
-# This tag requires that the tag SOURCE_BROWSER is set to YES.
-
-USE_HTAGS              = NO
-
-# If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a
-# verbatim copy of the header file for each class for which an include is
-# specified. Set to NO to disable this.
-# See also: Section \class.
-# The default value is: YES.
-
-VERBATIM_HEADERS       = YES
-
-#---------------------------------------------------------------------------
-# Configuration options related to the alphabetical class index
-#---------------------------------------------------------------------------
-
-# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all
-# compounds will be generated. Enable this if the project contains a lot of
-# classes, structs, unions or interfaces.
-# The default value is: YES.
-
-ALPHABETICAL_INDEX     = YES
-
-# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in
-# which the alphabetical index list will be split.
-# Minimum value: 1, maximum value: 20, default value: 5.
-# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
-
-COLS_IN_ALPHA_INDEX    = 5
-
-# In case all classes in a project start with a common prefix, all classes will
-# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag
-# can be used to specify a prefix (or a list of prefixes) that should be ignored
-# while generating the index headers.
-# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
-
-IGNORE_PREFIX          =
-
-#---------------------------------------------------------------------------
-# Configuration options related to the HTML output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_HTML tag is set to YES doxygen will generate HTML output
-# The default value is: YES.
-
-GENERATE_HTML          = YES
-
-# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a
-# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
-# it.
-# The default directory is: html.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_OUTPUT            = html
-
-# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each
-# generated HTML page (for example: .htm, .php, .asp).
-# The default value is: .html.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_FILE_EXTENSION    = .html
-
-# The HTML_HEADER tag can be used to specify a user-defined HTML header file for
-# each generated HTML page. If the tag is left blank doxygen will generate a
-# standard header.
-#
-# To get valid HTML the header file that includes any scripts and style sheets
-# that doxygen needs, which is dependent on the configuration options used (e.g.
-# the setting GENERATE_TREEVIEW). It is highly recommended to start with a
-# default header using
-# doxygen -w html new_header.html new_footer.html new_stylesheet.css
-# YourConfigFile
-# and then modify the file new_header.html. See also section "Doxygen usage"
-# for information on how to generate the default header that doxygen normally
-# uses.
-# Note: The header is subject to change so you typically have to regenerate the
-# default header when upgrading to a newer version of doxygen. For a description
-# of the possible markers and block names see the documentation.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_HEADER            =
-
-# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each
-# generated HTML page. If the tag is left blank doxygen will generate a standard
-# footer. See HTML_HEADER for more information on how to generate a default
-# footer and what special commands can be used inside the footer. See also
-# section "Doxygen usage" for information on how to generate the default footer
-# that doxygen normally uses.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_FOOTER            =
-
-# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style
-# sheet that is used by each HTML page. It can be used to fine-tune the look of
-# the HTML output. If left blank doxygen will generate a default style sheet.
-# See also section "Doxygen usage" for information on how to generate the style
-# sheet that doxygen normally uses.
-# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as
-# it is more robust and this tag (HTML_STYLESHEET) will in the future become
-# obsolete.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_STYLESHEET        =
-
-# The HTML_EXTRA_STYLESHEET tag can be used to specify an additional user-
-# defined cascading style sheet that is included after the standard style sheets
-# created by doxygen. Using this option one can overrule certain style aspects.
-# This is preferred over using HTML_STYLESHEET since it does not replace the
-# standard style sheet and is therefor more robust against future updates.
-# Doxygen will copy the style sheet file to the output directory. For an example
-# see the documentation.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_EXTRA_STYLESHEET  =
-
-# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
-# other source files which should be copied to the HTML output directory. Note
-# that these files will be copied to the base HTML output directory. Use the
-# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these
-# files. In the HTML_STYLESHEET file, use the file name only. Also note that the
-# files will be copied as-is; there are no commands or markers available.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_EXTRA_FILES       =
-
-# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen
-# will adjust the colors in the stylesheet and background images according to
-# this color. Hue is specified as an angle on a colorwheel, see
-# http://en.wikipedia.org/wiki/Hue for more information. For instance the value
-# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300
-# purple, and 360 is red again.
-# Minimum value: 0, maximum value: 359, default value: 220.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_COLORSTYLE_HUE    = 220
-
-# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors
-# in the HTML output. For a value of 0 the output will use grayscales only. A
-# value of 255 will produce the most vivid colors.
-# Minimum value: 0, maximum value: 255, default value: 100.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_COLORSTYLE_SAT    = 100
-
-# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the
-# luminance component of the colors in the HTML output. Values below 100
-# gradually make the output lighter, whereas values above 100 make the output
-# darker. The value divided by 100 is the actual gamma applied, so 80 represents
-# a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not
-# change the gamma.
-# Minimum value: 40, maximum value: 240, default value: 80.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_COLORSTYLE_GAMMA  = 80
-
-# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
-# page will contain the date and time when the page was generated. Setting this
-# to NO can help when comparing the output of multiple runs.
-# The default value is: YES.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_TIMESTAMP         = YES
-
-# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
-# documentation will contain sections that can be hidden and shown after the
-# page has loaded.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_DYNAMIC_SECTIONS  = NO
-
-# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries
-# shown in the various tree structured indices initially; the user can expand
-# and collapse entries dynamically later on. Doxygen will expand the tree to
-# such a level that at most the specified number of entries are visible (unless
-# a fully collapsed tree already exceeds this amount). So setting the number of
-# entries 1 will produce a full collapsed tree by default. 0 is a special value
-# representing an infinite number of entries and will result in a full expanded
-# tree by default.
-# Minimum value: 0, maximum value: 9999, default value: 100.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-HTML_INDEX_NUM_ENTRIES = 100
-
-# If the GENERATE_DOCSET tag is set to YES, additional index files will be
-# generated that can be used as input for Apple's Xcode 3 integrated development
-# environment (see: http://developer.apple.com/tools/xcode/), introduced with
-# OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a
-# Makefile in the HTML output directory. Running make will produce the docset in
-# that directory and running make install will install the docset in
-# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at
-# startup. See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html
-# for more information.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-GENERATE_DOCSET        = NO
-
-# This tag determines the name of the docset feed. A documentation feed provides
-# an umbrella under which multiple documentation sets from a single provider
-# (such as a company or product suite) can be grouped.
-# The default value is: Doxygen generated docs.
-# This tag requires that the tag GENERATE_DOCSET is set to YES.
-
-DOCSET_FEEDNAME        = "Doxygen generated docs"
-
-# This tag specifies a string that should uniquely identify the documentation
-# set bundle. This should be a reverse domain-name style string, e.g.
-# com.mycompany.MyDocSet. Doxygen will append .docset to the name.
-# The default value is: org.doxygen.Project.
-# This tag requires that the tag GENERATE_DOCSET is set to YES.
-
-DOCSET_BUNDLE_ID       = org.doxygen.Project
-
-# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify
-# the documentation publisher. This should be a reverse domain-name style
-# string, e.g. com.mycompany.MyDocSet.documentation.
-# The default value is: org.doxygen.Publisher.
-# This tag requires that the tag GENERATE_DOCSET is set to YES.
-
-DOCSET_PUBLISHER_ID    = org.doxygen.Publisher
-
-# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher.
-# The default value is: Publisher.
-# This tag requires that the tag GENERATE_DOCSET is set to YES.
-
-DOCSET_PUBLISHER_NAME  = Publisher
-
-# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three
-# additional HTML index files: index.hhp, index.hhc, and index.hhk. The
-# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop
-# (see: http://www.microsoft.com/en-us/download/details.aspx?id=21138) on
-# Windows.
-#
-# The HTML Help Workshop contains a compiler that can convert all HTML output
-# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML
-# files are now used as the Windows 98 help format, and will replace the old
-# Windows help format (.hlp) on all Windows platforms in the future. Compressed
-# HTML files also contain an index, a table of contents, and you can search for
-# words in the documentation. The HTML workshop also contains a viewer for
-# compressed HTML files.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-GENERATE_HTMLHELP      = NO
-
-# The CHM_FILE tag can be used to specify the file name of the resulting .chm
-# file. You can add a path in front of the file if the result should not be
-# written to the html output directory.
-# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
-
-CHM_FILE               =
-
-# The HHC_LOCATION tag can be used to specify the location (absolute path
-# including file name) of the HTML help compiler ( hhc.exe). If non-empty
-# doxygen will try to run the HTML help compiler on the generated index.hhp.
-# The file has to be specified with full path.
-# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
-
-HHC_LOCATION           =
-
-# The GENERATE_CHI flag controls if a separate .chi index file is generated (
-# YES) or that it should be included in the master .chm file ( NO).
-# The default value is: NO.
-# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
-
-GENERATE_CHI           = NO
-
-# The CHM_INDEX_ENCODING is used to encode HtmlHelp index ( hhk), content ( hhc)
-# and project file content.
-# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
-
-CHM_INDEX_ENCODING     =
-
-# The BINARY_TOC flag controls whether a binary table of contents is generated (
-# YES) or a normal table of contents ( NO) in the .chm file.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
-
-BINARY_TOC             = NO
-
-# The TOC_EXPAND flag can be set to YES to add extra items for group members to
-# the table of contents of the HTML help documentation and to the tree view.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
-
-TOC_EXPAND             = NO
-
-# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and
-# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that
-# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help
-# (.qch) of the generated HTML documentation.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-GENERATE_QHP           = NO
-
-# If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify
-# the file name of the resulting .qch file. The path specified is relative to
-# the HTML output folder.
-# This tag requires that the tag GENERATE_QHP is set to YES.
-
-QCH_FILE               =
-
-# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help
-# Project output. For more information please see Qt Help Project / Namespace
-# (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#namespace).
-# The default value is: org.doxygen.Project.
-# This tag requires that the tag GENERATE_QHP is set to YES.
-
-QHP_NAMESPACE          = org.doxygen.Project
-
-# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt
-# Help Project output. For more information please see Qt Help Project / Virtual
-# Folders (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#virtual-
-# folders).
-# The default value is: doc.
-# This tag requires that the tag GENERATE_QHP is set to YES.
-
-QHP_VIRTUAL_FOLDER     = doc
-
-# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom
-# filter to add. For more information please see Qt Help Project / Custom
-# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom-
-# filters).
-# This tag requires that the tag GENERATE_QHP is set to YES.
-
-QHP_CUST_FILTER_NAME   =
-
-# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the
-# custom filter to add. For more information please see Qt Help Project / Custom
-# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom-
-# filters).
-# This tag requires that the tag GENERATE_QHP is set to YES.
-
-QHP_CUST_FILTER_ATTRS  =
-
-# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this
-# project's filter section matches. Qt Help Project / Filter Attributes (see:
-# http://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes).
-# This tag requires that the tag GENERATE_QHP is set to YES.
-
-QHP_SECT_FILTER_ATTRS  =
-
-# The QHG_LOCATION tag can be used to specify the location of Qt's
-# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the
-# generated .qhp file.
-# This tag requires that the tag GENERATE_QHP is set to YES.
-
-QHG_LOCATION           =
-
-# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be
-# generated, together with the HTML files, they form an Eclipse help plugin. To
-# install this plugin and make it available under the help contents menu in
-# Eclipse, the contents of the directory containing the HTML and XML files needs
-# to be copied into the plugins directory of eclipse. The name of the directory
-# within the plugins directory should be the same as the ECLIPSE_DOC_ID value.
-# After copying Eclipse needs to be restarted before the help appears.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-GENERATE_ECLIPSEHELP   = NO
-
-# A unique identifier for the Eclipse help plugin. When installing the plugin
-# the directory name containing the HTML and XML files should also have this
-# name. Each documentation set should have its own identifier.
-# The default value is: org.doxygen.Project.
-# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES.
-
-ECLIPSE_DOC_ID         = org.doxygen.Project
-
-# If you want full control over the layout of the generated HTML pages it might
-# be necessary to disable the index and replace it with your own. The
-# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top
-# of each HTML page. A value of NO enables the index and the value YES disables
-# it. Since the tabs in the index contain the same information as the navigation
-# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-DISABLE_INDEX          = NO
-
-# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
-# structure should be generated to display hierarchical information. If the tag
-# value is set to YES, a side panel will be generated containing a tree-like
-# index structure (just like the one that is generated for HTML Help). For this
-# to work a browser that supports JavaScript, DHTML, CSS and frames is required
-# (i.e. any modern browser). Windows users are probably better off using the
-# HTML help feature. Via custom stylesheets (see HTML_EXTRA_STYLESHEET) one can
-# further fine-tune the look of the index. As an example, the default style
-# sheet generated by doxygen has an example that shows how to put an image at
-# the root of the tree instead of the PROJECT_NAME. Since the tree basically has
-# the same information as the tab index, you could consider setting
-# DISABLE_INDEX to YES when enabling this option.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-GENERATE_TREEVIEW      = NO
-
-# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that
-# doxygen will group on one line in the generated HTML documentation.
-#
-# Note that a value of 0 will completely suppress the enum values from appearing
-# in the overview section.
-# Minimum value: 0, maximum value: 20, default value: 4.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-ENUM_VALUES_PER_LINE   = 4
-
-# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used
-# to set the initial width (in pixels) of the frame in which the tree is shown.
-# Minimum value: 0, maximum value: 1500, default value: 250.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-TREEVIEW_WIDTH         = 250
-
-# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open links to
-# external symbols imported via tag files in a separate window.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-EXT_LINKS_IN_WINDOW    = NO
-
-# Use this tag to change the font size of LaTeX formulas included as images in
-# the HTML documentation. When you change the font size after a successful
-# doxygen run you need to manually remove any form_*.png images from the HTML
-# output directory to force them to be regenerated.
-# Minimum value: 8, maximum value: 50, default value: 10.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-FORMULA_FONTSIZE       = 10
-
-# Use the FORMULA_TRANPARENT tag to determine whether or not the images
-# generated for formulas are transparent PNGs. Transparent PNGs are not
-# supported properly for IE 6.0, but are supported on all modern browsers.
-#
-# Note that when changing this option you need to delete any form_*.png files in
-# the HTML output directory before the changes have effect.
-# The default value is: YES.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-FORMULA_TRANSPARENT    = YES
-
-# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see
-# http://www.mathjax.org) which uses client side Javascript for the rendering
-# instead of using prerendered bitmaps. Use this if you do not have LaTeX
-# installed or if you want to formulas look prettier in the HTML output. When
-# enabled you may also need to install MathJax separately and configure the path
-# to it using the MATHJAX_RELPATH option.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-USE_MATHJAX            = NO
-
-# When MathJax is enabled you can set the default output format to be used for
-# the MathJax output. See the MathJax site (see:
-# http://docs.mathjax.org/en/latest/output.html) for more details.
-# Possible values are: HTML-CSS (which is slower, but has the best
-# compatibility), NativeMML (i.e. MathML) and SVG.
-# The default value is: HTML-CSS.
-# This tag requires that the tag USE_MATHJAX is set to YES.
-
-MATHJAX_FORMAT         = HTML-CSS
-
-# When MathJax is enabled you need to specify the location relative to the HTML
-# output directory using the MATHJAX_RELPATH option. The destination directory
-# should contain the MathJax.js script. For instance, if the mathjax directory
-# is located at the same level as the HTML output directory, then
-# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax
-# Content Delivery Network so you can quickly see the result without installing
-# MathJax. However, it is strongly recommended to install a local copy of
-# MathJax from http://www.mathjax.org before deployment.
-# The default value is: http://cdn.mathjax.org/mathjax/latest.
-# This tag requires that the tag USE_MATHJAX is set to YES.
-
-MATHJAX_RELPATH        = http://cdn.mathjax.org/mathjax/latest
-
-# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax
-# extension names that should be enabled during MathJax rendering. For example
-# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols
-# This tag requires that the tag USE_MATHJAX is set to YES.
-
-MATHJAX_EXTENSIONS     =
-
-# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces
-# of code that will be used on startup of the MathJax code. See the MathJax site
-# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an
-# example see the documentation.
-# This tag requires that the tag USE_MATHJAX is set to YES.
-
-MATHJAX_CODEFILE       =
-
-# When the SEARCHENGINE tag is enabled doxygen will generate a search box for
-# the HTML output. The underlying search engine uses javascript and DHTML and
-# should work on any modern browser. Note that when using HTML help
-# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET)
-# there is already a search function so this one should typically be disabled.
-# For large projects the javascript based search engine can be slow, then
-# enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to
-# search using the keyboard; to jump to the search box use <access key> + S
-# (what the <access key> is depends on the OS and browser, but it is typically
-# <CTRL>, <ALT>/<option>, or both). Inside the search box use the <cursor down
-# key> to jump into the search results window, the results can be navigated
-# using the <cursor keys>. Press <Enter> to select an item or <escape> to cancel
-# the search. The filter options can be selected when the cursor is inside the
-# search box by pressing <Shift>+<cursor down>. Also here use the <cursor keys>
-# to select a filter and <Enter> or <escape> to activate or cancel the filter
-# option.
-# The default value is: YES.
-# This tag requires that the tag GENERATE_HTML is set to YES.
-
-SEARCHENGINE           = YES
-
-# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
-# implemented using a web server instead of a web client using Javascript. There
-# are two flavours of web server based searching depending on the
-# EXTERNAL_SEARCH setting. When disabled, doxygen will generate a PHP script for
-# searching and an index file used by the script. When EXTERNAL_SEARCH is
-# enabled the indexing and searching needs to be provided by external tools. See
-# the section "External Indexing and Searching" for details.
-# The default value is: NO.
-# This tag requires that the tag SEARCHENGINE is set to YES.
-
-SERVER_BASED_SEARCH    = NO
-
-# When EXTERNAL_SEARCH tag is enabled doxygen will no longer generate the PHP
-# script for searching. Instead the search results are written to an XML file
-# which needs to be processed by an external indexer. Doxygen will invoke an
-# external search engine pointed to by the SEARCHENGINE_URL option to obtain the
-# search results.
-#
-# Doxygen ships with an example indexer ( doxyindexer) and search engine
-# (doxysearch.cgi) which are based on the open source search engine library
-# Xapian (see: http://xapian.org/).
-#
-# See the section "External Indexing and Searching" for details.
-# The default value is: NO.
-# This tag requires that the tag SEARCHENGINE is set to YES.
-
-EXTERNAL_SEARCH        = NO
-
-# The SEARCHENGINE_URL should point to a search engine hosted by a web server
-# which will return the search results when EXTERNAL_SEARCH is enabled.
-#
-# Doxygen ships with an example indexer ( doxyindexer) and search engine
-# (doxysearch.cgi) which are based on the open source search engine library
-# Xapian (see: http://xapian.org/). See the section "External Indexing and
-# Searching" for details.
-# This tag requires that the tag SEARCHENGINE is set to YES.
-
-SEARCHENGINE_URL       =
-
-# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed
-# search data is written to a file for indexing by an external tool. With the
-# SEARCHDATA_FILE tag the name of this file can be specified.
-# The default file is: searchdata.xml.
-# This tag requires that the tag SEARCHENGINE is set to YES.
-
-SEARCHDATA_FILE        = searchdata.xml
-
-# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the
-# EXTERNAL_SEARCH_ID tag can be used as an identifier for the project. This is
-# useful in combination with EXTRA_SEARCH_MAPPINGS to search through multiple
-# projects and redirect the results back to the right project.
-# This tag requires that the tag SEARCHENGINE is set to YES.
-
-EXTERNAL_SEARCH_ID     =
-
-# The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through doxygen
-# projects other than the one defined by this configuration file, but that are
-# all added to the same external search index. Each project needs to have a
-# unique id set via EXTERNAL_SEARCH_ID. The search mapping then maps the id of
-# to a relative location where the documentation can be found. The format is:
-# EXTRA_SEARCH_MAPPINGS = tagname1=loc1 tagname2=loc2 ...
-# This tag requires that the tag SEARCHENGINE is set to YES.
-
-EXTRA_SEARCH_MAPPINGS  =
-
-#---------------------------------------------------------------------------
-# Configuration options related to the LaTeX output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_LATEX tag is set to YES doxygen will generate LaTeX output.
-# The default value is: YES.
-
-GENERATE_LATEX         = NO
-
-# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. If a
-# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
-# it.
-# The default directory is: latex.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-LATEX_OUTPUT           = latex
-
-# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
-# invoked.
-#
-# Note that when enabling USE_PDFLATEX this option is only used for generating
-# bitmaps for formulas in the HTML output, but not in the Makefile that is
-# written to the output directory.
-# The default file is: latex.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-LATEX_CMD_NAME         = latex
-
-# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to generate
-# index for LaTeX.
-# The default file is: makeindex.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-MAKEINDEX_CMD_NAME     = makeindex
-
-# If the COMPACT_LATEX tag is set to YES doxygen generates more compact LaTeX
-# documents. This may be useful for small projects and may help to save some
-# trees in general.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-COMPACT_LATEX          = NO
-
-# The PAPER_TYPE tag can be used to set the paper type that is used by the
-# printer.
-# Possible values are: a4 (210 x 297 mm), letter (8.5 x 11 inches), legal (8.5 x
-# 14 inches) and executive (7.25 x 10.5 inches).
-# The default value is: a4.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-PAPER_TYPE             = a4
-
-# The EXTRA_PACKAGES tag can be used to specify one or more LaTeX package names
-# that should be included in the LaTeX output. To get the times font for
-# instance you can specify
-# EXTRA_PACKAGES=times
-# If left blank no extra packages will be included.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-EXTRA_PACKAGES         =
-
-# The LATEX_HEADER tag can be used to specify a personal LaTeX header for the
-# generated LaTeX document. The header should contain everything until the first
-# chapter. If it is left blank doxygen will generate a standard header. See
-# section "Doxygen usage" for information on how to let doxygen write the
-# default header to a separate file.
-#
-# Note: Only use a user-defined header if you know what you are doing! The
-# following commands have a special meaning inside the header: $title,
-# $datetime, $date, $doxygenversion, $projectname, $projectnumber. Doxygen will
-# replace them by respectively the title of the page, the current date and time,
-# only the current date, the version number of doxygen, the project name (see
-# PROJECT_NAME), or the project number (see PROJECT_NUMBER).
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-LATEX_HEADER           =
-
-# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for the
-# generated LaTeX document. The footer should contain everything after the last
-# chapter. If it is left blank doxygen will generate a standard footer.
-#
-# Note: Only use a user-defined footer if you know what you are doing!
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-LATEX_FOOTER           =
-
-# The LATEX_EXTRA_FILES tag can be used to specify one or more extra images or
-# other source files which should be copied to the LATEX_OUTPUT output
-# directory. Note that the files will be copied as-is; there are no commands or
-# markers available.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-LATEX_EXTRA_FILES      =
-
-# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated is
-# prepared for conversion to PDF (using ps2pdf or pdflatex). The PDF file will
-# contain links (just like the HTML output) instead of page references. This
-# makes the output suitable for online browsing using a PDF viewer.
-# The default value is: YES.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-PDF_HYPERLINKS         = YES
-
-# If the LATEX_PDFLATEX tag is set to YES, doxygen will use pdflatex to generate
-# the PDF file directly from the LaTeX files. Set this option to YES to get a
-# higher quality PDF documentation.
-# The default value is: YES.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-USE_PDFLATEX           = YES
-
-# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \batchmode
-# command to the generated LaTeX files. This will instruct LaTeX to keep running
-# if errors occur, instead of asking the user for help. This option is also used
-# when generating formulas in HTML.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-LATEX_BATCHMODE        = NO
-
-# If the LATEX_HIDE_INDICES tag is set to YES then doxygen will not include the
-# index chapters (such as File Index, Compound Index, etc.) in the output.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-LATEX_HIDE_INDICES     = NO
-
-# If the LATEX_SOURCE_CODE tag is set to YES then doxygen will include source
-# code with syntax highlighting in the LaTeX output.
-#
-# Note that which sources are shown also depends on other settings such as
-# SOURCE_BROWSER.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-LATEX_SOURCE_CODE      = NO
-
-# The LATEX_BIB_STYLE tag can be used to specify the style to use for the
-# bibliography, e.g. plainnat, or ieeetr. See
-# http://en.wikipedia.org/wiki/BibTeX and \cite for more info.
-# The default value is: plain.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-LATEX_BIB_STYLE        = plain
-
-#---------------------------------------------------------------------------
-# Configuration options related to the RTF output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_RTF tag is set to YES doxygen will generate RTF output. The
-# RTF output is optimized for Word 97 and may not look too pretty with other RTF
-# readers/editors.
-# The default value is: NO.
-
-GENERATE_RTF           = NO
-
-# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. If a
-# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
-# it.
-# The default directory is: rtf.
-# This tag requires that the tag GENERATE_RTF is set to YES.
-
-RTF_OUTPUT             = rtf
-
-# If the COMPACT_RTF tag is set to YES doxygen generates more compact RTF
-# documents. This may be useful for small projects and may help to save some
-# trees in general.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_RTF is set to YES.
-
-COMPACT_RTF            = NO
-
-# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated will
-# contain hyperlink fields. The RTF file will contain links (just like the HTML
-# output) instead of page references. This makes the output suitable for online
-# browsing using Word or some other Word compatible readers that support those
-# fields.
-#
-# Note: WordPad (write) and others do not support links.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_RTF is set to YES.
-
-RTF_HYPERLINKS         = NO
-
-# Load stylesheet definitions from file. Syntax is similar to doxygen's config
-# file, i.e. a series of assignments. You only have to provide replacements,
-# missing definitions are set to their default value.
-#
-# See also section "Doxygen usage" for information on how to generate the
-# default style sheet that doxygen normally uses.
-# This tag requires that the tag GENERATE_RTF is set to YES.
-
-RTF_STYLESHEET_FILE    =
-
-# Set optional variables used in the generation of an RTF document. Syntax is
-# similar to doxygen's config file. A template extensions file can be generated
-# using doxygen -e rtf extensionFile.
-# This tag requires that the tag GENERATE_RTF is set to YES.
-
-RTF_EXTENSIONS_FILE    =
-
-#---------------------------------------------------------------------------
-# Configuration options related to the man page output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_MAN tag is set to YES doxygen will generate man pages for
-# classes and files.
-# The default value is: NO.
-
-GENERATE_MAN           = NO
-
-# The MAN_OUTPUT tag is used to specify where the man pages will be put. If a
-# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
-# it. A directory man3 will be created inside the directory specified by
-# MAN_OUTPUT.
-# The default directory is: man.
-# This tag requires that the tag GENERATE_MAN is set to YES.
-
-MAN_OUTPUT             = man
-
-# The MAN_EXTENSION tag determines the extension that is added to the generated
-# man pages. In case the manual section does not start with a number, the number
-# 3 is prepended. The dot (.) at the beginning of the MAN_EXTENSION tag is
-# optional.
-# The default value is: .3.
-# This tag requires that the tag GENERATE_MAN is set to YES.
-
-MAN_EXTENSION          = .3
-
-# If the MAN_LINKS tag is set to YES and doxygen generates man output, then it
-# will generate one additional man file for each entity documented in the real
-# man page(s). These additional files only source the real man page, but without
-# them the man command would be unable to find the correct page.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_MAN is set to YES.
-
-MAN_LINKS              = NO
-
-#---------------------------------------------------------------------------
-# Configuration options related to the XML output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_XML tag is set to YES doxygen will generate an XML file that
-# captures the structure of the code including all documentation.
-# The default value is: NO.
-
-GENERATE_XML           = NO
-
-# The XML_OUTPUT tag is used to specify where the XML pages will be put. If a
-# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
-# it.
-# The default directory is: xml.
-# This tag requires that the tag GENERATE_XML is set to YES.
-
-XML_OUTPUT             = xml
-
-# The XML_SCHEMA tag can be used to specify a XML schema, which can be used by a
-# validating XML parser to check the syntax of the XML files.
-# This tag requires that the tag GENERATE_XML is set to YES.
-
-XML_SCHEMA             =
-
-# The XML_DTD tag can be used to specify a XML DTD, which can be used by a
-# validating XML parser to check the syntax of the XML files.
-# This tag requires that the tag GENERATE_XML is set to YES.
-
-XML_DTD                =
-
-# If the XML_PROGRAMLISTING tag is set to YES doxygen will dump the program
-# listings (including syntax highlighting and cross-referencing information) to
-# the XML output. Note that enabling this will significantly increase the size
-# of the XML output.
-# The default value is: YES.
-# This tag requires that the tag GENERATE_XML is set to YES.
-
-XML_PROGRAMLISTING     = YES
-
-#---------------------------------------------------------------------------
-# Configuration options related to the DOCBOOK output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_DOCBOOK tag is set to YES doxygen will generate Docbook files
-# that can be used to generate PDF.
-# The default value is: NO.
-
-GENERATE_DOCBOOK       = NO
-
-# The DOCBOOK_OUTPUT tag is used to specify where the Docbook pages will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be put in
-# front of it.
-# The default directory is: docbook.
-# This tag requires that the tag GENERATE_DOCBOOK is set to YES.
-
-DOCBOOK_OUTPUT         = docbook
-
-#---------------------------------------------------------------------------
-# Configuration options for the AutoGen Definitions output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_AUTOGEN_DEF tag is set to YES doxygen will generate an AutoGen
-# Definitions (see http://autogen.sf.net) file that captures the structure of
-# the code including all documentation. Note that this feature is still
-# experimental and incomplete at the moment.
-# The default value is: NO.
-
-GENERATE_AUTOGEN_DEF   = NO
-
-#---------------------------------------------------------------------------
-# Configuration options related to the Perl module output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_PERLMOD tag is set to YES doxygen will generate a Perl module
-# file that captures the structure of the code including all documentation.
-#
-# Note that this feature is still experimental and incomplete at the moment.
-# The default value is: NO.
-
-GENERATE_PERLMOD       = NO
-
-# If the PERLMOD_LATEX tag is set to YES doxygen will generate the necessary
-# Makefile rules, Perl scripts and LaTeX code to be able to generate PDF and DVI
-# output from the Perl module output.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_PERLMOD is set to YES.
-
-PERLMOD_LATEX          = NO
-
-# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be nicely
-# formatted so it can be parsed by a human reader. This is useful if you want to
-# understand what is going on. On the other hand, if this tag is set to NO the
-# size of the Perl module output will be much smaller and Perl will parse it
-# just the same.
-# The default value is: YES.
-# This tag requires that the tag GENERATE_PERLMOD is set to YES.
-
-PERLMOD_PRETTY         = YES
-
-# The names of the make variables in the generated doxyrules.make file are
-# prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. This is useful
-# so different doxyrules.make files included by the same Makefile don't
-# overwrite each other's variables.
-# This tag requires that the tag GENERATE_PERLMOD is set to YES.
-
-PERLMOD_MAKEVAR_PREFIX =
-
-#---------------------------------------------------------------------------
-# Configuration options related to the preprocessor
-#---------------------------------------------------------------------------
-
-# If the ENABLE_PREPROCESSING tag is set to YES doxygen will evaluate all
-# C-preprocessor directives found in the sources and include files.
-# The default value is: YES.
-
-ENABLE_PREPROCESSING   = YES
-
-# If the MACRO_EXPANSION tag is set to YES doxygen will expand all macro names
-# in the source code. If set to NO only conditional compilation will be
-# performed. Macro expansion can be done in a controlled way by setting
-# EXPAND_ONLY_PREDEF to YES.
-# The default value is: NO.
-# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
-
-MACRO_EXPANSION        = NO
-
-# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES then
-# the macro expansion is limited to the macros specified with the PREDEFINED and
-# EXPAND_AS_DEFINED tags.
-# The default value is: NO.
-# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
-
-EXPAND_ONLY_PREDEF     = NO
-
-# If the SEARCH_INCLUDES tag is set to YES the includes files in the
-# INCLUDE_PATH will be searched if a #include is found.
-# The default value is: YES.
-# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
-
-SEARCH_INCLUDES        = YES
-
-# The INCLUDE_PATH tag can be used to specify one or more directories that
-# contain include files that are not input files but should be processed by the
-# preprocessor.
-# This tag requires that the tag SEARCH_INCLUDES is set to YES.
-
-INCLUDE_PATH           =
-
-# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
-# patterns (like *.h and *.hpp) to filter out the header-files in the
-# directories. If left blank, the patterns specified with FILE_PATTERNS will be
-# used.
-# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
-
-INCLUDE_FILE_PATTERNS  =
-
-# The PREDEFINED tag can be used to specify one or more macro names that are
-# defined before the preprocessor is started (similar to the -D option of e.g.
-# gcc). The argument of the tag is a list of macros of the form: name or
-# name=definition (no spaces). If the definition and the "=" are omitted, "=1"
-# is assumed. To prevent a macro definition from being undefined via #undef or
-# recursively expanded use the := operator instead of the = operator.
-# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
-
-PREDEFINED             =
-
-# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
-# tag can be used to specify a list of macro names that should be expanded. The
-# macro definition that is found in the sources will be used. Use the PREDEFINED
-# tag if you want to use a different macro definition that overrules the
-# definition found in the source code.
-# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
-
-EXPAND_AS_DEFINED      =
-
-# If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will
-# remove all refrences to function-like macros that are alone on a line, have an
-# all uppercase name, and do not end with a semicolon. Such function macros are
-# typically used for boiler-plate code, and will confuse the parser if not
-# removed.
-# The default value is: YES.
-# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
-
-SKIP_FUNCTION_MACROS   = YES
-
-#---------------------------------------------------------------------------
-# Configuration options related to external references
-#---------------------------------------------------------------------------
-
-# The TAGFILES tag can be used to specify one or more tag files. For each tag
-# file the location of the external documentation should be added. The format of
-# a tag file without this location is as follows:
-# TAGFILES = file1 file2 ...
-# Adding location for the tag files is done as follows:
-# TAGFILES = file1=loc1 "file2 = loc2" ...
-# where loc1 and loc2 can be relative or absolute paths or URLs. See the
-# section "Linking to external documentation" for more information about the use
-# of tag files.
-# Note: Each tag file must have an unique name (where the name does NOT include
-# the path). If a tag file is not located in the directory in which doxygen is
-# run, you must also specify the path to the tagfile here.
-
-TAGFILES               =
-
-# When a file name is specified after GENERATE_TAGFILE, doxygen will create a
-# tag file that is based on the input files it reads. See section "Linking to
-# external documentation" for more information about the usage of tag files.
-
-GENERATE_TAGFILE       =
-
-# If the ALLEXTERNALS tag is set to YES all external class will be listed in the
-# class index. If set to NO only the inherited external classes will be listed.
-# The default value is: NO.
-
-ALLEXTERNALS           = NO
-
-# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed in
-# the modules index. If set to NO, only the current project's groups will be
-# listed.
-# The default value is: YES.
-
-EXTERNAL_GROUPS        = YES
-
-# If the EXTERNAL_PAGES tag is set to YES all external pages will be listed in
-# the related pages index. If set to NO, only the current project's pages will
-# be listed.
-# The default value is: YES.
-
-EXTERNAL_PAGES         = YES
-
-# The PERL_PATH should be the absolute path and name of the perl script
-# interpreter (i.e. the result of 'which perl').
-# The default file (with absolute path) is: /us

<TRUNCATED>


[45/51] [abbrv] [partial] incubator-quickstep git commit: remove c++ files

Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/catalog/tests/PartitionScheme_unittest.cpp
----------------------------------------------------------------------
diff --git a/catalog/tests/PartitionScheme_unittest.cpp b/catalog/tests/PartitionScheme_unittest.cpp
deleted file mode 100644
index d10b26e..0000000
--- a/catalog/tests/PartitionScheme_unittest.cpp
+++ /dev/null
@@ -1,652 +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 <algorithm>
-#include <cstddef>
-#include <cstdint>
-#include <cstring>
-#include <limits>
-#include <memory>
-#include <utility>
-#include <vector>
-
-#include "catalog/CatalogTypedefs.hpp"
-#include "catalog/PartitionScheme.hpp"
-#include "catalog/PartitionSchemeHeader.hpp"
-#include "storage/StorageBlockInfo.hpp"
-#include "types/TypeFactory.hpp"
-#include "types/TypeID.hpp"
-#include "types/TypedValue.hpp"
-#include "types/operations/comparisons/Comparison.hpp"
-#include "types/operations/comparisons/EqualComparison.hpp"
-
-#include "gtest/gtest.h"
-
-using std::move;
-using std::size_t;
-
-namespace quickstep {
-
-class Type;
-
-TEST(PartitionSchemeHeaderTest, IntegerHashPartitionSchemeHeaderTest) {
-  const std::size_t num_partitions = 4;
-  std::unique_ptr<PartitionSchemeHeader> partition_scheme_header(
-      new HashPartitionSchemeHeader(num_partitions, 0));
-  EXPECT_EQ(num_partitions, partition_scheme_header->getNumPartitions());
-  EXPECT_EQ(0, partition_scheme_header->getPartitionAttributeId());
-  const int kSampleInts[] = {
-      0, 1, 2, 3, 400, 501, 64783970, 78437883, -2784627};
-  const size_t num_ints = sizeof(kSampleInts) / sizeof(kSampleInts[0]);
-  for (size_t i = 0; i < num_ints; ++i) {
-    // Check if the partition id returned by the partition scheme for
-    // an integer is the same as the hash of the integer modulus the number
-    // of partitions.
-    EXPECT_EQ(TypedValue(kSampleInts[i]).getHash() % num_partitions,
-              partition_scheme_header->getPartitionId(TypedValue(kSampleInts[i])));
-  }
-}
-
-TEST(PartitionSchemeHeaderTest, LongHashPartitionSchemeHeaderTest) {
-  const std::size_t num_partitions = 8;
-  std::unique_ptr<PartitionSchemeHeader> partition_scheme_header(
-      new HashPartitionSchemeHeader(num_partitions, 0));
-  EXPECT_EQ(num_partitions, partition_scheme_header->getNumPartitions());
-  EXPECT_EQ(0, partition_scheme_header->getPartitionAttributeId());
-  const std::int64_t kSampleLongs[] = {INT64_C(10),
-                                  INT64_C(100),
-                                  INT64_C(1025),
-                                  INT64_C(9876543),
-                                  INT64_C(-89234758937573987)};
-  const size_t num_longs = sizeof(kSampleLongs) / sizeof(kSampleLongs[0]);
-  // Check if the partition id returned by the partition scheme for
-  // a long is the same as the hash of the long number modulus the number
-  // of partitions.
-  for (size_t i = 0; i < num_longs; ++i) {
-    EXPECT_EQ(TypedValue(kSampleLongs[i]).getHash() % num_partitions,
-              partition_scheme_header->getPartitionId(TypedValue(kSampleLongs[i])));
-  }
-}
-
-TEST(PartitionSchemeHeaderTest, FloatHashPartitionSchemeHeaderTest) {
-  const std::size_t num_partitions = 5;
-  std::unique_ptr<PartitionSchemeHeader> partition_scheme_header(
-      new HashPartitionSchemeHeader(num_partitions, 0));
-  EXPECT_EQ(num_partitions, partition_scheme_header->getNumPartitions());
-  EXPECT_EQ(0, partition_scheme_header->getPartitionAttributeId());
-  const float kSampleFloats[] = {
-      285728.895680f, 924005.4989f, -8973494.37438f};
-  const size_t num_floats = sizeof(kSampleFloats) / sizeof(kSampleFloats[0]);
-  // Check if the partition id returned by the partition scheme for
-  // a float is the same as the hash of the floating point number modulus
-  // the number of partitions.
-  for (size_t i = 0; i < num_floats; ++i) {
-    EXPECT_EQ(TypedValue(kSampleFloats[i]).getHash() % num_partitions,
-              partition_scheme_header->getPartitionId(TypedValue(kSampleFloats[i])));
-  }
-}
-
-TEST(PartitionSchemeHeaderTest, DoubleHashPartitionSchemeHeaderTest) {
-  const std::size_t num_partitions = 6;
-  std::unique_ptr<PartitionSchemeHeader> partition_scheme_header(
-      new HashPartitionSchemeHeader(num_partitions, 0));
-  EXPECT_EQ(num_partitions, partition_scheme_header->getNumPartitions());
-  EXPECT_EQ(0, partition_scheme_header->getPartitionAttributeId());
-  const double kSampleDoubles[] = {
-      1.0378, 763624.46343453, -87238497384.3187431894713};
-  const size_t num_doubles = sizeof(kSampleDoubles) / sizeof(kSampleDoubles[0]);
-  // Check if the partition id returned by the partition scheme for
-  // a double is the same as the hash of the double modulus the number
-  // of partitions.
-  for (size_t i = 0; i < num_doubles; ++i) {
-    EXPECT_EQ(
-        TypedValue(kSampleDoubles[i]).getHash() % num_partitions,
-        partition_scheme_header->getPartitionId(TypedValue(kSampleDoubles[i])));
-  }
-}
-
-TEST(PartitionSchemeHeaderTest, CharacterHashPartitionSchemeHeaderTest) {
-  const std::size_t num_partitions = 7;
-  std::unique_ptr<PartitionSchemeHeader> partition_scheme_header(
-      new HashPartitionSchemeHeader(num_partitions, 0));
-  EXPECT_EQ(num_partitions, partition_scheme_header->getNumPartitions());
-  EXPECT_EQ(0, partition_scheme_header->getPartitionAttributeId());
-  const char *kSampleStrings[] = {
-      "a", "gerald", "ram", "3081289", "=42?", "+-/*&^%", "hello_world"};
-  const size_t num_strings = sizeof(kSampleStrings) / sizeof(kSampleStrings[0]);
-  // Check if the partition id returned by the partition scheme for
-  // characters is the same as the hash of the characters modulus the number
-  // of partitions.
-  for (size_t i = 0; i < num_strings; ++i) {
-    EXPECT_EQ(
-        TypedValue(
-            kChar, kSampleStrings[i], std::strlen(kSampleStrings[i]) + 1)
-                .getHash() %
-            num_partitions,
-        partition_scheme_header->getPartitionId(TypedValue(
-            kChar, kSampleStrings[i], std::strlen(kSampleStrings[i]) + 1)));
-  }
-}
-
-TEST(PartitionSchemeHeaderTest, VarCharHashPartitionSchemeHeaderTest) {
-  const std::size_t num_partitions = 7;
-  std::unique_ptr<PartitionSchemeHeader> partition_scheme_header(
-      new HashPartitionSchemeHeader(num_partitions, 0));
-  EXPECT_EQ(num_partitions, partition_scheme_header->getNumPartitions());
-  EXPECT_EQ(0, partition_scheme_header->getPartitionAttributeId());
-  const char *kSampleStrings[] = {
-      "hello", "world", "1234567", "!@#$^&*", "pa345+="};
-  const size_t num_strings = sizeof(kSampleStrings) / sizeof(kSampleStrings[0]);
-  // Check if the partition id returned by the partition scheme for
-  // a variable length string is the same as the hash of the variable length string
-  // modulus the number of partitions.
-  for (size_t i = 0; i < num_strings; ++i) {
-    EXPECT_EQ(
-        TypedValue(
-            kVarChar, kSampleStrings[i], std::strlen(kSampleStrings[i]) + 1)
-                .getHash() %
-            num_partitions,
-        partition_scheme_header->getPartitionId(
-            TypedValue(kVarChar,
-                       kSampleStrings[i],
-                       std::strlen(kSampleStrings[i]) + 1)));
-  }
-}
-
-TEST(PartitionSchemeHeaderTest, IntegerRangePartitionSchemeHeaderTest) {
-  std::vector<TypedValue> partition_range;
-  // Partition boundaries are 0, 10, 20.
-  // Last partition can hold upto infinity.
-  // First partition can hold from -infinity to -1.
-  for (int i = 0; i < 3; ++i) {
-    partition_range.push_back(TypedValue(i * 10));
-  }
-  std::unique_ptr<PartitionSchemeHeader> partition_scheme_header(
-      new RangePartitionSchemeHeader(TypeFactory::GetType(kInt), 4, 0, move(partition_range)));
-  EXPECT_EQ(4u, partition_scheme_header->getNumPartitions());
-  // Check if the partition id returned by the Range Partition Scheme for
-  // integers is the same as the partition id into which it is supposed to
-  // be based on the partition boundaries that we have defined.
-  EXPECT_EQ(0, partition_scheme_header->getPartitionAttributeId());
-  EXPECT_EQ(1u, partition_scheme_header->getPartitionId(TypedValue(0)));
-  EXPECT_EQ(2u, partition_scheme_header->getPartitionId(TypedValue(10)));
-  EXPECT_EQ(3u, partition_scheme_header->getPartitionId(TypedValue(20)));
-  EXPECT_EQ(3u, partition_scheme_header->getPartitionId(TypedValue(30)));
-  EXPECT_EQ(0u, partition_scheme_header->getPartitionId(TypedValue(-4)));
-  EXPECT_EQ(2u, partition_scheme_header->getPartitionId(TypedValue(15)));
-  EXPECT_EQ(1u, partition_scheme_header->getPartitionId(TypedValue(6)));
-  EXPECT_EQ(0u, partition_scheme_header->getPartitionId(TypedValue(-70)));
-  EXPECT_EQ(3u, partition_scheme_header->getPartitionId(TypedValue(1000)));
-  EXPECT_EQ(3u, partition_scheme_header->getPartitionId(TypedValue(20000)));
-}
-
-TEST(PartitionSchemeHeaderTest, LongRangePartitionSchemeHeaderTest) {
-  std::vector<TypedValue> partition_range;
-  // Partition boundaries are 0, 10000, 20000, 30000
-  for (int i = 0; i < 3; ++i) {
-    partition_range.push_back(TypedValue(i * INT64_C(10000)));
-  }
-  std::unique_ptr<PartitionSchemeHeader> partition_scheme_header(
-      new RangePartitionSchemeHeader(TypeFactory::GetType(kLong), 4, 0, move(partition_range)));
-
-  EXPECT_EQ(4u, partition_scheme_header->getNumPartitions());
-  EXPECT_EQ(0, partition_scheme_header->getPartitionAttributeId());
-  // Check if the partition id returned by the Range Partition Scheme for
-  // long numbers is the same as the partition id into which it is supposed to
-  // be based on the partition boundaries that we have defined.
-  EXPECT_EQ(1u, partition_scheme_header->getPartitionId(TypedValue(INT64_C(0))));
-  EXPECT_EQ(2u, partition_scheme_header->getPartitionId(TypedValue(INT64_C(13456))));
-  EXPECT_EQ(3u, partition_scheme_header->getPartitionId(TypedValue(INT64_C(20000))));
-  EXPECT_EQ(3u, partition_scheme_header->getPartitionId(TypedValue(INT64_C(300123))));
-  EXPECT_EQ(0u,
-            partition_scheme_header->getPartitionId(TypedValue(INT64_C(-400000))));
-  EXPECT_EQ(2u, partition_scheme_header->getPartitionId(TypedValue(INT64_C(15123))));
-  EXPECT_EQ(1u, partition_scheme_header->getPartitionId(TypedValue(INT64_C(6012))));
-  EXPECT_EQ(0u,
-            partition_scheme_header->getPartitionId(TypedValue(INT64_C(-7000000))));
-}
-
-TEST(PartitionSchemeHeaderTest, FloatRangePartitionSchemeHeaderTest) {
-  std::vector<TypedValue> partition_range;
-  // Partition boundaries are 0.0, 10.0, 20.0
-  for (int i = 0; i < 3; ++i) {
-    partition_range.push_back(TypedValue(i * 10.0f));
-  }
-  std::unique_ptr<PartitionSchemeHeader> partition_scheme_header(
-      new RangePartitionSchemeHeader(TypeFactory::GetType(kFloat), 4, 0, move(partition_range)));
-  EXPECT_EQ(4u, partition_scheme_header->getNumPartitions());
-  EXPECT_EQ(0, partition_scheme_header->getPartitionAttributeId());
-  // Check if the partition id returned by the Range Partition Scheme for
-  // floats is the same as the partition id into which it is supposed to
-  // be based on the partition boundaries that we have defined.
-  EXPECT_EQ(1u, partition_scheme_header->getPartitionId(TypedValue(0.1f)));
-  EXPECT_EQ(2u, partition_scheme_header->getPartitionId(TypedValue(10.00000000f)));
-  EXPECT_EQ(3u, partition_scheme_header->getPartitionId(TypedValue(20.23f)));
-  EXPECT_EQ(3u, partition_scheme_header->getPartitionId(TypedValue(30.56f)));
-  EXPECT_EQ(0u, partition_scheme_header->getPartitionId(TypedValue(-4.5f)));
-  EXPECT_EQ(2u, partition_scheme_header->getPartitionId(TypedValue(15.034f)));
-  EXPECT_EQ(1u, partition_scheme_header->getPartitionId(TypedValue(6.987f)));
-  EXPECT_EQ(0u, partition_scheme_header->getPartitionId(TypedValue(-70.384f)));
-}
-
-TEST(PartitionSchemeHeaderTest, DoubleRangePartitionSchemeHeaderTest) {
-  std::vector<TypedValue> partition_range;
-  // Partition boundaries are 0.00000, 10.00000, 20.00000
-  for (int i = 0; i < 3; ++i) {
-    partition_range.push_back(TypedValue(i * 10.00000));
-  }
-  std::unique_ptr<PartitionSchemeHeader> partition_scheme_header(
-      new RangePartitionSchemeHeader(TypeFactory::GetType(kDouble), 4, 0, move(partition_range)));
-  EXPECT_EQ(4u, partition_scheme_header->getNumPartitions());
-  EXPECT_EQ(0, partition_scheme_header->getPartitionAttributeId());
-  // Check if the partition id returned by the Range Partition Scheme for
-  // doubles is the same as the partition id into which it is supposed to
-  // be based on the partition boundaries that we have defined.
-  EXPECT_EQ(1u, partition_scheme_header->getPartitionId(TypedValue(0.1897438974)));
-  EXPECT_EQ(2u,
-            partition_scheme_header->getPartitionId(TypedValue(10.00000000287489)));
-  EXPECT_EQ(3u,
-            partition_scheme_header->getPartitionId(TypedValue(20.23249859403750)));
-  EXPECT_EQ(3u, partition_scheme_header->getPartitionId(TypedValue(30.567866347563)));
-  EXPECT_EQ(0u,
-            partition_scheme_header->getPartitionId(TypedValue(-4.57583978935689)));
-  EXPECT_EQ(2u,
-            partition_scheme_header->getPartitionId(TypedValue(15.034248758978936)));
-  EXPECT_EQ(1u, partition_scheme_header->getPartitionId(TypedValue(6.98792489)));
-  EXPECT_EQ(
-      0u, partition_scheme_header->getPartitionId(TypedValue(-70.38454985893768738)));
-}
-
-TEST(PartitionSchemeHeaderTest, CharacterRangePartitionSchemeHeaderTest) {
-  std::vector<TypedValue> partition_range;
-  // Partition boundaries are the following 3 characters.
-  const char *kRangeBoundaryStrings[] = {"don", "hippo", "pattasu"};
-  const size_t num_boundaries = sizeof(kRangeBoundaryStrings) / sizeof(kRangeBoundaryStrings[0]);
-  for (size_t i = 0; i < num_boundaries; ++i) {
-    partition_range.push_back(
-        TypedValue(kChar,
-                   kRangeBoundaryStrings[i],
-                   std::strlen(kRangeBoundaryStrings[i]) + 1));
-  }
-  std::unique_ptr<PartitionSchemeHeader> partition_scheme_header(
-      new RangePartitionSchemeHeader(TypeFactory::GetType(kChar, 20, false), 4, 0, move(partition_range)));
-  EXPECT_EQ(4u, partition_scheme_header->getNumPartitions());
-  EXPECT_EQ(0, partition_scheme_header->getPartitionAttributeId());
-  const char *kSampleStrings[] = {"amma",
-                                  "ganesh",
-                                  "e",
-                                  "imo",
-                                  "master",
-                                  "pathetic",
-                                  "turing",
-                                  "wentao",
-                                  "dog",
-                                  "zebra"};
-  const partition_id kExpectedPartitions[] = {0, 1, 1, 2, 2, 2, 3, 3, 0, 3};
-  const size_t num_strings = sizeof(kExpectedPartitions) / sizeof(kExpectedPartitions[0]);
-  // Check if the partition id returned by the Range Partition Scheme for
-  // characters is the same as the partition id into which it is supposed to
-  // be based on the partition boundaries that we have defined.
-  for (size_t i = 0; i < num_strings; ++i) {
-    EXPECT_EQ(
-        kExpectedPartitions[i],
-        partition_scheme_header->getPartitionId(TypedValue(
-            kChar, kSampleStrings[i], std::strlen(kSampleStrings[i]) + 1)));
-  }
-}
-
-TEST(PartitionSchemeHeaderTest, VarCharRangePartitionSchemeHeaderTest) {
-  std::vector<TypedValue> partition_range;
-  // Partition boundaries are the following 3 strings.
-  const char *kRangeBoundaryStrings[] = { "elephant", "jamaica", "zorgonz"};
-  const size_t num_boundaries = sizeof(kRangeBoundaryStrings) / sizeof(kRangeBoundaryStrings[0]);
-  for (size_t i = 0; i < num_boundaries; ++i) {
-    partition_range.push_back(
-        TypedValue(kVarChar,
-                   kRangeBoundaryStrings[i],
-                   std::strlen(kRangeBoundaryStrings[i]) + 1));
-  }
-
-  std::unique_ptr<PartitionSchemeHeader> partition_scheme_header(
-      new RangePartitionSchemeHeader(TypeFactory::GetType(kVarChar, 20, false), 4, 0, move(partition_range)));
-  EXPECT_EQ(4u, partition_scheme_header->getNumPartitions());
-  EXPECT_EQ(0, partition_scheme_header->getPartitionAttributeId());
-  const char *kSampleStrings[] = {"apple",
-                                  "halloween",
-                                  "mango",
-                                  "turkey",
-                                  "elephant",
-                                  "sathyam",
-                                  "zyxw",
-                                  "zorgonz"};
-  const partition_id kExpectedPartitions[] = {0, 1, 2, 2, 1, 2, 3, 3};
-  const size_t num_strings = sizeof(kExpectedPartitions) / sizeof(kExpectedPartitions[0]);
-  // Check if the partition id returned by the Range Partition Scheme for
-  // variable length strings is the same as the partition id into which it
-  // is supposed to be based on the partition boundaries that we have defined.
-  for (size_t i = 0; i < num_strings; ++i) {
-    EXPECT_EQ(kExpectedPartitions[i],
-              partition_scheme_header->getPartitionId(
-                  TypedValue(kVarChar,
-                             kSampleStrings[i],
-                             std::strlen(kSampleStrings[i]) + 1)));
-  }
-}
-
-TEST(PartitionSchemeTest, AddBlocksToPartitionTest) {
-  std::unique_ptr<PartitionScheme> partition_scheme(
-      new PartitionScheme(new HashPartitionSchemeHeader(4, 0)));
-  for (int i = 0; i < 10; ++i) {
-    partition_scheme->addBlockToPartition(i, i % 4);
-  }
-
-  // Compute blocks in each partition.
-  const std::vector<block_id> blocks_in_partition_zero =
-      partition_scheme->getBlocksInPartition(0);
-  const std::vector<block_id> blocks_in_partition_one =
-      partition_scheme->getBlocksInPartition(1);
-  const std::vector<block_id> blocks_in_partition_two =
-      partition_scheme->getBlocksInPartition(2);
-  const std::vector<block_id> blocks_in_partition_three =
-      partition_scheme->getBlocksInPartition(3);
-
-  EXPECT_EQ(4u, partition_scheme->getPartitionSchemeHeader().getNumPartitions());
-  EXPECT_EQ(0, partition_scheme->getPartitionSchemeHeader().getPartitionAttributeId());
-
-  // Check if the blocks are present in the partitions that we
-  // expect them to be based on where we inserted them.
-  EXPECT_NE(blocks_in_partition_zero.end(),
-            std::find(blocks_in_partition_zero.begin(),
-                      blocks_in_partition_zero.end(),
-                      0));
-  EXPECT_NE(blocks_in_partition_zero.end(),
-            std::find(blocks_in_partition_zero.begin(),
-                      blocks_in_partition_zero.end(),
-                      4));
-  EXPECT_NE(blocks_in_partition_zero.end(),
-            std::find(blocks_in_partition_zero.begin(),
-                      blocks_in_partition_zero.end(),
-                      8));
-  EXPECT_NE(
-      blocks_in_partition_one.end(),
-      std::find(
-          blocks_in_partition_one.begin(), blocks_in_partition_one.end(), 1));
-  EXPECT_NE(
-      blocks_in_partition_one.end(),
-      std::find(
-          blocks_in_partition_one.begin(), blocks_in_partition_one.end(), 5));
-  EXPECT_NE(
-      blocks_in_partition_one.end(),
-      std::find(
-          blocks_in_partition_one.begin(), blocks_in_partition_one.end(), 9));
-  EXPECT_NE(
-      blocks_in_partition_two.end(),
-      std::find(
-          blocks_in_partition_two.begin(), blocks_in_partition_two.end(), 2));
-  EXPECT_NE(
-      blocks_in_partition_two.end(),
-      std::find(
-          blocks_in_partition_two.begin(), blocks_in_partition_two.end(), 6));
-  EXPECT_NE(blocks_in_partition_three.end(),
-            std::find(blocks_in_partition_three.begin(),
-                      blocks_in_partition_three.end(),
-                      3));
-  EXPECT_NE(blocks_in_partition_three.end(),
-            std::find(blocks_in_partition_three.begin(),
-                      blocks_in_partition_three.end(),
-                      7));
-  // Check if the number of blocks in a partition are as expected.
-  EXPECT_EQ(3u, blocks_in_partition_zero.size());
-  EXPECT_EQ(3u, blocks_in_partition_one.size());
-  EXPECT_EQ(2u, blocks_in_partition_two.size());
-  EXPECT_EQ(2u, blocks_in_partition_three.size());
-}
-
-TEST(PartitionSchemeTest, RemoveBlocksFromPartitionTest) {
-  std::unique_ptr<PartitionScheme> partition_scheme(
-      new PartitionScheme(new HashPartitionSchemeHeader(4, 0)));
-  for (int i = 0; i < 10; ++i) {
-    partition_scheme->addBlockToPartition(i, i % 4);
-  }
-
-  EXPECT_EQ(4u, partition_scheme->getPartitionSchemeHeader().getNumPartitions());
-  EXPECT_EQ(0, partition_scheme->getPartitionSchemeHeader().getPartitionAttributeId());
-  // remove block 0 from partition 0
-  partition_scheme->removeBlockFromPartition(0, 0);
-  const std::vector<block_id> blocks_in_partition_zero =
-      partition_scheme->getBlocksInPartition(0);
-  // check if block 0 is removed from partition 0
-  EXPECT_EQ(blocks_in_partition_zero.end(),
-            std::find(blocks_in_partition_zero.begin(),
-                      blocks_in_partition_zero.end(),
-                      0));
-  // Check if block 4 is still present in partition zero.
-  EXPECT_NE(blocks_in_partition_zero.end(),
-            std::find(blocks_in_partition_zero.begin(),
-                      blocks_in_partition_zero.end(),
-                      4));
-  // Check if block 8 is still present in partition zero.
-  EXPECT_NE(blocks_in_partition_zero.end(),
-            std::find(blocks_in_partition_zero.begin(),
-                      blocks_in_partition_zero.end(),
-                      8));
-  EXPECT_EQ(2u, blocks_in_partition_zero.size());
-
-  // remove block 5 from partition 1
-  partition_scheme->removeBlockFromPartition(5, 1);
-  const std::vector<block_id> blocks_in_partition_one =
-      partition_scheme->getBlocksInPartition(1);
-  EXPECT_NE(
-      blocks_in_partition_one.end(),
-      std::find(
-          blocks_in_partition_one.begin(), blocks_in_partition_one.end(), 1));
-  // check if block 5 is not present in partition 1
-  EXPECT_EQ(
-      blocks_in_partition_one.end(),
-      std::find(
-          blocks_in_partition_one.begin(), blocks_in_partition_one.end(), 5));
-  // Check if block 9 is still present in partition one.
-  EXPECT_NE(
-      blocks_in_partition_one.end(),
-      std::find(
-          blocks_in_partition_one.begin(), blocks_in_partition_one.end(), 9));
-  EXPECT_EQ(2u, blocks_in_partition_one.size());
-
-  // remove block 2 from partition 2
-  partition_scheme->removeBlockFromPartition(2, 2);
-  const std::vector<block_id> blocks_in_partition_two =
-      partition_scheme->getBlocksInPartition(2);
-  // check if block 2 is removed from partition 2
-  EXPECT_EQ(
-      blocks_in_partition_two.end(),
-      std::find(
-          blocks_in_partition_two.begin(), blocks_in_partition_two.end(), 2));
-  // Check if block 6 is still present in partition two.
-  EXPECT_NE(
-      blocks_in_partition_two.end(),
-      std::find(
-          blocks_in_partition_two.begin(), blocks_in_partition_two.end(), 6));
-  EXPECT_EQ(1u, blocks_in_partition_two.size());
-
-  // remove block 7 from partition 3
-  partition_scheme->removeBlockFromPartition(7, 3);
-  const std::vector<block_id> blocks_in_partition_three =
-      partition_scheme->getBlocksInPartition(3);
-  // Check if block 3 is still present in partition three.
-  EXPECT_NE(blocks_in_partition_three.end(),
-            std::find(blocks_in_partition_three.begin(),
-                      blocks_in_partition_three.end(),
-                      3));
-  // check if block 7 is removed from partition 3
-  EXPECT_EQ(blocks_in_partition_three.end(),
-            std::find(blocks_in_partition_three.begin(),
-                      blocks_in_partition_three.end(),
-                      7));
-  EXPECT_EQ(1u, blocks_in_partition_three.size());
-}
-
-TEST(PartitionSchemeTest, CheckHashPartitionSchemeSerialization) {
-  const std::size_t num_partitions = 4;
-  std::unique_ptr<PartitionScheme> part_scheme(
-      new PartitionScheme(new HashPartitionSchemeHeader(num_partitions, 0)));
-  // Add some blocks to each partition.
-  for (int i = 0; i < 10; ++i) {
-    part_scheme->addBlockToPartition(i, i % num_partitions);
-  }
-  std::unique_ptr<PartitionScheme> part_scheme_from_proto;
-  part_scheme_from_proto.reset(
-      PartitionScheme::ReconstructFromProto(part_scheme->getProto(), TypeFactory::GetType(kInt)));
-
-  const PartitionSchemeHeader &header = part_scheme->getPartitionSchemeHeader();
-  const PartitionSchemeHeader &header_from_proto = part_scheme_from_proto->getPartitionSchemeHeader();
-
-  // Check the partition type
-  EXPECT_EQ(header.getPartitionType(),
-            header_from_proto.getPartitionType());
-  // Check number of partitions
-  EXPECT_EQ(header.getNumPartitions(),
-            header_from_proto.getNumPartitions());
-  // Check the partition attribute id
-  EXPECT_EQ(header.getPartitionAttributeId(),
-            header_from_proto.getPartitionAttributeId());
-  // Check the block in each partition
-  for (partition_id part_id = 0; part_id < num_partitions; ++part_id) {
-    // Collect the blocks from C++ Partition Scheme object.
-    std::vector<block_id> blocks_in_part_scheme =
-        part_scheme->getBlocksInPartition(part_id);
-    // Collect the blocks from Partition Scheme's protocol buffer.
-    std::vector<block_id> blocks_in_part_scheme_from_proto =
-        part_scheme_from_proto->getBlocksInPartition(part_id);
-    // Sort both these vector of block ids so that we can compare them.
-    std::sort(blocks_in_part_scheme.begin(), blocks_in_part_scheme.end());
-    std::sort(blocks_in_part_scheme_from_proto.begin(),
-              blocks_in_part_scheme_from_proto.end());
-    // Compare the two sorted lists to check if they are equal.
-    EXPECT_EQ(blocks_in_part_scheme, blocks_in_part_scheme_from_proto);
-  }
-}
-
-TEST(PartitionSchemeTest, CheckRangePartitionSchemeSerialization) {
-  const Type &type = TypeFactory::GetType(kInt);
-  const std::size_t num_partitions = 4;
-  std::vector<TypedValue> partition_range;
-  // Partition boundaries are 0, 10, 20.
-  // Last partition can hold upto infinity.
-  // First partition can hold from -infinity to -1.
-  for (std::size_t i = 0; i < num_partitions - 1; ++i) {
-    partition_range.push_back(TypedValue(static_cast<int>(i * 10)));
-  }
-  std::unique_ptr<PartitionScheme> part_scheme(
-      new PartitionScheme(
-          new RangePartitionSchemeHeader(type, num_partitions, 0, move(partition_range))));
-  for (int i = 0; i < 10; ++i) {
-    part_scheme->addBlockToPartition(i * 5, i % num_partitions);
-  }
-  std::unique_ptr<PartitionScheme> part_scheme_from_proto;
-
-  part_scheme_from_proto.reset(
-      PartitionScheme::ReconstructFromProto(part_scheme->getProto(), type));
-
-  const PartitionSchemeHeader &header = part_scheme->getPartitionSchemeHeader();
-  const PartitionSchemeHeader &header_from_proto = part_scheme_from_proto->getPartitionSchemeHeader();
-
-  // Check the partition type
-  EXPECT_EQ(header.getPartitionType(),
-            header_from_proto.getPartitionType());
-
-  // Check number of partitions
-  EXPECT_EQ(header.getNumPartitions(),
-            header_from_proto.getNumPartitions());
-
-  // Check the partition attribute id
-  EXPECT_EQ(header.getPartitionAttributeId(),
-            header_from_proto.getPartitionAttributeId());
-
-  // Check the partition range boundaries' size.
-  const std::vector<TypedValue> &range_boundaries_part_scheme =
-      static_cast<const RangePartitionSchemeHeader&>(header).getPartitionRangeBoundaries();
-  const std::vector<TypedValue> &range_boundaries_part_scheme_from_proto =
-      static_cast<const RangePartitionSchemeHeader&>(header_from_proto).getPartitionRangeBoundaries();
-  EXPECT_EQ(range_boundaries_part_scheme.size(),
-            range_boundaries_part_scheme_from_proto.size());
-
-  // Check the partition range boundaries' values.
-  const Comparison &equal_comparison_op(EqualComparison::Instance());
-  std::unique_ptr<UncheckedComparator> equal_unchecked_comparator;
-  equal_unchecked_comparator.reset(
-      equal_comparison_op.makeUncheckedComparatorForTypes(
-          TypeFactory::GetType(kInt), TypeFactory::GetType(kInt)));
-  for (std::size_t i = 0; i < range_boundaries_part_scheme.size(); ++i) {
-    EXPECT_TRUE(equal_unchecked_comparator->compareTypedValues(
-        range_boundaries_part_scheme[i],
-        range_boundaries_part_scheme_from_proto[i]));
-  }
-
-  // Check the blocks in each partition from both the Partition Scheme's
-  // C++ object and protocol buffer.
-  for (partition_id part_id = 0; part_id < num_partitions; ++part_id) {
-    std::vector<block_id> blocks_in_part_scheme =
-        part_scheme->getBlocksInPartition(part_id);
-    std::vector<block_id> blocks_in_part_scheme_from_proto =
-        part_scheme_from_proto->getBlocksInPartition(part_id);
-    std::sort(blocks_in_part_scheme.begin(), blocks_in_part_scheme.end());
-    std::sort(blocks_in_part_scheme_from_proto.begin(),
-              blocks_in_part_scheme_from_proto.end());
-    EXPECT_EQ(blocks_in_part_scheme, blocks_in_part_scheme_from_proto);
-  }
-}
-
-TEST(PartitionSchemeTest, CheckBlocksInPartitionTest) {
-  std::unique_ptr<PartitionScheme> partition_scheme;
-  constexpr std::size_t kNumBlocks = 10;
-  constexpr std::size_t kNumPartitions = 4;
-  constexpr attribute_id kPartitioningAttribute = 0;
-  // Create a partition scheme object.
-  partition_scheme.reset(
-      new PartitionScheme(new HashPartitionSchemeHeader(kNumPartitions, kPartitioningAttribute)));
-  // Add blocks to different partitions.
-  for (std::size_t block_id = 0; block_id < kNumBlocks; ++block_id) {
-    partition_scheme->addBlockToPartition(block_id,
-                                          block_id % kNumPartitions);
-  }
-
-  const PartitionSchemeHeader &header = partition_scheme->getPartitionSchemeHeader();
-
-  // Check the number of partitions and the partitioning attribute.
-  EXPECT_EQ(kNumPartitions, header.getNumPartitions());
-  EXPECT_EQ(kPartitioningAttribute, header.getPartitionAttributeId());
-
-  // Check if the blocks are correctly assigned to its partitions.
-  EXPECT_EQ(0u, partition_scheme->getPartitionForBlock(0));
-  EXPECT_EQ(1u, partition_scheme->getPartitionForBlock(1));
-  EXPECT_EQ(2u, partition_scheme->getPartitionForBlock(2));
-  EXPECT_EQ(3u, partition_scheme->getPartitionForBlock(3));
-  EXPECT_EQ(0u, partition_scheme->getPartitionForBlock(4));
-  EXPECT_EQ(1u, partition_scheme->getPartitionForBlock(5));
-  EXPECT_EQ(2u, partition_scheme->getPartitionForBlock(6));
-  EXPECT_EQ(3u, partition_scheme->getPartitionForBlock(7));
-  EXPECT_EQ(0u, partition_scheme->getPartitionForBlock(8));
-  EXPECT_EQ(1u, partition_scheme->getPartitionForBlock(9));
-
-  // Block that is not present in any partition.
-  EXPECT_EQ(std::numeric_limits<partition_id>::max(),
-            partition_scheme->getPartitionForBlock(100));
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/cli/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/cli/CMakeLists.txt b/cli/CMakeLists.txt
deleted file mode 100644
index 9b62af9..0000000
--- a/cli/CMakeLists.txt
+++ /dev/null
@@ -1,154 +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_directories(${CMAKE_CURRENT_BINARY_DIR})
-add_subdirectory(tests)
-
-if (WIN32)
-  set(QUICKSTEP_OS_WINDOWS TRUE)
-endif()
-
-if (USE_LINENOISE)
-  set(QUICKSTEP_USE_LINENOISE TRUE)
-endif()
-
-if(LIBNUMA_FOUND)
-  set(QUICKSTEP_HAVE_LIBNUMA TRUE)
-endif()
-
-if (BUILD_SHARED_LIBS)
-  set(GFLAGS_LIB_NAME gflags_nothreads-shared)
-else()
-  set(GFLAGS_LIB_NAME gflags_nothreads-static)
-endif()
-
-if (ENABLE_GOOGLE_PROFILER)
-  set(QUICKSTEP_ENABLE_GOOGLE_PROFILER TRUE)
-endif()
-
-configure_file (
-  "${CMAKE_CURRENT_SOURCE_DIR}/CliConfig.h.in"
-  "${CMAKE_CURRENT_BINARY_DIR}/CliConfig.h"
-)
-add_library(quickstep_cli_CommandExecutor CommandExecutor.cpp CommandExecutor.hpp)
-
-# Declare micro-libs and link dependencies:
-add_library(quickstep_cli_DropRelation DropRelation.cpp DropRelation.hpp)
-target_link_libraries(quickstep_cli_DropRelation
-                      quickstep_catalog_CatalogDatabase
-                      quickstep_catalog_CatalogRelation
-                      quickstep_storage_StorageBlockInfo
-                      quickstep_storage_StorageManager
-                      quickstep_utility_Macros)
-add_library(quickstep_cli_Flags Flags.cpp Flags.hpp)
-
-if(USE_LINENOISE)
-  add_library(quickstep_cli_LineReader
-              LineReader.cpp
-              LineReaderLineNoise.cpp
-              LineReader.hpp
-              LineReaderLineNoise.hpp)
-  target_link_libraries(quickstep_cli_LineReader
-                        linenoise
-                        quickstep_utility_Macros)
-else()
-  add_library(quickstep_cli_LineReader
-              LineReader.cpp
-              LineReaderDumb.cpp
-              LineReader.hpp
-              LineReaderDumb.hpp)
-  target_link_libraries(quickstep_cli_LineReader
-                        quickstep_utility_Macros)
-endif()
-
-add_library(quickstep_cli_DefaultsConfigurator DefaultsConfigurator.cpp DefaultsConfigurator.hpp)
-add_library(quickstep_cli_InputParserUtil InputParserUtil.cpp InputParserUtil.hpp)
-add_library(quickstep_cli_PrintToScreen PrintToScreen.cpp PrintToScreen.hpp)
-
-# Link dependencies:
-target_link_libraries(quickstep_cli_CommandExecutor
-                      glog
-                      quickstep_catalog_CatalogAttribute
-                      quickstep_catalog_CatalogDatabase
-                      quickstep_catalog_CatalogRelation
-                      quickstep_catalog_CatalogRelationSchema
-                      quickstep_cli_DropRelation
-                      quickstep_cli_PrintToScreen
-                      quickstep_parser_ParseStatement
-                      quickstep_parser_SqlParserWrapper
-                      quickstep_queryoptimizer_QueryHandle
-                      quickstep_queryoptimizer_QueryPlan
-                      quickstep_queryoptimizer_QueryProcessor
-                      quickstep_storage_StorageBlock
-                      quickstep_storage_StorageBlockInfo
-                      quickstep_storage_StorageManager
-                      quickstep_storage_TupleIdSequence
-                      quickstep_storage_TupleStorageSubBlock
-                      quickstep_parser_ParseString
-                      quickstep_types_Type
-                      quickstep_types_TypeID
-                      quickstep_types_TypedValue
-                      quickstep_utility_PtrVector
-                      quickstep_utility_SqlError)
-
-target_link_libraries(quickstep_cli_DefaultsConfigurator
-                      glog
-                      quickstep_catalog_Catalog
-                      quickstep_catalog_Catalog_proto
-                      quickstep_catalog_CatalogDatabase
-                      quickstep_utility_Macros)
-if(QUICKSTEP_HAVE_LIBNUMA)
-  target_link_libraries(quickstep_cli_DefaultsConfigurator
-                        ${LIBNUMA_LIBRARY})
-endif()
-target_link_libraries(quickstep_cli_Flags
-                      quickstep_cli_DefaultsConfigurator
-                      quickstep_storage_StorageConstants
-                      ${GFLAGS_LIB_NAME})
-target_link_libraries(quickstep_cli_InputParserUtil
-                      glog
-                      quickstep_utility_Macros
-                      quickstep_utility_StringUtil)
-if(QUICKSTEP_HAVE_LIBNUMA)
-target_link_libraries(quickstep_cli_InputParserUtil
-                      ${LIBNUMA_LIBRARY})
-endif()
-target_link_libraries(quickstep_cli_PrintToScreen
-                      ${GFLAGS_LIB_NAME}
-                      quickstep_catalog_CatalogAttribute
-                      quickstep_catalog_CatalogRelation
-                      quickstep_storage_StorageBlock
-                      quickstep_storage_StorageBlockInfo
-                      quickstep_storage_StorageManager
-                      quickstep_storage_TupleIdSequence
-                      quickstep_storage_TupleStorageSubBlock
-                      quickstep_types_IntType
-                      quickstep_types_Type
-                      quickstep_types_TypedValue
-                      quickstep_utility_Macros)
-
-# Module all-in-one library:
-add_library(quickstep_cli ../empty_src.cpp CliModule.hpp)
-
-target_link_libraries(quickstep_cli
-                      quickstep_cli_CommandExecutor
-                      quickstep_cli_DefaultsConfigurator
-                      quickstep_cli_DropRelation
-                      quickstep_cli_Flags
-                      quickstep_cli_InputParserUtil
-                      quickstep_cli_LineReader
-                      quickstep_cli_PrintToScreen)

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/cli/CliConfig.h.in
----------------------------------------------------------------------
diff --git a/cli/CliConfig.h.in b/cli/CliConfig.h.in
deleted file mode 100644
index 2508f3a..0000000
--- a/cli/CliConfig.h.in
+++ /dev/null
@@ -1,22 +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.
- **/
-
-#cmakedefine QUICKSTEP_USE_LINENOISE
-#cmakedefine QUICKSTEP_OS_WINDOWS
-#cmakedefine QUICKSTEP_ENABLE_GOOGLE_PROFILER

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/cli/CliModule.hpp
----------------------------------------------------------------------
diff --git a/cli/CliModule.hpp b/cli/CliModule.hpp
deleted file mode 100644
index e65de98..0000000
--- a/cli/CliModule.hpp
+++ /dev/null
@@ -1,23 +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 CLI
- *
- * The QuickStep command-line interface.
- **/

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/cli/CommandExecutor.cpp
----------------------------------------------------------------------
diff --git a/cli/CommandExecutor.cpp b/cli/CommandExecutor.cpp
deleted file mode 100644
index 4ab32de..0000000
--- a/cli/CommandExecutor.cpp
+++ /dev/null
@@ -1,406 +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 "cli/CommandExecutor.hpp"
-
-#include <algorithm>
-#include <cstddef>
-#include <cstdint>
-#include <cstdio>
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "catalog/CatalogAttribute.hpp"
-#include "catalog/CatalogDatabase.hpp"
-#include "catalog/CatalogRelation.hpp"
-#include "catalog/CatalogRelationSchema.hpp"
-#include "cli/DropRelation.hpp"
-#include "cli/PrintToScreen.hpp"
-#include "parser/ParseStatement.hpp"
-#include "parser/ParseString.hpp"
-#include "parser/SqlParserWrapper.hpp"
-#include "query_optimizer/QueryHandle.hpp"
-#include "query_optimizer/QueryPlan.hpp"
-#include "query_optimizer/QueryProcessor.hpp"
-#include "storage/StorageBlock.hpp"
-#include "storage/StorageBlockInfo.hpp"
-#include "storage/StorageManager.hpp"
-#include "storage/TupleIdSequence.hpp"
-#include "storage/TupleStorageSubBlock.hpp"
-#include "types/Type.hpp"
-#include "types/TypeID.hpp"
-#include "types/TypedValue.hpp"
-#include "utility/PtrVector.hpp"
-#include "utility/SqlError.hpp"
-
-#include "glog/logging.h"
-
-#include "tmb/id_typedefs.h"
-
-using std::fprintf;
-using std::fputc;
-using std::fputs;
-using std::size_t;
-using std::string;
-using std::vector;
-
-namespace tmb { class MessageBus; }
-
-namespace quickstep {
-namespace cli {
-namespace {
-
-namespace C = ::quickstep::cli;
-
-void executeDescribeDatabase(
-    const PtrVector<ParseString> *arguments,
-    const CatalogDatabase &catalog_database,
-    StorageManager *storage_manager,
-    FILE *out) {
-  // Column width initialized to 6 to take into account the header name
-  // and the column value table
-  int max_column_width = C::kInitMaxColumnWidth;
-  vector<std::size_t> num_blocks;
-  const CatalogRelation *relation = nullptr;
-  if (arguments->size() == 0) {
-    for (const CatalogRelation &rel : catalog_database) {
-      max_column_width =
-          std::max(static_cast<int>(rel.getName().length()), max_column_width);
-      num_blocks.push_back(rel.size_blocks());
-    }
-  } else {
-    const ParseString &table_name = arguments->front();
-    const std::string &table_name_val = table_name.value();
-    relation = catalog_database.getRelationByName(table_name_val);
-
-    if (relation == nullptr) {
-      THROW_SQL_ERROR_AT(&(arguments->front())) << " Unrecognized relation " << table_name_val;
-    }
-    max_column_width = std::max(static_cast<int>(relation->getName().length()),
-                                    max_column_width);
-    num_blocks.push_back(relation->size_blocks());
-  }
-  // Only if we have relations work on the printing logic.
-  if (catalog_database.size() > 0) {
-    const std::size_t max_num_blocks = *std::max_element(num_blocks.begin(), num_blocks.end());
-    const int max_num_blocks_digits = std::max(PrintToScreen::GetNumberOfDigits(max_num_blocks),
-                                      C::kInitMaxColumnWidth+2);
-    vector<int> column_widths;
-    column_widths.push_back(max_column_width +1);
-    column_widths.push_back(C::kInitMaxColumnWidth + 1);
-    column_widths.push_back(max_num_blocks_digits + 1);
-    fputs("       List of relations\n\n", out);
-    fprintf(out, "%-*s |", max_column_width+1, " Name");
-    fprintf(out, "%-*s |", C::kInitMaxColumnWidth, " Type");
-    fprintf(out, "%-*s\n", max_num_blocks_digits, " Blocks");
-    PrintToScreen::printHBar(column_widths, out);
-    //  If there are no argument print the entire list of tables
-    //  else print the particular table only.
-    vector<std::size_t>::const_iterator num_blocks_it = num_blocks.begin();
-    if (arguments->size() == 0) {
-      for (const CatalogRelation &rel : catalog_database) {
-        fprintf(out, " %-*s |", max_column_width, rel.getName().c_str());
-        fprintf(out, " %-*s |", C::kInitMaxColumnWidth - 1, "table");
-        fprintf(out, " %-*lu\n", max_num_blocks_digits - 1, *num_blocks_it);
-        ++num_blocks_it;
-      }
-    } else {
-      fprintf(out, " %-*s |", max_column_width, relation->getName().c_str());
-      fprintf(out, " %-*s |", C::kInitMaxColumnWidth -1, "table");
-      fprintf(out, " %-*lu\n", max_num_blocks_digits - 1, *num_blocks_it);
-      ++num_blocks_it;
-    }
-    fputc('\n', out);
-  }
-}
-
-void executeDescribeTable(
-    const PtrVector<ParseString> *arguments,
-    const CatalogDatabase &catalog_database, FILE *out) {
-  const ParseString &table_name = arguments->front();
-  const std::string &table_name_val = table_name.value();
-  const CatalogRelation *relation =
-      catalog_database.getRelationByName(table_name_val);
-  if (relation == nullptr) {
-    THROW_SQL_ERROR_AT(&(arguments->front())) << " Unrecognized relation "  << table_name_val;
-  }
-  vector<int> column_widths;
-  int max_attr_column_width = C::kInitMaxColumnWidth;
-  int max_type_column_width = C::kInitMaxColumnWidth;
-
-  for (const CatalogAttribute &attr : *relation) {
-    // Printed column needs to be wide enough to print:
-    //   1. The attribute name (in the printed "header").
-    //   2. Any value of the attribute's Type.
-    max_attr_column_width =
-        std::max(max_attr_column_width,
-            static_cast<int>(attr.getDisplayName().length()));
-    max_type_column_width =
-        std::max(max_type_column_width,
-            static_cast<int>(attr.getType().getName().length()));
-  }
-  // Add room for one extra character to allow spacing between the column ending and the vertical bar
-  column_widths.push_back(max_attr_column_width+1);
-  column_widths.push_back(max_type_column_width+1);
-
-  fprintf(out, "%*s \"%s\"\n", C::kInitMaxColumnWidth, "Table", table_name_val.c_str());
-  fprintf(out, "%-*s |", max_attr_column_width+1, " Column");
-  fprintf(out, "%-*s\n", max_type_column_width+1, " Type");
-  PrintToScreen::printHBar(column_widths, out);
-  for (const CatalogAttribute &attr : *relation) {
-    fprintf(out, " %-*s |", max_attr_column_width,
-            attr.getDisplayName().c_str());
-    fprintf(out, " %-*s\n", max_type_column_width,
-            attr.getType().getName().c_str());
-  }
-  // TODO(rogers): Add handlers for partitioning information.
-  if (relation->hasIndexScheme()) {
-    fprintf(out, "%*s\n", C::kInitMaxColumnWidth+2, " Indexes");
-    const quickstep::IndexScheme &index_scheme = relation->getIndexScheme();
-    for (auto index_it = index_scheme.begin(); index_it != index_scheme.end();
-         ++index_it) {
-      fprintf(out, "  \"%-*s\" %s", static_cast<int>(index_it->first.length()),
-              index_it->first.c_str(),
-              index_it->second.IndexSubBlockType_Name(
-                  index_it->second.sub_block_type()).c_str());
-      fputc(' ', out);
-      fputc('(', out);
-      fprintf(out, "%s", relation->getAttributeById(index_it->second.indexed_attribute_ids(0))
-                             ->getDisplayName().c_str());
-      for (std::size_t i = 1; i < static_cast<std::size_t>(index_it->second.indexed_attribute_ids_size()); ++i) {
-        const char *attribute_display_name = relation->getAttributeById(
-                                                 index_it->second.indexed_attribute_ids(i))
-                                                     ->getDisplayName().c_str();
-        fprintf(out, ", %s", attribute_display_name);
-      }
-      fputc(')', out);
-      fputc('\n', out);
-    }
-  }
-}
-
-/**
- * @brief A helper function that executes a SQL query to obtain a row of results.
- */
-inline std::vector<TypedValue> executeQueryForSingleRow(
-    const tmb::client_id main_thread_client_id,
-    const tmb::client_id foreman_client_id,
-    const std::string &query_string,
-    tmb::MessageBus *bus,
-    StorageManager *storage_manager,
-    QueryProcessor *query_processor,
-    SqlParserWrapper *parser_wrapper) {
-  parser_wrapper->feedNextBuffer(new std::string(query_string));
-
-  ParseResult result = parser_wrapper->getNextStatement();
-  DCHECK(result.condition == ParseResult::kSuccess);
-
-  const ParseStatement &statement = *result.parsed_statement;
-
-  // Generate the query plan.
-  std::unique_ptr<QueryHandle> query_handle(
-      std::make_unique<QueryHandle>(query_processor->query_id(),
-                                    main_thread_client_id,
-                                    statement.getPriority()));
-  query_processor->generateQueryHandle(statement, query_handle.get());
-  DCHECK(query_handle->getQueryPlanMutable() != nullptr);
-
-  // Use foreman to execute the query plan.
-  QueryExecutionUtil::ConstructAndSendAdmitRequestMessage(
-      main_thread_client_id, foreman_client_id, query_handle.get(), bus);
-
-  QueryExecutionUtil::ReceiveQueryCompletionMessage(main_thread_client_id, bus);
-
-  // Retrieve the scalar result from the result relation.
-  const CatalogRelation *query_result_relation = query_handle->getQueryResultRelation();
-  DCHECK(query_result_relation != nullptr);
-
-  std::vector<TypedValue> values;
-  {
-    std::vector<block_id> blocks = query_result_relation->getBlocksSnapshot();
-    DCHECK_EQ(1u, blocks.size());
-
-    BlockReference block = storage_manager->getBlock(blocks[0], *query_result_relation);
-    const TupleStorageSubBlock &tuple_store = block->getTupleStorageSubBlock();
-    DCHECK_EQ(1, tuple_store.numTuples());
-
-    const std::size_t num_columns = tuple_store.getRelation().size();
-    if (tuple_store.isPacked()) {
-      for (std::size_t i = 0; i < num_columns; ++i) {
-        values.emplace_back(tuple_store.getAttributeValueTyped(0, i));
-        values[i].ensureNotReference();
-      }
-    } else {
-      std::unique_ptr<TupleIdSequence> existence_map(tuple_store.getExistenceMap());
-      for (std::size_t i = 0; i < num_columns; ++i) {
-        values.emplace_back(
-            tuple_store.getAttributeValueTyped(*existence_map->begin(), i));
-        values[i].ensureNotReference();
-      }
-    }
-  }
-
-  // Drop the result relation.
-  DropRelation::Drop(*query_result_relation,
-                     query_processor->getDefaultDatabase(),
-                     storage_manager);
-
-  return values;
-}
-
-/**
- * @brief A helper function that executes a SQL query to obtain a scalar result.
- */
-inline TypedValue executeQueryForSingleResult(
-    const tmb::client_id main_thread_client_id,
-    const tmb::client_id foreman_client_id,
-    const std::string &query_string,
-    tmb::MessageBus *bus,
-    StorageManager *storage_manager,
-    QueryProcessor *query_processor,
-    SqlParserWrapper *parser_wrapper) {
-  std::vector<TypedValue> results =
-      executeQueryForSingleRow(main_thread_client_id,
-                               foreman_client_id,
-                               query_string,
-                               bus,
-                               storage_manager,
-                               query_processor,
-                               parser_wrapper);
-  DCHECK_EQ(1u, results.size());
-  return results[0];
-}
-
-void executeAnalyze(const PtrVector<ParseString> *arguments,
-                    const tmb::client_id main_thread_client_id,
-                    const tmb::client_id foreman_client_id,
-                    MessageBus *bus,
-                    StorageManager *storage_manager,
-                    QueryProcessor *query_processor,
-                    FILE *out) {
-  const CatalogDatabase &database = *query_processor->getDefaultDatabase();
-
-  std::unique_ptr<SqlParserWrapper> parser_wrapper(new SqlParserWrapper());
-  std::vector<std::reference_wrapper<const CatalogRelation>> relations;
-  if (arguments->size() == 0) {
-    relations.insert(relations.begin(), database.begin(), database.end());
-  } else {
-    for (const auto &rel_name : *arguments) {
-      const CatalogRelation *rel = database.getRelationByName(rel_name.value());
-      if (rel == nullptr) {
-        THROW_SQL_ERROR_AT(&rel_name) << "Table does not exist";
-      } else {
-        relations.emplace_back(*rel);
-      }
-    }
-  }
-
-  // Analyze each relation in the database.
-  for (const CatalogRelation &relation : relations) {
-    fprintf(out, "Analyzing %s ... ", relation.getName().c_str());
-    fflush(out);
-
-    CatalogRelation *mutable_relation =
-        query_processor->getDefaultDatabase()->getRelationByIdMutable(relation.getID());
-
-    // Get the number of distinct values for each column.
-    for (const CatalogAttribute &attribute : relation) {
-      std::string query_string = "SELECT COUNT(DISTINCT ";
-      query_string.append(attribute.getName());
-      query_string.append(") FROM ");
-      query_string.append(relation.getName());
-      query_string.append(";");
-
-      std::vector<TypedValue> results =
-          executeQueryForSingleRow(main_thread_client_id,
-                                   foreman_client_id,
-                                   query_string,
-                                   bus,
-                                   storage_manager,
-                                   query_processor,
-                                   parser_wrapper.get());
-
-      auto *stat = mutable_relation->getStatisticsMutable();
-      const attribute_id attr_id = attribute.getID();
-
-      DCHECK(results[0].getTypeID() == TypeID::kLong);
-      stat->setNumDistinctValues(attr_id,
-                                 results[0].getLiteral<std::int64_t>());
-    }
-
-    // Get the number of tuples for the relation.
-    std::string query_string = "SELECT COUNT(*) FROM ";
-    query_string.append(relation.getName());
-    query_string.append(";");
-
-    TypedValue num_tuples =
-        executeQueryForSingleResult(main_thread_client_id,
-                                    foreman_client_id,
-                                    query_string,
-                                    bus,
-                                    storage_manager,
-                                    query_processor,
-                                    parser_wrapper.get());
-
-    DCHECK(num_tuples.getTypeID() == TypeID::kLong);
-    mutable_relation->getStatisticsMutable()->setNumTuples(
-        num_tuples.getLiteral<std::int64_t>());
-
-    fprintf(out, "done\n");
-    fflush(out);
-  }
-  query_processor->markCatalogAltered();
-  query_processor->saveCatalog();
-}
-
-}  // namespace
-
-void executeCommand(const ParseStatement &statement,
-                    const CatalogDatabase &catalog_database,
-                    const tmb::client_id main_thread_client_id,
-                    const tmb::client_id foreman_client_id,
-                    MessageBus *bus,
-                    StorageManager *storage_manager,
-                    QueryProcessor *query_processor,
-                    FILE *out) {
-  const ParseCommand &command = static_cast<const ParseCommand &>(statement);
-  const PtrVector<ParseString> *arguments = command.arguments();
-  const std::string &command_str = command.command()->value();
-  if (command_str == C::kDescribeDatabaseCommand) {
-    executeDescribeDatabase(arguments, catalog_database, storage_manager, out);
-  } else if (command_str == C::kDescribeTableCommand) {
-    if (arguments->size() == 0) {
-      executeDescribeDatabase(arguments, catalog_database, storage_manager, out);
-    } else {
-      executeDescribeTable(arguments, catalog_database, out);
-    }
-  } else if (command_str == C::kAnalyzeCommand) {
-    executeAnalyze(arguments,
-                   main_thread_client_id,
-                   foreman_client_id,
-                   bus,
-                   storage_manager,
-                   query_processor, out);
-  } else {
-    THROW_SQL_ERROR_AT(command.command()) << "Invalid Command";
-  }
-}
-}  // namespace cli
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/cli/CommandExecutor.hpp
----------------------------------------------------------------------
diff --git a/cli/CommandExecutor.hpp b/cli/CommandExecutor.hpp
deleted file mode 100644
index a1d9af9..0000000
--- a/cli/CommandExecutor.hpp
+++ /dev/null
@@ -1,78 +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_CLI_COMMAND_COMMAND_EXECUTOR_HPP_
-#define QUICKSTEP_CLI_COMMAND_COMMAND_EXECUTOR_HPP_
-
-#include <cstdio>
-
-#include "tmb/id_typedefs.h"
-
-namespace tmb { class MessageBus; }
-
-namespace quickstep {
-
-class CatalogDatabase;
-class ParseStatement;
-class QueryProcessor;
-class StorageManager;
-
-namespace cli {
-
-/** \addtogroup CLI
- *  @{
- */
-
-// Adding the max column width as 6  as the default initializer
-// as the length of the word Column is 6 characters.
-// This is used while describing the table.
-constexpr int kInitMaxColumnWidth = 6;
-
-constexpr char kDescribeDatabaseCommand[] = "\\dt";
-constexpr char kDescribeTableCommand[] = "\\d";
-constexpr char kAnalyzeCommand[] = "\\analyze";
-
-/**
-  * @brief Executes the command by calling the command handler.
-  *
-  * @param statement The parsed statement from the cli.
-  * @param catalog_database The catalog information about the current database.
-  * @param main_thread_client_id The TMB client ID of the main thread.
-  * @param foreman_client_id The TMB client ID of the Foreman thread.
-  * @param bus A pointer to the TMB.
-  * @param storage_manager The current StorageManager.
-  * @param query_processor The query processor to generate plans for SQL queries.
-  * @param foreman The foreman to execute query plans.
-  * @param out The stream where the output of the command has to be redirected to.
-*/
-void executeCommand(const ParseStatement &statement,
-                    const CatalogDatabase &catalog_database,
-                    const tmb::client_id main_thread_client_id,
-                    const tmb::client_id foreman_client_id,
-                    tmb::MessageBus *bus,
-                    StorageManager *storage_manager,
-                    QueryProcessor *query_processor,
-                    FILE *out);
-
-/** @} */
-
-}  // namespace cli
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_CLI_COMMAND_COMMAND_EXECUTOR_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/cli/DefaultsConfigurator.cpp
----------------------------------------------------------------------
diff --git a/cli/DefaultsConfigurator.cpp b/cli/DefaultsConfigurator.cpp
deleted file mode 100644
index 94280a7..0000000
--- a/cli/DefaultsConfigurator.cpp
+++ /dev/null
@@ -1,78 +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 "cli/DefaultsConfigurator.hpp"
-
-#include "cli/CliConfig.h"  // For QUICKSTEP_OS_WINDOWS.
-
-#ifdef QUICKSTEP_OS_WINDOWS
-// TODO(jmp): If filesystem shows up in C++-17, we can switch to just using that.
-#include <experimental/filesystem>
-#else
-#include <cstdlib>
-#endif  // QUICKSTEP_OS_WINDOWS
-
-#include <fstream>
-#include <string>
-
-#include "catalog/Catalog.hpp"
-#include "catalog/Catalog.pb.h"
-#include "catalog/CatalogDatabase.hpp"
-
-#include "glog/logging.h"
-
-using std::string;
-
-namespace quickstep {
-
-void DefaultsConfigurator::InitializeDefaultDatabase(const string &storage_path, const string &catalog_path) {
-  // TODO(jmp): Refactor the code in this file!
-  LOG(INFO) << "Initializing the database, creating a new catalog file and storage directory";
-
-  // Create the directory
-  // TODO(jmp): At some point, likely in C++-17, we will just have the
-  //            filesystem path, and we can clean this up
-#ifdef QUICKSTEP_OS_WINDOWS
-  CHECK(std::experimental::filesystem::create_directories(storage_path))
-      << "Failed when attempting to create the directory: " << storage_path
-      << "\nCheck if the directory already exists. If so, delete it or move it before initializing";
-#else
-  {
-    const string path_name = "mkdir " + storage_path;
-    CHECK(std::system(path_name.c_str()))
-         << "Failed when attempting to create the directory: " << storage_path;
-  }
-#endif  // QUICKSTEP_OS_WINDOWS
-
-  // Create the default catalog file.
-  std::ofstream catalog_file(catalog_path.c_str());
-  CHECK(catalog_file.good())
-      << "ERROR: Unable to open " << catalog_path << " for writing.";
-
-  Catalog catalog;
-  catalog.addDatabase(new CatalogDatabase(nullptr, "default"));
-
-  CHECK(catalog.getProto().SerializeToOstream(&catalog_file))
-      << "ERROR: Unable to serialize catalog proto to file " << catalog_path;
-
-  // Close the catalog file - it will be reopened below by the QueryProcessor.
-  catalog_file.close();
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/cli/DefaultsConfigurator.hpp
----------------------------------------------------------------------
diff --git a/cli/DefaultsConfigurator.hpp b/cli/DefaultsConfigurator.hpp
deleted file mode 100644
index 4b534d6..0000000
--- a/cli/DefaultsConfigurator.hpp
+++ /dev/null
@@ -1,132 +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_CLI_DEFAULTS_CONFIGURATOR_HPP_
-#define QUICKSTEP_CLI_DEFAULTS_CONFIGURATOR_HPP_
-
-#include "storage/StorageConfig.h"  // For QUICKSTEP_HAVE_LIBNUMA.
-
-#ifdef QUICKSTEP_HAVE_LIBNUMA
-#include <numa.h>
-#endif  // QUICKSTEP_HAVE_LIBNUMA
-
-#include <cstddef>
-#include <string>
-#include <thread>  // NOLINT(build/c++11)
-
-#ifdef QUICKSTEP_HAVE_LIBNUMA
-#include <unordered_map>
-#endif  // QUICKSTEP_HAVE_LIBNUMA
-
-#include <vector>
-
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-
-/** \addtogroup CLI
- * @{
- **/
-
-/**
- * @brief A static class for setting the default configuration parameters in
- *        Quickstep.
- **/
-class DefaultsConfigurator {
- public:
-  /**
-   * @brief Get the number of concurrent threads supported by the hardware,
-   *
-   * @note This function will return 0, if it fails (which it may on some
-   *       machines/environments).
-   **/
-  static std::size_t GetNumHardwareThreads() {
-    return std::thread::hardware_concurrency();
-  }
-
-  /**
-   * @brief Get the number of available numa sockets.
-   *
-   * @return Number of available numa sockets. Always 1 if the system doesn't
-   *         have libnuma.
-   **/
-  static std::size_t GetNumNUMANodes() {
-#ifdef QUICKSTEP_HAVE_LIBNUMA
-    // Id of the maximum node.
-    return numa_max_node() + 1;
-#else
-    return 1;
-#endif  // QUICKSTEP_HAVE_LIBNUMA
-  }
-
-  /**
-   * @brief Get the number of NUMA nodes covered by the given worker affinities
-   *        to the CPU cores.
-   *
-   * @param worker_cpu_affinities A vector V where V[i] is the CPU core to which
-   *        worker with index i is affinitized.
-   *
-   * @return The number of NUMA nodes that are covered by the given set of
-   *         workers.
-   **/
-  static std::size_t GetNumNUMANodesCoveredByWorkers(const std::vector<int> &worker_cpu_affinities) {
-    if (!worker_cpu_affinities.empty()) {
-#ifdef QUICKSTEP_HAVE_LIBNUMA
-      // Key = NUMA node, value = whether there is at least one worker whose
-      // affinity is set to a core on the given NUMA node.
-      std::unordered_map<int, bool> any_worker_on_numa_node;
-      for (const int curr_cpu_core_id : worker_cpu_affinities) {
-        const int curr_numa_node_id = numa_node_of_cpu(curr_cpu_core_id);
-        if (curr_numa_node_id >= 0) {
-          // Note - For the purpose of this function, the value is always true.
-          // Therefore, we can rely on the size of the map to get the count.
-          any_worker_on_numa_node[curr_numa_node_id] = true;
-        }
-      }
-      return any_worker_on_numa_node.size();
-#endif  // QUICKSTEP_HAVE_LIBNUMA
-    }
-    // When libnuma is not available, or worker affinities are not specified,
-    // the default return value is 1.
-    return 1;
-  }
-
-  /**
-   * @brief Initialize the default database with no relations.
-   *
-   * @param storage_path The filesystem directory to store catalog.
-   * @param catalog_path The full path of the catalog file.
-   **/
-  static void InitializeDefaultDatabase(const std::string &storage_path,
-                                        const std::string &catalog_path);
-
- private:
-  /**
-   * @brief Private constructor to disable instantiation of the class.
-   **/
-  DefaultsConfigurator();
-
-  DISALLOW_COPY_AND_ASSIGN(DefaultsConfigurator);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_CLI_DEFAULTS_CONFIGURATOR_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/cli/DropRelation.cpp
----------------------------------------------------------------------
diff --git a/cli/DropRelation.cpp b/cli/DropRelation.cpp
deleted file mode 100644
index 9bf75f2..0000000
--- a/cli/DropRelation.cpp
+++ /dev/null
@@ -1,45 +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 "cli/DropRelation.hpp"
-
-#include <vector>
-
-#include "catalog/CatalogDatabase.hpp"
-#include "catalog/CatalogRelation.hpp"
-#include "storage/StorageBlockInfo.hpp"
-#include "storage/StorageManager.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-
-void DropRelation::Drop(const CatalogRelation &relation,
-                        CatalogDatabase *database,
-                        StorageManager *storage_manager) {
-  std::vector<block_id> relation_blocks(relation.getBlocksSnapshot());
-  for (const block_id relation_block_id : relation_blocks) {
-    storage_manager->deleteBlockOrBlobFile(relation_block_id);
-  }
-
-  const relation_id rel_id = relation.getID();
-  DEBUG_ASSERT(database->hasRelationWithId(rel_id));
-  database->dropRelationById(rel_id);
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/cli/DropRelation.hpp
----------------------------------------------------------------------
diff --git a/cli/DropRelation.hpp b/cli/DropRelation.hpp
deleted file mode 100644
index 91cea43..0000000
--- a/cli/DropRelation.hpp
+++ /dev/null
@@ -1,57 +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_CLI_DROP_RELATION_HPP_
-#define QUICKSTEP_CLI_DROP_RELATION_HPP_
-
-#include "storage/StorageBlockInfo.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-
-class CatalogDatabase;
-class CatalogRelation;
-class StorageManager;
-
-/** \addtogroup CLI
- *  @{
- */
-
-/**
- * @brief All static methods which drop a relation.
- **/
-class DropRelation {
- public:
-  static void Drop(const CatalogRelation &relation,
-                   CatalogDatabase *database,
-                   StorageManager *storage_manager);
-
- private:
-  // Undefined default constructor. Class is all-static and should not be
-  // instantiated.
-  DropRelation();
-
-  DISALLOW_COPY_AND_ASSIGN(DropRelation);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_CLI_DROP_RELATION_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/cli/Flags.cpp
----------------------------------------------------------------------
diff --git a/cli/Flags.cpp b/cli/Flags.cpp
deleted file mode 100644
index 87f9f73..0000000
--- a/cli/Flags.cpp
+++ /dev/null
@@ -1,72 +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 "cli/Flags.hpp"
-
-#include <cstddef>
-#include <cstdio>
-#include <string>
-
-#include "cli/DefaultsConfigurator.hpp"
-#include "storage/StorageConstants.hpp"
-
-#include "gflags/gflags.h"
-
-using std::fprintf;
-
-namespace quickstep {
-
-static bool ValidateNumWorkers(const char *flagname, int value) {
-  if (value > 0) {
-    return true;
-  }
-
-  // Detect the hardware concurrency level.
-  const std::size_t num_hw_threads =
-      DefaultsConfigurator::GetNumHardwareThreads();
-
-  // Use the command-line value if that was supplied, else use the value
-  // that we computed above, provided it did return a valid value.
-  // TODO(jmp): May need to change this at some point to keep one thread
-  //            available for the OS if the hardware concurrency level is high.
-  FLAGS_num_workers = num_hw_threads != 0 ? num_hw_threads : 1;
-
-  return FLAGS_num_workers > 0;
-}
-DEFINE_int32(num_workers, 0, "Number of worker threads. If this value is "
-             "specified and is greater than 0, then this user-supplied value is "
-             "used. Else (i.e. the default case), we examine the reported "
-             "hardware concurrency level, and use that.");
-static const volatile bool num_workers_dummy
-    = gflags::RegisterFlagValidator(&FLAGS_num_workers, &ValidateNumWorkers);
-
-static bool ValidateStoragePath(const char *flagname,
-                                const std::string &value) {
-  if (!value.empty() && value.back() != kPathSeparator) {
-    FLAGS_storage_path.push_back(kPathSeparator);
-  }
-
-  return true;
-}
-DEFINE_string(storage_path, kDefaultStoragePath,
-              "Filesystem path to store the Quickstep database.");
-static const volatile bool storage_path_dummy
-    = gflags::RegisterFlagValidator(&FLAGS_storage_path, &ValidateStoragePath);
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/cli/Flags.hpp
----------------------------------------------------------------------
diff --git a/cli/Flags.hpp b/cli/Flags.hpp
deleted file mode 100644
index b020a3e..0000000
--- a/cli/Flags.hpp
+++ /dev/null
@@ -1,43 +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_CLI_FLAGS_HPP_
-#define QUICKSTEP_CLI_FLAGS_HPP_
-
-#include "gflags/gflags_declare.h"
-
-namespace quickstep {
-
-/** \addtogroup CLI
- *  @{
- */
-
-/**
- * @brief A collection of common flags shared by Quickstep CLIs in both the
- * single-node and the distributed version.
- **/
-DECLARE_int32(num_workers);
-
-DECLARE_string(storage_path);
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_CLI_FLAGS_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/cli/InputParserUtil.cpp
----------------------------------------------------------------------
diff --git a/cli/InputParserUtil.cpp b/cli/InputParserUtil.cpp
deleted file mode 100644
index e45605c..0000000
--- a/cli/InputParserUtil.cpp
+++ /dev/null
@@ -1,143 +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 "cli/InputParserUtil.hpp"
-
-#include <cstddef>
-#include <iostream>
-#include <memory>
-#include <ostream>
-#include <string>
-#include <utility>
-#include <vector>
-
-#include "catalog/CatalogConfig.h"
-#include "storage/StorageConfig.h"
-#include "utility/StringUtil.hpp"
-
-#include "glog/logging.h"
-
-#ifdef QUICKSTEP_HAVE_LIBNUMA
-#include <numa.h>
-#endif
-
-using std::string;
-
-namespace quickstep {
-
-std::vector<int> InputParserUtil::ParseWorkerAffinities(
-    const int num_workers,
-    const string &affinity_string) {
-  std::vector<int> affinities;
-  bool switch_to_default_affinities = false;
-  if (affinity_string.empty()) {
-    switch_to_default_affinities = true;
-    LOG(INFO) << "Empty worker affinities provided, switching to default "
-                 "worker affinities";
-  } else if (!ParseIntString(affinity_string, ',', &affinities)) {
-      switch_to_default_affinities = true;
-      LOG(INFO) << "Invalid worker affinities provided, switching to default "
-                   "affinities";
-  }
-
-  for (const int affinity : affinities) {
-    if (affinity < -1) {
-      switch_to_default_affinities = true;
-      LOG(INFO) << "CPU affinities specified by --worker_affinities must be "
-                   "non-negative, or -1 to specify no affinity. Switching to "
-                   "default worker affinities";
-      break;
-    }
-  }
-
-  if (switch_to_default_affinities) {
-    // Set default affinities.
-    // If the number of worker threads is less than the maximum parallelism on
-    // the box, we try to balance workers on all sockets. The intention is to
-    // balance the memory bandwidth usage across all sockets. This may however
-    // hurt the performance (due to poor data locality) when the machine has
-    // many sockets and data is not partitioned.
-#ifdef QUICKSTEP_HAVE_LIBNUMA
-    // This code is inspired from the print_node_cpus() function of numactl.
-    // WARNING - If some NUMA sockets are disabled, we can't detect it.
-    const int num_sockets = numa_num_configured_nodes();
-    CHECK_GT(num_sockets, 0);
-    // A vector V where V[i] denotes a vector of CPU cores that belong to the
-    // socket i.
-    std::vector<std::vector<int>> cpus_from_sockets;
-    cpus_from_sockets.resize(num_sockets);
-    for (int curr_socket = 0; curr_socket < num_sockets; ++curr_socket) {
-      std::unique_ptr<struct bitmask> cpus(numa_allocate_cpumask());
-      const int err = numa_node_to_cpus(curr_socket, cpus.get());
-      if (err >= 0) {
-        for (int i = 0; i < static_cast<int>(cpus->size); i++) {
-          if (numa_bitmask_isbitset(cpus.get(), i)) {
-            // The current CPU belongs to curr_socket.
-            cpus_from_sockets[curr_socket].push_back(i);
-          }
-        }
-      }
-    }
-    // Now assign affinity to each worker, picking one CPU from each socket in a
-    // round robin manner.
-    int curr_socket = 0;
-    std::size_t iteration = 0;
-    for (int curr_worker = 0; curr_worker < num_workers; ++curr_worker) {
-      if (iteration < cpus_from_sockets[curr_socket].size()) {
-        const int curr_worker_affinity =
-            cpus_from_sockets[curr_socket][iteration];
-        affinities.push_back(curr_worker_affinity);
-      }
-      // Increase iteration number only when we are at the last socket.
-      iteration = iteration + ((curr_socket + 1) / num_sockets);
-      curr_socket = (curr_socket + 1) % num_sockets;
-    }
-#endif
-  }
-
-  if (affinities.size() < static_cast<std::size_t>(num_workers)) {
-    std::cout << "--num_workers is " << num_workers << ", but only "
-              << "specified " << affinities.size() << " CPU affinities "
-              << "with --worker_affinities. "
-              << (num_workers - affinities.size()) << " workers will be "
-              << "unaffinitized.\n";
-    affinities.resize(num_workers, -1);
-  } else if (affinities.size() > static_cast<std::size_t>(num_workers)) {
-    std::cout << "--num_workers is " << num_workers << ", but specified "
-              << affinities.size() << " CPU affinities with "
-              << "--worker_affinities. Extra affinities will be ignored.\n";
-    affinities.resize(num_workers);
-  }
-
-  return affinities;
-}
-
-std::vector<int> InputParserUtil::GetNUMANodesForCPUs() {
-  std::vector<int> numa_nodes_of_cpus;
-#ifdef QUICKSTEP_HAVE_LIBNUMA
-  const int num_cpus = numa_num_configured_cpus();
-  numa_nodes_of_cpus.reserve(num_cpus);
-  for (int curr_cpu = 0; curr_cpu < num_cpus; ++curr_cpu) {
-    numa_nodes_of_cpus.push_back(numa_node_of_cpu(curr_cpu));
-  }
-#endif
-  return numa_nodes_of_cpus;
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/cli/InputParserUtil.hpp
----------------------------------------------------------------------
diff --git a/cli/InputParserUtil.hpp b/cli/InputParserUtil.hpp
deleted file mode 100644
index d34dbed..0000000
--- a/cli/InputParserUtil.hpp
+++ /dev/null
@@ -1,79 +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_CLI_INPUT_PARSER_UTIL_HPP_
-#define QUICKSTEP_CLI_INPUT_PARSER_UTIL_HPP_
-
-#include <string>
-#include <vector>
-
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-
-/** \addtogroup CLI
- *  @{
- */
-
-/**
- * @brief A static utility class for parsing input to Quickstep CLI.
- **/
-class InputParserUtil {
- public:
-  /**
-   * @brief Parse an input string consisting of worker thread's CPU core
-   *        affinities.
-   *
-   * @param num_workers The number of worker threads.
-   * @param affinity_string A string consisting of the worker thread affinities.
-   *
-   * @note Check cli/QuickstepCli.cpp for the description on the format of the
-   *       affinity_string.
-   *
-   * @return A vector of CPU cores to which workers are affinitized. If no
-   *         information is available for a worker, we assign -1.
-   **/
-  static std::vector<int> ParseWorkerAffinities(
-      const int num_workers,
-      const std::string &affinity_string);
-
-  /**
-   * @brief Get NUMA nodes of all the CPUs.
-   *
-   * @note This function is only relevant when libnuma is present.
-   *
-   * @return A vector where ith element is the NUMA node of ith CPU, starting
-   *         from 0.
-   **/
-  static std::vector<int> GetNUMANodesForCPUs();
-
- private:
-  /**
-   * @brief Private constructor to disable instantiation of the class.
-   **/
-  InputParserUtil();
-
-  DISALLOW_COPY_AND_ASSIGN(InputParserUtil);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_CLI_INPUT_PARSER_UTIL_HPP_


[06/51] [abbrv] [partial] incubator-quickstep git commit: remove c++ files

Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/physical/Aggregate.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/physical/Aggregate.hpp b/query_optimizer/physical/Aggregate.hpp
deleted file mode 100644
index de36cc3..0000000
--- a/query_optimizer/physical/Aggregate.hpp
+++ /dev/null
@@ -1,157 +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_PHYSICAL_AGGREGATE_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_PHYSICAL_AGGREGATE_HPP_
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/Alias.hpp"
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "query_optimizer/expressions/ExpressionUtil.hpp"
-#include "query_optimizer/expressions/NamedExpression.hpp"
-#include "query_optimizer/expressions/Predicate.hpp"
-#include "query_optimizer/physical/Physical.hpp"
-#include "query_optimizer/physical/PhysicalType.hpp"
-#include "utility/Macros.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-namespace optimizer {
-namespace physical {
-
-/** \addtogroup OptimizerLogical
- *  @{
- */
-
-class Aggregate;
-typedef std::shared_ptr<const Aggregate> AggregatePtr;
-
-/**
- * @brief Aggregate operator that computes aggregate expressions for each combination
- *        of the values of grouping expressions.
- */
-class Aggregate : public Physical {
- public:
-  PhysicalType getPhysicalType() const override { return PhysicalType::kAggregate; }
-
-  std::string getName() const override { return "Aggregate"; }
-
-  /**
-   * @return The input physical node.
-   */
-  const PhysicalPtr input() const { return input_; }
-
-  /**
-   * @return Grouping expressions.
-   */
-  inline const std::vector<expressions::NamedExpressionPtr>& grouping_expressions() const {
-    return grouping_expressions_;
-  }
-
-  /**
-   * @return Aggregate expressions.
-   */
-  const std::vector<expressions::AliasPtr>& aggregate_expressions() const {
-    return aggregate_expressions_;
-  }
-
-  /**
-   * @return Filter predicate applied before aggregation.
-   */
-  const expressions::PredicatePtr& filter_predicate() const {
-    return filter_predicate_;
-  }
-
-  PhysicalPtr copyWithNewChildren(
-      const std::vector<PhysicalPtr> &new_children) const override {
-    DCHECK_EQ(getNumChildren(), new_children.size());
-    return Create(new_children[0], grouping_expressions_, aggregate_expressions_, filter_predicate_);
-  }
-
-  std::vector<expressions::AttributeReferencePtr> getOutputAttributes() const override;
-
-  std::vector<expressions::AttributeReferencePtr> getReferencedAttributes() const override;
-
-  bool maybeCopyWithPrunedExpressions(
-      const expressions::UnorderedNamedExpressionSet &referenced_expressions,
-      PhysicalPtr *output) const override {
-    // The project expressions for an Aggregate cannot be changed.
-    return false;
-  }
-
-  /**
-   * @brief Creates an Aggregate physical node.
-   *
-   * @param input The input node.
-   * @param aggregate_expressions The aggregate expressions.
-   * @param grouping_expressions The grouping expressions.
-   * @param filter_predicate The filtering predicate applied before aggregation. Can be NULL.
-   * @return An immutable Aggregate node.
-   */
-  static AggregatePtr Create(
-      PhysicalPtr input,
-      const std::vector<expressions::NamedExpressionPtr> &grouping_expressions,
-      const std::vector<expressions::AliasPtr> &aggregate_expressions,
-      const expressions::PredicatePtr &filter_predicate) {
-    return AggregatePtr(
-        new Aggregate(input, grouping_expressions, aggregate_expressions, filter_predicate));
-  }
-
- 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:
-  Aggregate(
-      PhysicalPtr input,
-      const std::vector<expressions::NamedExpressionPtr> &grouping_expressions,
-      const std::vector<expressions::AliasPtr> &aggregate_expressions,
-      const expressions::PredicatePtr &filter_predicate)
-      : input_(input),
-        grouping_expressions_(grouping_expressions),
-        aggregate_expressions_(aggregate_expressions),
-        filter_predicate_(filter_predicate) {
-    addChild(input_);
-  }
-
-  PhysicalPtr input_;
-  std::vector<expressions::NamedExpressionPtr> grouping_expressions_;
-  std::vector<expressions::AliasPtr> aggregate_expressions_;
-  expressions::PredicatePtr filter_predicate_;
-
-  DISALLOW_COPY_AND_ASSIGN(Aggregate);
-};
-
-/** @} */
-
-}  // namespace physical
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_QUERY_OPTIMIZER_PHYSICAL_AGGREGATE_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/physical/BinaryJoin.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/physical/BinaryJoin.cpp b/query_optimizer/physical/BinaryJoin.cpp
deleted file mode 100644
index 30e2e8d..0000000
--- a/query_optimizer/physical/BinaryJoin.cpp
+++ /dev/null
@@ -1,54 +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/physical/BinaryJoin.hpp"
-
-#include <string>
-#include <vector>
-
-#include "query_optimizer/OptimizerTree.hpp"
-#include "utility/Cast.hpp"
-
-namespace quickstep {
-namespace optimizer {
-namespace physical {
-
-namespace E = ::quickstep::optimizer::expressions;
-
-void BinaryJoin::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("left");
-  non_container_child_field_names->push_back("right");
-
-  non_container_child_fields->push_back(left_);
-  non_container_child_fields->push_back(right_);
-
-  container_child_field_names->push_back("project_expressions");
-  container_child_fields->push_back(
-      CastSharedPtrVector<OptimizerTreeBase>(project_expressions()));
-}
-
-}  // namespace physical
-}  // namespace optimizer
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/physical/BinaryJoin.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/physical/BinaryJoin.hpp b/query_optimizer/physical/BinaryJoin.hpp
deleted file mode 100644
index 4b5671d..0000000
--- a/query_optimizer/physical/BinaryJoin.hpp
+++ /dev/null
@@ -1,103 +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_PHYSICAL_BINARY_JOIN_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_PHYSICAL_BINARY_JOIN_HPP_
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/NamedExpression.hpp"
-#include "query_optimizer/physical/Join.hpp"
-#include "query_optimizer/physical/Physical.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-namespace optimizer {
-namespace physical {
-
-/** \addtogroup OptimizerPhysical
- *  @{
- */
-
-class BinaryJoin;
-typedef std::shared_ptr<const BinaryJoin> BinaryJoinPtr;
-
-/**
- * @brief Base class for binary join nodes.
- */
-class BinaryJoin : public Join {
- public:
-  /**
-   * @brief Destructor.
-   */
-  ~BinaryJoin() override {}
-
-  /**
-   * @return The left operand.
-   */
-  const PhysicalPtr& left() const { return left_; }
-
-  /**
-   * @return The right operand.
-   */
-  const PhysicalPtr& right() const { return right_; }
-
- protected:
-  /**
-   * @brief Constructor.
-   *
-   * @param left The left operand.
-   * @param right The right operand.
-   * @param project_expressions The project expressions.
-   */
-  BinaryJoin(const PhysicalPtr &left,
-             const PhysicalPtr &right,
-             const std::vector<expressions::NamedExpressionPtr> &project_expressions)
-      : Join(project_expressions),
-        left_(left),
-        right_(right) {
-    addChild(left_);
-    addChild(right_);
-  }
-
-  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:
-  PhysicalPtr left_;
-  PhysicalPtr right_;
-
-  DISALLOW_COPY_AND_ASSIGN(BinaryJoin);
-};
-
-/** @} */
-
-}  // namespace physical
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_QUERY_OPTIMIZER_PHYSICAL_BINARY_JOIN_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/physical/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/query_optimizer/physical/CMakeLists.txt b/query_optimizer/physical/CMakeLists.txt
deleted file mode 100644
index 5c2cd0b..0000000
--- a/query_optimizer/physical/CMakeLists.txt
+++ /dev/null
@@ -1,301 +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.
-
-# Declare micro-libs:
-add_library(quickstep_queryoptimizer_physical_Aggregate Aggregate.cpp Aggregate.hpp)
-add_library(quickstep_queryoptimizer_physical_BinaryJoin BinaryJoin.cpp BinaryJoin.hpp)
-add_library(quickstep_queryoptimizer_physical_CopyFrom CopyFrom.cpp CopyFrom.hpp)
-add_library(quickstep_queryoptimizer_physical_CreateIndex CreateIndex.cpp CreateIndex.hpp)
-add_library(quickstep_queryoptimizer_physical_CreateTable CreateTable.cpp CreateTable.hpp)
-add_library(quickstep_queryoptimizer_physical_DeleteTuples DeleteTuples.cpp DeleteTuples.hpp)
-add_library(quickstep_queryoptimizer_physical_DropTable DropTable.cpp DropTable.hpp)
-add_library(quickstep_queryoptimizer_physical_HashJoin HashJoin.cpp HashJoin.hpp)
-add_library(quickstep_queryoptimizer_physical_InsertSelection InsertSelection.cpp InsertSelection.hpp)
-add_library(quickstep_queryoptimizer_physical_InsertTuple InsertTuple.cpp InsertTuple.hpp)
-add_library(quickstep_queryoptimizer_physical_Join ../../empty_src.cpp Join.hpp)
-add_library(quickstep_queryoptimizer_physical_LIPFilterConfiguration ../../empty_src.cpp LIPFilterConfiguration.hpp)
-add_library(quickstep_queryoptimizer_physical_NestedLoopsJoin NestedLoopsJoin.cpp NestedLoopsJoin.hpp)
-add_library(quickstep_queryoptimizer_physical_PatternMatcher ../../empty_src.cpp PatternMatcher.hpp)
-add_library(quickstep_queryoptimizer_physical_Physical ../../empty_src.cpp Physical.hpp)
-add_library(quickstep_queryoptimizer_physical_PhysicalType ../../empty_src.cpp PhysicalType.hpp)
-add_library(quickstep_queryoptimizer_physical_Sample Sample.cpp Sample.hpp)
-add_library(quickstep_queryoptimizer_physical_Selection Selection.cpp Selection.hpp)
-add_library(quickstep_queryoptimizer_physical_SharedSubplanReference
-            SharedSubplanReference.cpp
-            SharedSubplanReference.hpp)
-add_library(quickstep_queryoptimizer_physical_Sort Sort.cpp Sort.hpp)
-add_library(quickstep_queryoptimizer_physical_TableGenerator ../../empty_src.cpp TableGenerator.hpp)
-add_library(quickstep_queryoptimizer_physical_TableReference TableReference.cpp TableReference.hpp)
-add_library(quickstep_queryoptimizer_physical_TopLevelPlan TopLevelPlan.cpp TopLevelPlan.hpp)
-add_library(quickstep_queryoptimizer_physical_UpdateTable UpdateTable.cpp UpdateTable.hpp)
-add_library(quickstep_queryoptimizer_physical_WindowAggregate WindowAggregate.cpp WindowAggregate.hpp)
-
-# Link dependencies:
-target_link_libraries(quickstep_queryoptimizer_physical_Aggregate
-                      quickstep_queryoptimizer_OptimizerTree
-                      quickstep_queryoptimizer_expressions_Alias
-                      quickstep_queryoptimizer_expressions_AttributeReference
-                      quickstep_queryoptimizer_expressions_ExpressionUtil
-                      quickstep_queryoptimizer_expressions_NamedExpression
-                      quickstep_queryoptimizer_expressions_Predicate
-                      quickstep_queryoptimizer_physical_Physical
-                      quickstep_queryoptimizer_physical_PhysicalType
-                      quickstep_utility_Cast
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_physical_BinaryJoin
-                      glog
-                      quickstep_queryoptimizer_OptimizerTree
-                      quickstep_queryoptimizer_expressions_NamedExpression
-                      quickstep_queryoptimizer_physical_Join
-                      quickstep_queryoptimizer_physical_Physical
-                      quickstep_utility_Cast
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_physical_CopyFrom
-                      glog
-                      quickstep_catalog_CatalogRelation
-                      quickstep_queryoptimizer_OptimizerTree
-                      quickstep_queryoptimizer_expressions_AttributeReference
-                      quickstep_queryoptimizer_expressions_ExpressionUtil
-                      quickstep_queryoptimizer_expressions_NamedExpression
-                      quickstep_queryoptimizer_physical_Physical
-                      quickstep_queryoptimizer_physical_PhysicalType
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_physical_CreateIndex
-                      glog
-                      quickstep_queryoptimizer_OptimizerTree
-                      quickstep_queryoptimizer_expressions_AttributeReference
-                      quickstep_queryoptimizer_physical_Physical
-                      quickstep_queryoptimizer_physical_PhysicalType
-                      quickstep_storage_StorageBlockLayout_proto
-                      quickstep_utility_Cast
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_physical_CreateTable
-                      glog
-                      quickstep_queryoptimizer_OptimizerTree
-                      quickstep_queryoptimizer_expressions_AttributeReference
-                      quickstep_queryoptimizer_expressions_ExpressionUtil
-                      quickstep_queryoptimizer_expressions_NamedExpression
-                      quickstep_queryoptimizer_physical_Physical
-                      quickstep_queryoptimizer_physical_PhysicalType
-                      quickstep_utility_Cast
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_physical_DeleteTuples
-                      glog
-                      quickstep_catalog_CatalogRelation
-                      quickstep_queryoptimizer_OptimizerTree
-                      quickstep_queryoptimizer_expressions_AttributeReference
-                      quickstep_queryoptimizer_expressions_ExpressionUtil
-                      quickstep_queryoptimizer_expressions_NamedExpression
-                      quickstep_queryoptimizer_expressions_Predicate
-                      quickstep_queryoptimizer_physical_Physical
-                      quickstep_queryoptimizer_physical_PhysicalType
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_physical_DropTable
-                      glog
-                      quickstep_catalog_CatalogRelation
-                      quickstep_queryoptimizer_OptimizerTree
-                      quickstep_queryoptimizer_expressions_AttributeReference
-                      quickstep_queryoptimizer_expressions_ExpressionUtil
-                      quickstep_queryoptimizer_expressions_NamedExpression
-                      quickstep_queryoptimizer_physical_Physical
-                      quickstep_queryoptimizer_physical_PhysicalType
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_physical_HashJoin
-                      glog
-                      quickstep_queryoptimizer_OptimizerTree
-                      quickstep_queryoptimizer_expressions_AttributeReference
-                      quickstep_queryoptimizer_expressions_ExpressionUtil
-                      quickstep_queryoptimizer_expressions_NamedExpression
-                      quickstep_queryoptimizer_expressions_Predicate
-                      quickstep_queryoptimizer_physical_BinaryJoin
-                      quickstep_queryoptimizer_physical_Physical
-                      quickstep_queryoptimizer_physical_PhysicalType
-                      quickstep_utility_Cast
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_physical_InsertSelection
-                      glog
-                      quickstep_queryoptimizer_OptimizerTree
-                      quickstep_queryoptimizer_expressions_AttributeReference
-                      quickstep_queryoptimizer_expressions_ExpressionUtil
-                      quickstep_queryoptimizer_physical_Physical
-                      quickstep_queryoptimizer_physical_PhysicalType
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_physical_InsertTuple
-                      glog
-                      quickstep_queryoptimizer_OptimizerTree
-                      quickstep_queryoptimizer_expressions_AttributeReference
-                      quickstep_queryoptimizer_expressions_ExpressionUtil
-                      quickstep_queryoptimizer_expressions_NamedExpression
-                      quickstep_queryoptimizer_expressions_ScalarLiteral
-                      quickstep_queryoptimizer_physical_Physical
-                      quickstep_queryoptimizer_physical_PhysicalType
-                      quickstep_utility_Cast
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_physical_Join
-                      quickstep_queryoptimizer_expressions_AttributeReference
-                      quickstep_queryoptimizer_expressions_ExpressionUtil
-                      quickstep_queryoptimizer_expressions_NamedExpression
-                      quickstep_queryoptimizer_physical_Physical
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_physical_LIPFilterConfiguration
-                      quickstep_queryoptimizer_expressions_AttributeReference
-                      quickstep_utility_Macros
-                      quickstep_utility_lipfilter_LIPFilter)
-target_link_libraries(quickstep_queryoptimizer_physical_NestedLoopsJoin
-                      glog
-                      quickstep_queryoptimizer_OptimizerTree
-                      quickstep_queryoptimizer_expressions_AttributeReference
-                      quickstep_queryoptimizer_expressions_ExpressionUtil
-                      quickstep_queryoptimizer_expressions_NamedExpression
-                      quickstep_queryoptimizer_expressions_Predicate
-                      quickstep_queryoptimizer_physical_BinaryJoin
-                      quickstep_queryoptimizer_physical_Physical
-                      quickstep_queryoptimizer_physical_PhysicalType
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_physical_PatternMatcher
-                      quickstep_queryoptimizer_physical_PhysicalType)
-target_link_libraries(quickstep_queryoptimizer_physical_Physical
-                      quickstep_queryoptimizer_OptimizerTree
-                      quickstep_queryoptimizer_expressions_AttributeReference
-                      quickstep_queryoptimizer_expressions_ExpressionUtil
-                      quickstep_queryoptimizer_physical_PhysicalType
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_physical_Sample
-                      glog
-                      quickstep_queryoptimizer_OptimizerTree
-                      quickstep_queryoptimizer_expressions_AttributeReference
-                      quickstep_queryoptimizer_expressions_ExpressionUtil
-                      quickstep_queryoptimizer_expressions_NamedExpression
-                      quickstep_queryoptimizer_physical_Physical
-                      quickstep_queryoptimizer_physical_PhysicalType
-                      quickstep_utility_Cast
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_physical_Selection
-                      glog
-                      quickstep_queryoptimizer_OptimizerTree
-                      quickstep_queryoptimizer_expressions_AttributeReference
-                      quickstep_queryoptimizer_expressions_ExpressionUtil
-                      quickstep_queryoptimizer_expressions_LogicalAnd
-                      quickstep_queryoptimizer_expressions_NamedExpression
-                      quickstep_queryoptimizer_expressions_Predicate
-                      quickstep_queryoptimizer_physical_Physical
-                      quickstep_queryoptimizer_physical_PhysicalType
-                      quickstep_utility_Cast
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_physical_SharedSubplanReference
-                      glog
-                      quickstep_queryoptimizer_OptimizerTree
-                      quickstep_queryoptimizer_expressions_AttributeReference
-                      quickstep_queryoptimizer_expressions_ExpressionUtil
-                      quickstep_queryoptimizer_expressions_NamedExpression
-                      quickstep_queryoptimizer_physical_Physical
-                      quickstep_queryoptimizer_physical_PhysicalType
-                      quickstep_utility_Cast
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_physical_Sort
-                      glog
-                      quickstep_queryoptimizer_OptimizerTree
-                      quickstep_queryoptimizer_expressions_AttributeReference
-                      quickstep_queryoptimizer_expressions_ExpressionUtil
-                      quickstep_queryoptimizer_physical_Physical
-                      quickstep_queryoptimizer_physical_PhysicalType
-                      quickstep_utility_Cast
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_physical_TableGenerator
-                      quickstep_expressions_tablegenerator_GeneratorFunctionHandle
-                      quickstep_queryoptimizer_OptimizerTree
-                      quickstep_queryoptimizer_expressions_AttributeReference
-                      quickstep_queryoptimizer_expressions_ExprId
-                      quickstep_queryoptimizer_expressions_ExpressionUtil
-                      quickstep_queryoptimizer_physical_Physical
-                      quickstep_queryoptimizer_physical_PhysicalType
-                      quickstep_utility_Cast
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_physical_TableReference
-                      glog
-                      quickstep_catalog_CatalogRelation
-                      quickstep_queryoptimizer_OptimizerTree
-                      quickstep_queryoptimizer_expressions_AttributeReference
-                      quickstep_queryoptimizer_expressions_ExpressionUtil
-                      quickstep_queryoptimizer_expressions_NamedExpression
-                      quickstep_queryoptimizer_physical_Physical
-                      quickstep_queryoptimizer_physical_PhysicalType
-                      quickstep_utility_Cast
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_physical_TopLevelPlan
-                      glog
-                      quickstep_queryoptimizer_OptimizerTree
-                      quickstep_queryoptimizer_expressions_AttributeReference
-                      quickstep_queryoptimizer_expressions_ExprId
-                      quickstep_queryoptimizer_expressions_ExpressionUtil
-                      quickstep_queryoptimizer_physical_LIPFilterConfiguration
-                      quickstep_queryoptimizer_physical_Physical
-                      quickstep_queryoptimizer_physical_PhysicalType
-                      quickstep_utility_Cast
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_physical_UpdateTable
-                      glog
-                      quickstep_queryoptimizer_OptimizerTree
-                      quickstep_queryoptimizer_expressions_AttributeReference
-                      quickstep_queryoptimizer_expressions_ExpressionUtil
-                      quickstep_queryoptimizer_expressions_NamedExpression
-                      quickstep_queryoptimizer_expressions_Predicate
-                      quickstep_queryoptimizer_expressions_Scalar
-                      quickstep_queryoptimizer_physical_Physical
-                      quickstep_queryoptimizer_physical_PhysicalType
-                      quickstep_utility_Cast
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_physical_WindowAggregate
-                      quickstep_queryoptimizer_OptimizerTree
-                      quickstep_queryoptimizer_expressions_Alias
-                      quickstep_queryoptimizer_expressions_AttributeReference
-                      quickstep_queryoptimizer_expressions_ExpressionUtil
-                      quickstep_queryoptimizer_expressions_NamedExpression
-                      quickstep_queryoptimizer_expressions_Predicate
-                      quickstep_queryoptimizer_physical_Physical
-                      quickstep_queryoptimizer_physical_PhysicalType
-                      quickstep_utility_Cast
-                      quickstep_utility_Macros)
-
-# Module all-in-one library:
-add_library(quickstep_queryoptimizer_physical ../../empty_src.cpp OptimizerPhysicalModule.hpp)
-target_link_libraries(quickstep_queryoptimizer_physical
-                      quickstep_queryoptimizer_physical_Aggregate
-                      quickstep_queryoptimizer_physical_BinaryJoin
-                      quickstep_queryoptimizer_physical_CopyFrom
-                      quickstep_queryoptimizer_physical_CreateIndex
-                      quickstep_queryoptimizer_physical_CreateTable
-                      quickstep_queryoptimizer_physical_DeleteTuples
-                      quickstep_queryoptimizer_physical_DropTable
-                      quickstep_queryoptimizer_physical_HashJoin
-                      quickstep_queryoptimizer_physical_InsertSelection
-                      quickstep_queryoptimizer_physical_InsertTuple
-                      quickstep_queryoptimizer_physical_Join
-                      quickstep_queryoptimizer_physical_LIPFilterConfiguration
-                      quickstep_queryoptimizer_physical_NestedLoopsJoin
-                      quickstep_queryoptimizer_physical_PatternMatcher
-                      quickstep_queryoptimizer_physical_Physical
-                      quickstep_queryoptimizer_physical_PhysicalType
-                      quickstep_queryoptimizer_physical_Sample
-                      quickstep_queryoptimizer_physical_Selection
-                      quickstep_queryoptimizer_physical_SharedSubplanReference
-                      quickstep_queryoptimizer_physical_Sort
-                      quickstep_queryoptimizer_physical_TableGenerator
-                      quickstep_queryoptimizer_physical_TableReference
-                      quickstep_queryoptimizer_physical_TopLevelPlan
-                      quickstep_queryoptimizer_physical_UpdateTable
-                      quickstep_queryoptimizer_physical_WindowAggregate)

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/physical/CopyFrom.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/physical/CopyFrom.cpp b/query_optimizer/physical/CopyFrom.cpp
deleted file mode 100644
index 8448d4e..0000000
--- a/query_optimizer/physical/CopyFrom.cpp
+++ /dev/null
@@ -1,54 +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/physical/CopyFrom.hpp"
-
-#include <string>
-#include <vector>
-
-#include "catalog/CatalogRelation.hpp"
-#include "query_optimizer/OptimizerTree.hpp"
-
-namespace quickstep {
-namespace optimizer {
-namespace physical {
-
-void CopyFrom::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("relation");
-  inline_field_values->push_back(catalog_relation_->getName());
-
-  inline_field_names->push_back("file_name");
-  inline_field_values->push_back(file_name_);
-
-  inline_field_names->push_back("column_delimiter");
-  inline_field_values->push_back(std::string(1, column_delimiter_));
-
-  inline_field_names->push_back("escape_strings");
-  inline_field_values->push_back(escape_strings_ ? "true" : "false");
-}
-
-}  // namespace physical
-}  // namespace optimizer
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/physical/CopyFrom.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/physical/CopyFrom.hpp b/query_optimizer/physical/CopyFrom.hpp
deleted file mode 100644
index ecbf318..0000000
--- a/query_optimizer/physical/CopyFrom.hpp
+++ /dev/null
@@ -1,157 +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_PHYSICAL_COPYFROM_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_PHYSICAL_COPYFROM_HPP_
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "query_optimizer/expressions/ExpressionUtil.hpp"
-#include "query_optimizer/expressions/NamedExpression.hpp"
-#include "query_optimizer/physical/Physical.hpp"
-#include "query_optimizer/physical/PhysicalType.hpp"
-#include "utility/Macros.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-class CatalogRelation;
-
-namespace optimizer {
-namespace physical {
-
-/** \addtogroup OptimizerPhysical
- *  @{
- */
-
-class CopyFrom;
-typedef std::shared_ptr<const CopyFrom> CopyFromPtr;
-
-/**
- * @brief Represents an operation that copies  data from a text file to a relation.
- */
-class CopyFrom : public Physical {
- public:
-  PhysicalType getPhysicalType() const override { return PhysicalType::kCopyFrom; }
-
-  std::string getName() const override { return "CopyFrom"; }
-
-  /**
-   * @return The catalog relation to insert the tuples to.
-   */
-  const CatalogRelation* catalog_relation() const { return catalog_relation_; }
-
-  /**
-   * @return The name of the file to read the data from.
-   */
-  const std::string& file_name() const { return file_name_; }
-
-  /**
-   * @return The delimiter used in the text file to separate columns.
-   */
-  const char column_delimiter() const { return column_delimiter_; }
-
-  /**
-   * @return Whether to decode escape sequences in the text file.
-   */
-  bool escape_strings() const { return escape_strings_; }
-
-  PhysicalPtr copyWithNewChildren(
-      const std::vector<PhysicalPtr> &new_children) const override {
-    DCHECK(new_children.empty());
-    return Create(catalog_relation_,
-                  file_name_,
-                  column_delimiter_,
-                  escape_strings_);
-  }
-
-  std::vector<expressions::AttributeReferencePtr> getOutputAttributes() const override {
-    return std::vector<expressions::AttributeReferencePtr>();
-  }
-
-  std::vector<expressions::AttributeReferencePtr> getReferencedAttributes() const override {
-    return std::vector<expressions::AttributeReferencePtr>();
-  }
-
-  bool maybeCopyWithPrunedExpressions(
-      const expressions::UnorderedNamedExpressionSet &referenced_expressions,
-      PhysicalPtr *output) const override {
-    return false;
-  }
-
-  /**
-   * @brief Creates a CopyFrom physical node.
-   *
-   * @param catalog_relation The catalog relation to insert the tuples to.
-   * @param file_name The name of the file to read the data from.
-   * @param column_delimiter The delimiter used in the text file to separate
-   *                         columns.
-   * @param escape_strings Whether to decode escape sequences in the text file.
-   * @return An immutable CopyFrom physical node.
-   */
-  static CopyFromPtr Create(const CatalogRelation *catalog_relation,
-                            const std::string &file_name,
-                            const char &column_delimiter,
-                            bool escape_strings) {
-    return CopyFromPtr(new CopyFrom(catalog_relation,
-                                    file_name,
-                                    column_delimiter,
-                                    escape_strings));
-  }
-
- 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:
-  CopyFrom(const CatalogRelation *catalog_relation,
-           const std::string &file_name,
-           const char column_delimiter,
-           bool escape_strings)
-      : catalog_relation_(catalog_relation),
-        file_name_(file_name),
-        column_delimiter_(column_delimiter),
-        escape_strings_(escape_strings) {}
-
-  const CatalogRelation *catalog_relation_;
-  std::string file_name_;
-
-  const char column_delimiter_;
-  const bool escape_strings_;
-
-  DISALLOW_COPY_AND_ASSIGN(CopyFrom);
-};
-
-/** @} */
-
-}  // namespace physical
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_QUERY_OPTIMIZER_PHYSICAL_COPYFROM_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/physical/CreateIndex.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/physical/CreateIndex.cpp b/query_optimizer/physical/CreateIndex.cpp
deleted file mode 100644
index af7d500..0000000
--- a/query_optimizer/physical/CreateIndex.cpp
+++ /dev/null
@@ -1,55 +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/physical/CreateIndex.hpp"
-
-#include <string>
-#include <vector>
-
-#include "query_optimizer/OptimizerTree.hpp"
-#include "utility/Cast.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-namespace optimizer {
-namespace physical {
-
-void CreateIndex::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("index_name");
-  inline_field_values->push_back(index_name_);
-
-  non_container_child_field_names->push_back("relation");
-  non_container_child_fields->push_back(input_);
-
-  container_child_field_names->push_back("index_attributes");
-  container_child_fields->push_back(CastSharedPtrVector<OptimizerTreeBase>(index_attributes_));
-
-  inline_field_names->push_back("serialized_index_description");
-  inline_field_values->push_back(index_description_->DebugString());
-}
-
-}  // namespace physical
-}  // namespace optimizer
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/physical/CreateIndex.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/physical/CreateIndex.hpp b/query_optimizer/physical/CreateIndex.hpp
deleted file mode 100644
index 3847736..0000000
--- a/query_optimizer/physical/CreateIndex.hpp
+++ /dev/null
@@ -1,156 +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_PHYSICAL_CREATEINDEX_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_PHYSICAL_CREATEINDEX_HPP_
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "query_optimizer/physical/Physical.hpp"
-#include "query_optimizer/physical/PhysicalType.hpp"
-#include "storage/StorageBlockLayout.pb.h"
-#include "utility/Macros.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-namespace optimizer {
-namespace physical {
-
-/** \addtogroup OptimizerPhysical
- *  @{
- */
-
-class CreateIndex;
-typedef std::shared_ptr<const CreateIndex> CreateIndexPtr;
-
-/**
- * @brief Creates an index.
- */
-class CreateIndex : public Physical {
- public:
-  PhysicalType getPhysicalType() const override {
-    return PhysicalType::kCreateIndex;
-  }
-
-  std::string getName() const override { return "CreateIndex"; }
-
-  /**
-   * @return The input that produces the relation to create index upon.
-   */
-  const PhysicalPtr& input() const { return input_; }
-
-  /**
-   * @return The name of the index to be created.
-   */
-  const std::string& index_name() const { return index_name_; }
-
-  /**
-   * @return The list of attributes to build index upon.
-   */
-  const std::vector<expressions::AttributeReferencePtr>& index_attributes() const {
-    return index_attributes_;
-  }
-
-  /**
-   * @return Shared pointer to the index properties.
-   */
-  std::shared_ptr<const IndexSubBlockDescription> index_description() const {
-    return index_description_;
-  }
-
-  PhysicalPtr copyWithNewChildren(
-      const std::vector<PhysicalPtr> &new_children) const override {
-    DCHECK_EQ(getNumChildren(), new_children.size());
-    return Create(new_children[0], index_name_, index_attributes_, index_description_);
-  }
-
-  std::vector<expressions::AttributeReferencePtr> getOutputAttributes() const override {
-    return index_attributes_;
-  }
-
-  std::vector<expressions::AttributeReferencePtr> getReferencedAttributes() const override {
-    return index_attributes_;
-  }
-
-  bool maybeCopyWithPrunedExpressions(
-      const expressions::UnorderedNamedExpressionSet &referenced_expressions,
-      PhysicalPtr *output) const override {
-    return false;
-  }
-
-  /**
-   * @brief Creates a CreateIndex physical node that represents an operation to
-   *        create a new index.
-   *
-   * @param input The input produces the relation to create index upon.
-   * @param index_name The name of the index to create.
-   * @param index_attributes Set of attributes to create index upon.
-   * @param index_description A proto block describing the set of properties for this index.
-   * @return An immutable CreateIndex node.
-   */
-  static CreateIndexPtr Create(
-      const PhysicalPtr &input,
-      const std::string &index_name,
-      const std::vector<expressions::AttributeReferencePtr> &index_attributes,
-      const std::shared_ptr<const IndexSubBlockDescription> &index_description) {
-    return CreateIndexPtr(new CreateIndex(input, index_name, index_attributes, index_description));
-  }
-
- 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:
-  CreateIndex(
-      const PhysicalPtr &input,
-      const std::string &index_name,
-      const std::vector<expressions::AttributeReferencePtr> &index_attributes,
-      const std::shared_ptr<const IndexSubBlockDescription> &index_description)
-      : input_(input),
-        index_name_(index_name),
-        index_attributes_(index_attributes),
-        index_description_(index_description) {
-    addChild(input_);
-  }
-
-  const PhysicalPtr input_;
-  const std::string index_name_;
-  const std::vector<expressions::AttributeReferencePtr> index_attributes_;
-  std::shared_ptr<const IndexSubBlockDescription> index_description_;
-
-  DISALLOW_COPY_AND_ASSIGN(CreateIndex);
-};
-
-/** @} */
-
-}  // namespace physical
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_QUERY_OPTIMIZER_PHYSICAL_CREATEINDEX_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/physical/CreateTable.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/physical/CreateTable.cpp b/query_optimizer/physical/CreateTable.cpp
deleted file mode 100644
index d42eac3..0000000
--- a/query_optimizer/physical/CreateTable.cpp
+++ /dev/null
@@ -1,56 +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/physical/CreateTable.hpp"
-
-#include <string>
-#include <vector>
-
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "utility/Cast.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-namespace optimizer {
-namespace physical {
-
-void CreateTable::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("relation");
-  inline_field_values->push_back(relation_name_);
-
-  container_child_field_names->push_back("attributes");
-  container_child_fields->push_back(CastSharedPtrVector<OptimizerTreeBase>(attributes_));
-
-  // The tree representation of the LayoutDescription object, if specified by the user.
-  if (block_properties_representation_) {
-    non_container_child_field_names->push_back("block_properties");
-    non_container_child_fields->push_back(block_properties_representation_);
-  }
-}
-
-}  // namespace physical
-}  // namespace optimizer
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/physical/CreateTable.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/physical/CreateTable.hpp b/query_optimizer/physical/CreateTable.hpp
deleted file mode 100644
index 8e3bbd4..0000000
--- a/query_optimizer/physical/CreateTable.hpp
+++ /dev/null
@@ -1,148 +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_PHYSICAL_CREATETABLE_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_PHYSICAL_CREATETABLE_HPP_
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "query_optimizer/expressions/ExpressionUtil.hpp"
-#include "query_optimizer/expressions/NamedExpression.hpp"
-#include "query_optimizer/physical/Physical.hpp"
-#include "query_optimizer/physical/PhysicalType.hpp"
-#include "utility/Macros.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-namespace optimizer {
-namespace physical {
-
-/** \addtogroup OptimizerPhysical
- *  @{
- */
-
-class CreateTable;
-typedef std::shared_ptr<const CreateTable> CreateTablePtr;
-
-/**
- * @brief Creates a table.
- */
-class CreateTable : public Physical {
- public:
-  PhysicalType getPhysicalType() const override {
-    return PhysicalType::kCreateTable;
-  }
-
-  std::string getName() const override { return "CreateTable"; }
-
-  /**
-   * @return The name of the relation to be inserted.
-   */
-  const std::string& relation_name() const { return relation_name_; }
-
-  /**
-   * @return Attribute list of the relation.
-   */
-  const std::vector<expressions::AttributeReferencePtr>& attributes() const {
-    return attributes_;
-  }
-
-  /**
-   * @return Shared pointer to the block properties.
-   */
-  const std::shared_ptr<const StorageBlockLayoutDescription> block_properties() const {
-    return block_properties_;
-  }
-
-  PhysicalPtr copyWithNewChildren(
-      const std::vector<PhysicalPtr> &new_children) const override {
-    DCHECK_EQ(getNumChildren(), new_children.size());
-    return Create(relation_name_, attributes_, block_properties_);
-  }
-
-  std::vector<expressions::AttributeReferencePtr> getOutputAttributes() const override {
-    return attributes_;
-  }
-
-  std::vector<expressions::AttributeReferencePtr> getReferencedAttributes() const override {
-    return attributes_;
-  }
-
-  bool maybeCopyWithPrunedExpressions(
-      const expressions::UnorderedNamedExpressionSet &referenced_expressions,
-      PhysicalPtr *output) const override {
-    return false;
-  }
-
-  /**
-   * @brief Creates a CreateTable physical node that represents an operation to
-   *        create a new table.
-   *
-   * @param relation_name The name of the relation to be inserted.
-   * @param attributes Schema of the relation.
-   * @param block_properties The optional proto message describing the block.
-   * @return An immutable CreateTable node.
-   */
-  static CreateTablePtr Create(
-      const std::string &relation_name,
-      const std::vector<expressions::AttributeReferencePtr> &attributes,
-      const std::shared_ptr<const StorageBlockLayoutDescription> &block_properties) {
-    return CreateTablePtr(new CreateTable(relation_name, attributes, block_properties));
-  }
-
- 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:
-  CreateTable(
-      const std::string &relation_name,
-      const std::vector<expressions::AttributeReferencePtr> &attributes,
-      const std::shared_ptr<const StorageBlockLayoutDescription> &block_properties)
-      : relation_name_(relation_name),
-        attributes_(attributes),
-        block_properties_(block_properties),
-        block_properties_representation_(
-            getOptimizerRepresentationForProto<OptimizerTreeBaseNodePtr>(block_properties_.get())) {}
-
-  std::string relation_name_;
-  std::vector<expressions::AttributeReferencePtr> attributes_;
-  std::shared_ptr<const StorageBlockLayoutDescription> block_properties_;
-  std::shared_ptr<const OptimizerProtoRepresentation<OptimizerTreeBaseNodePtr> > block_properties_representation_;
-
-  DISALLOW_COPY_AND_ASSIGN(CreateTable);
-};
-
-/** @} */
-
-}  // namespace physical
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_QUERY_OPTIMIZER_PHYSICAL_CREATETABLE_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/physical/DeleteTuples.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/physical/DeleteTuples.cpp b/query_optimizer/physical/DeleteTuples.cpp
deleted file mode 100644
index 2c93502..0000000
--- a/query_optimizer/physical/DeleteTuples.cpp
+++ /dev/null
@@ -1,61 +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/physical/DeleteTuples.hpp"
-
-#include <string>
-#include <vector>
-
-#include "catalog/CatalogRelation.hpp"
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "query_optimizer/expressions/Predicate.hpp"
-
-namespace quickstep {
-namespace optimizer {
-namespace physical {
-
-std::vector<expressions::AttributeReferencePtr> DeleteTuples::getReferencedAttributes() const {
-  if (predicate_ != nullptr) {
-    return predicate_->getReferencedAttributes();
-  } else {
-    return std::vector<expressions::AttributeReferencePtr>();
-  }
-}
-
-void DeleteTuples::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("input");
-  non_container_child_fields->push_back(input_);
-
-  if (predicate_ != nullptr) {
-    non_container_child_field_names->push_back("predicate");
-    non_container_child_fields->push_back(predicate_);
-  }
-}
-
-}  // namespace physical
-}  // namespace optimizer
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/physical/DeleteTuples.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/physical/DeleteTuples.hpp b/query_optimizer/physical/DeleteTuples.hpp
deleted file mode 100644
index bd1e847..0000000
--- a/query_optimizer/physical/DeleteTuples.hpp
+++ /dev/null
@@ -1,138 +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_PHYSICAL_DELETE_TUPLES_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_PHYSICAL_DELETE_TUPLES_HPP_
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "query_optimizer/expressions/ExpressionUtil.hpp"
-#include "query_optimizer/expressions/NamedExpression.hpp"
-#include "query_optimizer/expressions/Predicate.hpp"
-#include "query_optimizer/physical/Physical.hpp"
-#include "query_optimizer/physical/PhysicalType.hpp"
-#include "utility/Macros.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-class CatalogRelation;
-
-namespace optimizer {
-namespace physical {
-
-/** \addtogroup OptimizerPhysical
- *  @{
- */
-
-class DeleteTuples;
-typedef std::shared_ptr<const DeleteTuples> DeleteTuplesPtr;
-
-/**
- * @brief Deletes tuples on which a predicate <predicate_> is
- *        evaluated to true.
- */
-class DeleteTuples : public Physical {
- public:
-  PhysicalType getPhysicalType() const override {
-    return PhysicalType::kDeleteTuples;
-  }
-
-  std::string getName() const override { return "DeleteTuples"; }
-
-  /**
-   * @return The physical node that produces the relation
-   *         where the DeleteTuples is applied.
-   */
-  const PhysicalPtr& input() const { return input_; }
-
-  /**
-   * @return The predicate used to determine whether a tuple should be deleted.
-   */
-  const expressions::PredicatePtr& predicate() const { return predicate_; }
-
-  PhysicalPtr copyWithNewChildren(
-      const std::vector<PhysicalPtr> &new_children) const override {
-    DCHECK_EQ(getNumChildren(), new_children.size());
-    return Create(new_children[0], predicate_);
-  }
-
-  std::vector<expressions::AttributeReferencePtr> getOutputAttributes() const override {
-    return {};
-  }
-
-  std::vector<expressions::AttributeReferencePtr> getReferencedAttributes() const override;
-
-  bool maybeCopyWithPrunedExpressions(
-      const expressions::UnorderedNamedExpressionSet &referenced_expressions,
-      PhysicalPtr *output) const override {
-    return false;
-  }
-
-  /**
-   * @brief Creates a DeleteTuples physical node that represents an operation
-   *        to delete tuples on which \p predicate is evaluated to true
-   *        from the relation output by \p input. If \p predicate is NULL,
-   *        all tuples are removed.
-   *
-   * @param input The physical node that produces the relation
-   *              where the DeleteTuples is applied.
-   * @param predicate The predicate used to determine whether
-   *                  a tuple needs to be deleted. Can be NULL.
-   * @return An immutable DeleteTuples node.
-   */
-  static DeleteTuplesPtr Create(const PhysicalPtr &input,
-                                const expressions::PredicatePtr &predicate) {
-    return DeleteTuplesPtr(new DeleteTuples(input, predicate));
-  }
-
- 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:
-  DeleteTuples(const PhysicalPtr &input,
-               const expressions::PredicatePtr &predicate)
-      : input_(input), predicate_(predicate) {
-    addChild(input_);
-  }
-
-  PhysicalPtr input_;
-  expressions::PredicatePtr predicate_;
-
-  DISALLOW_COPY_AND_ASSIGN(DeleteTuples);
-};
-
-/** @} */
-
-}  // namespace physical
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_QUERY_OPTIMIZER_PHYSICAL_DELETE_TUPLES_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/physical/DropTable.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/physical/DropTable.cpp b/query_optimizer/physical/DropTable.cpp
deleted file mode 100644
index 6a4b5bd..0000000
--- a/query_optimizer/physical/DropTable.cpp
+++ /dev/null
@@ -1,45 +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/physical/DropTable.hpp"
-
-#include <string>
-#include <vector>
-
-#include "catalog/CatalogRelation.hpp"
-#include "query_optimizer/OptimizerTree.hpp"
-
-namespace quickstep {
-namespace optimizer {
-namespace physical {
-
-void DropTable::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("relation");
-  inline_field_values->push_back(catalog_relation_->getName());
-}
-
-}  // namespace physical
-}  // namespace optimizer
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/physical/DropTable.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/physical/DropTable.hpp b/query_optimizer/physical/DropTable.hpp
deleted file mode 100644
index ef6020b..0000000
--- a/query_optimizer/physical/DropTable.hpp
+++ /dev/null
@@ -1,119 +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_PHYSICAL_DROPTABLE_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_PHYSICAL_DROPTABLE_HPP_
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "query_optimizer/expressions/ExpressionUtil.hpp"
-#include "query_optimizer/expressions/NamedExpression.hpp"
-#include "query_optimizer/physical/Physical.hpp"
-#include "query_optimizer/physical/PhysicalType.hpp"
-#include "utility/Macros.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-class CatalogRelation;
-
-namespace optimizer {
-namespace physical {
-
-/** \addtogroup OptimizerPhysical
- *  @{
- */
-
-class DropTable;
-typedef std::shared_ptr<const DropTable> DropTablePtr;
-
-/**
- * @brief Drops a table.
- */
-class DropTable : public Physical {
- public:
-  PhysicalType getPhysicalType() const override { return PhysicalType::kDropTable; }
-
-  std::string getName() const override { return "DropTable"; }
-
-  /**
-   * @return Gets the catalog relation to be dropped.
-   */
-  const CatalogRelation* catalog_relation() const { return catalog_relation_; }
-
-  PhysicalPtr copyWithNewChildren(
-      const std::vector<PhysicalPtr> &new_children) const override {
-    DCHECK_EQ(getNumChildren(), new_children.size());
-    return Create(catalog_relation_);
-  }
-
-  std::vector<expressions::AttributeReferencePtr> getOutputAttributes() const override {
-    return {};
-  }
-
-  std::vector<expressions::AttributeReferencePtr> getReferencedAttributes() const override {
-    return {};
-  }
-
-  bool maybeCopyWithPrunedExpressions(
-      const expressions::UnorderedNamedExpressionSet &referenced_expressions,
-      PhysicalPtr *output) const override {
-    return false;
-  }
-
-  /**
-   * @brief Creates a DropTable physical node that drops \p catalog_relation.
-   *
-   * @param catalog_relation The relation to be dropped.
-   * @return An immutable DropTable node.
-   */
-  static DropTablePtr Create(const CatalogRelation *catalog_relation) {
-    return DropTablePtr(new DropTable(catalog_relation));
-  }
-
- 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 DropTable(const CatalogRelation *catalog_relation)
-      : catalog_relation_(catalog_relation) {}
-
-  const CatalogRelation *catalog_relation_;
-
-  DISALLOW_COPY_AND_ASSIGN(DropTable);
-};
-
-/** @} */
-
-}  // namespace physical
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_QUERY_OPTIMIZER_PHYSICAL_DROPTABLE_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/physical/HashJoin.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/physical/HashJoin.cpp b/query_optimizer/physical/HashJoin.cpp
deleted file mode 100644
index e186072..0000000
--- a/query_optimizer/physical/HashJoin.cpp
+++ /dev/null
@@ -1,113 +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/physical/HashJoin.hpp"
-
-#include <string>
-#include <vector>
-
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "query_optimizer/expressions/ExpressionUtil.hpp"
-#include "query_optimizer/expressions/NamedExpression.hpp"
-#include "query_optimizer/expressions/Predicate.hpp"
-#include "utility/Cast.hpp"
-
-namespace quickstep {
-namespace optimizer {
-namespace physical {
-
-std::vector<expressions::AttributeReferencePtr> HashJoin::getReferencedAttributes() const {
-  std::vector<expressions::AttributeReferencePtr> referenced_attributes;
-  for (const expressions::NamedExpressionPtr &project_expression :
-       project_expressions()) {
-    const std::vector<expressions::AttributeReferencePtr> referenced_attributes_in_expression =
-        project_expression->getReferencedAttributes();
-    referenced_attributes.insert(referenced_attributes.end(),
-                                 referenced_attributes_in_expression.begin(),
-                                 referenced_attributes_in_expression.end());
-  }
-  referenced_attributes.insert(referenced_attributes.end(),
-                               left_join_attributes_.begin(),
-                               left_join_attributes_.end());
-  referenced_attributes.insert(referenced_attributes.end(),
-                               right_join_attributes_.begin(),
-                               right_join_attributes_.end());
-  if (residual_predicate_ != nullptr) {
-    const std::vector<expressions::AttributeReferencePtr> referenced_attributes_in_residual =
-        residual_predicate_->getReferencedAttributes();
-    referenced_attributes.insert(referenced_attributes.end(),
-                                 referenced_attributes_in_residual.begin(),
-                                 referenced_attributes_in_residual.end());
-  }
-  return referenced_attributes;
-}
-
-bool HashJoin::maybeCopyWithPrunedExpressions(
-    const expressions::UnorderedNamedExpressionSet &referenced_expressions,
-    PhysicalPtr *output) const {
-  std::vector<expressions::NamedExpressionPtr> new_project_expressions;
-  const std::vector<expressions::NamedExpressionPtr> &
-      current_project_expressions = project_expressions();
-  for (const expressions::NamedExpressionPtr &project_expression :
-       current_project_expressions) {
-    if (referenced_expressions.find(project_expression) !=
-        referenced_expressions.end()) {
-      new_project_expressions.emplace_back(project_expression);
-    }
-  }
-  if (new_project_expressions.size() != current_project_expressions.size()) {
-    *output = Create(left(),
-                     right(),
-                     left_join_attributes_,
-                     right_join_attributes_,
-                     residual_predicate_,
-                     new_project_expressions,
-                     join_type_);
-    return true;
-  }
-  return false;
-}
-
-void HashJoin::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 {
-  BinaryJoin::getFieldStringItems(inline_field_names,
-                                  inline_field_values,
-                                  non_container_child_field_names,
-                                  non_container_child_fields,
-                                  container_child_field_names,
-                                  container_child_fields);
-  if (residual_predicate_ != nullptr) {
-    non_container_child_field_names->push_back("residual_predicate");
-    non_container_child_fields->push_back(residual_predicate_);
-  }
-  container_child_field_names->push_back("left_join_attributes");
-  container_child_fields->push_back(CastSharedPtrVector<OptimizerTreeBase>(left_join_attributes_));
-  container_child_field_names->push_back("right_join_attributes");
-  container_child_fields->push_back(CastSharedPtrVector<OptimizerTreeBase>(right_join_attributes_));
-}
-
-}  // namespace physical
-}  // namespace optimizer
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/physical/HashJoin.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/physical/HashJoin.hpp b/query_optimizer/physical/HashJoin.hpp
deleted file mode 100644
index c513f77..0000000
--- a/query_optimizer/physical/HashJoin.hpp
+++ /dev/null
@@ -1,198 +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_PHYSICAL_HASHJOIN_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_PHYSICAL_HASHJOIN_HPP_
-
-#include <cstddef>
-#include <memory>
-#include <string>
-#include <type_traits>
-#include <vector>
-
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "query_optimizer/expressions/ExpressionUtil.hpp"
-#include "query_optimizer/expressions/NamedExpression.hpp"
-#include "query_optimizer/expressions/Predicate.hpp"
-#include "query_optimizer/physical/BinaryJoin.hpp"
-#include "query_optimizer/physical/Physical.hpp"
-#include "query_optimizer/physical/PhysicalType.hpp"
-#include "utility/Macros.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-namespace optimizer {
-namespace physical {
-
-/** \addtogroup OptimizerPhysical
- *  @{
- */
-
-class HashJoin;
-typedef std::shared_ptr<const HashJoin> HashJoinPtr;
-
-/**
- * @brief Physical hash join node.
- */
-class HashJoin : public BinaryJoin {
- public:
-  enum class JoinType {
-    kInnerJoin = 0,
-    kLeftSemiJoin,
-    kLeftAntiJoin,
-    kLeftOuterJoin
-  };
-
-  PhysicalType getPhysicalType() const override { return PhysicalType::kHashJoin; }
-
-  std::string getName() const override {
-    switch (join_type_) {
-      case JoinType::kInnerJoin:
-        return "HashJoin";
-      case JoinType::kLeftSemiJoin:
-        return "HashLeftSemiJoin";
-      case JoinType::kLeftAntiJoin:
-        return "HashLeftAntiJoin";
-      case JoinType::kLeftOuterJoin:
-        return "HashLeftOuterJoin";
-      default:
-        LOG(FATAL) << "Invalid JoinType: "
-                   << static_cast<typename std::underlying_type<JoinType>::type>(join_type_);
-    }
-  }
-
-  /**
-   * @brief Join attributes in the left logical 'left_'.
-   */
-  const std::vector<expressions::AttributeReferencePtr>& left_join_attributes() const {
-    return left_join_attributes_;
-  }
-
-  /**
-   * @brief Join attributes in the right logical 'right_'.
-   */
-  const std::vector<expressions::AttributeReferencePtr>& right_join_attributes() const {
-    return right_join_attributes_;
-  }
-
-  /**
-   * @brief The filtering predicate evaluated after join.
-   */
-  const expressions::PredicatePtr& residual_predicate() const {
-    return residual_predicate_;
-  }
-
-  /**
-   * @return Join type of this hash join.
-   */
-  JoinType join_type() const {
-    return join_type_;
-  }
-
-  PhysicalPtr copyWithNewChildren(
-      const std::vector<PhysicalPtr> &new_children) const override {
-    DCHECK_EQ(children().size(), new_children.size());
-    return Create(new_children[0],
-                  new_children[1],
-                  left_join_attributes_,
-                  right_join_attributes_,
-                  residual_predicate_,
-                  project_expressions(),
-                  join_type_);
-  }
-
-  std::vector<expressions::AttributeReferencePtr> getReferencedAttributes() const override;
-
-  bool maybeCopyWithPrunedExpressions(
-      const expressions::UnorderedNamedExpressionSet &referenced_expressions,
-      PhysicalPtr *output) const override;
-
-  /**
-   * @brief Creates a physical HashJoin. The left/right operand does not correspond to
-   *        probe/build operand.
-   *
-   * @param left The left operand.
-   * @param right The right operand.
-   * @param left_join_attributes The join attributes in the 'left'.
-   * @param right_join_attributes The join attributes in the 'right'.
-   * @param residual_predicate Optional filtering predicate evaluated after join.
-   * @param project_expressions The project expressions.
-   * @param Join type of this hash join.
-   * @return An immutable physical HashJoin.
-   */
-  static HashJoinPtr Create(
-      const PhysicalPtr &left,
-      const PhysicalPtr &right,
-      const std::vector<expressions::AttributeReferencePtr> &left_join_attributes,
-      const std::vector<expressions::AttributeReferencePtr> &right_join_attributes,
-      const expressions::PredicatePtr &residual_predicate,
-      const std::vector<expressions::NamedExpressionPtr> &project_expressions,
-      const JoinType join_type) {
-    return HashJoinPtr(
-        new HashJoin(left,
-                     right,
-                     left_join_attributes,
-                     right_join_attributes,
-                     residual_predicate,
-                     project_expressions,
-                     join_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:
-  HashJoin(
-      const PhysicalPtr &left,
-      const PhysicalPtr &right,
-      const std::vector<expressions::AttributeReferencePtr> &left_join_attributes,
-      const std::vector<expressions::AttributeReferencePtr> &right_join_attributes,
-      const expressions::PredicatePtr &residual_predicate,
-      const std::vector<expressions::NamedExpressionPtr> &project_expressions,
-      const JoinType join_type)
-      : BinaryJoin(left, right, project_expressions),
-        left_join_attributes_(left_join_attributes),
-        right_join_attributes_(right_join_attributes),
-        residual_predicate_(residual_predicate),
-        join_type_(join_type) {
-  }
-
-  std::vector<expressions::AttributeReferencePtr> left_join_attributes_;
-  std::vector<expressions::AttributeReferencePtr> right_join_attributes_;
-  expressions::PredicatePtr residual_predicate_;
-  JoinType join_type_;
-
-  DISALLOW_COPY_AND_ASSIGN(HashJoin);
-};
-
-/** @} */
-
-}  // namespace physical
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_QUERY_OPTIMIZER_PHYSICAL_HASHJOIN_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/physical/InsertSelection.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/physical/InsertSelection.cpp b/query_optimizer/physical/InsertSelection.cpp
deleted file mode 100644
index 42a888f..0000000
--- a/query_optimizer/physical/InsertSelection.cpp
+++ /dev/null
@@ -1,47 +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/physical/InsertSelection.hpp"
-
-#include <string>
-#include <vector>
-
-#include "query_optimizer/OptimizerTree.hpp"
-
-namespace quickstep {
-namespace optimizer {
-namespace physical {
-
-void InsertSelection::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("destination");
-  non_container_child_fields->push_back(destination_);
-
-  non_container_child_field_names->push_back("selection");
-  non_container_child_fields->push_back(selection_);
-}
-
-}  // namespace physical
-}  // namespace optimizer
-}  // namespace quickstep


[51/51] [abbrv] [partial] incubator-quickstep git commit: remove c++ files

Posted by sp...@apache.org.
remove c++ files


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

Branch: refs/heads/gh-pages
Commit: 156290a4e65f67beef270cd1989836c5fd980e65
Parents: 401b8c0
Author: Marc Spehlmann <ma...@gmail.com>
Authored: Sun Dec 11 09:04:49 2016 -0600
Committer: Marc Spehlmann <ma...@gmail.com>
Committed: Sun Dec 11 09:04:49 2016 -0600

----------------------------------------------------------------------
 .gitignore                                      |    15 +-
 BUILDING.md                                     |   206 -
 CMakeLists.txt                                  |   784 -
 CREDITS.md                                      |    12 -
 DEV_README.md                                   |   108 -
 DISCLAIMER                                      |    11 -
 Doxyfile                                        |  2280 --
 GENERATOR_FUNCTIONS.md                          |    89 -
 LICENSE                                         |   202 -
 NOTICE                                          |    44 -
 WORKING_WITH_AN_IDE.md                          |   178 -
 build/profile_build.sh                          |   109 -
 build/vagrant/README.md                         |    97 -
 build/vagrant/debian-jessie-amd64/Vagrantfile   |    39 -
 build/vagrant/freebsd-10.2-amd64/Vagrantfile    |    45 -
 build/vagrant/ubuntu-precise-amd64/Vagrantfile  |    48 -
 catalog/CMakeLists.txt                          |   249 -
 catalog/Catalog.cpp                             |   111 -
 catalog/Catalog.hpp                             |   299 -
 catalog/Catalog.proto                           |   124 -
 catalog/CatalogAttribute.cpp                    |    69 -
 catalog/CatalogAttribute.hpp                    |   198 -
 catalog/CatalogConfig.h.in                      |    21 -
 catalog/CatalogDatabase.cpp                     |   154 -
 catalog/CatalogDatabase.hpp                     |   468 -
 catalog/CatalogDatabaseCache.cpp                |   107 -
 catalog/CatalogDatabaseCache.hpp                |   139 -
 catalog/CatalogDatabaseLite.hpp                 |   104 -
 catalog/CatalogErrors.hpp                       |    54 -
 catalog/CatalogModule.hpp                       |    25 -
 catalog/CatalogRelation.cpp                     |   198 -
 catalog/CatalogRelation.hpp                     |   438 -
 catalog/CatalogRelationSchema.cpp               |   191 -
 catalog/CatalogRelationSchema.hpp               |   545 -
 catalog/CatalogRelationStatistics.cpp           |    51 -
 catalog/CatalogRelationStatistics.hpp           |   124 -
 catalog/CatalogTypedefs.hpp                     |    58 -
 catalog/IndexScheme.cpp                         |    82 -
 catalog/IndexScheme.hpp                         |   194 -
 catalog/NUMAPlacementScheme.cpp                 |    85 -
 catalog/NUMAPlacementScheme.hpp                 |   208 -
 catalog/PartitionScheme.cpp                     |   115 -
 catalog/PartitionScheme.hpp                     |   190 -
 catalog/PartitionSchemeHeader.cpp               |   134 -
 catalog/PartitionSchemeHeader.hpp               |   314 -
 catalog/tests/Catalog_unittest.cpp              |   629 -
 catalog/tests/NUMAPlacementScheme_unittest.cpp  |   133 -
 catalog/tests/PartitionScheme_unittest.cpp      |   652 -
 cli/CMakeLists.txt                              |   154 -
 cli/CliConfig.h.in                              |    22 -
 cli/CliModule.hpp                               |    23 -
 cli/CommandExecutor.cpp                         |   406 -
 cli/CommandExecutor.hpp                         |    78 -
 cli/DefaultsConfigurator.cpp                    |    78 -
 cli/DefaultsConfigurator.hpp                    |   132 -
 cli/DropRelation.cpp                            |    45 -
 cli/DropRelation.hpp                            |    57 -
 cli/Flags.cpp                                   |    72 -
 cli/Flags.hpp                                   |    43 -
 cli/InputParserUtil.cpp                         |   143 -
 cli/InputParserUtil.hpp                         |    79 -
 cli/LineReader.cpp                              |   243 -
 cli/LineReader.hpp                              |    97 -
 cli/LineReaderDumb.cpp                          |    78 -
 cli/LineReaderDumb.hpp                          |    54 -
 cli/LineReaderLineNoise.cpp                     |    60 -
 cli/LineReaderLineNoise.hpp                     |    57 -
 cli/PrintToScreen.cpp                           |   185 -
 cli/PrintToScreen.hpp                           |    99 -
 cli/QuickstepCli.cpp                            |   451 -
 cli/tests/CMakeLists.txt                        |    52 -
 cli/tests/CommandExecutorTest.cpp               |    58 -
 cli/tests/CommandExecutorTestRunner.cpp         |   134 -
 cli/tests/CommandExecutorTestRunner.hpp         |   122 -
 cli/tests/command_executor/CMakeLists.txt       |    33 -
 cli/tests/command_executor/D.test               |   122 -
 cli/tests/command_executor/Dt.test              |    79 -
 cmake/FindGSasl.cmake                           |    42 -
 cmake/FindKerberos.cmake                        |    40 -
 cmake/FindLibNuma.cmake                         |    28 -
 cmake/FindLibhdfs3.cmake                        |    39 -
 compression/CMakeLists.txt                      |    78 -
 compression/CompressionDictionary.cpp           |   415 -
 compression/CompressionDictionary.hpp           |   260 -
 compression/CompressionDictionaryBuilder.cpp    |   207 -
 compression/CompressionDictionaryBuilder.hpp    |   245 -
 compression/CompressionDictionaryLite.cpp       |   103 -
 compression/CompressionDictionaryLite.hpp       |   312 -
 compression/CompressionModule.hpp               |    24 -
 .../tests/CompressionDictionary_unittest.cpp    |  2290 --
 cyclic_dependency.py                            |   230 -
 empty_src.cpp                                   |    24 -
 expressions/CMakeLists.txt                      |    71 -
 expressions/ExpressionFactories.cpp             |   313 -
 expressions/ExpressionFactories.hpp             |   121 -
 expressions/Expressions.proto                   |   125 -
 expressions/ExpressionsModule.hpp               |    23 -
 expressions/aggregation/AggregateFunction.cpp   |    58 -
 expressions/aggregation/AggregateFunction.hpp   |   148 -
 expressions/aggregation/AggregateFunction.proto |    32 -
 .../aggregation/AggregateFunctionAvg.cpp        |    83 -
 .../aggregation/AggregateFunctionAvg.hpp        |    74 -
 .../aggregation/AggregateFunctionCount.cpp      |    69 -
 .../aggregation/AggregateFunctionCount.hpp      |    74 -
 .../aggregation/AggregateFunctionFactory.cpp    |   105 -
 .../aggregation/AggregateFunctionFactory.hpp    |   101 -
 .../aggregation/AggregateFunctionMax.cpp        |    65 -
 .../aggregation/AggregateFunctionMax.hpp        |    74 -
 .../aggregation/AggregateFunctionMin.cpp        |    65 -
 .../aggregation/AggregateFunctionMin.hpp        |    74 -
 .../aggregation/AggregateFunctionSum.cpp        |    81 -
 .../aggregation/AggregateFunctionSum.hpp        |    74 -
 .../aggregation/AggregationConcreteHandle.cpp   |    68 -
 .../aggregation/AggregationConcreteHandle.hpp   |   325 -
 expressions/aggregation/AggregationHandle.hpp   |   437 -
 .../aggregation/AggregationHandleAvg.cpp        |   205 -
 .../aggregation/AggregationHandleAvg.hpp        |   273 -
 .../aggregation/AggregationHandleCount.cpp      |   210 -
 .../aggregation/AggregationHandleCount.hpp      |   250 -
 .../aggregation/AggregationHandleDistinct.cpp   |    81 -
 .../aggregation/AggregationHandleDistinct.hpp   |   130 -
 .../aggregation/AggregationHandleMax.cpp        |   137 -
 .../aggregation/AggregationHandleMax.hpp        |   251 -
 .../aggregation/AggregationHandleMin.cpp        |   138 -
 .../aggregation/AggregationHandleMin.hpp        |   252 -
 .../aggregation/AggregationHandleSum.cpp        |   190 -
 .../aggregation/AggregationHandleSum.hpp        |   254 -
 expressions/aggregation/AggregationID.hpp       |    44 -
 expressions/aggregation/CMakeLists.txt          |   325 -
 .../tests/AggregationHandleAvg_unittest.cpp     |   596 -
 .../tests/AggregationHandleCount_unittest.cpp   |   660 -
 .../tests/AggregationHandleMax_unittest.cpp     |   826 -
 .../tests/AggregationHandleMin_unittest.cpp     |   822 -
 .../tests/AggregationHandleSum_unittest.cpp     |   611 -
 expressions/predicate/CMakeLists.txt            |   159 -
 expressions/predicate/ComparisonPredicate.cpp   |   376 -
 expressions/predicate/ComparisonPredicate.hpp   |   156 -
 expressions/predicate/ConjunctionPredicate.cpp  |   201 -
 expressions/predicate/ConjunctionPredicate.hpp  |    97 -
 expressions/predicate/DisjunctionPredicate.cpp  |   222 -
 expressions/predicate/DisjunctionPredicate.hpp  |    99 -
 expressions/predicate/NegationPredicate.cpp     |   123 -
 expressions/predicate/NegationPredicate.hpp     |   125 -
 expressions/predicate/Predicate.cpp             |    60 -
 expressions/predicate/Predicate.hpp             |   208 -
 expressions/predicate/PredicateCost.hpp         |    62 -
 expressions/predicate/PredicateWithList.hpp     |    77 -
 expressions/predicate/TrivialPredicates.hpp     |   167 -
 .../predicate/tests/Predicate_unittest.cpp      |   447 -
 expressions/scalar/CMakeLists.txt               |   181 -
 expressions/scalar/Scalar.cpp                   |    38 -
 expressions/scalar/Scalar.hpp                   |   242 -
 expressions/scalar/ScalarAttribute.cpp          |   214 -
 expressions/scalar/ScalarAttribute.hpp          |   105 -
 expressions/scalar/ScalarBinaryExpression.cpp   |   377 -
 expressions/scalar/ScalarBinaryExpression.hpp   |   130 -
 expressions/scalar/ScalarCaseExpression.cpp     |   515 -
 expressions/scalar/ScalarCaseExpression.hpp     |   202 -
 expressions/scalar/ScalarLiteral.cpp            |    70 -
 expressions/scalar/ScalarLiteral.hpp            |   124 -
 expressions/scalar/ScalarUnaryExpression.cpp    |   169 -
 expressions/scalar/ScalarUnaryExpression.hpp    |   125 -
 .../tests/ScalarCaseExpression_unittest.cpp     |   980 -
 expressions/scalar/tests/Scalar_unittest.cpp    |   381 -
 expressions/table_generator/CMakeLists.txt      |    66 -
 expressions/table_generator/GenerateSeries.hpp  |   149 -
 .../table_generator/GenerateSeriesHandle.hpp    |   187 -
 .../table_generator/GeneratorFunction.hpp       |   135 -
 .../table_generator/GeneratorFunction.proto     |    27 -
 .../GeneratorFunctionFactory.cpp                |    73 -
 .../GeneratorFunctionFactory.hpp                |    95 -
 .../table_generator/GeneratorFunctionHandle.hpp |   153 -
 expressions/window_aggregation/CMakeLists.txt   |   213 -
 .../WindowAggregateFunction.cpp                 |    58 -
 .../WindowAggregateFunction.hpp                 |   158 -
 .../WindowAggregateFunction.proto               |    32 -
 .../WindowAggregateFunctionAvg.cpp              |    93 -
 .../WindowAggregateFunctionAvg.hpp              |    79 -
 .../WindowAggregateFunctionCount.cpp            |    63 -
 .../WindowAggregateFunctionCount.hpp            |    79 -
 .../WindowAggregateFunctionFactory.cpp          |   106 -
 .../WindowAggregateFunctionFactory.hpp          |    96 -
 .../WindowAggregateFunctionMax.cpp              |    71 -
 .../WindowAggregateFunctionMax.hpp              |    79 -
 .../WindowAggregateFunctionMin.cpp              |    70 -
 .../WindowAggregateFunctionMin.hpp              |    79 -
 .../WindowAggregateFunctionSum.cpp              |    86 -
 .../WindowAggregateFunctionSum.hpp              |    79 -
 .../WindowAggregationHandle.cpp                 |   186 -
 .../WindowAggregationHandle.hpp                 |   173 -
 .../WindowAggregationHandleAvg.cpp              |   174 -
 .../WindowAggregationHandleAvg.hpp              |    92 -
 .../window_aggregation/WindowAggregationID.hpp  |    44 -
 .../WindowAggregationHandleAvg_unittest.cpp     |   518 -
 parser/CMakeLists.txt                           |   440 -
 parser/ParseAssignment.hpp                      |   110 -
 parser/ParseAttributeDefinition.cpp             |    91 -
 parser/ParseAttributeDefinition.hpp             |   255 -
 parser/ParseBasicExpressions.cpp                |   233 -
 parser/ParseBasicExpressions.hpp                |   640 -
 parser/ParseBlockProperties.cpp                 |    31 -
 parser/ParseBlockProperties.hpp                 |   256 -
 parser/ParseCaseExpressions.cpp                 |   131 -
 parser/ParseCaseExpressions.hpp                 |   315 -
 parser/ParseExpression.hpp                      |    82 -
 parser/ParseGeneratorTableReference.cpp         |    40 -
 parser/ParseGeneratorTableReference.hpp         |    93 -
 parser/ParseGroupBy.cpp                         |    41 -
 parser/ParseGroupBy.hpp                         |    91 -
 parser/ParseHaving.cpp                          |    39 -
 parser/ParseHaving.hpp                          |    89 -
 parser/ParseIndexProperties.cpp                 |    29 -
 parser/ParseIndexProperties.hpp                 |   512 -
 parser/ParseJoinedTableReference.cpp            |    73 -
 parser/ParseJoinedTableReference.hpp            |   130 -
 parser/ParseKeyValue.hpp                        |   257 -
 parser/ParseLimit.cpp                           |    39 -
 parser/ParseLimit.hpp                           |    90 -
 parser/ParseLiteralValue.cpp                    |   211 -
 parser/ParseLiteralValue.hpp                    |   354 -
 parser/ParseOrderBy.cpp                         |    57 -
 parser/ParseOrderBy.hpp                         |   167 -
 parser/ParsePartitionClause.hpp                 |   134 -
 parser/ParsePredicate.cpp                       |   106 -
 parser/ParsePredicate.hpp                       |   453 -
 parser/ParsePredicateExists.hpp                 |    95 -
 parser/ParsePredicateInTableQuery.hpp           |   112 -
 parser/ParsePriority.hpp                        |    96 -
 parser/ParseSample.cpp                          |    39 -
 parser/ParseSample.hpp                          |   105 -
 parser/ParseSelect.hpp                          |   235 -
 parser/ParseSelectionClause.cpp                 |    60 -
 parser/ParseSelectionClause.hpp                 |   219 -
 parser/ParseSimpleTableReference.cpp            |    53 -
 parser/ParseSimpleTableReference.hpp            |   102 -
 parser/ParseStatement.hpp                       |  1215 -
 parser/ParseString.cpp                          |    37 -
 parser/ParseString.hpp                          |   118 -
 parser/ParseSubqueryExpression.cpp              |    47 -
 parser/ParseSubqueryExpression.hpp              |    92 -
 parser/ParseSubqueryTableReference.cpp          |    46 -
 parser/ParseSubqueryTableReference.hpp          |    95 -
 parser/ParseTableReference.cpp                  |    65 -
 parser/ParseTableReference.hpp                  |   158 -
 parser/ParseTreeNode.hpp                        |    77 -
 parser/ParseWindow.hpp                          |   203 -
 parser/ParserModule.hpp                         |    23 -
 parser/ParserUtil.cpp                           |    45 -
 parser/ParserUtil.hpp                           |    50 -
 parser/SqlLexer.lpp                             |   466 -
 parser/SqlParser.ypp                            |  2015 --
 parser/SqlParserWrapper.cpp                     |   153 -
 parser/SqlParserWrapper.hpp                     |   127 -
 parser/preprocessed/SqlLexer_gen.cpp            |  3579 ---
 parser/preprocessed/SqlLexer_gen.hpp            |   368 -
 parser/preprocessed/SqlParser_gen.cpp           |  6118 -----
 parser/preprocessed/SqlParser_gen.hpp           |   311 -
 parser/preprocessed/genfiles.sh                 |     4 -
 parser/tests/Aggregate.test                     |   220 -
 parser/tests/Alter.test                         |    53 -
 parser/tests/CMakeLists.txt                     |    78 -
 parser/tests/Copy.test                          |    57 -
 parser/tests/Create.test                        |   270 -
 parser/tests/Delete.test                        |    50 -
 parser/tests/Drop.test                          |    27 -
 parser/tests/Index.test                         |    81 -
 parser/tests/Insert.test                        |    71 -
 parser/tests/Join.test                          |   162 -
 parser/tests/ParserTest.cpp                     |    86 -
 parser/tests/Select.test                        |  1874 --
 parser/tests/TPCH.test                          |  2301 --
 parser/tests/Update.test                        |    81 -
 query_execution/AdmitRequestMessage.hpp         |    75 -
 query_execution/BlockLocator.cpp                |   226 -
 query_execution/BlockLocator.hpp                |   128 -
 query_execution/BlockLocatorUtil.cpp            |    93 -
 query_execution/BlockLocatorUtil.hpp            |    59 -
 query_execution/CMakeLists.txt                  |   453 -
 query_execution/ForemanBase.hpp                 |   121 -
 query_execution/ForemanDistributed.cpp          |   347 -
 query_execution/ForemanDistributed.hpp          |   120 -
 query_execution/ForemanSingleNode.cpp           |   257 -
 query_execution/ForemanSingleNode.hpp           |   124 -
 query_execution/PolicyEnforcerBase.cpp          |   187 -
 query_execution/PolicyEnforcerBase.hpp          |   208 -
 query_execution/PolicyEnforcerDistributed.cpp   |   266 -
 query_execution/PolicyEnforcerDistributed.hpp   |   113 -
 query_execution/PolicyEnforcerSingleNode.cpp    |   111 -
 query_execution/PolicyEnforcerSingleNode.hpp    |   111 -
 query_execution/QueryContext.cpp                |   266 -
 query_execution/QueryContext.hpp                |   585 -
 query_execution/QueryContext.proto              |    65 -
 query_execution/QueryExecutionMessages.proto    |   162 -
 query_execution/QueryExecutionModule.hpp        |    24 -
 query_execution/QueryExecutionState.hpp         |   329 -
 query_execution/QueryExecutionTypedefs.hpp      |   128 -
 query_execution/QueryExecutionUtil.hpp          |   168 -
 query_execution/QueryManagerBase.cpp            |   228 -
 query_execution/QueryManagerBase.hpp            |   321 -
 query_execution/QueryManagerDistributed.cpp     |   187 -
 query_execution/QueryManagerDistributed.hpp     |   122 -
 query_execution/QueryManagerSingleNode.cpp      |   196 -
 query_execution/QueryManagerSingleNode.hpp      |   142 -
 query_execution/README.md                       |   149 -
 query_execution/Shiftboss.cpp                   |   400 -
 query_execution/Shiftboss.hpp                   |   259 -
 query_execution/ShiftbossDirectory.hpp          |   186 -
 query_execution/WorkOrderProtosContainer.hpp    |   149 -
 query_execution/WorkOrdersContainer.cpp         |   149 -
 query_execution/WorkOrdersContainer.hpp         |   515 -
 query_execution/Worker.cpp                      |   155 -
 query_execution/Worker.hpp                      |   151 -
 query_execution/WorkerDirectory.hpp             |   243 -
 query_execution/WorkerMessage.hpp               |   144 -
 query_execution/WorkerSelectionPolicy.hpp       |   146 -
 query_execution/tests/BlockLocator_unittest.cpp |   230 -
 .../tests/QueryManagerSingleNode_unittest.cpp   |   890 -
 .../tests/WorkOrdersContainer_unittest.cpp      |   870 -
 .../tests/WorkerDirectory_unittest.cpp          |   296 -
 .../tests/WorkerSelectionPolicy_unittest.cpp    |   169 -
 query_optimizer/CMakeLists.txt                  |   263 -
 query_optimizer/ExecutionGenerator.cpp          |  1725 --
 query_optimizer/ExecutionGenerator.hpp          |   442 -
 query_optimizer/LIPFilterGenerator.cpp          |   194 -
 query_optimizer/LIPFilterGenerator.hpp          |   194 -
 query_optimizer/LogicalGenerator.cpp            |    87 -
 query_optimizer/LogicalGenerator.hpp            |    89 -
 query_optimizer/LogicalToPhysicalMapper.hpp     |    68 -
 query_optimizer/Optimizer.cpp                   |    41 -
 query_optimizer/Optimizer.hpp                   |    83 -
 query_optimizer/OptimizerContext.cpp            |    30 -
 query_optimizer/OptimizerContext.hpp            |   104 -
 query_optimizer/OptimizerTree.hpp               |   295 -
 query_optimizer/PhysicalGenerator.cpp           |   156 -
 query_optimizer/PhysicalGenerator.hpp           |   141 -
 query_optimizer/QueryHandle.hpp                 |   163 -
 query_optimizer/QueryOptimizerConfig.h.in       |    20 -
 query_optimizer/QueryOptimizerModule.hpp        |    23 -
 query_optimizer/QueryPlan.hpp                   |   166 -
 query_optimizer/QueryProcessor.cpp              |    79 -
 query_optimizer/QueryProcessor.hpp              |   204 -
 query_optimizer/Validator.hpp                   |    73 -
 query_optimizer/cost_model/CMakeLists.txt       |    81 -
 query_optimizer/cost_model/CostModel.hpp        |    83 -
 query_optimizer/cost_model/CostModelModule.hpp  |    24 -
 query_optimizer/cost_model/SimpleCostModel.cpp  |   150 -
 query_optimizer/cost_model/SimpleCostModel.hpp  |   113 -
 .../cost_model/StarSchemaSimpleCostModel.cpp    |   399 -
 .../cost_model/StarSchemaSimpleCostModel.hpp    |   157 -
 .../expressions/AggregateFunction.cpp           |   125 -
 .../expressions/AggregateFunction.hpp           |   180 -
 query_optimizer/expressions/Alias.cpp           |    94 -
 query_optimizer/expressions/Alias.hpp           |   139 -
 .../expressions/AttributeReference.cpp          |    83 -
 .../expressions/AttributeReference.hpp          |   151 -
 .../expressions/BinaryExpression.cpp            |   120 -
 .../expressions/BinaryExpression.hpp            |   127 -
 query_optimizer/expressions/CMakeLists.txt      |   348 -
 query_optimizer/expressions/Cast.cpp            |    74 -
 query_optimizer/expressions/Cast.hpp            |   121 -
 .../expressions/ComparisonExpression.cpp        |   105 -
 .../expressions/ComparisonExpression.hpp        |   136 -
 query_optimizer/expressions/Exists.cpp          |    57 -
 query_optimizer/expressions/Exists.hpp          |   128 -
 query_optimizer/expressions/ExprId.hpp          |    42 -
 query_optimizer/expressions/Expression.hpp      |    96 -
 query_optimizer/expressions/ExpressionType.hpp  |    62 -
 query_optimizer/expressions/ExpressionUtil.cpp  |    73 -
 query_optimizer/expressions/ExpressionUtil.hpp  |   243 -
 query_optimizer/expressions/InTableQuery.cpp    |    55 -
 query_optimizer/expressions/InTableQuery.hpp    |   145 -
 query_optimizer/expressions/InValueList.cpp     |    74 -
 query_optimizer/expressions/InValueList.hpp     |   159 -
 query_optimizer/expressions/LogicalAnd.cpp      |   125 -
 query_optimizer/expressions/LogicalAnd.hpp      |   128 -
 query_optimizer/expressions/LogicalNot.cpp      |    65 -
 query_optimizer/expressions/LogicalNot.hpp      |   114 -
 query_optimizer/expressions/LogicalOr.cpp       |   123 -
 query_optimizer/expressions/LogicalOr.hpp       |   128 -
 query_optimizer/expressions/NamedExpression.cpp |    59 -
 query_optimizer/expressions/NamedExpression.hpp |   131 -
 .../expressions/OptimizerExpressionsModule.hpp  |    24 -
 query_optimizer/expressions/PatternMatcher.hpp  |   171 -
 query_optimizer/expressions/Predicate.hpp       |    91 -
 .../expressions/PredicateLiteral.cpp            |    64 -
 .../expressions/PredicateLiteral.hpp            |   108 -
 query_optimizer/expressions/Scalar.hpp          |    81 -
 query_optimizer/expressions/ScalarLiteral.cpp   |    74 -
 query_optimizer/expressions/ScalarLiteral.hpp   |   120 -
 query_optimizer/expressions/SearchedCase.cpp    |   166 -
 query_optimizer/expressions/SearchedCase.hpp    |   172 -
 query_optimizer/expressions/SimpleCase.cpp      |   188 -
 query_optimizer/expressions/SimpleCase.hpp      |   187 -
 .../expressions/SubqueryExpression.cpp          |    68 -
 .../expressions/SubqueryExpression.hpp          |   132 -
 query_optimizer/expressions/UnaryExpression.cpp |    72 -
 query_optimizer/expressions/UnaryExpression.hpp |   130 -
 .../expressions/WindowAggregateFunction.cpp     |   194 -
 .../expressions/WindowAggregateFunction.hpp     |   246 -
 query_optimizer/logical/Aggregate.cpp           |   127 -
 query_optimizer/logical/Aggregate.hpp           |   136 -
 query_optimizer/logical/BinaryJoin.cpp          |    61 -
 query_optimizer/logical/BinaryJoin.hpp          |   104 -
 query_optimizer/logical/CMakeLists.txt          |   306 -
 query_optimizer/logical/CopyFrom.cpp            |    56 -
 query_optimizer/logical/CopyFrom.hpp            |   147 -
 query_optimizer/logical/CreateIndex.cpp         |    56 -
 query_optimizer/logical/CreateIndex.hpp         |   148 -
 query_optimizer/logical/CreateTable.cpp         |    56 -
 query_optimizer/logical/CreateTable.hpp         |   141 -
 query_optimizer/logical/DeleteTuples.cpp        |    63 -
 query_optimizer/logical/DeleteTuples.hpp        |   126 -
 query_optimizer/logical/DropTable.cpp           |    48 -
 query_optimizer/logical/DropTable.hpp           |   111 -
 query_optimizer/logical/Filter.cpp              |    83 -
 query_optimizer/logical/Filter.hpp              |   148 -
 query_optimizer/logical/HashJoin.hpp            |   245 -
 query_optimizer/logical/InsertSelection.cpp     |    47 -
 query_optimizer/logical/InsertSelection.hpp     |   122 -
 query_optimizer/logical/InsertTuple.cpp         |    50 -
 query_optimizer/logical/InsertTuple.hpp         |   123 -
 query_optimizer/logical/Join.hpp                |    65 -
 query_optimizer/logical/Logical.hpp             |   139 -
 query_optimizer/logical/LogicalType.hpp         |    64 -
 .../logical/MultiwayCartesianJoin.cpp           |    67 -
 .../logical/MultiwayCartesianJoin.hpp           |   113 -
 query_optimizer/logical/NestedLoopsJoin.hpp     |   154 -
 .../logical/OptimizerLogicalModule.hpp          |    24 -
 query_optimizer/logical/PatternMatcher.hpp      |   144 -
 query_optimizer/logical/Project.cpp             |    91 -
 query_optimizer/logical/Project.hpp             |   122 -
 query_optimizer/logical/Sample.cpp              |    63 -
 query_optimizer/logical/Sample.hpp              |   135 -
 .../logical/SharedSubplanReference.cpp          |    60 -
 .../logical/SharedSubplanReference.hpp          |   138 -
 query_optimizer/logical/Sort.cpp                |    87 -
 query_optimizer/logical/Sort.hpp                |   184 -
 query_optimizer/logical/TableGenerator.hpp      |   183 -
 query_optimizer/logical/TableReference.cpp      |    86 -
 query_optimizer/logical/TableReference.hpp      |   143 -
 query_optimizer/logical/TopLevelPlan.cpp        |    58 -
 query_optimizer/logical/TopLevelPlan.hpp        |   155 -
 query_optimizer/logical/UpdateTable.cpp         |    86 -
 query_optimizer/logical/UpdateTable.hpp         |   145 -
 query_optimizer/logical/WindowAggregate.cpp     |    85 -
 query_optimizer/logical/WindowAggregate.hpp     |   123 -
 query_optimizer/physical/Aggregate.cpp          |   115 -
 query_optimizer/physical/Aggregate.hpp          |   157 -
 query_optimizer/physical/BinaryJoin.cpp         |    54 -
 query_optimizer/physical/BinaryJoin.hpp         |   103 -
 query_optimizer/physical/CMakeLists.txt         |   301 -
 query_optimizer/physical/CopyFrom.cpp           |    54 -
 query_optimizer/physical/CopyFrom.hpp           |   157 -
 query_optimizer/physical/CreateIndex.cpp        |    55 -
 query_optimizer/physical/CreateIndex.hpp        |   156 -
 query_optimizer/physical/CreateTable.cpp        |    56 -
 query_optimizer/physical/CreateTable.hpp        |   148 -
 query_optimizer/physical/DeleteTuples.cpp       |    61 -
 query_optimizer/physical/DeleteTuples.hpp       |   138 -
 query_optimizer/physical/DropTable.cpp          |    45 -
 query_optimizer/physical/DropTable.hpp          |   119 -
 query_optimizer/physical/HashJoin.cpp           |   113 -
 query_optimizer/physical/HashJoin.hpp           |   198 -
 query_optimizer/physical/InsertSelection.cpp    |    47 -
 query_optimizer/physical/InsertSelection.hpp    |   131 -
 query_optimizer/physical/InsertTuple.cpp        |    49 -
 query_optimizer/physical/InsertTuple.hpp        |   138 -
 query_optimizer/physical/Join.hpp               |    88 -
 .../physical/LIPFilterConfiguration.hpp         |   171 -
 query_optimizer/physical/NestedLoopsJoin.cpp    |    91 -
 query_optimizer/physical/NestedLoopsJoin.hpp    |   133 -
 .../physical/OptimizerPhysicalModule.hpp        |    24 -
 query_optimizer/physical/PatternMatcher.hpp     |   133 -
 query_optimizer/physical/Physical.hpp           |   105 -
 query_optimizer/physical/PhysicalType.hpp       |    62 -
 query_optimizer/physical/Sample.cpp             |    64 -
 query_optimizer/physical/Sample.hpp             |   138 -
 query_optimizer/physical/Selection.cpp          |   107 -
 query_optimizer/physical/Selection.hpp          |   162 -
 .../physical/SharedSubplanReference.cpp         |    54 -
 .../physical/SharedSubplanReference.hpp         |   148 -
 query_optimizer/physical/Sort.cpp               |   101 -
 query_optimizer/physical/Sort.hpp               |   192 -
 query_optimizer/physical/TableGenerator.hpp     |   161 -
 query_optimizer/physical/TableReference.cpp     |    56 -
 query_optimizer/physical/TableReference.hpp     |   138 -
 query_optimizer/physical/TopLevelPlan.cpp       |    57 -
 query_optimizer/physical/TopLevelPlan.hpp       |   209 -
 query_optimizer/physical/UpdateTable.cpp        |    77 -
 query_optimizer/physical/UpdateTable.hpp        |   162 -
 query_optimizer/physical/WindowAggregate.cpp    |    66 -
 query_optimizer/physical/WindowAggregate.hpp    |   133 -
 query_optimizer/resolver/CMakeLists.txt         |   140 -
 query_optimizer/resolver/NameResolver.cpp       |   153 -
 query_optimizer/resolver/NameResolver.hpp       |   208 -
 .../resolver/QueryResolverModule.hpp            |    24 -
 query_optimizer/resolver/Resolver.cpp           |  3129 ---
 query_optimizer/resolver/Resolver.hpp           |   694 -
 query_optimizer/rules/AttachLIPFilters.cpp      |   253 -
 query_optimizer/rules/AttachLIPFilters.hpp      |   151 -
 query_optimizer/rules/BottomUpRule.hpp          |   104 -
 query_optimizer/rules/CMakeLists.txt            |   222 -
 query_optimizer/rules/CollapseProject.cpp       |    60 -
 query_optimizer/rules/CollapseProject.hpp       |    58 -
 query_optimizer/rules/GenerateJoins.cpp         |   491 -
 query_optimizer/rules/GenerateJoins.hpp         |    66 -
 query_optimizer/rules/OptimizerRulesModule.hpp  |    24 -
 query_optimizer/rules/PruneColumns.cpp          |    75 -
 query_optimizer/rules/PruneColumns.hpp          |    59 -
 query_optimizer/rules/PushDownFilter.cpp        |   140 -
 query_optimizer/rules/PushDownFilter.hpp        |    60 -
 query_optimizer/rules/PushDownSemiAntiJoin.cpp  |   122 -
 query_optimizer/rules/PushDownSemiAntiJoin.hpp  |    51 -
 query_optimizer/rules/Rule.hpp                  |    91 -
 query_optimizer/rules/RuleHelper.cpp            |   102 -
 query_optimizer/rules/RuleHelper.hpp            |    77 -
 .../StarSchemaHashJoinOrderOptimization.cpp     |   380 -
 .../StarSchemaHashJoinOrderOptimization.hpp     |   190 -
 query_optimizer/rules/SwapProbeBuild.cpp        |    81 -
 query_optimizer/rules/SwapProbeBuild.hpp        |    67 -
 query_optimizer/rules/TopDownRule.hpp           |   106 -
 query_optimizer/rules/UnnestSubqueries.cpp      |   796 -
 query_optimizer/rules/UnnestSubqueries.hpp      |   236 -
 query_optimizer/rules/UpdateExpression.cpp      |    54 -
 query_optimizer/rules/UpdateExpression.hpp      |    70 -
 query_optimizer/rules/tests/CMakeLists.txt      |    95 -
 .../rules/tests/CollapseProject_unittest.cpp    |    98 -
 .../rules/tests/ExpressionRuleTest.hpp          |    85 -
 .../rules/tests/GenerateJoins_unittest.cpp      |   346 -
 query_optimizer/rules/tests/LogicalRuleTest.hpp |    84 -
 .../rules/tests/PhysicalRuleTest.hpp            |    84 -
 .../rules/tests/PruneColumns_unittest.cpp       |   184 -
 .../rules/tests/PushDownFilter_unittest.cpp     |   161 -
 query_optimizer/rules/tests/RuleTest.hpp        |    55 -
 .../rules/tests/UpdateExpression_unittest.cpp   |   105 -
 query_optimizer/strategy/Aggregate.cpp          |    95 -
 query_optimizer/strategy/Aggregate.hpp          |    70 -
 query_optimizer/strategy/CMakeLists.txt         |   142 -
 query_optimizer/strategy/Join.cpp               |   382 -
 query_optimizer/strategy/Join.hpp               |   105 -
 query_optimizer/strategy/OneToOne.cpp           |   228 -
 query_optimizer/strategy/OneToOne.hpp           |    70 -
 .../strategy/OptimizerStrategyModule.hpp        |    24 -
 query_optimizer/strategy/Selection.cpp          |   128 -
 query_optimizer/strategy/Selection.hpp          |    94 -
 query_optimizer/strategy/Strategy.hpp           |    93 -
 .../strategy/tests/Aggregate_unittest.cpp       |   146 -
 query_optimizer/strategy/tests/CMakeLists.txt   |    85 -
 .../strategy/tests/Join_unittest.cpp            |   337 -
 .../strategy/tests/OneToOne_unittest.cpp        |    75 -
 .../strategy/tests/Selection_unittest.cpp       |   180 -
 query_optimizer/strategy/tests/StrategyTest.hpp |   112 -
 query_optimizer/tests/CMakeLists.txt            |   180 -
 .../tests/DistributedExecutionGeneratorTest.cpp |    62 -
 .../DistributedExecutionGeneratorTestRunner.cpp |   202 -
 .../DistributedExecutionGeneratorTestRunner.hpp |   144 -
 .../tests/ExecutionGeneratorTest.cpp            |    61 -
 .../tests/ExecutionGeneratorTestRunner.cpp      |   114 -
 .../tests/ExecutionGeneratorTestRunner.hpp      |   130 -
 query_optimizer/tests/OptimizerTest.cpp         |   281 -
 query_optimizer/tests/OptimizerTest.hpp         |   194 -
 query_optimizer/tests/OptimizerTextTest.cpp     |    73 -
 .../tests/OptimizerTextTestRunner.cpp           |   135 -
 .../tests/OptimizerTextTestRunner.hpp           |    89 -
 query_optimizer/tests/TestDatabaseLoader.cpp    |   196 -
 query_optimizer/tests/TestDatabaseLoader.hpp    |   204 -
 .../tests/execution_generator/CMakeLists.txt    |   156 -
 .../tests/execution_generator/Create.test       |    42 -
 .../tests/execution_generator/Delete.test       |    39 -
 .../tests/execution_generator/Distinct.test     |    72 -
 .../tests/execution_generator/Drop.test         |    23 -
 .../tests/execution_generator/Index.test        |    82 -
 .../tests/execution_generator/Insert.test       |   134 -
 .../tests/execution_generator/Join.test         |   233 -
 .../tests/execution_generator/Select.test       |  1074 -
 .../StringPatternMatching.test                  |   161 -
 .../execution_generator/TableGenerator.test     |   261 -
 .../tests/execution_generator/Update.test       |    38 -
 .../tests/logical_generator/CMakeLists.txt      |    33 -
 .../tests/logical_generator/Create.test         |    48 -
 .../tests/logical_generator/Index.test          |    83 -
 .../tests/logical_generator/Join.test           |   401 -
 .../tests/logical_generator/Select.test         |  1518 --
 .../tests/physical_generator/CMakeLists.txt     |    53 -
 .../tests/physical_generator/Copy.test          |    48 -
 .../tests/physical_generator/Create.test        |   117 -
 .../tests/physical_generator/Delete.test        |    94 -
 .../tests/physical_generator/Drop.test          |    30 -
 .../tests/physical_generator/Index.test         |   144 -
 .../tests/physical_generator/Insert.test        |    58 -
 .../tests/physical_generator/Join.test          |   403 -
 .../tests/physical_generator/Select.test        |  3142 ---
 .../tests/physical_generator/Update.test        |    90 -
 query_optimizer/tests/resolver/Aggregate.test   |   941 -
 query_optimizer/tests/resolver/CMakeLists.txt   |    57 -
 query_optimizer/tests/resolver/Copy.test        |    48 -
 query_optimizer/tests/resolver/Create.test      |   231 -
 query_optimizer/tests/resolver/Delete.test      |    78 -
 query_optimizer/tests/resolver/Drop.test        |    36 -
 query_optimizer/tests/resolver/Index.test       |   130 -
 query_optimizer/tests/resolver/Insert.test      |   155 -
 query_optimizer/tests/resolver/Join.test        |   301 -
 query_optimizer/tests/resolver/Select.test      |  3352 ---
 query_optimizer/tests/resolver/Update.test      |    83 -
 relational_operators/AggregationOperator.cpp    |   108 -
 relational_operators/AggregationOperator.hpp    |   169 -
 relational_operators/BuildHashOperator.cpp      |   178 -
 relational_operators/BuildHashOperator.hpp      |   242 -
 relational_operators/CMakeLists.txt             |   800 -
 relational_operators/CreateIndexOperator.cpp    |    40 -
 relational_operators/CreateIndexOperator.hpp    |   107 -
 relational_operators/CreateTableOperator.cpp    |    43 -
 relational_operators/CreateTableOperator.hpp    |   105 -
 relational_operators/DeleteOperator.cpp         |   160 -
 relational_operators/DeleteOperator.hpp         |   195 -
 .../DestroyAggregationStateOperator.cpp         |    71 -
 .../DestroyAggregationStateOperator.hpp         |   120 -
 relational_operators/DestroyHashOperator.cpp    |    65 -
 relational_operators/DestroyHashOperator.hpp    |   118 -
 relational_operators/DropTableOperator.cpp      |   106 -
 relational_operators/DropTableOperator.hpp      |   149 -
 .../FinalizeAggregationOperator.cpp             |    90 -
 .../FinalizeAggregationOperator.hpp             |   150 -
 relational_operators/HashJoinOperator.cpp       |  1047 -
 relational_operators/HashJoinOperator.hpp       |   805 -
 relational_operators/InsertOperator.cpp         |    77 -
 relational_operators/InsertOperator.hpp         |   148 -
 .../NestedLoopsJoinOperator.cpp                 |   478 -
 .../NestedLoopsJoinOperator.hpp                 |   352 -
 relational_operators/RebuildWorkOrder.hpp       |   129 -
 relational_operators/RelationalOperator.hpp     |   286 -
 .../RelationalOperatorsConfig.h.in              |    20 -
 .../RelationalOperatorsModule.hpp               |    24 -
 relational_operators/SampleOperator.cpp         |   193 -
 relational_operators/SampleOperator.hpp         |   211 -
 relational_operators/SaveBlocksOperator.cpp     |    80 -
 relational_operators/SaveBlocksOperator.hpp     |   150 -
 relational_operators/SelectOperator.cpp         |   284 -
 relational_operators/SelectOperator.hpp         |   429 -
 relational_operators/SortMergeRunOperator.cpp   |   340 -
 relational_operators/SortMergeRunOperator.hpp   |   303 -
 relational_operators/SortMergeRunOperator.proto |    29 -
 .../SortMergeRunOperatorHelpers.cpp             |   426 -
 .../SortMergeRunOperatorHelpers.hpp             |   733 -
 .../SortRunGenerationOperator.cpp               |   138 -
 .../SortRunGenerationOperator.hpp               |   220 -
 relational_operators/TableGeneratorOperator.cpp |    82 -
 relational_operators/TableGeneratorOperator.hpp |   152 -
 relational_operators/TextScanOperator.cpp       |   532 -
 relational_operators/TextScanOperator.hpp       |   342 -
 relational_operators/UpdateOperator.cpp         |   142 -
 relational_operators/UpdateOperator.hpp         |   205 -
 .../WindowAggregationOperator.cpp               |    93 -
 .../WindowAggregationOperator.hpp               |   157 -
 relational_operators/WorkOrder.hpp              |   327 -
 relational_operators/WorkOrder.proto            |   267 -
 relational_operators/WorkOrderFactory.cpp       |   803 -
 relational_operators/WorkOrderFactory.hpp       |   100 -
 .../tests/AggregationOperator_unittest.cpp      |  1843 --
 .../tests/HashJoinOperator_unittest.cpp         |  1298 -
 .../tests/SortMergeRunOperator_unittest.cpp     |  2319 --
 .../SortRunGenerationOperator_unittest.cpp      |   798 -
 .../tests/TextScanOperator_unittest.cpp         |   249 -
 .../tests/text_scan_faulty_golden_output.txt    |     5 -
 .../tests/text_scan_faulty_input.txt            |     4 -
 .../tests/text_scan_golden_output.txt           |    19 -
 relational_operators/tests/text_scan_input.txt  |     6 -
 storage/AggregationOperationState.cpp           |   757 -
 storage/AggregationOperationState.hpp           |   315 -
 storage/AggregationOperationState.proto         |    45 -
 .../BasicColumnStoreTupleStorageSubBlock.cpp    |   863 -
 .../BasicColumnStoreTupleStorageSubBlock.hpp    |   239 -
 storage/BasicColumnStoreValueAccessor.hpp       |   152 -
 storage/BloomFilterIndexSubBlock.cpp            |   281 -
 storage/BloomFilterIndexSubBlock.hpp            |   199 -
 storage/CMakeLists.txt                          |  1765 --
 storage/CSBTreeIndexSubBlock.cpp                |  2408 --
 storage/CSBTreeIndexSubBlock.hpp                |   697 -
 storage/ColumnStoreUtil.cpp                     |   300 -
 storage/ColumnStoreUtil.hpp                     |   236 -
 storage/CompressedBlockBuilder.cpp              |   864 -
 storage/CompressedBlockBuilder.hpp              |   218 -
 ...ompressedColumnStoreTupleStorageSubBlock.cpp |   996 -
 ...ompressedColumnStoreTupleStorageSubBlock.hpp |   224 -
 storage/CompressedColumnStoreValueAccessor.hpp  |   200 -
 ...ressedPackedRowStoreTupleStorageSubBlock.cpp |   712 -
 ...ressedPackedRowStoreTupleStorageSubBlock.hpp |   206 -
 .../CompressedPackedRowStoreValueAccessor.hpp   |   215 -
 storage/CompressedStoreUtil.cpp                 |   616 -
 storage/CompressedStoreUtil.hpp                 |   262 -
 storage/CompressedTupleStorageSubBlock.cpp      |   344 -
 storage/CompressedTupleStorageSubBlock.hpp      |   408 -
 storage/CountedReference.hpp                    |   178 -
 storage/DataExchange.proto                      |    34 -
 storage/DataExchangerAsync.cpp                  |   169 -
 storage/DataExchangerAsync.hpp                  |    98 -
 storage/EvictionPolicy.cpp                      |   499 -
 storage/EvictionPolicy.hpp                      |   217 -
 storage/FastHashTable.hpp                       |  2403 --
 storage/FastHashTableFactory.hpp                |   224 -
 storage/FastSeparateChainingHashTable.hpp       |  1551 --
 storage/FileManager.hpp                         |   148 -
 storage/FileManagerHdfs.cpp                     |   244 -
 storage/FileManagerHdfs.hpp                     |    75 -
 storage/FileManagerLocal.hpp                    |    41 -
 storage/FileManagerPosix.cpp                    |   182 -
 storage/FileManagerPosix.hpp                    |    64 -
 storage/FileManagerWindows.cpp                  |   202 -
 storage/FileManagerWindows.hpp                  |    64 -
 storage/HashTable.hpp                           |  2180 --
 storage/HashTable.proto                         |    37 -
 storage/HashTableBase.hpp                       |   121 -
 storage/HashTableFactory.cpp                    |    70 -
 storage/HashTableFactory.hpp                    |   344 -
 storage/HashTableKeyManager.hpp                 |   516 -
 storage/HashTablePool.hpp                       |   233 -
 storage/IndexSubBlock.hpp                       |   200 -
 storage/IndexSubBlockDescriptionFactory.hpp     |    83 -
 storage/InsertDestination.cpp                   |   800 -
 storage/InsertDestination.hpp                   |   591 -
 storage/InsertDestination.proto                 |    57 -
 storage/InsertDestinationInterface.hpp          |   163 -
 storage/LinearOpenAddressingHashTable.hpp       |  1576 --
 storage/PackedRowStoreTupleStorageSubBlock.cpp  |   491 -
 storage/PackedRowStoreTupleStorageSubBlock.hpp  |   216 -
 storage/PackedRowStoreValueAccessor.hpp         |   150 -
 storage/PartitionedHashTablePool.hpp            |   206 -
 storage/PreloaderThread.cpp                     |   141 -
 storage/PreloaderThread.hpp                     |   112 -
 storage/SMAIndexSubBlock.cpp                    |   707 -
 storage/SMAIndexSubBlock.hpp                    |   458 -
 storage/SeparateChainingHashTable.hpp           |  1524 --
 .../SimpleScalarSeparateChainingHashTable.cpp   |    30 -
 .../SimpleScalarSeparateChainingHashTable.hpp   |  1113 -
 storage/SplitRowStoreTupleStorageSubBlock.cpp   |   931 -
 storage/SplitRowStoreTupleStorageSubBlock.hpp   |   424 -
 storage/SplitRowStoreValueAccessor.hpp          |   363 -
 storage/StorageBlob.hpp                         |   124 -
 storage/StorageBlock.cpp                        |  1411 --
 storage/StorageBlock.hpp                        |   766 -
 storage/StorageBlockBase.hpp                    |   143 -
 storage/StorageBlockInfo.cpp                    |    52 -
 storage/StorageBlockInfo.hpp                    |   157 -
 storage/StorageBlockLayout.cpp                  |   178 -
 storage/StorageBlockLayout.hpp                  |   204 -
 storage/StorageBlockLayout.proto                |   152 -
 storage/StorageConfig.h.in                      |    28 -
 storage/StorageConstants.hpp                    |   129 -
 storage/StorageErrors.cpp                       |    66 -
 storage/StorageErrors.hpp                       |   223 -
 storage/StorageManager.cpp                      |   932 -
 storage/StorageManager.hpp                      |   634 -
 storage/StorageModule.hpp                       |    23 -
 storage/SubBlockTypeRegistry.cpp                |   148 -
 storage/SubBlockTypeRegistry.hpp                |   234 -
 storage/SubBlockTypeRegistryMacros.hpp          |    34 -
 storage/SubBlocksReference.hpp                  |    62 -
 storage/TupleIdSequence.hpp                     |   396 -
 storage/TupleReference.hpp                      |    53 -
 storage/TupleStorageSubBlock.cpp                |   112 -
 storage/TupleStorageSubBlock.hpp                |   534 -
 storage/ValueAccessor.hpp                       |  1046 -
 storage/ValueAccessorUtil.hpp                   |   275 -
 storage/WindowAggregationOperationState.cpp     |   299 -
 storage/WindowAggregationOperationState.hpp     |   134 -
 storage/WindowAggregationOperationState.proto   |    34 -
 .../AggregationOperationState_unittest.cpp      |    72 -
 ...ColumnStoreTupleStorageSubBlock_unittest.cpp |  1166 -
 .../tests/BloomFilterIndexSubBlock_unittest.cpp |   445 -
 storage/tests/CSBTreeIndexSubBlock_unittest.cpp |  1893 --
 storage/tests/CSBTreePrettyPrinter.cpp          |   131 -
 storage/tests/CSBTreePrettyPrinter.hpp          |    60 -
 ...ColumnStoreTupleStorageSubBlock_unittest.cpp |  1645 --
 ...kedRowStoreTupleStorageSubBlock_unittest.cpp |  1363 -
 storage/tests/DataExchange_unittest.cpp         |   198 -
 storage/tests/EvictionPolicy_unittest.cpp       |   203 -
 storage/tests/FileManagerHdfs_unittest.cpp      |    25 -
 storage/tests/FileManagerLocal_unittest.cpp     |    25 -
 storage/tests/FileManager_unittest_common.hpp   |   196 -
 storage/tests/HashTable_unittest_common.hpp     |  2330 --
 .../LinearOpenAddressingHashTable_unittest.cpp  |    25 -
 storage/tests/MockTupleStorageSubBlock.hpp      |   208 -
 ...kedRowStoreTupleStorageSubBlock_unittest.cpp |   584 -
 storage/tests/SMAIndexSubBlock_unittest.cpp     |  1066 -
 .../SeparateChainingHashTable_unittest.cpp      |    25 -
 ...ScalarSeparateChainingHashTable_unittest.cpp |    28 -
 ...litRowStoreTupleStorageSubBlock_unittest.cpp |  1336 -
 storage/tests/StorageBlockSort_unittest.cpp     |   451 -
 storage/tests/StorageManager_unittest.cpp       |   253 -
 storage/tests/StorageTestConfig.h.in            |    20 -
 storage/tests/TupleStorePredicateUtil.hpp       |    71 -
 ...WindowAggregationOperationState_unittest.cpp |    92 -
 third_party/README.md                           |     7 -
 third_party/benchmark/.gitignore                |    39 -
 third_party/benchmark/.travis.yml               |    33 -
 third_party/benchmark/AUTHORS                   |    25 -
 third_party/benchmark/CMakeLists.txt            |    62 -
 third_party/benchmark/CONTRIBUTING.md           |    58 -
 third_party/benchmark/CONTRIBUTORS              |    41 -
 third_party/benchmark/LICENSE                   |   202 -
 third_party/benchmark/README.md                 |   165 -
 .../benchmark/cmake/AddCXXCompilerFlag.cmake    |    38 -
 .../benchmark/cmake/CXXFeatureCheck.cmake       |    39 -
 third_party/benchmark/cmake/GetGitVersion.cmake |    45 -
 third_party/benchmark/cmake/gnu_posix_regex.cpp |    12 -
 third_party/benchmark/cmake/posix_regex.cpp     |    12 -
 third_party/benchmark/cmake/std_regex.cpp       |    10 -
 .../benchmark/include/benchmark/benchmark.h     |   537 -
 .../benchmark/include/benchmark/macros.h        |    44 -
 third_party/benchmark/src/CMakeLists.txt        |    44 -
 third_party/benchmark/src/arraysize.h           |    36 -
 third_party/benchmark/src/benchmark.cc          |  1188 -
 third_party/benchmark/src/check.h               |    57 -
 third_party/benchmark/src/colorprint.cc         |   111 -
 third_party/benchmark/src/colorprint.h          |    19 -
 third_party/benchmark/src/commandlineflags.cc   |   220 -
 third_party/benchmark/src/commandlineflags.h    |    76 -
 third_party/benchmark/src/cycleclock.h          |   134 -
 third_party/benchmark/src/internal_macros.h     |    40 -
 third_party/benchmark/src/log.cc                |    40 -
 third_party/benchmark/src/log.h                 |    28 -
 third_party/benchmark/src/re.h                  |    60 -
 third_party/benchmark/src/re_posix.cc           |    59 -
 third_party/benchmark/src/re_std.cc             |    44 -
 third_party/benchmark/src/sleep.cc              |    46 -
 third_party/benchmark/src/sleep.h               |    17 -
 third_party/benchmark/src/stat.h                |   302 -
 third_party/benchmark/src/string_util.cc        |   164 -
 third_party/benchmark/src/string_util.h         |    40 -
 third_party/benchmark/src/sysinfo.cc            |   354 -
 third_party/benchmark/src/sysinfo.h             |    11 -
 third_party/benchmark/src/walltime.cc           |   191 -
 third_party/benchmark/src/walltime.h            |    22 -
 third_party/benchmark/test/CMakeLists.txt       |    22 -
 third_party/benchmark/test/benchmark_test.cc    |   169 -
 third_party/benchmark/test/filter_test.cc       |    86 -
 third_party/cpplint/cpplint.py                  |  6287 -----
 third_party/cpplint/lint_everything.py          |    23 -
 third_party/farmhash/CMakeLists.txt             |    54 -
 third_party/farmhash/COPYING                    |    19 -
 third_party/farmhash/NEWS                       |    19 -
 third_party/farmhash/README                     |   163 -
 .../farmhash/Understanding_Hash_Functions       |   162 -
 third_party/farmhash/farm-test.cc               |    38 -
 third_party/farmhash/farmhash.cc                | 11854 ---------
 third_party/farmhash/farmhash.h                 |   290 -
 third_party/gflags/.gitattributes               |     3 -
 third_party/gflags/.gitignore                   |    14 -
 third_party/gflags/AUTHORS.txt                  |     2 -
 third_party/gflags/CMakeLists.txt               |   506 -
 third_party/gflags/COPYING.txt                  |    28 -
 third_party/gflags/ChangeLog.txt                |   218 -
 third_party/gflags/INSTALL.md                   |    54 -
 third_party/gflags/README.md                    |   263 -
 third_party/gflags/cmake/README_runtime.txt     |     4 -
 third_party/gflags/cmake/config.cmake.in        |    23 -
 third_party/gflags/cmake/execute_test.cmake     |    53 -
 third_party/gflags/cmake/package.cmake.in       |    49 -
 third_party/gflags/cmake/utils.cmake            |    96 -
 third_party/gflags/cmake/version.cmake.in       |    21 -
 third_party/gflags/doc/designstyle.css          |   115 -
 third_party/gflags/doc/index.html               |   558 -
 third_party/gflags/src/config.h.in              |   112 -
 third_party/gflags/src/gflags.cc                |  1961 --
 third_party/gflags/src/gflags.h.in              |   572 -
 third_party/gflags/src/gflags_completions.cc    |   769 -
 third_party/gflags/src/gflags_completions.h.in  |   121 -
 third_party/gflags/src/gflags_completions.sh    |   117 -
 third_party/gflags/src/gflags_declare.h.in      |   141 -
 third_party/gflags/src/gflags_ns.h.in           |   101 -
 third_party/gflags/src/gflags_reporting.cc      |   442 -
 third_party/gflags/src/mutex.h                  |   351 -
 third_party/gflags/src/util.h                   |   373 -
 third_party/gflags/src/windows_port.cc          |    71 -
 third_party/gflags/src/windows_port.h           |   127 -
 third_party/gflags/test/CMakeLists.txt          |   185 -
 third_party/gflags/test/config_for_unittests.h  |    79 -
 third_party/gflags/test/flagfile.1              |     1 -
 third_party/gflags/test/flagfile.2              |     2 -
 third_party/gflags/test/flagfile.3              |     1 -
 third_party/gflags/test/gflags_declare_flags.cc |     9 -
 third_party/gflags/test/gflags_declare_test.cc  |    12 -
 third_party/gflags/test/gflags_nc.py.in         |    33 -
 .../gflags/test/gflags_strip_flags_test.cc      |    61 -
 .../gflags/test/gflags_strip_flags_test.cmake   |     7 -
 third_party/gflags/test/gflags_unittest.cc      |  1536 --
 .../gflags/test/gflags_unittest_flagfile        |     2 -
 third_party/gflags/test/nc/CMakeLists.txt       |    16 -
 third_party/gflags/test/nc/gflags_nc.cc         |    73 -
 third_party/glog/AUTHORS                        |     2 -
 third_party/glog/CMakeLists.txt                 |   208 -
 third_party/glog/COPYING                        |    65 -
 third_party/glog/ChangeLog                      |    84 -
 third_party/glog/INSTALL                        |   297 -
 third_party/glog/NEWS                           |     0
 third_party/glog/README                         |     5 -
 third_party/glog/README.windows                 |    26 -
 third_party/glog/doc/designstyle.css            |   115 -
 third_party/glog/doc/glog.html                  |   613 -
 third_party/glog/src/base/commandlineflags.h    |   133 -
 third_party/glog/src/base/googleinit.h          |    51 -
 third_party/glog/src/base/mutex.h               |   331 -
 third_party/glog/src/config.h.in                |   171 -
 third_party/glog/src/config_cmake.h.in          |   169 -
 third_party/glog/src/config_for_unittests.h     |    66 -
 third_party/glog/src/demangle.cc                |  1304 -
 third_party/glog/src/demangle.h                 |    84 -
 third_party/glog/src/demangle_unittest.cc       |   142 -
 third_party/glog/src/demangle_unittest.sh       |    95 -
 third_party/glog/src/demangle_unittest.txt      |   137 -
 third_party/glog/src/glog/log_severity.h        |    92 -
 third_party/glog/src/glog/logging.h             |  1619 --
 third_party/glog/src/glog/raw_logging.h         |   191 -
 third_party/glog/src/glog/stl_logging.h         |   183 -
 third_party/glog/src/glog/vlog_is_on.h          |   129 -
 third_party/glog/src/googletest.h               |   604 -
 third_party/glog/src/logging.cc                 |  2049 --
 third_party/glog/src/logging_striplog_test.sh   |    79 -
 third_party/glog/src/logging_striptest10.cc     |    35 -
 third_party/glog/src/logging_striptest2.cc      |    35 -
 third_party/glog/src/logging_striptest_main.cc  |    73 -
 third_party/glog/src/logging_unittest.cc        |  1215 -
 third_party/glog/src/logging_unittest.err       |   305 -
 third_party/glog/src/mock-log.h                 |   155 -
 third_party/glog/src/mock-log_test.cc           |   106 -
 third_party/glog/src/raw_logging.cc             |   172 -
 third_party/glog/src/signalhandler.cc           |   350 -
 third_party/glog/src/signalhandler_unittest.cc  |    97 -
 third_party/glog/src/signalhandler_unittest.sh  |   131 -
 third_party/glog/src/stacktrace.h               |    60 -
 third_party/glog/src/stacktrace_generic-inl.h   |    59 -
 third_party/glog/src/stacktrace_libunwind-inl.h |    87 -
 third_party/glog/src/stacktrace_powerpc-inl.h   |   130 -
 third_party/glog/src/stacktrace_unittest.cc     |   208 -
 third_party/glog/src/stacktrace_x86-inl.h       |   139 -
 third_party/glog/src/stacktrace_x86_64-inl.h    |   109 -
 third_party/glog/src/stl_logging_unittest.cc    |   182 -
 third_party/glog/src/symbolize.cc               |   681 -
 third_party/glog/src/symbolize.h                |   116 -
 third_party/glog/src/symbolize_unittest.cc      |   365 -
 third_party/glog/src/utilities.cc               |   347 -
 third_party/glog/src/utilities.h                |   226 -
 third_party/glog/src/utilities_unittest.cc      |    54 -
 third_party/glog/src/vlog_is_on.cc              |   249 -
 .../glog/src/windows/base/commandlineflags.h    |   133 -
 third_party/glog/src/windows/base/googleinit.h  |    51 -
 third_party/glog/src/windows/base/mutex.h       |   331 -
 third_party/glog/src/windows/config_cmake.h.in  |   142 -
 .../glog/src/windows/glog/log_severity.h        |    96 -
 third_party/glog/src/windows/glog/logging.h     |  1603 --
 third_party/glog/src/windows/glog/raw_logging.h |   189 -
 third_party/glog/src/windows/glog/stl_logging.h |   187 -
 third_party/glog/src/windows/glog/vlog_is_on.h  |   133 -
 third_party/glog/src/windows/logging.cc         |  2050 --
 third_party/glog/src/windows/port.cc            |    66 -
 third_party/glog/src/windows/port.h             |   165 -
 third_party/glog/src/windows/preprocess.sh      |   119 -
 third_party/glog/src/windows/raw_logging.cc     |   172 -
 third_party/glog/src/windows/utilities.cc       |   347 -
 third_party/glog/src/windows/utilities.h        |   226 -
 third_party/glog/src/windows/vlog_is_on.cc      |   249 -
 third_party/googletest                          |     1 -
 third_party/gperftools/AUTHORS                  |     2 -
 third_party/gperftools/COPYING                  |    28 -
 third_party/gperftools/ChangeLog                |   646 -
 third_party/gperftools/INSTALL                  |   561 -
 third_party/gperftools/Makefile.am              |  1425 --
 third_party/gperftools/Makefile.in              |  6533 -----
 third_party/gperftools/NEWS                     |   588 -
 third_party/gperftools/README                   |   265 -
 third_party/gperftools/README_windows.txt       |   118 -
 third_party/gperftools/TODO                     |    47 -
 third_party/gperftools/aclocal.m4               |  1199 -
 third_party/gperftools/compile                  |   347 -
 third_party/gperftools/config.guess             |  1420 --
 third_party/gperftools/config.sub               |  1799 --
 third_party/gperftools/configure                | 21812 -----------------
 third_party/gperftools/configure.ac             |   538 -
 third_party/gperftools/depcomp                  |   791 -
 .../gperftools/doc/cpuprofile-fileformat.html   |   264 -
 third_party/gperftools/doc/cpuprofile.html      |   536 -
 third_party/gperftools/doc/designstyle.css      |   109 -
 third_party/gperftools/doc/heap-example1.png    |   Bin 37619 -> 0 bytes
 third_party/gperftools/doc/heap_checker.html    |   534 -
 third_party/gperftools/doc/heapprofile.html     |   382 -
 third_party/gperftools/doc/index.html           |    20 -
 third_party/gperftools/doc/overview.dot         |    15 -
 third_party/gperftools/doc/overview.gif         |   Bin 6472 -> 0 bytes
 third_party/gperftools/doc/pageheap.dot         |    29 -
 third_party/gperftools/doc/pageheap.gif         |   Bin 15486 -> 0 bytes
 third_party/gperftools/doc/pprof-test-big.gif   |   Bin 111566 -> 0 bytes
 third_party/gperftools/doc/pprof-test.gif       |   Bin 56995 -> 0 bytes
 .../gperftools/doc/pprof-vsnprintf-big.gif      |   Bin 100721 -> 0 bytes
 third_party/gperftools/doc/pprof-vsnprintf.gif  |   Bin 31054 -> 0 bytes
 third_party/gperftools/doc/pprof.1              |   131 -
 third_party/gperftools/doc/pprof.see_also       |    11 -
 .../gperftools/doc/pprof_remote_servers.html    |   260 -
 third_party/gperftools/doc/spanmap.dot          |    22 -
 third_party/gperftools/doc/spanmap.gif          |   Bin 8482 -> 0 bytes
 third_party/gperftools/doc/t-test1.times.txt    |   480 -
 ...alloc-opspercpusec.vs.threads.1024.bytes.png |   Bin 1882 -> 0 bytes
 ...malloc-opspercpusec.vs.threads.128.bytes.png |   Bin 1731 -> 0 bytes
 ...loc-opspercpusec.vs.threads.131072.bytes.png |   Bin 1314 -> 0 bytes
 ...lloc-opspercpusec.vs.threads.16384.bytes.png |   Bin 1815 -> 0 bytes
 ...alloc-opspercpusec.vs.threads.2048.bytes.png |   Bin 1877 -> 0 bytes
 ...malloc-opspercpusec.vs.threads.256.bytes.png |   Bin 1838 -> 0 bytes
 ...lloc-opspercpusec.vs.threads.32768.bytes.png |   Bin 1516 -> 0 bytes
 ...alloc-opspercpusec.vs.threads.4096.bytes.png |   Bin 2005 -> 0 bytes
 ...malloc-opspercpusec.vs.threads.512.bytes.png |   Bin 1683 -> 0 bytes
 ...cmalloc-opspercpusec.vs.threads.64.bytes.png |   Bin 1656 -> 0 bytes
 ...lloc-opspercpusec.vs.threads.65536.bytes.png |   Bin 1498 -> 0 bytes
 ...alloc-opspercpusec.vs.threads.8192.bytes.png |   Bin 1912 -> 0 bytes
 .../tcmalloc-opspersec.vs.size.1.threads.png    |   Bin 1689 -> 0 bytes
 .../tcmalloc-opspersec.vs.size.12.threads.png   |   Bin 2216 -> 0 bytes
 .../tcmalloc-opspersec.vs.size.16.threads.png   |   Bin 2010 -> 0 bytes
 .../tcmalloc-opspersec.vs.size.2.threads.png    |   Bin 2163 -> 0 bytes
 .../tcmalloc-opspersec.vs.size.20.threads.png   |   Bin 2147 -> 0 bytes
 .../tcmalloc-opspersec.vs.size.3.threads.png    |   Bin 2270 -> 0 bytes
 .../tcmalloc-opspersec.vs.size.4.threads.png    |   Bin 2174 -> 0 bytes
 .../tcmalloc-opspersec.vs.size.5.threads.png    |   Bin 1995 -> 0 bytes
 .../tcmalloc-opspersec.vs.size.8.threads.png    |   Bin 2156 -> 0 bytes
 third_party/gperftools/doc/tcmalloc.html        |   765 -
 third_party/gperftools/doc/threadheap.dot       |    21 -
 third_party/gperftools/doc/threadheap.gif       |   Bin 7571 -> 0 bytes
 third_party/gperftools/gperftools.sln           |   207 -
 third_party/gperftools/install-sh               |   527 -
 third_party/gperftools/libtool                  | 10246 --------
 third_party/gperftools/ltmain.sh                |  9661 --------
 third_party/gperftools/m4/ac_have_attribute.m4  |    16 -
 third_party/gperftools/m4/acx_nanosleep.m4      |    35 -
 third_party/gperftools/m4/acx_pthread.m4        |   397 -
 .../gperftools/m4/compiler_characteristics.m4   |    24 -
 third_party/gperftools/m4/install_prefix.m4     |     8 -
 third_party/gperftools/m4/libtool.m4            |  7988 ------
 third_party/gperftools/m4/ltoptions.m4          |   384 -
 third_party/gperftools/m4/ltsugar.m4            |   123 -
 third_party/gperftools/m4/ltversion.m4          |    23 -
 third_party/gperftools/m4/lt~obsolete.m4        |    98 -
 third_party/gperftools/m4/namespaces.m4         |    15 -
 third_party/gperftools/m4/pc_from_ucontext.m4   |    97 -
 .../gperftools/m4/program_invocation_name.m4    |    19 -
 third_party/gperftools/m4/stl_namespace.m4      |    25 -
 third_party/gperftools/missing                  |   215 -
 third_party/gperftools/packages/deb.sh          |    74 -
 third_party/gperftools/packages/deb/README      |     7 -
 third_party/gperftools/packages/deb/changelog   |   208 -
 third_party/gperftools/packages/deb/compat      |     1 -
 third_party/gperftools/packages/deb/control     |    25 -
 third_party/gperftools/packages/deb/copyright   |    38 -
 third_party/gperftools/packages/deb/docs        |    47 -
 .../packages/deb/libgperftools-dev.dirs         |     5 -
 .../packages/deb/libgperftools-dev.install      |    12 -
 .../gperftools/packages/deb/libgperftools0.dirs |     2 -
 .../packages/deb/libgperftools0.install         |     4 -
 .../packages/deb/libgperftools0.manpages        |     1 -
 third_party/gperftools/packages/deb/rules       |   117 -
 third_party/gperftools/packages/rpm.sh          |    86 -
 third_party/gperftools/packages/rpm/rpm.spec    |    77 -
 third_party/gperftools/src/addressmap-inl.h     |   422 -
 .../src/base/arm_instruction_set_select.h       |    79 -
 .../src/base/atomicops-internals-arm-generic.h  |   228 -
 .../src/base/atomicops-internals-arm-v6plus.h   |   330 -
 .../src/base/atomicops-internals-gcc.h          |   203 -
 .../src/base/atomicops-internals-linuxppc.h     |   437 -
 .../src/base/atomicops-internals-macosx.h       |   370 -
 .../src/base/atomicops-internals-mips.h         |   323 -
 .../src/base/atomicops-internals-windows.h      |   457 -
 .../src/base/atomicops-internals-x86.cc         |   112 -
 .../src/base/atomicops-internals-x86.h          |   391 -
 third_party/gperftools/src/base/atomicops.h     |   391 -
 third_party/gperftools/src/base/basictypes.h    |   384 -
 .../gperftools/src/base/commandlineflags.h      |   166 -
 third_party/gperftools/src/base/cycleclock.h    |   173 -
 .../gperftools/src/base/dynamic_annotations.c   |   179 -
 .../gperftools/src/base/dynamic_annotations.h   |   627 -
 .../gperftools/src/base/elf_mem_image.cc        |   434 -
 third_party/gperftools/src/base/elf_mem_image.h |   135 -
 third_party/gperftools/src/base/elfcore.h       |   401 -
 third_party/gperftools/src/base/googleinit.h    |    74 -
 .../gperftools/src/base/linux_syscall_support.h |  2483 --
 third_party/gperftools/src/base/linuxthreads.cc |   707 -
 third_party/gperftools/src/base/linuxthreads.h  |    53 -
 third_party/gperftools/src/base/logging.cc      |   108 -
 third_party/gperftools/src/base/logging.h       |   259 -
 .../gperftools/src/base/low_level_alloc.cc      |   523 -
 .../gperftools/src/base/low_level_alloc.h       |   107 -
 third_party/gperftools/src/base/simple_mutex.h  |   332 -
 third_party/gperftools/src/base/spinlock.cc     |   183 -
 third_party/gperftools/src/base/spinlock.h      |   146 -
 .../gperftools/src/base/spinlock_internal.cc    |   122 -
 .../gperftools/src/base/spinlock_internal.h     |    65 -
 .../gperftools/src/base/spinlock_linux-inl.h    |   104 -
 .../gperftools/src/base/spinlock_posix-inl.h    |    63 -
 .../gperftools/src/base/spinlock_win32-inl.h    |    54 -
 third_party/gperftools/src/base/stl_allocator.h |    98 -
 .../src/base/synchronization_profiling.h        |    51 -
 third_party/gperftools/src/base/sysinfo.cc      |  1153 -
 third_party/gperftools/src/base/sysinfo.h       |   236 -
 .../gperftools/src/base/thread_annotations.h    |   134 -
 third_party/gperftools/src/base/thread_lister.c |    77 -
 third_party/gperftools/src/base/thread_lister.h |    83 -
 third_party/gperftools/src/base/vdso_support.cc |   143 -
 third_party/gperftools/src/base/vdso_support.h  |   132 -
 third_party/gperftools/src/central_freelist.cc  |   387 -
 third_party/gperftools/src/central_freelist.h   |   211 -
 third_party/gperftools/src/common.cc            |   276 -
 third_party/gperftools/src/common.h             |   274 -
 third_party/gperftools/src/config.h.in          |   305 -
 .../gperftools/src/config_for_unittests.h       |    65 -
 third_party/gperftools/src/debugallocation.cc   |  1494 --
 third_party/gperftools/src/getenv_safe.h        |    63 -
 third_party/gperftools/src/getpc.h              |   187 -
 .../gperftools/src/google/heap-checker.h        |    36 -
 .../gperftools/src/google/heap-profiler.h       |    37 -
 .../gperftools/src/google/malloc_extension.h    |    36 -
 .../gperftools/src/google/malloc_extension_c.h  |    37 -
 third_party/gperftools/src/google/malloc_hook.h |    36 -
 .../gperftools/src/google/malloc_hook_c.h       |    37 -
 third_party/gperftools/src/google/profiler.h    |    37 -
 third_party/gperftools/src/google/stacktrace.h  |    36 -
 third_party/gperftools/src/google/tcmalloc.h    |    37 -
 .../gperftools/src/gperftools/heap-checker.h    |   422 -
 .../gperftools/src/gperftools/heap-profiler.h   |   105 -
 .../src/gperftools/malloc_extension.h           |   421 -
 .../src/gperftools/malloc_extension_c.h         |    99 -
 .../gperftools/src/gperftools/malloc_hook.h     |   359 -
 .../gperftools/src/gperftools/malloc_hook_c.h   |   173 -
 .../gperftools/src/gperftools/profiler.h        |   169 -
 .../gperftools/src/gperftools/stacktrace.h      |   117 -
 .../gperftools/src/gperftools/tcmalloc.h.in     |   135 -
 third_party/gperftools/src/heap-checker-bcad.cc |    93 -
 third_party/gperftools/src/heap-checker.cc      |  2388 --
 third_party/gperftools/src/heap-profile-stats.h |    78 -
 .../gperftools/src/heap-profile-table.cc        |   625 -
 third_party/gperftools/src/heap-profile-table.h |   399 -
 third_party/gperftools/src/heap-profiler.cc     |   620 -
 third_party/gperftools/src/internal_logging.cc  |   194 -
 third_party/gperftools/src/internal_logging.h   |   144 -
 third_party/gperftools/src/libc_override.h      |    91 -
 .../gperftools/src/libc_override_gcc_and_weak.h |   107 -
 .../gperftools/src/libc_override_glibc.h        |   149 -
 third_party/gperftools/src/libc_override_osx.h  |   276 -
 .../gperftools/src/libc_override_redefine.h     |    94 -
 third_party/gperftools/src/linked_list.h        |   103 -
 third_party/gperftools/src/malloc_extension.cc  |   378 -
 third_party/gperftools/src/malloc_hook-inl.h    |   247 -
 third_party/gperftools/src/malloc_hook.cc       |   692 -
 .../gperftools/src/malloc_hook_mmap_freebsd.h   |   135 -
 .../gperftools/src/malloc_hook_mmap_linux.h     |   238 -
 third_party/gperftools/src/maybe_threads.cc     |   157 -
 third_party/gperftools/src/maybe_threads.h      |    54 -
 third_party/gperftools/src/memfs_malloc.cc      |   268 -
 third_party/gperftools/src/memory_region_map.cc |   829 -
 third_party/gperftools/src/memory_region_map.h  |   413 -
 third_party/gperftools/src/packed-cache-inl.h   |   239 -
 third_party/gperftools/src/page_heap.cc         |   675 -
 third_party/gperftools/src/page_heap.h          |   316 -
 .../gperftools/src/page_heap_allocator.h        |   114 -
 third_party/gperftools/src/pagemap.h            |   324 -
 third_party/gperftools/src/pprof                |  5504 -----
 third_party/gperftools/src/profile-handler.cc   |   685 -
 third_party/gperftools/src/profile-handler.h    |   149 -
 third_party/gperftools/src/profiledata.cc       |   332 -
 third_party/gperftools/src/profiledata.h        |   184 -
 third_party/gperftools/src/profiler.cc          |   431 -
 third_party/gperftools/src/raw_printer.cc       |    72 -
 third_party/gperftools/src/raw_printer.h        |    90 -
 third_party/gperftools/src/sampler.cc           |   131 -
 third_party/gperftools/src/sampler.h            |   180 -
 third_party/gperftools/src/solaris/libstdc++.la |    51 -
 third_party/gperftools/src/span.cc              |   102 -
 third_party/gperftools/src/span.h               |   102 -
 third_party/gperftools/src/stack_trace_table.cc |   160 -
 third_party/gperftools/src/stack_trace_table.h  |    92 -
 third_party/gperftools/src/stacktrace.cc        |   270 -
 third_party/gperftools/src/stacktrace_arm-inl.h |   148 -
 .../gperftools/src/stacktrace_generic-inl.h     |    84 -
 .../gperftools/src/stacktrace_impl_setup-inl.h  |    94 -
 .../gperftools/src/stacktrace_instrument-inl.h  |   155 -
 .../gperftools/src/stacktrace_libunwind-inl.h   |   150 -
 .../src/stacktrace_powerpc-darwin-inl.h         |   158 -
 .../gperftools/src/stacktrace_powerpc-inl.h     |   176 -
 .../src/stacktrace_powerpc-linux-inl.h          |   231 -
 .../gperftools/src/stacktrace_win32-inl.h       |   107 -
 third_party/gperftools/src/stacktrace_x86-inl.h |   354 -
 third_party/gperftools/src/static_vars.cc       |   125 -
 third_party/gperftools/src/static_vars.h        |   115 -
 third_party/gperftools/src/symbolize.cc         |   285 -
 third_party/gperftools/src/symbolize.h          |    84 -
 third_party/gperftools/src/system-alloc.cc      |   552 -
 third_party/gperftools/src/system-alloc.h       |    92 -
 third_party/gperftools/src/tcmalloc.cc          |  1740 --
 third_party/gperftools/src/tcmalloc.h           |    70 -
 third_party/gperftools/src/tcmalloc_guard.h     |    49 -
 .../gperftools/src/tests/addressmap_unittest.cc |   171 -
 .../gperftools/src/tests/atomicops_unittest.cc  |   162 -
 .../src/tests/current_allocated_bytes_test.cc   |    64 -
 .../src/tests/debugallocation_test.cc           |   332 -
 .../src/tests/debugallocation_test.sh           |    95 -
 .../gperftools/src/tests/frag_unittest.cc       |   133 -
 third_party/gperftools/src/tests/getpc_test.cc  |   123 -
 .../src/tests/heap-checker-death_unittest.sh    |   176 -
 .../src/tests/heap-checker_unittest.cc          |  1526 --
 .../src/tests/heap-checker_unittest.sh          |    89 -
 .../src/tests/heap-profiler_unittest.cc         |   164 -
 .../src/tests/heap-profiler_unittest.sh         |   150 -
 .../tests/large_heap_fragmentation_unittest.cc  |    62 -
 .../src/tests/low_level_alloc_unittest.cc       |   197 -
 .../src/tests/malloc_extension_c_test.c         |   182 -
 .../src/tests/malloc_extension_test.cc          |    98 -
 .../gperftools/src/tests/malloc_hook_test.cc    |   367 -
 .../gperftools/src/tests/markidle_unittest.cc   |   109 -
 .../src/tests/maybe_threads_unittest.sh         |    79 -
 .../gperftools/src/tests/memalign_unittest.cc   |   221 -
 .../gperftools/src/tests/packed-cache_test.cc   |    63 -
 .../gperftools/src/tests/page_heap_test.cc      |   169 -
 .../gperftools/src/tests/pagemap_unittest.cc    |   178 -
 .../src/tests/profile-handler_unittest.cc       |   519 -
 .../src/tests/profiledata_unittest.cc           |   611 -
 .../gperftools/src/tests/profiler_unittest.cc   |   147 -
 .../gperftools/src/tests/profiler_unittest.sh   |   269 -
 .../gperftools/src/tests/raw_printer_test.cc    |    64 -
 .../gperftools/src/tests/realloc_unittest.cc    |   125 -
 .../gperftools/src/tests/sampler_test.cc        |   658 -
 .../gperftools/src/tests/sampling_test.cc       |    83 -
 .../gperftools/src/tests/sampling_test.sh       |    94 -
 .../gperftools/src/tests/simple_compat_test.cc  |    68 -
 .../src/tests/stack_trace_table_test.cc         |   102 -
 .../gperftools/src/tests/stacktrace_unittest.cc |   194 -
 .../src/tests/system-alloc_unittest.cc          |   155 -
 .../src/tests/tcmalloc_large_unittest.cc        |   138 -
 .../gperftools/src/tests/tcmalloc_unittest.cc   |  1409 --
 .../gperftools/src/tests/tcmalloc_unittest.sh   |    76 -
 third_party/gperftools/src/tests/testutil.cc    |   224 -
 third_party/gperftools/src/tests/testutil.h     |    62 -
 .../src/tests/thread_dealloc_unittest.cc        |    84 -
 .../gperftools/src/third_party/valgrind.h       |  3924 ---
 third_party/gperftools/src/thread_cache.cc      |   474 -
 third_party/gperftools/src/thread_cache.h       |   440 -
 third_party/gperftools/src/windows/TODO         |    86 -
 .../gperftools/src/windows/addr2line-pdb.c      |   163 -
 .../gperftools/src/windows/auto_testing_hook.h  |   156 -
 third_party/gperftools/src/windows/config.h     |   310 -
 .../gperftools/src/windows/get_mangled_names.cc |    65 -
 .../src/windows/gperftools/tcmalloc.h           |   125 -
 .../src/windows/gperftools/tcmalloc.h.in        |   125 -
 .../gperftools/src/windows/ia32_modrm_map.cc    |   121 -
 .../gperftools/src/windows/ia32_opcode_map.cc   |  1219 -
 third_party/gperftools/src/windows/mingw.h      |    72 -
 .../gperftools/src/windows/mini_disassembler.cc |   432 -
 .../gperftools/src/windows/mini_disassembler.h  |   198 -
 .../src/windows/mini_disassembler_types.h       |   237 -
 third_party/gperftools/src/windows/nm-pdb.c     |   273 -
 .../src/windows/override_functions.cc           |   123 -
 .../gperftools/src/windows/patch_functions.cc   |  1077 -
 third_party/gperftools/src/windows/port.cc      |   235 -
 third_party/gperftools/src/windows/port.h       |   492 -
 .../gperftools/src/windows/preamble_patcher.cc  |   736 -
 .../gperftools/src/windows/preamble_patcher.h   |   620 -
 .../src/windows/preamble_patcher_test.cc        |   368 -
 .../src/windows/preamble_patcher_with_stub.cc   |   302 -
 .../gperftools/src/windows/shortproc.asm        |   169 -
 .../gperftools/src/windows/system-alloc.cc      |   204 -
 third_party/gperftools/test-driver              |   139 -
 .../addr2line-pdb/addr2line-pdb.vcproj          |   127 -
 .../addressmap_unittest.vcproj                  |   301 -
 .../current_allocated_bytes_test.vcproj         |   156 -
 .../frag_unittest/frag_unittest.vcproj          |   150 -
 .../libtcmalloc_minimal.vcproj                  |   802 -
 .../low_level_alloc_unittest.vcproj             |   373 -
 .../malloc_extension_test.vcproj                |   157 -
 .../malloc_hook_test/malloc_hook_test.vcproj    |   174 -
 .../markidle_unittest/markidle_unittest.vcproj  |   170 -
 .../gperftools/vsprojects/nm-pdb/nm-pdb.vcproj  |   127 -
 .../packed-cache_test/packed-cache_test.vcproj  |   201 -
 .../page_heap_test/page_heap_test.vcproj        |   157 -
 .../pagemap_unittest/pagemap_unittest.vcproj    |   154 -
 .../preamble_patcher_test.vcproj                |   180 -
 .../realloc_unittest/realloc_unittest.vcproj    |   151 -
 .../vsprojects/sampler_test/sampler_test.vcproj |   154 -
 .../stack_trace_table_test.vcproj               |   153 -
 .../system-alloc_unittest.vcproj                |   170 -
 .../tcmalloc_minimal_large_unittest.vcproj      |   150 -
 .../tcmalloc_minimal_unittest.vcproj            |   170 -
 .../thread_dealloc_unittest.vcproj              |   170 -
 .../vsprojects/tmu-static/tmu-static.vcproj     |   903 -
 third_party/iwyu/Darwin.imp                     |    10 -
 third_party/iwyu/README.md                      |   136 -
 third_party/iwyu/iwyu_helper.py                 |   174 -
 third_party/iwyu/sample_iwyu_conf.py            |    38 -
 third_party/linenoise/CMakeLists.txt            |     1 -
 third_party/linenoise/LICENSE                   |    25 -
 third_party/linenoise/README.markdown           |    52 -
 third_party/linenoise/linenoise.c               |  1131 -
 third_party/linenoise/linenoise.h               |    73 -
 third_party/protobuf                            |     1 -
 third_party/protobuf_cmake/CMakeLists.txt       |   275 -
 third_party/protobuf_cmake/config_cmake.h.in    |   156 -
 third_party/re2                                 |     1 -
 third_party/re2_cmake/CMakeLists.txt            |    77 -
 third_party/tmb/.gitignore                      |     4 -
 third_party/tmb/CMakeLists.txt                  |   595 -
 third_party/tmb/README.md                       |     6 -
 third_party/tmb/benchmarks/CMakeLists.txt       |   143 -
 .../tmb/benchmarks/include/tmbbench/affinity.h  |    34 -
 .../tmb/benchmarks/include/tmbbench/bus_setup.h |    52 -
 .../tmb/benchmarks/include/tmbbench/messages.h  |    43 -
 .../include/tmbbench/receiver_thread.h          |    84 -
 .../benchmarks/include/tmbbench/sender_thread.h |    78 -
 .../tmb/benchmarks/include/tmbbench/thread.h    |    65 -
 third_party/tmb/benchmarks/src/affinity.cc      |    61 -
 third_party/tmb/benchmarks/src/bus_setup.cc     |   340 -
 .../tmb/benchmarks/src/oneway_throughput.cc     |   224 -
 .../src/oneway_throughput_distributed.cc        |   186 -
 ...oneway_throughput_distributed_coordinator.cc |   213 -
 .../benchmarks/src/oneway_throughput_numa.cc    |   280 -
 .../tmb/benchmarks/src/receiver_thread.cc       |    80 -
 third_party/tmb/benchmarks/src/reset_bus.cc     |    40 -
 third_party/tmb/benchmarks/src/sender_thread.cc |   100 -
 third_party/tmb/benchmarks/src/thread.cc        |    88 -
 third_party/tmb/cmake/FindGrpc++.cmake          |   114 -
 third_party/tmb/cmake/FindLevelDB.cmake         |    31 -
 third_party/tmb/cmake/FindProtobuf3.cmake       |    40 -
 third_party/tmb/cmake/FindSQLite3.cmake         |    37 -
 third_party/tmb/cmake/FindVoltDB.cmake          |    48 -
 third_party/tmb/cmake/FindZookeeper.cmake       |    31 -
 third_party/tmb/include/tmb/address.h           |   114 -
 .../tmb/include/tmb/cancellation_token.h        |    91 -
 third_party/tmb/include/tmb/id_typedefs.h       |    54 -
 .../tmb/include/tmb/internal/c_string_buffer.h  |    71 -
 .../tmb/include/tmb/internal/cache_info.h       |    42 -
 .../tmb/include/tmb/internal/container_pusher.h |    77 -
 third_party/tmb/include/tmb/internal/crc32.h    |    51 -
 .../tmb/internal/heap_receiver_message_queue.h  |   105 -
 .../tmb/include/tmb/internal/iterator_adapter.h |    91 -
 .../tmb/internal/leveldb_key_comparator.h       |    59 -
 .../tmb/include/tmb/internal/leveldb_keys.h     |   226 -
 .../tmb/internal/lock_free_garbage_collector.h  |   175 -
 .../tmb/include/tmb/internal/lock_free_stack.h  |   117 -
 .../tmb/include/tmb/internal/log_read_status.h  |    46 -
 .../tmb/include/tmb/internal/log_reader_base.h  |    47 -
 .../tmb/include/tmb/internal/log_reader_posix.h |   115 -
 .../tmb/include/tmb/internal/log_reader_stdio.h |   117 -
 .../include/tmb/internal/log_record_header.h    |    38 -
 .../tmb/include/tmb/internal/log_writer_base.h  |    47 -
 .../tmb/include/tmb/internal/log_writer_posix.h |   107 -
 .../tmb/include/tmb/internal/log_writer_stdio.h |    96 -
 .../include/tmb/internal/logging_constants.h    |    47 -
 .../tmb/internal/memory_based_message_bus.h     |   197 -
 .../internal/memory_mirror_cancellation_set.h   |    50 -
 .../tmb/internal/memory_mirror_delete_batch.h   |    59 -
 .../tmb/include/tmb/internal/message_metadata.h |    41 -
 .../tmb/internal/native_transaction_log.h       |   127 -
 .../tmb/internal/net_memory_container_pusher.h  |    72 -
 .../internal/net_message_removal_interface.h    |    65 -
 .../tmb/include/tmb/internal/net_service_impl.h |   101 -
 .../internal/persistent_bus_state_interface.h   |   129 -
 .../tmb/include/tmb/internal/queued_message.h   |   199 -
 third_party/tmb/include/tmb/internal/rcu.h      |   369 -
 .../tmb/include/tmb/internal/shared_bool.h      |   128 -
 .../include/tmb/internal/sqlite_connection.h    |   366 -
 .../tmb/internal/sqlite_connection_pool.h       |    97 -
 .../tmb/include/tmb/internal/threadsafe_set.h   |   126 -
 .../tmb/internal/tree_receiver_message_queue.h  |   131 -
 .../tmb/internal/voltdb_connection_pool.h       |   109 -
 .../tmb/internal/voltdb_procedure_factory.h     |   145 -
 .../tmb/internal/voltdb_procedure_warehouse.h   |   255 -
 .../tmb/include/tmb/internal/zookeeper_format.h |    45 -
 .../tmb/internal/zookeeper_receiver_context.h   |    90 -
 .../tmb/internal/zookeeper_transaction_batch.h  |   113 -
 .../tmb/include/tmb/leveldb_message_bus.h       |   231 -
 .../tmb/include/tmb/memory_mirror_message_bus.h |   184 -
 third_party/tmb/include/tmb/message_bus.h       |   513 -
 third_party/tmb/include/tmb/message_style.h     |   111 -
 .../include/tmb/native_logging_message_bus.h    |    69 -
 .../include/tmb/native_net_client_message_bus.h |   123 -
 third_party/tmb/include/tmb/priority.h          |    68 -
 .../tmb/include/tmb/pure_memory_message_bus.h   |   187 -
 .../tmb/include/tmb/sqlite_message_bus.h        |   234 -
 third_party/tmb/include/tmb/tagged_message.h    |   342 -
 .../tmb/include/tmb/voltdb_message_bus.h        |   233 -
 .../tmb/include/tmb/zookeeper_message_bus.h     |   280 -
 third_party/tmb/src/crc32.cc                    |   110 -
 .../tmb/src/heap_receiver_message_queue.cc      |   192 -
 third_party/tmb/src/java/CancelMessages.java    |    49 -
 third_party/tmb/src/java/ConnectClient.java     |    39 -
 third_party/tmb/src/java/DeleteMessages.java    |    40 -
 .../tmb/src/java/DeleteMessagesUnchecked.java   |    36 -
 third_party/tmb/src/java/DisconnectClient.java  |    47 -
 third_party/tmb/src/java/LoadState.java         |    48 -
 third_party/tmb/src/java/Receive.java           |    66 -
 third_party/tmb/src/java/ReceiveAndDelete.java  |    77 -
 third_party/tmb/src/java/RegisterReceiver.java  |    39 -
 third_party/tmb/src/java/RegisterSender.java    |    39 -
 third_party/tmb/src/java/ResetBus.java          |    45 -
 third_party/tmb/src/java/SendToAny.java         |   119 -
 .../tmb/src/java/SendToExplicitReceivers.java   |   129 -
 .../java/SendToExplicitReceiversUnchecked.java  |    67 -
 .../src/java/SendToSingleExplicitReceiver.java  |    84 -
 .../SendToSingleExplicitReceiverUnchecked.java  |    57 -
 third_party/tmb/src/leveldb_key_comparator.cc   |   192 -
 third_party/tmb/src/leveldb_message_bus.cc      |  1165 -
 third_party/tmb/src/log_reader_posix.cc         |   171 -
 third_party/tmb/src/log_reader_stdio.cc         |   128 -
 third_party/tmb/src/log_writer_posix.cc         |   230 -
 third_party/tmb/src/log_writer_stdio.cc         |   208 -
 third_party/tmb/src/memory_based_message_bus.cc |   319 -
 .../tmb/src/memory_mirror_message_bus.cc        |   490 -
 third_party/tmb/src/message_bus.cc              |    63 -
 .../tmb/src/native_net_client_message_bus.cc    |   299 -
 third_party/tmb/src/native_transaction_log.cc   |   698 -
 third_party/tmb/src/net_service_impl.cc         |   276 -
 third_party/tmb/src/proto/tmb_net.proto         |   131 -
 third_party/tmb/src/pure_memory_message_bus.cc  |   359 -
 third_party/tmb/src/sql/voltdb_schema.sql       |   121 -
 third_party/tmb/src/sqlite_connection.cc        |   518 -
 third_party/tmb/src/sqlite_message_bus.cc       |  1167 -
 third_party/tmb/src/tmb_net_server.cc           |   544 -
 .../tmb/src/tree_receiver_message_queue.cc      |   294 -
 third_party/tmb/src/voltdb_connection_pool.cc   |    59 -
 third_party/tmb/src/voltdb_message_bus.cc       |   672 -
 third_party/tmb/src/voltdb_procedure_factory.cc |   111 -
 third_party/tmb/src/zookeeper_message_bus.cc    |  1792 --
 .../tmb/src/zookeeper_transaction_batch.cc      |   203 -
 .../tests/leveldb_message_bus_async_unittest.cc |    48 -
 .../tmb/tests/leveldb_message_bus_unittest.cc   |    44 -
 ..._mirror_message_bus_with_leveldb_unittest.cc |    55 -
 ...y_mirror_message_bus_with_sqlite_unittest.cc |    55 -
 ...y_mirror_message_bus_with_voltdb_unittest.cc |    57 -
 ...irror_message_bus_with_zookeeper_unittest.cc |    57 -
 .../tmb/tests/message_bus_unittest_common.h     |  2402 --
 ...native_logging_message_bus_async_unittest.cc |    50 -
 .../native_logging_message_bus_unittest.cc      |    50 -
 .../native_net_client_message_bus_unittest.cc   |    53 -
 .../tests/pure_memory_message_bus_unittest.cc   |    35 -
 third_party/tmb/tests/rcu_unittest.cc           |   216 -
 .../tmb/tests/sqlite_message_bus_unittest.cc    |    45 -
 .../tmb/tests/voltdb_message_bus_unittest.cc    |    49 -
 .../tmb/tests/zookeeper_message_bus_unittest.cc |    49 -
 .../tmb/third_party/gflags/.gitattributes       |     3 -
 third_party/tmb/third_party/gflags/.gitignore   |    14 -
 third_party/tmb/third_party/gflags/AUTHORS.txt  |     2 -
 .../tmb/third_party/gflags/CMakeLists.txt       |   506 -
 third_party/tmb/third_party/gflags/COPYING.txt  |    28 -
 .../tmb/third_party/gflags/ChangeLog.txt        |   218 -
 third_party/tmb/third_party/gflags/INSTALL.md   |    54 -
 third_party/tmb/third_party/gflags/README.md    |   263 -
 .../third_party/gflags/cmake/README_runtime.txt |     4 -
 .../third_party/gflags/cmake/config.cmake.in    |    23 -
 .../third_party/gflags/cmake/execute_test.cmake |    53 -
 .../third_party/gflags/cmake/package.cmake.in   |    49 -
 .../tmb/third_party/gflags/cmake/utils.cmake    |    96 -
 .../third_party/gflags/cmake/version.cmake.in   |    21 -
 .../tmb/third_party/gflags/doc/designstyle.css  |   115 -
 .../tmb/third_party/gflags/doc/index.html       |   558 -
 .../tmb/third_party/gflags/src/config.h.in      |   112 -
 .../tmb/third_party/gflags/src/gflags.cc        |  1957 --
 .../tmb/third_party/gflags/src/gflags.h.in      |   572 -
 .../gflags/src/gflags_completions.cc            |   769 -
 .../gflags/src/gflags_completions.h.in          |   121 -
 .../gflags/src/gflags_completions.sh            |   117 -
 .../third_party/gflags/src/gflags_declare.h.in  |   141 -
 .../tmb/third_party/gflags/src/gflags_ns.h.in   |   101 -
 .../third_party/gflags/src/gflags_reporting.cc  |   441 -
 third_party/tmb/third_party/gflags/src/mutex.h  |   351 -
 third_party/tmb/third_party/gflags/src/util.h   |   373 -
 .../tmb/third_party/gflags/src/windows_port.cc  |    71 -
 .../tmb/third_party/gflags/src/windows_port.h   |   127 -
 .../tmb/third_party/gflags/test/CMakeLists.txt  |   185 -
 .../gflags/test/config_for_unittests.h          |    79 -
 .../tmb/third_party/gflags/test/flagfile.1      |     1 -
 .../tmb/third_party/gflags/test/flagfile.2      |     2 -
 .../tmb/third_party/gflags/test/flagfile.3      |     1 -
 .../gflags/test/gflags_declare_flags.cc         |     9 -
 .../gflags/test/gflags_declare_test.cc          |    12 -
 .../tmb/third_party/gflags/test/gflags_nc.py.in |    33 -
 .../gflags/test/gflags_strip_flags_test.cc      |    61 -
 .../gflags/test/gflags_strip_flags_test.cmake   |     7 -
 .../third_party/gflags/test/gflags_unittest.cc  |  1536 --
 .../gflags/test/gflags_unittest_flagfile        |     2 -
 .../third_party/gflags/test/nc/CMakeLists.txt   |    16 -
 .../tmb/third_party/gflags/test/nc/gflags_nc.cc |    73 -
 third_party/tmb/third_party/gtest/CHANGES       |   157 -
 .../tmb/third_party/gtest/CMakeLists.txt        |   252 -
 third_party/tmb/third_party/gtest/CONTRIBUTORS  |    37 -
 third_party/tmb/third_party/gtest/LICENSE       |    28 -
 third_party/tmb/third_party/gtest/Makefile.am   |   306 -
 third_party/tmb/third_party/gtest/README        |   435 -
 third_party/tmb/third_party/gtest/aclocal.m4    |  1198 -
 .../third_party/gtest/build-aux/config.guess    |  1530 --
 .../tmb/third_party/gtest/build-aux/config.h.in |    69 -
 .../tmb/third_party/gtest/build-aux/config.sub  |  1773 --
 .../tmb/third_party/gtest/build-aux/depcomp     |   688 -
 .../tmb/third_party/gtest/build-aux/install-sh  |   527 -
 .../tmb/third_party/gtest/build-aux/ltmain.sh   |  9661 --------
 .../tmb/third_party/gtest/build-aux/missing     |   331 -
 .../gtest/cmake/internal_utils.cmake            |   227 -
 .../tmb/third_party/gtest/codegear/gtest.cbproj |   138 -
 .../third_party/gtest/codegear/gtest.groupproj  |    54 -
 .../tmb/third_party/gtest/codegear/gtest_all.cc |    38 -
 .../third_party/gtest/codegear/gtest_link.cc    |    40 -
 .../gtest/codegear/gtest_main.cbproj            |    82 -
 .../gtest/codegear/gtest_unittest.cbproj        |    88 -
 third_party/tmb/third_party/gtest/configure     | 18222 --------------
 third_party/tmb/third_party/gtest/configure.ac  |    68 -
 .../gtest/fused-src/gtest/gtest-all.cc          |  9592 --------
 .../third_party/gtest/fused-src/gtest/gtest.h   | 20061 ---------------
 .../gtest/fused-src/gtest/gtest_main.cc         |    38 -
 .../gtest/include/gtest/gtest-death-test.h      |   294 -
 .../gtest/include/gtest/gtest-message.h         |   250 -
 .../gtest/include/gtest/gtest-param-test.h      |  1421 --
 .../gtest/include/gtest/gtest-param-test.h.pump |   487 -
 .../gtest/include/gtest/gtest-printers.h        |   855 -
 .../third_party/gtest/include/gtest/gtest-spi.h |   232 -
 .../gtest/include/gtest/gtest-test-part.h       |   179 -
 .../gtest/include/gtest/gtest-typed-test.h      |   259 -
 .../tmb/third_party/gtest/include/gtest/gtest.h |  2291 --
 .../gtest/include/gtest/gtest_pred_impl.h       |   358 -
 .../gtest/include/gtest/gtest_prod.h            |    58 -
 .../gtest/internal/gtest-death-test-internal.h  |   319 -
 .../include/gtest/internal/gtest-filepath.h     |   206 -
 .../include/gtest/internal/gtest-internal.h     |  1158 -
 .../include/gtest/internal/gtest-linked_ptr.h   |   233 -
 .../gtest/internal/gtest-param-util-generated.h |  5143 ----
 .../internal/gtest-param-util-generated.h.pump  |   301 -
 .../include/gtest/internal/gtest-param-util.h   |   619 -
 .../gtest/include/gtest/internal/gtest-port.h   |  1947 --
 .../gtest/include/gtest/internal/gtest-string.h |   167 -
 .../gtest/include/gtest/internal/gtest-tuple.h  |  1012 -
 .../include/gtest/internal/gtest-tuple.h.pump   |   339 -
 .../include/gtest/internal/gtest-type-util.h    |  3331 ---
 .../gtest/internal/gtest-type-util.h.pump       |   297 -
 .../tmb/third_party/gtest/m4/acx_pthread.m4     |   363 -
 third_party/tmb/third_party/gtest/m4/gtest.m4   |    74 -
 third_party/tmb/third_party/gtest/m4/libtool.m4 |  8001 ------
 .../tmb/third_party/gtest/m4/ltoptions.m4       |   384 -
 third_party/tmb/third_party/gtest/m4/ltsugar.m4 |   123 -
 .../tmb/third_party/gtest/m4/ltversion.m4       |    23 -
 .../tmb/third_party/gtest/m4/lt~obsolete.m4     |    98 -
 third_party/tmb/third_party/gtest/make/Makefile |    82 -
 .../tmb/third_party/gtest/msvc/gtest-md.sln     |    45 -
 .../tmb/third_party/gtest/msvc/gtest-md.vcproj  |   126 -
 .../tmb/third_party/gtest/msvc/gtest.sln        |    45 -
 .../tmb/third_party/gtest/msvc/gtest.vcproj     |   126 -
 .../third_party/gtest/msvc/gtest_main-md.vcproj |   129 -
 .../third_party/gtest/msvc/gtest_main.vcproj    |   129 -
 .../gtest/msvc/gtest_prod_test-md.vcproj        |   164 -
 .../gtest/msvc/gtest_prod_test.vcproj           |   164 -
 .../gtest/msvc/gtest_unittest-md.vcproj         |   147 -
 .../gtest/msvc/gtest_unittest.vcproj            |   147 -
 .../third_party/gtest/samples/prime_tables.h    |   123 -
 .../tmb/third_party/gtest/samples/sample1.cc    |    68 -
 .../tmb/third_party/gtest/samples/sample1.h     |    43 -
 .../gtest/samples/sample10_unittest.cc          |   144 -
 .../gtest/samples/sample1_unittest.cc           |   153 -
 .../tmb/third_party/gtest/samples/sample2.cc    |    56 -
 .../tmb/third_party/gtest/samples/sample2.h     |    85 -
 .../gtest/samples/sample2_unittest.cc           |   109 -
 .../tmb/third_party/gtest/samples/sample3-inl.h |   172 -
 .../gtest/samples/sample3_unittest.cc           |   151 -
 .../tmb/third_party/gtest/samples/sample4.cc    |    46 -
 .../tmb/third_party/gtest/samples/sample4.h     |    53 -
 .../gtest/samples/sample4_unittest.cc           |    45 -
 .../gtest/samples/sample5_unittest.cc           |   199 -
 .../gtest/samples/sample6_unittest.cc           |   224 -
 .../gtest/samples/sample7_unittest.cc           |   130 -
 .../gtest/samples/sample8_unittest.cc           |   173 -
 .../gtest/samples/sample9_unittest.cc           |   160 -
 .../gtest/scripts/fuse_gtest_files.py           |   250 -
 .../gtest/scripts/gen_gtest_pred_impl.py        |   730 -
 .../third_party/gtest/scripts/gtest-config.in   |   274 -
 .../tmb/third_party/gtest/scripts/pump.py       |   855 -
 .../tmb/third_party/gtest/scripts/test/Makefile |    59 -
 .../tmb/third_party/gtest/src/gtest-all.cc      |    48 -
 .../third_party/gtest/src/gtest-death-test.cc   |  1344 -
 .../tmb/third_party/gtest/src/gtest-filepath.cc |   382 -
 .../third_party/gtest/src/gtest-internal-inl.h  |  1218 -
 .../tmb/third_party/gtest/src/gtest-port.cc     |   805 -
 .../tmb/third_party/gtest/src/gtest-printers.cc |   363 -
 .../third_party/gtest/src/gtest-test-part.cc    |   110 -
 .../third_party/gtest/src/gtest-typed-test.cc   |   110 -
 third_party/tmb/third_party/gtest/src/gtest.cc  |  5015 ----
 .../tmb/third_party/gtest/src/gtest_main.cc     |    38 -
 .../gtest/test/gtest-death-test_ex_test.cc      |    93 -
 .../gtest/test/gtest-death-test_test.cc         |  1367 --
 .../gtest/test/gtest-filepath_test.cc           |   680 -
 .../gtest/test/gtest-linked_ptr_test.cc         |   154 -
 .../gtest/test/gtest-listener_test.cc           |   310 -
 .../gtest/test/gtest-message_test.cc            |   159 -
 .../gtest/test/gtest-options_test.cc            |   215 -
 .../gtest/test/gtest-param-test2_test.cc        |    65 -
 .../gtest/test/gtest-param-test_test.cc         |   904 -
 .../gtest/test/gtest-param-test_test.h          |    57 -
 .../third_party/gtest/test/gtest-port_test.cc   |  1253 -
 .../gtest/test/gtest-printers_test.cc           |  1566 --
 .../gtest/test/gtest-test-part_test.cc          |   208 -
 .../third_party/gtest/test/gtest-tuple_test.cc  |   320 -
 .../gtest/test/gtest-typed-test2_test.cc        |    45 -
 .../gtest/test/gtest-typed-test_test.cc         |   360 -
 .../gtest/test/gtest-typed-test_test.h          |    66 -
 .../gtest/test/gtest-unittest-api_test.cc       |   341 -
 .../third_party/gtest/test/gtest_all_test.cc    |    47 -
 .../test/gtest_break_on_failure_unittest.py     |   212 -
 .../test/gtest_break_on_failure_unittest_.cc    |    88 -
 .../gtest/test/gtest_catch_exceptions_test.py   |   237 -
 .../gtest/test/gtest_catch_exceptions_test_.cc  |   311 -
 .../third_party/gtest/test/gtest_color_test.py  |   130 -
 .../third_party/gtest/test/gtest_color_test_.cc |    71 -
 .../gtest/test/gtest_env_var_test.py            |   103 -
 .../gtest/test/gtest_env_var_test_.cc           |   126 -
 .../gtest/test/gtest_environment_test.cc        |   192 -
 .../gtest/test/gtest_filter_unittest.py         |   633 -
 .../gtest/test/gtest_filter_unittest_.cc        |   140 -
 .../third_party/gtest/test/gtest_help_test.py   |   172 -
 .../third_party/gtest/test/gtest_help_test_.cc  |    46 -
 .../gtest/test/gtest_list_tests_unittest.py     |   207 -
 .../gtest/test/gtest_list_tests_unittest_.cc    |   157 -
 .../gtest/test/gtest_main_unittest.cc           |    45 -
 .../gtest/test/gtest_no_test_unittest.cc        |    56 -
 .../third_party/gtest/test/gtest_output_test.py |   335 -
 .../gtest/test/gtest_output_test_.cc            |  1034 -
 .../gtest/test/gtest_output_test_golden_lin.txt |   720 -
 .../gtest/test/gtest_pred_impl_unittest.cc      |  2427 --
 .../gtest/test/gtest_premature_exit_test.cc     |   141 -
 .../third_party/gtest/test/gtest_prod_test.cc   |    57 -
 .../third_party/gtest/test/gtest_repeat_test.cc |   253 -
 .../gtest/test/gtest_shuffle_test.py            |   325 -
 .../gtest/test/gtest_shuffle_test_.cc           |   103 -
 .../gtest/test/gtest_sole_header_test.cc        |    57 -
 .../third_party/gtest/test/gtest_stress_test.cc |   256 -
 .../third_party/gtest/test/gtest_test_utils.py  |   320 -
 .../test/gtest_throw_on_failure_ex_test.cc      |    92 -
 .../gtest/test/gtest_throw_on_failure_test.py   |   171 -
 .../gtest/test/gtest_throw_on_failure_test_.cc  |    72 -
 .../gtest/test/gtest_uninitialized_test.py      |    70 -
 .../gtest/test/gtest_uninitialized_test_.cc     |    43 -
 .../third_party/gtest/test/gtest_unittest.cc    |  7415 ------
 .../gtest/test/gtest_xml_outfile1_test_.cc      |    49 -
 .../gtest/test/gtest_xml_outfile2_test_.cc      |    49 -
 .../gtest/test/gtest_xml_outfiles_test.py       |   132 -
 .../gtest/test/gtest_xml_output_unittest.py     |   307 -
 .../gtest/test/gtest_xml_output_unittest_.cc    |   181 -
 .../gtest/test/gtest_xml_test_utils.py          |   194 -
 .../tmb/third_party/gtest/test/production.cc    |    36 -
 .../tmb/third_party/gtest/test/production.h     |    55 -
 .../gtest/xcode/Config/DebugProject.xcconfig    |    30 -
 .../gtest/xcode/Config/FrameworkTarget.xcconfig |    17 -
 .../gtest/xcode/Config/General.xcconfig         |    41 -
 .../gtest/xcode/Config/ReleaseProject.xcconfig  |    32 -
 .../xcode/Config/StaticLibraryTarget.xcconfig   |    18 -
 .../gtest/xcode/Config/TestTarget.xcconfig      |     8 -
 .../gtest/xcode/Resources/Info.plist            |    30 -
 .../xcode/Samples/FrameworkSample/Info.plist    |    28 -
 .../WidgetFramework.xcodeproj/project.pbxproj   |   457 -
 .../xcode/Samples/FrameworkSample/runtests.sh   |    62 -
 .../xcode/Samples/FrameworkSample/widget.cc     |    63 -
 .../xcode/Samples/FrameworkSample/widget.h      |    59 -
 .../Samples/FrameworkSample/widget_test.cc      |    68 -
 .../third_party/gtest/xcode/Scripts/runtests.sh |    65 -
 .../gtest/xcode/Scripts/versiongenerate.py      |   100 -
 .../gtest/xcode/gtest.xcodeproj/project.pbxproj |  1135 -
 threading/CMakeLists.txt                        |   402 -
 threading/ConditionVariable.cpp                 |    26 -
 threading/ConditionVariable.hpp                 |   119 -
 threading/Mutex.cpp                             |    29 -
 threading/Mutex.hpp                             |   177 -
 threading/SharedMutex.hpp                       |   173 -
 threading/SpinMutex.hpp                         |    83 -
 threading/SpinSharedMutex.hpp                   |   172 -
 threading/Thread.cpp                            |    39 -
 threading/Thread.hpp                            |   101 -
 threading/ThreadIDBasedMap.hpp                  |   167 -
 threading/ThreadUtil.hpp                        |   136 -
 threading/ThreadingConfig.h.in                  |    33 -
 threading/ThreadingModule.hpp                   |    24 -
 threading/WinThreadsAPI.hpp                     |    61 -
 threading/cpp11/ConditionVariable.hpp           |    82 -
 threading/cpp11/Mutex.hpp                       |    76 -
 threading/cpp11/SharedMutex.hpp                 |    96 -
 threading/cpp11/Thread.hpp                      |    64 -
 threading/cpp11/cpp14/SharedMutex.hpp           |    70 -
 threading/cpp11/cpp17/SharedMutex.hpp           |    70 -
 threading/posix/ConditionVariable.hpp           |   102 -
 threading/posix/Mutex.hpp                       |   123 -
 threading/posix/SharedMutex.hpp                 |    69 -
 threading/posix/Thread.hpp                      |    67 -
 threading/tests/Mutex_unittest.cpp              |   170 -
 threading/tests/SharedMutex_unittest.cpp        |   171 -
 threading/windows/ConditionVariable.hpp         |    79 -
 threading/windows/Mutex.hpp                     |   118 -
 threading/windows/SharedMutex.hpp               |    73 -
 threading/windows/Thread.hpp                    |    80 -
 transaction/AccessMode.cpp                      |    36 -
 transaction/AccessMode.hpp                      |   214 -
 transaction/CMakeLists.txt                      |   231 -
 transaction/CycleDetector.cpp                   |   122 -
 transaction/CycleDetector.hpp                   |    85 -
 transaction/DeadLockDetector.cpp                |   179 -
 transaction/DeadLockDetector.hpp                |   158 -
 transaction/DirectedGraph.hpp                   |   204 -
 transaction/Lock.hpp                            |   105 -
 transaction/LockManager.cpp                     |   239 -
 transaction/LockManager.hpp                     |   130 -
 transaction/LockRequest.hpp                     |   114 -
 transaction/LockTable.cpp                       |   204 -
 transaction/LockTable.hpp                       |   181 -
 transaction/ResourceId.cpp                      |    76 -
 transaction/ResourceId.hpp                      |   217 -
 transaction/StronglyConnectedComponents.cpp     |   124 -
 transaction/StronglyConnectedComponents.hpp     |   121 -
 transaction/Transaction.hpp                     |   121 -
 transaction/TransactionModule.hpp               |    24 -
 transaction/TransactionTable.cpp                |   142 -
 transaction/TransactionTable.hpp                |   164 -
 transaction/tests/AccessMode_unittest.cpp       |   173 -
 transaction/tests/CycleDetector_unittest.cpp    |   159 -
 transaction/tests/DeadLockDetector_unittest.cpp |    98 -
 transaction/tests/DirectedGraph_unittest.cpp    |   126 -
 transaction/tests/LockRequest_unittest.cpp      |    51 -
 transaction/tests/LockTable_unittest.cpp        |   116 -
 transaction/tests/Lock_unittest.cpp             |    95 -
 transaction/tests/ResourceId_unittest.cpp       |   115 -
 .../StronglyConnectedComponents_unittest.cpp    |   228 -
 transaction/tests/TransactionTable_unittest.cpp |   144 -
 types/CMakeLists.txt                            |   444 -
 types/CharType.cpp                              |   184 -
 types/CharType.hpp                              |   150 -
 types/DateOperatorOverloads.hpp                 |   262 -
 types/DateType.cpp                              |   153 -
 types/DateType.hpp                              |   137 -
 types/DatetimeIntervalType.cpp                  |   154 -
 types/DatetimeIntervalType.hpp                  |   129 -
 types/DatetimeLit.hpp                           |   220 -
 types/DatetimeType.cpp                          |   268 -
 types/DatetimeType.hpp                          |   145 -
 types/DoubleType.cpp                            |   122 -
 types/DoubleType.hpp                            |   135 -
 types/FloatType.cpp                             |   122 -
 types/FloatType.hpp                             |   135 -
 types/IntType.cpp                               |   101 -
 types/IntType.hpp                               |   122 -
 types/IntervalLit.hpp                           |   193 -
 types/IntervalParser.cpp                        |   439 -
 types/IntervalParser.hpp                        |   163 -
 types/LongType.cpp                              |   108 -
 types/LongType.hpp                              |   123 -
 types/NullCoercibilityCheckMacro.hpp            |    46 -
 types/NullType.hpp                              |   119 -
 types/NumericSuperType.hpp                      |    72 -
 types/NumericTypeUnifier.hpp                    |   143 -
 types/README.md                                 |   102 -
 types/Type.cpp                                  |    96 -
 types/Type.hpp                                  |   510 -
 types/Type.proto                                |    57 -
 types/TypeErrors.hpp                            |    82 -
 types/TypeFactory.cpp                           |   182 -
 types/TypeFactory.hpp                           |   150 -
 types/TypeID.cpp                                |    38 -
 types/TypeID.hpp                                |    70 -
 types/TypedValue.cpp                            |   237 -
 types/TypedValue.hpp                            |   956 -
 types/TypedValue.proto                          |    44 -
 types/TypesModule.hpp                           |    24 -
 types/VarCharType.cpp                           |   184 -
 types/VarCharType.hpp                           |   153 -
 types/YearMonthIntervalType.cpp                 |   160 -
 types/YearMonthIntervalType.hpp                 |   128 -
 types/containers/CMakeLists.txt                 |    78 -
 types/containers/ColumnVector.cpp               |    44 -
 types/containers/ColumnVector.hpp               |   571 -
 types/containers/ColumnVectorUtil.hpp           |    57 -
 types/containers/ColumnVectorsValueAccessor.hpp |   318 -
 types/containers/Tuple.hpp                      |   247 -
 types/containers/Tuple.proto                    |    26 -
 .../containers/tests/ColumnVector_unittest.cpp  |   780 -
 types/operations/CMakeLists.txt                 |    44 -
 types/operations/Operation.cpp                  |    30 -
 types/operations/Operation.hpp                  |   122 -
 types/operations/Operation.proto                |    95 -
 .../binary_operations/AddBinaryOperation.cpp    |   418 -
 .../binary_operations/AddBinaryOperation.hpp    |    90 -
 .../ArithmeticBinaryOperation.hpp               |   404 -
 .../ArithmeticBinaryOperators.hpp               |   848 -
 .../binary_operations/BinaryOperation.cpp       |    53 -
 .../binary_operations/BinaryOperation.hpp       |   531 -
 .../BinaryOperationFactory.cpp                  |    93 -
 .../BinaryOperationFactory.hpp                  |    79 -
 .../binary_operations/BinaryOperationID.cpp     |    40 -
 .../binary_operations/BinaryOperationID.hpp     |    62 -
 .../operations/binary_operations/CMakeLists.txt |   241 -
 .../binary_operations/DivideBinaryOperation.cpp |   391 -
 .../binary_operations/DivideBinaryOperation.hpp |    93 -
 .../binary_operations/ModuloBinaryOperation.cpp |   259 -
 .../binary_operations/ModuloBinaryOperation.hpp |    93 -
 .../MultiplyBinaryOperation.cpp                 |   410 -
 .../MultiplyBinaryOperation.hpp                 |    98 -
 .../SubtractBinaryOperation.cpp                 |   459 -
 .../SubtractBinaryOperation.hpp                 |    93 -
 .../tests/AddBinaryOperation_unittest.cpp       |   245 -
 .../tests/BinaryOperationTestUtil.hpp           |   251 -
 .../tests/BinaryOperation_unittest.cpp          |  1267 -
 .../tests/DivideBinaryOperation_unittest.cpp    |   240 -
 .../tests/ModuloBinaryOperation_unittest.cpp    |   219 -
 .../tests/MultiplyBinaryOperation_unittest.cpp  |   209 -
 .../tests/SubtractBinaryOperation_unittest.cpp  |   287 -
 .../comparisons/AsciiStringComparators-inl.hpp  |   591 -
 .../comparisons/AsciiStringComparators.hpp      |   398 -
 .../operations/comparisons/BasicComparison.cpp  |   136 -
 .../operations/comparisons/BasicComparison.hpp  |   523 -
 types/operations/comparisons/CMakeLists.txt     |   221 -
 types/operations/comparisons/Comparison-inl.hpp |   663 -
 types/operations/comparisons/Comparison.cpp     |   181 -
 types/operations/comparisons/Comparison.hpp     |   627 -
 .../comparisons/ComparisonFactory.cpp           |   109 -
 .../comparisons/ComparisonFactory.hpp           |    79 -
 types/operations/comparisons/ComparisonID.cpp   |    50 -
 types/operations/comparisons/ComparisonID.hpp   |    99 -
 types/operations/comparisons/ComparisonUtil.hpp |  1284 -
 .../operations/comparisons/EqualComparison.cpp  |    46 -
 .../operations/comparisons/EqualComparison.hpp  |    71 -
 .../comparisons/GreaterComparison.cpp           |    46 -
 .../comparisons/GreaterComparison.hpp           |    71 -
 .../comparisons/GreaterOrEqualComparison.cpp    |    46 -
 .../comparisons/GreaterOrEqualComparison.hpp    |    70 -
 types/operations/comparisons/LessComparison.cpp |    46 -
 types/operations/comparisons/LessComparison.hpp |    71 -
 .../comparisons/LessOrEqualComparison.cpp       |    46 -
 .../comparisons/LessOrEqualComparison.hpp       |    71 -
 .../comparisons/LiteralComparators-inl.hpp      |   623 -
 .../comparisons/LiteralComparators.hpp          |   351 -
 .../comparisons/NotEqualComparison.cpp          |    46 -
 .../comparisons/NotEqualComparison.hpp          |    71 -
 .../PatternMatchingComparators-inl.hpp          |   345 -
 .../comparisons/PatternMatchingComparators.hpp  |   242 -
 .../comparisons/PatternMatchingComparison.cpp   |   131 -
 .../comparisons/PatternMatchingComparison.hpp   |    77 -
 .../comparisons/tests/Comparison_unittest.cpp   |  1023 -
 .../ArithmeticUnaryOperations.cpp               |   145 -
 .../ArithmeticUnaryOperations.hpp               |    94 -
 .../ArithmeticUnaryOperators.hpp                |   169 -
 .../operations/unary_operations/CMakeLists.txt  |   170 -
 .../unary_operations/DateExtractOperation.cpp   |   542 -
 .../unary_operations/DateExtractOperation.hpp   |   192 -
 .../unary_operations/NumericCastOperation.hpp   |   313 -
 .../unary_operations/SubstringOperation.cpp     |   216 -
 .../unary_operations/SubstringOperation.hpp     |   236 -
 .../unary_operations/UnaryOperation.cpp         |    47 -
 .../unary_operations/UnaryOperation.hpp         |   283 -
 .../unary_operations/UnaryOperationFactory.cpp  |   120 -
 .../unary_operations/UnaryOperationFactory.hpp  |    79 -
 .../unary_operations/UnaryOperationID.cpp       |    32 -
 .../unary_operations/UnaryOperationID.hpp       |    63 -
 .../tests/DateExtractOperation_unittest.cpp     |   229 -
 .../tests/NegateUnaryOperation_unittest.cpp     |   126 -
 .../tests/NumericCastOperation_unittest.cpp     |   123 -
 .../tests/UnaryOperation_unittest.cpp           |   411 -
 types/port/CMakeLists.txt                       |    93 -
 types/port/TypesPortConfig.h.in                 |    27 -
 types/port/gmtime_r.hpp                         |    46 -
 types/port/localtime_r.hpp                      |    46 -
 types/port/strnlen.hpp                          |    53 -
 types/port/tests/timegm_benchmark.cpp           |   165 -
 types/port/tests/timegm_unittest.cpp            |   141 -
 types/port/timegm.cpp                           |   153 -
 types/port/timegm.hpp                           |   127 -
 types/tests/CharType_unittest.cpp               |   253 -
 types/tests/DateType_unittest.cpp               |   151 -
 types/tests/DatetimeIntervalType_unittest.cpp   |   316 -
 types/tests/DatetimeType_unittest.cpp           |   219 -
 types/tests/DoubleType_unittest.cpp             |   247 -
 types/tests/FloatType_unittest.cpp              |   247 -
 types/tests/IntType_unittest.cpp                |   136 -
 types/tests/LongType_unittest.cpp               |   138 -
 types/tests/TypeTest_common.hpp                 |   616 -
 types/tests/Type_unittest.cpp                   |   127 -
 types/tests/TypedValue_unittest.cpp             |  2081 --
 types/tests/VarCharType_unittest.cpp            |   196 -
 types/tests/YearMonthIntervalType_unittest.cpp  |   260 -
 utility/Alignment.hpp                           |   102 -
 utility/BitManipulation.hpp                     |   186 -
 utility/BitVector.hpp                           |  1212 -
 utility/BloomFilter.hpp                         |   406 -
 utility/BloomFilter.proto                       |    32 -
 utility/CMakeLists.txt                          |   500 -
 utility/CalculateInstalledMemory.cpp            |    66 -
 utility/CalculateInstalledMemory.hpp            |    40 -
 utility/Cast.hpp                                |    53 -
 utility/CheckSnprintf.hpp                       |    60 -
 utility/CompositeHash.hpp                       |    52 -
 utility/DAG.hpp                                 |   496 -
 utility/DisjointTreeForest.hpp                  |   152 -
 utility/EqualsAnyConstant.hpp                   |   179 -
 utility/ExecutionDAGVisualizer.cpp              |   233 -
 utility/ExecutionDAGVisualizer.hpp              |   114 -
 utility/Glob.cpp                                |   114 -
 utility/Glob.hpp                                |    54 -
 utility/HashPair.hpp                            |   115 -
 utility/Macros.hpp                              |   105 -
 utility/MemStream.hpp                           |   195 -
 utility/NetworkUtil.cpp                         |    78 -
 utility/NetworkUtil.hpp                         |    42 -
 utility/PlanVisualizer.cpp                      |   198 -
 utility/PlanVisualizer.hpp                      |    99 -
 utility/PrimeNumber.cpp                         |  2133 --
 utility/PrimeNumber.hpp                         |    54 -
 utility/PtrList.hpp                             |   263 -
 utility/PtrMap.hpp                              |   137 -
 utility/PtrVector.hpp                           |   771 -
 utility/ScopedBuffer.hpp                        |   217 -
 utility/ScopedDeleter.hpp                       |    95 -
 utility/ShardedLockManager.hpp                  |   133 -
 utility/SortConfiguration.cpp                   |    83 -
 utility/SortConfiguration.hpp                   |   142 -
 utility/SortConfiguration.proto                 |    32 -
 utility/SqlError.cpp                            |   165 -
 utility/SqlError.hpp                            |   162 -
 utility/StringUtil.cpp                          |   147 -
 utility/StringUtil.hpp                          |   121 -
 utility/TemplateUtil.hpp                        |   167 -
 utility/ThreadSafeQueue.hpp                     |   177 -
 utility/TreeStringSerializable.hpp              |   363 -
 utility/UtilityConfig.h.in                      |    32 -
 utility/UtilityModule.hpp                       |    24 -
 utility/VectorUtil.hpp                          |    53 -
 utility/lip_filter/CMakeLists.txt               |    76 -
 utility/lip_filter/LIPFilter.hpp                |   103 -
 utility/lip_filter/LIPFilter.proto              |    58 -
 utility/lip_filter/LIPFilterAdaptiveProber.hpp  |   243 -
 utility/lip_filter/LIPFilterBuilder.hpp         |   106 -
 utility/lip_filter/LIPFilterDeployment.cpp      |    87 -
 utility/lip_filter/LIPFilterDeployment.hpp      |   111 -
 utility/lip_filter/LIPFilterFactory.cpp         |    74 -
 utility/lip_filter/LIPFilterFactory.hpp         |    69 -
 utility/lip_filter/LIPFilterUtil.hpp            |    79 -
 utility/lip_filter/SingleIdentityHashFilter.hpp |   185 -
 utility/tests/BitVector_unittest.cpp            |  1186 -
 utility/tests/BloomFilter_unittest.cpp          |    92 -
 .../tests/CalculateInstalledMemory_unittest.cpp |    40 -
 utility/tests/DAG_unittest.cpp                  |   565 -
 utility/tests/DisjointTreeForest_unittest.cpp   |    98 -
 utility/tests/EqualsAnyConstant_benchmark.cpp   |   237 -
 utility/tests/EqualsAnyConstant_unittest.cpp    |   166 -
 utility/tests/HashPair_benchmark.cpp            |    49 -
 utility/tests/NetworkUtil_unittest.cpp          |    44 -
 utility/tests/PrimeNumber_unittest.cpp          |   117 -
 utility/tests/ScopedDeleter_unittest.cpp        |   156 -
 utility/tests/SqlError_unittest.cpp             |   148 -
 utility/tests/TemplateUtil_unittest.cpp         |   115 -
 utility/tests/TextBasedTestDriver_unittest.cpp  |   339 -
 utility/tests/ThreadSafeQueue_unittest.cpp      |    57 -
 .../tests/TreeStringSerializable_unittest.cpp   |   375 -
 utility/textbased_test/TextBasedTest.cpp        |    33 -
 utility/textbased_test/TextBasedTest.hpp        |   125 -
 utility/textbased_test/TextBasedTestDriver.cpp  |   317 -
 utility/textbased_test/TextBasedTestDriver.hpp  |   202 -
 utility/textbased_test/TextBasedTestRunner.hpp  |    63 -
 validate_cmakelists.py                          |   519 -
 yarn/CMakeLists.txt                             |    19 -
 1958 files changed, 4 insertions(+), 636064 deletions(-)
----------------------------------------------------------------------



[39/51] [abbrv] [partial] incubator-quickstep git commit: remove c++ files

Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/aggregation/AggregationHandleMax.hpp
----------------------------------------------------------------------
diff --git a/expressions/aggregation/AggregationHandleMax.hpp b/expressions/aggregation/AggregationHandleMax.hpp
deleted file mode 100644
index d851a0c..0000000
--- a/expressions/aggregation/AggregationHandleMax.hpp
+++ /dev/null
@@ -1,251 +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_EXPRESSIONS_AGGREGATION_AGGREGATION_HANDLE_MAX_HPP_
-#define QUICKSTEP_EXPRESSIONS_AGGREGATION_AGGREGATION_HANDLE_MAX_HPP_
-
-#include <cstddef>
-#include <memory>
-#include <utility>
-#include <vector>
-
-#include "catalog/CatalogTypedefs.hpp"
-#include "expressions/aggregation/AggregationConcreteHandle.hpp"
-#include "expressions/aggregation/AggregationHandle.hpp"
-#include "storage/FastHashTable.hpp"
-#include "storage/HashTableBase.hpp"
-#include "threading/SpinMutex.hpp"
-#include "types/Type.hpp"
-#include "types/TypedValue.hpp"
-#include "types/operations/comparisons/Comparison.hpp"
-#include "utility/Macros.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-class ColumnVector;
-class StorageManager;
-class ValueAccessor;
-
-/** \addtogroup Expressions
- *  @{
- */
-
-/**
- * @brief Aggregation state for max.
- */
-class AggregationStateMax : public AggregationState {
- public:
-  /**
-   * @brief Copy constructor (ignores mutex).
-   */
-  AggregationStateMax(const AggregationStateMax &orig) : max_(orig.max_) {}
-
-  /**
-   * @brief Destructor.
-   */
-  ~AggregationStateMax() override{};
-
-  const std::uint8_t* getPayloadAddress() const {
-    return reinterpret_cast<const uint8_t *>(&max_);
-  }
-
- private:
-  friend class AggregationHandleMax;
-
-  explicit AggregationStateMax(const Type &type)
-      : max_(type.getNullableVersion().makeNullValue()) {}
-
-  explicit AggregationStateMax(TypedValue &&value) : max_(std::move(value)) {}
-
-  TypedValue max_;
-  SpinMutex mutex_;
-};
-
-/**
- * @brief An aggregationhandle for max.
- **/
-class AggregationHandleMax : public AggregationConcreteHandle {
- public:
-  ~AggregationHandleMax() override {}
-
-  AggregationState* createInitialState() const override {
-    return new AggregationStateMax(type_);
-  }
-
-  AggregationStateHashTableBase* createGroupByHashTable(
-      const HashTableImplType hash_table_impl,
-      const std::vector<const Type *> &group_by_types,
-      const std::size_t estimated_num_groups,
-      StorageManager *storage_manager) const override;
-
-  /**
-   * @brief Iterate with max aggregation state.
-   */
-  inline void iterateUnaryInl(AggregationStateMax *state,
-                              const TypedValue &value) const {
-    DCHECK(value.isPlausibleInstanceOf(type_.getSignature()));
-    compareAndUpdate(static_cast<AggregationStateMax *>(state), value);
-  }
-
-  inline void iterateUnaryInlFast(const TypedValue &value,
-                                  std::uint8_t *byte_ptr) const {
-    DCHECK(value.isPlausibleInstanceOf(type_.getSignature()));
-    TypedValue *max_ptr = reinterpret_cast<TypedValue *>(byte_ptr);
-    compareAndUpdateFast(max_ptr, value);
-  }
-
-  inline void updateStateUnary(const TypedValue &argument,
-                               std::uint8_t *byte_ptr) const override {
-    if (!block_update_) {
-      iterateUnaryInlFast(argument, byte_ptr);
-    }
-  }
-
-  void blockUpdate() override { block_update_ = true; }
-
-  void allowUpdate() override { block_update_ = false; }
-
-  void initPayload(std::uint8_t *byte_ptr) const override {
-    TypedValue *max_ptr = reinterpret_cast<TypedValue *>(byte_ptr);
-    TypedValue t1 = (type_.getNullableVersion().makeNullValue());
-    *max_ptr = t1;
-  }
-
-  void destroyPayload(std::uint8_t *byte_ptr) const override {
-    TypedValue *max_ptr = reinterpret_cast<TypedValue *>(byte_ptr);
-    if (max_ptr != nullptr) {
-      max_ptr->~TypedValue();
-    }
-  }
-
-  AggregationState* accumulateColumnVectors(
-      const std::vector<std::unique_ptr<ColumnVector>> &column_vectors)
-      const override;
-
-#ifdef QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_SELECTION
-  AggregationState* accumulateValueAccessor(
-      ValueAccessor *accessor,
-      const std::vector<attribute_id> &accessor_ids) const override;
-#endif
-
-  void aggregateValueAccessorIntoHashTable(
-      ValueAccessor *accessor,
-      const std::vector<attribute_id> &argument_ids,
-      const std::vector<attribute_id> &group_by_key_ids,
-      AggregationStateHashTableBase *hash_table) const override;
-
-  void mergeStates(const AggregationState &source,
-                   AggregationState *destination) const override;
-
-  void mergeStatesFast(const std::uint8_t *source,
-                       std::uint8_t *destination) const override;
-
-  TypedValue finalize(const AggregationState &state) const override {
-    return TypedValue(static_cast<const AggregationStateMax &>(state).max_);
-  }
-
-  inline TypedValue finalizeHashTableEntry(
-      const AggregationState &state) const {
-    return TypedValue(static_cast<const AggregationStateMax &>(state).max_);
-  }
-
-  inline TypedValue finalizeHashTableEntryFast(
-      const std::uint8_t *byte_ptr) const {
-    const TypedValue *max_ptr = reinterpret_cast<const TypedValue *>(byte_ptr);
-    return TypedValue(*max_ptr);
-  }
-
-  ColumnVector* finalizeHashTable(
-      const AggregationStateHashTableBase &hash_table,
-      std::vector<std::vector<TypedValue>> *group_by_keys,
-      int index) const override;
-
-  /**
-   * @brief Implementation of
-   *        AggregationHandle::aggregateOnDistinctifyHashTableForSingle()
-   *        for MAX aggregation.
-   */
-  AggregationState* aggregateOnDistinctifyHashTableForSingle(
-      const AggregationStateHashTableBase &distinctify_hash_table)
-      const override;
-
-  /**
-   * @brief Implementation of
-   *        AggregationHandle::aggregateOnDistinctifyHashTableForGroupBy()
-   *        for MAX aggregation.
-   */
-  void aggregateOnDistinctifyHashTableForGroupBy(
-      const AggregationStateHashTableBase &distinctify_hash_table,
-      AggregationStateHashTableBase *aggregation_hash_table,
-      std::size_t index) const override;
-
-  std::size_t getPayloadSize() const override { return sizeof(TypedValue); }
-
- private:
-  friend class AggregateFunctionMax;
-
-  /**
-   * @brief Constructor.
-   *
-   * @param type Type of the data set.
-   **/
-  explicit AggregationHandleMax(const Type &type);
-
-  /**
-   * @brief compare the value with max_ and update it if the value is larger
-   *        than current maximum. NULLs are ignored.
-   *
-   * @param value A TypedValue to compare
-   **/
-  inline void compareAndUpdate(AggregationStateMax *state,
-                               const TypedValue &value) const {
-    // TODO(chasseur): Avoid null-checks when aggregating a non-nullable Type.
-    if (value.isNull()) return;
-
-    SpinMutexLock lock(state->mutex_);
-    if (state->max_.isNull() ||
-        fast_comparator_->compareTypedValues(value, state->max_)) {
-      state->max_ = value;
-    }
-  }
-
-  inline void compareAndUpdateFast(TypedValue *max_ptr,
-                                   const TypedValue &value) const {
-    if (value.isNull()) return;
-    if (max_ptr->isNull() ||
-        fast_comparator_->compareTypedValues(value, *max_ptr)) {
-      *max_ptr = value;
-    }
-  }
-
-  const Type &type_;
-  std::unique_ptr<UncheckedComparator> fast_comparator_;
-
-  bool block_update_;
-
-  DISALLOW_COPY_AND_ASSIGN(AggregationHandleMax);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_EXPRESSIONS_AGGREGATION_AGGREGATION_HANDLE_MAX_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/aggregation/AggregationHandleMin.cpp
----------------------------------------------------------------------
diff --git a/expressions/aggregation/AggregationHandleMin.cpp b/expressions/aggregation/AggregationHandleMin.cpp
deleted file mode 100644
index a07f299..0000000
--- a/expressions/aggregation/AggregationHandleMin.cpp
+++ /dev/null
@@ -1,138 +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 "expressions/aggregation/AggregationHandleMin.hpp"
-
-#include <memory>
-#include <vector>
-
-#include "catalog/CatalogTypedefs.hpp"
-#include "storage/HashTable.hpp"
-#include "storage/HashTableFactory.hpp"
-#include "types/Type.hpp"
-#include "types/TypedValue.hpp"
-#include "types/containers/ColumnVector.hpp"
-#include "types/operations/comparisons/Comparison.hpp"
-#include "types/operations/comparisons/ComparisonFactory.hpp"
-#include "types/operations/comparisons/ComparisonID.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-class StorageManager;
-
-AggregationHandleMin::AggregationHandleMin(const Type &type)
-    : type_(type), block_update_(false) {
-  fast_comparator_.reset(
-      ComparisonFactory::GetComparison(ComparisonID::kLess)
-          .makeUncheckedComparatorForTypes(type, type.getNonNullableVersion()));
-}
-
-AggregationStateHashTableBase* AggregationHandleMin::createGroupByHashTable(
-    const HashTableImplType hash_table_impl,
-    const std::vector<const Type *> &group_by_types,
-    const std::size_t estimated_num_groups,
-    StorageManager *storage_manager) const {
-  return AggregationStateHashTableFactory<AggregationStateMin>::CreateResizable(
-      hash_table_impl, group_by_types, estimated_num_groups, storage_manager);
-}
-
-AggregationState* AggregationHandleMin::accumulateColumnVectors(
-    const std::vector<std::unique_ptr<ColumnVector>> &column_vectors) const {
-  DCHECK_EQ(1u, column_vectors.size())
-      << "Got wrong number of ColumnVectors for MIN: " << column_vectors.size();
-
-  return new AggregationStateMin(fast_comparator_->accumulateColumnVector(
-      type_.getNullableVersion().makeNullValue(), *column_vectors.front()));
-}
-
-#ifdef QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_SELECTION
-AggregationState* AggregationHandleMin::accumulateValueAccessor(
-    ValueAccessor *accessor,
-    const std::vector<attribute_id> &accessor_ids) const {
-  DCHECK_EQ(1u, accessor_ids.size())
-      << "Got wrong number of attributes for MIN: " << accessor_ids.size();
-
-  return new AggregationStateMin(fast_comparator_->accumulateValueAccessor(
-      type_.getNullableVersion().makeNullValue(),
-      accessor,
-      accessor_ids.front()));
-}
-#endif  // QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_SELECTION
-
-void AggregationHandleMin::aggregateValueAccessorIntoHashTable(
-    ValueAccessor *accessor,
-    const std::vector<attribute_id> &argument_ids,
-    const std::vector<attribute_id> &group_by_key_ids,
-    AggregationStateHashTableBase *hash_table) const {
-  DCHECK_EQ(1u, argument_ids.size())
-      << "Got wrong number of arguments for MIN: " << argument_ids.size();
-}
-
-void AggregationHandleMin::mergeStates(const AggregationState &source,
-                                       AggregationState *destination) const {
-  const AggregationStateMin &min_source =
-      static_cast<const AggregationStateMin &>(source);
-  AggregationStateMin *min_destination =
-      static_cast<AggregationStateMin *>(destination);
-
-  if (!min_source.min_.isNull()) {
-    compareAndUpdate(min_destination, min_source.min_);
-  }
-}
-
-void AggregationHandleMin::mergeStatesFast(const std::uint8_t *source,
-                                           std::uint8_t *destination) const {
-  const TypedValue *src_min_ptr = reinterpret_cast<const TypedValue *>(source);
-  TypedValue *dst_min_ptr = reinterpret_cast<TypedValue *>(destination);
-
-  if (!(src_min_ptr->isNull())) {
-    compareAndUpdateFast(dst_min_ptr, *src_min_ptr);
-  }
-}
-
-ColumnVector* AggregationHandleMin::finalizeHashTable(
-    const AggregationStateHashTableBase &hash_table,
-    std::vector<std::vector<TypedValue>> *group_by_keys,
-    int index) const {
-  return finalizeHashTableHelperFast<AggregationHandleMin,
-                                     AggregationStateFastHashTable>(
-      type_.getNonNullableVersion(), hash_table, group_by_keys, index);
-}
-
-AggregationState*
-AggregationHandleMin::aggregateOnDistinctifyHashTableForSingle(
-    const AggregationStateHashTableBase &distinctify_hash_table) const {
-  return aggregateOnDistinctifyHashTableForSingleUnaryHelperFast<
-      AggregationHandleMin,
-      AggregationStateMin>(distinctify_hash_table);
-}
-
-void AggregationHandleMin::aggregateOnDistinctifyHashTableForGroupBy(
-    const AggregationStateHashTableBase &distinctify_hash_table,
-    AggregationStateHashTableBase *aggregation_hash_table,
-    std::size_t index) const {
-  aggregateOnDistinctifyHashTableForGroupByUnaryHelperFast<
-      AggregationHandleMin,
-      AggregationStateFastHashTable>(
-      distinctify_hash_table, aggregation_hash_table, index);
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/aggregation/AggregationHandleMin.hpp
----------------------------------------------------------------------
diff --git a/expressions/aggregation/AggregationHandleMin.hpp b/expressions/aggregation/AggregationHandleMin.hpp
deleted file mode 100644
index e3472ec..0000000
--- a/expressions/aggregation/AggregationHandleMin.hpp
+++ /dev/null
@@ -1,252 +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_EXPRESSIONS_AGGREGATION_AGGREGATION_HANDLE_MIN_HPP_
-#define QUICKSTEP_EXPRESSIONS_AGGREGATION_AGGREGATION_HANDLE_MIN_HPP_
-
-#include <cstddef>
-#include <memory>
-#include <utility>
-#include <vector>
-
-#include "catalog/CatalogTypedefs.hpp"
-#include "expressions/aggregation/AggregationConcreteHandle.hpp"
-#include "expressions/aggregation/AggregationHandle.hpp"
-#include "storage/FastHashTable.hpp"
-#include "storage/HashTableBase.hpp"
-#include "threading/SpinMutex.hpp"
-#include "types/Type.hpp"
-#include "types/TypedValue.hpp"
-#include "types/operations/comparisons/Comparison.hpp"
-#include "utility/Macros.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-class ColumnVector;
-class StorageManager;
-class ValueAccessor;
-
-/** \addtogroup Expressions
- *  @{
- */
-
-/**
- * @brief Aggregation state for min.
- */
-class AggregationStateMin : public AggregationState {
- public:
-  /**
-   * @brief Copy constructor (ignores mutex).
-   */
-  AggregationStateMin(const AggregationStateMin &orig) : min_(orig.min_) {}
-
-  /**
-   * @brief Destructor.
-   */
-  ~AggregationStateMin() override {}
-
-  std::size_t getPayloadSize() const { return sizeof(TypedValue); }
-
-  const std::uint8_t *getPayloadAddress() const {
-    return reinterpret_cast<const uint8_t *>(&min_);
-  }
-
- private:
-  friend class AggregationHandleMin;
-
-  explicit AggregationStateMin(const Type &type)
-      : min_(type.getNullableVersion().makeNullValue()) {}
-
-  explicit AggregationStateMin(TypedValue &&value) : min_(std::move(value)) {}
-
-  TypedValue min_;
-  SpinMutex mutex_;
-};
-
-/**
- * @brief An aggregationhandle for min.
- **/
-class AggregationHandleMin : public AggregationConcreteHandle {
- public:
-  ~AggregationHandleMin() override {}
-
-  AggregationState* createInitialState() const override {
-    return new AggregationStateMin(type_);
-  }
-
-  AggregationStateHashTableBase* createGroupByHashTable(
-      const HashTableImplType hash_table_impl,
-      const std::vector<const Type *> &group_by_types,
-      const std::size_t estimated_num_groups,
-      StorageManager *storage_manager) const override;
-
-  /**
-   * @brief Iterate with min aggregation state.
-   */
-  inline void iterateUnaryInl(AggregationStateMin *state,
-                              const TypedValue &value) const {
-    DCHECK(value.isPlausibleInstanceOf(type_.getSignature()));
-    compareAndUpdate(state, value);
-  }
-
-  inline void iterateUnaryInlFast(const TypedValue &value,
-                                  std::uint8_t *byte_ptr) const {
-    DCHECK(value.isPlausibleInstanceOf(type_.getSignature()));
-    TypedValue *min_ptr = reinterpret_cast<TypedValue *>(byte_ptr);
-    compareAndUpdateFast(min_ptr, value);
-  }
-
-  inline void updateStateUnary(const TypedValue &argument,
-                               std::uint8_t *byte_ptr) const override {
-    if (!block_update_) {
-      iterateUnaryInlFast(argument, byte_ptr);
-    }
-  }
-
-  void blockUpdate() override { block_update_ = true; }
-
-  void allowUpdate() override { block_update_ = false; }
-
-  void initPayload(std::uint8_t *byte_ptr) const override {
-    TypedValue *min_ptr = reinterpret_cast<TypedValue *>(byte_ptr);
-    TypedValue t1 = (type_.getNullableVersion().makeNullValue());
-    *min_ptr = t1;
-  }
-
-  void destroyPayload(std::uint8_t *byte_ptr) const override {
-    TypedValue *min_ptr = reinterpret_cast<TypedValue *>(byte_ptr);
-    if (min_ptr != nullptr) {
-      min_ptr->~TypedValue();
-    }
-  }
-
-  AggregationState* accumulateColumnVectors(
-      const std::vector<std::unique_ptr<ColumnVector>> &column_vectors)
-      const override;
-
-#ifdef QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_SELECTION
-  AggregationState* accumulateValueAccessor(
-      ValueAccessor *accessor,
-      const std::vector<attribute_id> &accessor_ids) const override;
-#endif
-
-  void aggregateValueAccessorIntoHashTable(
-      ValueAccessor *accessor,
-      const std::vector<attribute_id> &argument_ids,
-      const std::vector<attribute_id> &group_by_key_ids,
-      AggregationStateHashTableBase *hash_table) const override;
-
-  void mergeStates(const AggregationState &source,
-                   AggregationState *destination) const override;
-
-  void mergeStatesFast(const std::uint8_t *source,
-                       std::uint8_t *destination) const override;
-
-  TypedValue finalize(const AggregationState &state) const override {
-    return static_cast<const AggregationStateMin &>(state).min_;
-  }
-
-  inline TypedValue finalizeHashTableEntry(
-      const AggregationState &state) const {
-    return static_cast<const AggregationStateMin &>(state).min_;
-  }
-
-  inline TypedValue finalizeHashTableEntryFast(
-      const std::uint8_t *byte_ptr) const {
-    const TypedValue *min_ptr = reinterpret_cast<const TypedValue *>(byte_ptr);
-    return TypedValue(*min_ptr);
-  }
-
-  ColumnVector* finalizeHashTable(
-      const AggregationStateHashTableBase &hash_table,
-      std::vector<std::vector<TypedValue>> *group_by_keys,
-      int index) const override;
-
-  /**
-   * @brief Implementation of
-   * AggregationHandle::aggregateOnDistinctifyHashTableForSingle()
-   *        for MIN aggregation.
-   */
-  AggregationState* aggregateOnDistinctifyHashTableForSingle(
-      const AggregationStateHashTableBase &distinctify_hash_table)
-      const override;
-
-  /**
-   * @brief Implementation of
-   *        AggregationHandle::aggregateOnDistinctifyHashTableForGroupBy()
-   *        for MIN aggregation.
-   */
-  void aggregateOnDistinctifyHashTableForGroupBy(
-      const AggregationStateHashTableBase &distinctify_hash_table,
-      AggregationStateHashTableBase *aggregation_hash_table,
-      std::size_t index) const override;
-
-  std::size_t getPayloadSize() const override { return sizeof(TypedValue); }
-
- private:
-  friend class AggregateFunctionMin;
-
-  /**
-   * @brief Constructor.
-   *
-   * @param type Type of the data set.
-   **/
-  explicit AggregationHandleMin(const Type &type);
-
-  /**
-   * @brief compare the value with min_ and update it if the value is smaller
-   *        than current minimum. NULLs are ignored.
-   *
-   * @param value A TypedValue to compare.
-   **/
-  inline void compareAndUpdate(AggregationStateMin *state,
-                               const TypedValue &value) const {
-    if (value.isNull()) return;
-
-    SpinMutexLock lock(state->mutex_);
-    if (state->min_.isNull() ||
-        fast_comparator_->compareTypedValues(value, state->min_)) {
-      state->min_ = value;
-    }
-  }
-
-  inline void compareAndUpdateFast(TypedValue *min_ptr,
-                                   const TypedValue &value) const {
-    if (value.isNull()) return;
-    if (min_ptr->isNull() ||
-        fast_comparator_->compareTypedValues(value, *min_ptr)) {
-      *min_ptr = value;
-    }
-  }
-
-  const Type &type_;
-  std::unique_ptr<UncheckedComparator> fast_comparator_;
-
-  bool block_update_;
-
-  DISALLOW_COPY_AND_ASSIGN(AggregationHandleMin);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_EXPRESSIONS_AGGREGATION_AGGREGATION_HANDLE_MIN_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/aggregation/AggregationHandleSum.cpp
----------------------------------------------------------------------
diff --git a/expressions/aggregation/AggregationHandleSum.cpp b/expressions/aggregation/AggregationHandleSum.cpp
deleted file mode 100644
index 642d88d..0000000
--- a/expressions/aggregation/AggregationHandleSum.cpp
+++ /dev/null
@@ -1,190 +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 "expressions/aggregation/AggregationHandleSum.hpp"
-
-#include <cstddef>
-#include <memory>
-#include <utility>
-#include <vector>
-
-#include "catalog/CatalogTypedefs.hpp"
-#include "storage/HashTable.hpp"
-#include "storage/HashTableFactory.hpp"
-#include "threading/SpinMutex.hpp"
-#include "types/Type.hpp"
-#include "types/TypeFactory.hpp"
-#include "types/TypeID.hpp"
-#include "types/TypedValue.hpp"
-#include "types/operations/binary_operations/BinaryOperation.hpp"
-#include "types/operations/binary_operations/BinaryOperationFactory.hpp"
-#include "types/operations/binary_operations/BinaryOperationID.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-class StorageManager;
-
-AggregationHandleSum::AggregationHandleSum(const Type &type)
-    : argument_type_(type), block_update_(false) {
-  // We sum Int as Long and Float as Double so that we have more headroom when
-  // adding many values.
-  TypeID type_precision_id;
-  switch (argument_type_.getTypeID()) {
-    case kInt:
-    case kLong:
-      type_precision_id = kLong;
-      break;
-    case kFloat:
-    case kDouble:
-      type_precision_id = kDouble;
-      break;
-    default:
-      type_precision_id = type.getTypeID();
-      break;
-  }
-
-  const Type &sum_type = TypeFactory::GetType(type_precision_id);
-  blank_state_.sum_ = sum_type.makeZeroValue();
-
-  // Make operators to do arithmetic:
-  // Add operator for summing argument values.
-  fast_operator_.reset(
-      BinaryOperationFactory::GetBinaryOperation(BinaryOperationID::kAdd)
-          .makeUncheckedBinaryOperatorForTypes(sum_type, argument_type_));
-  // Add operator for merging states.
-  merge_operator_.reset(
-      BinaryOperationFactory::GetBinaryOperation(BinaryOperationID::kAdd)
-          .makeUncheckedBinaryOperatorForTypes(sum_type, sum_type));
-
-  // Result is nullable, because SUM() over 0 values (or all NULL values) is
-  // NULL.
-  result_type_ = &sum_type.getNullableVersion();
-}
-
-AggregationStateHashTableBase* AggregationHandleSum::createGroupByHashTable(
-    const HashTableImplType hash_table_impl,
-    const std::vector<const Type *> &group_by_types,
-    const std::size_t estimated_num_groups,
-    StorageManager *storage_manager) const {
-  return AggregationStateHashTableFactory<AggregationStateSum>::CreateResizable(
-      hash_table_impl, group_by_types, estimated_num_groups, storage_manager);
-}
-
-AggregationState* AggregationHandleSum::accumulateColumnVectors(
-    const std::vector<std::unique_ptr<ColumnVector>> &column_vectors) const {
-  DCHECK_EQ(1u, column_vectors.size())
-      << "Got wrong number of ColumnVectors for SUM: " << column_vectors.size();
-  std::size_t num_tuples = 0;
-  TypedValue cv_sum = fast_operator_->accumulateColumnVector(
-      blank_state_.sum_, *column_vectors.front(), &num_tuples);
-  return new AggregationStateSum(std::move(cv_sum), num_tuples == 0);
-}
-
-#ifdef QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_SELECTION
-AggregationState* AggregationHandleSum::accumulateValueAccessor(
-    ValueAccessor *accessor,
-    const std::vector<attribute_id> &accessor_ids) const {
-  DCHECK_EQ(1u, accessor_ids.size())
-      << "Got wrong number of attributes for SUM: " << accessor_ids.size();
-
-  std::size_t num_tuples = 0;
-  TypedValue va_sum = fast_operator_->accumulateValueAccessor(
-      blank_state_.sum_, accessor, accessor_ids.front(), &num_tuples);
-  return new AggregationStateSum(std::move(va_sum), num_tuples == 0);
-}
-#endif
-
-void AggregationHandleSum::aggregateValueAccessorIntoHashTable(
-    ValueAccessor *accessor,
-    const std::vector<attribute_id> &argument_ids,
-    const std::vector<attribute_id> &group_by_key_ids,
-    AggregationStateHashTableBase *hash_table) const {
-  DCHECK_EQ(1u, argument_ids.size())
-      << "Got wrong number of arguments for SUM: " << argument_ids.size();
-}
-
-void AggregationHandleSum::mergeStates(const AggregationState &source,
-                                       AggregationState *destination) const {
-  const AggregationStateSum &sum_source =
-      static_cast<const AggregationStateSum &>(source);
-  AggregationStateSum *sum_destination =
-      static_cast<AggregationStateSum *>(destination);
-
-  SpinMutexLock lock(sum_destination->mutex_);
-  sum_destination->sum_ = merge_operator_->applyToTypedValues(
-      sum_destination->sum_, sum_source.sum_);
-  sum_destination->null_ = sum_destination->null_ && sum_source.null_;
-}
-
-void AggregationHandleSum::mergeStatesFast(const std::uint8_t *source,
-                                           std::uint8_t *destination) const {
-  const TypedValue *src_sum_ptr =
-      reinterpret_cast<const TypedValue *>(source + blank_state_.sum_offset_);
-  const bool *src_null_ptr =
-      reinterpret_cast<const bool *>(source + blank_state_.null_offset_);
-  TypedValue *dst_sum_ptr =
-      reinterpret_cast<TypedValue *>(destination + blank_state_.sum_offset_);
-  bool *dst_null_ptr =
-      reinterpret_cast<bool *>(destination + blank_state_.null_offset_);
-  *dst_sum_ptr =
-      merge_operator_->applyToTypedValues(*dst_sum_ptr, *src_sum_ptr);
-  *dst_null_ptr = (*dst_null_ptr) && (*src_null_ptr);
-}
-
-TypedValue AggregationHandleSum::finalize(const AggregationState &state) const {
-  const AggregationStateSum &agg_state =
-      static_cast<const AggregationStateSum &>(state);
-  if (agg_state.null_) {
-    // SUM() over no values is NULL.
-    return result_type_->makeNullValue();
-  } else {
-    return agg_state.sum_;
-  }
-}
-
-ColumnVector* AggregationHandleSum::finalizeHashTable(
-    const AggregationStateHashTableBase &hash_table,
-    std::vector<std::vector<TypedValue>> *group_by_keys,
-    int index) const {
-  return finalizeHashTableHelperFast<AggregationHandleSum,
-                                     AggregationStateFastHashTable>(
-      *result_type_, hash_table, group_by_keys, index);
-}
-
-AggregationState*
-AggregationHandleSum::aggregateOnDistinctifyHashTableForSingle(
-    const AggregationStateHashTableBase &distinctify_hash_table) const {
-  return aggregateOnDistinctifyHashTableForSingleUnaryHelperFast<
-      AggregationHandleSum,
-      AggregationStateSum>(distinctify_hash_table);
-}
-
-void AggregationHandleSum::aggregateOnDistinctifyHashTableForGroupBy(
-    const AggregationStateHashTableBase &distinctify_hash_table,
-    AggregationStateHashTableBase *aggregation_hash_table,
-    std::size_t index) const {
-  aggregateOnDistinctifyHashTableForGroupByUnaryHelperFast<
-      AggregationHandleSum,
-      AggregationStateFastHashTable>(
-      distinctify_hash_table, aggregation_hash_table, index);
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/aggregation/AggregationHandleSum.hpp
----------------------------------------------------------------------
diff --git a/expressions/aggregation/AggregationHandleSum.hpp b/expressions/aggregation/AggregationHandleSum.hpp
deleted file mode 100644
index f0d23e1..0000000
--- a/expressions/aggregation/AggregationHandleSum.hpp
+++ /dev/null
@@ -1,254 +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_EXPRESSIONS_AGGREGATION_AGGREGATION_HANDLE_SUM_HPP_
-#define QUICKSTEP_EXPRESSIONS_AGGREGATION_AGGREGATION_HANDLE_SUM_HPP_
-
-#include <cstddef>
-#include <memory>
-#include <utility>
-#include <vector>
-
-#include "catalog/CatalogTypedefs.hpp"
-#include "expressions/aggregation/AggregationConcreteHandle.hpp"
-#include "expressions/aggregation/AggregationHandle.hpp"
-#include "storage/FastHashTable.hpp"
-#include "storage/HashTableBase.hpp"
-#include "threading/SpinMutex.hpp"
-#include "types/Type.hpp"
-#include "types/TypedValue.hpp"
-#include "types/operations/binary_operations/BinaryOperation.hpp"
-#include "utility/Macros.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-class ColumnVector;
-class StorageManager;
-class ValueAccessor;
-
-/** \addtogroup Expressions
- *  @{
- */
-
-/**
- * @brief Aggregation state for sum.
- */
-class AggregationStateSum : public AggregationState {
- public:
-  /**
-   * @brief Copy constructor (ignores mutex).
-   */
-  AggregationStateSum(const AggregationStateSum &orig)
-      : sum_(orig.sum_),
-        null_(orig.null_),
-        sum_offset_(orig.sum_offset_),
-        null_offset_(orig.null_offset_) {}
-
-  std::size_t getPayloadSize() const {
-    std::size_t p1 = reinterpret_cast<std::size_t>(&sum_);
-    std::size_t p2 = reinterpret_cast<std::size_t>(&mutex_);
-    return (p2 - p1);
-  }
-
-  const std::uint8_t* getPayloadAddress() const {
-    return reinterpret_cast<const uint8_t *>(&sum_);
-  }
-
- private:
-  friend class AggregationHandleSum;
-
-  AggregationStateSum()
-      : sum_(0),
-        null_(true),
-        sum_offset_(0),
-        null_offset_(reinterpret_cast<std::uint8_t *>(&null_) -
-                     reinterpret_cast<std::uint8_t *>(&sum_)) {}
-
-  AggregationStateSum(TypedValue &&sum, const bool is_null)
-      : sum_(std::move(sum)), null_(is_null) {}
-
-  // TODO(shoban): We might want to specialize sum_ to use atomics for int types
-  // similar to in AggregationStateCount.
-  TypedValue sum_;
-  bool null_;
-  SpinMutex mutex_;
-
-  int sum_offset_, null_offset_;
-};
-
-/**
- * @brief An aggregationhandle for sum.
- **/
-class AggregationHandleSum : public AggregationConcreteHandle {
- public:
-  ~AggregationHandleSum() override {}
-
-  AggregationState* createInitialState() const override {
-    return new AggregationStateSum(blank_state_);
-  }
-
-  AggregationStateHashTableBase* createGroupByHashTable(
-      const HashTableImplType hash_table_impl,
-      const std::vector<const Type *> &group_by_types,
-      const std::size_t estimated_num_groups,
-      StorageManager *storage_manager) const override;
-
-  inline void iterateUnaryInl(AggregationStateSum *state,
-                              const TypedValue &value) const {
-    DCHECK(value.isPlausibleInstanceOf(argument_type_.getSignature()));
-    if (value.isNull()) return;
-
-    SpinMutexLock lock(state->mutex_);
-    state->sum_ = fast_operator_->applyToTypedValues(state->sum_, value);
-    state->null_ = false;
-  }
-
-  inline void iterateUnaryInlFast(const TypedValue &value,
-                                  std::uint8_t *byte_ptr) const {
-    DCHECK(value.isPlausibleInstanceOf(argument_type_.getSignature()));
-    if (value.isNull()) return;
-    TypedValue *sum_ptr =
-        reinterpret_cast<TypedValue *>(byte_ptr + blank_state_.sum_offset_);
-    bool *null_ptr =
-        reinterpret_cast<bool *>(byte_ptr + blank_state_.null_offset_);
-    *sum_ptr = fast_operator_->applyToTypedValues(*sum_ptr, value);
-    *null_ptr = false;
-  }
-
-  inline void updateStateUnary(const TypedValue &argument,
-                               std::uint8_t *byte_ptr) const override {
-    if (!block_update_) {
-      iterateUnaryInlFast(argument, byte_ptr);
-    }
-  }
-
-  void blockUpdate() override { block_update_ = true; }
-
-  void allowUpdate() override { block_update_ = false; }
-
-  void initPayload(std::uint8_t *byte_ptr) const override {
-    TypedValue *sum_ptr =
-        reinterpret_cast<TypedValue *>(byte_ptr + blank_state_.sum_offset_);
-    bool *null_ptr =
-        reinterpret_cast<bool *>(byte_ptr + blank_state_.null_offset_);
-    *sum_ptr = blank_state_.sum_;
-    *null_ptr = true;
-  }
-
-  void destroyPayload(std::uint8_t *byte_ptr) const override {
-    TypedValue *sum_ptr =
-        reinterpret_cast<TypedValue *>(byte_ptr + blank_state_.sum_offset_);
-    if (sum_ptr != nullptr) {
-      sum_ptr->~TypedValue();
-    }
-  }
-
-  AggregationState* accumulateColumnVectors(
-      const std::vector<std::unique_ptr<ColumnVector>> &column_vectors)
-      const override;
-
-#ifdef QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_SELECTION
-  AggregationState* accumulateValueAccessor(
-      ValueAccessor *accessor,
-      const std::vector<attribute_id> &accessor_id) const override;
-#endif
-
-  void aggregateValueAccessorIntoHashTable(
-      ValueAccessor *accessor,
-      const std::vector<attribute_id> &argument_ids,
-      const std::vector<attribute_id> &group_by_key_ids,
-      AggregationStateHashTableBase *hash_table) const override;
-
-  void mergeStates(const AggregationState &source,
-                   AggregationState *destination) const override;
-
-  void mergeStatesFast(const std::uint8_t *source,
-                       std::uint8_t *destination) const override;
-
-  TypedValue finalize(const AggregationState &state) const override;
-
-  inline TypedValue finalizeHashTableEntry(
-      const AggregationState &state) const {
-    return static_cast<const AggregationStateSum &>(state).sum_;
-  }
-
-  inline TypedValue finalizeHashTableEntryFast(
-      const std::uint8_t *byte_ptr) const {
-    std::uint8_t *value_ptr = const_cast<std::uint8_t *>(byte_ptr);
-    TypedValue *sum_ptr =
-        reinterpret_cast<TypedValue *>(value_ptr + blank_state_.sum_offset_);
-    return *sum_ptr;
-  }
-
-  ColumnVector* finalizeHashTable(
-      const AggregationStateHashTableBase &hash_table,
-      std::vector<std::vector<TypedValue>> *group_by_keys,
-      int index) const override;
-
-  /**
-   * @brief Implementation of
-   *        AggregationHandle::aggregateOnDistinctifyHashTableForSingle()
-   *        for SUM aggregation.
-   */
-  AggregationState* aggregateOnDistinctifyHashTableForSingle(
-      const AggregationStateHashTableBase &distinctify_hash_table)
-      const override;
-
-  /**
-   * @brief Implementation of
-   *        AggregationHandle::aggregateOnDistinctifyHashTableForGroupBy()
-   *        for SUM aggregation.
-   */
-  void aggregateOnDistinctifyHashTableForGroupBy(
-      const AggregationStateHashTableBase &distinctify_hash_table,
-      AggregationStateHashTableBase *aggregation_hash_table,
-      std::size_t index) const override;
-
-  std::size_t getPayloadSize() const override {
-    return blank_state_.getPayloadSize();
-  }
-
- private:
-  friend class AggregateFunctionSum;
-
-  /**
-   * @brief Initialize handle for type.
-   *
-   * @param type Type of the sum value.
-   **/
-  explicit AggregationHandleSum(const Type &type);
-
-  const Type &argument_type_;
-  const Type *result_type_;
-  AggregationStateSum blank_state_;
-  std::unique_ptr<UncheckedBinaryOperator> fast_operator_;
-  std::unique_ptr<UncheckedBinaryOperator> merge_operator_;
-
-  bool block_update_;
-
-  DISALLOW_COPY_AND_ASSIGN(AggregationHandleSum);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_EXPRESSIONS_AGGREGATION_AGGREGATION_HANDLE_SUM_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/aggregation/AggregationID.hpp
----------------------------------------------------------------------
diff --git a/expressions/aggregation/AggregationID.hpp b/expressions/aggregation/AggregationID.hpp
deleted file mode 100644
index 1efb35c..0000000
--- a/expressions/aggregation/AggregationID.hpp
+++ /dev/null
@@ -1,44 +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_EXPRESSIONS_AGGREGATION_AGGREGATION_ID_HPP_
-#define QUICKSTEP_EXPRESSIONS_AGGREGATION_AGGREGATION_ID_HPP_
-
-namespace quickstep {
-
-/** \addtogroup Expressions
- *  @{
- */
-
-/**
- * @brief The possible types of aggregations.
- **/
-enum class AggregationID {
-  kAvg = 0,
-  kCount,
-  kMax,
-  kMin,
-  kSum
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_EXPRESSIONS_AGGREGATION_AGGREGATION_ID_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/aggregation/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/expressions/aggregation/CMakeLists.txt b/expressions/aggregation/CMakeLists.txt
deleted file mode 100644
index e9503f7..0000000
--- a/expressions/aggregation/CMakeLists.txt
+++ /dev/null
@@ -1,325 +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.
-
-QS_PROTOBUF_GENERATE_CPP(expressions_aggregation_AggregateFunction_proto_srcs
-                         expressions_aggregation_AggregateFunction_proto_hdrs
-                         AggregateFunction.proto)
-
-# Declare micro-libs:
-add_library(quickstep_expressions_aggregation_AggregateFunction
-            AggregateFunction.cpp
-            AggregateFunction.hpp)
-add_library(quickstep_expressions_aggregation_AggregateFunction_proto
-            ${expressions_aggregation_AggregateFunction_proto_srcs})
-add_library(quickstep_expressions_aggregation_AggregateFunctionAvg
-            AggregateFunctionAvg.cpp
-            AggregateFunctionAvg.hpp)
-add_library(quickstep_expressions_aggregation_AggregateFunctionCount
-            AggregateFunctionCount.cpp
-            AggregateFunctionCount.hpp)
-add_library(quickstep_expressions_aggregation_AggregateFunctionFactory
-            AggregateFunctionFactory.cpp
-            AggregateFunctionFactory.hpp)
-add_library(quickstep_expressions_aggregation_AggregateFunctionMax
-            AggregateFunctionMax.cpp
-            AggregateFunctionMax.hpp)
-add_library(quickstep_expressions_aggregation_AggregateFunctionMin
-            AggregateFunctionMin.cpp
-            AggregateFunctionMin.hpp)
-add_library(quickstep_expressions_aggregation_AggregateFunctionSum
-            AggregateFunctionSum.cpp
-            AggregateFunctionSum.hpp)
-add_library(quickstep_expressions_aggregation_AggregationConcreteHandle
-            AggregationConcreteHandle.cpp
-            AggregationConcreteHandle.hpp)
-add_library(quickstep_expressions_aggregation_AggregationHandle
-            ../../empty_src.cpp
-            AggregationHandle.hpp)
-add_library(quickstep_expressions_aggregation_AggregationHandleAvg
-            AggregationHandleAvg.cpp
-            AggregationHandleAvg.hpp)
-add_library(quickstep_expressions_aggregation_AggregationHandleCount
-            AggregationHandleCount.cpp
-            AggregationHandleCount.hpp)
-add_library(quickstep_expressions_aggregation_AggregationHandleDistinct
-            AggregationHandleDistinct.cpp
-            AggregationHandleDistinct.hpp)
-add_library(quickstep_expressions_aggregation_AggregationHandleMax
-            AggregationHandleMax.cpp
-            AggregationHandleMax.hpp)
-add_library(quickstep_expressions_aggregation_AggregationHandleMin
-            AggregationHandleMin.cpp
-            AggregationHandleMin.hpp)
-add_library(quickstep_expressions_aggregation_AggregationHandleSum
-            AggregationHandleSum.cpp
-            AggregationHandleSum.hpp)
-add_library(quickstep_expressions_aggregation_AggregationID
-            ../../empty_src.cpp
-            AggregationID.hpp)
-
-# Link dependencies:
-target_link_libraries(quickstep_expressions_aggregation_AggregateFunction
-                      glog
-                      quickstep_expressions_aggregation_AggregateFunction_proto
-                      quickstep_expressions_aggregation_AggregationID
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_expressions_aggregation_AggregateFunction_proto
-                      ${PROTOBUF_LIBRARY})
-target_link_libraries(quickstep_expressions_aggregation_AggregateFunctionAvg
-                      glog
-                      quickstep_expressions_aggregation_AggregateFunction
-                      quickstep_expressions_aggregation_AggregationHandleAvg
-                      quickstep_expressions_aggregation_AggregationID
-                      quickstep_types_Type
-                      quickstep_types_TypeFactory
-                      quickstep_types_TypeID
-                      quickstep_types_operations_binaryoperations_BinaryOperation
-                      quickstep_types_operations_binaryoperations_BinaryOperationFactory
-                      quickstep_types_operations_binaryoperations_BinaryOperationID
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_expressions_aggregation_AggregateFunctionCount
-                      glog
-                      quickstep_expressions_aggregation_AggregateFunction
-                      quickstep_expressions_aggregation_AggregationHandleCount
-                      quickstep_expressions_aggregation_AggregationID
-                      quickstep_types_Type
-                      quickstep_types_TypeFactory
-                      quickstep_types_TypeID
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_expressions_aggregation_AggregateFunctionFactory
-                      glog
-                      quickstep_expressions_aggregation_AggregateFunction_proto
-                      quickstep_expressions_aggregation_AggregateFunctionAvg
-                      quickstep_expressions_aggregation_AggregateFunctionCount
-                      quickstep_expressions_aggregation_AggregateFunctionMax
-                      quickstep_expressions_aggregation_AggregateFunctionMin
-                      quickstep_expressions_aggregation_AggregateFunctionSum
-                      quickstep_expressions_aggregation_AggregationID
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_expressions_aggregation_AggregateFunctionMax
-                      glog
-                      quickstep_expressions_aggregation_AggregateFunction
-                      quickstep_expressions_aggregation_AggregationHandleMax
-                      quickstep_expressions_aggregation_AggregationID
-                      quickstep_types_Type
-                      quickstep_types_operations_comparisons_Comparison
-                      quickstep_types_operations_comparisons_ComparisonFactory
-                      quickstep_types_operations_comparisons_ComparisonID
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_expressions_aggregation_AggregateFunctionMin
-                      glog
-                      quickstep_expressions_aggregation_AggregateFunction
-                      quickstep_expressions_aggregation_AggregationHandleMin
-                      quickstep_expressions_aggregation_AggregationID
-                      quickstep_types_Type
-                      quickstep_types_operations_comparisons_Comparison
-                      quickstep_types_operations_comparisons_ComparisonFactory
-                      quickstep_types_operations_comparisons_ComparisonID
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_expressions_aggregation_AggregateFunctionSum
-                      glog
-                      quickstep_expressions_aggregation_AggregateFunction
-                      quickstep_expressions_aggregation_AggregationHandleSum
-                      quickstep_expressions_aggregation_AggregationID
-                      quickstep_types_Type
-                      quickstep_types_TypeFactory
-                      quickstep_types_TypeID
-                      quickstep_types_operations_binaryoperations_BinaryOperation
-                      quickstep_types_operations_binaryoperations_BinaryOperationFactory
-                      quickstep_types_operations_binaryoperations_BinaryOperationID
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_expressions_aggregation_AggregationConcreteHandle
-                      glog
-                      quickstep_catalog_CatalogTypedefs
-                      quickstep_expressions_aggregation_AggregationHandle
-                      quickstep_storage_FastHashTable
-                      quickstep_storage_HashTable
-                      quickstep_storage_HashTableBase
-                      quickstep_storage_HashTableFactory
-                      quickstep_threading_SpinMutex
-                      quickstep_types_TypedValue
-                      quickstep_types_containers_ColumnVector
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_expressions_aggregation_AggregationHandle
-                      glog
-                      quickstep_catalog_CatalogTypedefs
-                      quickstep_storage_HashTableBase
-                      quickstep_types_TypedValue
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_expressions_aggregation_AggregationHandleAvg
-                      glog
-                      quickstep_catalog_CatalogTypedefs
-                      quickstep_expressions_aggregation_AggregationConcreteHandle
-                      quickstep_expressions_aggregation_AggregationHandle
-                      quickstep_storage_FastHashTable
-                      quickstep_storage_HashTable
-                      quickstep_storage_HashTableBase
-                      quickstep_storage_HashTableFactory
-                      quickstep_threading_SpinMutex
-                      quickstep_types_Type
-                      quickstep_types_TypeFactory
-                      quickstep_types_TypeID
-                      quickstep_types_TypedValue
-                      quickstep_types_operations_binaryoperations_BinaryOperation
-                      quickstep_types_operations_binaryoperations_BinaryOperationFactory
-                      quickstep_types_operations_binaryoperations_BinaryOperationID
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_expressions_aggregation_AggregationHandleCount
-                      glog
-                      quickstep_catalog_CatalogTypedefs
-                      quickstep_expressions_aggregation_AggregationConcreteHandle
-                      quickstep_expressions_aggregation_AggregationHandle
-                      quickstep_storage_FastHashTable
-                      quickstep_storage_HashTable
-                      quickstep_storage_HashTableBase
-                      quickstep_storage_HashTableFactory
-                      quickstep_storage_ValueAccessor
-                      quickstep_storage_ValueAccessorUtil
-                      quickstep_types_TypeFactory
-                      quickstep_types_TypeID
-                      quickstep_types_TypedValue
-                      quickstep_types_containers_ColumnVector
-                      quickstep_types_containers_ColumnVectorUtil
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_expressions_aggregation_AggregationHandleDistinct
-                      glog
-                      quickstep_catalog_CatalogTypedefs
-                      quickstep_expressions_aggregation_AggregationConcreteHandle
-                      quickstep_storage_HashTable
-                      quickstep_storage_HashTableBase
-                      quickstep_types_TypedValue
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_expressions_aggregation_AggregationHandleMax
-                      glog
-                      quickstep_catalog_CatalogTypedefs
-                      quickstep_expressions_aggregation_AggregationConcreteHandle
-                      quickstep_expressions_aggregation_AggregationHandle
-                      quickstep_storage_FastHashTable
-                      quickstep_storage_HashTable
-                      quickstep_storage_HashTableBase
-                      quickstep_storage_HashTableFactory
-                      quickstep_threading_SpinMutex
-                      quickstep_types_Type
-                      quickstep_types_TypedValue
-                      quickstep_types_containers_ColumnVector
-                      quickstep_types_operations_comparisons_Comparison
-                      quickstep_types_operations_comparisons_ComparisonFactory
-                      quickstep_types_operations_comparisons_ComparisonID
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_expressions_aggregation_AggregationHandleMin
-                      glog
-                      quickstep_catalog_CatalogTypedefs
-                      quickstep_expressions_aggregation_AggregationConcreteHandle
-                      quickstep_expressions_aggregation_AggregationHandle
-                      quickstep_storage_FastHashTable
-                      quickstep_storage_HashTable
-                      quickstep_storage_HashTableBase
-                      quickstep_storage_HashTableFactory
-                      quickstep_threading_SpinMutex
-                      quickstep_types_Type
-                      quickstep_types_TypedValue
-                      quickstep_types_containers_ColumnVector
-                      quickstep_types_operations_comparisons_Comparison
-                      quickstep_types_operations_comparisons_ComparisonFactory
-                      quickstep_types_operations_comparisons_ComparisonID
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_expressions_aggregation_AggregationHandleSum
-                      glog
-                      quickstep_catalog_CatalogTypedefs
-                      quickstep_expressions_aggregation_AggregationConcreteHandle
-                      quickstep_expressions_aggregation_AggregationHandle
-                      quickstep_storage_FastHashTable
-                      quickstep_storage_HashTable
-                      quickstep_storage_HashTableBase
-                      quickstep_storage_HashTableFactory
-                      quickstep_threading_SpinMutex
-                      quickstep_types_Type
-                      quickstep_types_TypeFactory
-                      quickstep_types_TypeID
-                      quickstep_types_TypedValue
-                      quickstep_types_operations_binaryoperations_BinaryOperation
-                      quickstep_types_operations_binaryoperations_BinaryOperationFactory
-                      quickstep_types_operations_binaryoperations_BinaryOperationID
-                      quickstep_utility_Macros)
-
-# Submodule all-in-one library:
-add_library(quickstep_expressions_aggregation ../../empty_src.cpp)
-target_link_libraries(quickstep_expressions_aggregation
-                      quickstep_expressions_aggregation_AggregateFunction
-                      quickstep_expressions_aggregation_AggregateFunction_proto
-                      quickstep_expressions_aggregation_AggregateFunctionAvg
-                      quickstep_expressions_aggregation_AggregateFunctionCount
-                      quickstep_expressions_aggregation_AggregateFunctionFactory
-                      quickstep_expressions_aggregation_AggregateFunctionMax
-                      quickstep_expressions_aggregation_AggregateFunctionMin
-                      quickstep_expressions_aggregation_AggregateFunctionSum
-                      quickstep_expressions_aggregation_AggregationConcreteHandle
-                      quickstep_expressions_aggregation_AggregationHandle
-                      quickstep_expressions_aggregation_AggregationHandleAvg
-                      quickstep_expressions_aggregation_AggregationHandleCount
-                      quickstep_expressions_aggregation_AggregationHandleDistinct
-                      quickstep_expressions_aggregation_AggregationHandleMax
-                      quickstep_expressions_aggregation_AggregationHandleMin
-                      quickstep_expressions_aggregation_AggregationHandleSum
-                      quickstep_expressions_aggregation_AggregationID)
-
-# Tests:
-
-# Unified executable to ammortize cost of linking.
-add_executable(AggregationHandle_tests
-               "${CMAKE_CURRENT_SOURCE_DIR}/tests/AggregationHandleAvg_unittest.cpp"
-               "${CMAKE_CURRENT_SOURCE_DIR}/tests/AggregationHandleCount_unittest.cpp"
-               "${CMAKE_CURRENT_SOURCE_DIR}/tests/AggregationHandleMax_unittest.cpp"
-               "${CMAKE_CURRENT_SOURCE_DIR}/tests/AggregationHandleMin_unittest.cpp"
-               "${CMAKE_CURRENT_SOURCE_DIR}/tests/AggregationHandleSum_unittest.cpp")
-target_link_libraries(AggregationHandle_tests
-                      gtest
-                      gtest_main
-                      quickstep_catalog_CatalogTypedefs
-                      quickstep_expressions_aggregation_AggregateFunction
-                      quickstep_expressions_aggregation_AggregateFunctionFactory
-                      quickstep_expressions_aggregation_AggregationHandle
-                      quickstep_expressions_aggregation_AggregationHandleAvg
-                      quickstep_expressions_aggregation_AggregationHandleCount
-                      quickstep_expressions_aggregation_AggregationHandleMax
-                      quickstep_expressions_aggregation_AggregationHandleMin
-                      quickstep_expressions_aggregation_AggregationHandleSum
-                      quickstep_expressions_aggregation_AggregationID
-                      quickstep_storage_AggregationOperationState
-                      quickstep_storage_HashTableBase
-                      quickstep_storage_StorageManager
-                      quickstep_types_CharType
-                      quickstep_types_DateOperatorOverloads
-                      quickstep_types_DatetimeIntervalType
-                      quickstep_types_DatetimeType
-                      quickstep_types_DoubleType
-                      quickstep_types_FloatType
-                      quickstep_types_IntType
-                      quickstep_types_IntervalLit
-                      quickstep_types_LongType
-                      quickstep_types_Type
-                      quickstep_types_TypeFactory
-                      quickstep_types_TypeID
-                      quickstep_types_TypedValue
-                      quickstep_types_VarCharType
-                      quickstep_types_YearMonthIntervalType
-                      quickstep_types_containers_ColumnVector
-                      quickstep_types_containers_ColumnVectorsValueAccessor
-                      quickstep_types_operations_comparisons_Comparison
-                      quickstep_types_operations_comparisons_ComparisonFactory
-                      quickstep_types_operations_comparisons_ComparisonID)
-add_test(AggregationHandle_tests AggregationHandle_tests)

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/aggregation/tests/AggregationHandleAvg_unittest.cpp
----------------------------------------------------------------------
diff --git a/expressions/aggregation/tests/AggregationHandleAvg_unittest.cpp b/expressions/aggregation/tests/AggregationHandleAvg_unittest.cpp
deleted file mode 100644
index 79d4448..0000000
--- a/expressions/aggregation/tests/AggregationHandleAvg_unittest.cpp
+++ /dev/null
@@ -1,596 +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 <cstddef>
-#include <cstdint>
-#include <memory>
-#include <vector>
-
-#include "catalog/CatalogTypedefs.hpp"
-#include "expressions/aggregation/AggregateFunction.hpp"
-#include "expressions/aggregation/AggregateFunctionFactory.hpp"
-#include "expressions/aggregation/AggregationHandle.hpp"
-#include "expressions/aggregation/AggregationHandleAvg.hpp"
-#include "expressions/aggregation/AggregationID.hpp"
-#include "storage/AggregationOperationState.hpp"
-#include "storage/FastHashTableFactory.hpp"
-#include "storage/StorageManager.hpp"
-#include "types/CharType.hpp"
-#include "types/DateOperatorOverloads.hpp"
-#include "types/DatetimeIntervalType.hpp"
-#include "types/DoubleType.hpp"
-#include "types/FloatType.hpp"
-#include "types/IntType.hpp"
-#include "types/IntervalLit.hpp"
-#include "types/LongType.hpp"
-#include "types/Type.hpp"
-#include "types/TypeFactory.hpp"
-#include "types/TypeID.hpp"
-#include "types/TypedValue.hpp"
-#include "types/VarCharType.hpp"
-#include "types/YearMonthIntervalType.hpp"
-#include "types/containers/ColumnVector.hpp"
-
-#ifdef QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_SELECTION
-#include "types/containers/ColumnVectorsValueAccessor.hpp"
-#endif
-
-#include "gtest/gtest.h"
-
-namespace quickstep {
-
-class AggregationHandleAvgTest : public ::testing::Test {
- protected:
-  static const int kNumSamples = 100;
-
-  // Helper method that calls AggregationHandleAvg::iterateUnaryInl() to
-  // aggregate 'value' into '*state'.
-  void iterateHandle(AggregationState *state, const TypedValue &value) {
-    static_cast<const AggregationHandleAvg &>(*aggregation_handle_avg_)
-        .iterateUnaryInl(static_cast<AggregationStateAvg *>(state), value);
-  }
-
-  void initializeHandle(const Type &type) {
-    aggregation_handle_avg_.reset(
-        AggregateFunctionFactory::Get(AggregationID::kAvg)
-            .createHandle(std::vector<const Type *>(1, &type)));
-    aggregation_handle_avg_state_.reset(
-        aggregation_handle_avg_->createInitialState());
-  }
-
-  static bool ApplyToTypesTest(TypeID typeID) {
-    const Type &type =
-        (typeID == kChar || typeID == kVarChar)
-            ? TypeFactory::GetType(typeID, static_cast<std::size_t>(10))
-            : TypeFactory::GetType(typeID);
-
-    return AggregateFunctionFactory::Get(AggregationID::kAvg)
-        .canApplyToTypes(std::vector<const Type *>(1, &type));
-  }
-
-  static bool ResultTypeForArgumentTypeTest(TypeID input_type_id,
-                                            TypeID output_type_id) {
-    const Type *result_type =
-        AggregateFunctionFactory::Get(AggregationID::kAvg)
-            .resultTypeForArgumentTypes(std::vector<const Type *>(
-                1, &TypeFactory::GetType(input_type_id)));
-    return (result_type->getTypeID() == output_type_id);
-  }
-
-  template <typename CppType>
-  static void CheckAvgValue(CppType expected,
-                            const AggregationHandle &handle,
-                            const AggregationState &state) {
-    EXPECT_EQ(expected, handle.finalize(state).getLiteral<CppType>());
-  }
-
-  template <typename CppType>
-  static void CheckAvgValue(CppType expected, const TypedValue &value) {
-    EXPECT_EQ(expected, value.getLiteral<CppType>());
-  }
-
-  // Static templated method for set a meaningful value to data types.
-  template <typename CppType>
-  static void SetDataType(int value, CppType *data) {
-    *data = value;
-  }
-
-  template <typename GenericType, typename OutputType = DoubleType>
-  void checkAggregationAvgGeneric() {
-    const GenericType &type = GenericType::Instance(true);
-    initializeHandle(type);
-    EXPECT_TRUE(
-        aggregation_handle_avg_->finalize(*aggregation_handle_avg_state_)
-            .isNull());
-
-    typename GenericType::cpptype val;
-    typename GenericType::cpptype sum;
-    SetDataType(0, &sum);
-
-    iterateHandle(aggregation_handle_avg_state_.get(), type.makeNullValue());
-    for (int i = 0; i < kNumSamples; ++i) {
-      if (type.getTypeID() == kInt || type.getTypeID() == kLong) {
-        SetDataType(i - 10, &val);
-      } else {
-        SetDataType(static_cast<float>(i - 10) / 10, &val);
-      }
-      iterateHandle(aggregation_handle_avg_state_.get(), type.makeValue(&val));
-      sum += val;
-    }
-    iterateHandle(aggregation_handle_avg_state_.get(), type.makeNullValue());
-    CheckAvgValue<typename OutputType::cpptype>(
-        static_cast<typename OutputType::cpptype>(sum) / kNumSamples,
-        *aggregation_handle_avg_,
-        *aggregation_handle_avg_state_);
-
-    // Test mergeStates().
-    std::unique_ptr<AggregationState> merge_state(
-        aggregation_handle_avg_->createInitialState());
-    aggregation_handle_avg_->mergeStates(*merge_state,
-                                         aggregation_handle_avg_state_.get());
-
-    iterateHandle(merge_state.get(), type.makeNullValue());
-    for (int i = 0; i < kNumSamples; ++i) {
-      if (type.getTypeID() == kInt || type.getTypeID() == kLong) {
-        SetDataType(i - 10, &val);
-      } else {
-        SetDataType(static_cast<float>(i - 10) / 10, &val);
-      }
-      iterateHandle(merge_state.get(), type.makeValue(&val));
-      sum += val;
-    }
-
-    aggregation_handle_avg_->mergeStates(*merge_state,
-                                         aggregation_handle_avg_state_.get());
-    CheckAvgValue<typename OutputType::cpptype>(
-        static_cast<typename OutputType::cpptype>(sum) / (2 * kNumSamples),
-        *aggregation_handle_avg_,
-        *aggregation_handle_avg_state_);
-  }
-
-  template <typename GenericType>
-  ColumnVector* createColumnVectorGeneric(const Type &type,
-                                          typename GenericType::cpptype *sum) {
-    NativeColumnVector *column = new NativeColumnVector(type, kNumSamples + 3);
-
-    typename GenericType::cpptype val;
-    SetDataType(0, sum);
-
-    column->appendTypedValue(type.makeNullValue());
-    for (int i = 0; i < kNumSamples; ++i) {
-      if (type.getTypeID() == kInt || type.getTypeID() == kLong) {
-        SetDataType(i - 10, &val);
-      } else {
-        SetDataType(static_cast<float>(i - 10) / 10, &val);
-      }
-      column->appendTypedValue(type.makeValue(&val));
-      *sum += val;
-      // One NULL in the middle.
-      if (i == kNumSamples / 2) {
-        column->appendTypedValue(type.makeNullValue());
-      }
-    }
-    column->appendTypedValue(type.makeNullValue());
-
-    return column;
-  }
-
-  template <typename GenericType, typename OutputType = DoubleType>
-  void checkAggregationAvgGenericColumnVector() {
-    const GenericType &type = GenericType::Instance(true);
-    initializeHandle(type);
-    EXPECT_TRUE(
-        aggregation_handle_avg_->finalize(*aggregation_handle_avg_state_)
-            .isNull());
-
-    typename GenericType::cpptype sum;
-    SetDataType(0, &sum);
-    std::vector<std::unique_ptr<ColumnVector>> column_vectors;
-    column_vectors.emplace_back(
-        createColumnVectorGeneric<GenericType>(type, &sum));
-
-    std::unique_ptr<AggregationState> cv_state(
-        aggregation_handle_avg_->accumulateColumnVectors(column_vectors));
-
-    // Test the state generated directly by accumulateColumnVectors(), and also
-    // test after merging back.
-    CheckAvgValue<typename OutputType::cpptype>(
-        static_cast<typename OutputType::cpptype>(sum) / kNumSamples,
-        *aggregation_handle_avg_,
-        *cv_state);
-
-    aggregation_handle_avg_->mergeStates(*cv_state,
-                                         aggregation_handle_avg_state_.get());
-    CheckAvgValue<typename OutputType::cpptype>(
-        static_cast<typename OutputType::cpptype>(sum) / kNumSamples,
-        *aggregation_handle_avg_,
-        *aggregation_handle_avg_state_);
-  }
-
-#ifdef QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_SELECTION
-  template <typename GenericType, typename OutputType = DoubleType>
-  void checkAggregationAvgGenericValueAccessor() {
-    const GenericType &type = GenericType::Instance(true);
-    initializeHandle(type);
-    EXPECT_TRUE(
-        aggregation_handle_avg_->finalize(*aggregation_handle_avg_state_)
-            .isNull());
-
-    typename GenericType::cpptype sum;
-    SetDataType(0, &sum);
-    std::unique_ptr<ColumnVectorsValueAccessor> accessor(
-        new ColumnVectorsValueAccessor());
-    accessor->addColumn(createColumnVectorGeneric<GenericType>(type, &sum));
-
-    std::unique_ptr<AggregationState> va_state(
-        aggregation_handle_avg_->accumulateValueAccessor(
-            accessor.get(), std::vector<attribute_id>(1, 0)));
-
-    // Test the state generated directly by accumulateValueAccessor(), and also
-    // test after merging back.
-    CheckAvgValue<typename OutputType::cpptype>(
-        static_cast<typename OutputType::cpptype>(sum) / kNumSamples,
-        *aggregation_handle_avg_,
-        *va_state);
-
-    aggregation_handle_avg_->mergeStates(*va_state,
-                                         aggregation_handle_avg_state_.get());
-    CheckAvgValue<typename OutputType::cpptype>(
-        static_cast<typename OutputType::cpptype>(sum) / kNumSamples,
-        *aggregation_handle_avg_,
-        *aggregation_handle_avg_state_);
-  }
-#endif  // QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_SELECTION
-
-  std::unique_ptr<AggregationHandle> aggregation_handle_avg_;
-  std::unique_ptr<AggregationState> aggregation_handle_avg_state_;
-  std::unique_ptr<StorageManager> storage_manager_;
-};
-
-const int AggregationHandleAvgTest::kNumSamples;
-
-template <>
-void AggregationHandleAvgTest::CheckAvgValue<double>(
-    double expected,
-    const AggregationHandle &handle,
-    const AggregationState &state) {
-  EXPECT_DOUBLE_EQ(expected, handle.finalize(state).getLiteral<double>());
-}
-
-template <>
-void AggregationHandleAvgTest::SetDataType<DatetimeIntervalLit>(
-    int value, DatetimeIntervalLit *data) {
-  data->interval_ticks = value;
-}
-
-template <>
-void AggregationHandleAvgTest::SetDataType<YearMonthIntervalLit>(
-    int value, YearMonthIntervalLit *data) {
-  data->months = value;
-}
-
-typedef AggregationHandleAvgTest AggregationHandleAvgDeathTest;
-
-TEST_F(AggregationHandleAvgTest, IntTypeTest) {
-  checkAggregationAvgGeneric<IntType>();
-}
-
-TEST_F(AggregationHandleAvgTest, LongTypeTest) {
-  checkAggregationAvgGeneric<LongType>();
-}
-
-TEST_F(AggregationHandleAvgTest, FloatTypeTest) {
-  checkAggregationAvgGeneric<FloatType>();
-}
-
-TEST_F(AggregationHandleAvgTest, DoubleTypeTest) {
-  checkAggregationAvgGeneric<DoubleType>();
-}
-
-TEST_F(AggregationHandleAvgTest, DatetimeIntervalTypeTest) {
-  checkAggregationAvgGeneric<DatetimeIntervalType, DatetimeIntervalType>();
-}
-
-TEST_F(AggregationHandleAvgTest, YearMonthIntervalTypeTest) {
-  checkAggregationAvgGeneric<YearMonthIntervalType, YearMonthIntervalType>();
-}
-
-TEST_F(AggregationHandleAvgTest, IntTypeColumnVectorTest) {
-  checkAggregationAvgGenericColumnVector<IntType>();
-}
-
-TEST_F(AggregationHandleAvgTest, LongTypeColumnVectorTest) {
-  checkAggregationAvgGenericColumnVector<LongType>();
-}
-
-TEST_F(AggregationHandleAvgTest, FloatTypeColumnVectorTest) {
-  checkAggregationAvgGenericColumnVector<FloatType>();
-}
-
-TEST_F(AggregationHandleAvgTest, DoubleTypeColumnVectorTest) {
-  checkAggregationAvgGenericColumnVector<DoubleType>();
-}
-
-TEST_F(AggregationHandleAvgTest, DatetimeIntervalTypeColumnVectorTest) {
-  checkAggregationAvgGenericColumnVector<DatetimeIntervalType,
-                                         DatetimeIntervalType>();
-}
-
-TEST_F(AggregationHandleAvgTest, YearMonthIntervalTypeColumnVectorTest) {
-  checkAggregationAvgGenericColumnVector<YearMonthIntervalType,
-                                         YearMonthIntervalType>();
-}
-
-#ifdef QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_SELECTION
-TEST_F(AggregationHandleAvgTest, IntTypeValueAccessorTest) {
-  checkAggregationAvgGenericValueAccessor<IntType>();
-}
-
-TEST_F(AggregationHandleAvgTest, LongTypeValueAccessorTest) {
-  checkAggregationAvgGenericValueAccessor<LongType>();
-}
-
-TEST_F(AggregationHandleAvgTest, FloatTypeValueAccessorTest) {
-  checkAggregationAvgGenericValueAccessor<FloatType>();
-}
-
-TEST_F(AggregationHandleAvgTest, DoubleTypeValueAccessorTest) {
-  checkAggregationAvgGenericValueAccessor<DoubleType>();
-}
-
-TEST_F(AggregationHandleAvgTest, DatetimeIntervalTypeValueAccessorTest) {
-  checkAggregationAvgGenericValueAccessor<DatetimeIntervalType,
-                                          DatetimeIntervalType>();
-}
-
-TEST_F(AggregationHandleAvgTest, YearMonthIntervalTypeValueAccessorTest) {
-  checkAggregationAvgGenericValueAccessor<YearMonthIntervalType,
-                                          YearMonthIntervalType>();
-}
-#endif  // QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_SELECTION
-
-#ifdef QUICKSTEP_DEBUG
-TEST_F(AggregationHandleAvgDeathTest, CharTypeTest) {
-  const Type &type = CharType::Instance(true, 10);
-  EXPECT_DEATH(initializeHandle(type), "");
-}
-
-TEST_F(AggregationHandleAvgDeathTest, VarTypeTest) {
-  const Type &type = VarCharType::Instance(true, 10);
-  EXPECT_DEATH(initializeHandle(type), "");
-}
-
-TEST_F(AggregationHandleAvgDeathTest, WrongTypeTest) {
-  const Type &int_non_null_type = IntType::Instance(false);
-  const Type &long_type = LongType::Instance(true);
-  const Type &double_type = DoubleType::Instance(true);
-  const Type &float_type = FloatType::Instance(true);
-  const Type &char_type = CharType::Instance(true, 10);
-  const Type &varchar_type = VarCharType::Instance(true, 10);
-
-  initializeHandle(IntType::Instance(true));
-  int int_val = 0;
-  std::int64_t long_val = 0;
-  double double_val = 0;
-  float float_val = 0;
-
-  iterateHandle(aggregation_handle_avg_state_.get(),
-                int_non_null_type.makeValue(&int_val));
-
-  EXPECT_DEATH(iterateHandle(aggregation_handle_avg_state_.get(),
-                             long_type.makeValue(&long_val)),
-               "");
-  EXPECT_DEATH(iterateHandle(aggregation_handle_avg_state_.get(),
-                             double_type.makeValue(&double_val)),
-               "");
-  EXPECT_DEATH(iterateHandle(aggregation_handle_avg_state_.get(),
-                             float_type.makeValue(&float_val)),
-               "");
-  EXPECT_DEATH(iterateHandle(aggregation_handle_avg_state_.get(),
-                             char_type.makeValue("asdf", 5)),
-               "");
-  EXPECT_DEATH(iterateHandle(aggregation_handle_avg_state_.get(),
-                             varchar_type.makeValue("asdf", 5)),
-               "");
-
-  // Test mergeStates() with incorrectly typed handles.
-  std::unique_ptr<AggregationHandle> aggregation_handle_avg_double(
-      AggregateFunctionFactory::Get(AggregationID::kAvg)
-          .createHandle(std::vector<const Type *>(1, &double_type)));
-  std::unique_ptr<AggregationState> aggregation_state_avg_merge_double(
-      aggregation_handle_avg_double->createInitialState());
-  static_cast<const AggregationHandleAvg &>(*aggregation_handle_avg_double)
-      .iterateUnaryInl(static_cast<AggregationStateAvg *>(
-                           aggregation_state_avg_merge_double.get()),
-                       double_type.makeValue(&double_val));
-  EXPECT_DEATH(
-      aggregation_handle_avg_->mergeStates(*aggregation_state_avg_merge_double,
-                                           aggregation_handle_avg_state_.get()),
-      "");
-
-  std::unique_ptr<AggregationHandle> aggregation_handle_avg_float(
-      AggregateFunctionFactory::Get(AggregationID::kAvg)
-          .createHandle(std::vector<const Type *>(1, &float_type)));
-  std::unique_ptr<AggregationState> aggregation_state_avg_merge_float(
-      aggregation_handle_avg_float->createInitialState());
-  static_cast<const AggregationHandleAvg &>(*aggregation_handle_avg_float)
-      .iterateUnaryInl(static_cast<AggregationStateAvg *>(
-                           aggregation_state_avg_merge_float.get()),
-                       float_type.makeValue(&float_val));
-  EXPECT_DEATH(
-      aggregation_handle_avg_->mergeStates(*aggregation_state_avg_merge_float,
-                                           aggregation_handle_avg_state_.get()),
-      "");
-}
-#endif
-
-TEST_F(AggregationHandleAvgTest, canApplyToTypeTest) {
-  EXPECT_TRUE(ApplyToTypesTest(kInt));
-  EXPECT_TRUE(ApplyToTypesTest(kLong));
-  EXPECT_TRUE(ApplyToTypesTest(kFloat));
-  EXPECT_TRUE(ApplyToTypesTest(kDouble));
-  EXPECT_FALSE(ApplyToTypesTest(kChar));
-  EXPECT_FALSE(ApplyToTypesTest(kVarChar));
-  EXPECT_FALSE(ApplyToTypesTest(kDatetime));
-  EXPECT_TRUE(ApplyToTypesTest(kDatetimeInterval));
-  EXPECT_TRUE(ApplyToTypesTest(kYearMonthInterval));
-}
-
-TEST_F(AggregationHandleAvgTest, ResultTypeForArgumentTypeTest) {
-  EXPECT_TRUE(ResultTypeForArgumentTypeTest(kInt, kDouble));
-  EXPECT_TRUE(ResultTypeForArgumentTypeTest(kLong, kDouble));
-  EXPECT_TRUE(ResultTypeForArgumentTypeTest(kFloat, kDouble));
-  EXPECT_TRUE(ResultTypeForArgumentTypeTest(kDouble, kDouble));
-  EXPECT_TRUE(
-      ResultTypeForArgumentTypeTest(kDatetimeInterval, kDatetimeInterval));
-  EXPECT_TRUE(
-      ResultTypeForArgumentTypeTest(kYearMonthInterval, kYearMonthInterval));
-}
-
-TEST_F(AggregationHandleAvgTest, GroupByTableMergeTestAvg) {
-  const Type &long_non_null_type = LongType::Instance(false);
-  initializeHandle(long_non_null_type);
-  storage_manager_.reset(new StorageManager("./test_avg_data"));
-  std::unique_ptr<AggregationStateHashTableBase> source_hash_table(
-      AggregationStateFastHashTableFactory::CreateResizable(
-          HashTableImplType::kSeparateChaining,
-          std::vector<const Type *>(1, &long_non_null_type),
-          10,
-          {aggregation_handle_avg_.get()->getPayloadSize()},
-          {aggregation_handle_avg_.get()},
-          storage_manager_.get()));
-  std::unique_ptr<AggregationStateHashTableBase> destination_hash_table(
-      AggregationStateFastHashTableFactory::CreateResizable(
-          HashTableImplType::kSeparateChaining,
-          std::vector<const Type *>(1, &long_non_null_type),
-          10,
-          {aggregation_handle_avg_.get()->getPayloadSize()},
-          {aggregation_handle_avg_.get()},
-          storage_manager_.get()));
-
-  AggregationStateFastHashTable *destination_hash_table_derived =
-      static_cast<AggregationStateFastHashTable *>(
-          destination_hash_table.get());
-
-  AggregationStateFastHashTable *source_hash_table_derived =
-      static_cast<AggregationStateFastHashTable *>(source_hash_table.get());
-
-  AggregationHandleAvg *aggregation_handle_avg_derived =
-      static_cast<AggregationHandleAvg *>(aggregation_handle_avg_.get());
-  // We create three keys: first is present in both the hash tables, second key
-  // is present only in the source hash table while the third key is present
-  // the destination hash table only.
-  std::vector<TypedValue> common_key;
-  common_key.emplace_back(static_cast<std::int64_t>(0));
-  std::vector<TypedValue> exclusive_source_key, exclusive_destination_key;
-  exclusive_source_key.emplace_back(static_cast<std::int64_t>(1));
-  exclusive_destination_key.emplace_back(static_cast<std::int64_t>(2));
-
-  const std::int64_t common_key_source_avg = 355;
-  TypedValue common_key_source_avg_val(common_key_source_avg);
-
-  const std::int64_t common_key_destination_avg = 295;
-  TypedValue common_key_destination_avg_val(common_key_destination_avg);
-
-  const std::int64_t exclusive_key_source_avg = 1;
-  TypedValue exclusive_key_source_avg_val(exclusive_key_source_avg);
-
-  const std::int64_t exclusive_key_destination_avg = 1;
-  TypedValue exclusive_key_destination_avg_val(exclusive_key_destination_avg);
-
-  std::unique_ptr<AggregationStateAvg> common_key_source_state(
-      static_cast<AggregationStateAvg *>(
-          aggregation_handle_avg_->createInitialState()));
-  std::unique_ptr<AggregationStateAvg> common_key_destination_state(
-      static_cast<AggregationStateAvg *>(
-          aggregation_handle_avg_->createInitialState()));
-  std::unique_ptr<AggregationStateAvg> exclusive_key_source_state(
-      static_cast<AggregationStateAvg *>(
-          aggregation_handle_avg_->createInitialState()));
-  std::unique_ptr<AggregationStateAvg> exclusive_key_destination_state(
-      static_cast<AggregationStateAvg *>(
-          aggregation_handle_avg_->createInitialState()));
-
-  // Create avg value states for keys.
-  aggregation_handle_avg_derived->iterateUnaryInl(common_key_source_state.get(),
-                                                  common_key_source_avg_val);
-
-  aggregation_handle_avg_derived->iterateUnaryInl(
-      common_key_destination_state.get(), common_key_destination_avg_val);
-
-  aggregation_handle_avg_derived->iterateUnaryInl(
-      exclusive_key_destination_state.get(), exclusive_key_destination_avg_val);
-
-  aggregation_handle_avg_derived->iterateUnaryInl(
-      exclusive_key_source_state.get(), exclusive_key_source_avg_val);
-
-  // Add the key-state pairs to the hash tables.
-  unsigned char buffer[100];
-  buffer[0] = '\0';
-  memcpy(buffer + 1,
-         common_key_source_state.get()->getPayloadAddress(),
-         aggregation_handle_avg_.get()->getPayloadSize());
-  source_hash_table_derived->putCompositeKey(common_key, buffer);
-
-  memcpy(buffer + 1,
-         common_key_destination_state.get()->getPayloadAddress(),
-         aggregation_handle_avg_.get()->getPayloadSize());
-  destination_hash_table_derived->putCompositeKey(common_key, buffer);
-
-  memcpy(buffer + 1,
-         exclusive_key_source_state.get()->getPayloadAddress(),
-         aggregation_handle_avg_.get()->getPayloadSize());
-  source_hash_table_derived->putCompositeKey(exclusive_source_key, buffer);
-
-  memcpy(buffer + 1,
-         exclusive_key_destination_state.get()->getPayloadAddress(),
-         aggregation_handle_avg_.get()->getPayloadSize());
-  destination_hash_table_derived->putCompositeKey(exclusive_destination_key,
-                                                      buffer);
-
-  EXPECT_EQ(2u, destination_hash_table_derived->numEntries());
-  EXPECT_EQ(2u, source_hash_table_derived->numEntries());
-
-  AggregationOperationState::mergeGroupByHashTables(
-      source_hash_table.get(), destination_hash_table.get());
-
-  EXPECT_EQ(3u, destination_hash_table_derived->numEntries());
-
-  CheckAvgValue<double>(
-      (common_key_destination_avg_val.getLiteral<std::int64_t>() +
-       common_key_source_avg_val.getLiteral<std::int64_t>()) /
-          static_cast<double>(2),
-      aggregation_handle_avg_derived->finalizeHashTableEntryFast(
-          destination_hash_table_derived->getSingleCompositeKey(common_key) +
-          1));
-  CheckAvgValue<double>(
-      exclusive_key_destination_avg_val.getLiteral<std::int64_t>(),
-      aggregation_handle_avg_derived->finalizeHashTableEntryFast(
-          destination_hash_table_derived->getSingleCompositeKey(
-              exclusive_destination_key) +
-          1));
-  CheckAvgValue<double>(
-      exclusive_key_source_avg_val.getLiteral<std::int64_t>(),
-      aggregation_handle_avg_derived->finalizeHashTableEntryFast(
-          source_hash_table_derived->getSingleCompositeKey(
-              exclusive_source_key) +
-          1));
-}
-
-}  // namespace quickstep


[23/51] [abbrv] [partial] incubator-quickstep git commit: remove c++ files

Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/parser/preprocessed/SqlParser_gen.hpp
----------------------------------------------------------------------
diff --git a/parser/preprocessed/SqlParser_gen.hpp b/parser/preprocessed/SqlParser_gen.hpp
deleted file mode 100644
index fe963be..0000000
--- a/parser/preprocessed/SqlParser_gen.hpp
+++ /dev/null
@@ -1,311 +0,0 @@
-/* A Bison parser, made by GNU Bison 3.0.2.  */
-
-/* Bison interface for Yacc-like parsers in C
-
-   Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation, either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-/* As a special exception, you may create a larger work that contains
-   part or all of the Bison parser skeleton and distribute that work
-   under terms of your choice, so long as that work isn't itself a
-   parser generator using the skeleton or a modified version thereof
-   as a parser skeleton.  Alternatively, if you modify or redistribute
-   the parser skeleton itself, you may (at your option) remove this
-   special exception, which will cause the skeleton and the resulting
-   Bison output files to be licensed under the GNU General Public
-   License without this special exception.
-
-   This special exception was added by the Free Software Foundation in
-   version 2.2 of Bison.  */
-
-#ifndef YY_QUICKSTEP_YY_SQLPARSER_GEN_HPP_INCLUDED
-# define YY_QUICKSTEP_YY_SQLPARSER_GEN_HPP_INCLUDED
-/* Debug traces.  */
-#ifndef YYDEBUG
-# define YYDEBUG 0
-#endif
-#if YYDEBUG
-extern int quickstep_yydebug;
-#endif
-
-/* Token type.  */
-#ifndef YYTOKENTYPE
-# define YYTOKENTYPE
-  enum yytokentype
-  {
-    TOKEN_COMMAND = 258,
-    TOKEN_NAME = 259,
-    TOKEN_STRING_SINGLE_QUOTED = 260,
-    TOKEN_STRING_DOUBLE_QUOTED = 261,
-    TOKEN_UNSIGNED_NUMVAL = 262,
-    TOKEN_OR = 263,
-    TOKEN_AND = 264,
-    TOKEN_NOT = 265,
-    TOKEN_EQ = 266,
-    TOKEN_LT = 267,
-    TOKEN_LEQ = 268,
-    TOKEN_GT = 269,
-    TOKEN_GEQ = 270,
-    TOKEN_NEQ = 271,
-    TOKEN_LIKE = 272,
-    TOKEN_REGEXP = 273,
-    TOKEN_BETWEEN = 274,
-    TOKEN_IS = 275,
-    UNARY_PLUS = 276,
-    UNARY_MINUS = 277,
-    TOKEN_ADD = 278,
-    TOKEN_ALL = 279,
-    TOKEN_ALTER = 280,
-    TOKEN_AS = 281,
-    TOKEN_ASC = 282,
-    TOKEN_BIGINT = 283,
-    TOKEN_BIT = 284,
-    TOKEN_BITWEAVING = 285,
-    TOKEN_BLOCKPROPERTIES = 286,
-    TOKEN_BLOCKSAMPLE = 287,
-    TOKEN_BLOOM_FILTER = 288,
-    TOKEN_CSB_TREE = 289,
-    TOKEN_BY = 290,
-    TOKEN_CASE = 291,
-    TOKEN_CHARACTER = 292,
-    TOKEN_CHECK = 293,
-    TOKEN_COLUMN = 294,
-    TOKEN_CONSTRAINT = 295,
-    TOKEN_COPY = 296,
-    TOKEN_CREATE = 297,
-    TOKEN_CURRENT = 298,
-    TOKEN_DATE = 299,
-    TOKEN_DATETIME = 300,
-    TOKEN_DAY = 301,
-    TOKEN_DECIMAL = 302,
-    TOKEN_DEFAULT = 303,
-    TOKEN_DELETE = 304,
-    TOKEN_DELIMITER = 305,
-    TOKEN_DESC = 306,
-    TOKEN_DISTINCT = 307,
-    TOKEN_DOUBLE = 308,
-    TOKEN_DROP = 309,
-    TOKEN_ELSE = 310,
-    TOKEN_END = 311,
-    TOKEN_ESCAPE_STRINGS = 312,
-    TOKEN_EXISTS = 313,
-    TOKEN_EXTRACT = 314,
-    TOKEN_FALSE = 315,
-    TOKEN_FIRST = 316,
-    TOKEN_FLOAT = 317,
-    TOKEN_FOLLOWING = 318,
-    TOKEN_FOR = 319,
-    TOKEN_FOREIGN = 320,
-    TOKEN_FROM = 321,
-    TOKEN_FULL = 322,
-    TOKEN_GROUP = 323,
-    TOKEN_HASH = 324,
-    TOKEN_HAVING = 325,
-    TOKEN_HOUR = 326,
-    TOKEN_IN = 327,
-    TOKEN_INDEX = 328,
-    TOKEN_INNER = 329,
-    TOKEN_INSERT = 330,
-    TOKEN_INTEGER = 331,
-    TOKEN_INTERVAL = 332,
-    TOKEN_INTO = 333,
-    TOKEN_JOIN = 334,
-    TOKEN_KEY = 335,
-    TOKEN_LAST = 336,
-    TOKEN_LEFT = 337,
-    TOKEN_LIMIT = 338,
-    TOKEN_LONG = 339,
-    TOKEN_MINUTE = 340,
-    TOKEN_MONTH = 341,
-    TOKEN_NULL = 342,
-    TOKEN_NULLS = 343,
-    TOKEN_OFF = 344,
-    TOKEN_ON = 345,
-    TOKEN_ORDER = 346,
-    TOKEN_OUTER = 347,
-    TOKEN_OVER = 348,
-    TOKEN_PARTITION = 349,
-    TOKEN_PARTITIONS = 350,
-    TOKEN_PERCENT = 351,
-    TOKEN_PRECEDING = 352,
-    TOKEN_PRIMARY = 353,
-    TOKEN_PRIORITY = 354,
-    TOKEN_QUIT = 355,
-    TOKEN_RANGE = 356,
-    TOKEN_REAL = 357,
-    TOKEN_REFERENCES = 358,
-    TOKEN_RIGHT = 359,
-    TOKEN_ROW = 360,
-    TOKEN_ROW_DELIMITER = 361,
-    TOKEN_ROWS = 362,
-    TOKEN_SECOND = 363,
-    TOKEN_SELECT = 364,
-    TOKEN_SET = 365,
-    TOKEN_SMA = 366,
-    TOKEN_SMALLINT = 367,
-    TOKEN_SUBSTRING = 368,
-    TOKEN_TABLE = 369,
-    TOKEN_THEN = 370,
-    TOKEN_TIME = 371,
-    TOKEN_TIMESTAMP = 372,
-    TOKEN_TRUE = 373,
-    TOKEN_TUPLESAMPLE = 374,
-    TOKEN_UNBOUNDED = 375,
-    TOKEN_UNIQUE = 376,
-    TOKEN_UPDATE = 377,
-    TOKEN_USING = 378,
-    TOKEN_VALUES = 379,
-    TOKEN_VARCHAR = 380,
-    TOKEN_WHEN = 381,
-    TOKEN_WHERE = 382,
-    TOKEN_WINDOW = 383,
-    TOKEN_WITH = 384,
-    TOKEN_YEAR = 385,
-    TOKEN_YEARMONTH = 386,
-    TOKEN_EOF = 387,
-    TOKEN_LEX_ERROR = 388
-  };
-#endif
-
-/* Value type.  */
-#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
-typedef union YYSTYPE YYSTYPE;
-union YYSTYPE
-{
-#line 120 "../SqlParser.ypp" /* yacc.c:1909  */
-
-  quickstep::ParseString *string_value_;
-
-  quickstep::PtrList<quickstep::ParseString> *string_list_;
-
-  bool boolean_value_;
-
-  quickstep::NumericParseLiteralValue *numeric_literal_value_;
-  quickstep::ParseLiteralValue *literal_value_;
-  quickstep::PtrList<quickstep::ParseScalarLiteral> *literal_value_list_;
-
-  quickstep::ParseExpression *expression_;
-
-  quickstep::ParseScalarLiteral *scalar_literal_;
-  quickstep::ParseAttribute *attribute_;
-  quickstep::PtrList<quickstep::ParseAttribute> *attribute_list_;
-
-  quickstep::ParsePredicate *predicate_;
-
-  quickstep::ParseSubqueryExpression *subquery_expression_;
-
-  quickstep::PtrVector<quickstep::ParseSimpleWhenClause> *simple_when_clause_list_;
-  quickstep::ParseSimpleWhenClause *simple_when_clause_;
-
-  quickstep::PtrVector<quickstep::ParseSearchedWhenClause> *searched_when_clause_list_;
-  quickstep::ParseSearchedWhenClause *searched_when_clause_;
-
-  quickstep::ParseSelectionClause *selection_;
-  quickstep::ParseSelectionItem *selection_item_;
-  quickstep::ParseSelectionList *selection_list_;
-
-  quickstep::ParseTableReference *table_reference_;
-  quickstep::PtrList<quickstep::ParseTableReference> *table_reference_list_;
-  quickstep::ParseTableReferenceSignature *table_reference_signature_;
-
-  quickstep::ParseJoinedTableReference::JoinType join_type_;
-
-  quickstep::ParseDataType *data_type_;
-  quickstep::ParseAttributeDefinition *attribute_definition_;
-  quickstep::ParseColumnConstraint *column_constraint_;
-  quickstep::PtrList<quickstep::ParseColumnConstraint> *column_constraint_list_;
-  quickstep::PtrList<quickstep::ParseAttributeDefinition> *attribute_definition_list_;
-
-  quickstep::ParseKeyValue *key_value_;
-  quickstep::PtrList<quickstep::ParseKeyValue> *key_value_list_;
-  quickstep::ParseKeyStringValue *key_string_value_;
-  quickstep::ParseKeyStringList *key_string_list_;
-  quickstep::ParseKeyIntegerValue *key_integer_value_;
-
-  quickstep::ParseCopyFromParams *copy_from_params_;
-
-  quickstep::ParseAssignment *assignment_;
-  quickstep::PtrList<quickstep::ParseAssignment> *assignment_list_;
-
-  quickstep::ParseCommand *command_;
-  quickstep::PtrVector<quickstep::ParseString> *command_argument_list_;
-
-  quickstep::ParseStatement *statement_;
-  quickstep::ParseStatementSelect *select_statement_;
-  quickstep::ParseStatementUpdate *update_statement_;
-  quickstep::ParseStatementInsert *insert_statement_;
-  quickstep::ParseStatementDelete *delete_statement_;
-  quickstep::ParseStatementCopyFrom *copy_from_statement_;
-  quickstep::ParseStatementCreateTable *create_table_statement_;
-  quickstep::ParsePartitionClause *partition_clause_;
-  quickstep::ParseBlockProperties *block_properties_;
-  quickstep::ParseStatementDropTable *drop_table_statement_;
-  quickstep::ParseStatementQuit *quit_statement_;
-
-  const quickstep::Comparison *comparison_;
-  const quickstep::UnaryOperation *unary_operation_;
-  const quickstep::BinaryOperation *binary_operation_;
-
-  quickstep::ParseFunctionCall *function_call_;
-  quickstep::PtrList<quickstep::ParseExpression> *expression_list_;
-
-  quickstep::ParseSelect *select_query_;
-  quickstep::ParseGroupBy *opt_group_by_clause_;
-  quickstep::ParseHaving *opt_having_clause_;
-  quickstep::ParseOrderBy *opt_order_by_clause_;
-  bool *order_direction_;
-  quickstep::ParseLimit *opt_limit_clause_;
-
-  quickstep::ParseSample *opt_sample_clause_;
-
-  quickstep::PtrList<quickstep::ParseWindow> *opt_window_clause_;
-  quickstep::ParseWindow *window_definition_;
-  quickstep::PtrList<quickstep::ParseExpression> *window_partition_by_list_;
-  quickstep::PtrList<quickstep::ParseOrderByItem> *window_order_by_list_;
-  quickstep::ParseFrameInfo *window_frame_info_;
-
-  quickstep::PtrList<quickstep::ParseOrderByItem> *order_commalist_;
-  quickstep::ParseOrderByItem *order_item_;
-
-  quickstep::PtrVector<quickstep::ParseSubqueryTableReference> *with_list_;
-  quickstep::ParseSubqueryTableReference *with_list_element_;
-
-  quickstep::ParsePriority *opt_priority_clause_;
-
-#line 288 "SqlParser_gen.hpp" /* yacc.c:1909  */
-};
-# define YYSTYPE_IS_TRIVIAL 1
-# define YYSTYPE_IS_DECLARED 1
-#endif
-
-/* Location type.  */
-#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
-typedef struct YYLTYPE YYLTYPE;
-struct YYLTYPE
-{
-  int first_line;
-  int first_column;
-  int last_line;
-  int last_column;
-};
-# define YYLTYPE_IS_DECLARED 1
-# define YYLTYPE_IS_TRIVIAL 1
-#endif
-
-
-
-int quickstep_yyparse (yyscan_t yyscanner, quickstep::ParseStatement **parsedStatement);
-
-#endif /* !YY_QUICKSTEP_YY_SQLPARSER_GEN_HPP_INCLUDED  */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/parser/preprocessed/genfiles.sh
----------------------------------------------------------------------
diff --git a/parser/preprocessed/genfiles.sh b/parser/preprocessed/genfiles.sh
deleted file mode 100755
index f497494..0000000
--- a/parser/preprocessed/genfiles.sh
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/bash
-
-flex -i -I --header-file=SqlLexer_gen.hpp -oSqlLexer_gen.cpp ../SqlLexer.lpp
-bison -d -o SqlParser_gen.cpp ../SqlParser.ypp

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/parser/tests/Aggregate.test
----------------------------------------------------------------------
diff --git a/parser/tests/Aggregate.test b/parser/tests/Aggregate.test
deleted file mode 100644
index e7b8945..0000000
--- a/parser/tests/Aggregate.test
+++ /dev/null
@@ -1,220 +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.
-
-SELECT AGG(*), AGG(), AGG(a, b, c) FROM test
---
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectList
-  | +-SelectListItem
-  | | +-FunctionCall[name=AGG,is_star=true]
-  | +-SelectListItem
-  | | +-FunctionCall[name=AGG]
-  | +-SelectListItem
-  |   +-FunctionCall[name=AGG]
-  |     +-AttributeReference[attribute_name=a]
-  |     +-AttributeReference[attribute_name=b]
-  |     +-AttributeReference[attribute_name=c]
-  +-from_clause=
-    +-TableReference[table=test]
-==
-
-SELECT AGG()+1, AGG()*2+1+AGG(a, b)/AGG(c, d) FROM test
---
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectList
-  | +-SelectListItem
-  | | +-Add
-  | |   +-left_operand=FunctionCall[name=AGG]
-  | |   +-right_operand=Literal
-  | |     +-NumericLiteral[numeric_string=1,float_like=false]
-  | +-SelectListItem
-  |   +-Add
-  |     +-left_operand=Add
-  |     | +-left_operand=Multiply
-  |     | | +-left_operand=FunctionCall[name=AGG]
-  |     | | +-right_operand=Literal
-  |     | |   +-NumericLiteral[numeric_string=2,float_like=false]
-  |     | +-right_operand=Literal
-  |     |   +-NumericLiteral[numeric_string=1,float_like=false]
-  |     +-right_operand=Divide
-  |       +-left_operand=FunctionCall[name=AGG]
-  |       | +-AttributeReference[attribute_name=a]
-  |       | +-AttributeReference[attribute_name=b]
-  |       +-right_operand=FunctionCall[name=AGG]
-  |         +-AttributeReference[attribute_name=c]
-  |         +-AttributeReference[attribute_name=d]
-  +-from_clause=
-    +-TableReference[table=test]
-==
-
-# Function calls as arguments of another function calls.
-# This is just for testing purpose. If agg is an aggregation,
-# the query is not valid. The query resolver will capture the error.
-SELECT AGG(AGG(AGG()+1)*2, AGG(*)/2.0) FROM test
---
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectList
-  | +-SelectListItem
-  |   +-FunctionCall[name=AGG]
-  |     +-Multiply
-  |     | +-left_operand=FunctionCall[name=AGG]
-  |     | | +-Add
-  |     | |   +-left_operand=FunctionCall[name=AGG]
-  |     | |   +-right_operand=Literal
-  |     | |     +-NumericLiteral[numeric_string=1,float_like=false]
-  |     | +-right_operand=Literal
-  |     |   +-NumericLiteral[numeric_string=2,float_like=false]
-  |     +-Divide
-  |       +-left_operand=FunctionCall[name=AGG,is_star=true]
-  |       +-right_operand=Literal
-  |         +-NumericLiteral[numeric_string=2.0,float_like=true]
-  +-from_clause=
-    +-TableReference[table=test]
-==
-
-SELECT AGG(*, a) FROM test
---
-ERROR: syntax error (1 : 13)
-SELECT AGG(*, a) FROM test
-            ^
-==
-
-SELECT AGG()+1 FROM test GROUP BY a+1, AGG()+1 HAVING AGG()*2>1
---
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectList
-  | +-SelectListItem
-  |   +-Add
-  |     +-left_operand=FunctionCall[name=AGG]
-  |     +-right_operand=Literal
-  |       +-NumericLiteral[numeric_string=1,float_like=false]
-  +-group_by=GroupBy
-  | +-Add
-  | | +-left_operand=AttributeReference[attribute_name=a]
-  | | +-right_operand=Literal
-  | |   +-NumericLiteral[numeric_string=1,float_like=false]
-  | +-Add
-  |   +-left_operand=FunctionCall[name=AGG]
-  |   +-right_operand=Literal
-  |     +-NumericLiteral[numeric_string=1,float_like=false]
-  +-having=HAVING
-  | +-Greater
-  |   +-left_operand=Multiply
-  |   | +-left_operand=FunctionCall[name=AGG]
-  |   | +-right_operand=Literal
-  |   |   +-NumericLiteral[numeric_string=2,float_like=false]
-  |   +-right_operand=Literal
-  |     +-NumericLiteral[numeric_string=1,float_like=false]
-  +-from_clause=
-    +-TableReference[table=test]
-==
-
-SELECT 1 FROM test HAVING AGG() > 1 AND 1=1
---
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectList
-  | +-SelectListItem
-  |   +-Literal
-  |     +-NumericLiteral[numeric_string=1,float_like=false]
-  +-having=HAVING
-  | +-And
-  |   +-Greater
-  |   | +-left_operand=FunctionCall[name=AGG]
-  |   | +-right_operand=Literal
-  |   |   +-NumericLiteral[numeric_string=1,float_like=false]
-  |   +-Equal
-  |     +-left_operand=Literal
-  |     | +-NumericLiteral[numeric_string=1,float_like=false]
-  |     +-right_operand=Literal
-  |       +-NumericLiteral[numeric_string=1,float_like=false]
-  +-from_clause=
-    +-TableReference[table=test]
-==
-
-SELECT 1 FROM test GROUP BY AGG()+1, AGG()/AGG()
---
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectList
-  | +-SelectListItem
-  |   +-Literal
-  |     +-NumericLiteral[numeric_string=1,float_like=false]
-  +-group_by=GroupBy
-  | +-Add
-  | | +-left_operand=FunctionCall[name=AGG]
-  | | +-right_operand=Literal
-  | |   +-NumericLiteral[numeric_string=1,float_like=false]
-  | +-Divide
-  |   +-left_operand=FunctionCall[name=AGG]
-  |   +-right_operand=FunctionCall[name=AGG]
-  +-from_clause=
-    +-TableReference[table=test]
-==
-
-SELECT AGG(DISTINCT x), AGG(y) FROM test GROUP BY z
---
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectList
-  | +-SelectListItem
-  | | +-FunctionCall[name=AGG,is_distinct=true]
-  | |   +-AttributeReference[attribute_name=x]
-  | +-SelectListItem
-  |   +-FunctionCall[name=AGG]
-  |     +-AttributeReference[attribute_name=y]
-  +-group_by=GroupBy
-  | +-AttributeReference[attribute_name=z]
-  +-from_clause=
-    +-TableReference[table=test]
-==
-
-SELECT AGG(DISTINCT FUN(x) + y) * AGG(z)
-FROM test
-GROUP BY z
-HAVING AGG(DISTINCT w) + AGG(s) > 1
---
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectList
-  | +-SelectListItem
-  |   +-Multiply
-  |     +-left_operand=FunctionCall[name=AGG,is_distinct=true]
-  |     | +-Add
-  |     |   +-left_operand=FunctionCall[name=FUN]
-  |     |   | +-AttributeReference[attribute_name=x]
-  |     |   +-right_operand=AttributeReference[attribute_name=y]
-  |     +-right_operand=FunctionCall[name=AGG]
-  |       +-AttributeReference[attribute_name=z]
-  +-group_by=GroupBy
-  | +-AttributeReference[attribute_name=z]
-  +-having=HAVING
-  | +-Greater
-  |   +-left_operand=Add
-  |   | +-left_operand=FunctionCall[name=AGG,is_distinct=true]
-  |   | | +-AttributeReference[attribute_name=w]
-  |   | +-right_operand=FunctionCall[name=AGG]
-  |   |   +-AttributeReference[attribute_name=s]
-  |   +-right_operand=Literal
-  |     +-NumericLiteral[numeric_string=1,float_like=false]
-  +-from_clause=
-    +-TableReference[table=test]
-==

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/parser/tests/Alter.test
----------------------------------------------------------------------
diff --git a/parser/tests/Alter.test b/parser/tests/Alter.test
deleted file mode 100644
index f050284..0000000
--- a/parser/tests/Alter.test
+++ /dev/null
@@ -1,53 +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.
-
-ALTER TABLE test
-ADD attr INT
---
-ERROR: syntax error (2 : 5)
-ADD attr INT
-    ^
-==
-
-ALTER TABLE test
-ADD COLUMN attr INT
---
-ERROR: ALTER statements is not supported yet (1 : 1)
-ALTER TABLE test
-^
-==
-
-ALTER TABLE test
-DROP COLUMN attr INT
---
-[same as above]
-==
-
-ALTER TABLE test
-ADD CONSTRAINT UNIQUE(attr)
---
-ERROR: Table Constraints (UNIQUE) is not supported yet (2 : 16)
-ADD CONSTRAINT UNIQUE(attr)
-               ^
-==
-
-ALTER TABLE test
-DROP CONSTRAINT constraint0
---
-ERROR: ALTER statements is not supported yet (1 : 1)
-ALTER TABLE test
-^

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/parser/tests/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/parser/tests/CMakeLists.txt b/parser/tests/CMakeLists.txt
deleted file mode 100644
index 9b461ec..0000000
--- a/parser/tests/CMakeLists.txt
+++ /dev/null
@@ -1,78 +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.
-
-add_executable(quickstep_parser_tests_ParserTest
-              "${CMAKE_CURRENT_SOURCE_DIR}/ParserTest.cpp"
-              "${PROJECT_SOURCE_DIR}/utility/textbased_test/TextBasedTest.cpp"
-              "${PROJECT_SOURCE_DIR}/utility/textbased_test/TextBasedTest.hpp")
-
-target_link_libraries(quickstep_parser_tests_ParserTest
-                      glog
-                      gtest
-                      gtest_main
-                      quickstep_parser
-                      quickstep_utility_Macros
-                      quickstep_utility_TextBasedTestDriver)
-
-add_test(quickstep_parser_tests_ParserTest_aggregate
-         quickstep_parser_tests_ParserTest
-         "${CMAKE_CURRENT_SOURCE_DIR}/Aggregate.test"
-         "${CMAKE_CURRENT_BINARY_DIR}/Aggregate.test")
-add_test(quickstep_parser_tests_ParserTest_alter
-         quickstep_parser_tests_ParserTest
-         "${CMAKE_CURRENT_SOURCE_DIR}/Alter.test"
-         "${CMAKE_CURRENT_BINARY_DIR}/Alter.test")
-add_test(quickstep_parser_tests_ParserTest_copy
-         quickstep_parser_tests_ParserTest
-         "${CMAKE_CURRENT_SOURCE_DIR}/Copy.test"
-         "${CMAKE_CURRENT_BINARY_DIR}/Copy.test")
-add_test(quickstep_parser_tests_ParserTest_create
-         quickstep_parser_tests_ParserTest
-         "${CMAKE_CURRENT_SOURCE_DIR}/Create.test"
-         "${CMAKE_CURRENT_BINARY_DIR}/Create.test")
-add_test(quickstep_parser_tests_ParserTest_delete
-         quickstep_parser_tests_ParserTest
-         "${CMAKE_CURRENT_SOURCE_DIR}/Delete.test"
-         "${CMAKE_CURRENT_BINARY_DIR}/Delete.test")
-add_test(quickstep_parser_tests_ParserTest_drop
-         quickstep_parser_tests_ParserTest
-         "${CMAKE_CURRENT_SOURCE_DIR}/Drop.test"
-         "${CMAKE_CURRENT_BINARY_DIR}/Drop.test")
-add_test(quickstep_parser_tests_ParserTest_index
-         quickstep_parser_tests_ParserTest
-         "${CMAKE_CURRENT_SOURCE_DIR}/Index.test"
-         "${CMAKE_CURRENT_BINARY_DIR}/Index.test")
-add_test(quickstep_parser_tests_ParserTest_insert
-         quickstep_parser_tests_ParserTest
-         "${CMAKE_CURRENT_SOURCE_DIR}/Insert.test"
-         "${CMAKE_CURRENT_BINARY_DIR}/Insert.test")
-add_test(quickstep_parser_tests_ParserTest_join
-         quickstep_parser_tests_ParserTest
-         "${CMAKE_CURRENT_SOURCE_DIR}/Join.test"
-         "${CMAKE_CURRENT_BINARY_DIR}/Join.test")
-add_test(quickstep_parser_tests_ParserTest_select
-         quickstep_parser_tests_ParserTest
-         "${CMAKE_CURRENT_SOURCE_DIR}/Select.test"
-         "${CMAKE_CURRENT_BINARY_DIR}/Select.test")
-add_test(quickstep_parser_tests_ParserTest_tpch
-         quickstep_parser_tests_ParserTest
-         "${CMAKE_CURRENT_SOURCE_DIR}/TPCH.test"
-         "${CMAKE_CURRENT_BINARY_DIR}/TPCH.test")
-add_test(quickstep_parser_tests_ParserTest_update
-         quickstep_parser_tests_ParserTest
-         "${CMAKE_CURRENT_SOURCE_DIR}/Update.test"
-         "${CMAKE_CURRENT_BINARY_DIR}/Update.test")

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/parser/tests/Copy.test
----------------------------------------------------------------------
diff --git a/parser/tests/Copy.test b/parser/tests/Copy.test
deleted file mode 100644
index dccaa82..0000000
--- a/parser/tests/Copy.test
+++ /dev/null
@@ -1,57 +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.
-
-COPY test FROM 'test.txt' WITH ()
---
-ERROR: syntax error (1 : 33)
-COPY test FROM 'test.txt' WITH ()
-                                ^
-==
-
-COPY test FROM 'test.txt'
---
-CopyFromStatement[relation_name=test,source_file=test.txt]
-==
-
-COPY test FROM 'test.txt' WITH (DELIMITER 'd', ESCAPE_STRINGS FALSE)
---
-CopyFromStatement[relation_name=test,source_file=test.txt]
-+-params=CopyFromParams[delimiter=d,escape_string=false]
-==
-
-COPY test FROM 'test.txt' WITH (DELIMITER '123', ESCAPE_STRINGS FALSE)
---
-CopyFromStatement[relation_name=test,source_file=test.txt]
-+-params=CopyFromParams[delimiter=123,escape_string=false]
-==
-
-COPY test FROM 'test.txt' WITH (DELIMITER e'\t')
---
-CopyFromStatement[relation_name=test,source_file=test.txt]
-+-params=CopyFromParams[delimiter=	,escape_string=true]
-==
-
-COPY test FROM 'test.txt' WITH (ESCAPE_STRINGS FALSE, DELIMITER 'd')
---
-CopyFromStatement[relation_name=test,source_file=test.txt]
-+-params=CopyFromParams[delimiter=d,escape_string=false]
-==
-
-COPY test FROM 'test.txt' WITH (DELIMITER '1', ESCAPE_STRINGS FALSE, DELIMITER '2', ESCAPE_STRINGS TRUE)
---
-CopyFromStatement[relation_name=test,source_file=test.txt]
-+-params=CopyFromParams[delimiter=2,escape_string=true]

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/parser/tests/Create.test
----------------------------------------------------------------------
diff --git a/parser/tests/Create.test b/parser/tests/Create.test
deleted file mode 100644
index 49e7ccd..0000000
--- a/parser/tests/Create.test
+++ /dev/null
@@ -1,270 +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.
-
-CREATE TABLE TABLE (attr int)
---
-ERROR: syntax error (1 : 14)
-CREATE TABLE TABLE (attr int)
-             ^
-==
-
-# We do not allow an empty-column table.
-CREATE TABLE test ()
---
-ERROR: syntax error (1 : 20)
-CREATE TABLE test ()
-                   ^
-==
-
-CREATE TABLE test (attr1 INT, attr2 FLOAT, attr3 DOUBLE, attr4 CHAR(5), attr5 VARCHAR(4))
---
-CreateTableStatement[relation_name=test]
-+-attribute_list=
-  +-AttributeDefinition[name=attr1,type=Int]
-  +-AttributeDefinition[name=attr2,type=Float]
-  +-AttributeDefinition[name=attr3,type=Double]
-  +-AttributeDefinition[name=attr4,type=Char(5)]
-  +-AttributeDefinition[name=attr5,type=VarChar(4)]
-==
-
-CREATE TABLE test (attr CHAR(-1))
---
-ERROR: syntax error (1 : 30)
-CREATE TABLE test (attr CHAR(-1))
-                             ^
-==
-
-# Zero-length char type is not allowed.
-CREATE TABLE test (attr CHAR(0))
---
-ERROR: Length for CHAR type must be at least 1 (1 : 30)
-CREATE TABLE test (attr CHAR(0))
-                             ^
-==
-
-CREATE TABLE test(attr CHAR(1+1))
---
-ERROR: syntax error (1 : 30)
-CREATE TABLE test(attr CHAR(1+1))
-                             ^
-==
-
-CREATE TABLE test (attr UNKNOWN_TYPE)
---
-ERROR: syntax error (1 : 25)
-CREATE TABLE test (attr UNKNOWN_TYPE)
-                        ^
-==
-
-CREATE TABLE test (attr INT NULL, attr FLOAT NOT NULL)
---
-CreateTableStatement[relation_name=test]
-+-attribute_list=
-  +-AttributeDefinition[name=attr,type=Int NULL]
-  +-AttributeDefinition[name=attr,type=Float]
-==
-
-CREATE TABLE test (attr INT UNIQUE)
---
-ERROR: Column Constraints (UNIQUE) is not supported yet (1 : 29)
-CREATE TABLE test (attr INT UNIQUE)
-                            ^
-==
-
-CREATE TABLE test (attr INT PRIMARY KEY)
---
-ERROR: Column Constraints (PRIMARY KEY) is not supported yet (1 : 29)
-CREATE TABLE test (attr INT PRIMARY KEY)
-                            ^
-==
-
-CREATE TABLE test (attr INT DEFAULT 4)
---
-ERROR: Column Constraints (DEFAULT) is not supported yet (1 : 29)
-CREATE TABLE test (attr INT DEFAULT 4)
-                            ^
-==
-
-CREATE TABLE test (attr INT CHECK(attr>5))
---
-ERROR: Column Constraints (CHECK) is not supported yet (1 : 29)
-CREATE TABLE test (attr INT CHECK(attr>5))
-                            ^
-==
-
-CREATE TABLE test (attr INT REFERENCES test2(attr2))
---
-ERROR: Foreign Keys is not supported yet (1 : 29)
-CREATE TABLE test (attr INT REFERENCES test2(attr2))
-                            ^
-==
-
-CREATE TABLE test (attr INT) UNIQUE(attr)
---
-ERROR: Table Constraints (UNIQUE) is not supported yet (1 : 30)
-CREATE TABLE test (attr INT) UNIQUE(attr)
-                             ^
-==
-
-CREATE TABLE test (attr INT) PRIMARY KEY(attr)
---
-ERROR: Table Constraints (PRIMARY KEY) is not supported yet (1 : 30)
-CREATE TABLE test (attr INT) PRIMARY KEY(attr)
-                             ^
-==
-
-CREATE TABLE test (attr INT) FOREIGN KEY(attr)
---
-ERROR: syntax error (1 : 47)
-... TABLE test (attr INT) FOREIGN KEY(attr)
-                                           ^
-==
-
-CREATE TABLE test (attr INT) CHECK(attr>0)
---
-ERROR: Table Constraints (CHECK) is not supported yet (1 : 30)
-CREATE TABLE test (attr INT) CHECK(attr>0)
-                             ^
-==
-
-CREATE TABLE test (attr INT) PARTITION BY HASH(attr) PARTITIONS 4
---
-CreateTableStatement[relation_name=test]
-+-attribute_list=
-| +-AttributeDefinition[name=attr,type=Int]
-+-partition_clause=
-  +-PartitionClause[partition_type=0]
-    +-Number of Partitions=NumericLiteral[numeric_string=4,float_like=false]
-    +-attribute_name_list=
-      +-String[value=attr]
-==
-
-# Empty partitioning attribute is not allowed
-CREATE TABLE test (attr INT) PARTITION BY HASH() PARTITIONS 4
---
-ERROR: syntax error (1 : 48)
-...TABLE test (attr INT) PARTITION BY HASH() PARTITIONS 4
-                                           ^
-==
-
-# Zero partitions not allowed
-CREATE TABLE test (attr INT) PARTITION BY HASH(attr) PARTITIONS 0
---
-ERROR: NUMBER OF PARITIONS must be between 1 and 64 (1 : 65)
-...INT) PARTITION BY HASH(attr) PARTITIONS 0
-                                           ^
-==
-
-# Missing number of partitions not allowed
-CREATE TABLE test (attr INT) PARTITION BY HASH(attr) PARTITIONS
---
-ERROR: syntax error (1 : 64)
-... INT) PARTITION BY HASH(attr) PARTITIONS
-                                           ^
-==
-
-# Missing PARTITIONS attribute not allowed
-CREATE TABLE test (attr INT) PARTITION BY HASH(attr)
---
-ERROR: syntax error (1 : 53)
-... test (attr INT) PARTITION BY HASH(attr)
-                                           ^
-==
-
-# Missing partitioning type not allowed
-CREATE TABLE test (attr INT) PARTITION BY (attr) PARTITIONS 4
---
-ERROR: syntax error (1 : 43)
-CREATE TABLE test (attr INT) PARTITION BY (attr) PARTITIONS 4
-                                          ^
-==
-
-# Number of partitions greater than 64 not allowed
-CREATE TABLE test (attr INT) PARTITION BY HASH(attr) PARTITIONS 65
---
-ERROR: NUMBER OF PARITIONS must be between 1 and 64 (1 : 65)
-...INT) PARTITION BY HASH(attr) PARTITIONS 65
-                                           ^
-==
-
-# Missing PARTITION BY clause not allowed
-CREATE TABLE test (attr INT) PARTITIONS 4
---
-ERROR: syntax error (1 : 30)
-CREATE TABLE test (attr INT) PARTITIONS 4
-                             ^
-==
-
-CREATE TABLE test (attr INT) WITH BLOCKPROPERTIES
-(TYPE rowstore)
---
-CreateTableStatement[relation_name=test]
-+-attribute_list=
-| +-AttributeDefinition[name=attr,type=Int]
-+-block_properties=
-  +-BlockProperties
-    +-block_property=KeyStringValue[key=TYPE]
-      +-value=String[value=rowstore]
-==
-
-CREATE TABLE test (attr INT) WITH BLOCKPROPERTIES
-(TYPE compressed_columnstore, SORT attr, COMPRESS ALL)
---
-CreateTableStatement[relation_name=test]
-+-attribute_list=
-| +-AttributeDefinition[name=attr,type=Int]
-+-block_properties=
-  +-BlockProperties
-    +-block_property=KeyStringValue[key=TYPE]
-    | +-value=String[value=compressed_columnstore]
-    +-block_property=KeyStringValue[key=SORT]
-    | +-value=String[value=attr]
-    +-block_property=KeyStringValue[key=COMPRESS]
-      +-value=String[value=ALL]
-==
-
-CREATE TABLE test (attr1 INT, attr2 INT) WITH BLOCKPROPERTIES
-(TYPE compressed_columnstore, SORT attr1, COMPRESS (attr1, attr2))
---
-CreateTableStatement[relation_name=test]
-+-attribute_list=
-| +-AttributeDefinition[name=attr1,type=Int]
-| +-AttributeDefinition[name=attr2,type=Int]
-+-block_properties=
-  +-BlockProperties
-    +-block_property=KeyStringValue[key=TYPE]
-    | +-value=String[value=compressed_columnstore]
-    +-block_property=KeyStringValue[key=SORT]
-    | +-value=String[value=attr1]
-    +-block_property=KeyStringList[key=COMPRESS]
-      +-value_list=
-        +-String[value=attr1]
-        +-String[value=attr2]
-==
-
-CREATE TABLE test (attr INT) WITH BLOCKPROPERTIES
-(TYPE rowstore, BLOCKSIZEMB 10);
---
-CreateTableStatement[relation_name=test]
-+-attribute_list=
-| +-AttributeDefinition[name=attr,type=Int]
-+-block_properties=
-  +-BlockProperties
-    +-block_property=KeyStringValue[key=TYPE]
-    | +-value=String[value=rowstore]
-    +-block_property=KeyIntegerValue[key=BLOCKSIZEMB]
-      +-value=NumericLiteral[numeric_string=10,float_like=false]

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/parser/tests/Delete.test
----------------------------------------------------------------------
diff --git a/parser/tests/Delete.test b/parser/tests/Delete.test
deleted file mode 100644
index da1c3f0..0000000
--- a/parser/tests/Delete.test
+++ /dev/null
@@ -1,50 +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.
-
-DELETE FROM test WHERE tb1=1
---
-DeleteStatement[relation_name=test]
-+-where_predicate=Equal
-  +-left_operand=AttributeReference[attribute_name=tb1]
-  +-right_operand=Literal
-    +-NumericLiteral[numeric_string=1,float_like=false]
-==
-
-DELETE FROM test
---
-DeleteStatement[relation_name=test]
-==
-
-DELETE FROM TABLE
---
-ERROR: syntax error (1 : 13)
-DELETE FROM TABLE
-            ^
-==
-
-DELETE FROM TABLE test
---
-ERROR: syntax error (1 : 13)
-DELETE FROM TABLE test
-            ^
-==
-
-DELETE FROM test1, test2
---
-ERROR: syntax error (1 : 18)
-DELETE FROM test1, test2
-                 ^

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/parser/tests/Drop.test
----------------------------------------------------------------------
diff --git a/parser/tests/Drop.test b/parser/tests/Drop.test
deleted file mode 100644
index 3735e5a..0000000
--- a/parser/tests/Drop.test
+++ /dev/null
@@ -1,27 +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.
-
-DROP TABLE test
---
-DropTableStatement[relation_name=test]
-==
-
-DROP TABLE TABLE
---
-ERROR: syntax error (1 : 12)
-DROP TABLE TABLE
-           ^

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/parser/tests/Index.test
----------------------------------------------------------------------
diff --git a/parser/tests/Index.test b/parser/tests/Index.test
deleted file mode 100644
index d97701b..0000000
--- a/parser/tests/Index.test
+++ /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.
-
-# Name of index is required
-CREATE INDEX ON test
---
-ERROR: syntax error (1 : 14)
-CREATE INDEX ON test
-             ^
-==
-
-# Empty-column list is not allowed
-CREATE INDEX test ON test ()
---
-ERROR: syntax error (1 : 28)
-CREATE INDEX test ON test ()
-                           ^
-==
-
-# Type of index is required
-CREATE INDEX test ON test
---
-ERROR: syntax error (1 : 26)
-CREATE INDEX test ON test
-                         ^
-==
-
-# Currently supported indices are csbtree, bloomfilter, and sma.
-# Unsupported indices should result in syntax error.
-CREATE INDEX test ON test USING arbitrary
---
-ERROR: syntax error (1 : 33)
-CREATE INDEX test ON test USING arbitrary
-                                ^
-==
-CREATE INDEX smaIndex ON test USING SMA
---
-CreateIndexStatement[index_name=smaIndex,relation_name=test,index_type=sma]
-==
-CREATE INDEX bloomIndex ON test USING BLOOMFILTER
---
-CreateIndexStatement[index_name=bloomIndex,relation_name=test,
-  index_type=bloom_filter]
-==
-CREATE INDEX csbIndex ON test USING CSBTREE
---
-CreateIndexStatement[index_name=csbIndex,relation_name=test,index_type=cs_b_tree]
-==
-# Bitweaving is supported on builds where it was included as a submodule. The
-# parser should create code to change the catalog, but on Block creation, no
-# index will be created.
-CREATE INDEX bwIndex ON test(int_col) USING bitweaving;
---
-CreateIndexStatement[index_name=bwIndex,relation_name=test,index_type=bitweaving]
-+-attribute_list=
-  +-AttributeReference[attribute_name=int_col]
-==
-CREATE INDEX bwhIndex ON test(int_col) USING bitweaving (TYPE H);
---
-CreateIndexStatement[index_name=bwhIndex,relation_name=test,
-  index_type=bitweaving]
-+-attribute_list=
-| +-AttributeReference[attribute_name=int_col]
-+-index_property_list=
-  +-IndexProperties
-    +-index_property=KeyStringValue[key=TYPE]
-      +-value=String[value=H]

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/parser/tests/Insert.test
----------------------------------------------------------------------
diff --git a/parser/tests/Insert.test b/parser/tests/Insert.test
deleted file mode 100644
index ef732b9..0000000
--- a/parser/tests/Insert.test
+++ /dev/null
@@ -1,71 +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.
-
-INSERT INTO test (attr1, attr2) VALUES (1, 2)
---
-ERROR: list of column names in INSERT statement is not supported yet (1 : 18)
-INSERT INTO test (attr1, attr2) VALUES (1, 2)
-                 ^
-==
-
-INSERT INTO test VALUES (1, -2, 3)
---
-InsertStatement[relation_name=test]
-+-tuple=
-  +-Literal
-  | +-NumericLiteral[numeric_string=1,float_like=false]
-  +-Literal
-  | +-NumericLiteral[numeric_string=-2,float_like=false]
-  +-Literal
-    +-NumericLiteral[numeric_string=3,float_like=false]
-==
-
-INSERT INTO test VALUES (1+1, 2*2, 3+1)
---
-ERROR: syntax error (1 : 27)
-INSERT INTO test VALUES (1+1, 2*2, 3+1)
-                          ^
-==
-
-INSERT INTO test VALUES (e'\'sdfs')
---
-InsertStatement[relation_name=test]
-+-tuple=
-  +-Literal
-    +-StringLiteral[value='sdfs]
-==
-
-INSERT INTO test VALUES ('\'sdfs')
---
-ERROR: syntax error (1 : 29)
-INSERT INTO test VALUES ('\'sdfs')
-                            ^
-==
-
-INSERT INTO test VALUES (e'\999');
---
-ERROR: bad numeric escape sequence (must be octal or hex) (1 : 32)
-INSERT INTO test VALUES (e'\999');
-                               ^
-==
-
-INSERT INTO test VALUES ('some_string');
---
-InsertStatement[relation_name=test]
-+-tuple=
-  +-Literal
-    +-StringLiteral[value=some_string]

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/parser/tests/Join.test
----------------------------------------------------------------------
diff --git a/parser/tests/Join.test b/parser/tests/Join.test
deleted file mode 100644
index 63edeb4..0000000
--- a/parser/tests/Join.test
+++ /dev/null
@@ -1,162 +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.
-
-SELECT *
-FROM a JOIN b ON a.w = b.w
-       JOIN c ON a.x = c.x
-       JOIN d ON a.y = d.y;
---
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectStar
-  +-from_clause=
-    +-JoinedTable[join_type=InnerJoin]
-      +-left_table=JoinedTable[join_type=InnerJoin]
-      | +-left_table=JoinedTable[join_type=InnerJoin]
-      | | +-left_table=TableReference[table=a]
-      | | +-right_table=TableReference[table=b]
-      | | +-join_predicate=Equal
-      | |   +-left_operand=AttributeReference[attribute_name=w,relation_name=a]
-      | |   +-right_operand=AttributeReference[attribute_name=w,relation_name=b]
-      | +-right_table=TableReference[table=c]
-      | +-join_predicate=Equal
-      |   +-left_operand=AttributeReference[attribute_name=x,relation_name=a]
-      |   +-right_operand=AttributeReference[attribute_name=x,relation_name=c]
-      +-right_table=TableReference[table=d]
-      +-join_predicate=Equal
-        +-left_operand=AttributeReference[attribute_name=y,relation_name=a]
-        +-right_operand=AttributeReference[attribute_name=y,relation_name=d]
-==
-
-SELECT *
-FROM a AS a1 JOIN b AS b1 ON a1.w = b1.w
-             JOIN c AS c1 ON a1.x = c1.x
-             JOIN d AS d1 ON a1.y = d1.y;
-WHERE a1.x > b1.x
-  AND a1.y > c1.y
-  AND a1.z > d1.z;
---
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectStar
-  +-from_clause=
-    +-JoinedTable[join_type=InnerJoin]
-      +-left_table=JoinedTable[join_type=InnerJoin]
-      | +-left_table=JoinedTable[join_type=InnerJoin]
-      | | +-left_table=TableReference[table=a]
-      | | | +-table_signature=TableSignature[table_alias=a1]
-      | | +-right_table=TableReference[table=b]
-      | | | +-table_signature=TableSignature[table_alias=b1]
-      | | +-join_predicate=Equal
-      | |   +-left_operand=AttributeReference[attribute_name=w,relation_name=a1]
-      | |   +-right_operand=AttributeReference[attribute_name=w,relation_name=b1]
-      | +-right_table=TableReference[table=c]
-      | | +-table_signature=TableSignature[table_alias=c1]
-      | +-join_predicate=Equal
-      |   +-left_operand=AttributeReference[attribute_name=x,relation_name=a1]
-      |   +-right_operand=AttributeReference[attribute_name=x,relation_name=c1]
-      +-right_table=TableReference[table=d]
-      | +-table_signature=TableSignature[table_alias=d1]
-      +-join_predicate=Equal
-        +-left_operand=AttributeReference[attribute_name=y,relation_name=a1]
-        +-right_operand=AttributeReference[attribute_name=y,relation_name=d1]
-==
-
-SELECT *
-FROM a LEFT OUTER JOIN b ON a.w = b.w
-       RIGHT OUTER JOIN c ON a.x = c.x
-       FULL OUTER JOIN d ON a.y = d.y;
---
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectStar
-  +-from_clause=
-    +-JoinedTable[join_type=FullOuterJoin]
-      +-left_table=JoinedTable[join_type=RightOuterJoin]
-      | +-left_table=JoinedTable[join_type=LeftOuterJoin]
-      | | +-left_table=TableReference[table=a]
-      | | +-right_table=TableReference[table=b]
-      | | +-join_predicate=Equal
-      | |   +-left_operand=AttributeReference[attribute_name=w,relation_name=a]
-      | |   +-right_operand=AttributeReference[attribute_name=w,relation_name=b]
-      | +-right_table=TableReference[table=c]
-      | +-join_predicate=Equal
-      |   +-left_operand=AttributeReference[attribute_name=x,relation_name=a]
-      |   +-right_operand=AttributeReference[attribute_name=x,relation_name=c]
-      +-right_table=TableReference[table=d]
-      +-join_predicate=Equal
-        +-left_operand=AttributeReference[attribute_name=y,relation_name=a]
-        +-right_operand=AttributeReference[attribute_name=y,relation_name=d]
-==
-
-SELECT *
-FROM a INNER JOIN b ON (a.w = b.w OR a.x > b.y);
---
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectStar
-  +-from_clause=
-    +-JoinedTable[join_type=InnerJoin]
-      +-left_table=TableReference[table=a]
-      +-right_table=TableReference[table=b]
-      +-join_predicate=Or
-        +-Equal
-        | +-left_operand=AttributeReference[attribute_name=w,relation_name=a]
-        | +-right_operand=AttributeReference[attribute_name=w,relation_name=b]
-        +-Greater
-          +-left_operand=AttributeReference[attribute_name=x,relation_name=a]
-          +-right_operand=AttributeReference[attribute_name=y,relation_name=b]
-==
-
-SELECT *
-FROM b LEFT JOIN c ON b.x = c.x JOIN d ON c.y = d.y;
---
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectStar
-  +-from_clause=
-    +-JoinedTable[join_type=InnerJoin]
-      +-left_table=JoinedTable[join_type=LeftOuterJoin]
-      | +-left_table=TableReference[table=b]
-      | +-right_table=TableReference[table=c]
-      | +-join_predicate=Equal
-      |   +-left_operand=AttributeReference[attribute_name=x,relation_name=b]
-      |   +-right_operand=AttributeReference[attribute_name=x,relation_name=c]
-      +-right_table=TableReference[table=d]
-      +-join_predicate=Equal
-        +-left_operand=AttributeReference[attribute_name=y,relation_name=c]
-        +-right_operand=AttributeReference[attribute_name=y,relation_name=d]
-==
-
-SELECT *
-FROM b LEFT JOIN (c JOIN d ON c.y = d.y) ON b.x = c.x;
---
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectStar
-  +-from_clause=
-    +-JoinedTable[join_type=LeftOuterJoin]
-      +-left_table=TableReference[table=b]
-      +-right_table=JoinedTable[join_type=InnerJoin]
-      | +-left_table=TableReference[table=c]
-      | +-right_table=TableReference[table=d]
-      | +-join_predicate=Equal
-      |   +-left_operand=AttributeReference[attribute_name=y,relation_name=c]
-      |   +-right_operand=AttributeReference[attribute_name=y,relation_name=d]
-      +-join_predicate=Equal
-        +-left_operand=AttributeReference[attribute_name=x,relation_name=b]
-        +-right_operand=AttributeReference[attribute_name=x,relation_name=c]

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/parser/tests/ParserTest.cpp
----------------------------------------------------------------------
diff --git a/parser/tests/ParserTest.cpp b/parser/tests/ParserTest.cpp
deleted file mode 100644
index cd2eaf4..0000000
--- a/parser/tests/ParserTest.cpp
+++ /dev/null
@@ -1,86 +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 <fstream>
-#include <memory>
-#include <set>
-#include <string>
-
-#include "parser/ParseStatement.hpp"
-#include "parser/SqlParserWrapper.hpp"
-#include "utility/Macros.hpp"
-#include "utility/textbased_test/TextBasedTest.hpp"
-#include "utility/textbased_test/TextBasedTestDriver.hpp"
-#include "utility/textbased_test/TextBasedTestRunner.hpp"
-
-#include "glog/logging.h"
-
-#include "gtest/gtest.h"
-
-namespace quickstep {
-
-class SqlParserTestRunner : public TextBasedTestRunner {
- public:
-  SqlParserTestRunner() {}
-
-  void runTestCase(const std::string& input, const std::set<std::string> &options, std::string *output) override {
-    CHECK(options.empty()) << "ParserTestRunner does not accept any options";
-
-    VLOG(4) << "Parse SQL: " << input;
-
-    sql_parser_.feedNextBuffer(new std::string(input));
-    ParseResult result = sql_parser_.getNextStatement();
-
-    if (result.condition != ParseResult::kSuccess) {
-      *output = result.error_message;
-    } else {
-      *output = result.parsed_statement->toString();
-    }
-  }
-
- private:
-  SqlParserWrapper sql_parser_;
-
-  DISALLOW_COPY_AND_ASSIGN(SqlParserTestRunner);
-};
-
-QUICKSTEP_GENERATE_TEXT_TEST(PARSE_SQL_TEST);
-
-}  // namespace quickstep
-
-int main(int argc, char** argv) {
-  google::InitGoogleLogging(argv[0]);
-
-  if (argc < 3) {
-    LOG(ERROR) << "Must have at least 2 arguments, but " << argc-1 << " are provided";
-  }
-
-  std::ifstream input_file(argv[1]);
-  CHECK(input_file.is_open()) << argv[1];
-  std::unique_ptr<quickstep::TextBasedTestRunner> test_runner(new quickstep::SqlParserTestRunner);
-  quickstep::test_driver.reset(new quickstep::TextBasedTestDriver(&input_file, test_runner.get()));
-
-  ::testing::InitGoogleTest(&argc, argv);
-  const int success = RUN_ALL_TESTS();
-  if (success != 0) {
-    quickstep::test_driver->writeActualOutputToFile(argv[2]);
-  }
-
-  return success;
-}


[18/51] [abbrv] [partial] incubator-quickstep git commit: remove c++ files

Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_execution/QueryExecutionTypedefs.hpp
----------------------------------------------------------------------
diff --git a/query_execution/QueryExecutionTypedefs.hpp b/query_execution/QueryExecutionTypedefs.hpp
deleted file mode 100644
index fb9a9d6..0000000
--- a/query_execution/QueryExecutionTypedefs.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_EXECUTION_QUERY_EXECUTION_TYPEDEFS_HPP_
-#define QUICKSTEP_QUERY_EXECUTION_QUERY_EXECUTION_TYPEDEFS_HPP_
-
-#include <cstddef>
-#include <unordered_map>
-#include <vector>
-
-#include "query_optimizer/QueryOptimizerConfig.h"  // For QUICKSTEP_DISTRIBUTED
-#include "threading/ThreadIDBasedMap.hpp"
-
-#include "tmb/address.h"
-#include "tmb/id_typedefs.h"
-#include "tmb/message_style.h"
-#include "tmb/pure_memory_message_bus.h"
-#include "tmb/tagged_message.h"
-
-namespace quickstep {
-
-/** \addtogroup QueryExecution
- *  @{
- */
-
-typedef tmb::Address Address;
-typedef tmb::AnnotatedMessage AnnotatedMessage;
-typedef tmb::MessageBus MessageBus;
-typedef tmb::MessageStyle MessageStyle;
-typedef tmb::Priority Priority;
-typedef tmb::PureMemoryMessageBus<false> MessageBusImpl;
-typedef tmb::TaggedMessage TaggedMessage;
-typedef tmb::client_id client_id;
-typedef tmb::message_type_id message_type_id;
-
-using ClientIDMap = ThreadIDBasedMap<client_id,
-                                     'C',
-                                     'l',
-                                     'i',
-                                     'e',
-                                     'n',
-                                     't',
-                                     'I',
-                                     'D',
-                                     'M',
-                                     'a',
-                                     'p'>;
-
-// We sort the following message types in the order of a life cycle of a query.
-enum QueryExecutionMessageType : message_type_id {
-  kAdmitRequestMessage = 0,  // Requesting a query (or queries) to be admitted, from
-                             // the main thread to Foreman.
-  kWorkOrderMessage,  // From Foreman to Worker.
-  kWorkOrderCompleteMessage,  // From Worker to Foreman.
-  kCatalogRelationNewBlockMessage,  // From InsertDestination to Foreman.
-  kDataPipelineMessage,  // From InsertDestination or some WorkOrders to Foreman.
-  kWorkOrderFeedbackMessage,  // From some WorkOrders to Foreman on behalf of
-                              // their corresponding RelationalOperators.
-  kRebuildWorkOrderMessage,  // From Foreman to Worker.
-  kRebuildWorkOrderCompleteMessage,  // From Worker to Foreman.
-  kWorkloadCompletionMessage,  // From Foreman to main thread.
-  kPoisonMessage,  // From the main thread to Foreman and Workers.
-
-#ifdef QUICKSTEP_DISTRIBUTED
-  kShiftbossRegistrationMessage,  // From Shiftboss to Foreman.
-  kShiftbossRegistrationResponseMessage,  // From Foreman to Shiftboss, or from
-                                          // Shiftboss to Worker.
-  kQueryInitiateMessage,  // From Foreman to Shiftboss.
-  kQueryInitiateResponseMessage,  // From Shiftboss to Foreman.
-
-  kInitiateRebuildMessage,  // From Foreman to Shiftboss.
-  kInitiateRebuildResponseMessage,  // From Shiftboss to Foreman.
-
-  kQueryTeardownMessage,  // From Foreman to Shiftboss.
-
-  kSaveQueryResultMessage,  // From Foreman to Shiftboss.
-  kSaveQueryResultResponseMessage,  // From Shiftboss to Foreman.
-
-  // From Foreman to CLI.
-  kQueryExecutionSuccessMessage,
-
-  // BlockLocator related messages, sorted in a life cycle of StorageManager
-  // with a unique block domain.
-  kBlockDomainRegistrationMessage,  // From Worker to BlockLocator.
-  kBlockDomainRegistrationResponseMessage,  // From BlockLocator to Worker.
-  kAddBlockLocationMessage,  // From StorageManager to BlockLocator.
-  kDeleteBlockLocationMessage,  // From StorageManager to BlockLocator.
-  kLocateBlockMessage,  // From StorageManager to BlockLocator.
-  kLocateBlockResponseMessage,  // From BlockLocator to StorageManager.
-  kGetPeerDomainNetworkAddressesMessage,  // From StorageManager to BlockLocator.
-  kGetPeerDomainNetworkAddressesResponseMessage,  // From BlockLocator to StorageManager.
-  kBlockDomainUnregistrationMessage,  // From StorageManager to BlockLocator.
-#endif
-};
-
-// WorkOrder profiling data structures.
-// Profiling record for an individual work order.
-struct WorkOrderTimeEntry {
-  std::size_t worker_id;
-  std::size_t operator_id;
-  std::size_t start_time;  // Epoch time measured in microseconds
-  std::size_t end_time;  // Epoch time measured in microseconds
-};
-// Key = query ID.
-// Value = vector of work order profiling records.
-typedef std::unordered_map<std::size_t, std::vector<WorkOrderTimeEntry>> WorkOrderTimeRecorder;
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_QUERY_EXECUTION_QUERY_EXECUTION_TYPEDEFS_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_execution/QueryExecutionUtil.hpp
----------------------------------------------------------------------
diff --git a/query_execution/QueryExecutionUtil.hpp b/query_execution/QueryExecutionUtil.hpp
deleted file mode 100644
index b41965c..0000000
--- a/query_execution/QueryExecutionUtil.hpp
+++ /dev/null
@@ -1,168 +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_EXECUTION_QUERY_EXECUTION_UTIL_HPP_
-#define QUICKSTEP_QUERY_EXECUTION_QUERY_EXECUTION_UTIL_HPP_
-
-#include <cstddef>
-#include <memory>
-#include <utility>
-
-#include "query_execution/AdmitRequestMessage.hpp"
-#include "query_execution/QueryExecutionTypedefs.hpp"
-#include "utility/Macros.hpp"
-
-#include "glog/logging.h"
-
-#include "tmb/address.h"
-#include "tmb/id_typedefs.h"
-#include "tmb/message_bus.h"
-#include "tmb/message_style.h"
-#include "tmb/tagged_message.h"
-
-namespace quickstep {
-
-class QueryHandle;
-
-/** \addtogroup QueryExecution
- *  @{
- */
-
-/**
- * @brief A static class for reusable methods in query_execution module.
- **/
-class QueryExecutionUtil {
- public:
-  /**
-   * @brief Send a TMB message to a single receiver.
-   *
-   * @param bus A pointer to the TMB.
-   * @param sender_id The client ID of the sender.
-   * @param receiver_id The client ID of the receiver.
-   * @param tagged_message A moved-from reference to the tagged message.
-   *
-   * @return A status code indicating the result of the message getting sent.
-   *         The caller should ensure that the status is SendStatus::kOK.
-   **/
-  static tmb::MessageBus::SendStatus SendTMBMessage(
-      tmb::MessageBus *bus,
-      tmb::client_id sender_id,
-      tmb::client_id receiver_id,
-      tmb::TaggedMessage &&tagged_message) {  // NOLINT(whitespace/operators)
-    tmb::Address receiver_address;
-    receiver_address.AddRecipient(receiver_id);
-
-    tmb::MessageStyle single_receiver_style;
-    return bus->Send(sender_id,
-                     receiver_address,
-                     single_receiver_style,
-                     std::move(tagged_message));
-  }
-
-  /**
-   * @brief Construct and send an AdmitRequestMessage from a given sender to a
-   *        given recipient.
-   *
-   * @param sender_id The TMB client ID of the sender.
-   * @param receiver_id The TMB client ID of the receiver.
-   * @param query_handle The QueryHandle used in the AdmitRequestMessage.
-   * @param bus A pointer to the TMB.
-   * @param tagged_message A moved from reference to the tagged message.
-   *
-   * @return A status code indicating the result of the message delivery.
-   *         The caller should ensure that the status is SendStatus::kOK.
-   **/
-  static tmb::MessageBus::SendStatus ConstructAndSendAdmitRequestMessage(
-      const tmb::client_id sender_id,
-      const tmb::client_id receiver_id,
-      QueryHandle *query_handle,
-      tmb::MessageBus *bus) {
-    std::unique_ptr<AdmitRequestMessage> request_message(
-        new AdmitRequestMessage(query_handle));
-    const std::size_t size_of_request_msg = sizeof(*request_message);
-    tmb::TaggedMessage admit_tagged_message(
-        request_message.release(), size_of_request_msg, kAdmitRequestMessage);
-
-    return QueryExecutionUtil::SendTMBMessage(
-        bus, sender_id, receiver_id, std::move(admit_tagged_message));
-  }
-
-  /**
-   * @brief Receive a query completion message.
-   *
-   * @param receiver_id The TMB client ID of the receiver thread.
-   * @param bus A pointer to the TMB.
-   *
-   * @note Right now the query completion message is of no interest to the
-   *       caller. In the future, if this message needs to be fetched, make this
-   *       function return the TaggedMessage.
-   **/
-  static void ReceiveQueryCompletionMessage(const tmb::client_id receiver_id,
-                                            tmb::MessageBus *bus) {
-    const tmb::AnnotatedMessage annotated_msg =
-        bus->Receive(receiver_id, 0, true);
-    const tmb::TaggedMessage &tagged_message = annotated_msg.tagged_message;
-    DCHECK_EQ(kWorkloadCompletionMessage, tagged_message.message_type());
-  }
-
-  static void BroadcastMessage(const tmb::client_id sender_id,
-                               const tmb::Address &addresses,
-                               tmb::TaggedMessage &&tagged_message,  // NOLINT(whitespace/operators)
-                               tmb::MessageBus *bus) {
-    // The sender broadcasts the given message to all 'addresses'.
-    tmb::MessageStyle style;
-    style.Broadcast(true);
-
-    const tmb::MessageBus::SendStatus send_status =
-        bus->Send(sender_id, addresses, style, std::move(tagged_message));
-    CHECK(send_status == tmb::MessageBus::SendStatus::kOK);
-  }
-
-  static void BroadcastPoisonMessage(const tmb::client_id sender_id, tmb::MessageBus *bus) {
-    // Terminate all threads.
-    // The sender thread broadcasts poison message to the workers and foreman.
-    // Each worker dies after receiving poison message. The order of workers'
-    // death is irrelavant.
-    tmb::MessageStyle style;
-    style.Broadcast(true);
-    tmb::Address address;
-    address.All(true);
-    tmb::TaggedMessage poison_tagged_message(kPoisonMessage);
-
-    DLOG(INFO) << "TMB client ID " << sender_id
-               << " broadcast PoisonMessage (typed '" << kPoisonMessage << "') to all";
-    const tmb::MessageBus::SendStatus send_status = bus->Send(
-        sender_id, address, style, std::move(poison_tagged_message));
-    CHECK(send_status == tmb::MessageBus::SendStatus::kOK);
-  }
-
- private:
-  /**
-   * @brief Constructor. Made private to avoid instantiation.
-   **/
-  QueryExecutionUtil();
-
-  DISALLOW_COPY_AND_ASSIGN(QueryExecutionUtil);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_QUERY_EXECUTION_QUERY_EXECUTION_UTIL_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_execution/QueryManagerBase.cpp
----------------------------------------------------------------------
diff --git a/query_execution/QueryManagerBase.cpp b/query_execution/QueryManagerBase.cpp
deleted file mode 100644
index 8e37da8..0000000
--- a/query_execution/QueryManagerBase.cpp
+++ /dev/null
@@ -1,228 +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_execution/QueryManagerBase.hpp"
-
-#include <memory>
-#include <utility>
-#include <vector>
-
-#include "catalog/CatalogTypedefs.hpp"
-#include "query_execution/QueryContext.hpp"
-#include "query_optimizer/QueryHandle.hpp"
-#include "query_optimizer/QueryPlan.hpp"
-#include "relational_operators/WorkOrder.hpp"
-#include "storage/StorageBlockInfo.hpp"
-
-#include "glog/logging.h"
-
-using std::pair;
-
-namespace quickstep {
-
-QueryManagerBase::QueryManagerBase(QueryHandle *query_handle)
-    : query_handle_(DCHECK_NOTNULL(query_handle)),
-      query_id_(query_handle->query_id()),
-      query_dag_(DCHECK_NOTNULL(
-          DCHECK_NOTNULL(query_handle->getQueryPlanMutable())->getQueryPlanDAGMutable())),
-      num_operators_in_dag_(query_dag_->size()),
-      output_consumers_(num_operators_in_dag_),
-      blocking_dependencies_(num_operators_in_dag_),
-      query_exec_state_(new QueryExecutionState(num_operators_in_dag_)) {
-  for (dag_node_index node_index = 0;
-       node_index < num_operators_in_dag_;
-       ++node_index) {
-    const QueryContext::insert_destination_id insert_destination_index =
-        query_dag_->getNodePayload(node_index).getInsertDestinationID();
-    if (insert_destination_index != QueryContext::kInvalidInsertDestinationId) {
-      // Rebuild is necessary whenever InsertDestination is present.
-      query_exec_state_->setRebuildRequired(node_index);
-      query_exec_state_->setRebuildStatus(node_index, 0, false);
-    }
-
-    for (const pair<dag_node_index, bool> &dependent_link :
-         query_dag_->getDependents(node_index)) {
-      const dag_node_index dependent_op_index = dependent_link.first;
-      if (!query_dag_->getLinkMetadata(node_index, dependent_op_index)) {
-        // The link is not a pipeline-breaker. Streaming of blocks is possible
-        // between these two operators.
-        output_consumers_[node_index].push_back(dependent_op_index);
-      } else {
-        // The link is a pipeline-breaker. Streaming of blocks is not possible
-        // between these two operators.
-        blocking_dependencies_[dependent_op_index].push_back(node_index);
-      }
-    }
-  }
-}
-
-QueryManagerBase::QueryStatusCode QueryManagerBase::queryStatus(
-    const dag_node_index op_index) {
-  // As kQueryExecuted takes precedence over kOperatorExecuted, we first check
-  // whether the query has finished its execution.
-  if (query_exec_state_->hasQueryExecutionFinished()) {
-    return QueryStatusCode::kQueryExecuted;
-  }
-
-  if (query_exec_state_->hasExecutionFinished(op_index)) {
-    return QueryStatusCode::kOperatorExecuted;
-  }
-
-  return QueryStatusCode::kNone;
-}
-
-void QueryManagerBase::processFeedbackMessage(
-    const dag_node_index op_index, const WorkOrder::FeedbackMessage &msg) {
-  RelationalOperator *op =
-      query_dag_->getNodePayloadMutable(op_index);
-  op->receiveFeedbackMessage(msg);
-}
-
-void QueryManagerBase::processWorkOrderCompleteMessage(
-    const dag_node_index op_index) {
-  query_exec_state_->decrementNumQueuedWorkOrders(op_index);
-
-  // Check if new work orders are available and fetch them if so.
-  fetchNormalWorkOrders(op_index);
-
-  if (checkRebuildRequired(op_index)) {
-    if (checkNormalExecutionOver(op_index)) {
-      if (!checkRebuildInitiated(op_index)) {
-        if (initiateRebuild(op_index)) {
-          // Rebuild initiated and completed right away.
-          markOperatorFinished(op_index);
-        } else {
-          // Rebuild under progress.
-        }
-      } else if (checkRebuildOver(op_index)) {
-        // Rebuild was under progress and now it is over.
-        markOperatorFinished(op_index);
-      }
-    } else {
-      // Normal execution under progress for this operator.
-    }
-  } else if (checkOperatorExecutionOver(op_index)) {
-    // Rebuild not required for this operator and its normal execution is
-    // complete.
-    markOperatorFinished(op_index);
-  }
-
-  for (const pair<dag_node_index, bool> &dependent_link :
-       query_dag_->getDependents(op_index)) {
-    const dag_node_index dependent_op_index = dependent_link.first;
-    if (checkAllBlockingDependenciesMet(dependent_op_index)) {
-      // Process the dependent operator (of the operator whose WorkOrder
-      // was just executed) for which all the dependencies have been met.
-      processOperator(dependent_op_index, true);
-    }
-  }
-}
-
-void QueryManagerBase::processRebuildWorkOrderCompleteMessage(const dag_node_index op_index) {
-  query_exec_state_->decrementNumRebuildWorkOrders(op_index);
-
-  if (checkRebuildOver(op_index)) {
-    markOperatorFinished(op_index);
-
-    for (const pair<dag_node_index, bool> &dependent_link :
-         query_dag_->getDependents(op_index)) {
-      const dag_node_index dependent_op_index = dependent_link.first;
-      if (checkAllBlockingDependenciesMet(dependent_op_index)) {
-        processOperator(dependent_op_index, true);
-      }
-    }
-  }
-}
-
-void QueryManagerBase::processOperator(const dag_node_index index,
-                                       const bool recursively_check_dependents) {
-  if (fetchNormalWorkOrders(index)) {
-    // Fetched work orders. Return to wait for the generated work orders to
-    // execute, and skip the execution-finished checks.
-    return;
-  }
-
-  if (checkNormalExecutionOver(index)) {
-    if (checkRebuildRequired(index)) {
-      if (!checkRebuildInitiated(index)) {
-        // Rebuild hasn't started, initiate it.
-        if (initiateRebuild(index)) {
-          // Rebuild initiated and completed right away.
-          markOperatorFinished(index);
-        } else {
-          // Rebuild WorkOrders have been generated.
-          return;
-        }
-      } else if (checkRebuildOver(index)) {
-        // Rebuild had been initiated and it is over.
-        markOperatorFinished(index);
-      }
-    } else {
-      // Rebuild is not required and normal execution over, mark finished.
-      markOperatorFinished(index);
-    }
-    // If we reach here, that means the operator has been marked as finished.
-    if (recursively_check_dependents) {
-      for (const pair<dag_node_index, bool> &dependent_link :
-           query_dag_->getDependents(index)) {
-        const dag_node_index dependent_op_index = dependent_link.first;
-        if (checkAllBlockingDependenciesMet(dependent_op_index)) {
-          processOperator(dependent_op_index, true);
-        }
-      }
-    }
-  }
-}
-
-void QueryManagerBase::processDataPipelineMessage(const dag_node_index op_index,
-                                                  const block_id block,
-                                                  const relation_id rel_id) {
-  for (const dag_node_index consumer_index :
-       output_consumers_[op_index]) {
-    // Feed the streamed block to the consumer. Note that 'output_consumers_'
-    // only contain those dependents of operator with index = op_index which are
-    // eligible to receive streamed input.
-    query_dag_->getNodePayloadMutable(consumer_index)->feedInputBlock(block, rel_id);
-    // Because of the streamed input just fed, check if there are any new
-    // WorkOrders available and if so, fetch them.
-    fetchNormalWorkOrders(consumer_index);
-  }
-}
-
-void QueryManagerBase::markOperatorFinished(const dag_node_index index) {
-  query_exec_state_->setExecutionFinished(index);
-
-  RelationalOperator *op = query_dag_->getNodePayloadMutable(index);
-  op->updateCatalogOnCompletion();
-
-  const relation_id output_rel = op->getOutputRelationID();
-  for (const pair<dag_node_index, bool> &dependent_link : query_dag_->getDependents(index)) {
-    const dag_node_index dependent_op_index = dependent_link.first;
-    RelationalOperator *dependent_op = query_dag_->getNodePayloadMutable(dependent_op_index);
-    // Signal dependent operator that current operator is done feeding input blocks.
-    if (output_rel >= 0) {
-      dependent_op->doneFeedingInputBlocks(output_rel);
-    }
-    if (checkAllBlockingDependenciesMet(dependent_op_index)) {
-      dependent_op->informAllBlockingDependenciesMet();
-    }
-  }
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_execution/QueryManagerBase.hpp
----------------------------------------------------------------------
diff --git a/query_execution/QueryManagerBase.hpp b/query_execution/QueryManagerBase.hpp
deleted file mode 100644
index a274742..0000000
--- a/query_execution/QueryManagerBase.hpp
+++ /dev/null
@@ -1,321 +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_EXECUTION_QUERY_MANAGER_BASE_HPP_
-#define QUICKSTEP_QUERY_EXECUTION_QUERY_MANAGER_BASE_HPP_
-
-#include <cstddef>
-#include <memory>
-#include <vector>
-
-#include "catalog/CatalogTypedefs.hpp"
-#include "query_execution/QueryExecutionState.hpp"
-#include "relational_operators/RelationalOperator.hpp"
-#include "relational_operators/WorkOrder.hpp"
-#include "storage/StorageBlockInfo.hpp"
-#include "utility/DAG.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-
-class QueryHandle;
-
-/** \addtogroup QueryExecution
- *  @{
- */
-
-/**
- * @brief A base class that manages the execution of a query including
- *        generation of new work orders, and keeping track of the query
- *        exection state.
- **/
-class QueryManagerBase {
- public:
-  typedef DAG<RelationalOperator, bool>::size_type_nodes dag_node_index;
-
-  /**
-   * @brief Return codes for queryStatus() function.
-   *
-   * @note When both operator and query get executed, kQueryExecuted takes
-   *       precedence over kOperatorExecuted.
-   **/
-  enum class QueryStatusCode {
-    kOperatorExecuted = 0,  // An operator in the query finished execution.
-    kQueryExecuted,         // The query got executed.
-    kNone                   // None of the above.
-  };
-
-  /**
-   * @brief Constructor.
-   *
-   * @param query_handle The QueryHandle object for this query.
-   **/
-  explicit QueryManagerBase(QueryHandle *query_handle);
-
-  /**
-   * @brief Virtual destructor.
-   **/
-  virtual ~QueryManagerBase() {}
-
-  /**
-   * @brief Get the query handle.
-   **/
-  const QueryHandle* query_handle() const {
-    return query_handle_;
-  }
-
-  /**
-   * @brief Get the QueryExecutionState for this query.
-   **/
-  inline const QueryExecutionState& getQueryExecutionState() const {
-    return *query_exec_state_;
-  }
-
-  /**
-   * @brief Process the received WorkOrder complete message.
-   *
-   * @param op_index The index of the specified operator node in the query DAG
-   *        for the completed WorkOrder.
-   **/
-  void processWorkOrderCompleteMessage(const dag_node_index op_index);
-
-  /**
-   * @brief Process the received RebuildWorkOrder complete message.
-   *
-   * @param op_index The index of the specified operator node in the query DAG
-   *        for the completed RebuildWorkOrder.
-   **/
-  void processRebuildWorkOrderCompleteMessage(const dag_node_index op_index);
-
-  /**
-   * @brief Process the received data pipeline message.
-   *
-   * @param op_index The index of the specified operator node in the query DAG
-   *        for the pipelining block.
-   * @param block The block id.
-   * @param rel_id The ID of the relation that produced 'block'.
-   **/
-  void processDataPipelineMessage(const dag_node_index op_index,
-                                  const block_id block,
-                                  const relation_id rel_id);
-
-  /**
-   * @brief Fetch all work orders currently available in relational operator and
-   *        store them internally.
-   *
-   * @param index The index of the relational operator to be processed in the
-   *        query plan DAG.
-   *
-   * @return Whether any work order was generated by op.
-   **/
-  virtual bool fetchNormalWorkOrders(const dag_node_index index) = 0;
-
-  /**
-   * @brief Process the received work order feedback message and notify
-   *        relational operator.
-   *
-   * @param op_index The index of the specified operator node in the query DAG
-   *        for the feedback message.
-   * @param message Feedback message from work order.
-   **/
-  void processFeedbackMessage(const dag_node_index op_index,
-                              const WorkOrder::FeedbackMessage &message);
-
-  /**
-   * @brief Get the query status after processing an incoming message.
-   *
-   * @param op_index The index of the specified operator node in the query DAG
-   *        for the incoming message.
-   *
-   * @return QueryStatusCode as determined after the message is processed.
-   **/
-  QueryStatusCode queryStatus(const dag_node_index op_index);
-
- protected:
-  /**
-   * @brief Process a current relational operator: Get its workorders and store
-   *        them in the WorkOrdersContainer for this query. If the operator can
-   *        be marked as done, do so.
-   *
-   * @param index The index of the relational operator to be processed in the
-   *        query plan DAG.
-   * @param recursively_check_dependents If an operator is done, should we
-   *        call processOperator on its dependents recursively.
-   **/
-  void processOperator(const dag_node_index index,
-                       const bool recursively_check_dependents);
-
-  /**
-   * @brief This function does the following things:
-   *        1. Mark the given relational operator as "done".
-   *        2. For all the dependents of this operator, check if all of their
-   *        blocking dependencies are met. If so inform them that the blocking
-   *        dependencies are met.
-   *        3. Check if the given operator is done producing output. If it's
-   *        done, inform the dependents that they won't receive input anymore
-   *        from the given operator.
-   *
-   * @param index The index of the given relational operator in the DAG.
-   **/
-  void markOperatorFinished(const dag_node_index index);
-
-  /**
-   * @brief Check if all the dependencies of the node at specified index have
-   *        finished their execution.
-   *
-   * @note This function's true return value is a pre-requisite for calling
-   *       getRebuildWorkOrders()
-   *
-   * @param node_index The index of the specified node in the query DAG.
-   *
-   * @return True if all the dependencies have finished their execution. False
-   *         otherwise.
-   **/
-  inline bool checkAllDependenciesMet(const dag_node_index node_index) const {
-    for (const dag_node_index dependency_index :
-         query_dag_->getDependencies(node_index)) {
-      // If at least one of the dependencies is not met, return false.
-      if (!query_exec_state_->hasExecutionFinished(dependency_index)) {
-        return false;
-      }
-    }
-    return true;
-  }
-
-  /**
-   * @brief Check if all the blocking dependencies of the node at specified
-   *        index have finished their execution.
-   *
-   * @note A blocking dependency is the one which is pipeline breaker. Output of
-   *       a dependency can't be streamed to its dependent if the link between
-   *       them is pipeline breaker.
-   *
-   * @param node_index The index of the specified node in the query DAG.
-   *
-   * @return True if all the blocking dependencies have finished their
-   *         execution. False otherwise.
-   **/
-  inline bool checkAllBlockingDependenciesMet(
-      const dag_node_index node_index) const {
-    for (const dag_node_index blocking_dependency_index :
-         blocking_dependencies_[node_index]) {
-      if (!query_exec_state_->hasExecutionFinished(
-              blocking_dependency_index)) {
-        return false;
-      }
-    }
-    return true;
-  }
-
-  /**
-   * @brief Check if the execution of the given operator is over.
-   *
-   * @param index The index of the given operator in the DAG.
-   *
-   * @return True if the execution of the given operator is over, false
-   *         otherwise.
-   **/
-  inline bool checkOperatorExecutionOver(const dag_node_index index) const {
-    return this->checkNormalExecutionOver(index) &&
-           (!checkRebuildRequired(index) || this->checkRebuildOver(index));
-  }
-
-  /**
-   * @brief Check if the rebuild operation is required for a given operator.
-   *
-   * @param index The index of the given operator in the DAG.
-   *
-   * @return True if the rebuild operation is required, false otherwise.
-   **/
-  inline bool checkRebuildRequired(const dag_node_index index) const {
-    return query_exec_state_->isRebuildRequired(index);
-  }
-
-  /**
-   * @brief Check if the rebuild operation for a given operator has been
-   *        initiated.
-   *
-   * @param index The index of the given operator in the DAG.
-   *
-   * @return True if the rebuild operation has been initiated, false otherwise.
-   **/
-  inline bool checkRebuildInitiated(const dag_node_index index) const {
-    return query_exec_state_->hasRebuildInitiated(index);
-  }
-
-  const QueryHandle *query_handle_;
-
-  const std::size_t query_id_;
-
-  DAG<RelationalOperator, bool> *query_dag_;  // Owned by 'query_handle_'.
-  const dag_node_index num_operators_in_dag_;
-
-  // For all nodes, store their receiving dependents.
-  std::vector<std::vector<dag_node_index>> output_consumers_;
-
-  // For all nodes, store their pipeline breaking dependencies (if any).
-  std::vector<std::vector<dag_node_index>> blocking_dependencies_;
-
-  std::unique_ptr<QueryExecutionState> query_exec_state_;
-
- private:
-  /**
-   * @brief Check if the given operator's normal execution is over.
-   *
-   * @note The conditions for a given operator's normal execution to get over:
-   *       1. All of its  normal (i.e. non rebuild) WorkOrders have finished
-   *       execution.
-   *       2. The operator is done generating work orders.
-   *       3. All of the dependencies of the given operator have been met.
-   *
-   * @param index The index of the given operator in the DAG.
-   *
-   * @return True if the normal execution of the given operator is over, false
-   *         otherwise.
-   **/
-  virtual bool checkNormalExecutionOver(const dag_node_index index) const = 0;
-
-  /**
-   * @brief Initiate the rebuild process for partially filled blocks generated
-   *        during the execution of the given operator.
-   *
-   * @param index The index of the given operator in the DAG.
-   *
-   * @return True if the rebuild is over immediately, i.e. the operator didn't
-   *         generate any rebuild WorkOrders, false otherwise.
-   **/
-  virtual bool initiateRebuild(const dag_node_index index) = 0;
-
-  /**
-   * @brief Check if the rebuild operation for a given operator is over.
-   *
-   * @param index The index of the given operator in the DAG.
-   *
-   * @return True if the rebuild operation is over, false otherwise.
-   **/
-  virtual bool checkRebuildOver(const dag_node_index index) const = 0;
-
-  DISALLOW_COPY_AND_ASSIGN(QueryManagerBase);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_QUERY_EXECUTION_QUERY_MANAGER_BASE_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_execution/QueryManagerDistributed.cpp
----------------------------------------------------------------------
diff --git a/query_execution/QueryManagerDistributed.cpp b/query_execution/QueryManagerDistributed.cpp
deleted file mode 100644
index 7d45933..0000000
--- a/query_execution/QueryManagerDistributed.cpp
+++ /dev/null
@@ -1,187 +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_execution/QueryManagerDistributed.hpp"
-
-#include <cstddef>
-#include <cstdlib>
-#include <memory>
-#include <utility>
-
-#include "query_execution/QueryContext.hpp"
-#include "query_execution/QueryExecutionMessages.pb.h"
-#include "query_execution/QueryExecutionTypedefs.hpp"
-#include "query_execution/QueryExecutionUtil.hpp"
-#include "query_execution/ShiftbossDirectory.hpp"
-#include "query_execution/WorkOrderProtosContainer.hpp"
-#include "relational_operators/RelationalOperator.hpp"
-#include "relational_operators/WorkOrder.pb.h"
-#include "utility/DAG.hpp"
-
-#include "glog/logging.h"
-
-#include "tmb/id_typedefs.h"
-
-using std::free;
-using std::malloc;
-using std::move;
-using std::size_t;
-using std::unique_ptr;
-
-namespace quickstep {
-
-QueryManagerDistributed::QueryManagerDistributed(QueryHandle *query_handle,
-                                                 const ShiftbossDirectory *shiftboss_directory,
-                                                 const tmb::client_id foreman_client_id,
-                                                 tmb::MessageBus *bus)
-    : QueryManagerBase(query_handle),
-      shiftboss_directory_(shiftboss_directory),
-      foreman_client_id_(foreman_client_id),
-      bus_(bus),
-      normal_workorder_protos_container_(
-          new WorkOrderProtosContainer(num_operators_in_dag_)) {
-  // Collect all the workorders from all the relational operators in the DAG.
-  for (dag_node_index index = 0; index < num_operators_in_dag_; ++index) {
-    if (checkAllBlockingDependenciesMet(index)) {
-      query_dag_->getNodePayloadMutable(index)->informAllBlockingDependenciesMet();
-      processOperator(index, false);
-    }
-  }
-}
-
-serialization::WorkOrderMessage* QueryManagerDistributed::getNextWorkOrderMessage(
-    const dag_node_index start_operator_index) {
-  // Default policy: Operator with lowest index first.
-  size_t num_operators_checked = 0;
-  for (dag_node_index index = start_operator_index;
-       num_operators_checked < num_operators_in_dag_;
-       index = (index + 1) % num_operators_in_dag_, ++num_operators_checked) {
-    if (query_exec_state_->hasExecutionFinished(index)) {
-      continue;
-    }
-    unique_ptr<serialization::WorkOrder> work_order_proto(
-        normal_workorder_protos_container_->getWorkOrderProto(index));
-    if (work_order_proto != nullptr) {
-      query_exec_state_->incrementNumQueuedWorkOrders(index);
-
-      unique_ptr<serialization::WorkOrderMessage> message_proto(new serialization::WorkOrderMessage);
-      message_proto->set_query_id(query_id_);
-      message_proto->set_operator_index(index);
-      message_proto->mutable_work_order()->MergeFrom(*work_order_proto);
-
-      return message_proto.release();
-    }
-  }
-  // No normal WorkOrder protos available right now.
-  return nullptr;
-}
-
-bool QueryManagerDistributed::fetchNormalWorkOrders(const dag_node_index index) {
-  bool generated_new_workorder_protos = false;
-  if (!query_exec_state_->hasDoneGenerationWorkOrders(index)) {
-    // Do not fetch any work units until all blocking dependencies are met.
-    // The releational operator is not aware of blocking dependencies for
-    // uncorrelated scalar queries.
-    if (!checkAllBlockingDependenciesMet(index)) {
-      return false;
-    }
-    const size_t num_pending_workorder_protos_before =
-        normal_workorder_protos_container_->getNumWorkOrderProtos(index);
-    const bool done_generation =
-        query_dag_->getNodePayloadMutable(index)
-            ->getAllWorkOrderProtos(normal_workorder_protos_container_.get());
-    if (done_generation) {
-      query_exec_state_->setDoneGenerationWorkOrders(index);
-    }
-
-    // TODO(shoban): It would be a good check to see if operator is making
-    // useful progress, i.e., the operator either generates work orders to
-    // execute or still has pending work orders executing. However, this will not
-    // work if Foreman polls operators without feeding data. This check can be
-    // enabled, if Foreman is refactored to call getAllWorkOrders() only when
-    // pending work orders are completed or new input blocks feed.
-
-    generated_new_workorder_protos =
-        (num_pending_workorder_protos_before <
-         normal_workorder_protos_container_->getNumWorkOrderProtos(index));
-  }
-  return generated_new_workorder_protos;
-}
-
-void QueryManagerDistributed::processInitiateRebuildResponseMessage(const dag_node_index op_index,
-                                                                    const std::size_t num_rebuild_work_orders) {
-  // TODO(zuyu): Multiple Shiftbosses support.
-  query_exec_state_->setRebuildStatus(op_index, num_rebuild_work_orders, true);
-
-  if (num_rebuild_work_orders != 0u) {
-    // Wait for the rebuild work orders to finish.
-    return;
-  }
-
-  // No needs for rebuilds.
-  markOperatorFinished(op_index);
-
-  for (const std::pair<dag_node_index, bool> &dependent_link :
-       query_dag_->getDependents(op_index)) {
-    const dag_node_index dependent_op_index = dependent_link.first;
-    if (checkAllBlockingDependenciesMet(dependent_op_index)) {
-      processOperator(dependent_op_index, true);
-    }
-  }
-}
-
-bool QueryManagerDistributed::initiateRebuild(const dag_node_index index) {
-  DCHECK(checkRebuildRequired(index));
-  DCHECK(!checkRebuildInitiated(index));
-
-  const RelationalOperator &op = query_dag_->getNodePayload(index);
-  DCHECK_NE(op.getInsertDestinationID(), QueryContext::kInvalidInsertDestinationId);
-
-  serialization::InitiateRebuildMessage proto;
-  proto.set_query_id(query_id_);
-  proto.set_operator_index(index);
-  proto.set_insert_destination_index(op.getInsertDestinationID());
-  proto.set_relation_id(op.getOutputRelationID());
-
-  const size_t proto_length = proto.ByteSize();
-  char *proto_bytes = static_cast<char*>(malloc(proto_length));
-  CHECK(proto.SerializeToArray(proto_bytes, proto_length));
-
-  TaggedMessage tagged_msg(static_cast<const void *>(proto_bytes),
-                           proto_length,
-                           kInitiateRebuildMessage);
-  free(proto_bytes);
-
-  LOG(INFO) << "ForemanDistributed sent InitiateRebuildMessage (typed '" << kInitiateRebuildMessage
-            << "') to Shiftboss";
-  // TODO(zuyu): Multiple workers support.
-  QueryExecutionUtil::SendTMBMessage(bus_,
-                                     foreman_client_id_,
-                                     shiftboss_directory_->getClientId(0),
-                                     move(tagged_msg));
-
-  // The negative value indicates that the number of rebuild work orders is to be
-  // determined.
-  query_exec_state_->setRebuildStatus(index, -1, true);
-
-  // Wait for Shiftbosses to report the number of rebuild work orders.
-  return false;
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_execution/QueryManagerDistributed.hpp
----------------------------------------------------------------------
diff --git a/query_execution/QueryManagerDistributed.hpp b/query_execution/QueryManagerDistributed.hpp
deleted file mode 100644
index e609ab8..0000000
--- a/query_execution/QueryManagerDistributed.hpp
+++ /dev/null
@@ -1,122 +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_EXECUTION_QUERY_MANAGER_DISTRIBUTED_HPP_
-#define QUICKSTEP_QUERY_EXECUTION_QUERY_MANAGER_DISTRIBUTED_HPP_
-
-#include <cstddef>
-#include <memory>
-
-#include "query_execution/QueryExecutionState.hpp"
-#include "query_execution/QueryManagerBase.hpp"
-#include "query_execution/WorkOrderProtosContainer.hpp"
-#include "utility/Macros.hpp"
-
-#include "tmb/id_typedefs.h"
-
-namespace tmb { class MessageBus; }
-
-namespace quickstep {
-
-class QueryHandle;
-class ShiftbossDirectory;
-
-namespace serialization { class WorkOrderMessage; }
-
-/** \addtogroup QueryExecution
- *  @{
- */
-
-/**
- * @brief A class that manages the execution of a query including generation
- *        of new work orders, keeping track of the query exection state.
- **/
-class QueryManagerDistributed final : public QueryManagerBase {
- public:
-  /**
-   * @brief Constructor.
-   *
-   * @param query_handle The QueryHandle object for this query.
-   * @param shiftboss_directory The ShiftbossDirectory to use.
-   * @param foreman_client_id The TMB client ID of the foreman thread.
-   * @param bus The TMB used for communication.
-   **/
-  QueryManagerDistributed(QueryHandle *query_handle,
-                          const ShiftbossDirectory *shiftboss_directory,
-                          const tmb::client_id foreman_client_id,
-                          tmb::MessageBus *bus);
-
-  ~QueryManagerDistributed() override {}
-
-  bool fetchNormalWorkOrders(const dag_node_index index) override;
-
-  /**
-   * @brief Process the initiate rebuild work order response message.
-   *
-   * @param op_index The index of the specified operator node in the query DAG
-   *        for initiating the rebuild work order.
-   * @param num_rebuild_work_orders The number of the rebuild work orders
-   *        generated for the operator indexed by 'op_index'.
-   **/
-  void processInitiateRebuildResponseMessage(const dag_node_index op_index,
-                                             const std::size_t num_rebuild_work_orders);
-
-  /**
-   * @brief Get the next normal workorder to be excuted, wrapped in a
-   *        WorkOrderMessage proto.
-   *
-   * @param start_operator_index Begin the search for the schedulable WorkOrder
-   *        with the operator at this index.
-   *
-   * @return A pointer to the WorkOrderMessage proto. If there is no WorkOrder
-   *         to be executed, return NULL.
-   **/
-  serialization::WorkOrderMessage* getNextWorkOrderMessage(
-      const dag_node_index start_operator_index);
-
- private:
-  bool checkNormalExecutionOver(const dag_node_index index) const override {
-    return (checkAllDependenciesMet(index) &&
-            !normal_workorder_protos_container_->hasWorkOrderProto(index) &&
-            query_exec_state_->getNumQueuedWorkOrders(index) == 0 &&
-            query_exec_state_->hasDoneGenerationWorkOrders(index));
-  }
-
-  bool initiateRebuild(const dag_node_index index) override;
-
-  bool checkRebuildOver(const dag_node_index index) const override {
-    return query_exec_state_->hasRebuildInitiated(index) &&
-           (query_exec_state_->getNumRebuildWorkOrders(index) == 0);
-  }
-
-  const ShiftbossDirectory *shiftboss_directory_;
-
-  const tmb::client_id foreman_client_id_;
-  tmb::MessageBus *bus_;
-
-  std::unique_ptr<WorkOrderProtosContainer> normal_workorder_protos_container_;
-
-  DISALLOW_COPY_AND_ASSIGN(QueryManagerDistributed);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_QUERY_EXECUTION_QUERY_MANAGER_DISTRIBUTED_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_execution/QueryManagerSingleNode.cpp
----------------------------------------------------------------------
diff --git a/query_execution/QueryManagerSingleNode.cpp b/query_execution/QueryManagerSingleNode.cpp
deleted file mode 100644
index 237796f..0000000
--- a/query_execution/QueryManagerSingleNode.cpp
+++ /dev/null
@@ -1,196 +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_execution/QueryManagerSingleNode.hpp"
-
-#include <cstddef>
-#include <memory>
-#include <utility>
-#include <vector>
-
-#include "catalog/CatalogTypedefs.hpp"
-#include "query_execution/WorkerMessage.hpp"
-#include "query_optimizer/QueryHandle.hpp"
-#include "relational_operators/RebuildWorkOrder.hpp"
-#include "relational_operators/RelationalOperator.hpp"
-#include "storage/InsertDestination.hpp"
-#include "storage/StorageBlock.hpp"
-#include "utility/DAG.hpp"
-
-#include "glog/logging.h"
-
-#include "tmb/id_typedefs.h"
-
-namespace quickstep {
-
-class WorkOrder;
-
-QueryManagerSingleNode::QueryManagerSingleNode(
-    const tmb::client_id foreman_client_id,
-    const std::size_t num_numa_nodes,
-    QueryHandle *query_handle,
-    CatalogDatabaseLite *catalog_database,
-    StorageManager *storage_manager,
-    tmb::MessageBus *bus)
-    : QueryManagerBase(query_handle),
-      foreman_client_id_(foreman_client_id),
-      storage_manager_(DCHECK_NOTNULL(storage_manager)),
-      bus_(DCHECK_NOTNULL(bus)),
-      query_context_(new QueryContext(query_handle->getQueryContextProto(),
-                                      *catalog_database,
-                                      storage_manager_,
-                                      foreman_client_id_,
-                                      bus_)),
-      workorders_container_(
-          new WorkOrdersContainer(num_operators_in_dag_, num_numa_nodes)) {
-  // Collect all the workorders from all the relational operators in the DAG.
-  for (dag_node_index index = 0; index < num_operators_in_dag_; ++index) {
-    if (checkAllBlockingDependenciesMet(index)) {
-      query_dag_->getNodePayloadMutable(index)->informAllBlockingDependenciesMet();
-      processOperator(index, false);
-    }
-  }
-}
-
-WorkerMessage* QueryManagerSingleNode::getNextWorkerMessage(
-    const dag_node_index start_operator_index, const numa_node_id numa_node) {
-  // Default policy: Operator with lowest index first.
-  WorkOrder *work_order = nullptr;
-  size_t num_operators_checked = 0;
-  for (dag_node_index index = start_operator_index;
-       num_operators_checked < num_operators_in_dag_;
-       index = (index + 1) % num_operators_in_dag_, ++num_operators_checked) {
-    if (query_exec_state_->hasExecutionFinished(index)) {
-      continue;
-    }
-    if (numa_node != kAnyNUMANodeID) {
-      // First try to get a normal WorkOrder from the specified NUMA node.
-      work_order = workorders_container_->getNormalWorkOrderForNUMANode(index, numa_node);
-      if (work_order != nullptr) {
-        // A WorkOrder found on the given NUMA node.
-        query_exec_state_->incrementNumQueuedWorkOrders(index);
-        return WorkerMessage::WorkOrderMessage(work_order, index);
-      } else {
-        // Normal workorder not found on this node. Look for a rebuild workorder
-        // on this NUMA node.
-        work_order = workorders_container_->getRebuildWorkOrderForNUMANode(index, numa_node);
-        if (work_order != nullptr) {
-          return WorkerMessage::RebuildWorkOrderMessage(work_order, index);
-        }
-      }
-    }
-    // Either no workorder found on the given NUMA node, or numa_node is
-    // 'kAnyNUMANodeID'.
-    // Try to get a normal WorkOrder from other NUMA nodes.
-    work_order = workorders_container_->getNormalWorkOrder(index);
-    if (work_order != nullptr) {
-      query_exec_state_->incrementNumQueuedWorkOrders(index);
-      return WorkerMessage::WorkOrderMessage(work_order, index);
-    } else {
-      // Normal WorkOrder not found, look for a RebuildWorkOrder.
-      work_order = workorders_container_->getRebuildWorkOrder(index);
-      if (work_order != nullptr) {
-        return WorkerMessage::RebuildWorkOrderMessage(work_order, index);
-      }
-    }
-  }
-  // No WorkOrders available right now.
-  return nullptr;
-}
-
-bool QueryManagerSingleNode::fetchNormalWorkOrders(const dag_node_index index) {
-  bool generated_new_workorders = false;
-  if (!query_exec_state_->hasDoneGenerationWorkOrders(index)) {
-    // Do not fetch any work units until all blocking dependencies are met.
-    // The releational operator is not aware of blocking dependencies for
-    // uncorrelated scalar queries.
-    if (!checkAllBlockingDependenciesMet(index)) {
-      return false;
-    }
-    const size_t num_pending_workorders_before =
-        workorders_container_->getNumNormalWorkOrders(index);
-    const bool done_generation =
-        query_dag_->getNodePayloadMutable(index)->getAllWorkOrders(workorders_container_.get(),
-                                                                   query_context_.get(),
-                                                                   storage_manager_,
-                                                                   foreman_client_id_,
-                                                                   bus_);
-    if (done_generation) {
-      query_exec_state_->setDoneGenerationWorkOrders(index);
-    }
-
-    // TODO(shoban): It would be a good check to see if operator is making
-    // useful progress, i.e., the operator either generates work orders to
-    // execute or still has pending work orders executing. However, this will not
-    // work if Foreman polls operators without feeding data. This check can be
-    // enabled, if Foreman is refactored to call getAllWorkOrders() only when
-    // pending work orders are completed or new input blocks feed.
-
-    generated_new_workorders =
-        (num_pending_workorders_before <
-         workorders_container_->getNumNormalWorkOrders(index));
-  }
-  return generated_new_workorders;
-}
-
-bool QueryManagerSingleNode::initiateRebuild(const dag_node_index index) {
-  DCHECK(!workorders_container_->hasRebuildWorkOrder(index));
-  DCHECK(checkRebuildRequired(index));
-  DCHECK(!checkRebuildInitiated(index));
-
-  getRebuildWorkOrders(index, workorders_container_.get());
-
-  query_exec_state_->setRebuildStatus(
-      index, workorders_container_->getNumRebuildWorkOrders(index), true);
-
-  return (query_exec_state_->getNumRebuildWorkOrders(index) == 0);
-}
-
-void QueryManagerSingleNode::getRebuildWorkOrders(const dag_node_index index,
-                                                  WorkOrdersContainer *container) {
-  const RelationalOperator &op = query_dag_->getNodePayload(index);
-  const QueryContext::insert_destination_id insert_destination_index = op.getInsertDestinationID();
-
-  if (insert_destination_index == QueryContext::kInvalidInsertDestinationId) {
-    return;
-  }
-
-  std::vector<MutableBlockReference> partially_filled_block_refs;
-
-  DCHECK(query_context_ != nullptr);
-  InsertDestination *insert_destination = query_context_->getInsertDestination(insert_destination_index);
-  DCHECK(insert_destination != nullptr);
-
-  insert_destination->getPartiallyFilledBlocks(&partially_filled_block_refs);
-
-  for (std::vector<MutableBlockReference>::size_type i = 0;
-       i < partially_filled_block_refs.size();
-       ++i) {
-    container->addRebuildWorkOrder(
-        new RebuildWorkOrder(query_id_,
-                             std::move(partially_filled_block_refs[i]),
-                             index,
-                             op.getOutputRelationID(),
-                             foreman_client_id_,
-                             bus_),
-        index);
-  }
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_execution/QueryManagerSingleNode.hpp
----------------------------------------------------------------------
diff --git a/query_execution/QueryManagerSingleNode.hpp b/query_execution/QueryManagerSingleNode.hpp
deleted file mode 100644
index dd044a5..0000000
--- a/query_execution/QueryManagerSingleNode.hpp
+++ /dev/null
@@ -1,142 +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_EXECUTION_QUERY_MANAGER_SINGLE_NODE_HPP_
-#define QUICKSTEP_QUERY_EXECUTION_QUERY_MANAGER_SINGLE_NODE_HPP_
-
-#include <cstddef>
-#include <memory>
-
-#include "catalog/CatalogTypedefs.hpp"
-#include "query_execution/QueryContext.hpp"
-#include "query_execution/QueryExecutionState.hpp"
-#include "query_execution/QueryManagerBase.hpp"
-#include "query_execution/WorkOrdersContainer.hpp"
-#include "utility/Macros.hpp"
-
-#include "tmb/id_typedefs.h"
-
-namespace tmb { class MessageBus; }
-
-namespace quickstep {
-
-class CatalogDatabaseLite;
-class QueryHandle;
-class StorageManager;
-class WorkerMessage;
-
-/** \addtogroup QueryExecution
- *  @{
- */
-
-/**
- * @brief A class that manages the execution of a query including generation
- *        of new work orders, keeping track of the query exection state.
- **/
-class QueryManagerSingleNode final : public QueryManagerBase {
- public:
-  /**
-   * @brief Constructor.
-   *
-   * @param foreman_client_id The TMB client ID of the foreman thread.
-   * @param num_numa_nodes The number of NUMA nodes used by the system.
-   * @param query_handle The QueryHandle object for this query.
-   * @param catalog_database The CatalogDatabse used by the query.
-   * @param storage_manager The StorageManager used by the query.
-   * @param bus The TMB used for communication.
-   **/
-  QueryManagerSingleNode(const tmb::client_id foreman_client_id,
-                         const std::size_t num_numa_nodes,
-                         QueryHandle *query_handle,
-                         CatalogDatabaseLite *catalog_database,
-                         StorageManager *storage_manager,
-                         tmb::MessageBus *bus);
-
-  ~QueryManagerSingleNode() override {}
-
-  bool fetchNormalWorkOrders(const dag_node_index index) override;
-
- /**
-   * @brief Get the next workorder to be excuted, wrapped in a WorkerMessage.
-   *
-   * @param start_operator_index Begin the search for the schedulable WorkOrder
-   *        with the operator at this index.
-   * @param numa_node The next WorkOrder should preferably have its input(s)
-   *        from this numa_node. This is a hint and not a binding requirement.
-   *
-   * @return A pointer to the WorkerMessage. If there's no WorkOrder to be
-   *         executed, return NULL.
-   **/
-  WorkerMessage* getNextWorkerMessage(
-      const dag_node_index start_operator_index,
-      const numa_node_id node_id = kAnyNUMANodeID);
-
-  /**
-   * @brief Get a pointer to the QueryContext.
-   **/
-  inline QueryContext* getQueryContextMutable() {
-    return query_context_.get();
-  }
-
- private:
-  bool checkNormalExecutionOver(const dag_node_index index) const override {
-    return (checkAllDependenciesMet(index) &&
-            !workorders_container_->hasNormalWorkOrder(index) &&
-            query_exec_state_->getNumQueuedWorkOrders(index) == 0 &&
-            query_exec_state_->hasDoneGenerationWorkOrders(index));
-  }
-
-  bool initiateRebuild(const dag_node_index index) override;
-
-  bool checkRebuildOver(const dag_node_index index) const override {
-    return query_exec_state_->hasRebuildInitiated(index) &&
-           !workorders_container_->hasRebuildWorkOrder(index) &&
-           (query_exec_state_->getNumRebuildWorkOrders(index) == 0);
-  }
-
-  /**
-   * @brief Get the rebuild WorkOrders for an operator.
-   *
-   * @note This function should be called only once, when all the normal
-   *       WorkOrders generated by an operator finish their execution.
-   *
-   * @param index The index of the operator in the query plan DAG.
-   * @param container A pointer to a WorkOrdersContainer to be used to store the
-   *        generated WorkOrders.
-   **/
-  void getRebuildWorkOrders(const dag_node_index index,
-                            WorkOrdersContainer *container);
-
-  const tmb::client_id foreman_client_id_;
-
-  StorageManager *storage_manager_;
-  tmb::MessageBus *bus_;
-
-  std::unique_ptr<QueryContext> query_context_;
-
-  std::unique_ptr<WorkOrdersContainer> workorders_container_;
-
-  DISALLOW_COPY_AND_ASSIGN(QueryManagerSingleNode);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_QUERY_EXECUTION_QUERY_MANAGER_SINGLE_NODE_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_execution/README.md
----------------------------------------------------------------------
diff --git a/query_execution/README.md b/query_execution/README.md
deleted file mode 100644
index 12e0f57..0000000
--- a/query_execution/README.md
+++ /dev/null
@@ -1,149 +0,0 @@
-# An Overview of Quickstep's Execution Engine
-
-## Types of threads
-There are two kinds of threads in Quickstep - Foreman and Worker. The foreman
-thread controls the query execution progress, finds schedulable work (called as
-WorkOrder) and assigns (or schedules) it for execution to the Worker threads.
-The Worker threads receive the WorkOrders and execute them. After execution they
-send a completion message (or response message) back to Foreman.
-
-## High level functionality of Foreman
-Foreman requests all the RelationalOperators in the physical query plan
-represented as a DAG to give any schedulable work (in the form of WorkOrders).
-While doing so, Foreman has to respect dependencies between operators. There are
-two kinds of dependencies between operators - pipeline breaking (or blocking)
-and pipeline non-breaking (or non-blocking). In the first case, the output of
-the producer operator can't be pipelined to the consumer operator. In the second
-case, the Foreman will facilitate the pipelining of the intermediate output
-produced by the producer operator to the consumer operator.
-
-## Messages in execution engine
-
-### WorkerMessage
-There are multiple types of WorkerMessage, each of which indicates the purpose
-of the message.
-
-Foreman -> Worker : WorkerMessage which consists of the following things
-- A pointer to the WorkOrder to be executed. The WorkOrder could be a normal
-WorkOrder or a rebuild WorkOrder. A normal WorkOrder involves the invocation of
-WorkOrder::execute() method which is overriden by all of the RelationalOperator
-classes. A rebuild WorkOrder has one StorageBlock as input and calls a
-rebuild() method on the block. More details about rebuild() can be found in the
-storage module.
-- The index of the relational operator in the query plan DAG that produced the
-WorkOrder.
-
-### ForemanMessage
-Multiple senders are possible for this message. There are multiple types of
-ForemanMessages, each of which indicates the purpose of the message.
-
-Worker -> Foreman : ForemanMessage of types WorkOrderCompletion and
-RebuildCompletion are sent after a Worker finishes executing a respective type
-of WorkOrder. This message helps the Foreman track the progress of individual
-operators as well as the whole query.
-
-Some relational operators and InsertDestination -> Foreman : ForemanMessage of
-types DataPipeline and WorkOrdersAvailable. InsertDestination first determines
-when an output block of a relational operator gets full. Once a block is full,
-it streams the unique block ID of the filled block along with the index of the
-relational operator that produced the block to Foreman with the message type
-DataPipeline. Some operators which modify the block in place also send similar
-messages to Foreman.
-
-### FeedbackMessage
-This message is sent from Workers to the Foreman during a WorkOrder execution.
-
-In certain operators, e.g. TextScan (used for bulk loading data from text files)
-and Sort, there is a communication between the relational operator and its
-WorkOrders. In such cases, when a WorkOrder is under execution on a Worker
-thread, a FeedbackMessage is sent from the WorkOrder via the Worker to Foreman.
-Foreman relays this message to the relational operator that produced the sender
-WorkOrder. The relational operator uses this message to update its internal
-state to potentially generate newer WorkOrders.
-
-### PoisonMessage
-This message is used to terminate a thread (i.e., Foreman and Worker), typically
-when shutting down the Quickstep process.
-
-## How does the Foreman react after receiving various messages?
-### WorkOrder completion message
-* Update the book-keeping of pending WorkOrders per Worker and per operator.
-* Fetch new WorkOrders if available for the operator of whose WorkOrder was
-just executed.
-* Update the state of an operator - the possible options are:
-  - Normal WorkOrders are still under execution
-  - All normal WorkOrders have finished execution and rebuild WorkOrders are yet
-  to be generated.
-  - All normal WorkOrders have finished execution, rebuild WorkOrders have been
-  generated and issued to Workers.
-  - All normal and rebuild WorkOrders have been executed AND all the dependency
-  operators for the given operator have finished execution, therefore the given
-  operator has finished its execution.
-* Fetch the WorkOrders from the dependents of the given operator.
-
-### Rebuild WorkOrder completion message
-* Update the book-keeping of pending WorkOrders per Worker and per operator.
-* If all the rebuild WorkOrders have finished their execution, try to fetch the
-WorkOrders of the dependent operators of the operator whose rebuild WorkOrder
-was just executed.
-
-### Data pipeline message
-* Find the consumer operators (i.e. operators which have a non
-pipeline-breaking link) of the producer operator.
-* Stream the block ID to the eligible consumer operators.
-* Fetch new WorkOrders from these consumer operators which may have become
-available because of the streaming of data.
-
-### WorkOrder available message
-* Fetch new WorkOrders that may have become available.
-
-### Feedback message
-* Relay the feedback message to a specified relational operator. The recipient
-operator is specified in the header of the message.
-
-## Example
-We look at a sample query to better describe the flow of messages -
-
-SELECT R.a, S.b from R, S where R.a = S.a and R.c < 20;
-
-This is an equi-join query which can be implemented using a hash join. We assume
-that S is a larger relation and the build relation is the output of the
-selection on R.
-
-The query execution plan involves the following operators:
-* SelectOperator to filter R based on predicate R.c < 20 (We call the output as
-R')
-* BuildHashOperator to construct a hash table on R'
-* HashJoinOperator to probe the hash table, where the probe relation is S
-* DestroyHashTableOperator to destroy the hash table after the join is done
-* Multiple DropTableOperators to destroy the temporaray relations produced as
-output.
-
-R has two blocks with IDs as 1 and 2. S has two blocks with IDs as 3 and 4.
-We assume that the SelectOperator produces one filled block and one partially
-filled block as output. Note that in the query plan DAG, the link between
-SelectOperator and BuildHashOperator allows streaming of data. The
-HashJoinOperator's WorkOrder can't be generated unless all of the
-BuildHashOperator's WorkOrders have finished their execution. The execution is
-assumed to be performed by a single Worker thread.
-
-The following table describes the message exchange that happens during the
-query excution. We primarily focus on three operators - Select, BuildHash and
-HashJoin (probe).
-
-| Sender | Receiver | Message  | Message Description |
-|:-----------------:|----------|---------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
-| Foreman | Worker | WorkerMessage of type kWorkOrderMessage | SelectWorkOrder on block 1. |
-| InsertDestination | Foreman | ForemanMessage of type kDataPipeline | SelectWorkOrder on block 1 produced one fully filled block as output.  The output block ID as pipelined from the InsertDestination to Foreman.  Foreman relays this block ID to BuildHashOperator, which generates a WorkOrder which is ready to be scheduled. |
-| Worker | Foreman | ForemanMessage of type kWorkOrderCompletion | SelectWorkOrder on block 1 completed. |
-| Foreman | Worker | WorkerMessage of type kWorkOrderMessage | SelectWorkOrder on block 2. |
-| Worker | Foreman | ForemanMessage of type kWorkOrderCompletion | SelectWorkOrder on block 2 completed.  As a result of this execution, a partially filled block of output was produced.  |
-| Foreman | Worker | WorkerMessage of type kWorkOrderMessage | BuildHashWorkOrder on the fully filled block of R'  |
-| Worker | Foreman | ForemanMessage of type kWorkOrderCompletion | BuildHashWorkOrder execution complete.  |
-| Foreman | Worker | WorkerMessage of type kWorkOrderMessage | BuildHashWorkOrder on the partially filled block of R' |
-| Worker | Foreman | ForemanMessage of type kWorkOrderCompletion | BuildHashWorkOrder execution complete. |
-| Foreman | Worker | WorkerMessage of type kWorkOrderMessage | HashJoinWorkOrder for block 3 from S |
-| Worker | Foreman | ForemanMessage of type kWorkOrderCompletion | HashJoinWorkOrder execution complete. |
-| Foreman | Worker | WorkerMessage of type kWorkOrderMessage | HashJoinWorkOrder for block 4 from S |
-| Worker | Foreman | ForemanMessage of type kWorkOrderCompletion | HashJoinWorkOrder execution complete. |
-

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_execution/Shiftboss.cpp
----------------------------------------------------------------------
diff --git a/query_execution/Shiftboss.cpp b/query_execution/Shiftboss.cpp
deleted file mode 100644
index ed4bade..0000000
--- a/query_execution/Shiftboss.cpp
+++ /dev/null
@@ -1,400 +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_execution/Shiftboss.hpp"
-
-#include <cstddef>
-#include <cstdlib>
-#include <memory>
-#include <string>
-#include <unordered_map>
-#include <utility>
-#include <vector>
-
-#include "catalog/CatalogTypedefs.hpp"
-#include "query_execution/QueryContext.hpp"
-#include "query_execution/QueryExecutionMessages.pb.h"
-#include "query_execution/QueryExecutionTypedefs.hpp"
-#include "query_execution/QueryExecutionUtil.hpp"
-#include "query_execution/WorkerMessage.hpp"
-#include "relational_operators/RebuildWorkOrder.hpp"
-#include "relational_operators/WorkOrderFactory.hpp"
-#include "storage/InsertDestination.hpp"
-#include "storage/StorageBlock.hpp"
-#include "storage/StorageManager.hpp"
-#include "threading/ThreadUtil.hpp"
-
-#include "glog/logging.h"
-
-#include "tmb/address.h"
-#include "tmb/id_typedefs.h"
-#include "tmb/message_bus.h"
-#include "tmb/message_style.h"
-#include "tmb/tagged_message.h"
-
-using std::free;
-using std::malloc;
-using std::move;
-using std::size_t;
-using std::string;
-using std::unique_ptr;
-using std::vector;
-
-using tmb::AnnotatedMessage;
-using tmb::MessageBus;
-using tmb::TaggedMessage;
-
-namespace quickstep {
-
-class WorkOrder;
-
-void Shiftboss::run() {
-  if (cpu_id_ >= 0) {
-    // We can pin the shiftboss thread to a CPU if specified.
-    ThreadUtil::BindToCPU(cpu_id_);
-  }
-
-  processShiftbossRegistrationResponseMessage();
-
-  for (;;) {
-    // Receive() is a blocking call, causing this thread to sleep until next
-    // message is received.
-    AnnotatedMessage annotated_message(bus_->Receive(shiftboss_client_id_, 0, true));
-    DLOG(INFO) << "Shiftboss " << shiftboss_index_ << " (id '" << shiftboss_client_id_
-               << "') received the typed '" << annotated_message.tagged_message.message_type()
-               << "' message from client " << annotated_message.sender;
-    switch (annotated_message.tagged_message.message_type()) {
-      case kQueryInitiateMessage: {
-        const TaggedMessage &tagged_message = annotated_message.tagged_message;
-
-        serialization::QueryInitiateMessage proto;
-        CHECK(proto.ParseFromArray(tagged_message.message(), tagged_message.message_bytes()));
-
-        processQueryInitiateMessage(proto.query_id(), proto.catalog_database_cache(), proto.query_context());
-        break;
-      }
-      case kWorkOrderMessage: {
-        const TaggedMessage &tagged_message = annotated_message.tagged_message;
-
-        serialization::WorkOrderMessage proto;
-        CHECK(proto.ParseFromArray(tagged_message.message(), tagged_message.message_bytes()));
-
-        const std::size_t query_id = proto.query_id();
-        DCHECK_EQ(1u, query_contexts_.count(query_id));
-
-        WorkOrder *work_order = WorkOrderFactory::ReconstructFromProto(proto.work_order(),
-                                                                       shiftboss_index_,
-                                                                       &database_cache_,
-                                                                       query_contexts_[query_id].get(),
-                                                                       storage_manager_,
-                                                                       shiftboss_client_id_,
-                                                                       bus_);
-
-        unique_ptr<WorkerMessage> worker_message(
-            WorkerMessage::WorkOrderMessage(work_order, proto.operator_index()));
-
-        TaggedMessage worker_tagged_message(worker_message.get(),
-                                            sizeof(*worker_message),
-                                            kWorkOrderMessage);
-
-        const size_t worker_index = getSchedulableWorker();
-        DLOG(INFO) << "Shiftboss " << shiftboss_index_ << " (id '" << shiftboss_client_id_
-                   << "') forwarded WorkOrderMessage (typed '" << kWorkOrderMessage
-                   << "') from Foreman to worker " << worker_index;
-
-        const MessageBus::SendStatus send_status =
-            QueryExecutionUtil::SendTMBMessage(bus_,
-                                               shiftboss_client_id_,
-                                               workers_->getClientID(worker_index),
-                                               move(worker_tagged_message));
-        CHECK(send_status == MessageBus::SendStatus::kOK);
-        break;
-      }
-      case kInitiateRebuildMessage: {
-        // Construct rebuild work orders, and send back their number to
-        // 'ForemanDistributed'.
-        const TaggedMessage &tagged_message = annotated_message.tagged_message;
-
-        serialization::InitiateRebuildMessage proto;
-        CHECK(proto.ParseFromArray(tagged_message.message(), tagged_message.message_bytes()));
-
-        processInitiateRebuildMessage(proto.query_id(),
-                                      proto.operator_index(),
-                                      proto.insert_destination_index(),
-                                      proto.relation_id());
-        break;
-      }
-      case kCatalogRelationNewBlockMessage:  // Fall through.
-      case kDataPipelineMessage:
-      case kWorkOrderFeedbackMessage:
-      case kWorkOrderCompleteMessage:
-      case kRebuildWorkOrderCompleteMessage: {
-        DLOG(INFO) << "Shiftboss " << shiftboss_index_ << " (id '" << shiftboss_client_id_
-                   << "') forwarded typed '" << annotated_message.tagged_message.message_type()
-                   << "' message from Worker with TMB client ID '" << annotated_message.sender
-                   << "' to Foreman with TMB client ID " << foreman_client_id_;
-
-        DCHECK_NE(foreman_client_id_, tmb::kClientIdNone);
-        const MessageBus::SendStatus send_status =
-            QueryExecutionUtil::SendTMBMessage(bus_,
-                                               shiftboss_client_id_,
-                                               foreman_client_id_,
-                                               move(annotated_message.tagged_message));
-        CHECK(send_status == MessageBus::SendStatus::kOK);
-        break;
-      }
-      case kQueryTeardownMessage: {
-        const TaggedMessage &tagged_message = annotated_message.tagged_message;
-
-        serialization::QueryTeardownMessage proto;
-        CHECK(proto.ParseFromArray(tagged_message.message(), tagged_message.message_bytes()));
-
-        query_contexts_.erase(proto.query_id());
-        break;
-      }
-      case kSaveQueryResultMessage: {
-        const TaggedMessage &tagged_message = annotated_message.tagged_message;
-
-        serialization::SaveQueryResultMessage proto;
-        CHECK(proto.ParseFromArray(tagged_message.message(), tagged_message.message_bytes()));
-
-        for (int i = 0; i < proto.blocks_size(); ++i) {
-          storage_manager_->saveBlockOrBlob(proto.blocks(i));
-        }
-
-        // Clean up query execution states, i.e., QueryContext.
-        query_contexts_.erase(proto.query_id());
-
-        serialization::SaveQueryResultResponseMessage proto_response;
-        proto_response.set_query_id(proto.query_id());
-        proto_response.set_relation_id(proto.relation_id());
-        proto_response.set_cli_id(proto.cli_id());
-        proto_response.set_shiftboss_index(shiftboss_index_);
-
-        const size_t proto_response_length = proto_response.ByteSize();
-        char *proto_response_bytes = static_cast<char*>(malloc(proto_response_length));
-        CHECK(proto_response.SerializeToArray(proto_response_bytes, proto_response_length));
-
-        TaggedMessage message_response(static_cast<const void*>(proto_response_bytes),
-                                       proto_response_length,
-                                       kSaveQueryResultResponseMessage);
-        free(proto_response_bytes);
-
-        DLOG(INFO) << "Shiftboss " << shiftboss_index_ << " (id '" << shiftboss_client_id_
-                   << "') sent SaveQueryResultResponseMessage (typed '" << kSaveQueryResultResponseMessage
-                   << "') to Foreman with TMB client ID " << foreman_client_id_;
-        const MessageBus::SendStatus send_status =
-            QueryExecutionUtil::SendTMBMessage(bus_,
-                                               shiftboss_client_id_,
-                                               foreman_client_id_,
-                                               move(message_response));
-        CHECK(send_status == MessageBus::SendStatus::kOK);
-        break;
-      }
-      case kPoisonMessage: {
-        DLOG(INFO) << "Shiftboss " << shiftboss_index_ << " (id '" << shiftboss_client_id_
-                   << "') forwarded PoisonMessage (typed '" << kPoisonMessage
-                   << "') from Foreman to all workers";
-
-        tmb::MessageStyle broadcast_style;
-        broadcast_style.Broadcast(true);
-
-        const MessageBus::SendStatus send_status =
-            bus_->Send(shiftboss_client_id_,
-                       worker_addresses_,
-                       broadcast_style,
-                       move(annotated_message.tagged_message));
-        CHECK(send_status == MessageBus::SendStatus::kOK);
-        return;
-      }
-      default: {
-        LOG(FATAL) << "Unknown TMB message type";
-      }
-    }
-  }
-}
-
-size_t Shiftboss::getSchedulableWorker() {
-  const size_t num_workers = workers_->getNumWorkers();
-
-  size_t curr_worker = start_worker_index_;
-  for (;;) {
-    if (workers_->getNumQueuedWorkOrders(curr_worker) < max_msgs_per_worker_) {
-      start_worker_index_ = (curr_worker + 1) % num_workers;
-      // TODO(zuyu): workers_->incrementNumQueuedWorkOrders(curr_worker);
-      // But we need a WorkOrder queue first.
-      return curr_worker;
-    }
-
-    curr_worker = (curr_worker + 1) % num_workers;
-  }
-}
-
-void Shiftboss::registerWithForeman() {
-  tmb::Address all_addresses;
-  all_addresses.All(true);
-
-  tmb::MessageStyle style;
-
-  serialization::ShiftbossRegistrationMessage proto;
-  proto.set_work_order_capacity(getWorkOrderCapacity());
-
-  const size_t proto_length = proto.ByteSize();
-  char *proto_bytes = static_cast<char*>(malloc(proto_length));
-  CHECK(proto.SerializeToArray(proto_bytes, proto_length));
-
-  TaggedMessage message(static_cast<const void*>(proto_bytes),
-                        proto_length,
-                        kShiftbossRegistrationMessage);
-  free(proto_bytes);
-
-  DLOG(INFO) << "Shiftboss " << shiftboss_index_ << " (id '" << shiftboss_client_id_
-             << "') sent ShiftbossRegistrationMessage (typed '" << kShiftbossRegistrationMessage
-             << "') to all";
-  tmb::MessageBus::SendStatus send_status =
-      bus_->Send(shiftboss_client_id_, all_addresses, style, move(message));
-  DCHECK(send_status == tmb::MessageBus::SendStatus::kOK);
-}
-
-void Shiftboss::processShiftbossRegistrationResponseMessage() {
-  AnnotatedMessage annotated_message(bus_->Receive(shiftboss_client_id_, 0, true));
-  const TaggedMessage &tagged_message = annotated_message.tagged_message;
-  DCHECK_EQ(kShiftbossRegistrationResponseMessage, tagged_message.message_type());
-
-  foreman_client_id_ = annotated_message.sender;
-  DLOG(INFO) << "Shiftboss (id '" << shiftboss_client_id_
-             << "') received the typed '" << kShiftbossRegistrationResponseMessage
-             << "' message from ForemanDistributed with client " << foreman_client_id_;
-
-  serialization::ShiftbossRegistrationResponseMessage proto;
-  CHECK(proto.ParseFromArray(tagged_message.message(), tagged_message.message_bytes()));
-
-  shiftboss_index_ = proto.shiftboss_index();
-
-  // Forward this message to Workers regarding <shiftboss_index_>.
-  QueryExecutionUtil::BroadcastMessage(shiftboss_client_id_,
-                                       worker_addresses_,
-                                       move(annotated_message.tagged_message),
-                                       bus_);
-}
-
-void Shiftboss::processQueryInitiateMessage(
-    const std::size_t query_id,
-    const serialization::CatalogDatabase &catalog_database_cache_proto,
-    const serialization::QueryContext &query_context_proto) {
-  database_cache_.update(catalog_database_cache_proto);
-
-  auto query_context = std::make_unique<QueryContext>(
-      query_context_proto, database_cache_, storage_manager_, shiftboss_client_id_, bus_);
-  query_contexts_.emplace(query_id, move(query_context));
-
-  serialization::QueryInitiateResponseMessage proto;
-  proto.set_query_id(query_id);
-
-  const size_t proto_length = proto.ByteSize();
-  char *proto_bytes = static_cast<char*>(malloc(proto_length));
-  CHECK(proto.SerializeToArray(proto_bytes, proto_length));
-
-  TaggedMessage message_response(static_cast<const void*>(proto_bytes),
-                                 proto_length,
-                                 kQueryInitiateResponseMessage);
-  free(proto_bytes);
-
-  DLOG(INFO) << "Shiftboss " << shiftboss_index_ << " (id '" << shiftboss_client_id_
-             << "') sent QueryInitiateResponseMessage (typed '" << kQueryInitiateResponseMessage
-             << "') to Foreman with TMB client ID " << foreman_client_id_;
-  const MessageBus::SendStatus send_status =
-      QueryExecutionUtil::SendTMBMessage(bus_,
-                                         shiftboss_client_id_,
-                                         foreman_client_id_,
-                                         move(message_response));
-  CHECK(send_status == MessageBus::SendStatus::kOK);
-}
-
-void Shiftboss::processInitiateRebuildMessage(const std::size_t query_id,
-                                              const std::size_t op_index,
-                                              const QueryContext::insert_destination_id dest_index,
-                                              const relation_id rel_id) {
-  DCHECK_NE(foreman_client_id_, tmb::kClientIdNone);
-
-  DCHECK_EQ(1u, query_contexts_.count(query_id));
-  InsertDestination *insert_destination = query_contexts_[query_id]->getInsertDestination(dest_index);
-  DCHECK(insert_destination != nullptr);
-
-  vector<MutableBlockReference> partially_filled_block_refs;
-  insert_destination->getPartiallyFilledBlocks(&partially_filled_block_refs);
-
-  serialization::InitiateRebuildResponseMessage proto;
-  proto.set_query_id(query_id);
-  proto.set_operator_index(op_index);
-  proto.set_num_rebuild_work_orders(partially_filled_block_refs.size());
-  proto.set_shiftboss_index(shiftboss_index_);
-
-  const size_t proto_length = proto.ByteSize();
-  char *proto_bytes = static_cast<char*>(malloc(proto_length));
-  CHECK(proto.SerializeToArray(proto_bytes, proto_length));
-
-  TaggedMessage message_response(static_cast<const void*>(proto_bytes),
-                                 proto_length,
-                                 kInitiateRebuildResponseMessage);
-  free(proto_bytes);
-
-  DLOG(INFO) << "Shiftboss " << shiftboss_index_ << " (id '" << shiftboss_client_id_
-             << "') sent InitiateRebuildResponseMessage (typed '" << kInitiateRebuildResponseMessage
-             << "') to Foreman with TMB client ID " << foreman_client_id_;
-  const MessageBus::SendStatus send_status =
-      QueryExecutionUtil::SendTMBMessage(bus_,
-                                         shiftboss_client_id_,
-                                         foreman_client_id_,
-                                         move(message_response));
-  CHECK(send_status == MessageBus::SendStatus::kOK);
-
-  for (size_t i = 0; i < partially_filled_block_refs.size(); ++i) {
-    // NOTE(zuyu): Worker releases the memory after the execution of
-    // RebuildWorkOrder on the Worker.
-    WorkOrder *rebuild_work_order =
-        new RebuildWorkOrder(query_id,
-                             move(partially_filled_block_refs[i]),
-                             op_index,
-                             rel_id,
-                             shiftboss_client_id_,
-                             bus_);
-
-    unique_ptr<WorkerMessage> worker_message(
-        WorkerMessage::RebuildWorkOrderMessage(rebuild_work_order, op_index));
-
-    TaggedMessage worker_tagged_message(worker_message.get(),
-                                        sizeof(*worker_message),
-                                        kRebuildWorkOrderMessage);
-
-    const size_t worker_index = getSchedulableWorker();
-    DLOG(INFO) << "Shiftboss " << shiftboss_index_ << " (id '" << shiftboss_client_id_
-               << "') sent RebuildWorkOrderMessage (typed '" << kRebuildWorkOrderMessage
-               << "') to worker " << worker_index;
-
-    const MessageBus::SendStatus send_status =
-        QueryExecutionUtil::SendTMBMessage(bus_,
-                                           shiftboss_client_id_,
-                                           workers_->getClientID(worker_index),
-                                           move(worker_tagged_message));
-    CHECK(send_status == MessageBus::SendStatus::kOK);
-  }
-}
-
-}  // namespace quickstep


[27/51] [abbrv] [partial] incubator-quickstep git commit: remove c++ files

Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/parser/SqlLexer.lpp
----------------------------------------------------------------------
diff --git a/parser/SqlLexer.lpp b/parser/SqlLexer.lpp
deleted file mode 100644
index 0953dc6..0000000
--- a/parser/SqlLexer.lpp
+++ /dev/null
@@ -1,466 +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.
- **/
-
-%option prefix="quickstep_yy"
-%option warn nodefault
-%option noyywrap noinput nounput
-%option never-interactive nounistd
-%option bison-bridge reentrant
-%option yylineno
-%option bison-locations
-
-%{
-#include <cstdio>
-#include <string>
-#include <vector>
-
-#include "parser/ParseJoinedTableReference.hpp"
-#include "parser/ParseLiteralValue.hpp"
-#include "utility/PtrList.hpp"
-#include "utility/PtrVector.hpp"
-
-namespace quickstep {
-
-class BinaryOperation;
-class Comparison;
-class ParseAssignment;
-class ParseAttribute;
-class ParseAttributeDefinition;
-class ParseBlockProperties;
-class ParseColumnConstraint;
-class ParseCommand;
-struct ParseCopyFromParams;
-class ParseDataType;
-class ParseExpression;
-struct ParseFrameInfo;
-class ParseFunctionCall;
-class ParseGroupBy;
-class ParseHaving;
-class ParseKeyIntegerValue;
-class ParseKeyStringValue;
-class ParseKeyStringList;
-class ParseKeyValue;
-class ParseLimit;
-class ParseOrderBy;
-class ParseOrderByItem;
-class ParsePartitionClause;
-class ParsePredicate;
-class ParsePriority;
-class ParseSample;
-class ParseScalarLiteral;
-class ParseSearchedWhenClause;
-class ParseSelect;
-class ParseSelectionClause;
-class ParseSelectionItem;
-class ParseSelectionItemScalar;
-class ParseSelectionList;
-class ParseSimpleTableReference;
-class ParseSimpleWhenClause;
-class ParseStringKeyLiteralValues;
-class ParseStatement;
-class ParseStatementCopyFrom;
-class ParseStatementCreateTable;
-class ParseStatementDelete;
-class ParseStatementDropTable;
-class ParseStatementInsert;
-class ParseStatementInsertTuple;
-class ParseStatementInsertSelection;
-class ParseStatementSelect;
-class ParseStatementQuit;
-class ParseStatementUpdate;
-class ParseSubqueryExpression;
-class ParseSubqueryTableReference;
-class ParseTableReference;
-class ParseTableReferenceSignature;
-class ParseWindow;
-class Type;
-class UnaryOperation;
-
-}  // namespace quickstep
-
-#include "parser/ParseString.hpp"
-#include "parser/SqlParser_gen.hpp"
-#include "parser/ParserUtil.hpp"
-
-#define YY_USER_ACTION                                    \
-  {                                                       \
-    yylloc->first_line = yylineno;                        \
-    yylloc->first_column = yycolumn;                      \
-    yycolumn += yyleng;                                   \
-  }
-
-%}
-
-%e 1024
-
-/* FIXME(chasseur, qzeng): Add support for hexadecimal literals. */
-
-/**
- * These patterns are based on the SQL-2011 standard for syntax of numeric
- * literals (Part 2, Section 5.3 of the standard).
- **/
-sign [\-\+]
-unsigned_integer [0-9]+
-signed_integer {sign}?{unsigned_integer}
-exact_numeric_literal ({unsigned_integer}(\.{unsigned_integer}?)?)|(\.{unsigned_integer})
-approximate_numeric_literal {exact_numeric_literal}[eE]{signed_integer}
-unsigned_numeric_literal {exact_numeric_literal}|{approximate_numeric_literal}
-
-%x CONDITION_SQL
-%x CONDITION_COMMAND
-%x CONDITION_STRING_SINGLE_QUOTED
-%x CONDITION_STRING_SINGLE_QUOTED_ESCAPED
-%x CONDITION_STRING_DOUBLE_QUOTED
-
-%%
-
-<INITIAL>{
-  \\[a-zA-Z]+ {
-    /* A forward slash character represents a system command. */
-    BEGIN(CONDITION_COMMAND);
-    yylval->string_value_ = new quickstep::ParseString(
-        yylloc->first_line, yylloc->first_column, std::string(yytext, yyleng));
-    return TOKEN_COMMAND;
-  }
-
-  [^\\] {
-    /* This is a SQL command. Place the char back and process normally. */
-    yyless(0);
-    yycolumn--;
-    BEGIN(CONDITION_SQL);
-  }
-}
-
-<CONDITION_COMMAND>{
-  [a-zA-Z0-9\-\.:]+ {
-    /* This is a command argument. */
-    yylval->string_value_ = new quickstep::ParseString(
-        yylloc->first_line, yylloc->first_column, std::string(yytext, yyleng));
-    return TOKEN_COMMAND;
-  }
-
-  [ \t]+ {
-    /* Ignore whitespace. */
-  }
-
-  [\n\r]+ {
-    /* Newline reverts the lexer to the initial state. */
-    yycolumn = 0;
-    BEGIN(INITIAL);
-    return '\n';
-  }
-}
-
-<CONDITION_SQL>{
-  "add"              return TOKEN_ADD;
-  "all"              return TOKEN_ALL;
-  "alter"            return TOKEN_ALTER;
-  "and"              return TOKEN_AND;
-  "as"               return TOKEN_AS;
-  "asc"              return TOKEN_ASC;
-  "ascending"        return TOKEN_ASC;
-  "between"          return TOKEN_BETWEEN;
-  "bigint"           return TOKEN_BIGINT;
-  "bit"              return TOKEN_BIT;
-  "bitweaving"       return TOKEN_BITWEAVING;
-  "blockproperties"  return TOKEN_BLOCKPROPERTIES;
-  "blocksample"      return TOKEN_BLOCKSAMPLE;
-  "bloomfilter"      return TOKEN_BLOOM_FILTER;
-  "case"             return TOKEN_CASE;
-  "csbtree"          return TOKEN_CSB_TREE;
-  "by"               return TOKEN_BY;
-  "char"             return TOKEN_CHARACTER;
-  "character"        return TOKEN_CHARACTER;
-  "check"            return TOKEN_CHECK;
-  "column"           return TOKEN_COLUMN;
-  "constraint"       return TOKEN_CONSTRAINT;
-  "copy"             return TOKEN_COPY;
-  "create"           return TOKEN_CREATE;
-  "current"          return TOKEN_CURRENT;
-  "date"             return TOKEN_DATE;
-  "datetime"         return TOKEN_DATETIME;
-  "day"              return TOKEN_DAY;
-  "decimal"          return TOKEN_DECIMAL;
-  "default"          return TOKEN_DEFAULT;
-  "delete"           return TOKEN_DELETE;
-  "delimiter"        return TOKEN_DELIMITER;
-  "desc"             return TOKEN_DESC;
-  "descending"       return TOKEN_DESC;
-  "distinct"         return TOKEN_DISTINCT;
-  "double"           return TOKEN_DOUBLE;
-  "drop"             return TOKEN_DROP;
-  "else"             return TOKEN_ELSE;
-  "end"              return TOKEN_END;
-  "escape_strings"   return TOKEN_ESCAPE_STRINGS;
-  "exists"           return TOKEN_EXISTS;
-  "extract"          return TOKEN_EXTRACT;
-  "false"            return TOKEN_FALSE;
-  "first"            return TOKEN_FIRST;
-  "float"            return TOKEN_FLOAT;
-  "following"        return TOKEN_FOLLOWING;
-  "for"              return TOKEN_FOR;
-  "foreign"          return TOKEN_FOREIGN;
-  "from"             return TOKEN_FROM;
-  "full"             return TOKEN_FULL;
-  "group"            return TOKEN_GROUP;
-  "hash"             return TOKEN_HASH;
-  "having"           return TOKEN_HAVING;
-  "hour"             return TOKEN_HOUR;
-  "in"               return TOKEN_IN;
-  "index"            return TOKEN_INDEX;
-  "inner"            return TOKEN_INNER;
-  "insert"           return TOKEN_INSERT;
-  "int"              return TOKEN_INTEGER;
-  "integer"          return TOKEN_INTEGER;
-  "interval"         return TOKEN_INTERVAL;
-  "into"             return TOKEN_INTO;
-  "is"               return TOKEN_IS;
-  "join"             return TOKEN_JOIN;
-  "key"              return TOKEN_KEY;
-  "last"             return TOKEN_LAST;
-  "left"             return TOKEN_LEFT;
-  "like"             return TOKEN_LIKE;
-  "limit"            return TOKEN_LIMIT;
-  "long"             return TOKEN_LONG;
-  "minute"           return TOKEN_MINUTE;
-  "month"            return TOKEN_MONTH;
-  "not"              return TOKEN_NOT;
-  "null"             return TOKEN_NULL;
-  "nulls"            return TOKEN_NULLS;
-  "off"              return TOKEN_OFF;
-  "on"               return TOKEN_ON;
-  "or"               return TOKEN_OR;
-  "order"            return TOKEN_ORDER;
-  "outer"            return TOKEN_OUTER;
-  "over"             return TOKEN_OVER;
-  "partition"        return TOKEN_PARTITION;
-  "partitions"       return TOKEN_PARTITIONS;
-  "percent"          return TOKEN_PERCENT;
-  "preceding"        return TOKEN_PRECEDING;
-  "primary"          return TOKEN_PRIMARY;
-  "priority"         return TOKEN_PRIORITY;
-  "quit"             return TOKEN_QUIT;
-  "range"            return TOKEN_RANGE;
-  "real"             return TOKEN_REAL;
-  "references"       return TOKEN_REFERENCES;
-  "regexp"           return TOKEN_REGEXP;
-  "right"            return TOKEN_RIGHT;
-  "row"              return TOKEN_ROW;
-  "row_delimiter"    return TOKEN_ROW_DELIMITER;
-  "rows"             return TOKEN_ROWS;
-  "second"           return TOKEN_SECOND;
-  "select"           return TOKEN_SELECT;
-  "set"              return TOKEN_SET;
-  "sma"              return TOKEN_SMA;
-  "smallint"         return TOKEN_SMALLINT;
-  "substring"        return TOKEN_SUBSTRING;
-  "table"            return TOKEN_TABLE;
-  "then"             return TOKEN_THEN;
-  "time"             return TOKEN_TIME;
-  "timestamp"        return TOKEN_TIMESTAMP;
-  "true"             return TOKEN_TRUE;
-  "tuplesample"      return TOKEN_TUPLESAMPLE;
-  "unbounded"        return TOKEN_UNBOUNDED;
-  "unique"           return TOKEN_UNIQUE;
-  "update"           return TOKEN_UPDATE;
-  "using"            return TOKEN_USING;
-  "values"           return TOKEN_VALUES;
-  "varchar"          return TOKEN_VARCHAR;
-  "when"             return TOKEN_WHEN;
-  "where"            return TOKEN_WHERE;
-  "window"           return TOKEN_WINDOW;
-  "with"             return TOKEN_WITH;
-  "year"             return TOKEN_YEAR;
-  "yearmonth"        return TOKEN_YEARMONTH;
-
-  "="                return TOKEN_EQ;
-  "!="               return TOKEN_NEQ;
-  "<>"               return TOKEN_NEQ;
-  "<"                return TOKEN_LT;
-  ">"                return TOKEN_GT;
-  "<="               return TOKEN_LEQ;
-  ">="               return TOKEN_GEQ;
-
-  [-+*/%(),.;]       return yytext[0];
-  [\[\]]             return yytext[0];
-
-   /**
-    * Quoted strings. Prefacing a string with an 'e' or 'E' causes escape
-    * sequences to be processed (as in PostgreSQL).
-    **/
-  [eE]\' {
-    yylval->string_value_ = new quickstep::ParseString(yylloc->first_line, yylloc->first_column);
-    BEGIN(CONDITION_STRING_SINGLE_QUOTED_ESCAPED);
-  }
-
-  \' {
-    yylval->string_value_ = new quickstep::ParseString(yylloc->first_line, yylloc->first_column);
-    BEGIN(CONDITION_STRING_SINGLE_QUOTED);
-  }
-
-  \" {
-    yylval->string_value_ = new quickstep::ParseString(yylloc->first_line, yylloc->first_column);
-    BEGIN(CONDITION_STRING_DOUBLE_QUOTED);
-  }
-
-} /* CONDITION_SQL */
-
- /* Catch an unterminated string. */
-<CONDITION_STRING_SINGLE_QUOTED,CONDITION_STRING_SINGLE_QUOTED_ESCAPED,CONDITION_STRING_DOUBLE_QUOTED>{
-  <<EOF>> {
-    delete yylval->string_value_;
-    BEGIN(INITIAL);
-    quickstep_yyerror(NULL, yyscanner, NULL, "unterminated string");
-    return TOKEN_LEX_ERROR;
-  }
-}
-
- /* Process escape sequences. */
-<CONDITION_STRING_SINGLE_QUOTED_ESCAPED>{
-  \\[0-7]{1,3} {
-    /* Octal code */
-    unsigned int code;
-    std::sscanf(yytext + 1, "%o", &code);
-    if (code > 0xff) {
-      delete yylval->string_value_;
-      BEGIN(INITIAL);
-      quickstep_yyerror(NULL, yyscanner, NULL, "octal escape sequence out of 1-byte range");
-      return TOKEN_LEX_ERROR;
-    }
-    yylval->string_value_->push_back(code);
-  }
-  \\x[0-9a-fA-F]{1,2} {
-    /* Hexadecimal code */
-    unsigned int code;
-    std::sscanf(yytext + 2, "%x", &code);
-    yylval->string_value_->push_back(code);
-  }
-  \\[0-9]+ {
-    /* A numeric escape sequence that isn't correctly specified. */
-    delete yylval->string_value_;
-    BEGIN(INITIAL);
-    quickstep_yyerror(NULL, yyscanner, NULL, "bad numeric escape sequence (must be octal or hex)");
-    return TOKEN_LEX_ERROR;
-  }
-  \\b {
-    /* Backspace */
-    yylval->string_value_->push_back('\b');
-  }
-  \\f {
-    /* Form-feed */
-    yylval->string_value_->push_back('\f');
-  }
-  \\n {
-    /* Newline */
-    yylval->string_value_->push_back('\n');
-  }
-  \\r {
-    /* Carriage-return */
-    yylval->string_value_->push_back('\r');
-  }
-  \\t {
-    /* Horizontal Tab */
-    yylval->string_value_->push_back('\t');
-  }
-  \\(.|\n|\r) {
-    /* Any other character (including actual newline or carriage return) */
-    yylval->string_value_->push_back(yytext[1]);
-  }
-  \\ {
-    /* This should only be encountered right before an EOF. */
-    delete yylval->string_value_;
-    BEGIN(INITIAL);
-    quickstep_yyerror(NULL, yyscanner, NULL, "unfinished escape sequence");
-    return TOKEN_LEX_ERROR;
-  }
-}
-
-<CONDITION_STRING_SINGLE_QUOTED,CONDITION_STRING_SINGLE_QUOTED_ESCAPED>{
-  \'\' {
-    /* Two quotes in a row become a single quote (this is specified by the SQL standard). */
-    yylval->string_value_->push_back('\'');
-  }
-  \' {
-    /* End string */
-    BEGIN(CONDITION_SQL);
-    return TOKEN_STRING_SINGLE_QUOTED;
-  }
-}
-
-<CONDITION_STRING_DOUBLE_QUOTED>{
-  \"\" {
-    /* Two quotes in a row become a single quote (this is specified by the SQL standard). */
-    yylval->string_value_->push_back('"');
-  }
-  \" {
-    /* End string */
-    BEGIN(CONDITION_SQL);
-    return TOKEN_STRING_DOUBLE_QUOTED;
-  }
-}
-
-<CONDITION_STRING_SINGLE_QUOTED>[^\']+ {
-  /* Scan up to a quote. */
-  yylval->string_value_->append(yytext, yyleng);
-}
-
-<CONDITION_STRING_SINGLE_QUOTED_ESCAPED>[^\\\']+ {
-  /* Scan up to a quote or escape sequence. */
-  yylval->string_value_->append(yytext, yyleng);
-}
-
-<CONDITION_STRING_DOUBLE_QUOTED>[^\"]+ {
-  /* Scan up to a quote. */
-  yylval->string_value_->append(yytext, yyleng);
-}
-
-<CONDITION_SQL>{
-  [A-Za-z][A-Za-z0-9_]* {
-    yylval->string_value_ = new quickstep::ParseString(
-        yylloc->first_line, yylloc->first_column, std::string(yytext, yyleng));
-    return TOKEN_NAME;
-  }
-
-  {unsigned_numeric_literal} {
-    yylval->numeric_literal_value_ = new quickstep::NumericParseLiteralValue(
-        yylloc->first_line, yylloc->first_column, yytext);
-    return TOKEN_UNSIGNED_NUMVAL;
-  }
-
-  "--".* /* comment */
-
-  [\n] { yycolumn = 0; }
-
-  [ \r\t]+ ; /* ignore white space */
-
-} /* CONDITION_SQL */
-
-<INITIAL,CONDITION_COMMAND,CONDITION_SQL><<EOF>> {
-  /* All conditions except for mutli-state string extracting conditions. */
-  BEGIN(INITIAL);
-  return TOKEN_EOF;
-}
-
-<*>. {
-  BEGIN(INITIAL);
-  quickstep_yyerror(NULL, yyscanner, NULL, "illegal character");
-  return TOKEN_LEX_ERROR;
-}
-
-%%

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/parser/SqlParser.ypp
----------------------------------------------------------------------
diff --git a/parser/SqlParser.ypp b/parser/SqlParser.ypp
deleted file mode 100644
index 547bb40..0000000
--- a/parser/SqlParser.ypp
+++ /dev/null
@@ -1,2015 +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.
- **/
-
-%name-prefix "quickstep_yy"
-%define api.pure
-%locations
-%lex-param    {yyscan_t yyscanner}
-%parse-param  {yyscan_t yyscanner}
-%parse-param  {quickstep::ParseStatement **parsedStatement}
-
-/**
- * NOTE(chasseur): There are two known shift/reduce conflicts in this parser.
- * They are noted where they occur in the source below. When such a conflict
- * occurs, Bison resolves it by preferring to shift rather than reduce, which
- * is the correct, expected behavior for both cases in this parser.
- **/
-%expect 2
-
-%{
-
-/* Override the default definition, as we only need <first_line> and <first_column>. */
-typedef struct YYLTYPE {
-  int first_line;
-  int first_column;
-} YYLTYPE;
-
-#define YYLTYPE_IS_DECLARED 1
-
-/*
- * Modified from the default YYLLOC_DEFAULT
- * (http://www.gnu.org/software/bison/manual/html_node/Location-Default-Action.html).
- * The assignments for last_line and last_column are removed as they are not used.
- */
-#define YYLLOC_DEFAULT(current, rhs, n)                         \
-  do {                                                          \
-    if (n) {                                                    \
-      (current).first_line   = YYRHSLOC(rhs, 1).first_line;     \
-      (current).first_column = YYRHSLOC(rhs, 1).first_column;   \
-    } else {                                                    \
-      /* empty RHS */                                           \
-      (current).first_line = YYRHSLOC(rhs, 0).first_line;       \
-      (current).first_column = YYRHSLOC(rhs, 0).first_column;   \
-    }                                                           \
-  } while (0)
-
-%}
-
-%{
-#include <cstdlib>
-#include <string>
-#include <utility>
-
-#include "catalog/PartitionSchemeHeader.hpp"
-#include "parser/ParseAssignment.hpp"
-#include "parser/ParseAttributeDefinition.hpp"
-#include "parser/ParseBasicExpressions.hpp"
-#include "parser/ParseBlockProperties.hpp"
-#include "parser/ParseCaseExpressions.hpp"
-#include "parser/ParseExpression.hpp"
-#include "parser/ParseGeneratorTableReference.hpp"
-#include "parser/ParseGroupBy.hpp"
-#include "parser/ParseHaving.hpp"
-#include "parser/ParseJoinedTableReference.hpp"
-#include "parser/ParseKeyValue.hpp"
-#include "parser/ParseLimit.hpp"
-#include "parser/ParseLiteralValue.hpp"
-#include "parser/ParseOrderBy.hpp"
-#include "parser/ParsePartitionClause.hpp"
-#include "parser/ParsePredicate.hpp"
-#include "parser/ParsePredicateExists.hpp"
-#include "parser/ParsePredicateInTableQuery.hpp"
-#include "parser/ParsePriority.hpp"
-#include "parser/ParserUtil.hpp"
-#include "parser/ParseSample.hpp"
-#include "parser/ParseSelect.hpp"
-#include "parser/ParseSelectionClause.hpp"
-#include "parser/ParseSimpleTableReference.hpp"
-#include "parser/ParseStatement.hpp"
-#include "parser/ParseString.hpp"
-#include "parser/ParseSubqueryExpression.hpp"
-#include "parser/ParseSubqueryTableReference.hpp"
-#include "parser/ParseTableReference.hpp"
-#include "parser/ParseWindow.hpp"
-#include "storage/StorageBlockInfo.hpp"
-#include "types/Type.hpp"
-#include "types/TypeFactory.hpp"
-#include "types/TypeID.hpp"
-#include "types/operations/binary_operations/BinaryOperation.hpp"
-#include "types/operations/binary_operations/BinaryOperationFactory.hpp"
-#include "types/operations/binary_operations/BinaryOperationID.hpp"
-#include "types/operations/comparisons/Comparison.hpp"
-#include "types/operations/comparisons/ComparisonFactory.hpp"
-#include "types/operations/comparisons/ComparisonID.hpp"
-#include "types/operations/unary_operations/UnaryOperation.hpp"
-#include "types/operations/unary_operations/UnaryOperationFactory.hpp"
-#include "types/operations/unary_operations/UnaryOperationID.hpp"
-#include "utility/PtrList.hpp"
-#include "utility/PtrVector.hpp"
-
-// Needed for Bison 2.6 and higher, which do not automatically provide this typedef.
-typedef void* yyscan_t;
-%}
-
-%union{
-  quickstep::ParseString *string_value_;
-
-  quickstep::PtrList<quickstep::ParseString> *string_list_;
-
-  bool boolean_value_;
-
-  quickstep::NumericParseLiteralValue *numeric_literal_value_;
-  quickstep::ParseLiteralValue *literal_value_;
-  quickstep::PtrList<quickstep::ParseScalarLiteral> *literal_value_list_;
-
-  quickstep::ParseExpression *expression_;
-
-  quickstep::ParseScalarLiteral *scalar_literal_;
-  quickstep::ParseAttribute *attribute_;
-  quickstep::PtrList<quickstep::ParseAttribute> *attribute_list_;
-
-  quickstep::ParsePredicate *predicate_;
-
-  quickstep::ParseSubqueryExpression *subquery_expression_;
-
-  quickstep::PtrVector<quickstep::ParseSimpleWhenClause> *simple_when_clause_list_;
-  quickstep::ParseSimpleWhenClause *simple_when_clause_;
-
-  quickstep::PtrVector<quickstep::ParseSearchedWhenClause> *searched_when_clause_list_;
-  quickstep::ParseSearchedWhenClause *searched_when_clause_;
-
-  quickstep::ParseSelectionClause *selection_;
-  quickstep::ParseSelectionItem *selection_item_;
-  quickstep::ParseSelectionList *selection_list_;
-
-  quickstep::ParseTableReference *table_reference_;
-  quickstep::PtrList<quickstep::ParseTableReference> *table_reference_list_;
-  quickstep::ParseTableReferenceSignature *table_reference_signature_;
-
-  quickstep::ParseJoinedTableReference::JoinType join_type_;
-
-  quickstep::ParseDataType *data_type_;
-  quickstep::ParseAttributeDefinition *attribute_definition_;
-  quickstep::ParseColumnConstraint *column_constraint_;
-  quickstep::PtrList<quickstep::ParseColumnConstraint> *column_constraint_list_;
-  quickstep::PtrList<quickstep::ParseAttributeDefinition> *attribute_definition_list_;
-
-  quickstep::ParseKeyValue *key_value_;
-  quickstep::PtrList<quickstep::ParseKeyValue> *key_value_list_;
-  quickstep::ParseKeyStringValue *key_string_value_;
-  quickstep::ParseKeyStringList *key_string_list_;
-  quickstep::ParseKeyIntegerValue *key_integer_value_;
-
-  quickstep::ParseCopyFromParams *copy_from_params_;
-
-  quickstep::ParseAssignment *assignment_;
-  quickstep::PtrList<quickstep::ParseAssignment> *assignment_list_;
-
-  quickstep::ParseCommand *command_;
-  quickstep::PtrVector<quickstep::ParseString> *command_argument_list_;
-
-  quickstep::ParseStatement *statement_;
-  quickstep::ParseStatementSelect *select_statement_;
-  quickstep::ParseStatementUpdate *update_statement_;
-  quickstep::ParseStatementInsert *insert_statement_;
-  quickstep::ParseStatementDelete *delete_statement_;
-  quickstep::ParseStatementCopyFrom *copy_from_statement_;
-  quickstep::ParseStatementCreateTable *create_table_statement_;
-  quickstep::ParsePartitionClause *partition_clause_;
-  quickstep::ParseBlockProperties *block_properties_;
-  quickstep::ParseStatementDropTable *drop_table_statement_;
-  quickstep::ParseStatementQuit *quit_statement_;
-
-  const quickstep::Comparison *comparison_;
-  const quickstep::UnaryOperation *unary_operation_;
-  const quickstep::BinaryOperation *binary_operation_;
-
-  quickstep::ParseFunctionCall *function_call_;
-  quickstep::PtrList<quickstep::ParseExpression> *expression_list_;
-
-  quickstep::ParseSelect *select_query_;
-  quickstep::ParseGroupBy *opt_group_by_clause_;
-  quickstep::ParseHaving *opt_having_clause_;
-  quickstep::ParseOrderBy *opt_order_by_clause_;
-  bool *order_direction_;
-  quickstep::ParseLimit *opt_limit_clause_;
-
-  quickstep::ParseSample *opt_sample_clause_;
-
-  quickstep::PtrList<quickstep::ParseWindow> *opt_window_clause_;
-  quickstep::ParseWindow *window_definition_;
-  quickstep::PtrList<quickstep::ParseExpression> *window_partition_by_list_;
-  quickstep::PtrList<quickstep::ParseOrderByItem> *window_order_by_list_;
-  quickstep::ParseFrameInfo *window_frame_info_;
-
-  quickstep::PtrList<quickstep::ParseOrderByItem> *order_commalist_;
-  quickstep::ParseOrderByItem *order_item_;
-
-  quickstep::PtrVector<quickstep::ParseSubqueryTableReference> *with_list_;
-  quickstep::ParseSubqueryTableReference *with_list_element_;
-
-  quickstep::ParsePriority *opt_priority_clause_;
-}
-
-%{
-/* This header needs YYSTYPE, which is defined by the %union directive above */
-#include "SqlLexer_gen.hpp"
-void NotSupported(const YYLTYPE *location, yyscan_t yyscanner, const std::string &feature);
-%}
-
-%token <string_value_> TOKEN_COMMAND;
-%token <string_value_> TOKEN_NAME;
-%token <string_value_> TOKEN_STRING_SINGLE_QUOTED;
-%token <string_value_> TOKEN_STRING_DOUBLE_QUOTED;
-%token <numeric_literal_value_> TOKEN_UNSIGNED_NUMVAL;
-
-/* Operator precedence - least to greatest */
-%left TOKEN_OR
-%left TOKEN_AND
-%right TOKEN_NOT
-%right TOKEN_EQ
-%nonassoc TOKEN_LT TOKEN_LEQ TOKEN_GT TOKEN_GEQ TOKEN_NEQ
-%nonassoc TOKEN_LIKE TOKEN_REGEXP
-%nonassoc TOKEN_BETWEEN
-%nonassoc TOKEN_IS
-%left '+' '-'
-%left '*' '/'
-%right UNARY_PLUS UNARY_MINUS
-%left '.'
-
-%token TOKEN_ADD;
-%token TOKEN_ALL;
-%token TOKEN_ALTER;
-%token TOKEN_AND;
-%token TOKEN_AS;
-%token TOKEN_ASC;
-%token TOKEN_BIGINT;
-%token TOKEN_BIT;
-%token TOKEN_BITWEAVING;
-%token TOKEN_BLOCKPROPERTIES;
-%token TOKEN_BLOCKSAMPLE;
-%token TOKEN_BLOOM_FILTER;
-%token TOKEN_CSB_TREE;
-%token TOKEN_BY;
-%token TOKEN_CASE;
-%token TOKEN_CHARACTER;
-%token TOKEN_CHECK;
-%token TOKEN_COLUMN;
-%token TOKEN_CONSTRAINT;
-%token TOKEN_COPY;
-%token TOKEN_CREATE;
-%token TOKEN_CURRENT;
-%token TOKEN_DATE;
-%token TOKEN_DATETIME;
-%token TOKEN_DAY;
-%token TOKEN_DECIMAL;
-%token TOKEN_DEFAULT;
-%token TOKEN_DELETE;
-%token TOKEN_DELIMITER;
-%token TOKEN_DESC;
-%token TOKEN_DISTINCT;
-%token TOKEN_DOUBLE;
-%token TOKEN_DROP;
-%token TOKEN_ELSE;
-%token TOKEN_END;
-%token TOKEN_ESCAPE_STRINGS;
-%token TOKEN_EXISTS;
-%token TOKEN_EXTRACT;
-%token TOKEN_FALSE;
-%token TOKEN_FIRST;
-%token TOKEN_FLOAT;
-%token TOKEN_FOLLOWING;
-%token TOKEN_FOR;
-%token TOKEN_FOREIGN;
-%token TOKEN_FROM;
-%token TOKEN_FULL;
-%token TOKEN_GROUP;
-%token TOKEN_HASH;
-%token TOKEN_HAVING;
-%token TOKEN_HOUR;
-%token TOKEN_IN;
-%token TOKEN_INDEX;
-%token TOKEN_INNER;
-%token TOKEN_INSERT;
-%token TOKEN_INTEGER;
-%token TOKEN_INTERVAL;
-%token TOKEN_INTO;
-%token TOKEN_JOIN;
-%token TOKEN_KEY;
-%token TOKEN_LAST;
-%token TOKEN_LEFT;
-%token TOKEN_LIMIT;
-%token TOKEN_LONG;
-%token TOKEN_MINUTE;
-%token TOKEN_MONTH;
-%token TOKEN_NOT;
-%token TOKEN_NULL;
-%token TOKEN_NULLS;
-%token TOKEN_OFF;
-%token TOKEN_ON;
-%token TOKEN_OR;
-%token TOKEN_ORDER;
-%token TOKEN_OUTER;
-%token TOKEN_OVER;
-%token TOKEN_PARTITION;
-%token TOKEN_PARTITIONS;
-%token TOKEN_PERCENT;
-%token TOKEN_PRECEDING;
-%token TOKEN_PRIMARY;
-%token TOKEN_PRIORITY;
-%token TOKEN_QUIT;
-%token TOKEN_RANGE;
-%token TOKEN_REAL;
-%token TOKEN_REFERENCES;
-%token TOKEN_REGEXP;
-%token TOKEN_RIGHT;
-%token TOKEN_ROW;
-%token TOKEN_ROW_DELIMITER;
-%token TOKEN_ROWS;
-%token TOKEN_SECOND;
-%token TOKEN_SELECT;
-%token TOKEN_SET;
-%token TOKEN_SMA;
-%token TOKEN_SMALLINT;
-%token TOKEN_SUBSTRING;
-%token TOKEN_TABLE;
-%token TOKEN_THEN;
-%token TOKEN_TIME;
-%token TOKEN_TIMESTAMP;
-%token TOKEN_TRUE;
-%token TOKEN_TUPLESAMPLE;
-%token TOKEN_UNBOUNDED;
-%token TOKEN_UNIQUE;
-%token TOKEN_UPDATE;
-%token TOKEN_USING;
-%token TOKEN_VALUES;
-%token TOKEN_VARCHAR;
-%token TOKEN_WHEN;
-%token TOKEN_WHERE;
-%token TOKEN_WINDOW;
-%token TOKEN_WITH;
-%token TOKEN_YEAR;
-%token TOKEN_YEARMONTH;
-%token TOKEN_EOF;
-%token TOKEN_LEX_ERROR;
-
-%type <string_value_>
-  any_name
-  datetime_unit
-  index_type
-  partition_type
-
-%type <boolean_value_>
-  boolean_value
-  frame_mode
-
-%type <literal_value_>
-  literal_value
-
-%type <numeric_literal_value_>
-  frame_preceding
-  frame_following
-
-%type <literal_value_list_>
-  literal_value_commalist
-
-%type <expression_>
-  expression_base
-  unary_expression
-  multiply_expression
-  add_expression
-  case_expression
-  opt_else_clause
-  extract_function
-  substr_function
-
-%type <attribute_>
-  attribute_ref
-
-%type <attribute_list_>
-  attribute_ref_list
-  opt_column_list
-
-%type <predicate_>
-  predicate_expression_base
-  not_expression
-  and_expression
-  or_expression
-  where_clause
-  opt_where_clause
-
-%type <subquery_expression_>
-  subquery_expression
-
-%type <simple_when_clause_list_>
-  simple_when_clause_list
-
-%type <simple_when_clause_>
-  simple_when_clause
-
-%type <searched_when_clause_list_>
-  searched_when_clause_list
-
-%type <searched_when_clause_>
-  searched_when_clause
-
-%type <selection_>
-  selection
-
-%type <selection_item_>
-  selection_item
-
-%type <selection_list_>
-  selection_item_commalist
-
-%type <table_reference_>
-  table_reference
-  joined_table_reference
-
-%type <table_reference_list_>
-  joined_table_reference_commalist
-  from_clause
-
-%type <table_reference_signature_>
-  table_reference_signature
-  table_reference_signature_primary
-
-%type <join_type_>
-  join_type
-
-%type <data_type_>
-  data_type
-
-%type <attribute_definition_>
-  column_def
-
-%type <column_constraint_>
-  column_constraint_def
-
-%type <column_constraint_list_>
-  column_constraint_def_list
-  opt_column_constraint_def_list
-
-%type <attribute_definition_list_>
-  column_def_commalist
-
-%type <key_value_>
-  key_value
-
-%type <key_value_list_>
-  key_value_list
-  opt_index_properties
-
-%type <key_string_value_>
-  key_string_value
-
-%type <key_string_list_>
-  key_string_list
-
-%type <key_integer_value_>
-  key_integer_value
-
-%type <assignment_>
-  assignment_item
-
-%type <assignment_list_>
-  assignment_list
-
-%type <statement_>
-  sql_statement
-  alter_table_statement
-
-%type <select_statement_>
-  select_statement
-
-%type <select_query_>
-  select_query
-
-%type <update_statement_>
-  update_statement
-
-%type <delete_statement_>
-  delete_statement
-
-%type <insert_statement_>
-  insert_statement
-
-%type <copy_from_statement_>
-  copy_from_statement
-
-%type <copy_from_params_>
-  copy_from_params
-  opt_copy_from_params
-
-%type <create_table_statement_>
-  create_table_statement
-
-%type <block_properties_>
-  opt_block_properties
-
-%type <partition_clause_>
-  opt_partition_clause
-
-%type <statement_>
-  create_index_statement
-
-%type <drop_table_statement_>
-  drop_table_statement
-
-%type <quit_statement_>
-  quit_statement
-
-%type <string_list_>
-  name_commalist
-
-%type <comparison_>
-  comparison_operation
-
-%type <unary_operation_>
-  unary_operation
-
-%type <binary_operation_>
-/* binary_operation */
-  add_operation
-  multiply_operation
-
-%type <function_call_>
-  function_call
-
-%type <expression_list_>
-  expression_list
-
-%type <opt_group_by_clause_>
-  opt_group_by_clause
-
-%type <opt_having_clause_>
-  opt_having_clause
-
-%type <opt_order_by_clause_>
-  opt_order_by_clause
-
-%type <order_commalist_>
-  order_commalist
-
-%type <order_item_>
-  order_item
-
-%type <order_direction_>
-  opt_order_direction
-  opt_nulls_first
-
-%type <opt_limit_clause_>
-  opt_limit_clause
-
-%type <opt_sample_clause_>
-  opt_sample_clause
-
-%type <opt_window_clause_>
-  opt_window_clause
-  window_declaration_list
-
-%type <window_definition_>
-  window_declaration
-  window_definition
-
-%type <window_partition_by_list_>
-  opt_window_partition
-
-%type <window_order_by_list_>
-  opt_window_order
-
-%type <window_frame_info_>
-  opt_window_frame
-
-%type <opt_priority_clause_>
-  opt_priority_clause
-
-%type <with_list_>
-  with_clause
-  with_list
-
-%type <with_list_element_>
-  with_list_element
-
-%type <command_>
-  command
-
-%type <command_argument_list_>
-  command_argument_list
-
-/*
-%type <int_val>
-  opt_all_distinct      // unimplemented
-  table_constraint_def  // unimplemented
-  table_constraint_def_commalist        // unimplemented
-  opt_table_constraint_def_commalist    // unimplemented
-*/
-
-%destructor { } <boolean_value_>
-%destructor { } <comparison_>
-%destructor { } <unary_operation_>
-%destructor { } <binary_operation_>
-%destructor { } <join_type_>
-
-%destructor {
-  if ($$ != nullptr) {
-    delete $$;
-  }
-} <*>
-
-%%
-
-start:
-  sql_statement ';' {
-    *parsedStatement = $1;
-    YYACCEPT;
-  }
-  | sql_statement TOKEN_EOF {
-    *parsedStatement = $1;
-    YYACCEPT;
-  }
-  | command '\n' {
-    *parsedStatement = $1;
-    YYACCEPT;
-  }
-  | command TOKEN_EOF {
-    *parsedStatement = $1;
-    YYACCEPT;
-  }
-  | error {
-    YYABORT;
-  }
-  | TOKEN_EOF {
-    // Regular yyparse() return codes are non-negative, so use a negative one here.
-    return -1;
-  };
-
-/* All supported statement types */
-sql_statement:
-  alter_table_statement {
-    $$ = $1;
-  }
-  | copy_from_statement {
-    $$ = $1;
-  }
-  | create_table_statement {
-    $$ = $1;
-  }
-  | create_index_statement {
-    $$ = $1;
-  }
-  | delete_statement {
-    $$ = $1;
-  }
-  | drop_table_statement {
-    $$ = $1;
-  }
-  | insert_statement {
-    $$ = $1;
-  }
-  | quit_statement {
-    $$ = $1;
-  }
-  | select_statement {
-    $$ = $1;
-  }
-  | update_statement {
-    $$ = $1;
-  };
-
-/* Quit statement */
-quit_statement:
-  TOKEN_QUIT {
-    $$ = new quickstep::ParseStatementQuit(@1.first_line, @1.first_column);
-  };
-
-/* Table modification statements */
-alter_table_statement:
-  TOKEN_ALTER TOKEN_TABLE any_name TOKEN_ADD TOKEN_COLUMN column_def {
-    delete $3;
-    delete $6;
-    $$ = nullptr;
-    NotSupported(&@1, yyscanner, "ALTER statements");
-    YYERROR;
-  }
-  | TOKEN_ALTER TOKEN_TABLE any_name TOKEN_ADD TOKEN_CONSTRAINT table_constraint_def {
-    delete $3;
-    $$ = nullptr;
-    NotSupported(&@1, yyscanner, "ALTER statements");
-    YYERROR;
-  }
-  | TOKEN_ALTER TOKEN_TABLE any_name TOKEN_DROP TOKEN_COLUMN any_name {
-    delete $3;
-    delete $6;
-    $$ = nullptr;
-    NotSupported(&@1, yyscanner, "ALTER statements");
-    YYERROR;
-  }
-  | TOKEN_ALTER TOKEN_TABLE any_name TOKEN_DROP TOKEN_CONSTRAINT any_name {
-    delete $3;
-    delete $6;
-    $$ = nullptr;
-    NotSupported(&@1, yyscanner, "ALTER statements");
-    YYERROR;
-  };
-
-create_table_statement:
-  TOKEN_CREATE TOKEN_TABLE any_name '(' column_def_commalist ')' opt_table_constraint_def_commalist opt_block_properties opt_partition_clause {
-    $$ = new quickstep::ParseStatementCreateTable(@1.first_line, @1.first_column, $3, $5, $8, $9);
-  };
-
-create_index_statement:
-  TOKEN_CREATE TOKEN_INDEX any_name TOKEN_ON any_name opt_column_list TOKEN_USING index_type opt_index_properties {
-    if ($9) {
-      $$ = new quickstep::ParseStatementCreateIndex(@1.first_line, @1.first_column, $3, $5, $6, $8, @9.first_line, @9.first_column, $9);
-    } else {
-      $$ = new quickstep::ParseStatementCreateIndex(@1.first_line, @1.first_column, $3, $5, $6, $8);
-    }
-  };
-
-drop_table_statement:
-  TOKEN_DROP TOKEN_TABLE any_name {
-    $$ = new quickstep::ParseStatementDropTable(@1.first_line, @1.first_column, $3);
-  };
-
-column_def:
-  any_name data_type opt_column_constraint_def_list {
-    $$ = new quickstep::ParseAttributeDefinition(@1.first_line, @1.first_column, $1, $2, $3);
-  };
-
-column_def_commalist:
-  column_def {
-    $$ = new quickstep::PtrList<quickstep::ParseAttributeDefinition>();
-    $$->push_back($1);
-  }
-  | column_def_commalist ',' column_def {
-    $$ = $1;
-    $$->push_back($3);
-  };
-
-data_type:
-  TOKEN_BIT {
-    $$ = nullptr;
-    NotSupported(&@1, yyscanner, "BIT data type");
-    YYERROR;
-  }
-  | TOKEN_DATE {
-    $$ = new quickstep::ParseDataType(quickstep::TypeFactory::GetType(quickstep::kDate));
-  }
-  | TOKEN_DATETIME {
-    $$ = new quickstep::ParseDataType(quickstep::TypeFactory::GetType(quickstep::kDatetime));
-  }
-  | TOKEN_TIME {
-    $$ = nullptr;
-    NotSupported(&@1, yyscanner, "TIME data type");
-    YYERROR;
-  }
-  | TOKEN_TIMESTAMP {
-    $$ = new quickstep::ParseDataType(quickstep::TypeFactory::GetType(quickstep::kDatetime));
-  }
-  | TOKEN_DECIMAL {
-    $$ = new quickstep::ParseDataType(quickstep::TypeFactory::GetType(quickstep::kDouble));
-  }
-  | TOKEN_REAL {
-    $$ = new quickstep::ParseDataType(quickstep::TypeFactory::GetType(quickstep::kDouble));
-  }
-  | TOKEN_DOUBLE {
-    $$ = new quickstep::ParseDataType(quickstep::TypeFactory::GetType(quickstep::kDouble));
-  }
-  | TOKEN_FLOAT {
-    $$ = new quickstep::ParseDataType(quickstep::TypeFactory::GetType(quickstep::kFloat));
-  }
-  | TOKEN_SMALLINT {
-    $$ = new quickstep::ParseDataType(quickstep::TypeFactory::GetType(quickstep::kInt));
-  }
-  | TOKEN_INTEGER {
-    $$ = new quickstep::ParseDataType(quickstep::TypeFactory::GetType(quickstep::kInt));
-  }
-  | TOKEN_BIGINT {
-    $$ = new quickstep::ParseDataType(quickstep::TypeFactory::GetType(quickstep::kLong));
-  }
-  | TOKEN_LONG {
-    $$ = new quickstep::ParseDataType(quickstep::TypeFactory::GetType(quickstep::kLong));
-  }
-  | TOKEN_INTERVAL {
-    /**
-     * NOTE(chasseur): This pattern exhibits a shift/reduce conflict with the
-     * TOKEN_INTERVAL case in 'literal_value'. Bison prefers to shift rather
-     * than reduce, so the case in 'literal_value' has precedence over this.
-     **/
-    $$ = nullptr;
-    quickstep_yyerror(&@1, yyscanner, nullptr,
-        "INTERVAL is ambiguous as a column type. Specify either DATETIME INTERVAL "
-        "or YEARMONTH INTERVAL");
-    YYERROR;
-  }
-  | TOKEN_DATETIME TOKEN_INTERVAL {
-    $$ = new quickstep::ParseDataType(quickstep::TypeFactory::GetType(quickstep::kDatetimeInterval));
-  }
-  | TOKEN_YEARMONTH TOKEN_INTERVAL {
-    $$ = new quickstep::ParseDataType(quickstep::TypeFactory::GetType(quickstep::kYearMonthInterval));
-  }
-  | TOKEN_CHARACTER '(' TOKEN_UNSIGNED_NUMVAL ')' {
-    if ($3->float_like()) {
-      delete $3;
-      $$ = NULL;
-      quickstep_yyerror(&@3, yyscanner, nullptr, "Non-integer length supplied for CHAR type");
-      YYERROR;
-    } else {
-      if ($3->long_value() <= 0) {
-        delete $3;
-        $$ = NULL;
-        quickstep_yyerror(&@3, yyscanner, nullptr, "Length for CHAR type must be at least 1");
-        YYERROR;
-      } else {
-        $$ = new quickstep::ParseDataType(quickstep::TypeFactory::GetType(quickstep::kChar, $3->long_value(), false));
-        delete $3;
-      }
-    }
-  }
-  | TOKEN_VARCHAR '(' TOKEN_UNSIGNED_NUMVAL ')' {
-    if ($3->float_like()) {
-      delete $3;
-      $$ = NULL;
-      quickstep_yyerror(&@3, yyscanner, nullptr, "Non-integer length supplied for VARCHAR type");
-      YYERROR;
-    } else {
-      if ($3->long_value() < 0) {
-        delete $3;
-        $$ = NULL;
-        quickstep_yyerror(&@3, yyscanner, nullptr, "Negative length supplied for VARCHAR type");
-        YYERROR;
-      } else {
-        $$ = new quickstep::ParseDataType(quickstep::TypeFactory::GetType(quickstep::kVarChar, $3->long_value(), false));
-        delete $3;
-      }
-    }
-  };
-
-column_constraint_def:
-  TOKEN_NULL {
-    $$ = new quickstep::ParseColumnConstraintNull(@1.first_line, @1.first_column);
-  }
-  | TOKEN_NOT TOKEN_NULL {
-    $$ = new quickstep::ParseColumnConstraintNotNull(@1.first_line, @1.first_column);
-  }
-  | TOKEN_UNIQUE {
-    $$ = nullptr;
-    NotSupported(&@1, yyscanner, "Column Constraints (UNIQUE)");
-    YYERROR;
-  }
-  | TOKEN_PRIMARY TOKEN_KEY {
-    $$ = nullptr;
-    NotSupported(&@1, yyscanner, "Column Constraints (PRIMARY KEY)");
-    YYERROR;
-  }
-  | TOKEN_DEFAULT literal_value {
-    $$ = nullptr;
-    delete $2;
-    NotSupported(&@1, yyscanner, "Column Constraints (DEFAULT)");
-    YYERROR;
-  }
-  | TOKEN_CHECK '(' or_expression ')' {
-    $$ = nullptr;
-    delete $3;
-    NotSupported(&@1, yyscanner, "Column Constraints (CHECK)");
-    YYERROR;
-  }
-  | TOKEN_REFERENCES any_name '(' any_name ')' {
-    $$ = nullptr;
-    delete $2;
-    delete $4;
-    NotSupported(&@1, yyscanner, "Foreign Keys");
-    YYERROR;
-  };
-
-column_constraint_def_list:
-  column_constraint_def_list column_constraint_def {
-    $$ = $1;
-    $$->push_back($2);
-  }
-  | column_constraint_def {
-    $$ = new quickstep::PtrList<quickstep::ParseColumnConstraint>();
-    $$->push_back($1);
-  };
-
-opt_column_constraint_def_list:
-  {
-    $$ = nullptr;
-  }
-  | column_constraint_def_list {
-    $$ = $1;
-  };
-
-table_constraint_def:
-  TOKEN_UNIQUE '(' name_commalist ')' {
-    delete $3;
-    NotSupported(&@1, yyscanner, "Table Constraints (UNIQUE)");
-    YYERROR;
-  }
-  | TOKEN_PRIMARY TOKEN_KEY '(' name_commalist ')' {
-    delete $4;
-    NotSupported(&@1, yyscanner, "Table Constraints (PRIMARY KEY)");
-    YYERROR;
-  }
-  | TOKEN_FOREIGN TOKEN_KEY '(' name_commalist ')' TOKEN_REFERENCES any_name '(' name_commalist ')' {
-    delete $4;
-    delete $7;
-    delete $9;
-    NotSupported(&@1, yyscanner, "Table Constraints (FOREIGN KEY)");
-    YYERROR;
-  }
-  | TOKEN_CHECK '(' or_expression ')' {
-    delete $3;
-    NotSupported(&@1, yyscanner, "Table Constraints (CHECK)");
-    YYERROR;
-  };
-
-table_constraint_def_commalist:
-  table_constraint_def_commalist ',' table_constraint_def {
-    NotSupported(&@1, yyscanner, "Table Constraints");
-    YYERROR;
-  }
-  | table_constraint_def {
-    NotSupported(&@1, yyscanner, "Table Constraints");
-    YYERROR;
-  };
-
-opt_table_constraint_def_commalist:
-  {
-    /* $$ = nullptr; */
-  }
-  | table_constraint_def_commalist {
-    /* $$ = $1; */
-  };
-
-opt_column_list:
-  {
-    $$ = nullptr;
-  }
-  | '(' attribute_ref_list ')' {
-    $$ = $2;
-  };
-
-opt_block_properties:
-  {
-    $$ = nullptr;
-  }
-  | TOKEN_WITH TOKEN_BLOCKPROPERTIES '(' key_value_list ')' {
-    $$ = new quickstep::ParseBlockProperties(@2.first_line, @2.first_column, $4);
-  }
-
-opt_partition_clause:
-  {
-    $$ = nullptr;
-  }
-  | TOKEN_PARTITION TOKEN_BY partition_type '(' name_commalist ')' TOKEN_PARTITIONS TOKEN_UNSIGNED_NUMVAL {
-    if ($8->float_like()) {
-      delete $8;
-      $$ = NULL;
-      quickstep_yyerror(&@8, yyscanner, NULL, "NUMBER OF PARTITIONS must be an integer");
-      YYERROR;
-    } else {
-      if ($8->long_value() <= 0 || $8->long_value() > 64) {
-        delete $8;
-        $$ = NULL;
-        quickstep_yyerror(&@8, yyscanner, NULL, "NUMBER OF PARITIONS must be between 1 and 64");
-        YYERROR;
-      } else {
-        $$ = new quickstep::ParsePartitionClause(@1.first_line, @1.first_column, $3, $5, $8);
-      }
-    }
-  }
-
-partition_type:
-  TOKEN_HASH {
-    $$ = new quickstep::ParseString(@1.first_line, @1.first_column,
-           std::to_string(quickstep::PartitionSchemeHeader::PartitionType::kHash));
-  }
-  | TOKEN_RANGE{
-    $$ = new quickstep::ParseString(@1.first_line, @1.first_column,
-           std::to_string(quickstep::PartitionSchemeHeader::PartitionType::kRange));
-  };
-
-key_value_list:
-  key_value {
-    $$ = new quickstep::PtrList<quickstep::ParseKeyValue>();
-    $$->push_back($1);
-  }
-  | key_value_list ',' key_value {
-    $$ = $1;
-    $$->push_back($3);
-  };
-
-key_value:
-  key_string_value {
-    $$ = $1;
-  }
-  | key_string_list {
-    $$ = $1;
-  }
-  | key_integer_value {
-    $$ = $1;
-  };
-
-key_string_value:
-  any_name any_name {
-    $$ = new quickstep::ParseKeyStringValue(@1.first_line, @1.first_column, $1, $2);
-  }
-  | any_name TOKEN_ALL {
-    // This is a special case to handle the COMPRESS ALL option of the BLOCK PROPERTIES.
-    $$ = new quickstep::ParseKeyStringValue(@1.first_line, @1.first_column, $1,
-        new quickstep::ParseString(@2.first_line, @2.first_column, "ALL"));
-  }
-
-key_string_list:
-  any_name '(' name_commalist ')' {
-    $$ = new quickstep::ParseKeyStringList(@1.first_line, @1.first_column, $1, $3);
-  };
-
-key_integer_value:
-  any_name TOKEN_UNSIGNED_NUMVAL {
-    if ($2->float_like()) {
-      delete $2;
-      $$ = nullptr;
-      quickstep_yyerror(&@2, yyscanner, nullptr, "Value must be an integer");
-      YYERROR;
-    }
-    $$ = new quickstep::ParseKeyIntegerValue(@1.first_line, @1.first_column, $1, $2);
-  };
-
-index_type:
-  TOKEN_BITWEAVING {
-    // Defaults to BitWeavingV, but IndexProperties can change this to H.
-    $$ = new quickstep::ParseString(@1.first_line, @1.first_column,
-           std::to_string(quickstep::IndexSubBlockType::kBitWeavingV));
-  }
-  | TOKEN_BLOOM_FILTER {
-    $$ = new quickstep::ParseString(@1.first_line, @1.first_column,
-           std::to_string(quickstep::IndexSubBlockType::kBloomFilter));
-  }
-  | TOKEN_CSB_TREE {
-    $$ = new quickstep::ParseString(@1.first_line, @1.first_column,
-           std::to_string(quickstep::IndexSubBlockType::kCSBTree));
-  }
-  | TOKEN_SMA {
-    $$ = new quickstep::ParseString(@1.first_line, @1.first_column,
-           std::to_string(quickstep::IndexSubBlockType::kSMA));
-  };
-
-opt_index_properties:
-  {
-    $$ = nullptr;
-  }
-  | '(' key_value_list ')' {
-    $$ = $2;
-  };
-
-/* Update Database Contents */
-insert_statement:
-  TOKEN_INSERT TOKEN_INTO any_name '(' name_commalist ')' TOKEN_VALUES '(' literal_value_commalist ')' {
-    delete $3;
-    delete $5;
-    delete $9;
-    $$ = nullptr;
-    NotSupported(&@4, yyscanner, "list of column names in INSERT statement");
-    YYERROR;
-  }
-  | TOKEN_INSERT TOKEN_INTO any_name TOKEN_VALUES '(' literal_value_commalist ')' {
-    $$ = new quickstep::ParseStatementInsertTuple(@1.first_line, @1.first_column, $3, $6);
-  }
-  | TOKEN_INSERT TOKEN_INTO any_name select_query {
-    $$ = new quickstep::ParseStatementInsertSelection(@1.first_line, @2.first_column, $3, $4, nullptr);
-  }
-  | with_clause TOKEN_INSERT TOKEN_INTO any_name select_query {
-    $$ = new quickstep::ParseStatementInsertSelection(@1.first_line, @2.first_column, $4, $5, $1);
-  }
-  ;
-
-copy_from_statement:
-  TOKEN_COPY any_name TOKEN_FROM TOKEN_STRING_SINGLE_QUOTED opt_copy_from_params {
-    $$ = new quickstep::ParseStatementCopyFrom(@1.first_line, @1.first_column, $2, $4, $5);
-  };
-
-opt_copy_from_params:
-  {
-    $$ = nullptr;
-  }
-  | TOKEN_WITH '(' copy_from_params ')' {
-    $$ = $3;
-  };
-
-copy_from_params:
-  TOKEN_DELIMITER TOKEN_STRING_SINGLE_QUOTED {
-    $$ = new quickstep::ParseCopyFromParams(@1.first_line, @1.first_column);
-    $$->set_delimiter($2);
-  }
-  | TOKEN_ESCAPE_STRINGS boolean_value {
-    $$ = new quickstep::ParseCopyFromParams(@1.first_line, @1.first_column);
-    $$->escape_strings = $2;
-  }
-  | copy_from_params ',' TOKEN_DELIMITER TOKEN_STRING_SINGLE_QUOTED {
-    $$ = $1;
-    $$->set_delimiter($4);
-  }
-  | copy_from_params ',' TOKEN_ESCAPE_STRINGS boolean_value {
-    $$ = $1;
-    $$->escape_strings = $4;
-  };
-
-update_statement:
-  TOKEN_UPDATE any_name TOKEN_SET assignment_list opt_where_clause {
-    $$ = new quickstep::ParseStatementUpdate(@1.first_line, @1.first_column, $2, $4, $5);
-  };
-
-delete_statement:
-  TOKEN_DELETE TOKEN_FROM any_name opt_where_clause {
-    $$ = new quickstep::ParseStatementDelete(@1.first_line, @1.first_column, $3, $4);
-  };
-
-assignment_list:
-  assignment_list ',' assignment_item {
-    $$ = $1;
-    $$->push_back($3);
-  }
-  | assignment_item {
-    $$ = new quickstep::PtrList<quickstep::ParseAssignment>();
-    $$->push_back($1);
-  };
-
-assignment_item:
-  any_name TOKEN_EQ add_expression {
-    $$ = new quickstep::ParseAssignment(@1.first_line, @1.first_column, $1, $3);
-  };
-
-/* Select Queries */
-select_statement:
-  select_query opt_priority_clause {
-    $$ = new quickstep::ParseStatementSelect(@1.first_line, @1.first_column, $1, nullptr, $2);
-  }
-  | with_clause select_query opt_priority_clause {
-    $$ = new quickstep::ParseStatementSelect(@1.first_line, @1.first_column, $2, $1, $3);
-  };
-
-opt_priority_clause:
-  {
-    $$ = nullptr;
-  }
-  | TOKEN_WITH TOKEN_PRIORITY TOKEN_UNSIGNED_NUMVAL {
-    if ($3->float_like()) {
-      delete $3;
-      $$ = nullptr;
-      quickstep_yyerror(&@3, yyscanner, nullptr, "PRIORITY value must be an integer");
-      YYERROR;
-    } else {
-      if ($3->long_value() <= 0) {
-        delete $3;
-        $$ = nullptr;
-        quickstep_yyerror(&@3, yyscanner, nullptr, "PRIORITY value must be positive");
-        YYERROR;
-      } else {
-        $$ = new quickstep::ParsePriority(@1.first_line, @1.first_column, $3);
-      }
-    }
-  };
-
-with_clause:
-  TOKEN_WITH with_list {
-    $$ = $2;
-  }
-
-with_list:
-  with_list_element {
-    $$ = new quickstep::PtrVector<quickstep::ParseSubqueryTableReference>();
-    $$->push_back($1);
-  }
-  | with_list ',' with_list_element {
-    $$ = $1;
-    $$->push_back($3);
-  };
-
-with_list_element:
-  table_reference_signature_primary TOKEN_AS subquery_expression {
-    $$ = new quickstep::ParseSubqueryTableReference(@1.first_line, @1.first_column, $3);
-    $$->set_table_reference_signature($1);
-  };
-
-select_query:
-  TOKEN_SELECT opt_all_distinct selection from_clause opt_where_clause opt_group_by_clause opt_having_clause
-      opt_order_by_clause opt_limit_clause opt_window_clause {
-    $$ = new quickstep::ParseSelect(@1.first_line, @1.first_column, $3, $4, $5, $6, $7, $8, $9, $10);
-  };
-
-opt_all_distinct:
-  {
-    /* $$ = nullptr; */
-  }
-  | TOKEN_ALL {
-    NotSupported(&@1, yyscanner, "ALL in selection");
-    YYERROR;
-  }
-  | TOKEN_DISTINCT {
-    NotSupported(&@1, yyscanner, "DISTINCT in selection");
-    YYERROR;
-  };
-
-selection:
-  '*' {
-    $$ = new quickstep::ParseSelectionStar(@1.first_line, @1.first_column);
-  }
-  | selection_item_commalist {
-    $$ = $1;
-  };
-
-selection_item_commalist:
-  selection_item {
-    $$ = new quickstep::ParseSelectionList(@1.first_line, @1.first_column);
-    $$->add($1);
-  }
-  | selection_item_commalist ',' selection_item {
-    $$ = $1;
-    $$->add($3);
-  };
-
-selection_item:
-  add_expression TOKEN_AS any_name {
-    $$ = new quickstep::ParseSelectionItem(@1.first_line, @1.first_column, $1, $3);
-  }
-  | add_expression any_name {
-    $$ = new quickstep::ParseSelectionItem(@1.first_line, @1.first_column, $1, $2);
-  }
-  | add_expression {
-    $$ = new quickstep::ParseSelectionItem(@1.first_line, @1.first_column, $1);
-  };
-
-from_clause:
-  TOKEN_FROM joined_table_reference_commalist {
-    $$ = $2;
-  };
-
-subquery_expression:
-  '(' select_query ')' {
-    $$ = new quickstep::ParseSubqueryExpression(@1.first_line, @1.first_column, $2);
-  };
-
-opt_sample_clause:
-  {
-    $$ = NULL;
-  }
-  | TOKEN_BLOCKSAMPLE TOKEN_UNSIGNED_NUMVAL TOKEN_PERCENT {
-    $$ = new quickstep::ParseSample(@1.first_line, @1.first_column, true, $2);
-  }
-  | TOKEN_TUPLESAMPLE TOKEN_UNSIGNED_NUMVAL TOKEN_PERCENT {
-    $$ = new quickstep::ParseSample(@1.first_line, @1.first_column, false, $2);
-  };
-
-join_type:
-  {
-    $$ = quickstep::ParseJoinedTableReference::JoinType::kInnerJoin;
-  }
-  | TOKEN_INNER {
-    $$ = quickstep::ParseJoinedTableReference::JoinType::kInnerJoin;
-  }
-  | TOKEN_LEFT {
-    $$ = quickstep::ParseJoinedTableReference::JoinType::kLeftOuterJoin;
-  }
-  | TOKEN_LEFT TOKEN_OUTER {
-    $$ = quickstep::ParseJoinedTableReference::JoinType::kLeftOuterJoin;
-  }
-  | TOKEN_RIGHT {
-    $$ = quickstep::ParseJoinedTableReference::JoinType::kRightOuterJoin;
-  }
-  | TOKEN_RIGHT TOKEN_OUTER {
-    $$ = quickstep::ParseJoinedTableReference::JoinType::kRightOuterJoin;
-  }
-  | TOKEN_FULL {
-    $$ = quickstep::ParseJoinedTableReference::JoinType::kFullOuterJoin;
-  }
-  | TOKEN_FULL TOKEN_OUTER {
-    $$ = quickstep::ParseJoinedTableReference::JoinType::kFullOuterJoin;
-  };
-
-joined_table_reference:
-  joined_table_reference join_type TOKEN_JOIN table_reference TOKEN_ON or_expression {
-    $$ = new quickstep::ParseJoinedTableReference(@3.first_line, @3.first_column, $2, $1, $4, $6);
-  }
-  | table_reference {
-    $$ = $1;
-  };
-
-table_reference:
-  subquery_expression table_reference_signature {
-    $$ = new quickstep::ParseSubqueryTableReference(@1.first_line, @1.first_column, $1);
-    $$->set_table_reference_signature($2);
-  }
-  | any_name opt_sample_clause table_reference_signature {
-    $$ = new quickstep::ParseSimpleTableReference(@1.first_line, @1.first_column, $1, $2);
-    $$->set_table_reference_signature($3);
-  }
-  | any_name opt_sample_clause {
-    $$ = new quickstep::ParseSimpleTableReference(@1.first_line, @1.first_column, $1, $2);
-  }
-  | function_call table_reference_signature {
-    $$ = new quickstep::ParseGeneratorTableReference(@1.first_line, @1.first_column, $1);
-    $$->set_table_reference_signature($2);
-  }
-  | function_call {
-    $$ = new quickstep::ParseGeneratorTableReference(@1.first_line, @1.first_column, $1);
-  }
-  | '(' joined_table_reference ')' {
-    $$ = $2;
-  };
-
-table_reference_signature:
-  table_reference_signature_primary {
-    $$ = $1;
-  }
-  | TOKEN_AS table_reference_signature_primary {
-    $$ = $2;
-  };
-
-table_reference_signature_primary:
-  any_name {
-    $$ = new ::quickstep::ParseTableReferenceSignature(@1.first_line, @1.first_column, $1);
-  }
-  | any_name '(' name_commalist ')' {
-    $$ = new ::quickstep::ParseTableReferenceSignature(@1.first_line, @1.first_column, $1, $3);
-  };
-
-joined_table_reference_commalist:
-  joined_table_reference {
-    $$ = new quickstep::PtrList<quickstep::ParseTableReference>();
-    $$->push_back($1);
-  }
-  | joined_table_reference_commalist ',' joined_table_reference {
-    $$ = $1;
-    $$->push_back($3);
-  };
-
-opt_group_by_clause:
-  {
-    $$ = nullptr;
-  }
-  | TOKEN_GROUP TOKEN_BY expression_list {
-    $$ = new quickstep::ParseGroupBy(@1.first_line, @1.first_column, $3);
-  };
-
-opt_having_clause:
-  {
-    $$ = nullptr;
-  }
-  | TOKEN_HAVING or_expression {
-    $$ = new quickstep::ParseHaving(@1.first_line, @1.first_column, $2);
-  };
-
-opt_order_by_clause:
-  {
-    $$ = nullptr;
-  }
-  | TOKEN_ORDER TOKEN_BY order_commalist {
-    $$ = new quickstep::ParseOrderBy(@1.first_line, @1.first_column, $3);
-  };
-
-opt_limit_clause:
-  {
-    $$ = nullptr;
-  }
-  | TOKEN_LIMIT TOKEN_UNSIGNED_NUMVAL {
-    if ($2->float_like()) {
-      delete $2;
-      $$ = nullptr;
-      quickstep_yyerror(&@2, yyscanner, nullptr, "LIMIT value must be an integer");
-      YYERROR;
-    } else {
-      if ($2->long_value() <= 0) {
-        delete $2;
-        $$ = nullptr;
-        quickstep_yyerror(&@2, yyscanner, nullptr, "LIMIT value must be positive");
-        YYERROR;
-      } else {
-        $$ = new quickstep::ParseLimit(@1.first_line, @1.first_column, $2);
-      }
-    }
-  }
-
-opt_window_clause:
-  {
-    $$ = nullptr;
-  }
-  | window_declaration_list {
-    $$ = $1;
-  }
-
-window_declaration_list:
-  window_declaration {
-    $$ = new quickstep::PtrList<quickstep::ParseWindow>();
-    $$->push_back($1);
-  }
-  | window_declaration_list window_declaration {
-    $$ = $1;
-    $$->push_back($2);
-  }
-
-window_declaration:
-  TOKEN_WINDOW any_name TOKEN_AS '(' window_definition ')' {
-    $$ = $5;
-    $$->setName($2);
-  }
-
-window_definition:
-  opt_window_partition opt_window_order opt_window_frame {
-    $$ = new quickstep::ParseWindow(@1.first_line, @1.first_column, $1, $2, $3);
-  };
-
-opt_window_partition:
-  {
-    $$ = nullptr;
-  }
-  | TOKEN_PARTITION TOKEN_BY expression_list {
-    $$ = $3;
-  };
-
-opt_window_order:
-  {
-    $$ = nullptr;
-  }
-  | TOKEN_ORDER TOKEN_BY order_commalist  {
-    $$ = $3;
-  };
-
-opt_window_frame:
-  {
-    $$ = nullptr;
-  }
-  | frame_mode TOKEN_BETWEEN frame_preceding TOKEN_AND frame_following {
-    $$ = new quickstep::ParseFrameInfo(@1.first_line, @1.first_column, $1, $3->long_value(), $5->long_value());
-  };
-
-frame_mode:
-  TOKEN_ROWS {
-    $$ = true;
-  }
-  | TOKEN_RANGE {
-    $$ = false;
-  };
-
-frame_preceding:
-  TOKEN_UNSIGNED_NUMVAL TOKEN_PRECEDING
-  | TOKEN_UNBOUNDED TOKEN_PRECEDING {
-    $$ = new quickstep::NumericParseLiteralValue(@1.first_line, @1.first_column, "-1");
-  }
-  | TOKEN_CURRENT TOKEN_ROW {
-    $$ = new quickstep::NumericParseLiteralValue(@1.first_line, @1.first_column, "0");
-  };
-
-frame_following:
-  TOKEN_UNSIGNED_NUMVAL TOKEN_FOLLOWING
-  | TOKEN_UNBOUNDED TOKEN_FOLLOWING {
-    $$ = new quickstep::NumericParseLiteralValue(@1.first_line, @1.first_column, "-1");
-  }
-  | TOKEN_CURRENT TOKEN_ROW {
-    $$ = new quickstep::NumericParseLiteralValue(@1.first_line, @1.first_column, "0");
-  };
-
-order_commalist:
-  order_item {
-    $$ = new quickstep::PtrList<quickstep::ParseOrderByItem>();
-    $$->push_back($1);
-  }
-  | order_commalist ',' order_item {
-    $$ = $1;
-    $$->push_back($3);
-  };
-
-order_item:
-  add_expression opt_order_direction opt_nulls_first {
-    $$ = new quickstep::ParseOrderByItem(@1.first_line, @1.first_column, $1, $2, $3);
-    delete $2;
-    delete $3;
-  };
-
-opt_order_direction:
-  {
-    $$ = nullptr;
-  }
-  | TOKEN_ASC {
-    $$ = new bool(true);
-  }
-  | TOKEN_DESC {
-    $$ = new bool(false);
-  };
-
-opt_nulls_first:
-  {
-    $$ = nullptr;
-  }
-  | TOKEN_NULLS TOKEN_FIRST {
-    $$ = new bool(true);
-  }
-  | TOKEN_NULLS TOKEN_LAST {
-    $$ = new bool(false);
-  };
-
-/* Predicates */
-opt_where_clause:
-  {
-    $$ = nullptr;
-  }
-  | where_clause {
-    $$ = $1;
-  };
-
-where_clause:
-  TOKEN_WHERE or_expression {
-    $$ = $2;
-  };
-
-or_expression:
-  or_expression TOKEN_OR and_expression {
-    if ($1->getParsePredicateType() == quickstep::ParsePredicate::kDisjunction) {
-      $$ = $1;
-    } else {
-      $$ = new quickstep::ParsePredicateDisjunction(@1.first_line, @1.first_column);
-      static_cast<quickstep::ParsePredicateDisjunction *>($$)->addPredicate($1);
-    }
-    static_cast<quickstep::ParsePredicateDisjunction *>($$)->addPredicate($3);
-  }
-  | and_expression {
-    $$ = $1;
-  };
-
-and_expression:
-  and_expression TOKEN_AND not_expression {
-    if ($1->getParsePredicateType() == quickstep::ParsePredicate::kConjunction) {
-      $$ = $1;
-    } else {
-      $$ = new quickstep::ParsePredicateConjunction(@1.first_line, @1.first_column);
-      static_cast<quickstep::ParsePredicateConjunction *>($$)->addPredicate($1);
-    }
-    static_cast<quickstep::ParsePredicateConjunction *>($$)->addPredicate($3);
-  }
-  | not_expression {
-    $$ = $1;
-  };
-
-not_expression:
-  TOKEN_NOT predicate_expression_base {
-    $$ = new quickstep::ParsePredicateNegation(@1.first_line, @1.first_column, $2);
-  }
-  | predicate_expression_base {
-    $$ = $1;
-  };
-
-predicate_expression_base:
-  add_expression TOKEN_BETWEEN add_expression TOKEN_AND add_expression {
-    $$ = new quickstep::ParsePredicateBetween(@2.first_line, @2.first_column, $1, $3, $5);
-  }
-  | add_expression TOKEN_NOT TOKEN_BETWEEN add_expression TOKEN_AND add_expression {
-    $$ = new quickstep::ParsePredicateNegation(
-        @2.first_line, @2.first_column,
-        new quickstep::ParsePredicateBetween(@3.first_line, @3.first_column, $1, $4, $6));
-  }
-  | attribute_ref TOKEN_IS TOKEN_NOT TOKEN_NULL {
-    delete $1;
-    $$ = nullptr;
-    NotSupported(&@2, yyscanner, "NULL comparison predicates");
-    YYERROR;
-  }
-  | attribute_ref TOKEN_IS TOKEN_NULL {
-    delete $1;
-    $$ = nullptr;
-    NotSupported(&@2, yyscanner, "NULL comparison predicates");
-    YYERROR;
-  }
-  | add_expression comparison_operation add_expression {
-    $$ = new quickstep::ParsePredicateComparison(@2.first_line, @2.first_column, *$2, $1, $3);
-  }
-  | '(' or_expression ')' {
-    $$ = $2;
-  }
-  | TOKEN_EXISTS subquery_expression {
-    $$ = new quickstep::ParsePredicateExists(@1.first_line, @1.first_column, $2);
-  }
-  | add_expression TOKEN_IN subquery_expression {
-    $$ = new quickstep::ParsePredicateInTableQuery(@2.first_line, @2.first_column, $1, $3);
-  }
-  | add_expression TOKEN_IN '(' expression_list ')' {
-    $$ = new quickstep::ParsePredicateInValueList(@2.first_line, @2.first_column, $1, $4);
-  }
-  | add_expression TOKEN_NOT TOKEN_IN subquery_expression {
-    $$ = new quickstep::ParsePredicateNegation(
-        @2.first_line,
-        @2.first_column,
-        new quickstep::ParsePredicateInTableQuery(@3.first_line, @3.first_column, $1, $4));
-  }
-  | add_expression TOKEN_NOT TOKEN_IN '(' expression_list ')' {
-    $$ = new quickstep::ParsePredicateNegation(
-        @2.first_line,
-        @2.first_column,
-        new quickstep::ParsePredicateInValueList(@3.first_line, @3.first_column, $1, $5));
-  };
-
-/* Scalars */
-add_expression:
-  add_expression add_operation multiply_expression {
-    $$ = new quickstep::ParseBinaryExpression(@2.first_line, @2.first_column, *$2, $1, $3);
-  }
-  | multiply_expression {
-    $$ = $1;
-  };
-
-multiply_expression:
-  multiply_expression multiply_operation unary_expression {
-    $$ = new quickstep::ParseBinaryExpression(@2.first_line, @2.first_column, *$2, $1, $3);
-  }
-  | unary_expression {
-    $$ = $1;
-  };
-
-unary_expression:
-  unary_operation expression_base {
-    $$ = new quickstep::ParseUnaryExpression(@1.first_line, @1.first_column, *$1, $2);
-  }
-  | expression_base {
-    $$ = $1;
-  };
-
-expression_base:
-  attribute_ref {
-    $$ = $1;
-  }
-  | literal_value {
-    $$ = new quickstep::ParseScalarLiteral($1);
-  }
-  | function_call {
-    $$ = $1;
-  }
-  | function_call TOKEN_OVER any_name {
-    $1->setWindowName($3);
-    $$ = $1;
-  }
-  | function_call TOKEN_OVER '(' window_definition ')' {
-    $1->setWindow($4);
-    $$ = $1;
-  }
-  | extract_function {
-    $$ = $1;
-  }
-  | substr_function {
-    $$ = $1;
-  }
-  | case_expression {
-    $$ = $1;
-  }
-  | '(' add_expression ')' {
-    $$ = $2;
-  }
-  | subquery_expression {
-    $$ = $1;
-  };
-
-function_call:
-  any_name '(' ')' {
-    $$ = new quickstep::ParseFunctionCall(
-        @1.first_line, @1.first_column, false, $1, new quickstep::PtrList<quickstep::ParseExpression>());
-  }
-  | any_name '(' '*' ')' {
-    $$ = new quickstep::ParseFunctionCall(
-        @1.first_line, @1.first_column, $1, new quickstep::ParseStar(@3.first_line, @3.first_column));
-  }
-  | any_name '(' expression_list ')' {
-    $$ = new quickstep::ParseFunctionCall(@1.first_line, @1.first_column, false, $1, $3);
-  };
-  | any_name '(' TOKEN_DISTINCT expression_list ')' {
-    $$ = new quickstep::ParseFunctionCall(@1.first_line, @1.first_column, true, $1, $4);
-  };
-
-extract_function:
-  TOKEN_EXTRACT '(' datetime_unit TOKEN_FROM add_expression ')' {
-    $$ = new quickstep::ParseExtractFunction(@1.first_line, @1.first_column, $3, $5);
-  };
-
-substr_function:
-  TOKEN_SUBSTRING '(' add_expression TOKEN_FROM TOKEN_UNSIGNED_NUMVAL ')' {
-    $$ = new quickstep::ParseSubstringFunction(
-        @1.first_line, @1.first_column, $3, $5->long_value());
-  }
-  | TOKEN_SUBSTRING '(' add_expression TOKEN_FROM TOKEN_UNSIGNED_NUMVAL TOKEN_FOR TOKEN_UNSIGNED_NUMVAL ')' {
-    $$ = new quickstep::ParseSubstringFunction(
-        @1.first_line, @1.first_column, $3, $5->long_value(), $7->long_value());
-  };
-
-case_expression:
-  TOKEN_CASE add_expression simple_when_clause_list opt_else_clause TOKEN_END {
-    $$ = new quickstep::ParseSimpleCaseExpression(@1.first_line, @1.first_column, $2, $3, $4);
-  }
-  | TOKEN_CASE searched_when_clause_list opt_else_clause TOKEN_END {
-    $$ = new quickstep::ParseSearchedCaseExpression(@1.first_line, @1.first_column, $2, $3);
-  };
-
-simple_when_clause_list:
-  simple_when_clause {
-    $$ = new quickstep::PtrVector<quickstep::ParseSimpleWhenClause>;
-    $$->push_back($1);
-  }
-  | simple_when_clause_list simple_when_clause {
-    $$ = $1;
-    $$->push_back($2);
-  };
-
-simple_when_clause:
-  TOKEN_WHEN add_expression TOKEN_THEN add_expression {
-    $$ = new quickstep::ParseSimpleWhenClause(@1.first_line, @1.first_column, $2, $4);
-  };
-
-searched_when_clause_list:
-  searched_when_clause {
-    $$ = new quickstep::PtrVector<quickstep::ParseSearchedWhenClause>;
-    $$->push_back($1);
-  }
-  | searched_when_clause_list searched_when_clause {
-    $$ = $1;
-    $$->push_back($2);
-  };
-
-searched_when_clause:
-  TOKEN_WHEN or_expression TOKEN_THEN add_expression {
-    $$ = new quickstep::ParseSearchedWhenClause(@1.first_line, @1.first_column, $2, $4);
-  };
-
-opt_else_clause:
-  {
-    $$ = NULL;
-  }
-  | TOKEN_ELSE add_expression {
-    $$ = $2;
-  };
-
-expression_list:
-  add_expression {
-    $$ = new quickstep::PtrList<quickstep::ParseExpression>();
-    $$->push_back($1);
-  }
-  | expression_list ',' add_expression {
-    $$ = $1;
-    $$->push_back($3);
-  };
-
-literal_value:
-  TOKEN_NULL {
-    $$ = new quickstep::NullParseLiteralValue(@1.first_line, @1.first_column);
-  }
-  | TOKEN_UNSIGNED_NUMVAL {
-    $$ = $1;
-  }
-  | '+' TOKEN_UNSIGNED_NUMVAL %prec UNARY_PLUS {
-    $$ = $2;
-  }
-  | '-' TOKEN_UNSIGNED_NUMVAL %prec UNARY_MINUS {
-    /**
-     * NOTE(chasseur): This case exhibits a shift/reduce conflict with the
-     * minus character as a 'unary_operation' followed by a numeric literal.
-     * Because Bison prefers to shift rather than reduce, this case has
-     * precedence (i.e. the parser will prefer to interpret the ambiguous
-     * pattern as a negative number literal rather than a unary minus operation
-     * applied to a non-negative number literal).
-     **/
-    $2->prependMinus();
-    $$ = $2;
-  }
-  | TOKEN_STRING_SINGLE_QUOTED {
-    $$ = new quickstep::StringParseLiteralValue($1,
-                                                nullptr);  // No explicit type.
-  }
-  | TOKEN_INTERVAL TOKEN_STRING_SINGLE_QUOTED {
-    /**
-     * NOTE(chasseur): This case exhibits a shift/reduce conflict with the
-     * plain TOKEN_INTERVAL case in 'data_type' reduced and used in the case
-     * below. Because Bison prefers to shift rather than reduce, this case has
-     * precedence (i.e. the special
-     * StringParseLiteralValue::ParseAmbiguousInterval() method will be used to
-     * parse the string as either one of the interval types, rather than an
-     * error being emitted because of an ambiguous type).
-     **/
-    quickstep::StringParseLiteralValue *parse_value;
-    if (quickstep::StringParseLiteralValue::ParseAmbiguousInterval($2, &parse_value)) {
-      $$ = parse_value;
-    } else {
-      $$ = nullptr;
-      quickstep_yyerror(&@2, yyscanner, nullptr, "Failed to parse literal as specified type");
-      YYERROR;
-    }
-  }
-  | TOKEN_INTERVAL TOKEN_STRING_SINGLE_QUOTED datetime_unit {
-    quickstep::StringParseLiteralValue *parse_value;
-    const std::string &datetime_type_value = $3->value();
-    if (quickstep::StringParseLiteralValue::ParseAmbiguousInterval(
-        &($2->append((" " + datetime_type_value).c_str(), datetime_type_value.length() + 1)),
-        &parse_value)) {
-      $$ = parse_value;
-    } else {
-      $$ = nullptr;
-      quickstep_yyerror(&@3, yyscanner, nullptr, "Failed to parse literal as specified type");
-      YYERROR;
-    }
-  }
-  | data_type TOKEN_STRING_SINGLE_QUOTED {
-    quickstep::StringParseLiteralValue *parse_value
-        = new quickstep::StringParseLiteralValue($2, &($1->getType()));
-    delete $1;
-    if (!parse_value->tryExplicitTypeParse()) {
-      delete parse_value;
-      $$ = nullptr;
-      quickstep_yyerror(&@2, yyscanner, nullptr, "Failed to parse literal as specified type");
-      YYERROR;
-    } else {
-      $$ = parse_value;
-    }
-  }
-
-datetime_unit:
-  TOKEN_YEAR {
-     $$ = new quickstep::ParseString(@1.first_line, @1.first_column, std::string("YEAR"));
-  }
-  | TOKEN_MONTH {
-     $$ = new quickstep::ParseString(@1.first_line, @1.first_column, std::string("MONTH"));
-  }
-  | TOKEN_DAY {
-     $$ = new quickstep::ParseString(@1.first_line, @1.first_column, std::string("DAY"));
-  }
-  | TOKEN_HOUR {
-     $$ = new quickstep::ParseString(@1.first_line, @1.first_column, std::string("HOUR"));
-  }
-  | TOKEN_MINUTE {
-     $$ = new quickstep::ParseString(@1.first_line, @1.first_column, std::string("MINUTE"));
-  }
-  | TOKEN_SECOND {
-     $$ = new quickstep::ParseString(@1.first_line, @1.first_column, std::string("SECOND"));
-  };
-
-literal_value_commalist:
-  literal_value {
-    $$ = new quickstep::PtrList<quickstep::ParseScalarLiteral>();
-    $$->push_back(new quickstep::ParseScalarLiteral($1));
-  }
-  | literal_value_commalist ',' literal_value {
-    $$ = $1;
-    $$->push_back(new quickstep::ParseScalarLiteral($3));
-  };
-
-attribute_ref:
-  any_name {
-    $$ = new quickstep::ParseAttribute(@1.first_line, @1.first_column, $1);
-  }
-  | any_name '.' any_name {
-    $$ = new quickstep::ParseAttribute(@1.first_line, @1.first_column, $3, $1);
-  };
-
-attribute_ref_list:
-  attribute_ref {
-    $$ = new quickstep::PtrList<quickstep::ParseAttribute>();
-    $$->push_back($1);
-  }
-  | attribute_ref_list ',' attribute_ref {
-    $$ = $1;
-    $$->push_back($3);
-  }
-
-/* Operations from libtypes */
-comparison_operation:
-  TOKEN_EQ {
-    $$ = &quickstep::ComparisonFactory::GetComparison(quickstep::ComparisonID::kEqual);
-  }
-  | TOKEN_NEQ {
-    $$ = &quickstep::ComparisonFactory::GetComparison(quickstep::ComparisonID::kNotEqual);
-  }
-  | TOKEN_LT {
-    $$ = &quickstep::ComparisonFactory::GetComparison(quickstep::ComparisonID::kLess);
-  }
-  | TOKEN_LEQ {
-    $$ = &quickstep::ComparisonFactory::GetComparison(quickstep::ComparisonID::kLessOrEqual);
-  }
-  | TOKEN_GT {
-    $$ = &quickstep::ComparisonFactory::GetComparison(quickstep::ComparisonID::kGreater);
-  }
-  | TOKEN_GEQ {
-    $$ = &quickstep::ComparisonFactory::GetComparison(quickstep::ComparisonID::kGreaterOrEqual);
-  }
-  | TOKEN_LIKE {
-    $$ =  &quickstep::ComparisonFactory::GetComparison(quickstep::ComparisonID::kLike);
-  }
-  | TOKEN_NOT TOKEN_LIKE {
-    $$ =  &quickstep::ComparisonFactory::GetComparison(quickstep::ComparisonID::kNotLike);
-  }
-  | TOKEN_REGEXP {
-    $$ =  &quickstep::ComparisonFactory::GetComparison(quickstep::ComparisonID::kRegexMatch);
-  }
-  | TOKEN_NOT TOKEN_REGEXP {
-    $$ =  &quickstep::ComparisonFactory::GetComparison(quickstep::ComparisonID::kNotRegexMatch);
-  };
-
-unary_operation:
-  '-' %prec UNARY_MINUS {
-    /**
-     * NOTE(chasseur): This case exhibits a shift/reduce conflict with the
-     * '-' TOKEN_UNSIGNED_NUMVAL case in 'literal_value'. Because Bison prefers
-     * to shift rather than reduce, the case in 'literal_value' has precedence
-     * over this one.
-     **/
-    $$ = &quickstep::UnaryOperationFactory::GetUnaryOperation(quickstep::UnaryOperationID::kNegate);
-  };
-
-add_operation:
-  '+' {
-    $$ = &quickstep::BinaryOperationFactory::GetBinaryOperation(quickstep::BinaryOperationID::kAdd);
-  }
-  | '-' {
-    $$ = &quickstep::BinaryOperationFactory::GetBinaryOperation(quickstep::BinaryOperationID::kSubtract);
-  };
-
-multiply_operation:
-  '%' {
-    $$ = &quickstep::BinaryOperationFactory::GetBinaryOperation(quickstep::BinaryOperationID::kModulo);
-  }
-  | '*' {
-    $$ = &quickstep::BinaryOperationFactory::GetBinaryOperation(quickstep::BinaryOperationID::kMultiply);
-  }
-  | '/' {
-    $$ = &quickstep::BinaryOperationFactory::GetBinaryOperation(quickstep::BinaryOperationID::kDivide);
-  };
-
-/* General Utility Stuff */
-name_commalist:
-  any_name {
-    $$ = new quickstep::PtrList<quickstep::ParseString>();
-    $$->push_back($1);
-  }
-  | name_commalist ',' any_name {
-    $$ = $1;
-    $$->push_back($3);
-  };
-
-any_name:
-  TOKEN_NAME {
-    $$ = $1;
-  }
-  | TOKEN_STRING_DOUBLE_QUOTED {
-    if ($1->value().empty()) {
-      quickstep_yyerror(&@1, yyscanner, nullptr, "Zero-length identifier");
-    }
-    $$ = $1;
-  };
-
-boolean_value:
-  TOKEN_TRUE {
-    $$ = true;
-  }
-  | TOKEN_ON {
-    $$ = true;
-  }
-  | TOKEN_FALSE {
-    $$ = false;
-  }
-  | TOKEN_OFF {
-    $$ = false;
-  };
-
-/* Command Statments */
-command:
-  TOKEN_COMMAND command_argument_list {
-    $$ = new quickstep::ParseCommand(@1.first_line, @1.first_column, $1, $2);
-  };
-
-command_argument_list:
-  command_argument_list TOKEN_COMMAND {
-    quickstep::PtrVector<quickstep::ParseString> *argument_list = $1;
-    argument_list->push_back($2);
-    $$ = argument_list;
-  }
-  | { /* Epsilon, an empy match. */
-    $$ = new quickstep::PtrVector<quickstep::ParseString>();
-  }
-
-%%
-
-void NotSupported(const YYLTYPE *location, yyscan_t yyscanner, const std::string &feature) {
-  std::string msg;
-  msg.append(feature);
-  msg.append(" is not supported yet");
-
-  quickstep_yyerror(location, yyscanner, nullptr, msg.c_str());
-}
-
-int quickstep_yyget_line_number(const YYLTYPE *yyloc) {
-  return yyloc->first_line;
-}
-
-int quickstep_yyget_column_number(const YYLTYPE *yyloc) {
-  return yyloc->first_column;
-}

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/parser/SqlParserWrapper.cpp
----------------------------------------------------------------------
diff --git a/parser/SqlParserWrapper.cpp b/parser/SqlParserWrapper.cpp
deleted file mode 100644
index 52a8910..0000000
--- a/parser/SqlParserWrapper.cpp
+++ /dev/null
@@ -1,153 +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 "parser/SqlParserWrapper.hpp"
-
-#include <string>
-
-#include "parser/ParseJoinedTableReference.hpp"
-#include "parser/ParseStatement.hpp"
-#include "utility/Macros.hpp"
-#include "utility/SqlError.hpp"
-
-#include "glog/logging.h"
-
-// Forward declarations needed for preprocessed/SqlParser_gen.hpp.
-namespace quickstep {
-
-class BinaryOperation;
-class Comparison;
-class NumericParseLiteralValue;
-class ParseAssignment;
-class ParseAttribute;
-class ParseAttributeDefinition;
-class ParseColumnConstraint;
-class ParseCommand;
-class ParseDataType;
-class ParseFunctionCall;
-class ParseKeyValue;
-class ParseKeyStringValue;
-class ParseKeyStringList;
-class ParseKeyLiteralValue;
-class ParseLiteralValue;
-class ParsePartitionClause;
-class ParsePredicate;
-class ParseSample;
-class ParseSearchedWhenClause;
-class ParseScalarLiteral;
-class ParseSelection;
-class ParseSelectionItem;
-class ParseSelectionList;
-class ParseSimpleWhenClause;
-class ParseTableReference;
-class Type;
-class UnaryOperation;
-
-struct ParseBulkInsertParams;
-
-template<class T> class PtrList;
-
-}  // namespace quickstep
-
-// Needed for Bison 2.6 and higher.
-typedef void* yyscan_t;
-
-#include "parser/SqlParser_gen.hpp"
-#include "parser/SqlLexer_gen.hpp"
-
-int quickstep_yyparse(yyscan_t yyscanner, quickstep::ParseStatement **parsedStatement);
-void quickstep_yyset_column(int column_no, yyscan_t yyscanner);
-
-namespace quickstep {
-
-SqlParserWrapper::SqlParserWrapper()
-    : current_buffer_(nullptr),
-      buffer_state_(nullptr),
-      parsed_statement_(nullptr) {
-  if (quickstep_yylex_init(&yyscanner_)) {
-    FATAL_ERROR("Unable to create lexer context.");
-  }
-}
-
-SqlParserWrapper::~SqlParserWrapper() {
-  destroyCurrentBuffer();
-
-  if (parsed_statement_ != nullptr) {
-    delete parsed_statement_;
-  }
-
-  quickstep_yylex_destroy(yyscanner_);
-}
-
-void SqlParserWrapper::feedNextBuffer(std::string *buffer) {
-  DCHECK(buffer != nullptr);
-  destroyCurrentBuffer();
-
-  current_buffer_ = buffer;
-  buffer_state_ = quickstep_yy_scan_string(buffer->c_str(), yyscanner_);
-
-  quickstep_yyset_lineno(0, yyscanner_);
-  quickstep_yyset_column(0, yyscanner_);
-}
-
-ParseResult SqlParserWrapper::getNextStatement() {
-  DCHECK(buffer_state_ != nullptr);
-  DCHECK(current_buffer_ != nullptr);
-  ParseResult retval;
-  retval.parsed_statement = nullptr;
-
-  if (parsed_statement_ != nullptr) {
-    delete parsed_statement_;
-    parsed_statement_ = nullptr;
-  }
-
-  int parser_return;
-  try {
-    parser_return = quickstep_yyparse(yyscanner_, &parsed_statement_);
-  } catch (const SqlError& error) {
-    parser_return = 1;
-    retval.error_message = error.formatMessage(*current_buffer_);
-  }
-
-  if (parser_return == 0) {
-    DCHECK(parsed_statement_ != nullptr);
-    retval.condition = ParseResult::kSuccess;
-    retval.parsed_statement = parsed_statement_;
-  } else if (parser_return > 0) {
-    retval.condition = ParseResult::kError;
-  } else {
-    retval.condition = ParseResult::kEndOfInput;
-  }
-
-  return retval;
-}
-
-void SqlParserWrapper::destroyCurrentBuffer() {
-  if (buffer_state_ != nullptr) {
-    quickstep_yyset_lineno(0, yyscanner_);
-    quickstep_yy_delete_buffer(buffer_state_, yyscanner_);
-    buffer_state_ = nullptr;
-  }
-  if (current_buffer_ != nullptr) {
-    delete current_buffer_;
-    current_buffer_ = nullptr;
-  }
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/parser/SqlParserWrapper.hpp
----------------------------------------------------------------------
diff --git a/parser/SqlParserWrapper.hpp b/parser/SqlParserWrapper.hpp
deleted file mode 100644
index e416e60..0000000
--- a/parser/SqlParserWrapper.hpp
+++ /dev/null
@@ -1,127 +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_PARSER_SQL_PARSER_WRAPPER_HPP_
-#define QUICKSTEP_PARSER_SQL_PARSER_WRAPPER_HPP_
-
-#include <string>
-
-#include "utility/Macros.hpp"
-
-struct yy_buffer_state;
-
-namespace quickstep {
-
-class ParseStatement;
-
-/** \addtogroup Parser
- *  @{
- */
-
-/**
- * @brief Struct containing the results of a parse.
- **/
-struct ParseResult {
-  enum Condition {
-    kSuccess,
-    kError,
-    kEndOfInput
-  };
-
-  /**
-   * @brief The outcome of the parse.
-   **/
-  Condition condition;
-
-  /**
-   * @brief If condition is Success, this is the parsed statement, otherwise
-   *        it is NULL.
-   **/
-  const ParseStatement *parsed_statement;
-
-  /**
-   * @brief The error message reported during the parsing. Non-empty only when the condition
-   *        is kError.
-   */
-  std::string error_message;
-};
-
-/**
- * @brief Wrapper encapsulating the Bison-generated parser and Flex-generated
- *        lexer.
- * @note The parser is reentrant, so an unlimited number of these wrappers can
- *       be safely created and used at the same time.
- **/
-class SqlParserWrapper {
- public:
-  /**
-   * @brief Constructor.
-   **/
-  SqlParserWrapper();
-
-  /**
-   * @brief Destructor.
-   **/
-  ~SqlParserWrapper();
-
-  /**
-   * @brief Feed the next string buffer to parse into the parser. In normal
-   *        operation, this should be called when starting parsing, and when
-   *        getNextStatement() starts returning a condition other than kSuccess.
-   *
-   * @param buffer The next string buffer to parse. This SqlParserWrapper takes
-   *        ownership of buffer and will destroy it when it is no longer
-   *        needed.
-   **/
-  void feedNextBuffer(std::string *buffer);
-
-  /**
-   * @brief Parse the next statement from the current buffer.
-   * @warning A buffer must be supplied to the SqlParserWrapper with
-   *          feedNextBuffer() before calling this method.
-   *
-   * @return The outcome of the parse.
-   **/
-  ParseResult getNextStatement();
-
-  /**
-   * @brief Returns the current string buffer.
-   *
-   * @return The current string buffer.
-   */
-  const std::string* current_buffer() const {
-    return current_buffer_;
-  }
-
- private:
-  void destroyCurrentBuffer();
-
-  std::string *current_buffer_;
-  yy_buffer_state *buffer_state_;
-  ParseStatement *parsed_statement_;
-  void *yyscanner_;
-
-  DISALLOW_COPY_AND_ASSIGN(SqlParserWrapper);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_PARSER_SQL_PARSER_WRAPPER_HPP_


[21/51] [abbrv] [partial] incubator-quickstep git commit: remove c++ files

Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/parser/tests/TPCH.test
----------------------------------------------------------------------
diff --git a/parser/tests/TPCH.test b/parser/tests/TPCH.test
deleted file mode 100644
index f0ffaa9..0000000
--- a/parser/tests/TPCH.test
+++ /dev/null
@@ -1,2301 +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.
-
-# Query 1
-SELECT
-  l_returnflag,
-  l_linestatus,
-  SUM(l_quantity) AS sum_qty,
-  SUM(l_extendedprice) AS sum_base_price,
-  SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_price,
-  SUM(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge,
-  AVG(l_quantity) AS avg_qty,
-  AVG(l_extendedprice) AS avg_price,
-  AVG(l_discount) AS avg_disc,
-  COUNT(*) AS count_order
-FROM
-  lineitem
-WHERE
-  l_shipdate <= DATE '1998-12-01' - INTERVAL '96 day'
-GROUP BY
-  l_returnflag,
-  l_linestatus
-ORDER BY
-  l_returnflag,
-  l_linestatus
---
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectList
-  | +-SelectListItem
-  | | +-AttributeReference[attribute_name=l_returnflag]
-  | +-SelectListItem
-  | | +-AttributeReference[attribute_name=l_linestatus]
-  | +-SelectListItem[alias=sum_qty]
-  | | +-FunctionCall[name=SUM]
-  | |   +-AttributeReference[attribute_name=l_quantity]
-  | +-SelectListItem[alias=sum_base_price]
-  | | +-FunctionCall[name=SUM]
-  | |   +-AttributeReference[attribute_name=l_extendedprice]
-  | +-SelectListItem[alias=sum_disc_price]
-  | | +-FunctionCall[name=SUM]
-  | |   +-Multiply
-  | |     +-left_operand=AttributeReference[attribute_name=l_extendedprice]
-  | |     +-right_operand=Subtract
-  | |       +-left_operand=Literal
-  | |       | +-NumericLiteral[numeric_string=1,float_like=false]
-  | |       +-right_operand=AttributeReference[attribute_name=l_discount]
-  | +-SelectListItem[alias=sum_charge]
-  | | +-FunctionCall[name=SUM]
-  | |   +-Multiply
-  | |     +-left_operand=Multiply
-  | |     | +-left_operand=AttributeReference[attribute_name=l_extendedprice]
-  | |     | +-right_operand=Subtract
-  | |     |   +-left_operand=Literal
-  | |     |   | +-NumericLiteral[numeric_string=1,float_like=false]
-  | |     |   +-right_operand=AttributeReference[attribute_name=l_discount]
-  | |     +-right_operand=Add
-  | |       +-left_operand=Literal
-  | |       | +-NumericLiteral[numeric_string=1,float_like=false]
-  | |       +-right_operand=AttributeReference[attribute_name=l_tax]
-  | +-SelectListItem[alias=avg_qty]
-  | | +-FunctionCall[name=AVG]
-  | |   +-AttributeReference[attribute_name=l_quantity]
-  | +-SelectListItem[alias=avg_price]
-  | | +-FunctionCall[name=AVG]
-  | |   +-AttributeReference[attribute_name=l_extendedprice]
-  | +-SelectListItem[alias=avg_disc]
-  | | +-FunctionCall[name=AVG]
-  | |   +-AttributeReference[attribute_name=l_discount]
-  | +-SelectListItem[alias=count_order]
-  |   +-FunctionCall[name=COUNT,is_star=true]
-  +-where_clause=LessOrEqual
-  | +-left_operand=AttributeReference[attribute_name=l_shipdate]
-  | +-right_operand=Subtract
-  |   +-left_operand=Literal
-  |   | +-StringLiteral[value=1998-12-01,explicit_type=Date]
-  |   +-right_operand=Literal
-  |     +-StringLiteral[value=96 day,explicit_type=DatetimeInterval]
-  +-group_by=GroupBy
-  | +-AttributeReference[attribute_name=l_returnflag]
-  | +-AttributeReference[attribute_name=l_linestatus]
-  +-order_by=OrderBy
-  | +-OrderByItem[is_asc=true,nulls_first=false]
-  | | +-AttributeReference[attribute_name=l_returnflag]
-  | +-OrderByItem[is_asc=true,nulls_first=false]
-  |   +-AttributeReference[attribute_name=l_linestatus]
-  +-from_clause=
-    +-TableReference[table=lineitem]
-==
-
-# Query 2
-SELECT
-  s_acctbal,
-  s_name,
-  n_name,
-  p_partkey,
-  p_mfgr,
-  s_address,
-  s_phone,
-  s_comment
-FROM
-  part,
-  supplier,
-  partsupp,
-  nation,
-  region
-WHERE
-  p_partkey = ps_partkey
-  AND s_suppkey = ps_suppkey
-  AND p_size = 48
-  AND p_type LIKE '%NICKEL'
-  AND s_nationkey = n_nationkey
-  AND n_regionkey = r_regionkey
-  AND r_name = 'ASIA'
-  AND ps_supplycost = (
-    SELECT
-      MIN(ps_supplycost)
-    FROM
-      partsupp,
-      supplier,
-      nation,
-      region
-    WHERE
-      p_partkey = ps_partkey
-      AND s_suppkey = ps_suppkey
-      AND s_nationkey = n_nationkey
-      AND n_regionkey = r_regionkey
-      AND r_name = 'ASIA'
-  )
-ORDER BY
-  s_acctbal desc,
-  n_name,
-  s_name,
-  p_partkey
-LIMIT 100
---
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectList
-  | +-SelectListItem
-  | | +-AttributeReference[attribute_name=s_acctbal]
-  | +-SelectListItem
-  | | +-AttributeReference[attribute_name=s_name]
-  | +-SelectListItem
-  | | +-AttributeReference[attribute_name=n_name]
-  | +-SelectListItem
-  | | +-AttributeReference[attribute_name=p_partkey]
-  | +-SelectListItem
-  | | +-AttributeReference[attribute_name=p_mfgr]
-  | +-SelectListItem
-  | | +-AttributeReference[attribute_name=s_address]
-  | +-SelectListItem
-  | | +-AttributeReference[attribute_name=s_phone]
-  | +-SelectListItem
-  |   +-AttributeReference[attribute_name=s_comment]
-  +-where_clause=And
-  | +-Equal
-  | | +-left_operand=AttributeReference[attribute_name=p_partkey]
-  | | +-right_operand=AttributeReference[attribute_name=ps_partkey]
-  | +-Equal
-  | | +-left_operand=AttributeReference[attribute_name=s_suppkey]
-  | | +-right_operand=AttributeReference[attribute_name=ps_suppkey]
-  | +-Equal
-  | | +-left_operand=AttributeReference[attribute_name=p_size]
-  | | +-right_operand=Literal
-  | |   +-NumericLiteral[numeric_string=48,float_like=false]
-  | +-Like
-  | | +-left_operand=AttributeReference[attribute_name=p_type]
-  | | +-right_operand=Literal
-  | |   +-StringLiteral[value=%NICKEL]
-  | +-Equal
-  | | +-left_operand=AttributeReference[attribute_name=s_nationkey]
-  | | +-right_operand=AttributeReference[attribute_name=n_nationkey]
-  | +-Equal
-  | | +-left_operand=AttributeReference[attribute_name=n_regionkey]
-  | | +-right_operand=AttributeReference[attribute_name=r_regionkey]
-  | +-Equal
-  | | +-left_operand=AttributeReference[attribute_name=r_name]
-  | | +-right_operand=Literal
-  | |   +-StringLiteral[value=ASIA]
-  | +-Equal
-  |   +-left_operand=AttributeReference[attribute_name=ps_supplycost]
-  |   +-right_operand=SubqueryExpression
-  |     +-Select
-  |       +-select_clause=SelectList
-  |       | +-SelectListItem
-  |       |   +-FunctionCall[name=MIN]
-  |       |     +-AttributeReference[attribute_name=ps_supplycost]
-  |       +-where_clause=And
-  |       | +-Equal
-  |       | | +-left_operand=AttributeReference[attribute_name=p_partkey]
-  |       | | +-right_operand=AttributeReference[attribute_name=ps_partkey]
-  |       | +-Equal
-  |       | | +-left_operand=AttributeReference[attribute_name=s_suppkey]
-  |       | | +-right_operand=AttributeReference[attribute_name=ps_suppkey]
-  |       | +-Equal
-  |       | | +-left_operand=AttributeReference[attribute_name=s_nationkey]
-  |       | | +-right_operand=AttributeReference[attribute_name=n_nationkey]
-  |       | +-Equal
-  |       | | +-left_operand=AttributeReference[attribute_name=n_regionkey]
-  |       | | +-right_operand=AttributeReference[attribute_name=r_regionkey]
-  |       | +-Equal
-  |       |   +-left_operand=AttributeReference[attribute_name=r_name]
-  |       |   +-right_operand=Literal
-  |       |     +-StringLiteral[value=ASIA]
-  |       +-from_clause=
-  |         +-TableReference[table=partsupp]
-  |         +-TableReference[table=supplier]
-  |         +-TableReference[table=nation]
-  |         +-TableReference[table=region]
-  +-order_by=OrderBy
-  | +-OrderByItem[is_asc=false,nulls_first=true]
-  | | +-AttributeReference[attribute_name=s_acctbal]
-  | +-OrderByItem[is_asc=true,nulls_first=false]
-  | | +-AttributeReference[attribute_name=n_name]
-  | +-OrderByItem[is_asc=true,nulls_first=false]
-  | | +-AttributeReference[attribute_name=s_name]
-  | +-OrderByItem[is_asc=true,nulls_first=false]
-  |   +-AttributeReference[attribute_name=p_partkey]
-  +-limit=LIMIT
-  | +-NumericLiteral[numeric_string=100,float_like=false]
-  +-from_clause=
-    +-TableReference[table=part]
-    +-TableReference[table=supplier]
-    +-TableReference[table=partsupp]
-    +-TableReference[table=nation]
-    +-TableReference[table=region]
-==
-
-# Query 3
-SELECT
-  l_orderkey,
-  SUM(l_extendedprice * (1 - l_discount)) AS revenue,
-  o_orderdate,
-  o_shippriority
-FROM
-  customer,
-  orders,
-  lineitem
-WHERE
-  c_mktsegment = 'AUTOMOBILE'
-  AND c_custkey = o_custkey
-  AND l_orderkey = o_orderkey
-  AND o_orderdate < DATE '1995-03-17'
-  AND l_shipdate > DATE '1995-03-17'
-GROUP BY
-  l_orderkey,
-  o_orderdate,
-  o_shippriority
-ORDER BY
-  revenue desc,
-  o_orderdate
-LIMIT 10
---
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectList
-  | +-SelectListItem
-  | | +-AttributeReference[attribute_name=l_orderkey]
-  | +-SelectListItem[alias=revenue]
-  | | +-FunctionCall[name=SUM]
-  | |   +-Multiply
-  | |     +-left_operand=AttributeReference[attribute_name=l_extendedprice]
-  | |     +-right_operand=Subtract
-  | |       +-left_operand=Literal
-  | |       | +-NumericLiteral[numeric_string=1,float_like=false]
-  | |       +-right_operand=AttributeReference[attribute_name=l_discount]
-  | +-SelectListItem
-  | | +-AttributeReference[attribute_name=o_orderdate]
-  | +-SelectListItem
-  |   +-AttributeReference[attribute_name=o_shippriority]
-  +-where_clause=And
-  | +-Equal
-  | | +-left_operand=AttributeReference[attribute_name=c_mktsegment]
-  | | +-right_operand=Literal
-  | |   +-StringLiteral[value=AUTOMOBILE]
-  | +-Equal
-  | | +-left_operand=AttributeReference[attribute_name=c_custkey]
-  | | +-right_operand=AttributeReference[attribute_name=o_custkey]
-  | +-Equal
-  | | +-left_operand=AttributeReference[attribute_name=l_orderkey]
-  | | +-right_operand=AttributeReference[attribute_name=o_orderkey]
-  | +-Less
-  | | +-left_operand=AttributeReference[attribute_name=o_orderdate]
-  | | +-right_operand=Literal
-  | |   +-StringLiteral[value=1995-03-17,explicit_type=Date]
-  | +-Greater
-  |   +-left_operand=AttributeReference[attribute_name=l_shipdate]
-  |   +-right_operand=Literal
-  |     +-StringLiteral[value=1995-03-17,explicit_type=Date]
-  +-group_by=GroupBy
-  | +-AttributeReference[attribute_name=l_orderkey]
-  | +-AttributeReference[attribute_name=o_orderdate]
-  | +-AttributeReference[attribute_name=o_shippriority]
-  +-order_by=OrderBy
-  | +-OrderByItem[is_asc=false,nulls_first=true]
-  | | +-AttributeReference[attribute_name=revenue]
-  | +-OrderByItem[is_asc=true,nulls_first=false]
-  |   +-AttributeReference[attribute_name=o_orderdate]
-  +-limit=LIMIT
-  | +-NumericLiteral[numeric_string=10,float_like=false]
-  +-from_clause=
-    +-TableReference[table=customer]
-    +-TableReference[table=orders]
-    +-TableReference[table=lineitem]
-==
-
-# Query 4
-SELECT
-  o_orderpriority,
-  COUNT(*) AS order_count
-FROM
-  orders
-WHERE
-  o_orderdate >= DATE '1995-08-01'
-  AND o_orderdate < DATE '1995-08-01' + INTERVAL '3 month'
-  AND EXISTS (
-    SELECT
-      *
-    FROM
-      lineitem
-    WHERE
-      l_orderkey = o_orderkey
-      AND l_commitdate < l_receiptdate
-  )
-GROUP BY
-  o_orderpriority
-ORDER BY
-  o_orderpriority
---
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectList
-  | +-SelectListItem
-  | | +-AttributeReference[attribute_name=o_orderpriority]
-  | +-SelectListItem[alias=order_count]
-  |   +-FunctionCall[name=COUNT,is_star=true]
-  +-where_clause=And
-  | +-GreaterOrEqual
-  | | +-left_operand=AttributeReference[attribute_name=o_orderdate]
-  | | +-right_operand=Literal
-  | |   +-StringLiteral[value=1995-08-01,explicit_type=Date]
-  | +-Less
-  | | +-left_operand=AttributeReference[attribute_name=o_orderdate]
-  | | +-right_operand=Add
-  | |   +-left_operand=Literal
-  | |   | +-StringLiteral[value=1995-08-01,explicit_type=Date]
-  | |   +-right_operand=Literal
-  | |     +-StringLiteral[value=3 month,explicit_type=YearMonthInterval]
-  | +-Exists
-  |   +-subquery=SubqueryExpression
-  |     +-Select
-  |       +-select_clause=SelectStar
-  |       +-where_clause=And
-  |       | +-Equal
-  |       | | +-left_operand=AttributeReference[attribute_name=l_orderkey]
-  |       | | +-right_operand=AttributeReference[attribute_name=o_orderkey]
-  |       | +-Less
-  |       |   +-left_operand=AttributeReference[attribute_name=l_commitdate]
-  |       |   +-right_operand=AttributeReference[attribute_name=l_receiptdate]
-  |       +-from_clause=
-  |         +-TableReference[table=lineitem]
-  +-group_by=GroupBy
-  | +-AttributeReference[attribute_name=o_orderpriority]
-  +-order_by=OrderBy
-  | +-OrderByItem[is_asc=true,nulls_first=false]
-  |   +-AttributeReference[attribute_name=o_orderpriority]
-  +-from_clause=
-    +-TableReference[table=orders]
-==
-
-# Query 5
-SELECT
-  n_name,
-  SUM(l_extendedprice * (1 - l_discount)) AS revenue
-FROM
-  customer,
-  orders,
-  lineitem,
-  supplier,
-  nation,
-  region
-WHERE
-  c_custkey = o_custkey
-  AND l_orderkey = o_orderkey
-  AND l_suppkey = s_suppkey
-  AND c_nationkey = s_nationkey
-  AND s_nationkey = n_nationkey
-  AND n_regionkey = r_regionkey
-  AND r_name = 'AMERICA'
-  AND o_orderdate >= DATE '1997-01-01'
-  AND o_orderdate < DATE '1997-01-01' + INTERVAL '1 year'
-GROUP BY
-  n_name
-ORDER BY
-  revenue DESC
---
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectList
-  | +-SelectListItem
-  | | +-AttributeReference[attribute_name=n_name]
-  | +-SelectListItem[alias=revenue]
-  |   +-FunctionCall[name=SUM]
-  |     +-Multiply
-  |       +-left_operand=AttributeReference[attribute_name=l_extendedprice]
-  |       +-right_operand=Subtract
-  |         +-left_operand=Literal
-  |         | +-NumericLiteral[numeric_string=1,float_like=false]
-  |         +-right_operand=AttributeReference[attribute_name=l_discount]
-  +-where_clause=And
-  | +-Equal
-  | | +-left_operand=AttributeReference[attribute_name=c_custkey]
-  | | +-right_operand=AttributeReference[attribute_name=o_custkey]
-  | +-Equal
-  | | +-left_operand=AttributeReference[attribute_name=l_orderkey]
-  | | +-right_operand=AttributeReference[attribute_name=o_orderkey]
-  | +-Equal
-  | | +-left_operand=AttributeReference[attribute_name=l_suppkey]
-  | | +-right_operand=AttributeReference[attribute_name=s_suppkey]
-  | +-Equal
-  | | +-left_operand=AttributeReference[attribute_name=c_nationkey]
-  | | +-right_operand=AttributeReference[attribute_name=s_nationkey]
-  | +-Equal
-  | | +-left_operand=AttributeReference[attribute_name=s_nationkey]
-  | | +-right_operand=AttributeReference[attribute_name=n_nationkey]
-  | +-Equal
-  | | +-left_operand=AttributeReference[attribute_name=n_regionkey]
-  | | +-right_operand=AttributeReference[attribute_name=r_regionkey]
-  | +-Equal
-  | | +-left_operand=AttributeReference[attribute_name=r_name]
-  | | +-right_operand=Literal
-  | |   +-StringLiteral[value=AMERICA]
-  | +-GreaterOrEqual
-  | | +-left_operand=AttributeReference[attribute_name=o_orderdate]
-  | | +-right_operand=Literal
-  | |   +-StringLiteral[value=1997-01-01,explicit_type=Date]
-  | +-Less
-  |   +-left_operand=AttributeReference[attribute_name=o_orderdate]
-  |   +-right_operand=Add
-  |     +-left_operand=Literal
-  |     | +-StringLiteral[value=1997-01-01,explicit_type=Date]
-  |     +-right_operand=Literal
-  |       +-StringLiteral[value=1 year,explicit_type=YearMonthInterval]
-  +-group_by=GroupBy
-  | +-AttributeReference[attribute_name=n_name]
-  +-order_by=OrderBy
-  | +-OrderByItem[is_asc=false,nulls_first=true]
-  |   +-AttributeReference[attribute_name=revenue]
-  +-from_clause=
-    +-TableReference[table=customer]
-    +-TableReference[table=orders]
-    +-TableReference[table=lineitem]
-    +-TableReference[table=supplier]
-    +-TableReference[table=nation]
-    +-TableReference[table=region]
-==
-
-# Query 6
-SELECT
-  SUM(l_extendedprice * l_discount) AS revenue
-FROM
-  lineitem
-WHERE
-  l_shipdate >= DATE '1997-01-01'
-  AND l_shipdate < DATE '1997-01-01' + INTERVAL '1 year'
-  AND l_discount BETWEEN 0.03 - 0.01 AND 0.03 + 0.01
-  AND l_quantity < 25
---
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectList
-  | +-SelectListItem[alias=revenue]
-  |   +-FunctionCall[name=SUM]
-  |     +-Multiply
-  |       +-left_operand=AttributeReference[attribute_name=l_extendedprice]
-  |       +-right_operand=AttributeReference[attribute_name=l_discount]
-  +-where_clause=And
-  | +-GreaterOrEqual
-  | | +-left_operand=AttributeReference[attribute_name=l_shipdate]
-  | | +-right_operand=Literal
-  | |   +-StringLiteral[value=1997-01-01,explicit_type=Date]
-  | +-Less
-  | | +-left_operand=AttributeReference[attribute_name=l_shipdate]
-  | | +-right_operand=Add
-  | |   +-left_operand=Literal
-  | |   | +-StringLiteral[value=1997-01-01,explicit_type=Date]
-  | |   +-right_operand=Literal
-  | |     +-StringLiteral[value=1 year,explicit_type=YearMonthInterval]
-  | +-Between
-  | | +-check_operand=AttributeReference[attribute_name=l_discount]
-  | | +-lower_bound_operand=Subtract
-  | | | +-left_operand=Literal
-  | | | | +-NumericLiteral[numeric_string=0.03,float_like=true]
-  | | | +-right_operand=Literal
-  | | |   +-NumericLiteral[numeric_string=0.01,float_like=true]
-  | | +-upper_bound_operand=Add
-  | |   +-left_operand=Literal
-  | |   | +-NumericLiteral[numeric_string=0.03,float_like=true]
-  | |   +-right_operand=Literal
-  | |     +-NumericLiteral[numeric_string=0.01,float_like=true]
-  | +-Less
-  |   +-left_operand=AttributeReference[attribute_name=l_quantity]
-  |   +-right_operand=Literal
-  |     +-NumericLiteral[numeric_string=25,float_like=false]
-  +-from_clause=
-    +-TableReference[table=lineitem]
-==
-
-# Query 7
-SELECT
-  supp_nation,
-  cust_nation,
-  l_year,
-  SUM(volume) AS revenue
-FROM
-  (
-    SELECT
-      n1.n_name AS supp_nation,
-      n2.n_name AS cust_nation,
-      EXTRACT(YEAR FROM l_shipdate) AS l_year,
-      l_extendedprice * (1 - l_discount) AS volume
-    FROM
-      supplier,
-      lineitem,
-      orders,
-      customer,
-      nation n1,
-      nation n2
-    WHERE
-      s_suppkey = l_suppkey
-      AND o_orderkey = l_orderkey
-      AND c_custkey = o_custkey
-      AND s_nationkey = n1.n_nationkey
-      AND c_nationkey = n2.n_nationkey
-      AND (
-        (n1.n_name = 'ETHIOPIA' AND n2.n_name = 'UNITED STATES')
-        OR (n1.n_name = 'UNITED STATES' AND n2.n_name = 'ETHIOPIA')
-      )
-      AND l_shipdate BETWEEN DATE '1995-01-01' AND DATE '1996-12-31'
-  ) AS shipping
-GROUP BY
-  supp_nation,
-  cust_nation,
-  l_year
-ORDER BY
-  supp_nation,
-  cust_nation,
-  l_year
---
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectList
-  | +-SelectListItem
-  | | +-AttributeReference[attribute_name=supp_nation]
-  | +-SelectListItem
-  | | +-AttributeReference[attribute_name=cust_nation]
-  | +-SelectListItem
-  | | +-AttributeReference[attribute_name=l_year]
-  | +-SelectListItem[alias=revenue]
-  |   +-FunctionCall[name=SUM]
-  |     +-AttributeReference[attribute_name=volume]
-  +-group_by=GroupBy
-  | +-AttributeReference[attribute_name=supp_nation]
-  | +-AttributeReference[attribute_name=cust_nation]
-  | +-AttributeReference[attribute_name=l_year]
-  +-order_by=OrderBy
-  | +-OrderByItem[is_asc=true,nulls_first=false]
-  | | +-AttributeReference[attribute_name=supp_nation]
-  | +-OrderByItem[is_asc=true,nulls_first=false]
-  | | +-AttributeReference[attribute_name=cust_nation]
-  | +-OrderByItem[is_asc=true,nulls_first=false]
-  |   +-AttributeReference[attribute_name=l_year]
-  +-from_clause=
-    +-SubqueryTable
-      +-table_signature=TableSignature[table_alias=shipping]
-      +-SubqueryExpression
-        +-Select
-          +-select_clause=SelectList
-          | +-SelectListItem[alias=supp_nation]
-          | | +-AttributeReference[attribute_name=n_name,relation_name=n1]
-          | +-SelectListItem[alias=cust_nation]
-          | | +-AttributeReference[attribute_name=n_name,relation_name=n2]
-          | +-SelectListItem[alias=l_year]
-          | | +-Extract[unit=YEAR]
-          | |   +-date_expression=AttributeReference[attribute_name=l_shipdate]
-          | +-SelectListItem[alias=volume]
-          |   +-Multiply
-          |     +-left_operand=AttributeReference[attribute_name=l_extendedprice]
-          |     +-right_operand=Subtract
-          |       +-left_operand=Literal
-          |       | +-NumericLiteral[numeric_string=1,float_like=false]
-          |       +-right_operand=AttributeReference[attribute_name=l_discount]
-          +-where_clause=And
-          | +-Equal
-          | | +-left_operand=AttributeReference[attribute_name=s_suppkey]
-          | | +-right_operand=AttributeReference[attribute_name=l_suppkey]
-          | +-Equal
-          | | +-left_operand=AttributeReference[attribute_name=o_orderkey]
-          | | +-right_operand=AttributeReference[attribute_name=l_orderkey]
-          | +-Equal
-          | | +-left_operand=AttributeReference[attribute_name=c_custkey]
-          | | +-right_operand=AttributeReference[attribute_name=o_custkey]
-          | +-Equal
-          | | +-left_operand=AttributeReference[attribute_name=s_nationkey]
-          | | +-right_operand=AttributeReference[attribute_name=n_nationkey,
-          | |   relation_name=n1]
-          | +-Equal
-          | | +-left_operand=AttributeReference[attribute_name=c_nationkey]
-          | | +-right_operand=AttributeReference[attribute_name=n_nationkey,
-          | |   relation_name=n2]
-          | +-Or
-          | | +-And
-          | | | +-Equal
-          | | | | +-left_operand=AttributeReference[attribute_name=n_name,
-          | | | | | relation_name=n1]
-          | | | | +-right_operand=Literal
-          | | | |   +-StringLiteral[value=ETHIOPIA]
-          | | | +-Equal
-          | | |   +-left_operand=AttributeReference[attribute_name=n_name,
-          | | |   | relation_name=n2]
-          | | |   +-right_operand=Literal
-          | | |     +-StringLiteral[value=UNITED STATES]
-          | | +-And
-          | |   +-Equal
-          | |   | +-left_operand=AttributeReference[attribute_name=n_name,
-          | |   | | relation_name=n1]
-          | |   | +-right_operand=Literal
-          | |   |   +-StringLiteral[value=UNITED STATES]
-          | |   +-Equal
-          | |     +-left_operand=AttributeReference[attribute_name=n_name,
-          | |     | relation_name=n2]
-          | |     +-right_operand=Literal
-          | |       +-StringLiteral[value=ETHIOPIA]
-          | +-Between
-          |   +-check_operand=AttributeReference[attribute_name=l_shipdate]
-          |   +-lower_bound_operand=Literal
-          |   | +-StringLiteral[value=1995-01-01,explicit_type=Date]
-          |   +-upper_bound_operand=Literal
-          |     +-StringLiteral[value=1996-12-31,explicit_type=Date]
-          +-from_clause=
-            +-TableReference[table=supplier]
-            +-TableReference[table=lineitem]
-            +-TableReference[table=orders]
-            +-TableReference[table=customer]
-            +-TableReference[table=nation]
-            | +-table_signature=TableSignature[table_alias=n1]
-            +-TableReference[table=nation]
-              +-table_signature=TableSignature[table_alias=n2]
-==
-
-# Query 8
-SELECT
-  o_year,
-  SUM(CASE
-    WHEN nation = 'UNITED STATES' THEN volume
-    ELSE 0
-  END) / SUM(volume) AS mkt_share
-FROM
-  (
-    SELECT
-      EXTRACT(YEAR FROM o_orderdate) AS o_year,
-      l_extendedprice * (1 - l_discount) AS volume,
-      n2.n_name AS nation
-    FROM
-      part,
-      supplier,
-      lineitem,
-      orders,
-      customer,
-      nation n1,
-      nation n2,
-      region
-    WHERE
-      p_partkey = l_partkey
-      AND s_suppkey = l_suppkey
-      AND l_orderkey = o_orderkey
-      AND o_custkey = c_custkey
-      AND c_nationkey = n1.n_nationkey
-      AND n1.n_regionkey = r_regionkey
-      AND r_name = 'AMERICA'
-      AND s_nationkey = n2.n_nationkey
-      AND o_orderdate BETWEEN DATE '1995-01-01' AND DATE '1996-12-31'
-      AND p_type = 'MEDIUM ANODIZED NICKEL'
-  ) AS all_nations
-GROUP BY
-  o_year
-ORDER BY
-  o_year
---
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectList
-  | +-SelectListItem
-  | | +-AttributeReference[attribute_name=o_year]
-  | +-SelectListItem[alias=mkt_share]
-  |   +-Divide
-  |     +-left_operand=FunctionCall[name=SUM]
-  |     | +-SearchedCaseExpression
-  |     |   +-else_result_expression=Literal
-  |     |   | +-NumericLiteral[numeric_string=0,float_like=false]
-  |     |   +-when_clauses=
-  |     |     +-SearchedWhenClause
-  |     |       +-condition_predicate=Equal
-  |     |       | +-left_operand=AttributeReference[attribute_name=nation]
-  |     |       | +-right_operand=Literal
-  |     |       |   +-StringLiteral[value=UNITED STATES]
-  |     |       +-result_expression=AttributeReference[attribute_name=volume]
-  |     +-right_operand=FunctionCall[name=SUM]
-  |       +-AttributeReference[attribute_name=volume]
-  +-group_by=GroupBy
-  | +-AttributeReference[attribute_name=o_year]
-  +-order_by=OrderBy
-  | +-OrderByItem[is_asc=true,nulls_first=false]
-  |   +-AttributeReference[attribute_name=o_year]
-  +-from_clause=
-    +-SubqueryTable
-      +-table_signature=TableSignature[table_alias=all_nations]
-      +-SubqueryExpression
-        +-Select
-          +-select_clause=SelectList
-          | +-SelectListItem[alias=o_year]
-          | | +-Extract[unit=YEAR]
-          | |   +-date_expression=AttributeReference[attribute_name=o_orderdate]
-          | +-SelectListItem[alias=volume]
-          | | +-Multiply
-          | |   +-left_operand=AttributeReference[attribute_name=l_extendedprice]
-          | |   +-right_operand=Subtract
-          | |     +-left_operand=Literal
-          | |     | +-NumericLiteral[numeric_string=1,float_like=false]
-          | |     +-right_operand=AttributeReference[attribute_name=l_discount]
-          | +-SelectListItem[alias=nation]
-          |   +-AttributeReference[attribute_name=n_name,relation_name=n2]
-          +-where_clause=And
-          | +-Equal
-          | | +-left_operand=AttributeReference[attribute_name=p_partkey]
-          | | +-right_operand=AttributeReference[attribute_name=l_partkey]
-          | +-Equal
-          | | +-left_operand=AttributeReference[attribute_name=s_suppkey]
-          | | +-right_operand=AttributeReference[attribute_name=l_suppkey]
-          | +-Equal
-          | | +-left_operand=AttributeReference[attribute_name=l_orderkey]
-          | | +-right_operand=AttributeReference[attribute_name=o_orderkey]
-          | +-Equal
-          | | +-left_operand=AttributeReference[attribute_name=o_custkey]
-          | | +-right_operand=AttributeReference[attribute_name=c_custkey]
-          | +-Equal
-          | | +-left_operand=AttributeReference[attribute_name=c_nationkey]
-          | | +-right_operand=AttributeReference[attribute_name=n_nationkey,
-          | |   relation_name=n1]
-          | +-Equal
-          | | +-left_operand=AttributeReference[attribute_name=n_regionkey,
-          | | | relation_name=n1]
-          | | +-right_operand=AttributeReference[attribute_name=r_regionkey]
-          | +-Equal
-          | | +-left_operand=AttributeReference[attribute_name=r_name]
-          | | +-right_operand=Literal
-          | |   +-StringLiteral[value=AMERICA]
-          | +-Equal
-          | | +-left_operand=AttributeReference[attribute_name=s_nationkey]
-          | | +-right_operand=AttributeReference[attribute_name=n_nationkey,
-          | |   relation_name=n2]
-          | +-Between
-          | | +-check_operand=AttributeReference[attribute_name=o_orderdate]
-          | | +-lower_bound_operand=Literal
-          | | | +-StringLiteral[value=1995-01-01,explicit_type=Date]
-          | | +-upper_bound_operand=Literal
-          | |   +-StringLiteral[value=1996-12-31,explicit_type=Date]
-          | +-Equal
-          |   +-left_operand=AttributeReference[attribute_name=p_type]
-          |   +-right_operand=Literal
-          |     +-StringLiteral[value=MEDIUM ANODIZED NICKEL]
-          +-from_clause=
-            +-TableReference[table=part]
-            +-TableReference[table=supplier]
-            +-TableReference[table=lineitem]
-            +-TableReference[table=orders]
-            +-TableReference[table=customer]
-            +-TableReference[table=nation]
-            | +-table_signature=TableSignature[table_alias=n1]
-            +-TableReference[table=nation]
-            | +-table_signature=TableSignature[table_alias=n2]
-            +-TableReference[table=region]
-==
-
-# Query 9
-SELECT
-  nation,
-  o_year,
-  SUM(amount) AS sum_profit
-FROM
-  (
-    SELECT
-      n_name AS nation,
-      EXTRACT(year FROM o_orderdate) AS o_year,
-      l_extendedprice * (1 - l_discount) - ps_supplycost * l_quantity AS amount
-    FROM
-      part,
-      supplier,
-      lineitem,
-      partsupp,
-      orders,
-      nation
-    WHERE
-      s_suppkey = l_suppkey
-      AND ps_suppkey = l_suppkey
-      AND ps_partkey = l_partkey
-      AND p_partkey = l_partkey
-      AND o_orderkey = l_orderkey
-      AND s_nationkey = n_nationkey
-      AND p_name LIKE '%ghost%'
-  ) AS profit
-GROUP BY
-  nation,
-  o_year
-ORDER BY
-  nation,
-  o_year DESC
---
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectList
-  | +-SelectListItem
-  | | +-AttributeReference[attribute_name=nation]
-  | +-SelectListItem
-  | | +-AttributeReference[attribute_name=o_year]
-  | +-SelectListItem[alias=sum_profit]
-  |   +-FunctionCall[name=SUM]
-  |     +-AttributeReference[attribute_name=amount]
-  +-group_by=GroupBy
-  | +-AttributeReference[attribute_name=nation]
-  | +-AttributeReference[attribute_name=o_year]
-  +-order_by=OrderBy
-  | +-OrderByItem[is_asc=true,nulls_first=false]
-  | | +-AttributeReference[attribute_name=nation]
-  | +-OrderByItem[is_asc=false,nulls_first=true]
-  |   +-AttributeReference[attribute_name=o_year]
-  +-from_clause=
-    +-SubqueryTable
-      +-table_signature=TableSignature[table_alias=profit]
-      +-SubqueryExpression
-        +-Select
-          +-select_clause=SelectList
-          | +-SelectListItem[alias=nation]
-          | | +-AttributeReference[attribute_name=n_name]
-          | +-SelectListItem[alias=o_year]
-          | | +-Extract[unit=YEAR]
-          | |   +-date_expression=AttributeReference[attribute_name=o_orderdate]
-          | +-SelectListItem[alias=amount]
-          |   +-Subtract
-          |     +-left_operand=Multiply
-          |     | +-left_operand=AttributeReference[
-          |     | | attribute_name=l_extendedprice]
-          |     | +-right_operand=Subtract
-          |     |   +-left_operand=Literal
-          |     |   | +-NumericLiteral[numeric_string=1,float_like=false]
-          |     |   +-right_operand=AttributeReference[attribute_name=l_discount]
-          |     +-right_operand=Multiply
-          |       +-left_operand=AttributeReference[attribute_name=ps_supplycost]
-          |       +-right_operand=AttributeReference[attribute_name=l_quantity]
-          +-where_clause=And
-          | +-Equal
-          | | +-left_operand=AttributeReference[attribute_name=s_suppkey]
-          | | +-right_operand=AttributeReference[attribute_name=l_suppkey]
-          | +-Equal
-          | | +-left_operand=AttributeReference[attribute_name=ps_suppkey]
-          | | +-right_operand=AttributeReference[attribute_name=l_suppkey]
-          | +-Equal
-          | | +-left_operand=AttributeReference[attribute_name=ps_partkey]
-          | | +-right_operand=AttributeReference[attribute_name=l_partkey]
-          | +-Equal
-          | | +-left_operand=AttributeReference[attribute_name=p_partkey]
-          | | +-right_operand=AttributeReference[attribute_name=l_partkey]
-          | +-Equal
-          | | +-left_operand=AttributeReference[attribute_name=o_orderkey]
-          | | +-right_operand=AttributeReference[attribute_name=l_orderkey]
-          | +-Equal
-          | | +-left_operand=AttributeReference[attribute_name=s_nationkey]
-          | | +-right_operand=AttributeReference[attribute_name=n_nationkey]
-          | +-Like
-          |   +-left_operand=AttributeReference[attribute_name=p_name]
-          |   +-right_operand=Literal
-          |     +-StringLiteral[value=%ghost%]
-          +-from_clause=
-            +-TableReference[table=part]
-            +-TableReference[table=supplier]
-            +-TableReference[table=lineitem]
-            +-TableReference[table=partsupp]
-            +-TableReference[table=orders]
-            +-TableReference[table=nation]
-==
-
-# Query 10
-SELECT
-  c_custkey,
-  c_name,
-  SUM(l_extendedprice * (1 - l_discount)) AS revenue,
-  c_acctbal,
-  n_name,
-  c_address,
-  c_phone,
-  c_comment
-FROM
-  customer,
-  orders,
-  lineitem,
-  nation
-WHERE
-  c_custkey = o_custkey
-  AND l_orderkey = o_orderkey
-  AND o_orderdate >= DATE '1994-03-01'
-  AND o_orderdate < DATE '1994-03-01' + INTERVAL '3 month'
-  AND l_returnflag = 'R'
-  AND c_nationkey = n_nationkey
-GROUP BY
-  c_custkey,
-  c_name,
-  c_acctbal,
-  c_phone,
-  n_name,
-  c_address,
-  c_comment
-ORDER BY
-  revenue DESC
-LIMIT 20
---
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectList
-  | +-SelectListItem
-  | | +-AttributeReference[attribute_name=c_custkey]
-  | +-SelectListItem
-  | | +-AttributeReference[attribute_name=c_name]
-  | +-SelectListItem[alias=revenue]
-  | | +-FunctionCall[name=SUM]
-  | |   +-Multiply
-  | |     +-left_operand=AttributeReference[attribute_name=l_extendedprice]
-  | |     +-right_operand=Subtract
-  | |       +-left_operand=Literal
-  | |       | +-NumericLiteral[numeric_string=1,float_like=false]
-  | |       +-right_operand=AttributeReference[attribute_name=l_discount]
-  | +-SelectListItem
-  | | +-AttributeReference[attribute_name=c_acctbal]
-  | +-SelectListItem
-  | | +-AttributeReference[attribute_name=n_name]
-  | +-SelectListItem
-  | | +-AttributeReference[attribute_name=c_address]
-  | +-SelectListItem
-  | | +-AttributeReference[attribute_name=c_phone]
-  | +-SelectListItem
-  |   +-AttributeReference[attribute_name=c_comment]
-  +-where_clause=And
-  | +-Equal
-  | | +-left_operand=AttributeReference[attribute_name=c_custkey]
-  | | +-right_operand=AttributeReference[attribute_name=o_custkey]
-  | +-Equal
-  | | +-left_operand=AttributeReference[attribute_name=l_orderkey]
-  | | +-right_operand=AttributeReference[attribute_name=o_orderkey]
-  | +-GreaterOrEqual
-  | | +-left_operand=AttributeReference[attribute_name=o_orderdate]
-  | | +-right_operand=Literal
-  | |   +-StringLiteral[value=1994-03-01,explicit_type=Date]
-  | +-Less
-  | | +-left_operand=AttributeReference[attribute_name=o_orderdate]
-  | | +-right_operand=Add
-  | |   +-left_operand=Literal
-  | |   | +-StringLiteral[value=1994-03-01,explicit_type=Date]
-  | |   +-right_operand=Literal
-  | |     +-StringLiteral[value=3 month,explicit_type=YearMonthInterval]
-  | +-Equal
-  | | +-left_operand=AttributeReference[attribute_name=l_returnflag]
-  | | +-right_operand=Literal
-  | |   +-StringLiteral[value=R]
-  | +-Equal
-  |   +-left_operand=AttributeReference[attribute_name=c_nationkey]
-  |   +-right_operand=AttributeReference[attribute_name=n_nationkey]
-  +-group_by=GroupBy
-  | +-AttributeReference[attribute_name=c_custkey]
-  | +-AttributeReference[attribute_name=c_name]
-  | +-AttributeReference[attribute_name=c_acctbal]
-  | +-AttributeReference[attribute_name=c_phone]
-  | +-AttributeReference[attribute_name=n_name]
-  | +-AttributeReference[attribute_name=c_address]
-  | +-AttributeReference[attribute_name=c_comment]
-  +-order_by=OrderBy
-  | +-OrderByItem[is_asc=false,nulls_first=true]
-  |   +-AttributeReference[attribute_name=revenue]
-  +-limit=LIMIT
-  | +-NumericLiteral[numeric_string=20,float_like=false]
-  +-from_clause=
-    +-TableReference[table=customer]
-    +-TableReference[table=orders]
-    +-TableReference[table=lineitem]
-    +-TableReference[table=nation]
-==
-
-# Query 11
-SELECT
-  ps_partkey,
-  SUM(ps_supplycost * ps_availqty) AS value
-FROM
-  partsupp,
-  supplier,
-  nation
-WHERE
-  ps_suppkey = s_suppkey
-  AND s_nationkey = n_nationkey
-  AND n_name = 'INDONESIA'
-GROUP BY
-  ps_partkey HAVING
-    SUM(ps_supplycost * ps_availqty) > (
-      SELECT
-        SUM(ps_supplycost * ps_availqty) * 0.0000010000
-      FROM
-        partsupp,
-        supplier,
-        nation
-      WHERE
-        ps_suppkey = s_suppkey
-        AND s_nationkey = n_nationkey
-        AND n_name = 'INDONESIA'
-    )
-ORDER BY
-  value DESC
---
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectList
-  | +-SelectListItem
-  | | +-AttributeReference[attribute_name=ps_partkey]
-  | +-SelectListItem[alias=value]
-  |   +-FunctionCall[name=SUM]
-  |     +-Multiply
-  |       +-left_operand=AttributeReference[attribute_name=ps_supplycost]
-  |       +-right_operand=AttributeReference[attribute_name=ps_availqty]
-  +-where_clause=And
-  | +-Equal
-  | | +-left_operand=AttributeReference[attribute_name=ps_suppkey]
-  | | +-right_operand=AttributeReference[attribute_name=s_suppkey]
-  | +-Equal
-  | | +-left_operand=AttributeReference[attribute_name=s_nationkey]
-  | | +-right_operand=AttributeReference[attribute_name=n_nationkey]
-  | +-Equal
-  |   +-left_operand=AttributeReference[attribute_name=n_name]
-  |   +-right_operand=Literal
-  |     +-StringLiteral[value=INDONESIA]
-  +-group_by=GroupBy
-  | +-AttributeReference[attribute_name=ps_partkey]
-  +-having=HAVING
-  | +-Greater
-  |   +-left_operand=FunctionCall[name=SUM]
-  |   | +-Multiply
-  |   |   +-left_operand=AttributeReference[attribute_name=ps_supplycost]
-  |   |   +-right_operand=AttributeReference[attribute_name=ps_availqty]
-  |   +-right_operand=SubqueryExpression
-  |     +-Select
-  |       +-select_clause=SelectList
-  |       | +-SelectListItem
-  |       |   +-Multiply
-  |       |     +-left_operand=FunctionCall[name=SUM]
-  |       |     | +-Multiply
-  |       |     |   +-left_operand=AttributeReference[
-  |       |     |   | attribute_name=ps_supplycost]
-  |       |     |   +-right_operand=AttributeReference[
-  |       |     |     attribute_name=ps_availqty]
-  |       |     +-right_operand=Literal
-  |       |       +-NumericLiteral[numeric_string=0.0000010000,float_like=true]
-  |       +-where_clause=And
-  |       | +-Equal
-  |       | | +-left_operand=AttributeReference[attribute_name=ps_suppkey]
-  |       | | +-right_operand=AttributeReference[attribute_name=s_suppkey]
-  |       | +-Equal
-  |       | | +-left_operand=AttributeReference[attribute_name=s_nationkey]
-  |       | | +-right_operand=AttributeReference[attribute_name=n_nationkey]
-  |       | +-Equal
-  |       |   +-left_operand=AttributeReference[attribute_name=n_name]
-  |       |   +-right_operand=Literal
-  |       |     +-StringLiteral[value=INDONESIA]
-  |       +-from_clause=
-  |         +-TableReference[table=partsupp]
-  |         +-TableReference[table=supplier]
-  |         +-TableReference[table=nation]
-  +-order_by=OrderBy
-  | +-OrderByItem[is_asc=false,nulls_first=true]
-  |   +-AttributeReference[attribute_name=value]
-  +-from_clause=
-    +-TableReference[table=partsupp]
-    +-TableReference[table=supplier]
-    +-TableReference[table=nation]
-==
-
-# Query 12
-SELECT
-  l_shipmode,
-  SUM(CASE
-    WHEN o_orderpriority = '1-URGENT'
-      OR o_orderpriority = '2-HIGH'
-      THEN 1
-    ELSE 0
-  END) AS high_line_count,
-  SUM(CASE
-    WHEN o_orderpriority <> '1-URGENT'
-      AND o_orderpriority <> '2-HIGH'
-      THEN 1
-    ELSE 0
-  END) AS low_line_count
-FROM
-  orders,
-  lineitem
-WHERE
-  o_orderkey = l_orderkey
-  AND l_shipmode IN ('REG AIR', 'RAIL')
-  AND l_commitdate < l_receiptdate
-  AND l_shipdate < l_commitdate
-  AND l_receiptdate >= DATE '1997-01-01'
-  AND l_receiptdate < DATE '1997-01-01' + INTERVAL '1 year'
-GROUP BY
-  l_shipmode
-ORDER BY
-  l_shipmode
---
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectList
-  | +-SelectListItem
-  | | +-AttributeReference[attribute_name=l_shipmode]
-  | +-SelectListItem[alias=high_line_count]
-  | | +-FunctionCall[name=SUM]
-  | |   +-SearchedCaseExpression
-  | |     +-else_result_expression=Literal
-  | |     | +-NumericLiteral[numeric_string=0,float_like=false]
-  | |     +-when_clauses=
-  | |       +-SearchedWhenClause
-  | |         +-condition_predicate=Or
-  | |         | +-Equal
-  | |         | | +-left_operand=AttributeReference[
-  | |         | | | attribute_name=o_orderpriority]
-  | |         | | +-right_operand=Literal
-  | |         | |   +-StringLiteral[value=1-URGENT]
-  | |         | +-Equal
-  | |         |   +-left_operand=AttributeReference[
-  | |         |   | attribute_name=o_orderpriority]
-  | |         |   +-right_operand=Literal
-  | |         |     +-StringLiteral[value=2-HIGH]
-  | |         +-result_expression=Literal
-  | |           +-NumericLiteral[numeric_string=1,float_like=false]
-  | +-SelectListItem[alias=low_line_count]
-  |   +-FunctionCall[name=SUM]
-  |     +-SearchedCaseExpression
-  |       +-else_result_expression=Literal
-  |       | +-NumericLiteral[numeric_string=0,float_like=false]
-  |       +-when_clauses=
-  |         +-SearchedWhenClause
-  |           +-condition_predicate=And
-  |           | +-NotEqual
-  |           | | +-left_operand=AttributeReference[
-  |           | | | attribute_name=o_orderpriority]
-  |           | | +-right_operand=Literal
-  |           | |   +-StringLiteral[value=1-URGENT]
-  |           | +-NotEqual
-  |           |   +-left_operand=AttributeReference[
-  |           |   | attribute_name=o_orderpriority]
-  |           |   +-right_operand=Literal
-  |           |     +-StringLiteral[value=2-HIGH]
-  |           +-result_expression=Literal
-  |             +-NumericLiteral[numeric_string=1,float_like=false]
-  +-where_clause=And
-  | +-Equal
-  | | +-left_operand=AttributeReference[attribute_name=o_orderkey]
-  | | +-right_operand=AttributeReference[attribute_name=l_orderkey]
-  | +-InValueList
-  | | +-test_expression=AttributeReference[attribute_name=l_shipmode]
-  | | +-value_list=
-  | |   +-Literal
-  | |   | +-StringLiteral[value=REG AIR]
-  | |   +-Literal
-  | |     +-StringLiteral[value=RAIL]
-  | +-Less
-  | | +-left_operand=AttributeReference[attribute_name=l_commitdate]
-  | | +-right_operand=AttributeReference[attribute_name=l_receiptdate]
-  | +-Less
-  | | +-left_operand=AttributeReference[attribute_name=l_shipdate]
-  | | +-right_operand=AttributeReference[attribute_name=l_commitdate]
-  | +-GreaterOrEqual
-  | | +-left_operand=AttributeReference[attribute_name=l_receiptdate]
-  | | +-right_operand=Literal
-  | |   +-StringLiteral[value=1997-01-01,explicit_type=Date]
-  | +-Less
-  |   +-left_operand=AttributeReference[attribute_name=l_receiptdate]
-  |   +-right_operand=Add
-  |     +-left_operand=Literal
-  |     | +-StringLiteral[value=1997-01-01,explicit_type=Date]
-  |     +-right_operand=Literal
-  |       +-StringLiteral[value=1 year,explicit_type=YearMonthInterval]
-  +-group_by=GroupBy
-  | +-AttributeReference[attribute_name=l_shipmode]
-  +-order_by=OrderBy
-  | +-OrderByItem[is_asc=true,nulls_first=false]
-  |   +-AttributeReference[attribute_name=l_shipmode]
-  +-from_clause=
-    +-TableReference[table=orders]
-    +-TableReference[table=lineitem]
-==
-
-# Query 13
-SELECT
-  c_count,
-  COUNT(*) AS custdist
-FROM
-  (
-    SELECT
-      c_custkey,
-      COUNT(o_orderkey)
-    FROM
-      customer LEFT OUTER JOIN orders ON
-        c_custkey = o_custkey
-        AND o_comment NOT LIKE '%special%requests%'
-    GROUP BY
-      c_custkey
-  ) AS  c_orders (c_custkey, c_count)
-GROUP BY
-  c_count
-ORDER BY
-  custdist desc,
-  c_count DESC
---
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectList
-  | +-SelectListItem
-  | | +-AttributeReference[attribute_name=c_count]
-  | +-SelectListItem[alias=custdist]
-  |   +-FunctionCall[name=COUNT,is_star=true]
-  +-group_by=GroupBy
-  | +-AttributeReference[attribute_name=c_count]
-  +-order_by=OrderBy
-  | +-OrderByItem[is_asc=false,nulls_first=true]
-  | | +-AttributeReference[attribute_name=custdist]
-  | +-OrderByItem[is_asc=false,nulls_first=true]
-  |   +-AttributeReference[attribute_name=c_count]
-  +-from_clause=
-    +-SubqueryTable
-      +-table_signature=TableSignature[table_alias=c_orders,
-      | columns=(c_custkey, c_count)]
-      +-SubqueryExpression
-        +-Select
-          +-select_clause=SelectList
-          | +-SelectListItem
-          | | +-AttributeReference[attribute_name=c_custkey]
-          | +-SelectListItem
-          |   +-FunctionCall[name=COUNT]
-          |     +-AttributeReference[attribute_name=o_orderkey]
-          +-group_by=GroupBy
-          | +-AttributeReference[attribute_name=c_custkey]
-          +-from_clause=
-            +-JoinedTable[join_type=LeftOuterJoin]
-              +-left_table=TableReference[table=customer]
-              +-right_table=TableReference[table=orders]
-              +-join_predicate=And
-                +-Equal
-                | +-left_operand=AttributeReference[attribute_name=c_custkey]
-                | +-right_operand=AttributeReference[attribute_name=o_custkey]
-                +-NotLike
-                  +-left_operand=AttributeReference[attribute_name=o_comment]
-                  +-right_operand=Literal
-                    +-StringLiteral[value=%special%requests%]
-==
-
-# Query 14
-SELECT
-  100.00 * SUM(CASE
-    WHEN p_type LIKE 'PROMO%'
-      THEN l_extendedprice * (1 - l_discount)
-    ELSE 0
-  END) / SUM(l_extendedprice * (1 - l_discount)) AS promo_revenue
-FROM
-  lineitem,
-  part
-WHERE
-  l_partkey = p_partkey
-  AND l_shipdate >= DATE '1994-11-01'
-  AND l_shipdate < DATE '1994-11-01' + INTERVAL '1 month'
---
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectList
-  | +-SelectListItem[alias=promo_revenue]
-  |   +-Divide
-  |     +-left_operand=Multiply
-  |     | +-left_operand=Literal
-  |     | | +-NumericLiteral[numeric_string=100.00,float_like=true]
-  |     | +-right_operand=FunctionCall[name=SUM]
-  |     |   +-SearchedCaseExpression
-  |     |     +-else_result_expression=Literal
-  |     |     | +-NumericLiteral[numeric_string=0,float_like=false]
-  |     |     +-when_clauses=
-  |     |       +-SearchedWhenClause
-  |     |         +-condition_predicate=Like
-  |     |         | +-left_operand=AttributeReference[attribute_name=p_type]
-  |     |         | +-right_operand=Literal
-  |     |         |   +-StringLiteral[value=PROMO%]
-  |     |         +-result_expression=Multiply
-  |     |           +-left_operand=AttributeReference[
-  |     |           | attribute_name=l_extendedprice]
-  |     |           +-right_operand=Subtract
-  |     |             +-left_operand=Literal
-  |     |             | +-NumericLiteral[numeric_string=1,float_like=false]
-  |     |             +-right_operand=AttributeReference[
-  |     |               attribute_name=l_discount]
-  |     +-right_operand=FunctionCall[name=SUM]
-  |       +-Multiply
-  |         +-left_operand=AttributeReference[attribute_name=l_extendedprice]
-  |         +-right_operand=Subtract
-  |           +-left_operand=Literal
-  |           | +-NumericLiteral[numeric_string=1,float_like=false]
-  |           +-right_operand=AttributeReference[attribute_name=l_discount]
-  +-where_clause=And
-  | +-Equal
-  | | +-left_operand=AttributeReference[attribute_name=l_partkey]
-  | | +-right_operand=AttributeReference[attribute_name=p_partkey]
-  | +-GreaterOrEqual
-  | | +-left_operand=AttributeReference[attribute_name=l_shipdate]
-  | | +-right_operand=Literal
-  | |   +-StringLiteral[value=1994-11-01,explicit_type=Date]
-  | +-Less
-  |   +-left_operand=AttributeReference[attribute_name=l_shipdate]
-  |   +-right_operand=Add
-  |     +-left_operand=Literal
-  |     | +-StringLiteral[value=1994-11-01,explicit_type=Date]
-  |     +-right_operand=Literal
-  |       +-StringLiteral[value=1 month,explicit_type=YearMonthInterval]
-  +-from_clause=
-    +-TableReference[table=lineitem]
-    +-TableReference[table=part]
-==
-
-# Query 15
-WITH revenue (supplier_no, total_revenue) AS (
-SELECT
-  l_suppkey,
-  sum(l_extendedprice * (1-l_discount))
-FROM
-  lineitem
-  WHERE
-  l_shipdate >= DATE '1996-11-01'
-  AND l_shipdate < DATE '1996-11-01' + INTERVAL '3 month'
-GROUP BY
-  l_suppkey
-) SELECT
-  s_suppkey,
-  s_name,
-  s_address,
-  s_phone,
-  total_revenue
-FROM
-  supplier,
-  revenue
-WHERE
-  s_suppkey = supplier_no AND total_revenue = (
-SELECT
-  MAX(total_revenue)
-FROM
-  revenue
-)
-ORDER BY
-  s_suppkey
---
-SelectStatement
-+-select_query=Select
-| +-select_clause=SelectList
-| | +-SelectListItem
-| | | +-AttributeReference[attribute_name=s_suppkey]
-| | +-SelectListItem
-| | | +-AttributeReference[attribute_name=s_name]
-| | +-SelectListItem
-| | | +-AttributeReference[attribute_name=s_address]
-| | +-SelectListItem
-| | | +-AttributeReference[attribute_name=s_phone]
-| | +-SelectListItem
-| |   +-AttributeReference[attribute_name=total_revenue]
-| +-where_clause=And
-| | +-Equal
-| | | +-left_operand=AttributeReference[attribute_name=s_suppkey]
-| | | +-right_operand=AttributeReference[attribute_name=supplier_no]
-| | +-Equal
-| |   +-left_operand=AttributeReference[attribute_name=total_revenue]
-| |   +-right_operand=SubqueryExpression
-| |     +-Select
-| |       +-select_clause=SelectList
-| |       | +-SelectListItem
-| |       |   +-FunctionCall[name=MAX]
-| |       |     +-AttributeReference[attribute_name=total_revenue]
-| |       +-from_clause=
-| |         +-TableReference[table=revenue]
-| +-order_by=OrderBy
-| | +-OrderByItem[is_asc=true,nulls_first=false]
-| |   +-AttributeReference[attribute_name=s_suppkey]
-| +-from_clause=
-|   +-TableReference[table=supplier]
-|   +-TableReference[table=revenue]
-+-with_clause=
-  +-SubqueryTable
-    +-table_signature=TableSignature[table_alias=revenue,
-    | columns=(supplier_no, total_revenue)]
-    +-SubqueryExpression
-      +-Select
-        +-select_clause=SelectList
-        | +-SelectListItem
-        | | +-AttributeReference[attribute_name=l_suppkey]
-        | +-SelectListItem
-        |   +-FunctionCall[name=sum]
-        |     +-Multiply
-        |       +-left_operand=AttributeReference[attribute_name=l_extendedprice]
-        |       +-right_operand=Subtract
-        |         +-left_operand=Literal
-        |         | +-NumericLiteral[numeric_string=1,float_like=false]
-        |         +-right_operand=AttributeReference[attribute_name=l_discount]
-        +-where_clause=And
-        | +-GreaterOrEqual
-        | | +-left_operand=AttributeReference[attribute_name=l_shipdate]
-        | | +-right_operand=Literal
-        | |   +-StringLiteral[value=1996-11-01,explicit_type=Date]
-        | +-Less
-        |   +-left_operand=AttributeReference[attribute_name=l_shipdate]
-        |   +-right_operand=Add
-        |     +-left_operand=Literal
-        |     | +-StringLiteral[value=1996-11-01,explicit_type=Date]
-        |     +-right_operand=Literal
-        |       +-StringLiteral[value=3 month,explicit_type=YearMonthInterval]
-        +-group_by=GroupBy
-        | +-AttributeReference[attribute_name=l_suppkey]
-        +-from_clause=
-          +-TableReference[table=lineitem]
-==
-
-# Query 16
-SELECT
-  p_brand,
-  p_type,
-  p_size,
-  COUNT(distinct ps_suppkey) AS supplier_cnt
-FROM
-  partsupp,
-  part
-WHERE
-  p_partkey = ps_partkey
-  AND p_brand <> 'Brand#22'
-  AND p_type NOT LIKE 'ECONOMY BURNISHED%'
-  AND p_size IN (32, 42, 9, 18, 50, 30, 12, 21)
-  AND ps_suppkey NOT IN (
-    SELECT
-      s_suppkey
-    FROM
-      supplier
-    WHERE
-      s_comment LIKE '%Customer%Complaints%'
-  )
-GROUP BY
-  p_brand,
-  p_type,
-  p_size
-ORDER BY
-  supplier_cnt DESC,
-  p_brand,
-  p_type,
-  p_size
---
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectList
-  | +-SelectListItem
-  | | +-AttributeReference[attribute_name=p_brand]
-  | +-SelectListItem
-  | | +-AttributeReference[attribute_name=p_type]
-  | +-SelectListItem
-  | | +-AttributeReference[attribute_name=p_size]
-  | +-SelectListItem[alias=supplier_cnt]
-  |   +-FunctionCall[name=COUNT,is_distinct=true]
-  |     +-AttributeReference[attribute_name=ps_suppkey]
-  +-where_clause=And
-  | +-Equal
-  | | +-left_operand=AttributeReference[attribute_name=p_partkey]
-  | | +-right_operand=AttributeReference[attribute_name=ps_partkey]
-  | +-NotEqual
-  | | +-left_operand=AttributeReference[attribute_name=p_brand]
-  | | +-right_operand=Literal
-  | |   +-StringLiteral[value=Brand#22]
-  | +-NotLike
-  | | +-left_operand=AttributeReference[attribute_name=p_type]
-  | | +-right_operand=Literal
-  | |   +-StringLiteral[value=ECONOMY BURNISHED%]
-  | +-InValueList
-  | | +-test_expression=AttributeReference[attribute_name=p_size]
-  | | +-value_list=
-  | |   +-Literal
-  | |   | +-NumericLiteral[numeric_string=32,float_like=false]
-  | |   +-Literal
-  | |   | +-NumericLiteral[numeric_string=42,float_like=false]
-  | |   +-Literal
-  | |   | +-NumericLiteral[numeric_string=9,float_like=false]
-  | |   +-Literal
-  | |   | +-NumericLiteral[numeric_string=18,float_like=false]
-  | |   +-Literal
-  | |   | +-NumericLiteral[numeric_string=50,float_like=false]
-  | |   +-Literal
-  | |   | +-NumericLiteral[numeric_string=30,float_like=false]
-  | |   +-Literal
-  | |   | +-NumericLiteral[numeric_string=12,float_like=false]
-  | |   +-Literal
-  | |     +-NumericLiteral[numeric_string=21,float_like=false]
-  | +-Not
-  |   +-InTableQuery
-  |     +-test_expression=AttributeReference[attribute_name=ps_suppkey]
-  |     +-table_query=SubqueryExpression
-  |       +-Select
-  |         +-select_clause=SelectList
-  |         | +-SelectListItem
-  |         |   +-AttributeReference[attribute_name=s_suppkey]
-  |         +-where_clause=Like
-  |         | +-left_operand=AttributeReference[attribute_name=s_comment]
-  |         | +-right_operand=Literal
-  |         |   +-StringLiteral[value=%Customer%Complaints%]
-  |         +-from_clause=
-  |           +-TableReference[table=supplier]
-  +-group_by=GroupBy
-  | +-AttributeReference[attribute_name=p_brand]
-  | +-AttributeReference[attribute_name=p_type]
-  | +-AttributeReference[attribute_name=p_size]
-  +-order_by=OrderBy
-  | +-OrderByItem[is_asc=false,nulls_first=true]
-  | | +-AttributeReference[attribute_name=supplier_cnt]
-  | +-OrderByItem[is_asc=true,nulls_first=false]
-  | | +-AttributeReference[attribute_name=p_brand]
-  | +-OrderByItem[is_asc=true,nulls_first=false]
-  | | +-AttributeReference[attribute_name=p_type]
-  | +-OrderByItem[is_asc=true,nulls_first=false]
-  |   +-AttributeReference[attribute_name=p_size]
-  +-from_clause=
-    +-TableReference[table=partsupp]
-    +-TableReference[table=part]
-==
-
-# Query 17
-SELECT
-  SUM(l_extendedprice) / 7.0 AS avg_yearly
-FROM
-  lineitem,
-  part
-WHERE
-  p_partkey = l_partkey
-  AND p_brand = 'Brand#24'
-  AND p_container = 'JUMBO BOX'
-  AND l_quantity < (
-    SELECT
-      0.2 * AVG(l_quantity)
-    FROM
-      lineitem
-    WHERE
-      l_partkey = p_partkey
-  )
---
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectList
-  | +-SelectListItem[alias=avg_yearly]
-  |   +-Divide
-  |     +-left_operand=FunctionCall[name=SUM]
-  |     | +-AttributeReference[attribute_name=l_extendedprice]
-  |     +-right_operand=Literal
-  |       +-NumericLiteral[numeric_string=7.0,float_like=true]
-  +-where_clause=And
-  | +-Equal
-  | | +-left_operand=AttributeReference[attribute_name=p_partkey]
-  | | +-right_operand=AttributeReference[attribute_name=l_partkey]
-  | +-Equal
-  | | +-left_operand=AttributeReference[attribute_name=p_brand]
-  | | +-right_operand=Literal
-  | |   +-StringLiteral[value=Brand#24]
-  | +-Equal
-  | | +-left_operand=AttributeReference[attribute_name=p_container]
-  | | +-right_operand=Literal
-  | |   +-StringLiteral[value=JUMBO BOX]
-  | +-Less
-  |   +-left_operand=AttributeReference[attribute_name=l_quantity]
-  |   +-right_operand=SubqueryExpression
-  |     +-Select
-  |       +-select_clause=SelectList
-  |       | +-SelectListItem
-  |       |   +-Multiply
-  |       |     +-left_operand=Literal
-  |       |     | +-NumericLiteral[numeric_string=0.2,float_like=true]
-  |       |     +-right_operand=FunctionCall[name=AVG]
-  |       |       +-AttributeReference[attribute_name=l_quantity]
-  |       +-where_clause=Equal
-  |       | +-left_operand=AttributeReference[attribute_name=l_partkey]
-  |       | +-right_operand=AttributeReference[attribute_name=p_partkey]
-  |       +-from_clause=
-  |         +-TableReference[table=lineitem]
-  +-from_clause=
-    +-TableReference[table=lineitem]
-    +-TableReference[table=part]
-==
-
-# Query 18
-SELECT
-  c_name,
-  c_custkey,
-  o_orderkey,
-  o_orderdate,
-  o_totalprice,
-  sum(l_quantity)
-FROM
-  customer,
-  orders,
-  lineitem
-WHERE
-  o_orderkey IN (
-    SELECT
-      l_orderkey
-    FROM
-      lineitem
-    GROUP BY
-      l_orderkey HAVING
-        SUM(l_quantity) > 314
-  )
-  AND c_custkey = o_custkey
-  AND o_orderkey = l_orderkey
-GROUP BY
-  c_name,
-  c_custkey,
-  o_orderkey,
-  o_orderdate,
-  o_totalprice
-ORDER BY
-  o_totalprice desc,
-  o_orderdate
-LIMIT 100
---
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectList
-  | +-SelectListItem
-  | | +-AttributeReference[attribute_name=c_name]
-  | +-SelectListItem
-  | | +-AttributeReference[attribute_name=c_custkey]
-  | +-SelectListItem
-  | | +-AttributeReference[attribute_name=o_orderkey]
-  | +-SelectListItem
-  | | +-AttributeReference[attribute_name=o_orderdate]
-  | +-SelectListItem
-  | | +-AttributeReference[attribute_name=o_totalprice]
-  | +-SelectListItem
-  |   +-FunctionCall[name=sum]
-  |     +-AttributeReference[attribute_name=l_quantity]
-  +-where_clause=And
-  | +-InTableQuery
-  | | +-test_expression=AttributeReference[attribute_name=o_orderkey]
-  | | +-table_query=SubqueryExpression
-  | |   +-Select
-  | |     +-select_clause=SelectList
-  | |     | +-SelectListItem
-  | |     |   +-AttributeReference[attribute_name=l_orderkey]
-  | |     +-group_by=GroupBy
-  | |     | +-AttributeReference[attribute_name=l_orderkey]
-  | |     +-having=HAVING
-  | |     | +-Greater
-  | |     |   +-left_operand=FunctionCall[name=SUM]
-  | |     |   | +-AttributeReference[attribute_name=l_quantity]
-  | |     |   +-right_operand=Literal
-  | |     |     +-NumericLiteral[numeric_string=314,float_like=false]
-  | |     +-from_clause=
-  | |       +-TableReference[table=lineitem]
-  | +-Equal
-  | | +-left_operand=AttributeReference[attribute_name=c_custkey]
-  | | +-right_operand=AttributeReference[attribute_name=o_custkey]
-  | +-Equal
-  |   +-left_operand=AttributeReference[attribute_name=o_orderkey]
-  |   +-right_operand=AttributeReference[attribute_name=l_orderkey]
-  +-group_by=GroupBy
-  | +-AttributeReference[attribute_name=c_name]
-  | +-AttributeReference[attribute_name=c_custkey]
-  | +-AttributeReference[attribute_name=o_orderkey]
-  | +-AttributeReference[attribute_name=o_orderdate]
-  | +-AttributeReference[attribute_name=o_totalprice]
-  +-order_by=OrderBy
-  | +-OrderByItem[is_asc=false,nulls_first=true]
-  | | +-AttributeReference[attribute_name=o_totalprice]
-  | +-OrderByItem[is_asc=true,nulls_first=false]
-  |   +-AttributeReference[attribute_name=o_orderdate]
-  +-limit=LIMIT
-  | +-NumericLiteral[numeric_string=100,float_like=false]
-  +-from_clause=
-    +-TableReference[table=customer]
-    +-TableReference[table=orders]
-    +-TableReference[table=lineitem]
-==
-
-# Query 19
-SELECT
-  SUM(l_extendedprice* (1 - l_discount)) AS revenue
-FROM
-  lineitem,
-  part
-WHERE
-  (
-    p_partkey = l_partkey
-    AND p_brand = 'Brand#45'
-    AND p_container IN ('SM CASE', 'SM BOX', 'SM PACK', 'SM PKG')
-    AND l_quantity >= 2 AND l_quantity <= 2 + 10
-    AND p_size BETWEEN 1 AND 5
-    AND l_shipmode IN ('AIR', 'AIR REG')
-    AND l_shipinstruct = 'DELIVER IN PERSON'
-  )
-  OR
-  (
-    p_partkey = l_partkey
-    AND p_brand = 'Brand#12'
-    AND p_container IN ('MED BAG', 'MED BOX', 'MED PKG', 'MED PACK')
-    AND l_quantity >= 13 AND l_quantity <= 13 + 10
-    AND p_size BETWEEN 1 AND 10
-    AND l_shipmode IN ('AIR', 'AIR REG')
-    AND l_shipinstruct = 'DELIVER IN PERSON'
-  )
-  OR
-  (
-    p_partkey = l_partkey
-    AND p_brand = 'Brand#53'
-    AND p_container IN ('LG CASE', 'LG BOX', 'LG PACK', 'LG PKG')
-    AND l_quantity >= 24 AND l_quantity <= 24 + 10
-    AND p_size BETWEEN 1 AND 15
-    AND l_shipmode IN ('AIR', 'AIR REG')
-    AND l_shipinstruct = 'DELIVER IN PERSON'
-  )
---
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectList
-  | +-SelectListItem[alias=revenue]
-  |   +-FunctionCall[name=SUM]
-  |     +-Multiply
-  |       +-left_operand=AttributeReference[attribute_name=l_extendedprice]
-  |       +-right_operand=Subtract
-  |         +-left_operand=Literal
-  |         | +-NumericLiteral[numeric_string=1,float_like=false]
-  |         +-right_operand=AttributeReference[attribute_name=l_discount]
-  +-where_clause=Or
-  | +-And
-  | | +-Equal
-  | | | +-left_operand=AttributeReference[attribute_name=p_partkey]
-  | | | +-right_operand=AttributeReference[attribute_name=l_partkey]
-  | | +-Equal
-  | | | +-left_operand=AttributeReference[attribute_name=p_brand]
-  | | | +-right_operand=Literal
-  | | |   +-StringLiteral[value=Brand#45]
-  | | +-InValueList
-  | | | +-test_expression=AttributeReference[attribute_name=p_container]
-  | | | +-value_list=
-  | | |   +-Literal
-  | | |   | +-StringLiteral[value=SM CASE]
-  | | |   +-Literal
-  | | |   | +-StringLiteral[value=SM BOX]
-  | | |   +-Literal
-  | | |   | +-StringLiteral[value=SM PACK]
-  | | |   +-Literal
-  | | |     +-StringLiteral[value=SM PKG]
-  | | +-GreaterOrEqual
-  | | | +-left_operand=AttributeReference[attribute_name=l_quantity]
-  | | | +-right_operand=Literal
-  | | |   +-NumericLiteral[numeric_string=2,float_like=false]
-  | | +-LessOrEqual
-  | | | +-left_operand=AttributeReference[attribute_name=l_quantity]
-  | | | +-right_operand=Add
-  | | |   +-left_operand=Literal
-  | | |   | +-NumericLiteral[numeric_string=2,float_like=false]
-  | | |   +-right_operand=Literal
-  | | |     +-NumericLiteral[numeric_string=10,float_like=false]
-  | | +-Between
-  | | | +-check_operand=AttributeReference[attribute_name=p_size]
-  | | | +-lower_bound_operand=Literal
-  | | | | +-NumericLiteral[numeric_string=1,float_like=false]
-  | | | +-upper_bound_operand=Literal
-  | | |   +-NumericLiteral[numeric_string=5,float_like=false]
-  | | +-InValueList
-  | | | +-test_expression=AttributeReference[attribute_name=l_shipmode]
-  | | | +-value_list=
-  | | |   +-Literal
-  | | |   | +-StringLiteral[value=AIR]
-  | | |   +-Literal
-  | | |     +-StringLiteral[value=AIR REG]
-  | | +-Equal
-  | |   +-left_operand=AttributeReference[attribute_name=l_shipinstruct]
-  | |   +-right_operand=Literal
-  | |     +-StringLiteral[value=DELIVER IN PERSON]
-  | +-And
-  | | +-Equal
-  | | | +-left_operand=AttributeReference[attribute_name=p_partkey]
-  | | | +-right_operand=AttributeReference[attribute_name=l_partkey]
-  | | +-Equal
-  | | | +-left_operand=AttributeReference[attribute_name=p_brand]
-  | | | +-right_operand=Literal
-  | | |   +-StringLiteral[value=Brand#12]
-  | | +-InValueList
-  | | | +-test_expression=AttributeReference[attribute_name=p_container]
-  | | | +-value_list=
-  | | |   +-Literal
-  | | |   | +-StringLiteral[value=MED BAG]
-  | | |   +-Literal
-  | | |   | +-StringLiteral[value=MED BOX]
-  | | |   +-Literal
-  | | |   | +-StringLiteral[value=MED PKG]
-  | | |   +-Literal
-  | | |     +-StringLiteral[value=MED PACK]
-  | | +-GreaterOrEqual
-  | | | +-left_operand=AttributeReference[attribute_name=l_quantity]
-  | | | +-right_operand=Literal
-  | | |   +-NumericLiteral[numeric_string=13,float_like=false]
-  | | +-LessOrEqual
-  | | | +-left_operand=AttributeReference[attribute_name=l_quantity]
-  | | | +-right_operand=Add
-  | | |   +-left_operand=Literal
-  | | |   | +-NumericLiteral[numeric_string=13,float_like=false]
-  | | |   +-right_operand=Literal
-  | | |     +-NumericLiteral[numeric_string=10,float_like=false]
-  | | +-Between
-  | | | +-check_operand=AttributeReference[attribute_name=p_size]
-  | | | +-lower_bound_operand=Literal
-  | | | | +-NumericLiteral[numeric_string=1,float_like=false]
-  | | | +-upper_bound_operand=Literal
-  | | |   +-NumericLiteral[numeric_string=10,float_like=false]
-  | | +-InValueList
-  | | | +-test_expression=AttributeReference[attribute_name=l_shipmode]
-  | | | +-value_list=
-  | | |   +-Literal
-  | | |   | +-StringLiteral[value=AIR]
-  | | |   +-Literal
-  | | |     +-StringLiteral[value=AIR REG]
-  | | +-Equal
-  | |   +-left_operand=AttributeReference[attribute_name=l_shipinstruct]
-  | |   +-right_operand=Literal
-  | |     +-StringLiteral[value=DELIVER IN PERSON]
-  | +-And
-  |   +-Equal
-  |   | +-left_operand=AttributeReference[attribute_name=p_partkey]
-  |   | +-right_operand=AttributeReference[attribute_name=l_partkey]
-  |   +-Equal
-  |   | +-left_operand=AttributeReference[attribute_name=p_brand]
-  |   | +-right_operand=Literal
-  |   |   +-StringLiteral[value=Brand#53]
-  |   +-InValueList
-  |   | +-test_expression=AttributeReference[attribute_name=p_container]
-  |   | +-value_list=
-  |   |   +-Literal
-  |   |   | +-StringLiteral[value=LG CASE]
-  |   |   +-Literal
-  |   |   | +-StringLiteral[value=LG BOX]
-  |   |   +-Literal
-  |   |   | +-StringLiteral[value=LG PACK]
-  |   |   +-Literal
-  |   |     +-StringLiteral[value=LG PKG]
-  |   +-GreaterOrEqual
-  |   | +-left_operand=AttributeReference[attribute_name=l_quantity]
-  |   | +-right_operand=Literal
-  |   |   +-NumericLiteral[numeric_string=24,float_like=false]
-  |   +-LessOrEqual
-  |   | +-left_operand=AttributeReference[attribute_name=l_quantity]
-  |   | +-right_operand=Add
-  |   |   +-left_operand=Literal
-  |   |   | +-NumericLiteral[numeric_string=24,float_like=false]
-  |   |   +-right_operand=Literal
-  |   |     +-NumericLiteral[numeric_string=10,float_like=false]
-  |   +-Between
-  |   | +-check_operand=AttributeReference[attribute_name=p_size]
-  |   | +-lower_bound_operand=Literal
-  |   | | +-NumericLiteral[numeric_string=1,float_like=false]
-  |   | +-upper_bound_operand=Literal
-  |   |   +-NumericLiteral[numeric_string=15,float_like=false]
-  |   +-InValueList
-  |   | +-test_expression=AttributeReference[attribute_name=l_shipmode]
-  |   | +-value_list=
-  |   |   +-Literal
-  |   |   | +-StringLiteral[value=AIR]
-  |   |   +-Literal
-  |   |     +-StringLiteral[value=AIR REG]
-  |   +-Equal
-  |     +-left_operand=AttributeReference[attribute_name=l_shipinstruct]
-  |     +-right_operand=Literal
-  |       +-StringLiteral[value=DELIVER IN PERSON]
-  +-from_clause=
-    +-TableReference[table=lineitem]
-    +-TableReference[table=part]
-==
-
-# Query 20
-SELECT
-  s_name,
-  s_address
-FROM
-  supplier,
-  nation
-WHERE
-  s_suppkey IN (
-    SELECT
-      ps_suppkey
-    FROM
-      partsupp
-    WHERE
-      ps_partkey IN (
-        SELECT
-          p_partkey
-        FROM
-          part
-        WHERE
-          p_name LIKE 'sandy%'
-      )
-      AND ps_availqty > (
-        SELECT
-          0.5 * SUM(l_quantity)
-        FROM
-          lineitem
-        WHERE
-          l_partkey = ps_partkey
-          AND l_suppkey = ps_suppkey
-          AND l_shipdate >= DATE '1993-01-01'
-          AND l_shipdate < DATE '1993-01-01' + INTERVAL '1 year'
-      )
-  )
-  AND s_nationkey = n_nationkey
-  AND n_name = 'GERMANY'
-ORDER BY
-  s_name
---
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectList
-  | +-SelectListItem
-  | | +-AttributeReference[attribute_name=s_name]
-  | +-SelectListItem
-  |   +-AttributeReference[attribute_name=s_address]
-  +-where_clause=And
-  | +-InTableQuery
-  | | +-test_expression=AttributeReference[attribute_name=s_suppkey]
-  | | +-table_query=SubqueryExpression
-  | |   +-Select
-  | |     +-select_clause=SelectList
-  | |     | +-SelectListItem
-  | |     |   +-AttributeReference[attribute_name=ps_suppkey]
-  | |     +-where_clause=And
-  | |     | +-InTableQuery
-  | |     | | +-test_expression=AttributeReference[attribute_name=ps_partkey]
-  | |     | | +-table_query=SubqueryExpression
-  | |     | |   +-Select
-  | |     | |     +-select_clause=SelectList
-  | |     | |     | +-SelectListItem
-  | |     | |     |   +-AttributeReference[attribute_name=p_partkey]
-  | |     | |     +-where_clause=Like
-  | |     | |     | +-left_operand=AttributeReference[attribute_name=p_name]
-  | |     | |     | +-right_operand=Literal
-  | |     | |     |   +-StringLiteral[value=sandy%]
-  | |     | |     +-from_clause=
-  | |     | |       +-TableReference[table=part]
-  | |     | +-Greater
-  | |     |   +-left_operand=AttributeReference[attribute_name=ps_availqty]
-  | |     |   +-right_operand=SubqueryExpression
-  | |     |     +-Select
-  | |     |       +-select_clause=SelectList
-  | |     |       | +-SelectListItem
-  | |     |       |   +-Multiply
-  | |     |       |     +-left_operand=Literal
-  | |     |       |     | +-NumericLiteral[numeric_string=0.5,float_like=true]
-  | |     |       |     +-right_operand=FunctionCall[name=SUM]
-  | |     |       |       +-AttributeReference[attribute_name=l_quantity]
-  | |     |       +-where_clause=And
-  | |     |       | +-Equal
-  | |     |       | | +-left_operand=AttributeReference[attribute_name=l_partkey]
-  | |     |       | | +-right_operand=AttributeReference[
-  | |     |       | |   attribute_name=ps_partkey]
-  | |     |       | +-Equal
-  | |     |       | | +-left_operand=AttributeReference[attribute_name=l_suppkey]
-  | |     |       | | +-right_operand=AttributeReference[
-  | |     |       | |   attribute_name=ps_suppkey]
-  | |     |       | +-GreaterOrEqual
-  | |     |       | | +-left_operand=AttributeReference[
-  | |     |       | | | attribute_name=l_shipdate]
-  | |     |       | | +-right_operand=Literal
-  | |     |       | |   +-StringLiteral[value=1993-01-01,explicit_type=Date]
-  | |     |       | +-Less
-  | |     |       |   +-left_operand=AttributeReference[
-  | |     |       |   | attribute_name=l_shipdate]
-  | |     |       |   +-right_operand=Add
-  | |     |       |     +-left_operand=Literal
-  | |     |       |     | +-StringLiteral[value=1993-01-01,explicit_type=Date]
-  | |     |       |     +-right_operand=Literal
-  | |     |       |       +-StringLiteral[value=1 year,
-  | |     |       |         explicit_type=YearMonthInterval]
-  | |     |       +-from_clause=
-  | |     |         +-TableReference[table=lineitem]
-  | |     +-from_clause=
-  | |       +-TableReference[table=partsupp]
-  | +-Equal
-  | | +-left_operand=AttributeReference[attribute_name=s_nationkey]
-  | | +-right_operand=AttributeReference[attribute_name=n_nationkey]
-  | +-Equal
-  |   +-left_operand=AttributeReference[attribute_name=n_name]
-  |   +-right_operand=Literal
-  |     +-StringLiteral[value=GERMANY]
-  +-order_by=OrderBy
-  | +-OrderByItem[is_asc=true,nulls_first=false]
-  |   +-AttributeReference[attribute_name=s_name]
-  +-from_clause=
-    +-TableReference[table=supplier]
-    +-TableReference[table=nation]
-==
-
-# Query 21
-SELECT
-  s_name,
-  count(*) AS numwait
-FROM
-  supplier,
-  lineitem l1,
-  orders,
-  nation
-WHERE
-  s_suppkey = l1.l_suppkey
-  AND o_orderkey = l1.l_orderkey
-  AND o_orderstatus = 'F'
-  AND l1.l_receiptdate > l1.l_commitdate
-  AND EXISTS (
-    SELECT
-      *
-    FROM
-      lineitem l2
-    WHERE
-      l2.l_orderkey = l1.l_orderkey
-      AND l2.l_suppkey <> l1.l_suppkey
-  )
-  AND NOT EXISTS (
-    SELECT
-      *
-    FROM
-      lineitem l3
-    WHERE
-      l3.l_orderkey = l1.l_orderkey
-      AND l3.l_suppkey <> l1.l_suppkey
-      AND l3.l_receiptdate > l3.l_commitdate
-  )
-  AND s_nationkey = n_nationkey
-  AND n_name = 'CANADA'
-GROUP BY
-  s_name
-ORDER BY
-  numwait desc,
-  s_name
-LIMIT 100
---
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectList
-  | +-SelectListItem
-  | | +-AttributeReference[attribute_name=s_name]
-  | +-SelectListItem[alias=numwait]
-  |   +-FunctionCall[name=count,is_star=true]
-  +-where_clause=And
-  | +-Equal
-  | | +-left_operand=AttributeReference[attribute_name=s_suppkey]
-  | | +-right_operand=AttributeReference[attribute_name=l_suppkey,
-  | |   relation_name=l1]
-  | +-Equal
-  | | +-left_operand=AttributeReference[attribute_name=o_orderkey]
-  | | +-right_operand=AttributeReference[attribute_name=l_orderkey,
-  | |   relation_name=l1]
-  | +-Equal
-  | | +-left_operand=AttributeReference[attribute_name=o_orderstatus]
-  | | +-right_operand=Literal
-  | |   +-StringLiteral[value=F]
-  | +-Greater
-  | | +-left_operand=AttributeReference[attribute_name=l_receiptdate,
-  | | | relation_name=l1]
-  | | +-right_operand=AttributeReference[attribute_name=l_commitdate,
-  | |   relation_name=l1]
-  | +-Exists
-  | | +-subquery=SubqueryExpression
-  | |   +-Select
-  | |     +-select_clause=SelectStar
-  | |     +-where_clause=And
-  | |     | +-Equal
-  | |     | | +-left_operand=AttributeReference[attribute_name=l_orderkey,
-  | |     | | | relation_name=l2]
-  | |     | | +-right_operand=AttributeReference[attribute_name=l_orderkey,
-  | |     | |   relation_name=l1]
-  | |     | +-NotEqual
-  | |     |   +-left_operand=AttributeReference[attribute_name=l_suppkey,
-  | |     |   | relation_name=l2]
-  | |     |   +-right_operand=AttributeReference[attribute_name=l_suppkey,
-  | |     |     relation_name=l1]
-  | |     +-from_clause=
-  | |       +-TableReference[table=lineitem]
-  | |         +-table_signature=TableSignature[table_alias=l2]
-  | +-Not
-  | | +-Exists
-  | |   +-subquery=SubqueryExpression
-  | |     +-Select
-  | |       +-select_clause=SelectStar
-  | |       +-where_clause=And
-  | |       | +-Equal
-  | |       | | +-left_operand=AttributeReference[attribute_name=l_orderkey,
-  | |       | | | relation_name=l3]
-  | |       | | +-right_operand=AttributeReference[attribute_name=l_orderkey,
-  | |       | |   relation_name=l1]
-  | |       | +-NotEqual
-  | |       | | +-left_operand=AttributeReference[attribute_name=l_suppkey,
-  | |       | | | relation_name=l3]
-  | |       | | +-right_operand=AttributeReference[attribute_name=l_suppkey,
-  | |       | |   relation_name=l1]
-  | |       | +-Greater
-  | |       |   +-left_operand=AttributeReference[attribute_name=l_receiptdate,
-  | |       |   | relation_name=l3]
-  | |       |   +-right_operand=AttributeReference[attribute_name=l_commitdate,
-  | |       |     relation_name=l3]
-  | |       +-from_clause=
-  | |         +-TableReference[table=lineitem]
-  | |           +-table_signature=TableSignature[table_alias=l3]
-  | +-Equal
-  | | +-left_operand=AttributeReference[attribute_name=s_nationkey]
-  | | +-right_operand=AttributeReference[attribute_name=n_nationkey]
-  | +-Equal
-  |   +-left_operand=AttributeReference[attribute_name=n_name]
-  |   +-right_operand=Literal
-  |     +-StringLiteral[value=CANADA]
-  +-group_by=GroupBy
-  | +-AttributeReference[attribute_name=s_name]
-  +-order_by=OrderBy
-  | +-OrderByItem[is_asc=false,nulls_first=true]
-  | | +-AttributeReference[attribute_name=numwait]
-  | +-OrderByItem[is_asc=true,nulls_first=false]
-  |   +-AttributeReference[attribute_name=s_name]
-  +-limit=LIMIT
-  | +-NumericLiteral[numeric_string=100,float_like=false]
-  +-from_clause=
-    +-TableReference[table=supplier]
-    +-TableReference[table=lineitem]
-    | +-table_signature=TableSignature[table_alias=l1]
-    +-TableReference[table=orders]
-    +-TableReference[table=nation]
-==
-
-# Query 22
-SELECT
-  cntrycode,
-  COUNT(*) AS numcust,
-  SUM(c_acctbal) AS totacctbal
-FROM
-  (
-    SELECT
-      SUBSTR(c_phone, 1, 2) AS cntrycode,
-      c_acctbal
-    FROM
-      customer
-    WHERE
-      SUBSTR(c_phone, 1, 2) IN
-        ('27', '44', '34', '25', '30', '33', '23')
-      AND c_acctbal > (
-        SELECT
-          AVG(c_acctbal)
-        FROM
-          customer
-        WHERE
-          c_acctbal > 0.00
-          AND SUBSTR(c_phone, 1, 2) IN
-            ('27', '44', '34', '25', '30', '33', '23')
-      )
-      AND NOT EXISTS (
-        SELECT *
-        FROM
-          orders
-        WHERE
-          o_custkey = c_custkey
-      )
-  ) AS custsale
-GROUP BY
-  cntrycode
-ORDER BY
-  cntrycode
---
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectList
-  | +-SelectListItem
-  | | +-AttributeReference[attribute_name=cntrycode]
-  | +-SelectListItem[alias=numcust]
-  | | +-FunctionCall[name=COUNT,is_star=true]
-  | +-SelectListItem[alias=totacctbal]
-  |   +-FunctionCall[name=SUM]
-  |     +-AttributeReference[attribute_name=c_acctbal]
-  +-group_by=GroupBy
-  | +-AttributeReference[attribute_name=cntrycode]
-  +-order_by=OrderBy
-  | +-OrderByItem[is_asc=true,nulls_first=false]
-  |   +-AttributeReference[attribute_name=cntrycode]
-  +-from_clause=
-    +-SubqueryTable
-      +-table_signature=TableSignature[table_alias=custsale]
-      +-SubqueryExpression
-        +-Select
-          +-select_clause=SelectList
-          | +-SelectListItem[alias=cntrycode]
-          | | +-FunctionCall[name=SUBSTR]
-          | |   +-AttributeReference[attribute_name=c_phone]
-          | |   +-Literal
-          | |   | +-NumericLiteral[numeric_string=1,float_like=false]
-          | |   +-Literal
-          | |     +-NumericLiteral[numeric_string=2,float_like=false]
-          | +-SelectListItem
-          |   +-AttributeReference[attribute_name=c_acctbal]
-          +-where_clause=And
-          | +-InValueList
-          | | +-test_expression=FunctionCall[name=SUBSTR]
-          | | | +-AttributeReference[attribute_name=c_phone]
-          | | | +-Literal
-          | | | | +-NumericLiteral[numeric_string=1,float_like=false]
-          | | | +-Literal
-          | | |   +-NumericLiteral[numeric_string=2,float_like=false]
-          | | +-value_list=
-          | |   +-Literal
-          | |   | +-StringLiteral[value=27]
-          | |   +-Literal
-          | |   | +-StringLiteral[value=44]
-          | |   +-Literal
-          | |   | +-StringLiteral[value=34]
-          | |   +-Literal
-          | |   | +-StringLiteral[value=25]
-          | |   +-Literal
-          | |   | +-StringLiteral[value=30]
-          | |   +-Literal
-          | |   | +-StringLiteral[value=33]
-          | |   +-Literal
-          | |     +-StringLiteral[value=23]
-          | +-Greater
-          | | +-left_operand=AttributeReference[attribute_name=c_acctbal]
-          | | +-right_operand=SubqueryExpression
-          | |   +-Select
-          | |     +-select_clause=SelectList
-          | |     | +-SelectListItem
-          | |     |   +-FunctionCall[name=AVG]
-          | |     |     +-AttributeReference[attribute_name=c_acctbal]
-          | |     +-where_clause=And
-          | |     | +-Greater
-          | |     | | +-left_operand=AttributeReference[attribute_name=c_acctbal]
-          | |     | | +-right_operand=Literal
-          | |     | |   +-NumericLiteral[numeric_string=0.00,float_like=true]
-          | |     | +-InValueList
-          | |     |   +-test_expression=FunctionCall[name=SUBSTR]
-          | |     |   | +-AttributeReference[attribute_name=c_phone]
-          | |     |   | +-Literal
-          | |     |   | | +-NumericLiteral[numeric_string=1,float_like=false]
-          | |     |   | +-Literal
-          | |     |   |   +-NumericLiteral[numeric_string=2,float_like=false]
-          | |     |   +-value_list=
-          | |     |     +-Literal
-          | |     |     | +-StringLiteral[value=27]
-          | |     |     +-Literal
-          | |     |     | +-StringLiteral[value=44]
-          | |     |     +-Literal
-          | |     |     | +-StringLiteral[value=34]
-          | |     |     +-Literal
-          | |     |     | +-StringLiteral[value=25]
-          | |     |     +-Literal
-          | |     |     | +-StringLiteral[value=30]
-          | |     |     +-Literal
-          | |     |     | +-StringLiteral[value=33]
-          | |     |     +-Literal
-          | |     |       +-StringLiteral[value=23]
-          | |     +-from_clause=
-          | |       +-TableReference[table=customer]
-          | +-Not
-          |   +-Exists
-          |     +-subquery=SubqueryExpression
-          |       +-Select
-          |         +-select_clause=SelectStar
-          |         +-where_clause=Equal
-          |         | +-left_operand=AttributeReference[attribute_name=o_custkey]
-          |         | +-right_operand=AttributeReference[
-          |         |   attribute_name=c_custkey]
-          |         +-from_clause=
-          |           +-TableReference[table=orders]
-          +-from_clause=
-            +-TableReference[table=customer]

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/parser/tests/Update.test
----------------------------------------------------------------------
diff --git a/parser/tests/Update.test b/parser/tests/Update.test
deleted file mode 100644
index 4ae0fcb..0000000
--- a/parser/tests/Update.test
+++ /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.
-
-UPDATE TABLE test SET attr = 1
---
-ERROR: syntax error (1 : 8)
-UPDATE TABLE test SET attr = 1
-       ^
-==
-
-UPDATE TABLE SET attr = 1
---
-ERROR: syntax error (1 : 8)
-UPDATE TABLE SET attr = 1
-       ^
-==
-
-UPDATE test SET attr1 = 1, attr2=5, attr3 = 4 WHERE attr2 < 1 AND attr1 > 5 AND attr1+1<2*attr2
---
-UpdateStatement[relation_name=test]
-+-where_predicate=And
-| +-Less
-| | +-left_operand=AttributeReference[attribute_name=attr2]
-| | +-right_operand=Literal
-| |   +-NumericLiteral[numeric_string=1,float_like=false]
-| +-Greater
-| | +-left_operand=AttributeReference[attribute_name=attr1]
-| | +-right_operand=Literal
-| |   +-NumericLiteral[numeric_string=5,float_like=false]
-| +-Less
-|   +-left_operand=Add
-|   | +-left_operand=AttributeReference[attribute_name=attr1]
-|   | +-right_operand=Literal
-|   |   +-NumericLiteral[numeric_string=1,float_like=false]
-|   +-right_operand=Multiply
-|     +-left_operand=Literal
-|     | +-NumericLiteral[numeric_string=2,float_like=false]
-|     +-right_operand=AttributeReference[attribute_name=attr2]
-+-assignment=
-  +-AttributeAssignment[attribute_name=attr1]
-  | +-value=Literal
-  |   +-NumericLiteral[numeric_string=1,float_like=false]
-  +-AttributeAssignment[attribute_name=attr2]
-  | +-value=Literal
-  |   +-NumericLiteral[numeric_string=5,float_like=false]
-  +-AttributeAssignment[attribute_name=attr3]
-    +-value=Literal
-      +-NumericLiteral[numeric_string=4,float_like=false]
-==
-
-UPDATE test SET attr = 4+1
---
-UpdateStatement[relation_name=test]
-+-assignment=
-  +-AttributeAssignment[attribute_name=attr]
-    +-value=Add
-      +-left_operand=Literal
-      | +-NumericLiteral[numeric_string=4,float_like=false]
-      +-right_operand=Literal
-        +-NumericLiteral[numeric_string=1,float_like=false]
-==
-
-UPDATE test WHERE attr2=1
---
-ERROR: syntax error (1 : 13)
-UPDATE test WHERE attr2=1
-            ^

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_execution/AdmitRequestMessage.hpp
----------------------------------------------------------------------
diff --git a/query_execution/AdmitRequestMessage.hpp b/query_execution/AdmitRequestMessage.hpp
deleted file mode 100644
index dd3d49b..0000000
--- a/query_execution/AdmitRequestMessage.hpp
+++ /dev/null
@@ -1,75 +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_EXECUTION_ADMIT_REQUEST_MESSAGE_HPP_
-#define QUICKSTEP_QUERY_EXECUTION_ADMIT_REQUEST_MESSAGE_HPP_
-
-#include <vector>
-
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-
-class QueryHandle;
-
-/** \addtogroup QueryExecution
- *  @{
- */
-
-/**
- * @brief A message requesting a query or queries to be admitted to the system.
- **/
-class AdmitRequestMessage {
- public:
-  /**
-   * @brief Constructor.
-   *
-   * @param query_handles The handles of the queries requesting to be admitted
-   *        to the system.
-   **/
-  explicit AdmitRequestMessage(const std::vector<QueryHandle*> &query_handles)
-      : query_handles_(query_handles) {}
-
-  /**
-   * @brief Constructor for requesting single query admission.
-   *
-   * @param query_handle The handle of the query requesting to be admitted.
-   **/
-  explicit AdmitRequestMessage(QueryHandle *query_handle) {
-    query_handles_.push_back(query_handle);
-  }
-
-  /**
-   * @brief Get the query handles from this message.
-   **/
-  const std::vector<QueryHandle*>& getQueryHandles() const {
-    return query_handles_;
-  }
-
- private:
-  std::vector<QueryHandle*> query_handles_;
-
-  DISALLOW_COPY_AND_ASSIGN(AdmitRequestMessage);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_QUERY_EXECUTION_ADMIT_REQUEST_MESSAGE_HPP_


[46/51] [abbrv] [partial] incubator-quickstep git commit: remove c++ files

Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/catalog/IndexScheme.hpp
----------------------------------------------------------------------
diff --git a/catalog/IndexScheme.hpp b/catalog/IndexScheme.hpp
deleted file mode 100644
index 3bf3f17..0000000
--- a/catalog/IndexScheme.hpp
+++ /dev/null
@@ -1,194 +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_CATALOG_INDEX_SCHEME_HPP_
-#define QUICKSTEP_CATALOG_INDEX_SCHEME_HPP_
-
-#include <algorithm>
-#include <cstddef>
-#include <string>
-#include <unordered_map>
-#include <vector>
-
-#include "catalog/Catalog.pb.h"
-#include "storage/StorageBlockLayout.pb.h"
-#include "utility/Macros.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-/** \addtogroup Catalog
- *  @{
- */
-
-/**
- * @brief The Index Scheme class which stores the information about
- *        various indicies defined for a particular relation.
- **/
-class IndexScheme {
- public:
-  typedef std::unordered_map<std::string, IndexSubBlockDescription>::const_iterator const_iterator;
-
-  /**
-   * @brief Constructor.
-   **/
-  IndexScheme() {
-  }
-
-  /**
-   * @brief Reconstruct an Index Scheme from its serialized
-   *        Protocol Buffer form.
-   *
-   * @param proto The Protocol Buffer serialization of a Index Scheme,
-   *              previously produced by getProto().
-   * @return The deserialied index scheme object.
-   **/
-  static IndexScheme* ReconstructFromProto(const serialization::IndexScheme &proto);
-
-  /**
-   * @brief Check whether a serialization::IndexScheme is fully-formed and
-   *        all parts are valid.
-   *
-   * @param proto A serialized Protocol Buffer representation of a
-   *              IndexScheme, originally generated by getProto().
-   * @return Whether proto is fully-formed and valid.
-   **/
-  static bool ProtoIsValid(const serialization::IndexScheme &proto);
-
-  /**
-   * @brief Serialize the Index Scheme as Protocol Buffer.
-   *
-   * @return The Protocol Buffer representation of Index Scheme.
-   **/
-  serialization::IndexScheme getProto() const;
-
-  /**
-   * @brief Get the number of indices for the relation.
-   *
-   * @return The number of indices defined for the relation.
-   **/
-  inline std::size_t getNumIndices() const {
-    return index_map_.size();
-  }
-
-  /**
-   * @brief Check whether an index with the given exists or not.
-   *
-   * @param index_name Name of the index to be checked.
-   * @return Whether the index exists or not.
-   **/
-  bool hasIndexWithName(const std::string &index_name) const {
-    return index_map_.find(index_name) != index_map_.end();
-  }
-
-  /**
-   * @brief Check whether an index with the given description
-   *        containing the same attribute id and index type
-   *        exists or not in the index map.
-   *
-   * @param index_descripton Index Description to check against.
-   * @return Whether a similar index description was already defined or not.
-   **/
-  bool hasIndexWithDescription(const IndexSubBlockDescription &index_description_checked) const {
-    // Iterate through every index description corresponding to each key in the index map.
-    for (auto cit = index_map_.cbegin(); cit != index_map_.cend(); ++cit) {
-      const IndexSubBlockDescription &index_description_expected = cit->second;
-      // Check if the stored description matches the given description.
-      if (areIndexDescriptionsSame(index_description_expected, index_description_checked)) {
-        return true;
-      }
-    }
-    return false;
-  }
-
-  /**
-   * @brief Check whether two index descriptions are same or not.
-   *        Two index descriptions are same if they have any matching
-   *        attributes ids and same index type.
-   *
-   * @param description_expected First index description.
-   * @param description_checked Second index description.
-   * @return Whether the two index_descriptions are similar or not.
-   **/
-  bool areIndexDescriptionsSame(const IndexSubBlockDescription &description_expected,
-                                const IndexSubBlockDescription &description_checked) const {
-    if (description_expected.sub_block_type() != description_checked.sub_block_type()) {
-      return false;
-    }
-
-    // Serialize and sort the two protobuf index descriptions and compare.
-    std::string serialized_description_expected, serialized_description_checked;
-    description_expected.SerializeToString(&serialized_description_expected);
-    description_checked.SerializeToString(&serialized_description_checked);
-    std::sort(serialized_description_expected.begin(), serialized_description_expected.end());
-    std::sort(serialized_description_checked.begin(), serialized_description_checked.end());
-
-    return (serialized_description_expected.compare(serialized_description_checked) == 0);
-  }
-
-  /**
-   * @brief Get an iterator at beginning of the index map.
-   *
-   * @return An iterator at beginning of the index map.
-   **/
-  inline const_iterator begin() const {
-    return index_map_.begin();
-  }
-
-  /**
-   * @brief Get an iterator at one-past-the-end of the index map.
-   *
-   * @return An iterator one-past-the-end of the index map.
-   **/
-  inline const_iterator end() const {
-    return index_map_.end();
-  }
-
-  /**
-   * @brief Adds a new index entry to the index map.
-   * @warning Must call before hasIndexWithName() and hasIndexWithDescription().
-   * @note This method assumes that the caller has already acquired the
-   *       necessary locks before invoking it.
-   *
-   * @param index_name The name of index to add (key).
-   * @param index_description The index description for this index (value).
-   **/
-  bool addIndexMapEntry(const std::string &index_name,
-                        IndexSubBlockDescription &&index_description) {  // NOLINT(whitespace/operators)
-    if (index_map_.find(index_name) != index_map_.end()) {
-      return false;  // index_name is already present!
-    }
-    // Value for this index_map key is the index description provided.
-    index_map_.emplace(index_name, std::move(index_description));
-    return true;
-  }
-
- private:
-  // A map of index names to their index description.
-  std::unordered_map<std::string, IndexSubBlockDescription> index_map_;
-
-  DISALLOW_COPY_AND_ASSIGN(IndexScheme);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_CATALOG_INDEX_SCHEME_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/catalog/NUMAPlacementScheme.cpp
----------------------------------------------------------------------
diff --git a/catalog/NUMAPlacementScheme.cpp b/catalog/NUMAPlacementScheme.cpp
deleted file mode 100644
index 8e7d0fa..0000000
--- a/catalog/NUMAPlacementScheme.cpp
+++ /dev/null
@@ -1,85 +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 "catalog/NUMAPlacementScheme.hpp"
-
-#include <unordered_map>
-#include <utility>
-
-#include "catalog/Catalog.pb.h"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-bool NUMAPlacementScheme::ProtoIsValid(
-    const serialization::NUMAPlacementScheme &proto) {
-  // Check that proto is fully initialized.
-  if (!proto.IsInitialized()) {
-    return false;
-  }
-  // Check if the number of numa nodes is non-zero.
-  if (proto.num_numa_nodes() <= 0) {
-    return false;
-  }
-  // Protobuf for NUMAPlacementScheme is valid.
-  return true;
-}
-
-serialization::NUMAPlacementScheme NUMAPlacementScheme::getProto() const {
-  serialization::NUMAPlacementScheme proto;
-
-  // Serialize the number of numa nodes.
-  proto.set_num_numa_nodes(getNumNUMANodes());
-
-  // Serialize the block to NUMA node map.
-  for (std::unordered_map<block_id, int>::const_iterator block_to_node_iter =
-           block_to_numa_node_map_.begin();
-       block_to_node_iter != block_to_numa_node_map_.end();
-       ++block_to_node_iter) {
-    serialization::NUMAPlacementScheme_BlockToNUMANodeEntry *entry =
-        proto.add_block_to_numa_node_map();
-    entry->set_block_id(block_to_node_iter->first);
-    entry->set_numa_node(block_to_node_iter->second);
-  }
-
-  return proto;
-}
-
-NUMAPlacementScheme* NUMAPlacementScheme::ReconstructFromProto(
-    const serialization::NUMAPlacementScheme &proto,
-    const std::size_t num_partitions) {
-  // This call to the constructor will populate the values of partition-to-NUMA
-  // node map.
-  NUMAPlacementScheme *placement_scheme = new NUMAPlacementScheme(num_partitions);
-
-  DCHECK(ProtoIsValid(proto))
-      << "Attempted to create NUMAPlacementScheme from an invalid proto description:\n"
-      << proto.DebugString();
-
-  // Deserialize block to NUMA node mapping.
-  for (int i = 0; i < proto.block_to_numa_node_map_size(); ++i) {
-    placement_scheme->addBlockToNUMANodeMap(
-        proto.block_to_numa_node_map(i).block_id(),
-        proto.block_to_numa_node_map(i).numa_node());
-  }
-  return placement_scheme;
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/catalog/NUMAPlacementScheme.hpp
----------------------------------------------------------------------
diff --git a/catalog/NUMAPlacementScheme.hpp b/catalog/NUMAPlacementScheme.hpp
deleted file mode 100644
index e5ab83a..0000000
--- a/catalog/NUMAPlacementScheme.hpp
+++ /dev/null
@@ -1,208 +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_CATALOG_PARTITION_PLACEMENT_SCHEME_HPP_
-#define QUICKSTEP_CATALOG_PARTITION_PLACEMENT_SCHEME_HPP_
-
-#include <numa.h>
-
-#include <cstddef>
-#include <ostream>
-#include <unordered_map>
-#include <utility>
-
-#include "catalog/Catalog.pb.h"
-#include "catalog/CatalogTypedefs.hpp"
-#include "storage/StorageBlockInfo.hpp"
-#include "utility/Macros.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-/** \addtogroup Catalog
- *  @{
- */
-
-/**
- * @brief A NUMAPlacementScheme object which stores the mapping between the
- * blocks in a partition and the NUMA nodes corresponding to those partitions.
- *
- * @note NUMA stands for Non-Uniform Memory Access.
- *
- * @note There is always only a one-on-one mapping between the partitions and
- * the NUMA nodes. This means that the blocks of a relation that belong to a
- * particular partition can be placed on ONLY one NUMA node. Earlier we had a
- * design where we can place the blocks in a single partition on multiple
- * NUMA nodes but we later decided that there wouldn't be any scenario where
- * we would want to place the blocks belonging to a single partition on more
- * than one NUMA node and hence that earlier design has been discarded.
- *
- * @note The terms node and socket would be used interchangeably in the
- * context of NUMA. A NUMA node or a NUMA socket would essentially mean
- * the same.
- **/
-class NUMAPlacementScheme {
- public:
-  /**
-   * @brief Constructor.
-   *
-   * @param num_partitions The number of partitions of the Catalog Relation.
-   *                       This would be the same as the number of partitions
-   *                       in the Partition Scheme of the relation.
-   **/
-  explicit NUMAPlacementScheme(const std::size_t num_partitions)
-      : num_numa_nodes_(numa_num_configured_nodes()),
-        num_partitions_(num_partitions) {
-    // Assign each partition to exactly one NUMA node.
-    // Partitions are assigned in a round robin way to NUMA nodes.
-    for (std::size_t part_id = 0;
-         part_id < num_partitions_;
-         ++part_id) {
-      partition_to_numa_node_map_[part_id] = part_id % num_numa_nodes_;
-    }
-  }
-
-  /**
-   * @brief Destructor.
-   **/
-  ~NUMAPlacementScheme() {}
-
-  /**
-   * @brief Get the number of partitions.
-   *
-   * @return Number of partitions in the Catalog Relation.
-   **/
-  inline std::size_t getNumPartitions() const {
-    return num_partitions_;
-  }
-
-  /**
-   * @brief Get the total number of NUMA nodes available in the system.
-   *
-   * @return Total number of NUMA nodes available in the system.
-   **/
-  inline std::size_t getNumNUMANodes() const {
-    return num_numa_nodes_;
-  }
-
-  /**
-   * @brief Get the NUMA node on which a partition is placed.
-   *
-   * @param part_id The partition id for which to find the NUMA node.
-   *
-   * @return The NUMA node on which the partition is placed.
-   **/
-  inline numa_node_id getNUMANodeForPartition(const partition_id part_id)
-      const {
-    auto partition_to_numa_node_map_iter =
-        partition_to_numa_node_map_.find(part_id);
-    DCHECK(partition_to_numa_node_map_iter != partition_to_numa_node_map_.end());
-    return partition_to_numa_node_map_iter->second;
-  }
-
-  /**
-   * @brief Add a mapping between a block and the NUMA node on which the block
-   *        is placed.
-   *
-   * @param block The block_id of the block for which the NUMA node mapping is
-   *              added.
-   * @param numa_node The numa node id on which the block is placed.
-   **/
-  void addBlockToNUMANodeMap(const block_id block, const int numa_node) {
-    // Make sure that the block doesn't have a mapping already.
-    // A block will be mapped to only one NUMA node.
-    // A NUMA node will be associated with a block only once.
-    DCHECK(block_to_numa_node_map_.find(block) == block_to_numa_node_map_.end());
-    DCHECK_GT(numa_num_configured_nodes(), numa_node)
-        << "NUMA node above the valid value.";
-    block_to_numa_node_map_[block] = numa_node;
-  }
-
-  /**
-   * @brief Get the NUMA node associated with a block.
-   *
-   * @param block The block_id of the block for which the associated NUMA node
-   *              id is to be found.
-   *
-   * @return The NUMA node id associated with the block.
-   **/
-  inline numa_node_id getNUMANodeForBlock(const block_id block) const {
-    auto block_to_numa_node_map_iter = block_to_numa_node_map_.find(block);
-    DCHECK(block_to_numa_node_map_iter != block_to_numa_node_map_.end());
-    return block_to_numa_node_map_iter->second;
-  }
-
-  /**
-   * @brief Check whether a serialization::NUMAPlacementScheme is fully-formed
-   *        and all parts are valid.
-   *
-   * @param proto A serialized Protocol Buffer representation of a
-   *              NUMAPlacementScheme, originally generated by getProto().
-   *
-   * @return Whether proto is fully-formed and valid.
-   **/
-  static bool ProtoIsValid(const serialization::NUMAPlacementScheme &proto);
-
-  /**
-   * @brief Serialize the NUMA Placement Scheme as Protocol Buffer.
-   *
-   * @return The Protocol Buffer representation of NUMA Placement Scheme.
-   **/
-  serialization::NUMAPlacementScheme getProto() const;
-
-  /**
-   * @brief Reconstruct a NUMA Placement Scheme from its serialized
-   *        Protocol Buffer form.
-   *
-   * @param proto The Protocol Buffer serialization of a NUMA Placement Scheme,
-   *              previously produced by getProto().
-   * @param partition_proto The Protocol Buffer serialization of a
-   *                        ParitionScheme. This is needed for number of
-   *                        partitions.
-   *
-   * @return The deserialized NUMA Placement Scheme object.
-   **/
-  static NUMAPlacementScheme* ReconstructFromProto(
-      const serialization::NUMAPlacementScheme &proto,
-      const std::size_t num_partitions);
-
- private:
-  // Number of NUMA nodes available in the system.
-  const std::size_t num_numa_nodes_;
-
-  // Number of partitions in the Catalog Relation.
-  const std::size_t num_partitions_;
-
-  // A map between the partition ids and NUMA node ids.
-  // All the blocks that belong to a particular partition are placed on only
-  // one NUMA node.
-  std::unordered_map<partition_id, numa_node_id> partition_to_numa_node_map_;
-
-  // A map between the block ids and the NUMA node ids.
-  std::unordered_map<block_id, numa_node_id> block_to_numa_node_map_;
-
-  DISALLOW_COPY_AND_ASSIGN(NUMAPlacementScheme);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_CATALOG_PARTITION_PLACEMENT_SCHEME_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/catalog/PartitionScheme.cpp
----------------------------------------------------------------------
diff --git a/catalog/PartitionScheme.cpp b/catalog/PartitionScheme.cpp
deleted file mode 100644
index d6e3469..0000000
--- a/catalog/PartitionScheme.cpp
+++ /dev/null
@@ -1,115 +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 "catalog/PartitionScheme.hpp"
-
-#include <cstddef>
-#include <limits>
-#include <unordered_set>
-#include <utility>
-#include <vector>
-
-#include "catalog/Catalog.pb.h"
-#include "catalog/PartitionSchemeHeader.hpp"
-#include "storage/StorageBlockInfo.hpp"
-
-#include "glog/logging.h"
-
-using std::move;
-using std::unordered_set;
-using std::vector;
-
-namespace quickstep {
-
-bool PartitionScheme::ProtoIsValid(
-    const serialization::PartitionScheme &proto) {
-  // Check that proto is fully initialized.
-  if (!proto.IsInitialized()) {
-    return false;
-  }
-
-  if (!PartitionSchemeHeader::ProtoIsValid(proto.header())) {
-    return false;
-  }
-
-  if (static_cast<std::size_t>(proto.partitions_size()) != proto.header().num_partitions()) {
-    return false;
-  }
-
-  return true;
-}
-
-PartitionScheme* PartitionScheme::ReconstructFromProto(const serialization::PartitionScheme &proto,
-                                                       const Type &attr_type) {
-  DCHECK(ProtoIsValid(proto))
-      << "Attempted to create PartitionScheme from an invalid proto description:\n"
-      << proto.DebugString();
-
-  vector<unordered_set<block_id>> blocks_in_partition;
-  for (int i = 0; i < proto.partitions_size(); ++i) {
-    unordered_set<block_id> blocks;
-
-    const serialization::Partition &proto_blocks = proto.partitions(i);
-    for (int j = 0; j < proto_blocks.blocks_size(); ++j) {
-      blocks.insert(proto_blocks.blocks(j));
-    }
-
-    blocks_in_partition.push_back(move(blocks));
-  }
-
-  return new PartitionScheme(
-      PartitionSchemeHeader::ReconstructFromProto(proto.header(), attr_type),
-      move(blocks_in_partition));
-}
-
-serialization::PartitionScheme PartitionScheme::getProto() const {
-  serialization::PartitionScheme proto;
-
-  proto.mutable_header()->MergeFrom(header_->getProto());
-
-  // Add blocks to the corresponding partitions.
-  for (std::size_t i = 0; i < blocks_in_partition_.size(); ++i) {
-    serialization::Partition *proto_blocks = proto.add_partitions();
-
-    SpinSharedMutexSharedLock<false> lock(blocks_in_partition_mutexes_[i]);
-    const std::unordered_set<block_id> &partition = blocks_in_partition_[i];
-    for (const block_id block : partition) {
-      proto_blocks->add_blocks(block);
-    }
-  }
-
-  return proto;
-}
-
-partition_id PartitionScheme::getPartitionForBlock(const block_id block) const {
-  // Check if the block is present in the available partitions.
-  // If so, return the partition id for the block.
-  for (partition_id part_id = 0; part_id < header_->getNumPartitions(); ++part_id) {
-    SpinSharedMutexSharedLock<false> lock(
-        blocks_in_partition_mutexes_[part_id]);
-    if (blocks_in_partition_[part_id].find(block) !=
-        blocks_in_partition_[part_id].end()) {
-      return part_id;
-    }
-  }
-  // Block was not found in any partitions.
-  return std::numeric_limits<std::size_t>::max();
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/catalog/PartitionScheme.hpp
----------------------------------------------------------------------
diff --git a/catalog/PartitionScheme.hpp b/catalog/PartitionScheme.hpp
deleted file mode 100644
index c882a5e..0000000
--- a/catalog/PartitionScheme.hpp
+++ /dev/null
@@ -1,190 +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_CATALOG_PARTITION_SCHEME_HPP_
-#define QUICKSTEP_CATALOG_PARTITION_SCHEME_HPP_
-
-#include <cstddef>
-#include <memory>
-#include <unordered_set>
-#include <utility>
-#include <vector>
-
-#include "catalog/Catalog.pb.h"
-#include "catalog/CatalogTypedefs.hpp"
-#include "catalog/PartitionSchemeHeader.hpp"
-#include "storage/StorageBlockInfo.hpp"
-#include "threading/Mutex.hpp"
-#include "threading/SharedMutex.hpp"
-#include "threading/SpinSharedMutex.hpp"
-#include "utility/Macros.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-class Type;
-
-/** \addtogroup Catalog
- *  @{
- */
-
-/**
- * @brief The class which stores the partitioning information and partitioned
- *        blocks for a particular relation.
- **/
-class PartitionScheme {
- public:
-  /**
-   * @brief Constructor.
-   * @note The constructor takes ownership of \c header.
-   *
-   * @param header The partition header.
-   * @param blocks_in_partition All blocks in partitions.
-   **/
-  explicit PartitionScheme(PartitionSchemeHeader *header)
-      : header_(DCHECK_NOTNULL(header)),
-        blocks_in_partition_(header_->getNumPartitions()),
-        blocks_in_partition_mutexes_(header_->getNumPartitions()) {}
-
-  /**
-   * @brief Constructor.
-   * @note The constructor takes ownership of \c header.
-   *
-   * @param header The partition header.
-   * @param blocks_in_partition All blocks in partitions.
-   **/
-  PartitionScheme(PartitionSchemeHeader *header,
-                  std::vector<std::unordered_set<block_id>> &&blocks_in_partition)
-      : header_(DCHECK_NOTNULL(header)),
-        blocks_in_partition_(std::move(blocks_in_partition)),
-        blocks_in_partition_mutexes_(header_->getNumPartitions()) {}
-
-  /**
-   * @brief Reconstruct a Partition Scheme from its serialized
-   *        Protocol Buffer form.
-   *
-   * @param proto The Protocol Buffer serialization of a Partition Scheme,
-   *        previously produced by getProto().
-   * @param attr_type The attribute type of the partitioning attribute.
-   * @return The deserialized partition scheme object.
-   **/
-  static PartitionScheme* ReconstructFromProto(const serialization::PartitionScheme &proto,
-                                               const Type &attr_type);
-
-  /**
-   * @brief Check whether a serialization::PartitionScheme is fully-formed and
-   *        all parts are valid.
-   *
-   * @param proto A serialized Protocol Buffer representation of a
-   *              PartitionScheme, originally generated by getProto().
-   * @return Whether proto is fully-formed and valid.
-   **/
-  static bool ProtoIsValid(const serialization::PartitionScheme &proto);
-
-  /**
-   * @brief Get the partitioning attribute for the relation.
-   *
-   * @return The partitioning attribute with which the relation
-   *         is partitioned into.
-   **/
-  const PartitionSchemeHeader& getPartitionSchemeHeader() const {
-    return *header_;
-  }
-
-  /**
-   * @brief Add a block to a partition.
-   *
-   * @param block_id The id of the block to be added to the partition.
-   * @param part_id The id of the partition to add the block to.
-   **/
-  inline void addBlockToPartition(const block_id block,
-                                  const partition_id part_id) {
-    DCHECK_LT(part_id, header_->getNumPartitions());
-    SpinSharedMutexExclusiveLock<false> lock(
-        blocks_in_partition_mutexes_[part_id]);
-    blocks_in_partition_[part_id].insert(block);
-  }
-
-  /**
-   * @brief Remove a block from a partition.
-   *
-   * @param block_id The id of the block to be removed from the partition.
-   * @param part_id The id of the partition to remove the block from.
-   **/
-  inline void removeBlockFromPartition(const block_id block,
-                                       const partition_id part_id) {
-    DCHECK_LT(part_id, header_->getNumPartitions());
-    SpinSharedMutexExclusiveLock<false> lock(
-        blocks_in_partition_mutexes_[part_id]);
-    std::unordered_set<block_id> &blocks_in_partition =
-        blocks_in_partition_[part_id];
-    blocks_in_partition.erase(block);
-  }
-
-  /**
-   * @brief Get all the blocks from a particular partition.
-   *
-   * @param part_id The id of the partition to retrieve the blocks from.
-   * @return The block_ids of blocks belonging to this partition at the moment
-   *         when this method is called.
-   **/
-  inline std::vector<block_id> getBlocksInPartition(
-      const partition_id part_id) const {
-    DCHECK_LT(part_id, header_->getNumPartitions());
-    SpinSharedMutexSharedLock<false> lock(
-        blocks_in_partition_mutexes_[part_id]);
-    return std::vector<block_id>(blocks_in_partition_[part_id].begin(),
-                                 blocks_in_partition_[part_id].end());
-  }
-
-  /**
-   * @brief Serialize the Partition Scheme as Protocol Buffer.
-   *
-   * @return The Protocol Buffer representation of Partition Scheme.
-   **/
-  serialization::PartitionScheme getProto() const;
-
-  /**
-   * @brief Get the partition id for a block.
-   *
-   * @param block The id of the block.
-   *
-   * @return The partition id to which the block belongs. If the block is not
-   *         found in any partition, then the maximum finite value for the type
-   *         std::size_t is returned.
-   **/
-  partition_id getPartitionForBlock(const block_id block) const;
-
- private:
-  std::unique_ptr<const PartitionSchemeHeader> header_;
-
-  // The unordered set of blocks per partition.
-  std::vector<std::unordered_set<block_id>> blocks_in_partition_;
-  // Mutexes for locking each partition separately.
-  mutable std::vector<SpinSharedMutex<false>> blocks_in_partition_mutexes_;
-
-  DISALLOW_COPY_AND_ASSIGN(PartitionScheme);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_CATALOG_PARTITION_SCHEME_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/catalog/PartitionSchemeHeader.cpp
----------------------------------------------------------------------
diff --git a/catalog/PartitionSchemeHeader.cpp b/catalog/PartitionSchemeHeader.cpp
deleted file mode 100644
index 26c317d..0000000
--- a/catalog/PartitionSchemeHeader.cpp
+++ /dev/null
@@ -1,134 +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 "catalog/PartitionSchemeHeader.hpp"
-
-#include <cstddef>
-#include <utility>
-#include <vector>
-
-#include "catalog/Catalog.pb.h"
-#include "types/TypedValue.hpp"
-#include "types/TypedValue.pb.h"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-PartitionSchemeHeader::PartitionSchemeHeader(const PartitionType type,
-                                             const std::size_t num_partitions,
-                                             const attribute_id attr_id)
-    : partition_type_(type),
-      num_partitions_(num_partitions),
-      partition_attribute_id_(attr_id) {
-  DCHECK_GT(num_partitions, 0u);
-  DCHECK_GE(attr_id, 0);
-}
-
-bool PartitionSchemeHeader::ProtoIsValid(
-    const serialization::PartitionSchemeHeader &proto) {
-  // Check that proto is fully initialized.
-  if (!proto.IsInitialized()) {
-    return false;
-  }
-  // Check if the partitioning attribute exists in the relation.
-  // TODO(gerald): Figure out how to find the max_attr_id of the
-  // relation so that we can check that partitioning attribute
-  // is not greater than the max_attr_id.
-
-  // Check that the proto has a valid partition type.
-  switch (proto.partition_type()) {
-    case serialization::PartitionSchemeHeader::HASH:
-      return true;
-    case serialization::PartitionSchemeHeader::RANGE: {
-      const std::size_t num_ranges =
-          proto.ExtensionSize(serialization::RangePartitionSchemeHeader::partition_range_boundaries);
-      return num_ranges == proto.num_partitions() - 1;
-    }
-    default:
-      // Partition type is unknown.
-      return false;
-  }
-}
-
-PartitionSchemeHeader* PartitionSchemeHeader::ReconstructFromProto(
-    const serialization::PartitionSchemeHeader &proto, const Type &attr_type) {
-  DCHECK(ProtoIsValid(proto))
-      << "Attempted to create PartitionSchemeHeader from an invalid proto description:\n"
-      << proto.DebugString();
-
-  switch (proto.partition_type()) {
-    case serialization::PartitionSchemeHeader::HASH: {
-      return new HashPartitionSchemeHeader(proto.num_partitions(), proto.partition_attribute_id());
-    }
-    case serialization::PartitionSchemeHeader::RANGE: {
-      std::vector<TypedValue> partition_ranges;
-      for (int i = 0;
-           i < proto.ExtensionSize(serialization::RangePartitionSchemeHeader::partition_range_boundaries);
-           ++i) {
-        partition_ranges.emplace_back(
-            TypedValue::ReconstructFromProto(
-                proto.GetExtension(serialization::RangePartitionSchemeHeader::partition_range_boundaries, i)));
-      }
-
-      return new RangePartitionSchemeHeader(attr_type,
-                                            proto.num_partitions(),
-                                            proto.partition_attribute_id(),
-                                            std::move(partition_ranges));
-    }
-    default:
-      LOG(FATAL) << "Invalid partition scheme header.";
-  }
-}
-
-serialization::PartitionSchemeHeader PartitionSchemeHeader::getProto() const {
-  serialization::PartitionSchemeHeader proto;
-
-  switch (partition_type_) {
-    case PartitionType::kHash:
-      proto.set_partition_type(serialization::PartitionSchemeHeader::HASH);
-      break;
-    case PartitionType::kRange:
-      LOG(FATAL) << "RangePartitionSchemeHeader should call the overridden method.";
-    default:
-      LOG(FATAL) << "Invalid Partition Type.";
-  }
-
-  proto.set_num_partitions(num_partitions_);
-  proto.set_partition_attribute_id(partition_attribute_id_);
-
-  return proto;
-}
-
-serialization::PartitionSchemeHeader RangePartitionSchemeHeader::getProto() const {
-  serialization::PartitionSchemeHeader proto;
-
-  proto.set_partition_type(serialization::PartitionSchemeHeader::RANGE);
-  proto.set_num_partitions(num_partitions_);
-  proto.set_partition_attribute_id(partition_attribute_id_);
-
-  for (std::size_t i = 0; i < partition_range_boundaries_.size(); ++i) {
-    proto.AddExtension(serialization::RangePartitionSchemeHeader::partition_range_boundaries)
-        ->MergeFrom(partition_range_boundaries_[i].getProto());
-  }
-
-  return proto;
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/catalog/PartitionSchemeHeader.hpp
----------------------------------------------------------------------
diff --git a/catalog/PartitionSchemeHeader.hpp b/catalog/PartitionSchemeHeader.hpp
deleted file mode 100644
index 89efc6d..0000000
--- a/catalog/PartitionSchemeHeader.hpp
+++ /dev/null
@@ -1,314 +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_CATALOG_PARTITION_SCHEME_HEADER_HPP_
-#define QUICKSTEP_CATALOG_PARTITION_SCHEME_HEADER_HPP_
-
-#include <cstddef>
-#include <memory>
-#include <utility>
-#include <vector>
-
-#include "catalog/Catalog.pb.h"
-#include "catalog/CatalogTypedefs.hpp"
-#include "types/TypedValue.hpp"
-#include "types/operations/comparisons/Comparison.hpp"
-#include "types/operations/comparisons/LessComparison.hpp"
-#include "utility/Macros.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-class Type;
-
-/** \addtogroup Catalog
- *  @{
- */
-
-/**
- * @brief The base class which stores the partitioning information for a
- *        particular relation.
- **/
-class PartitionSchemeHeader {
- public:
-  enum PartitionType {
-    kHash = 0,
-    kRange
-  };
-
-  /**
-   * @brief Virtual destructor.
-   **/
-  virtual ~PartitionSchemeHeader() {
-  }
-
-  /**
-   * @brief Reconstruct a PartitionSchemeHeader from its serialized
-   *        Protocol Buffer form.
-   *
-   * @param proto The Protocol Buffer serialization of a PartitionSchemeHeader,
-   *        previously produced by getProto().
-   * @param attr_type The attribute type of the partitioning attribute.
-   * @return The reconstructed PartitionSchemeHeader object.
-   **/
-  static PartitionSchemeHeader* ReconstructFromProto(
-      const serialization::PartitionSchemeHeader &proto,
-      const Type &attr_type);
-
-  /**
-   * @brief Check whether a serialization::PartitionSchemeHeader is fully-formed
-   *        and all parts are valid.
-   *
-   * @param proto A serialized Protocol Buffer representation of a
-   *              PartitionSchemeHeader, originally generated by getProto().
-   * @return Whether proto is fully-formed and valid.
-   **/
-  static bool ProtoIsValid(const serialization::PartitionSchemeHeader &proto);
-
-  /**
-   * @brief Calculate the partition id into which the attribute value should
-   *        be inserted.
-   *
-   * @param value_of_attribute The attribute value for which the
-   *                           partition id is to be determined.
-   * @return The partition id of the partition for the attribute value.
-   **/
-  // TODO(gerald): Make this method more efficient since currently this is
-  // done for each and every tuple. We can go through the entire set of tuples
-  // once using a value accessor and create bitmaps for each partition with
-  // tuples that correspond to those partitions.
-  virtual partition_id getPartitionId(
-      const TypedValue &value_of_attribute) const = 0;
-
-  /**
-   * @brief Serialize the Partition Scheme as Protocol Buffer.
-   *
-   * @return The Protocol Buffer representation of Partition Scheme.
-   **/
-  virtual serialization::PartitionSchemeHeader getProto() const;
-
-  /**
-   * @brief Get the partition type of the relation.
-   *
-   * @return The partition type used to partition the relation.
-   **/
-  inline PartitionType getPartitionType() const {
-    return partition_type_;
-  }
-
-  /**
-   * @brief Get the number of partitions for the relation.
-   *
-   * @return The number of partitions the relation is partitioned into.
-   **/
-  inline std::size_t getNumPartitions() const {
-    return num_partitions_;
-  }
-
-  /**
-   * @brief Get the partitioning attribute for the relation.
-   *
-   * @return The partitioning attribute with which the relation
-   *         is partitioned into.
-   **/
-  inline attribute_id getPartitionAttributeId() const {
-    return partition_attribute_id_;
-  }
-
- protected:
-  /**
-   * @brief Constructor.
-   *
-   * @param type The type of partitioning to be used to partition the
-   *             relation.
-   * @param num_partitions The number of partitions to be created.
-   * @param attr_id The attribute on which the partitioning happens.
-   **/
-  PartitionSchemeHeader(const PartitionType type,
-                        const std::size_t num_partitions,
-                        const attribute_id attr_id);
-
-  // The type of partitioning: Hash or Range.
-  const PartitionType partition_type_;
-  // The number of partitions.
-  const std::size_t num_partitions_;
-  // The attribute of partioning.
-  const attribute_id partition_attribute_id_;
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(PartitionSchemeHeader);
-};
-
-/**
- * @brief Implementation of PartitionSchemeHeader that partitions the tuples in
- *        a relation based on a hash function on the partitioning attribute.
-**/
-class HashPartitionSchemeHeader : public PartitionSchemeHeader {
- public:
-  /**
-   * @brief Constructor.
-   *
-   * @param num_partitions The number of partitions to be created.
-   * @param attribute The attribute on which the partitioning happens.
-   **/
-  HashPartitionSchemeHeader(const std::size_t num_partitions, const attribute_id attribute)
-      : PartitionSchemeHeader(PartitionType::kHash, num_partitions, attribute) {
-  }
-
-  /**
-   * @brief Destructor.
-   **/
-  ~HashPartitionSchemeHeader() override {
-  }
-
-  /**
-   * @brief Calulate the partition id into which the attribute value
-   *        should be inserted.
-   *
-   * @param value_of_attribute The attribute value for which the
-   *                           partition id is to be determined.
-   * @return The partition id of the partition for the attribute value.
-   **/
-  partition_id getPartitionId(
-      const TypedValue &value_of_attribute) const override {
-    // TODO(gerald): Optimize for the case where the number of partitions is a
-    // power of 2. We can just mask out the lower-order hash bits rather than
-    // doing a division operation.
-    return value_of_attribute.getHash() % num_partitions_;
-  }
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(HashPartitionSchemeHeader);
-};
-
-/**
- * @brief Implementation of PartitionSchemeHeader that partitions the tuples in
- *        a relation based on a given value range on the partitioning attribute.
-**/
-class RangePartitionSchemeHeader : public PartitionSchemeHeader {
- public:
-  /**
-   * @brief Constructor.
-   *
-   * @param partition_attribute_type The type of CatalogAttribute that is used
-   *                                 for partitioning.
-   * @param num_partitions The number of partitions to be created.
-   * @param attribute The attribute_id on which the partitioning happens.
-   * @param partition_range The mapping between the partition ids and the upper
-   *                        bound of the range boundaries. If two ranges R1 and
-   *                        R2 are separated by a boundary value V, then V
-   *                        would fall into range R2. For creating a range
-   *                        partition scheme with n partitions, you need to
-   *                        specify n-1 boundary values. The first partition
-   *                        will have all the values less than the first
-   *                        boundary and the last partition would have all
-   *                        values greater than or equal to the last boundary
-   *                        value.
-   **/
-  RangePartitionSchemeHeader(const Type &partition_attribute_type,
-                             const std::size_t num_partitions,
-                             const attribute_id attribute,
-                             std::vector<TypedValue> &&partition_range)
-      : PartitionSchemeHeader(PartitionType::kRange, num_partitions, attribute),
-        partition_range_boundaries_(std::move(partition_range)) {
-    DCHECK_EQ(num_partitions - 1, partition_range_boundaries_.size());
-
-    const Comparison &less_comparison_op(LessComparison::Instance());
-    less_unchecked_comparator_.reset(
-        less_comparison_op.makeUncheckedComparatorForTypes(
-            partition_attribute_type, partition_attribute_type));
-
-#ifdef QUICKSTEP_DEBUG
-    checkPartitionRangeBoundaries();
-#endif
-  }
-
-  /**
-   * @brief Destructor.
-   **/
-  ~RangePartitionSchemeHeader() override {
-  }
-
-  /**
-   * @brief Calulate the partition id into which the attribute value
-   *        should be inserted.
-   *
-   * @param value_of_attribute The attribute value for which the
-   *                           partition id is to be determined.
-   * @return The partition id of the partition for the attribute value.
-   **/
-  partition_id getPartitionId(
-      const TypedValue &value_of_attribute) const override {
-    partition_id start = 0, end = partition_range_boundaries_.size() - 1;
-    if (!less_unchecked_comparator_->compareTypedValues(value_of_attribute, partition_range_boundaries_[end])) {
-      return num_partitions_ - 1;
-    }
-
-    while (start < end) {
-      const partition_id mid = start + ((end - start) >> 1);
-      if (less_unchecked_comparator_->compareTypedValues(value_of_attribute, partition_range_boundaries_[mid])) {
-        end = mid;
-      } else {
-        start = mid + 1;
-      }
-    }
-
-    return start;
-  }
-
-  serialization::PartitionSchemeHeader getProto() const override;
-
-  /**
-   * @brief Get the range boundaries for partitions.
-   *
-   * @return The vector of range boundaries for partitions.
-   **/
-  inline const std::vector<TypedValue>& getPartitionRangeBoundaries() const {
-    return partition_range_boundaries_;
-  }
-
- private:
-  /**
-   * @brief Check if the partition range boundaries are in ascending order.
-   **/
-  void checkPartitionRangeBoundaries() {
-    for (partition_id part_id = 1; part_id < partition_range_boundaries_.size(); ++part_id) {
-      if (less_unchecked_comparator_->compareTypedValues(
-              partition_range_boundaries_[part_id],
-              partition_range_boundaries_[part_id - 1])) {
-        LOG(FATAL) << "Partition boundaries are not in ascending order.";
-      }
-    }
-  }
-
-  // The boundaries for each range in the RangePartitionSchemeHeader.
-  // The upper bound of the range is stored here.
-  const std::vector<TypedValue> partition_range_boundaries_;
-
-  std::unique_ptr<UncheckedComparator> less_unchecked_comparator_;
-
-  DISALLOW_COPY_AND_ASSIGN(RangePartitionSchemeHeader);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_CATALOG_PARTITION_SCHEME_HEADER_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/catalog/tests/Catalog_unittest.cpp
----------------------------------------------------------------------
diff --git a/catalog/tests/Catalog_unittest.cpp b/catalog/tests/Catalog_unittest.cpp
deleted file mode 100644
index e430b89..0000000
--- a/catalog/tests/Catalog_unittest.cpp
+++ /dev/null
@@ -1,629 +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 <algorithm>
-#include <cstddef>
-#include <limits>
-#include <memory>
-#include <sstream>
-#include <string>
-#include <vector>
-
-#include "catalog/Catalog.hpp"
-#include "catalog/Catalog.pb.h"
-#include "catalog/CatalogAttribute.hpp"
-#include "catalog/CatalogDatabase.hpp"
-#include "catalog/CatalogDatabaseCache.hpp"
-#include "catalog/CatalogRelation.hpp"
-#include "catalog/CatalogRelationSchema.hpp"
-#include "catalog/CatalogTypedefs.hpp"
-#include "catalog/IndexScheme.hpp"
-#include "storage/StorageBlockInfo.hpp"
-#include "storage/StorageBlockLayout.hpp"
-#include "storage/StorageBlockLayout.pb.h"
-#include "storage/SubBlockTypeRegistryMacros.hpp"
-#include "types/Type.hpp"
-#include "types/TypeFactory.hpp"
-#include "types/TypeID.hpp"
-#include "utility/Macros.hpp"
-#include "utility/PtrVector.hpp"
-
-#include "gtest/gtest.h"
-
-namespace quickstep {
-
-QUICKSTEP_FORCE_SUB_BLOCK_REGISTRATION(BasicColumnStoreTupleStorageSubBlock);
-QUICKSTEP_FORCE_SUB_BLOCK_REGISTRATION(CSBTreeIndexSubBlock);
-QUICKSTEP_FORCE_SUB_BLOCK_REGISTRATION(CompressedColumnStoreTupleStorageSubBlock);
-QUICKSTEP_FORCE_SUB_BLOCK_REGISTRATION(CompressedPackedRowStoreTupleStorageSubBlock);
-QUICKSTEP_FORCE_SUB_BLOCK_REGISTRATION(PackedRowStoreTupleStorageSubBlock);
-QUICKSTEP_FORCE_SUB_BLOCK_REGISTRATION(SMAIndexSubBlock);
-QUICKSTEP_FORCE_SUB_BLOCK_REGISTRATION(SplitRowStoreTupleStorageSubBlock);
-
-class CatalogTest : public ::testing::Test {
- protected:
-  virtual void SetUp() {
-    db_ = cat_.getDatabaseByIdMutable(cat_.addDatabase(new CatalogDatabase(nullptr, "db")));
-  }
-
-  CatalogRelation* createCatalogRelation(const std::string &name, bool temporary = false) {
-    return db_->getRelationByIdMutable(db_->addRelation(new CatalogRelation(nullptr, name, -1, temporary)));
-  }
-
-  static void CompareCatalogAttribute(const CatalogAttribute &expected, const CatalogAttribute &checked) {
-    EXPECT_EQ(expected.getID(), checked.getID());
-    EXPECT_EQ(expected.getName(), checked.getName());
-    EXPECT_TRUE(expected.getType().equals(checked.getType()));
-    EXPECT_EQ(expected.getDisplayName(), checked.getDisplayName());
-  }
-
-  static void CompareTupleStorageSubBlockDescription(
-      const TupleStorageSubBlockDescription &expected,
-      const TupleStorageSubBlockDescription &checked) {
-    EXPECT_EQ(expected.sub_block_type(), checked.sub_block_type());
-
-    switch (expected.sub_block_type()) {
-      case TupleStorageSubBlockDescription::PACKED_ROW_STORE:
-        break;
-      case TupleStorageSubBlockDescription::BASIC_COLUMN_STORE:
-        EXPECT_TRUE(expected.HasExtension(BasicColumnStoreTupleStorageSubBlockDescription::sort_attribute_id));
-        EXPECT_TRUE(checked.HasExtension(BasicColumnStoreTupleStorageSubBlockDescription::sort_attribute_id));
-        EXPECT_EQ(
-            expected.GetExtension(BasicColumnStoreTupleStorageSubBlockDescription::sort_attribute_id),
-            checked.GetExtension(BasicColumnStoreTupleStorageSubBlockDescription::sort_attribute_id));
-        break;
-      case TupleStorageSubBlockDescription::COMPRESSED_PACKED_ROW_STORE:
-        ASSERT_EQ(
-            expected.ExtensionSize(CompressedPackedRowStoreTupleStorageSubBlockDescription::compressed_attribute_id),
-            checked.ExtensionSize(CompressedPackedRowStoreTupleStorageSubBlockDescription::compressed_attribute_id));
-
-        for (int i = 0;
-             i < expected.ExtensionSize(
-                     CompressedPackedRowStoreTupleStorageSubBlockDescription::compressed_attribute_id);
-             ++i) {
-          EXPECT_EQ(
-              expected.GetExtension(
-                  CompressedPackedRowStoreTupleStorageSubBlockDescription::compressed_attribute_id, i),
-              checked.GetExtension(
-                  CompressedPackedRowStoreTupleStorageSubBlockDescription::compressed_attribute_id, i));
-        }
-        break;
-      case TupleStorageSubBlockDescription::COMPRESSED_COLUMN_STORE:
-        EXPECT_TRUE(expected.HasExtension(CompressedColumnStoreTupleStorageSubBlockDescription::sort_attribute_id));
-        EXPECT_TRUE(checked.HasExtension(CompressedColumnStoreTupleStorageSubBlockDescription::sort_attribute_id));
-        EXPECT_EQ(
-            expected.GetExtension(CompressedColumnStoreTupleStorageSubBlockDescription::sort_attribute_id),
-            checked.GetExtension(CompressedColumnStoreTupleStorageSubBlockDescription::sort_attribute_id));
-
-        ASSERT_EQ(
-            expected.ExtensionSize(CompressedColumnStoreTupleStorageSubBlockDescription::compressed_attribute_id),
-            checked.ExtensionSize(CompressedColumnStoreTupleStorageSubBlockDescription::compressed_attribute_id));
-
-        for (int i = 0;
-             i < expected.ExtensionSize(CompressedColumnStoreTupleStorageSubBlockDescription::compressed_attribute_id);
-             ++i) {
-          EXPECT_EQ(
-              expected.GetExtension(CompressedColumnStoreTupleStorageSubBlockDescription::compressed_attribute_id, i),
-              checked.GetExtension(CompressedColumnStoreTupleStorageSubBlockDescription::compressed_attribute_id, i));
-        }
-        break;
-      case TupleStorageSubBlockDescription::SPLIT_ROW_STORE:
-        break;
-      default:
-        FATAL_ERROR("Unknown TupleStorageSubBlockType encountered in CompareTupleStorageSubBlockDescription");
-    }
-  }
-
-  static void CompareIndexSubBlockDescription(
-      const IndexSubBlockDescription &expected,
-      const IndexSubBlockDescription &checked) {
-    EXPECT_EQ(expected.sub_block_type(), checked.sub_block_type());
-
-    ASSERT_EQ(expected.indexed_attribute_ids_size(), checked.indexed_attribute_ids_size());
-    for (int i = 0; i < expected.indexed_attribute_ids_size(); ++i) {
-      EXPECT_EQ(expected.indexed_attribute_ids(i), checked.indexed_attribute_ids(i));
-    }
-  }
-
-  static void CompareStorageBlockLayoutDescription(
-      const StorageBlockLayoutDescription &expected,
-      const StorageBlockLayoutDescription &checked) {
-    EXPECT_EQ(expected.num_slots(), checked.num_slots());
-    CompareTupleStorageSubBlockDescription(expected.tuple_store_description(), checked.tuple_store_description());
-
-    ASSERT_EQ(expected.index_description_size(), checked.index_description_size());
-    for (int i = 0; i < expected.index_description_size(); ++i) {
-      CompareIndexSubBlockDescription(expected.index_description(i), checked.index_description(i));
-    }
-  }
-
-  static void CompareCatalogRelation(const CatalogRelation &expected, const CatalogRelation &checked) {
-    EXPECT_EQ(expected.getID(), checked.getID());
-    EXPECT_EQ(expected.getName(), checked.getName());
-    EXPECT_EQ(expected.isTemporary(), checked.isTemporary());
-
-    CompareStorageBlockLayoutDescription(
-        expected.getDefaultStorageBlockLayout().getDescription(),
-        checked.getDefaultStorageBlockLayout().getDescription());
-
-    EXPECT_EQ(expected.blocks_, checked.blocks_);
-
-    ASSERT_EQ(expected.size(), checked.size());
-    for (CatalogRelation::const_iterator it1 = expected.begin(), it2 = checked.begin();
-         it1 != expected.end();
-         ++it1, ++it2) {
-      CompareCatalogAttribute(*it1, *it2);
-    }
-
-    ASSERT_EQ((expected.index_scheme_ != nullptr), (checked.index_scheme_ != nullptr));
-
-    if (checked.index_scheme_ != nullptr) {
-      ASSERT_EQ(expected.index_scheme_->getNumIndices(), checked.index_scheme_->getNumIndices());
-
-      std::string expected_index_scheme_serialized_proto, checked_index_scheme_serialized_proto;
-      expected.index_scheme_->getProto().SerializeToString(&expected_index_scheme_serialized_proto);
-      checked.index_scheme_->getProto().SerializeToString(&checked_index_scheme_serialized_proto);
-      std::sort(expected_index_scheme_serialized_proto.begin(), expected_index_scheme_serialized_proto.end());
-      std::sort(checked_index_scheme_serialized_proto.begin(), checked_index_scheme_serialized_proto.end());
-      EXPECT_EQ(expected_index_scheme_serialized_proto, checked_index_scheme_serialized_proto);
-    }
-  }
-
-  static void CompareCatalogDatabase(const CatalogDatabase &expected, const CatalogDatabase &checked) {
-    EXPECT_EQ(expected.getID(), checked.getID());
-    EXPECT_EQ(expected.getName(), checked.getName());
-    ASSERT_EQ(expected.size(), checked.size());
-    for (CatalogDatabase::const_iterator it1 = expected.begin(), it2 = checked.begin();
-         it1 != expected.end();
-         ++it1, ++it2) {
-      CompareCatalogRelation(*it1, *it2);
-    }
-  }
-
-  void compareCatalogDatabaseCache(const CatalogDatabaseCache &cache) {
-    ASSERT_EQ(db_->size(), cache.size());
-    for (const CatalogRelationSchema &expected : *db_) {
-      const relation_id rel_id = expected.getID();
-
-      ASSERT_TRUE(cache.hasRelationWithId(rel_id));
-      const CatalogRelationSchema &checked = cache.getRelationSchemaById(rel_id);
-
-      EXPECT_EQ(rel_id, checked.getID());
-      EXPECT_EQ(expected.getName(), checked.getName());
-      EXPECT_EQ(expected.isTemporary(), checked.isTemporary());
-
-      ASSERT_EQ(expected.size(), checked.size());
-      for (auto cit_expected = expected.begin(), cit_checked = checked.begin();
-           cit_expected != expected.end();
-           ++cit_expected, ++cit_checked) {
-        CompareCatalogAttribute(*cit_expected, *cit_checked);
-      }
-      const std::vector<std::size_t>& expected_max_lengths =
-          expected.getMaximumAttributeByteLengths();
-      const std::vector<std::size_t>& checked_max_lengths =
-          checked.getMaximumAttributeByteLengths();
-      ASSERT_EQ(expected_max_lengths.size(), checked_max_lengths.size());
-      for (attribute_id len_index = 0;
-           static_cast<std::size_t>(len_index) < expected_max_lengths.size();
-           ++len_index) {
-        EXPECT_EQ(expected_max_lengths[len_index],
-                  checked_max_lengths[len_index]);
-      }
-    }
-  }
-
-  void checkCatalogSerialization() {
-    Catalog cat_from_proto(cat_.getProto());
-    ASSERT_EQ(cat_.size(), cat_from_proto.size());
-    for (Catalog::const_iterator it = cat_.begin(), it_from_proto = cat_from_proto.begin();
-         it != cat_.end();
-         ++it, ++it_from_proto) {
-      CompareCatalogDatabase(*it, *it_from_proto);
-    }
-  }
-
-  Catalog cat_;
-  // db_ is owned by cat_.
-  CatalogDatabase *db_;
-};
-
-TEST_F(CatalogTest, CatalogAttributeSerializationTest) {
-  CatalogRelation* const rel_numeric = createCatalogRelation("rel_numeric");
-
-  rel_numeric->addBlock(BlockIdUtil::GetBlockId(0 /* domain */, 14));
-  rel_numeric->addBlock(BlockIdUtil::GetBlockId(0 /* domain */, 7));
-
-  rel_numeric->addAttribute(new CatalogAttribute(nullptr, "attr_int", TypeFactory::GetType(kInt), -1 /* id */, "int"));
-  rel_numeric->addAttribute(
-      new CatalogAttribute(nullptr, "attr_long", TypeFactory::GetType(kLong), -1 /* id */, "long"));
-  rel_numeric->addAttribute(
-      new CatalogAttribute(nullptr, "attr_float", TypeFactory::GetType(kFloat), -1 /* id */, "float"));
-  rel_numeric->addAttribute(
-      new CatalogAttribute(nullptr, "attr_double", TypeFactory::GetType(kDouble), -1 /* id */, "double"));
-
-  CatalogRelation* const rel_string = createCatalogRelation("rel_string");
-
-  rel_string->addBlock(BlockIdUtil::GetBlockId(0 /* domain */, 19));
-  rel_string->addBlock(BlockIdUtil::GetBlockId(0 /* domain */, 4));
-
-  StorageBlockLayoutDescription layout_description_string(
-      rel_string->getDefaultStorageBlockLayout().getDescription());
-
-  std::size_t str_type_length = 0;
-  rel_string->addAttribute(
-      new CatalogAttribute(nullptr,
-                           "char_length_0",
-                           TypeFactory::GetType(kChar, str_type_length),
-                           -1 /* id */,
-                           "char_0"));
-  rel_string->addAttribute(
-      new CatalogAttribute(nullptr, "var_char_length_0", TypeFactory::GetType(kVarChar, str_type_length)));
-
-  str_type_length = 8;
-  rel_string->addAttribute(
-      new CatalogAttribute(nullptr, "char_length_8", TypeFactory::GetType(kChar, str_type_length)));
-  rel_string->addAttribute(
-      new CatalogAttribute(nullptr,
-                           "var_char_length_8",
-                           TypeFactory::GetType(kVarChar, str_type_length),
-                           -1 /* id */,
-                           "vchar_8"));
-
-  str_type_length = 1024;
-  rel_string->addAttribute(
-      new CatalogAttribute(nullptr, "char_length_1024", TypeFactory::GetType(kChar, str_type_length)));
-  rel_string->addAttribute(
-      new CatalogAttribute(nullptr, "var_char_length_1024", TypeFactory::GetType(kVarChar, str_type_length)));
-
-  str_type_length = 65536;
-  rel_string->addAttribute(
-      new CatalogAttribute(nullptr, "char_length_65536", TypeFactory::GetType(kChar, str_type_length)));
-  rel_string->addAttribute(
-      new CatalogAttribute(nullptr, "var_char_length_65536", TypeFactory::GetType(kVarChar, str_type_length)));
-
-  // COMPRESSED_PACKED_ROW_STORE supports variable-length attributes.
-  TupleStorageSubBlockDescription* tuple_store_description_string =
-      layout_description_string.mutable_tuple_store_description();
-  tuple_store_description_string->set_sub_block_type(
-      TupleStorageSubBlockDescription::COMPRESSED_PACKED_ROW_STORE);
-  for (int i = 0; i <= rel_string->getMaxAttributeId(); ++i) {
-    tuple_store_description_string->AddExtension(
-        CompressedPackedRowStoreTupleStorageSubBlockDescription::compressed_attribute_id, i);
-  }
-  rel_string->setDefaultStorageBlockLayout(new StorageBlockLayout(*rel_string, layout_description_string));
-
-  checkCatalogSerialization();
-}
-
-TEST_F(CatalogTest, NullableCatalogAttributeSerializationTest) {
-  CatalogRelation* const rel = createCatalogRelation("rel");
-
-  StorageBlockLayoutDescription layout_description(
-      rel->getDefaultStorageBlockLayout().getDescription());
-
-  rel->addAttribute(new CatalogAttribute(nullptr, "attr_int_nullable", TypeFactory::GetType(kInt, true)));
-  rel->addAttribute(new CatalogAttribute(nullptr, "attr_long_nullable", TypeFactory::GetType(kLong, true)));
-  rel->addAttribute(new CatalogAttribute(nullptr, "attr_float_nullable", TypeFactory::GetType(kFloat, true)));
-  rel->addAttribute(new CatalogAttribute(nullptr, "attr_double_nullable", TypeFactory::GetType(kDouble, true)));
-
-  std::size_t str_type_length = 0;
-  rel->addAttribute(
-      new CatalogAttribute(nullptr, "char_length_0_nullable", TypeFactory::GetType(kChar, str_type_length, true)));
-  rel->addAttribute(
-      new CatalogAttribute(nullptr,
-                           "var_char_length_0_nullable",
-                           TypeFactory::GetType(kVarChar, str_type_length, true)));
-
-  str_type_length = 8;
-  rel->addAttribute(
-      new CatalogAttribute(nullptr, "char_length_8_nullable", TypeFactory::GetType(kChar, str_type_length, true)));
-  rel->addAttribute(
-      new CatalogAttribute(nullptr,
-                           "var_char_length_8_nullable",
-                           TypeFactory::GetType(kVarChar, str_type_length, true)));
-
-  str_type_length = 1024;
-  rel->addAttribute(
-      new CatalogAttribute(nullptr, "char_length_1024_nullable", TypeFactory::GetType(kChar, str_type_length, true)));
-  rel->addAttribute(
-      new CatalogAttribute(nullptr,
-                           "var_char_length_1024_nullable",
-                           TypeFactory::GetType(kVarChar, str_type_length, true)));
-
-  str_type_length = 65536;
-  rel->addAttribute(
-      new CatalogAttribute(nullptr, "char_length_65536_nullable", TypeFactory::GetType(kChar, str_type_length, true)));
-  rel->addAttribute(
-      new CatalogAttribute(nullptr,
-                           "var_char_length_65536_nullable",
-                           TypeFactory::GetType(kVarChar, str_type_length, true)));
-
-  TupleStorageSubBlockDescription* tuple_store_description =
-      layout_description.mutable_tuple_store_description();
-  tuple_store_description->set_sub_block_type(
-      TupleStorageSubBlockDescription::COMPRESSED_PACKED_ROW_STORE);
-  for (int i = 0; i <= rel->getMaxAttributeId(); ++i) {
-    tuple_store_description->AddExtension(
-        CompressedPackedRowStoreTupleStorageSubBlockDescription::compressed_attribute_id, i);
-  }
-  rel->setDefaultStorageBlockLayout(new StorageBlockLayout(*rel, layout_description));
-
-  checkCatalogSerialization();
-}
-
-TEST_F(CatalogTest, TemporaryCatalogRelationSerializationTest) {
-  CatalogRelation* const tmp_rel_numeric = createCatalogRelation("tmp_rel_numeric", true);
-
-  tmp_rel_numeric->addBlock(BlockIdUtil::GetBlockId(0 /* domain */, 14));
-  tmp_rel_numeric->addBlock(BlockIdUtil::GetBlockId(0 /* domain */, 7));
-
-  tmp_rel_numeric->addAttribute(new CatalogAttribute(nullptr, "attr_int", TypeFactory::GetType(kInt)));
-  tmp_rel_numeric->addAttribute(new CatalogAttribute(nullptr, "attr_long", TypeFactory::GetType(kLong)));
-  tmp_rel_numeric->addAttribute(new CatalogAttribute(nullptr, "attr_float", TypeFactory::GetType(kFloat)));
-  tmp_rel_numeric->addAttribute(new CatalogAttribute(nullptr, "attr_double", TypeFactory::GetType(kDouble)));
-
-  CatalogRelation* const tmp_rel_string = createCatalogRelation("tmp_rel_string", true);
-
-  tmp_rel_string->addBlock(BlockIdUtil::GetBlockId(0 /* domain */, 19));
-  tmp_rel_string->addBlock(BlockIdUtil::GetBlockId(0 /* domain */, 4));
-
-  StorageBlockLayoutDescription layout_description_string(
-      tmp_rel_string->getDefaultStorageBlockLayout().getDescription());
-
-  std::size_t str_type_length = 0;
-  tmp_rel_string->addAttribute(
-      new CatalogAttribute(nullptr, "char_length_0", TypeFactory::GetType(kChar, str_type_length)));
-  tmp_rel_string->addAttribute(
-      new CatalogAttribute(nullptr, "var_char_length_0", TypeFactory::GetType(kVarChar, str_type_length)));
-
-  str_type_length = 8;
-  tmp_rel_string->addAttribute(
-      new CatalogAttribute(nullptr, "char_length_8", TypeFactory::GetType(kChar, str_type_length)));
-  tmp_rel_string->addAttribute(
-      new CatalogAttribute(nullptr, "var_char_length_8", TypeFactory::GetType(kVarChar, str_type_length)));
-
-  str_type_length = 1024;
-  tmp_rel_string->addAttribute(
-      new CatalogAttribute(nullptr, "char_length_1024", TypeFactory::GetType(kChar, str_type_length)));
-  tmp_rel_string->addAttribute(
-      new CatalogAttribute(nullptr, "var_char_length_1024", TypeFactory::GetType(kVarChar, str_type_length)));
-
-  str_type_length = 65536;
-  tmp_rel_string->addAttribute(
-      new CatalogAttribute(nullptr, "char_length_65536", TypeFactory::GetType(kChar, str_type_length)));
-  tmp_rel_string->addAttribute(
-      new CatalogAttribute(nullptr, "var_char_length_65536", TypeFactory::GetType(kVarChar, str_type_length)));
-
-  // COMPRESSED_PACKED_ROW_STORE supports variable-length attributes.
-  TupleStorageSubBlockDescription* tuple_store_description_string =
-      layout_description_string.mutable_tuple_store_description();
-  tuple_store_description_string->set_sub_block_type(
-      TupleStorageSubBlockDescription::COMPRESSED_PACKED_ROW_STORE);
-  for (int i = 0; i <= tmp_rel_string->getMaxAttributeId(); ++i) {
-    tuple_store_description_string->AddExtension(
-        CompressedPackedRowStoreTupleStorageSubBlockDescription::compressed_attribute_id, i);
-  }
-  tmp_rel_string->setDefaultStorageBlockLayout(new StorageBlockLayout(*tmp_rel_string, layout_description_string));
-
-  checkCatalogSerialization();
-}
-
-TEST_F(CatalogTest, DroppedCatalogRelationSerializationTest) {
-  for (int i = 0; i < 20; ++i) {
-    std::ostringstream oss;
-    oss << "rel" << i;
-    createCatalogRelation(oss.str());
-  }
-
-  db_->dropRelationByName("rel10");
-
-  checkCatalogSerialization();
-}
-
-TEST_F(CatalogTest, CatalogPackedRowStoreSerializationTest) {
-  CatalogRelation* const rel = createCatalogRelation("rel");
-  StorageBlockLayoutDescription layout_description(rel->getDefaultStorageBlockLayout().getDescription());
-
-  rel->addAttribute(new CatalogAttribute(nullptr, "attr_int", TypeFactory::GetType(kInt)));
-  rel->addAttribute(new CatalogAttribute(nullptr, "attr_long", TypeFactory::GetType(kLong)));
-  rel->addAttribute(new CatalogAttribute(nullptr, "attr_float", TypeFactory::GetType(kFloat)));
-  rel->addAttribute(new CatalogAttribute(nullptr, "attr_double", TypeFactory::GetType(kDouble)));
-
-  const std::size_t str_type_length = 20;
-  rel->addAttribute(new CatalogAttribute(nullptr, "attr_char", TypeFactory::GetType(kChar, str_type_length)));
-  // NOTE(zuyu): PackedRowStoreTupleStorageSubBlock does NOT support variable-length attributes.
-
-  layout_description.mutable_tuple_store_description()->set_sub_block_type(
-      TupleStorageSubBlockDescription::PACKED_ROW_STORE);
-
-  rel->setDefaultStorageBlockLayout(new StorageBlockLayout(*rel, layout_description));
-
-  checkCatalogSerialization();
-}
-
-TEST_F(CatalogTest, CatalogBasicColumnStoreSerializationTest) {
-  CatalogRelation* const rel = createCatalogRelation("rel");
-  StorageBlockLayoutDescription layout_description(rel->getDefaultStorageBlockLayout().getDescription());
-
-  rel->addAttribute(new CatalogAttribute(nullptr, "attr_int", TypeFactory::GetType(kInt)));
-  rel->addAttribute(new CatalogAttribute(nullptr, "attr_long", TypeFactory::GetType(kLong)));
-  rel->addAttribute(new CatalogAttribute(nullptr, "attr_float", TypeFactory::GetType(kFloat)));
-  rel->addAttribute(new CatalogAttribute(nullptr, "attr_double", TypeFactory::GetType(kDouble)));
-
-  const std::size_t str_type_length = 120;
-  const attribute_id attr_id =
-      rel->addAttribute(new CatalogAttribute(nullptr, "attr_char", TypeFactory::GetType(kChar, str_type_length)));
-  // NOTE(zuyu): BasicColumnStoreTupleStorageSubBlock does NOT support variable-length attributes.
-
-  TupleStorageSubBlockDescription* tuple_store_description =
-      layout_description.mutable_tuple_store_description();
-  tuple_store_description->set_sub_block_type(TupleStorageSubBlockDescription::BASIC_COLUMN_STORE);
-  tuple_store_description->SetExtension(
-      BasicColumnStoreTupleStorageSubBlockDescription::sort_attribute_id, attr_id);
-
-  rel->setDefaultStorageBlockLayout(new StorageBlockLayout(*rel, layout_description));
-
-  checkCatalogSerialization();
-}
-
-TEST_F(CatalogTest, CatalogCompressedPackedRowStoreSerializationTest) {
-  CatalogRelation* const rel = createCatalogRelation("rel");
-  StorageBlockLayoutDescription layout_description(rel->getDefaultStorageBlockLayout().getDescription());
-
-  rel->addAttribute(new CatalogAttribute(nullptr, "attr_int", TypeFactory::GetType(kInt)));
-  rel->addAttribute(new CatalogAttribute(nullptr, "attr_long", TypeFactory::GetType(kLong)));
-  rel->addAttribute(new CatalogAttribute(nullptr, "attr_float", TypeFactory::GetType(kFloat)));
-  rel->addAttribute(new CatalogAttribute(nullptr, "attr_double", TypeFactory::GetType(kDouble)));
-
-  const std::size_t str_type_length = 1024;
-  rel->addAttribute(new CatalogAttribute(nullptr, "attr_char", TypeFactory::GetType(kChar, str_type_length)));
-  rel->addAttribute(new CatalogAttribute(nullptr, "attr_var_char", TypeFactory::GetType(kVarChar, str_type_length)));
-
-  TupleStorageSubBlockDescription* tuple_store_description =
-      layout_description.mutable_tuple_store_description();
-  tuple_store_description->set_sub_block_type(
-      TupleStorageSubBlockDescription::COMPRESSED_PACKED_ROW_STORE);
-  for (int i = 0; i <= rel->getMaxAttributeId(); ++i) {
-    tuple_store_description->AddExtension(
-        CompressedPackedRowStoreTupleStorageSubBlockDescription::compressed_attribute_id, i);
-  }
-
-  rel->setDefaultStorageBlockLayout(new StorageBlockLayout(*rel, layout_description));
-
-  checkCatalogSerialization();
-}
-
-TEST_F(CatalogTest, CatalogCompressedColumnStoreSerializationTest) {
-  CatalogRelation* const rel = createCatalogRelation("rel");
-  StorageBlockLayoutDescription layout_description(rel->getDefaultStorageBlockLayout().getDescription());
-
-  rel->addAttribute(new CatalogAttribute(nullptr, "attr_int", TypeFactory::GetType(kInt)));
-  rel->addAttribute(new CatalogAttribute(nullptr, "attr_long", TypeFactory::GetType(kLong)));
-  rel->addAttribute(new CatalogAttribute(nullptr, "attr_float", TypeFactory::GetType(kFloat)));
-  rel->addAttribute(new CatalogAttribute(nullptr, "attr_double", TypeFactory::GetType(kDouble)));
-
-  const std::size_t str_type_length = 65536;
-  rel->addAttribute(new CatalogAttribute(nullptr, "attr_char", TypeFactory::GetType(kChar, str_type_length)));
-  const attribute_id attr_id =
-      rel->addAttribute(
-          new CatalogAttribute(nullptr, "attr_var_char", TypeFactory::GetType(kVarChar, str_type_length)));
-
-  TupleStorageSubBlockDescription* tuple_store_description =
-      layout_description.mutable_tuple_store_description();
-  tuple_store_description->set_sub_block_type(
-      TupleStorageSubBlockDescription::COMPRESSED_COLUMN_STORE);
-  tuple_store_description->SetExtension(
-      CompressedColumnStoreTupleStorageSubBlockDescription::sort_attribute_id, attr_id);
-  for (int i = 0; i <= rel->getMaxAttributeId(); ++i) {
-    tuple_store_description->AddExtension(
-        CompressedColumnStoreTupleStorageSubBlockDescription::compressed_attribute_id, i);
-  }
-
-  rel->setDefaultStorageBlockLayout(new StorageBlockLayout(*rel, layout_description));
-
-  checkCatalogSerialization();
-}
-
-TEST_F(CatalogTest, CatalogSplitRowStoreSerializationTest) {
-  CatalogRelation* const rel = createCatalogRelation("rel");
-  StorageBlockLayoutDescription layout_description(rel->getDefaultStorageBlockLayout().getDescription());
-
-  rel->addAttribute(new CatalogAttribute(nullptr, "attr_int", TypeFactory::GetType(kInt)));
-  rel->addAttribute(new CatalogAttribute(nullptr, "attr_long", TypeFactory::GetType(kLong)));
-  rel->addAttribute(new CatalogAttribute(nullptr, "attr_float", TypeFactory::GetType(kFloat)));
-  rel->addAttribute(new CatalogAttribute(nullptr, "attr_double", TypeFactory::GetType(kDouble)));
-
-  const std::size_t str_type_length = std::numeric_limits<std::size_t>::max();
-  rel->addAttribute(new CatalogAttribute(nullptr, "attr_char", TypeFactory::GetType(kChar, str_type_length)));
-  rel->addAttribute(new CatalogAttribute(nullptr, "attr_var_char", TypeFactory::GetType(kVarChar, str_type_length)));
-
-  layout_description.mutable_tuple_store_description()->set_sub_block_type(
-      TupleStorageSubBlockDescription::SPLIT_ROW_STORE);
-
-  rel->setDefaultStorageBlockLayout(new StorageBlockLayout(*rel, layout_description));
-
-  checkCatalogSerialization();
-}
-
-TEST_F(CatalogTest, CatalogIndexTest) {
-  CatalogRelation* const rel = createCatalogRelation("rel");
-  StorageBlockLayoutDescription layout_description(rel->getDefaultStorageBlockLayout().getDescription());
-
-  rel->addAttribute(new CatalogAttribute(nullptr, "attr_idx1", TypeFactory::GetType(kInt)));
-  rel->addAttribute(new CatalogAttribute(nullptr, "attr_idx2", TypeFactory::GetType(kInt)));
-
-  layout_description.mutable_tuple_store_description()->set_sub_block_type(
-      TupleStorageSubBlockDescription::PACKED_ROW_STORE);
-
-  rel->setDefaultStorageBlockLayout(new StorageBlockLayout(*rel, layout_description));
-
-  IndexSubBlockDescription index_description;
-  index_description.set_sub_block_type(IndexSubBlockDescription::CSB_TREE);
-  index_description.add_indexed_attribute_ids(rel->getAttributeByName("attr_idx1")->getID());
-
-  EXPECT_TRUE(rel->addIndex("idx1", std::move(index_description)));
-  EXPECT_TRUE(rel->hasIndexWithName("idx1"));
-  // Adding an index with duplicate name should return false.
-  EXPECT_FALSE(rel->addIndex("idx1", std::move(index_description)));
-  // Adding an index of same type with different name on the same attribute should return false.
-  EXPECT_FALSE(rel->addIndex("idx2", std::move(index_description)));
-
-  index_description.Clear();
-  index_description.set_sub_block_type(IndexSubBlockDescription::CSB_TREE);
-  index_description.add_indexed_attribute_ids(rel->getAttributeByName("attr_idx2")->getID());
-
-  EXPECT_TRUE(rel->addIndex("idx2", std::move(index_description)));
-  EXPECT_TRUE(rel->hasIndexWithName("idx2"));
-
-  checkCatalogSerialization();
-}
-
-TEST_F(CatalogTest, CatalogDatabaseCacheTest) {
-  CatalogRelationSchema* const rel = createCatalogRelation("rel");
-
-  rel->addAttribute(new CatalogAttribute(nullptr, "attr_int", TypeFactory::GetType(kInt), -1 /* id */, "int"));
-  rel->addAttribute(new CatalogAttribute(nullptr, "attr_long", TypeFactory::GetType(kLong)));
-  rel->addAttribute(
-      new CatalogAttribute(nullptr, "attr_float", TypeFactory::GetType(kFloat), -1 /* id */, "float"));
-  rel->addAttribute(new CatalogAttribute(nullptr, "attr_double", TypeFactory::GetType(kDouble)));
-
-  CatalogDatabaseCache cache(db_->getProto());
-  compareCatalogDatabaseCache(cache);
-
-  // Test dropping relations in the cache.
-  cache.dropRelationById(rel->getID());
-  ASSERT_EQ(0u, cache.size());
-
-  // CatalogRelactionSchema changes.
-  const std::size_t str_type_length = 8;
-  rel->addAttribute(
-      new CatalogAttribute(nullptr, "char_length_8", TypeFactory::GetType(kChar, str_type_length)));
-  rel->addAttribute(
-      new CatalogAttribute(nullptr,
-                           "var_char_length_8",
-                           TypeFactory::GetType(kVarChar, str_type_length),
-                           -1 /* id */,
-                           "vchar_8"));
-
-  // Update the cache after the schema changed.
-  cache.update(db_->getProto());
-  compareCatalogDatabaseCache(cache);
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/catalog/tests/NUMAPlacementScheme_unittest.cpp
----------------------------------------------------------------------
diff --git a/catalog/tests/NUMAPlacementScheme_unittest.cpp b/catalog/tests/NUMAPlacementScheme_unittest.cpp
deleted file mode 100644
index 6a3b32f..0000000
--- a/catalog/tests/NUMAPlacementScheme_unittest.cpp
+++ /dev/null
@@ -1,133 +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 <numa.h>
-
-#include <cstddef>
-#include <memory>
-
-#include "catalog/NUMAPlacementScheme.hpp"
-#include "catalog/PartitionSchemeHeader.hpp"
-#include "storage/StorageBlockInfo.hpp"
-
-#include "gtest/gtest.h"
-
-namespace quickstep {
-
-// Test to check if the number of NUMA nodes in the system
-// is the same as the number of NUMA nodes as reported by
-// the NUMAPlacementScheme.
-TEST(NUMAPlacementSchemeTest, CheckNumNUMANodes) {
-  // Number of partitions in the Catalog Relation.
-  std::size_t num_partitions = 4;
-
-  // Create a NUMAPlacementScheme object with the num_partitions.
-  std::unique_ptr<NUMAPlacementScheme> placement_scheme(
-      new NUMAPlacementScheme(num_partitions));
-
-  // Get the number of NUMA nodes in the system.
-  const std::size_t num_numa_nodes = numa_num_configured_nodes();
-
-  // Check if the number of NUMA nodes in NUMAPlacementScheme and that returned
-  // from the system are the same.
-  EXPECT_EQ(num_numa_nodes, placement_scheme->getNumNUMANodes());
-}
-
-// Test to check if the partitions are assigned the available NUMA nodes in a
-// round-robin manner.
-TEST(NUMAPlacementSchemeTest, CheckNUMANodesAssignment) {
-  // Number of partitions in the Catalog Relation.
-  std::size_t num_partitions = 64;
-
-  // Create a NUMAPlacementScheme object with the num_partitions.
-  std::unique_ptr<NUMAPlacementScheme> placement_scheme(
-      new NUMAPlacementScheme(num_partitions));
-
-  // Check that the partitions are assigned to the NUMA nodes in a
-  // round-robbin manner. Partition 0 should be assigned to NUMA node 0,
-  // partition 1 should be assigned to NUMA node 1, and so on. Partition n
-  // should be assigned to NUMA node n modulus number_of_NUMA_nodes.
-  for (std::size_t part_num = 0;
-       part_num < num_partitions;
-       ++part_num) {
-    EXPECT_EQ(static_cast<int>(part_num % placement_scheme->getNumNUMANodes()),
-              placement_scheme->getNUMANodeForPartition(part_num));
-  }
-}
-
-// Test the serialization and deserialization of NUMAPlacementScheme object.
-TEST(NUMAPlacementSchemeTest, NUMAPlacementSchemeSerializationTest) {
-  // Number of blocks in the Catalog Relation.
-  constexpr int kNumBlocks = 10;
-
-  // Number of partitions in the Catalog Relation.
-  std::size_t num_partitions = 64;
-
-  // Create a HashPartitionSchemeHeader object with 64 partitions and attribute
-  //  0 as the partitioning attribute.
-  std::unique_ptr<PartitionSchemeHeader> partition_scheme_header(
-      new HashPartitionSchemeHeader(num_partitions, 0));
-
-  // Create a NUMAPlacementScheme object with the num_partitions.
-  std::unique_ptr<NUMAPlacementScheme> placement_scheme(
-      new NUMAPlacementScheme(num_partitions));
-
-  // Add some entries into block to NUMA node map.
-  for (block_id block = 0; block < kNumBlocks; ++block) {
-    placement_scheme->addBlockToNUMANodeMap(
-        block, block % placement_scheme->getNumNUMANodes());
-  }
-
-  // Check if the BlockToNUMANodeMap has exactly the same entries that we just
-  // inserted..
-  for (block_id block = 0; block < kNumBlocks; ++block) {
-    EXPECT_EQ(static_cast<int>(block % placement_scheme->getNumNUMANodes()),
-              placement_scheme->getNUMANodeForBlock(block));
-  }
-
-  // Create a new placement scheme object from the protobuf version of the
-  // previously created placement scheme object. Note that serialization is done
-  // using getProto() and deserialization is done using
-  // ReconstructFromProto() methods, respectively.
-  std::unique_ptr<NUMAPlacementScheme> placement_scheme_from_proto;
-  placement_scheme_from_proto.reset(
-      NUMAPlacementScheme::ReconstructFromProto(
-          placement_scheme->getProto(), partition_scheme_header->getNumPartitions()));
-
-  // Check if the number of NUMA nodes is the same in both the placement scheme
-  // objects.
-  EXPECT_EQ(placement_scheme->getNumNUMANodes(),
-            placement_scheme_from_proto->getNumNUMANodes());
-
-  // Check if the mapping between the partitions to the NUMA nodes is the same
-  // in both the placement scheme objects.
-  for (std::size_t part_id = 0; part_id < num_partitions; ++part_id) {
-    EXPECT_EQ(placement_scheme->getNUMANodeForPartition(part_id),
-              placement_scheme_from_proto->getNUMANodeForPartition(part_id));
-  }
-
-  // Check if the entries in the block to NUMA node map are the same in both the
-  // placement scheme objects.
-  for (block_id block = 0; block < kNumBlocks; ++block) {
-    EXPECT_EQ(placement_scheme->getNUMANodeForBlock(block),
-              placement_scheme_from_proto->getNUMANodeForBlock(block));
-  }
-}
-
-}  // namespace quickstep


[20/51] [abbrv] [partial] incubator-quickstep git commit: remove c++ files

Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_execution/BlockLocator.cpp
----------------------------------------------------------------------
diff --git a/query_execution/BlockLocator.cpp b/query_execution/BlockLocator.cpp
deleted file mode 100644
index 81684ba..0000000
--- a/query_execution/BlockLocator.cpp
+++ /dev/null
@@ -1,226 +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_execution/BlockLocator.hpp"
-
-#include <cstdlib>
-#include <string>
-#include <utility>
-
-#include "query_execution/QueryExecutionMessages.pb.h"
-#include "query_execution/QueryExecutionTypedefs.hpp"
-#include "query_execution/QueryExecutionUtil.hpp"
-#include "storage/StorageBlockInfo.hpp"
-#include "threading/ThreadUtil.hpp"
-
-#include "glog/logging.h"
-
-#include "tmb/id_typedefs.h"
-#include "tmb/message_bus.h"
-#include "tmb/tagged_message.h"
-
-using std::free;
-using std::malloc;
-using std::move;
-
-using tmb::TaggedMessage;
-using tmb::client_id;
-
-namespace quickstep {
-
-void BlockLocator::run() {
-  if (cpu_id_ >= 0) {
-    ThreadUtil::BindToCPU(cpu_id_);
-  }
-
-  for (;;) {
-    // Receive() is a blocking call, causing this thread to sleep until next
-    // message is received.
-    const tmb::AnnotatedMessage annotated_message = bus_->Receive(locator_client_id_, 0, true);
-    const TaggedMessage &tagged_message = annotated_message.tagged_message;
-    const client_id sender = annotated_message.sender;
-    LOG(INFO) << "BlockLocator received the typed '" << tagged_message.message_type()
-              << "' message from TMB Client " << sender;
-    switch (tagged_message.message_type()) {
-      case kBlockDomainRegistrationMessage: {
-        serialization::BlockDomainRegistrationMessage proto;
-        CHECK(proto.ParseFromArray(tagged_message.message(), tagged_message.message_bytes()));
-
-        processBlockDomainRegistrationMessage(sender, proto.domain_network_address());
-        break;
-      }
-      case kAddBlockLocationMessage: {
-        serialization::BlockLocationMessage proto;
-        CHECK(proto.ParseFromArray(tagged_message.message(), tagged_message.message_bytes()));
-
-        const block_id block = proto.block_id();
-        const block_id_domain domain = proto.block_domain();
-
-        const auto result_block_locations = block_locations_[block].insert(domain);
-        const auto result_domain_blocks = domain_blocks_[domain].insert(block);
-        DCHECK_EQ(result_block_locations.second, result_domain_blocks.second);
-
-        if (result_domain_blocks.second) {
-          LOG(INFO) << "Block " << BlockIdUtil::ToString(block) << " loaded in Domain " << domain;
-        } else {
-          LOG(INFO) << "Block " << BlockIdUtil::ToString(block) << " existed in Domain " << domain;
-        }
-        break;
-      }
-      case kDeleteBlockLocationMessage: {
-        serialization::BlockLocationMessage proto;
-        CHECK(proto.ParseFromArray(tagged_message.message(), tagged_message.message_bytes()));
-
-        const block_id block = proto.block_id();
-        const block_id_domain domain = proto.block_domain();
-
-        const auto cit = block_locations_[block].find(domain);
-        if (cit != block_locations_[block].end()) {
-          block_locations_[block].erase(domain);
-          domain_blocks_[domain].erase(block);
-
-          LOG(INFO) << "Block " << BlockIdUtil::ToString(block) << " evicted in Domain " << domain;
-        } else {
-          LOG(INFO) << "Block " << BlockIdUtil::ToString(block) << " not found in Domain " << domain;
-        }
-        break;
-      }
-      case kLocateBlockMessage: {
-        serialization::BlockMessage proto;
-        CHECK(proto.ParseFromArray(tagged_message.message(), tagged_message.message_bytes()));
-
-        processLocateBlockMessage(sender, proto.block_id());
-        break;
-      }
-      case kGetPeerDomainNetworkAddressesMessage: {
-        serialization::BlockMessage proto;
-        CHECK(proto.ParseFromArray(tagged_message.message(), tagged_message.message_bytes()));
-
-        processGetPeerDomainNetworkAddressesMessage(sender, proto.block_id());
-        break;
-      }
-      case kBlockDomainUnregistrationMessage: {
-        serialization::BlockDomainMessage proto;
-        CHECK(proto.ParseFromArray(tagged_message.message(), tagged_message.message_bytes()));
-
-        const block_id_domain domain = proto.block_domain();
-
-        domain_network_addresses_.erase(domain);
-
-        for (const block_id block : domain_blocks_[domain]) {
-          block_locations_[block].erase(domain);
-        }
-        domain_blocks_.erase(domain);
-
-        LOG(INFO) << "Unregistered Domain " << domain;
-        break;
-      }
-      case kPoisonMessage: {
-        return;
-      }
-    }
-  }
-}
-
-void BlockLocator::processBlockDomainRegistrationMessage(const client_id receiver,
-                                                         const std::string &network_address) {
-  DCHECK_LT(block_domain_, kMaxDomain);
-
-  domain_network_addresses_.emplace(++block_domain_, network_address);
-  domain_blocks_[block_domain_];
-
-  serialization::BlockDomainMessage proto;
-  proto.set_block_domain(block_domain_);
-
-  const int proto_length = proto.ByteSize();
-  char *proto_bytes = static_cast<char*>(malloc(proto_length));
-  CHECK(proto.SerializeToArray(proto_bytes, proto_length));
-
-  TaggedMessage message(static_cast<const void*>(proto_bytes),
-                                 proto_length,
-                                 kBlockDomainRegistrationResponseMessage);
-  free(proto_bytes);
-
-  LOG(INFO) << "BlockLocator (id '" << locator_client_id_
-            << "') sent BlockDomainRegistrationResponseMessage (typed '"
-            << kBlockDomainRegistrationResponseMessage
-            << "') to Worker (id '" << receiver << "')";
-  CHECK(tmb::MessageBus::SendStatus::kOK ==
-      QueryExecutionUtil::SendTMBMessage(bus_,
-                                         locator_client_id_,
-                                         receiver,
-                                         move(message)));
-}
-
-void BlockLocator::processLocateBlockMessage(const client_id receiver,
-                                             const block_id block) {
-  serialization::LocateBlockResponseMessage proto;
-
-  for (const block_id_domain domain : block_locations_[block]) {
-    proto.add_block_domains(domain);
-  }
-
-  const int proto_length = proto.ByteSize();
-  char *proto_bytes = static_cast<char*>(malloc(proto_length));
-  CHECK(proto.SerializeToArray(proto_bytes, proto_length));
-
-  TaggedMessage message(static_cast<const void*>(proto_bytes),
-                                 proto_length,
-                                 kLocateBlockResponseMessage);
-  free(proto_bytes);
-
-  LOG(INFO) << "BlockLocator (id '" << locator_client_id_
-            << "') sent LocateBlockResponseMessage (typed '" << kLocateBlockResponseMessage
-            << "') to StorageManager (id '" << receiver << "')";
-  CHECK(tmb::MessageBus::SendStatus::kOK ==
-      QueryExecutionUtil::SendTMBMessage(bus_,
-                                         locator_client_id_,
-                                         receiver,
-                                         move(message)));
-}
-
-void BlockLocator::processGetPeerDomainNetworkAddressesMessage(const client_id receiver,
-                                                               const block_id block) {
-  serialization::GetPeerDomainNetworkAddressesResponseMessage proto;
-
-  for (const block_id_domain domain : block_locations_[block]) {
-    proto.add_domain_network_addresses(domain_network_addresses_[domain]);
-  }
-
-  const int proto_length = proto.ByteSize();
-  char *proto_bytes = static_cast<char*>(malloc(proto_length));
-  CHECK(proto.SerializeToArray(proto_bytes, proto_length));
-
-  TaggedMessage message(static_cast<const void*>(proto_bytes),
-                                 proto_length,
-                                 kGetPeerDomainNetworkAddressesResponseMessage);
-  free(proto_bytes);
-
-  LOG(INFO) << "BlockLocator (id '" << locator_client_id_
-            << "') sent GetPeerDomainNetworkAddressesResponseMessage (typed '"
-            << kGetPeerDomainNetworkAddressesResponseMessage
-            << "') to StorageManager (id '" << receiver << "')";
-  CHECK(tmb::MessageBus::SendStatus::kOK ==
-      QueryExecutionUtil::SendTMBMessage(bus_,
-                                         locator_client_id_,
-                                         receiver,
-                                         move(message)));
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_execution/BlockLocator.hpp
----------------------------------------------------------------------
diff --git a/query_execution/BlockLocator.hpp b/query_execution/BlockLocator.hpp
deleted file mode 100644
index a83a394..0000000
--- a/query_execution/BlockLocator.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_EXECUTION_BLOCK_LOCATOR_HPP_
-#define QUICKSTEP_QUERY_EXECUTION_BLOCK_LOCATOR_HPP_
-
-#include <atomic>
-#include <string>
-#include <unordered_map>
-#include <unordered_set>
-
-#include "query_execution/QueryExecutionTypedefs.hpp"
-#include "storage/StorageBlockInfo.hpp"
-#include "storage/StorageConstants.hpp"
-#include "threading/Thread.hpp"
-#include "utility/Macros.hpp"
-
-#include "glog/logging.h"
-
-#include "tmb/id_typedefs.h"
-#include "tmb/message_bus.h"
-
-namespace quickstep {
-
-/** \addtogroup QueryExecution
- *  @{
- */
-
-/**
- * @brief A class for keeping trace of blocks loaded in a Worker's buffer pool
- *        in the distributed version.
- **/
-class BlockLocator : public Thread {
- public:
-  /**
-   * @brief Constructor.
-   *
-   * @param bus A pointer to the TMB.
-   * @param cpu_id The ID of the CPU to which the BlockLocator thread can be pinned.
-   *
-   * @note If cpu_id is not specified, BlockLocator thread can be possibly moved
-   *       around on different CPUs by the OS.
-  **/
-  BlockLocator(tmb::MessageBus *bus,
-               const int cpu_id = -1)
-      : bus_(DCHECK_NOTNULL(bus)),
-        cpu_id_(cpu_id),
-        block_domain_(0) {
-    locator_client_id_ = bus_->Connect();
-
-    bus_->RegisterClientAsReceiver(locator_client_id_, kBlockDomainRegistrationMessage);
-    bus_->RegisterClientAsSender(locator_client_id_, kBlockDomainRegistrationResponseMessage);
-
-    bus_->RegisterClientAsReceiver(locator_client_id_, kAddBlockLocationMessage);
-    bus_->RegisterClientAsReceiver(locator_client_id_, kDeleteBlockLocationMessage);
-
-    bus_->RegisterClientAsReceiver(locator_client_id_, kLocateBlockMessage);
-    bus_->RegisterClientAsSender(locator_client_id_, kLocateBlockResponseMessage);
-
-    bus_->RegisterClientAsReceiver(locator_client_id_, kGetPeerDomainNetworkAddressesMessage);
-    bus_->RegisterClientAsSender(locator_client_id_, kGetPeerDomainNetworkAddressesResponseMessage);
-
-    bus_->RegisterClientAsReceiver(locator_client_id_, kBlockDomainUnregistrationMessage);
-    bus_->RegisterClientAsReceiver(locator_client_id_, kPoisonMessage);
-  }
-
-  ~BlockLocator() override {}
-
-  /**
-   * @brief Get the TMB client ID of BlockLocator thread.
-   *
-   * @return TMB client ID of BlockLocator thread.
-   **/
-  tmb::client_id getBusClientID() const {
-    return locator_client_id_;
-  }
-
- protected:
-  void run() override;
-
- private:
-  void processBlockDomainRegistrationMessage(const tmb::client_id receiver, const std::string &network_address);
-  void processLocateBlockMessage(const tmb::client_id receiver, const block_id block);
-  void processGetPeerDomainNetworkAddressesMessage(const tmb::client_id receiver, const block_id block);
-
-  tmb::MessageBus *bus_;
-
-  // The ID of the CPU that the BlockLocator thread can optionally be pinned to.
-  const int cpu_id_;
-
-  alignas(kCacheLineBytes) std::atomic<block_id_domain> block_domain_;
-
-  // From a block domain to its network info in the ip:port format, i.e.,
-  // "0.0.0.0:0".
-  std::unordered_map<block_id_domain, const std::string> domain_network_addresses_;
-
-  // From a block to its domains.
-  std::unordered_map<block_id, std::unordered_set<block_id_domain>> block_locations_;
-
-  // From a block domain to all blocks loaded in its buffer pool.
-  std::unordered_map<block_id_domain, std::unordered_set<block_id>> domain_blocks_;
-
-  tmb::client_id locator_client_id_;
-
-  DISALLOW_COPY_AND_ASSIGN(BlockLocator);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_QUERY_EXECUTION_BLOCK_LOCATOR_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_execution/BlockLocatorUtil.cpp
----------------------------------------------------------------------
diff --git a/query_execution/BlockLocatorUtil.cpp b/query_execution/BlockLocatorUtil.cpp
deleted file mode 100644
index d2d1e96..0000000
--- a/query_execution/BlockLocatorUtil.cpp
+++ /dev/null
@@ -1,93 +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_execution/BlockLocatorUtil.hpp"
-
-#include <cstdlib>
-#include <string>
-#include <utility>
-
-#include "query_execution/QueryExecutionMessages.pb.h"
-#include "query_execution/QueryExecutionTypedefs.hpp"
-#include "storage/StorageBlockInfo.hpp"
-
-#include "glog/logging.h"
-
-#include "tmb/address.h"
-#include "tmb/id_typedefs.h"
-#include "tmb/message_bus.h"
-#include "tmb/message_style.h"
-#include "tmb/tagged_message.h"
-
-using tmb::TaggedMessage;
-using tmb::MessageBus;
-using tmb::client_id;
-
-namespace quickstep {
-namespace block_locator {
-
-namespace S = ::quickstep::serialization;
-
-block_id_domain getBlockDomain(const std::string &network_address,
-                               const client_id cli_id,
-                               client_id *locator_client_id,
-                               MessageBus *bus) {
-  tmb::Address address;
-  address.All(true);
-  // NOTE(zuyu): The singleton BlockLocator would need only one copy of the message.
-  tmb::MessageStyle style;
-
-  S::BlockDomainRegistrationMessage proto;
-  proto.set_domain_network_address(network_address);
-
-  const int proto_length = proto.ByteSize();
-  char *proto_bytes = static_cast<char*>(std::malloc(proto_length));
-  CHECK(proto.SerializeToArray(proto_bytes, proto_length));
-
-  TaggedMessage message(static_cast<const void*>(proto_bytes),
-                        proto_length,
-                        kBlockDomainRegistrationMessage);
-  std::free(proto_bytes);
-
-  DLOG(INFO) << "Client (id '" << cli_id
-             << "') broadcasts BlockDomainRegistrationMessage (typed '" << kBlockDomainRegistrationMessage
-             << "') to BlockLocator.";
-
-  CHECK(MessageBus::SendStatus::kOK ==
-      bus->Send(cli_id, address, style, std::move(message)));
-
-  const tmb::AnnotatedMessage annotated_message(bus->Receive(cli_id, 0, true));
-  const TaggedMessage &tagged_message = annotated_message.tagged_message;
-  CHECK_EQ(kBlockDomainRegistrationResponseMessage, tagged_message.message_type());
-
-  *locator_client_id = annotated_message.sender;
-
-  DLOG(INFO) << "Client (id '" << cli_id
-             << "') received BlockDomainRegistrationResponseMessage (typed '"
-             << kBlockDomainRegistrationResponseMessage
-             << "') from BlockLocator (id '" << *locator_client_id << "').";
-
-  S::BlockDomainMessage response_proto;
-  CHECK(response_proto.ParseFromArray(tagged_message.message(), tagged_message.message_bytes()));
-
-  return static_cast<block_id_domain>(response_proto.block_domain());
-}
-
-}  // namespace block_locator
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_execution/BlockLocatorUtil.hpp
----------------------------------------------------------------------
diff --git a/query_execution/BlockLocatorUtil.hpp b/query_execution/BlockLocatorUtil.hpp
deleted file mode 100644
index 74f65e4..0000000
--- a/query_execution/BlockLocatorUtil.hpp
+++ /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.
- **/
-
-#ifndef QUICKSTEP_QUERY_EXECUTION_BLOCK_LOCATOR_UTIL_HPP_
-#define QUICKSTEP_QUERY_EXECUTION_BLOCK_LOCATOR_UTIL_HPP_
-
-#include <string>
-
-#include "storage/StorageBlockInfo.hpp"
-
-#include "tmb/id_typedefs.h"
-
-namespace tmb { class MessageBus; }
-
-namespace quickstep {
-namespace block_locator {
-
-/** \addtogroup QueryExecution
- *  @{
- */
-
-/**
- * @brief Broadcast to find BlockLocator to get a block domain for
- * StorageManager with the given network address.
- *
- * @param network_address The network address of the StorageManager.
- * @param cli_id The client ID of the block domain requester.
- * @param locator_client_id The client ID of BlockLocator to set.
- * @param bus A pointer to the TMB.
- *
- * @return The requested block domain.
- **/
-block_id_domain getBlockDomain(const std::string &network_address,
-                               const tmb::client_id cli_id,
-                               tmb::client_id *locator_client_id,
-                               tmb::MessageBus *bus);
-
-/** @} */
-
-}  // namespace block_locator
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_QUERY_EXECUTION_BLOCK_LOCATOR_UTIL_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_execution/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/query_execution/CMakeLists.txt b/query_execution/CMakeLists.txt
deleted file mode 100644
index 719d9f3..0000000
--- a/query_execution/CMakeLists.txt
+++ /dev/null
@@ -1,453 +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.
-
-QS_PROTOBUF_GENERATE_CPP(queryexecution_QueryContext_proto_srcs queryexecution_QueryContext_proto_hdrs
-                         QueryContext.proto)
-QS_PROTOBUF_GENERATE_CPP(queryexecution_QueryExecutionMessages_proto_srcs
-                         queryexecution_QueryExecutionMessages_proto_hdrs
-                         QueryExecutionMessages.proto)
-
-if (BUILD_SHARED_LIBS)
-  set(GFLAGS_LIB_NAME gflags_nothreads-shared)
-else()
-  set(GFLAGS_LIB_NAME gflags_nothreads-static)
-endif()
-
-# Declare micro-libs:
-add_library(quickstep_queryexecution_AdmitRequestMessage ../empty_src.cpp AdmitRequestMessage.hpp)
-if (ENABLE_DISTRIBUTED)
-  add_library(quickstep_queryexecution_BlockLocator BlockLocator.cpp BlockLocator.hpp)
-  add_library(quickstep_queryexecution_BlockLocatorUtil BlockLocatorUtil.cpp BlockLocatorUtil.hpp)
-endif(ENABLE_DISTRIBUTED)
-add_library(quickstep_queryexecution_ForemanBase ../empty_src.cpp ForemanBase.hpp)
-if (ENABLE_DISTRIBUTED)
-  add_library(quickstep_queryexecution_ForemanDistributed ForemanDistributed.cpp ForemanDistributed.hpp)
-endif(ENABLE_DISTRIBUTED)
-add_library(quickstep_queryexecution_ForemanSingleNode ForemanSingleNode.cpp ForemanSingleNode.hpp)
-add_library(quickstep_queryexecution_PolicyEnforcerBase PolicyEnforcerBase.cpp PolicyEnforcerBase.hpp)
-if (ENABLE_DISTRIBUTED)
-  add_library(quickstep_queryexecution_PolicyEnforcerDistributed PolicyEnforcerDistributed.cpp PolicyEnforcerDistributed.hpp)
-endif(ENABLE_DISTRIBUTED)
-add_library(quickstep_queryexecution_PolicyEnforcerSingleNode PolicyEnforcerSingleNode.cpp PolicyEnforcerSingleNode.hpp)
-add_library(quickstep_queryexecution_QueryContext QueryContext.cpp QueryContext.hpp)
-add_library(quickstep_queryexecution_QueryContext_proto
-            ${queryexecution_QueryContext_proto_srcs}
-            ${queryexecution_QueryContext_proto_hdrs})
-add_library(quickstep_queryexecution_QueryExecutionMessages_proto
-            ${queryexecution_QueryExecutionMessages_proto_srcs}
-            ${queryexecution_QueryExecutionMessages_proto_hdrs})
-add_library(quickstep_queryexecution_QueryExecutionState ../empty_src.cpp QueryExecutionState.hpp)
-add_library(quickstep_queryexecution_QueryExecutionTypedefs ../empty_src.cpp QueryExecutionTypedefs.hpp)
-add_library(quickstep_queryexecution_QueryExecutionUtil ../empty_src.cpp QueryExecutionUtil.hpp)
-add_library(quickstep_queryexecution_QueryManagerBase QueryManagerBase.cpp QueryManagerBase.hpp)
-if (ENABLE_DISTRIBUTED)
-  add_library(quickstep_queryexecution_QueryManagerDistributed QueryManagerDistributed.cpp QueryManagerDistributed.hpp)
-endif(ENABLE_DISTRIBUTED)
-add_library(quickstep_queryexecution_QueryManagerSingleNode QueryManagerSingleNode.cpp QueryManagerSingleNode.hpp)
-if (ENABLE_DISTRIBUTED)
-  add_library(quickstep_queryexecution_Shiftboss Shiftboss.cpp Shiftboss.hpp)
-  add_library(quickstep_queryexecution_ShiftbossDirectory ../empty_src.cpp ShiftbossDirectory.hpp)
-endif(ENABLE_DISTRIBUTED)
-add_library(quickstep_queryexecution_WorkOrderProtosContainer ../empty_src.cpp WorkOrderProtosContainer.hpp)
-add_library(quickstep_queryexecution_WorkOrdersContainer WorkOrdersContainer.cpp WorkOrdersContainer.hpp)
-add_library(quickstep_queryexecution_Worker Worker.cpp Worker.hpp)
-add_library(quickstep_queryexecution_WorkerDirectory ../empty_src.cpp WorkerDirectory.hpp)
-add_library(quickstep_queryexecution_WorkerMessage ../empty_src.cpp WorkerMessage.hpp)
-add_library(quickstep_queryexecution_WorkerSelectionPolicy ../empty_src.cpp WorkerSelectionPolicy.hpp)
-
-# Link dependencies:
-target_link_libraries(quickstep_queryexecution_AdmitRequestMessage
-                      quickstep_utility_Macros)
-if (ENABLE_DISTRIBUTED)
-  target_link_libraries(quickstep_queryexecution_BlockLocator
-                        glog
-                        quickstep_queryexecution_QueryExecutionMessages_proto
-                        quickstep_queryexecution_QueryExecutionTypedefs
-                        quickstep_queryexecution_QueryExecutionUtil
-                        quickstep_storage_StorageBlockInfo
-                        quickstep_storage_StorageConstants
-                        quickstep_threading_Thread
-                        quickstep_threading_ThreadUtil
-                        quickstep_utility_Macros
-                        tmb)
-  target_link_libraries(quickstep_queryexecution_BlockLocatorUtil
-                        glog
-                        quickstep_queryexecution_QueryExecutionMessages_proto
-                        quickstep_queryexecution_QueryExecutionTypedefs
-                        quickstep_storage_StorageBlockInfo
-                        tmb)
-endif(ENABLE_DISTRIBUTED)
-target_link_libraries(quickstep_queryexecution_ForemanBase
-                      glog
-                      quickstep_queryexecution_PolicyEnforcerBase
-                      quickstep_threading_Thread
-                      quickstep_utility_Macros
-                      tmb)
-if (ENABLE_DISTRIBUTED)
-  target_link_libraries(quickstep_queryexecution_ForemanDistributed
-                        glog
-                        quickstep_catalog_CatalogDatabase
-                        quickstep_catalog_CatalogRelation
-                        quickstep_catalog_CatalogTypedefs
-                        quickstep_catalog_Catalog_proto
-                        quickstep_queryexecution_AdmitRequestMessage
-                        quickstep_queryexecution_ForemanBase
-                        quickstep_queryexecution_PolicyEnforcerBase
-                        quickstep_queryexecution_PolicyEnforcerDistributed
-                        quickstep_queryexecution_QueryExecutionMessages_proto
-                        quickstep_queryexecution_QueryExecutionTypedefs
-                        quickstep_queryexecution_QueryExecutionUtil
-                        quickstep_queryexecution_ShiftbossDirectory
-                        quickstep_threading_ThreadUtil
-                        quickstep_utility_EqualsAnyConstant
-                        quickstep_utility_Macros
-                        tmb
-                        ${GFLAGS_LIB_NAME})
-endif(ENABLE_DISTRIBUTED)
-target_link_libraries(quickstep_queryexecution_ForemanSingleNode
-                      glog
-                      quickstep_queryexecution_AdmitRequestMessage
-                      quickstep_queryexecution_ForemanBase
-                      quickstep_queryexecution_PolicyEnforcerBase
-                      quickstep_queryexecution_PolicyEnforcerSingleNode
-                      quickstep_queryexecution_QueryExecutionTypedefs
-                      quickstep_queryexecution_QueryExecutionUtil
-                      quickstep_queryexecution_WorkerDirectory
-                      quickstep_queryexecution_WorkerMessage
-                      quickstep_threading_ThreadUtil
-                      quickstep_utility_EqualsAnyConstant
-                      quickstep_utility_Macros
-                      tmb
-                      ${GFLAGS_LIB_NAME})
-target_link_libraries(quickstep_queryexecution_PolicyEnforcerBase
-                      glog
-                      quickstep_catalog_CatalogDatabase
-                      quickstep_catalog_CatalogRelation
-                      quickstep_catalog_PartitionScheme
-                      quickstep_queryexecution_QueryExecutionMessages_proto
-                      quickstep_queryexecution_QueryExecutionState
-                      quickstep_queryexecution_QueryExecutionTypedefs
-                      quickstep_queryexecution_QueryManagerBase
-                      quickstep_relationaloperators_WorkOrder
-                      quickstep_storage_StorageBlockInfo
-                      quickstep_utility_Macros
-                      tmb
-                      ${GFLAGS_LIB_NAME})
-if (ENABLE_DISTRIBUTED)
-  target_link_libraries(quickstep_queryexecution_PolicyEnforcerDistributed
-                        glog
-                        quickstep_catalog_CatalogRelation
-                        quickstep_catalog_Catalog_proto
-                        quickstep_queryexecution_PolicyEnforcerBase
-                        quickstep_queryexecution_QueryContext_proto
-                        quickstep_queryexecution_QueryExecutionMessages_proto
-                        quickstep_queryexecution_QueryExecutionState
-                        quickstep_queryexecution_QueryExecutionTypedefs
-                        quickstep_queryexecution_QueryExecutionUtil
-                        quickstep_queryexecution_QueryManagerBase
-                        quickstep_queryexecution_QueryManagerDistributed
-                        quickstep_queryexecution_ShiftbossDirectory
-                        quickstep_queryoptimizer_QueryHandle
-                        quickstep_storage_StorageBlockInfo
-                        quickstep_utility_Macros
-                        tmb
-                        ${GFLAGS_LIB_NAME})
-endif(ENABLE_DISTRIBUTED)
-target_link_libraries(quickstep_queryexecution_PolicyEnforcerSingleNode
-                      glog
-                      quickstep_catalog_CatalogTypedefs
-                      quickstep_queryexecution_PolicyEnforcerBase
-                      quickstep_queryexecution_QueryExecutionMessages_proto
-                      quickstep_queryexecution_QueryExecutionState
-                      quickstep_queryexecution_QueryManagerBase
-                      quickstep_queryexecution_QueryManagerSingleNode
-                      quickstep_queryexecution_WorkerDirectory
-                      quickstep_queryexecution_WorkerMessage
-                      quickstep_queryoptimizer_QueryHandle
-                      quickstep_utility_Macros
-                      tmb
-                      ${GFLAGS_LIB_NAME})
-target_link_libraries(quickstep_queryexecution_QueryContext
-                      glog
-                      quickstep_catalog_CatalogDatabaseLite
-                      quickstep_catalog_CatalogRelationSchema
-                      quickstep_catalog_CatalogTypedefs
-                      quickstep_expressions_ExpressionFactories
-                      quickstep_expressions_predicate_Predicate
-                      quickstep_expressions_scalar_Scalar
-                      quickstep_expressions_tablegenerator_GeneratorFunctionFactory
-                      quickstep_expressions_tablegenerator_GeneratorFunctionHandle
-                      quickstep_expressions_tablegenerator_GeneratorFunction_proto
-                      quickstep_queryexecution_QueryContext_proto
-                      quickstep_storage_AggregationOperationState
-                      quickstep_storage_HashTable
-                      quickstep_storage_HashTableFactory
-                      quickstep_storage_InsertDestination
-                      quickstep_storage_InsertDestination_proto
-                      quickstep_storage_WindowAggregationOperationState
-                      quickstep_types_TypedValue
-                      quickstep_types_containers_Tuple
-                      quickstep_utility_Macros
-                      quickstep_utility_SortConfiguration
-                      quickstep_utility_lipfilter_LIPFilter
-                      quickstep_utility_lipfilter_LIPFilterDeployment
-                      quickstep_utility_lipfilter_LIPFilterFactory)
-target_link_libraries(quickstep_queryexecution_QueryContext_proto
-                      quickstep_expressions_Expressions_proto
-                      quickstep_expressions_tablegenerator_GeneratorFunction_proto
-                      quickstep_storage_AggregationOperationState_proto
-                      quickstep_storage_HashTable_proto
-                      quickstep_storage_InsertDestination_proto
-                      quickstep_storage_WindowAggregationOperationState_proto
-                      quickstep_types_containers_Tuple_proto
-                      quickstep_utility_SortConfiguration_proto
-                      quickstep_utility_lipfilter_LIPFilter_proto
-                      ${PROTOBUF_LIBRARY})
-target_link_libraries(quickstep_queryexecution_QueryExecutionMessages_proto
-                      quickstep_catalog_Catalog_proto
-                      quickstep_queryexecution_QueryContext_proto
-                      quickstep_relationaloperators_WorkOrder_proto
-                      ${PROTOBUF_LIBRARY})
-target_link_libraries(quickstep_queryexecution_QueryExecutionState
-                      glog
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_queryexecution_QueryExecutionTypedefs
-                      quickstep_threading_ThreadIDBasedMap
-                      tmb)
-target_link_libraries(quickstep_queryexecution_QueryExecutionUtil
-                      quickstep_queryexecution_AdmitRequestMessage
-                      quickstep_queryexecution_QueryExecutionTypedefs
-                      quickstep_utility_Macros
-                      tmb)
-target_link_libraries(quickstep_queryexecution_QueryManagerBase
-                      quickstep_catalog_CatalogTypedefs
-                      quickstep_queryexecution_QueryContext
-                      quickstep_queryexecution_QueryExecutionState
-                      quickstep_queryoptimizer_QueryHandle
-                      quickstep_queryoptimizer_QueryPlan
-                      quickstep_relationaloperators_RelationalOperator
-                      quickstep_relationaloperators_WorkOrder
-                      quickstep_storage_StorageBlockInfo
-                      quickstep_utility_DAG
-                      quickstep_utility_Macros)
-if (ENABLE_DISTRIBUTED)
-  target_link_libraries(quickstep_queryexecution_QueryManagerDistributed
-                        quickstep_queryexecution_QueryContext
-                        quickstep_queryexecution_QueryExecutionMessages_proto
-                        quickstep_queryexecution_QueryExecutionState
-                        quickstep_queryexecution_QueryExecutionTypedefs
-                        quickstep_queryexecution_QueryExecutionUtil
-                        quickstep_queryexecution_QueryManagerBase
-                        quickstep_queryexecution_ShiftbossDirectory
-                        quickstep_queryexecution_WorkOrderProtosContainer
-                        quickstep_relationaloperators_RelationalOperator
-                        quickstep_relationaloperators_WorkOrder_proto
-                        quickstep_utility_DAG
-                        quickstep_utility_Macros
-                        tmb)
-endif(ENABLE_DISTRIBUTED)
-target_link_libraries(quickstep_queryexecution_QueryManagerSingleNode
-                      quickstep_catalog_CatalogTypedefs
-                      quickstep_queryexecution_QueryContext
-                      quickstep_queryexecution_QueryExecutionState
-                      quickstep_queryexecution_QueryManagerBase
-                      quickstep_queryexecution_WorkOrdersContainer
-                      quickstep_queryexecution_WorkerMessage
-                      quickstep_queryoptimizer_QueryHandle
-                      quickstep_relationaloperators_RebuildWorkOrder
-                      quickstep_relationaloperators_RelationalOperator
-                      quickstep_storage_InsertDestination
-                      quickstep_storage_StorageBlock
-                      quickstep_utility_DAG
-                      quickstep_utility_Macros
-                      tmb)
-if (ENABLE_DISTRIBUTED)
-  target_link_libraries(quickstep_queryexecution_Shiftboss
-                        glog
-                        quickstep_catalog_CatalogDatabaseCache
-                        quickstep_catalog_CatalogTypedefs
-                        quickstep_queryexecution_QueryContext
-                        quickstep_queryexecution_QueryExecutionMessages_proto
-                        quickstep_queryexecution_QueryExecutionTypedefs
-                        quickstep_queryexecution_QueryExecutionUtil
-                        quickstep_queryexecution_WorkerDirectory
-                        quickstep_queryexecution_WorkerMessage
-                        quickstep_relationaloperators_RebuildWorkOrder
-                        quickstep_relationaloperators_WorkOrderFactory
-                        quickstep_storage_InsertDestination
-                        quickstep_storage_StorageBlock
-                        quickstep_storage_StorageManager
-                        quickstep_threading_Thread
-                        quickstep_threading_ThreadUtil
-                        quickstep_utility_Macros
-                        tmb)
-  target_link_libraries(quickstep_queryexecution_ShiftbossDirectory
-                        quickstep_utility_Macros
-                        tmb)
-endif(ENABLE_DISTRIBUTED)
-target_link_libraries(quickstep_queryexecution_WorkOrderProtosContainer
-                      glog
-                      quickstep_relationaloperators_WorkOrder_proto
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_queryexecution_WorkOrdersContainer
-                      glog
-                      quickstep_relationaloperators_WorkOrder
-                      quickstep_utility_Macros
-                      quickstep_utility_PtrVector)
-target_link_libraries(quickstep_queryexecution_Worker
-                      glog
-                      quickstep_queryexecution_QueryExecutionMessages_proto
-                      quickstep_queryexecution_QueryExecutionTypedefs
-                      quickstep_queryexecution_QueryExecutionUtil
-                      quickstep_queryexecution_WorkerMessage
-                      quickstep_relationaloperators_WorkOrder
-                      quickstep_threading_Thread
-                      quickstep_threading_ThreadIDBasedMap
-                      quickstep_threading_ThreadUtil
-                      quickstep_utility_Macros
-                      tmb)
-target_link_libraries(quickstep_queryexecution_WorkerDirectory
-                      quickstep_queryexecution_QueryExecutionTypedefs
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_queryexecution_WorkerSelectionPolicy
-                      quickstep_queryexecution_WorkerDirectory
-                      quickstep_utility_Macros)
-
-# Module all-in-one library:
-add_library(quickstep_queryexecution ../empty_src.cpp QueryExecutionModule.hpp)
-target_link_libraries(quickstep_queryexecution
-                      quickstep_queryexecution_AdmitRequestMessage
-                      quickstep_queryexecution_ForemanBase
-                      quickstep_queryexecution_ForemanSingleNode
-                      quickstep_queryexecution_PolicyEnforcerBase
-                      quickstep_queryexecution_PolicyEnforcerSingleNode
-                      quickstep_queryexecution_QueryContext
-                      quickstep_queryexecution_QueryContext_proto
-                      quickstep_queryexecution_QueryExecutionMessages_proto
-                      quickstep_queryexecution_QueryExecutionState
-                      quickstep_queryexecution_QueryExecutionTypedefs
-                      quickstep_queryexecution_QueryExecutionUtil
-                      quickstep_queryexecution_QueryManagerBase
-                      quickstep_queryexecution_QueryManagerSingleNode
-                      quickstep_queryexecution_WorkOrderProtosContainer
-                      quickstep_queryexecution_WorkOrdersContainer
-                      quickstep_queryexecution_Worker
-                      quickstep_queryexecution_WorkerDirectory
-                      quickstep_queryexecution_WorkerMessage
-                      quickstep_queryexecution_WorkerSelectionPolicy)
-if (ENABLE_DISTRIBUTED)
-  target_link_libraries(quickstep_queryexecution
-                        quickstep_queryexecution_BlockLocator
-                        quickstep_queryexecution_BlockLocatorUtil
-                        quickstep_queryexecution_ForemanDistributed
-                        quickstep_queryexecution_PolicyEnforcerDistributed
-                        quickstep_queryexecution_QueryManagerDistributed
-                        quickstep_queryexecution_Shiftboss
-                        quickstep_queryexecution_ShiftbossDirectory)
-endif(ENABLE_DISTRIBUTED)
-
-# Tests:
-if (ENABLE_DISTRIBUTED)
-  add_executable(BlockLocator_unittest
-                 "${CMAKE_CURRENT_SOURCE_DIR}/tests/BlockLocator_unittest.cpp")
-  target_link_libraries(BlockLocator_unittest
-                        ${GFLAGS_LIB_NAME}
-                        glog
-                        gtest
-                        quickstep_catalog_CatalogAttribute
-                        quickstep_catalog_CatalogRelation
-                        quickstep_queryexecution_BlockLocator
-                        quickstep_queryexecution_BlockLocatorUtil
-                        quickstep_queryexecution_QueryExecutionMessages_proto
-                        quickstep_queryexecution_QueryExecutionTypedefs
-                        quickstep_queryexecution_QueryExecutionUtil
-                        quickstep_storage_StorageBlob
-                        quickstep_storage_StorageBlock
-                        quickstep_storage_StorageBlockInfo
-                        quickstep_storage_StorageConstants
-                        quickstep_storage_StorageManager
-                        quickstep_types_TypeFactory
-                        quickstep_types_TypeID
-                        tmb
-                        ${LIBS})
-  add_test(BlockLocator_unittest BlockLocator_unittest)
-endif(ENABLE_DISTRIBUTED)
-
-add_executable(QueryManagerSingleNode_unittest
-  "${CMAKE_CURRENT_SOURCE_DIR}/tests/QueryManagerSingleNode_unittest.cpp")
-target_link_libraries(QueryManagerSingleNode_unittest
-                      glog
-                      gtest
-                      gtest_main
-                      quickstep_catalog_CatalogDatabase
-                      quickstep_catalog_CatalogRelation
-                      quickstep_catalog_CatalogTypedefs
-                      quickstep_queryexecution_QueryContext
-                      quickstep_queryexecution_QueryContext_proto
-                      quickstep_queryexecution_QueryExecutionMessages_proto
-                      quickstep_queryexecution_QueryExecutionState
-                      quickstep_queryexecution_QueryExecutionTypedefs
-                      quickstep_queryexecution_QueryManagerSingleNode
-                      quickstep_queryexecution_WorkOrdersContainer
-                      quickstep_queryexecution_WorkerDirectory
-                      quickstep_queryexecution_WorkerMessage
-                      quickstep_queryoptimizer_QueryHandle
-                      quickstep_queryoptimizer_QueryPlan
-                      quickstep_relationaloperators_RelationalOperator
-                      quickstep_relationaloperators_WorkOrder
-                      quickstep_storage_InsertDestination
-                      quickstep_storage_InsertDestination_proto
-                      quickstep_storage_StorageBlock
-                      quickstep_storage_StorageBlockInfo
-                      quickstep_storage_StorageManager
-                      quickstep_utility_DAG
-                      quickstep_utility_Macros
-                      tmb)
-add_test(QueryManagerSingleNode_unittest QueryManagerSingleNode_unittest)
-
-add_executable(WorkOrdersContainer_unittest
-               "${CMAKE_CURRENT_SOURCE_DIR}/tests/WorkOrdersContainer_unittest.cpp")
-target_link_libraries(WorkOrdersContainer_unittest
-                      glog
-                      gtest
-                      gtest_main
-                      quickstep_queryexecution_WorkOrdersContainer
-                      quickstep_relationaloperators_WorkOrder
-                      quickstep_utility_Macros
-                      quickstep_utility_PtrVector)
-add_test(WorkOrdersContainer_unittest WorkOrdersContainer_unittest)
-
-add_executable(WorkerDirectory_unittest
-  "${CMAKE_CURRENT_SOURCE_DIR}/tests/WorkerDirectory_unittest.cpp")
-target_link_libraries(WorkerDirectory_unittest
-                      gtest
-                      gtest_main
-                      quickstep_queryexecution_QueryExecutionTypedefs
-                      quickstep_queryexecution_WorkerDirectory)
-add_test(WorkerDirectory_unittest WorkerDirectory_unittest)
-
-add_executable(WorkerSelectionPolicy_unittest
-  "${CMAKE_CURRENT_SOURCE_DIR}/tests/WorkerSelectionPolicy_unittest.cpp")
-target_link_libraries(WorkerSelectionPolicy_unittest
-                      gtest
-                      gtest_main
-                      quickstep_queryexecution_QueryExecutionTypedefs
-                      quickstep_queryexecution_WorkerDirectory
-                      quickstep_queryexecution_WorkerSelectionPolicy)
-add_test(WorkerSelectionPolicy_unittest WorkerSelectionPolicy_unittest)
-
-file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/block_locator_test_data/)

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_execution/ForemanBase.hpp
----------------------------------------------------------------------
diff --git a/query_execution/ForemanBase.hpp b/query_execution/ForemanBase.hpp
deleted file mode 100644
index ee6c7ce..0000000
--- a/query_execution/ForemanBase.hpp
+++ /dev/null
@@ -1,121 +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_EXECUTION_FOREMAN_BASE_HPP_
-#define QUICKSTEP_QUERY_EXECUTION_FOREMAN_BASE_HPP_
-
-#include <cstdio>
-#include <memory>
-#include <vector>
-
-#include "query_execution/PolicyEnforcerBase.hpp"
-#include "threading/Thread.hpp"
-#include "utility/Macros.hpp"
-
-#include "glog/logging.h"
-
-#include "tmb/id_typedefs.h"
-#include "tmb/message_bus.h"
-
-namespace quickstep {
-
-struct WorkOrderTimeEntry;
-
-/** \addtogroup QueryExecution
- *  @{
- */
-
-/**
- * @brief A base class that Foreman implements. This class is used to derive
- *        for implementations for both the single-node and distributed versions.
- **/
-class ForemanBase : public Thread {
- public:
-  /**
-   * @brief Constructor.
-   *
-   * @param bus A pointer to the TMB.
-   * @param cpu_id The ID of the CPU to which the Foreman thread can be pinned.
-   *
-   * @note If cpu_id is not specified, Foreman thread can be possibly moved
-   *       around on different CPUs by the OS.
-  **/
-  ForemanBase(tmb::MessageBus *bus,
-              const int cpu_id)
-      : bus_(DCHECK_NOTNULL(bus)),
-        cpu_id_(cpu_id) {
-    foreman_client_id_ = bus_->Connect();
-  }
-
-  ~ForemanBase() override {}
-
-  /**
-   * @brief Print the results of profiling individual work orders for a given
-   *        query.
-   *
-   * TODO(harshad) - Add the name of the operator to the output.
-   *
-   * @param query_id The ID of the query for which the results are to be printed.
-   * @param out The file stream.
-   **/
-  virtual void printWorkOrderProfilingResults(const std::size_t query_id,
-                                              std::FILE *out) const = 0;
-
-  /**
-   * @brief Get the results of profiling individual work orders for a given
-   *        query.
-   *
-   * @param query_id The ID of the query for which the results are to be printed.
-   * @return A vector of records, each being a single profiling entry.
-   **/
-  const std::vector<WorkOrderTimeEntry>& getWorkOrderProfilingResults(
-      const std::size_t query_id) const {
-    return policy_enforcer_->getProfilingResults(query_id);
-  }
-
-  /**
-   * @brief Get the TMB client ID of Foreman thread.
-   *
-   * @return TMB client ID of foreman thread.
-   **/
-  tmb::client_id getBusClientID() const {
-    return foreman_client_id_;
-  }
-
- protected:
-  void run() override = 0;
-
-  tmb::MessageBus *bus_;
-
-  tmb::client_id foreman_client_id_;
-
-  // The ID of the CPU that the Foreman thread can optionally be pinned to.
-  const int cpu_id_;
-
-  std::unique_ptr<PolicyEnforcerBase> policy_enforcer_;
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(ForemanBase);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_QUERY_EXECUTION_FOREMAN_BASE_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_execution/ForemanDistributed.cpp
----------------------------------------------------------------------
diff --git a/query_execution/ForemanDistributed.cpp b/query_execution/ForemanDistributed.cpp
deleted file mode 100644
index d619657..0000000
--- a/query_execution/ForemanDistributed.cpp
+++ /dev/null
@@ -1,347 +0,0 @@
-/**
- * Licensed 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_execution/ForemanDistributed.hpp"
-
-#include <cstddef>
-#include <cstdio>
-#include <cstdlib>
-#include <memory>
-#include <unordered_map>
-#include <unordered_set>
-#include <utility>
-#include <vector>
-
-#include "catalog/Catalog.pb.h"
-#include "catalog/CatalogDatabase.hpp"
-#include "catalog/CatalogRelation.hpp"
-#include "catalog/CatalogTypedefs.hpp"
-#include "query_execution/AdmitRequestMessage.hpp"
-#include "query_execution/PolicyEnforcerBase.hpp"
-#include "query_execution/PolicyEnforcerDistributed.hpp"
-#include "query_execution/QueryExecutionMessages.pb.h"
-#include "query_execution/QueryExecutionTypedefs.hpp"
-#include "query_execution/QueryExecutionUtil.hpp"
-#include "query_execution/ShiftbossDirectory.hpp"
-#include "threading/ThreadUtil.hpp"
-#include "utility/EqualsAnyConstant.hpp"
-
-#include "glog/logging.h"
-
-#include "tmb/address.h"
-#include "tmb/id_typedefs.h"
-#include "tmb/message_bus.h"
-#include "tmb/message_style.h"
-#include "tmb/tagged_message.h"
-
-using std::move;
-using std::size_t;
-using std::unique_ptr;
-using std::vector;
-
-using tmb::AnnotatedMessage;
-using tmb::MessageBus;
-using tmb::TaggedMessage;
-using tmb::client_id;
-
-namespace quickstep {
-
-namespace S = serialization;
-
-class QueryHandle;
-
-ForemanDistributed::ForemanDistributed(
-    MessageBus *bus,
-    CatalogDatabaseLite *catalog_database,
-    const int cpu_id)
-    : ForemanBase(bus, cpu_id),
-      catalog_database_(DCHECK_NOTNULL(catalog_database)) {
-  const std::vector<QueryExecutionMessageType> sender_message_types{
-      kShiftbossRegistrationResponseMessage,
-      kQueryInitiateMessage,
-      kWorkOrderMessage,
-      kInitiateRebuildMessage,
-      kQueryTeardownMessage,
-      kSaveQueryResultMessage,
-      kQueryExecutionSuccessMessage,
-      kPoisonMessage};
-
-  for (const auto message_type : sender_message_types) {
-    bus_->RegisterClientAsSender(foreman_client_id_, message_type);
-  }
-
-  const std::vector<QueryExecutionMessageType> receiver_message_types{
-      kShiftbossRegistrationMessage,
-      kAdmitRequestMessage,
-      kQueryInitiateResponseMessage,
-      kCatalogRelationNewBlockMessage,
-      kDataPipelineMessage,
-      kInitiateRebuildResponseMessage,
-      kWorkOrderCompleteMessage,
-      kRebuildWorkOrderCompleteMessage,
-      kWorkOrderFeedbackMessage,
-      kSaveQueryResultResponseMessage,
-      kPoisonMessage};
-
-  for (const auto message_type : receiver_message_types) {
-    bus_->RegisterClientAsReceiver(foreman_client_id_, message_type);
-  }
-
-  policy_enforcer_ = std::make_unique<PolicyEnforcerDistributed>(
-      foreman_client_id_,
-      catalog_database_,
-      &shiftboss_directory_,
-      bus_);
-}
-
-void ForemanDistributed::run() {
-  if (cpu_id_ >= 0) {
-    // We can pin the foreman thread to a CPU if specified.
-    ThreadUtil::BindToCPU(cpu_id_);
-  }
-
-  // Ensure that at least one Shiftboss to register.
-  if (shiftboss_directory_.empty()) {
-    const AnnotatedMessage annotated_message = bus_->Receive(foreman_client_id_, 0, true);
-    const TaggedMessage &tagged_message = annotated_message.tagged_message;
-    DCHECK_EQ(kShiftbossRegistrationMessage, tagged_message.message_type());
-    DLOG(INFO) << "ForemanDistributed received typed '" << tagged_message.message_type()
-               << "' message from client " << annotated_message.sender;
-
-    S::ShiftbossRegistrationMessage proto;
-    CHECK(proto.ParseFromArray(tagged_message.message(), tagged_message.message_bytes()));
-
-    processShiftbossRegistrationMessage(annotated_message.sender, proto.work_order_capacity());
-    DCHECK_EQ(1u, shiftboss_directory_.size());
-  }
-
-  // Event loop
-  for (;;) {
-    // Receive() causes this thread to sleep until next message is received.
-    const AnnotatedMessage annotated_message =
-        bus_->Receive(foreman_client_id_, 0, true);
-    const TaggedMessage &tagged_message = annotated_message.tagged_message;
-    const tmb::message_type_id message_type = tagged_message.message_type();
-    DLOG(INFO) << "ForemanDistributed received typed '" << message_type
-               << "' message from client " << annotated_message.sender;
-    switch (message_type) {
-      case kShiftbossRegistrationMessage: {
-        S::ShiftbossRegistrationMessage proto;
-        CHECK(proto.ParseFromArray(tagged_message.message(), tagged_message.message_bytes()));
-
-        processShiftbossRegistrationMessage(annotated_message.sender, proto.work_order_capacity());
-        break;
-      }
-      case kAdmitRequestMessage: {
-        const AdmitRequestMessage *request_message =
-            static_cast<const AdmitRequestMessage*>(tagged_message.message());
-
-        const vector<QueryHandle *> &query_handles = request_message->getQueryHandles();
-        DCHECK(!query_handles.empty());
-
-        bool all_queries_admitted = true;
-        if (query_handles.size() == 1u) {
-          all_queries_admitted =
-              policy_enforcer_->admitQuery(query_handles.front());
-        } else {
-          all_queries_admitted = policy_enforcer_->admitQueries(query_handles);
-        }
-        if (!all_queries_admitted) {
-          LOG(WARNING) << "The scheduler could not admit all the queries";
-          // TODO(harshad) - Inform the main thread about the failure.
-        }
-        break;
-      }
-      case kQueryInitiateResponseMessage: {
-        S::QueryInitiateResponseMessage proto;
-        CHECK(proto.ParseFromArray(tagged_message.message(), tagged_message.message_bytes()));
-        CHECK(policy_enforcer_->existQuery(proto.query_id()));
-        break;
-      }
-      case kCatalogRelationNewBlockMessage:  // Fall through
-      case kDataPipelineMessage:
-      case kRebuildWorkOrderCompleteMessage:
-      case kWorkOrderCompleteMessage:
-      case kWorkOrderFeedbackMessage: {
-        policy_enforcer_->processMessage(tagged_message);
-        break;
-      }
-      case kInitiateRebuildResponseMessage: {
-        // A unique case in the distributed version.
-        static_cast<PolicyEnforcerDistributed*>(policy_enforcer_.get())->
-            processInitiateRebuildResponseMessage(tagged_message);
-        break;
-      }
-      case kSaveQueryResultResponseMessage: {
-        S::SaveQueryResultResponseMessage proto;
-        CHECK(proto.ParseFromArray(tagged_message.message(), tagged_message.message_bytes()));
-
-        const std::size_t query_id = proto.query_id();
-        query_result_saved_shiftbosses_[query_id].insert(proto.shiftboss_index());
-
-        // TODO(quickstep-team): Dynamically scale-up/down Shiftbosses.
-        if (query_result_saved_shiftbosses_[query_id].size() == shiftboss_directory_.size()) {
-          processSaveQueryResultResponseMessage(proto.cli_id(), proto.relation_id());
-          query_result_saved_shiftbosses_.erase(query_id);
-        }
-        break;
-      }
-      case kPoisonMessage: {
-        if (policy_enforcer_->hasQueries()) {
-          LOG(WARNING) << "ForemanDistributed thread exiting while some queries are "
-                          "under execution or waiting to be admitted";
-        }
-
-        // Shutdown all Shiftbosses.
-        tmb::Address shiftboss_addresses;
-        for (std::size_t i = 0; i < shiftboss_directory_.size(); ++i) {
-          shiftboss_addresses.AddRecipient(shiftboss_directory_.getClientId(i));
-        }
-
-        tmb::MessageStyle broadcast_style;
-        broadcast_style.Broadcast(true);
-
-        TaggedMessage poison_message(kPoisonMessage);
-
-        const MessageBus::SendStatus send_status =
-            bus_->Send(foreman_client_id_,
-                       shiftboss_addresses,
-                       broadcast_style,
-                       move(poison_message));
-        DCHECK(send_status == MessageBus::SendStatus::kOK);
-        return;
-      }
-      default:
-        LOG(FATAL) << "Unknown message type to ForemanDistributed";
-    }
-
-    if (canCollectNewMessages(message_type)) {
-      vector<unique_ptr<S::WorkOrderMessage>> new_messages;
-      static_cast<PolicyEnforcerDistributed*>(policy_enforcer_.get())->
-          getWorkOrderProtoMessages(&new_messages);
-      dispatchWorkOrderMessages(new_messages);
-    }
-  }
-}
-
-bool ForemanDistributed::canCollectNewMessages(const tmb::message_type_id message_type) {
-  return !QUICKSTEP_EQUALS_ANY_CONSTANT(message_type,
-                                        kCatalogRelationNewBlockMessage,
-                                        kWorkOrderFeedbackMessage) &&
-         // TODO(zuyu): Multiple Shiftbosses support.
-         !shiftboss_directory_.hasReachedCapacity(0);
-}
-
-void ForemanDistributed::dispatchWorkOrderMessages(const vector<unique_ptr<S::WorkOrderMessage>> &messages) {
-  for (const auto &message : messages) {
-    DCHECK(message != nullptr);
-    // TODO(zuyu): Multiple Shiftbosses support.
-    sendWorkOrderMessage(0, *message);
-    shiftboss_directory_.incrementNumQueuedWorkOrders(0);
-  }
-}
-
-void ForemanDistributed::sendWorkOrderMessage(const size_t shiftboss_index,
-                                              const S::WorkOrderMessage &proto) {
-  const size_t proto_length = proto.ByteSize();
-  char *proto_bytes = static_cast<char*>(malloc(proto_length));
-  CHECK(proto.SerializeToArray(proto_bytes, proto_length));
-
-  TaggedMessage message(static_cast<const void*>(proto_bytes),
-                        proto_length,
-                        kWorkOrderMessage);
-  free(proto_bytes);
-
-  const client_id shiftboss_client_id = shiftboss_directory_.getClientId(shiftboss_index);
-  DLOG(INFO) << "ForemanDistributed sent WorkOrderMessage (typed '" << kWorkOrderMessage
-             << "') to Shiftboss with TMB client ID " << shiftboss_client_id;
-  const MessageBus::SendStatus send_status =
-      QueryExecutionUtil::SendTMBMessage(bus_,
-                                         foreman_client_id_,
-                                         shiftboss_client_id,
-                                         move(message));
-  CHECK(send_status == MessageBus::SendStatus::kOK);
-}
-
-void ForemanDistributed::printWorkOrderProfilingResults(const std::size_t query_id,
-                                                        std::FILE *out) const {
-  const std::vector<WorkOrderTimeEntry> &recorded_times =
-      policy_enforcer_->getProfilingResults(query_id);
-  fputs("Query ID,Worker ID,Operator ID,Time (microseconds)\n", out);
-  for (const auto &workorder_entry : recorded_times) {
-    const std::size_t worker_id = workorder_entry.worker_id;
-    fprintf(out,
-            "%lu,%lu,%lu,%lu\n",
-            query_id,
-            worker_id,
-            workorder_entry.operator_id,  // Operator ID.
-            workorder_entry.end_time - workorder_entry.start_time);  // Time.
-  }
-}
-
-void ForemanDistributed::processShiftbossRegistrationMessage(const client_id shiftboss_client_id,
-                                                             const std::size_t work_order_capacity) {
-  S::ShiftbossRegistrationResponseMessage proto;
-  proto.set_shiftboss_index(shiftboss_directory_.size());
-
-  const size_t proto_length = proto.ByteSize();
-  char *proto_bytes = static_cast<char*>(malloc(proto_length));
-  CHECK(proto.SerializeToArray(proto_bytes, proto_length));
-
-  TaggedMessage message(static_cast<const void*>(proto_bytes),
-                        proto_length,
-                        kShiftbossRegistrationResponseMessage);
-  free(proto_bytes);
-
-  shiftboss_directory_.addShiftboss(shiftboss_client_id, work_order_capacity);
-
-  DLOG(INFO) << "ForemanDistributed sent ShiftbossRegistrationResponseMessage (typed '"
-             << kShiftbossRegistrationResponseMessage
-             << "') to Shiftboss with TMB client id " << shiftboss_client_id;
-  const MessageBus::SendStatus send_status =
-      QueryExecutionUtil::SendTMBMessage(bus_,
-                                         foreman_client_id_,
-                                         shiftboss_client_id,
-                                         move(message));
-  CHECK(send_status == MessageBus::SendStatus::kOK);
-}
-
-void ForemanDistributed::processSaveQueryResultResponseMessage(const client_id cli_id,
-                                                               const relation_id result_relation_id) {
-  S::QueryExecutionSuccessMessage proto;
-  proto.mutable_result_relation()->MergeFrom(
-      static_cast<CatalogDatabase*>(catalog_database_)->getRelationById(result_relation_id)->getProto());
-
-  const size_t proto_length = proto.ByteSize();
-  char *proto_bytes = static_cast<char*>(malloc(proto_length));
-  CHECK(proto.SerializeToArray(proto_bytes, proto_length));
-
-  TaggedMessage message(static_cast<const void*>(proto_bytes),
-                        proto_length,
-                        kQueryExecutionSuccessMessage);
-  free(proto_bytes);
-
-  // Notify the CLI regarding the query result.
-  DLOG(INFO) << "ForemanDistributed sent QueryExecutionSuccessMessage (typed '"
-             << kQueryExecutionSuccessMessage
-             << "') to CLI with TMB client id " << cli_id;
-  const MessageBus::SendStatus send_status =
-      QueryExecutionUtil::SendTMBMessage(bus_,
-                                         foreman_client_id_,
-                                         cli_id,
-                                         move(message));
-  CHECK(send_status == MessageBus::SendStatus::kOK);
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_execution/ForemanDistributed.hpp
----------------------------------------------------------------------
diff --git a/query_execution/ForemanDistributed.hpp b/query_execution/ForemanDistributed.hpp
deleted file mode 100644
index ccdd0ae..0000000
--- a/query_execution/ForemanDistributed.hpp
+++ /dev/null
@@ -1,120 +0,0 @@
-/**
- * Licensed 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_EXECUTION_FOREMAN_DISTRIBUTED_HPP_
-#define QUICKSTEP_QUERY_EXECUTION_FOREMAN_DISTRIBUTED_HPP_
-
-#include <cstddef>
-#include <cstdio>
-#include <memory>
-#include <unordered_map>
-#include <unordered_set>
-#include <vector>
-
-#include "catalog/CatalogTypedefs.hpp"
-#include "query_execution/ForemanBase.hpp"
-#include "query_execution/ShiftbossDirectory.hpp"
-#include "utility/Macros.hpp"
-
-#include "tmb/id_typedefs.h"
-
-namespace tmb { class MessageBus; }
-
-namespace quickstep {
-
-class CatalogDatabaseLite;
-
-namespace serialization { class WorkOrderMessage; }
-
-/** \addtogroup QueryExecution
- *  @{
- */
-
-/**
- * @brief The Foreman receives queries from the main thread, messages from the
- *        policy enforcer and dispatches the work to Shiftbosses. It also
- *        receives work completion messages from Shiftbosses.
- **/
-class ForemanDistributed final : public ForemanBase {
- public:
-  /**
-   * @brief Constructor.
-   *
-   * @param bus A pointer to the TMB.
-   * @param catalog_database The catalog database where this query is executed.
-   * @param cpu_id The ID of the CPU to which the Foreman thread can be pinned.
-   *
-   * @note If cpu_id is not specified, Foreman thread can be possibly moved
-   *       around on different CPUs by the OS.
-  **/
-  ForemanDistributed(tmb::MessageBus *bus,
-                     CatalogDatabaseLite *catalog_database,
-                     const int cpu_id = -1);
-
-  ~ForemanDistributed() override {}
-
-  void printWorkOrderProfilingResults(const std::size_t query_id,
-                                      std::FILE *out) const override;
-
- protected:
-  void run() override;
-
- private:
-  /**
-   * @brief Dispatch schedulable WorkOrders, wrapped in WorkOrderMessages to the
-   *        worker threads.
-   *
-   * @param messages The messages to be dispatched.
-   **/
-  void dispatchWorkOrderMessages(
-      const std::vector<std::unique_ptr<serialization::WorkOrderMessage>> &messages);
-
-  /**
-   * @brief Send the given message to the specified worker.
-   *
-   * @param worker_index The logical index of the recipient worker in
-   *        ShiftbossDirectory.
-   * @param proto The WorkOrderMessage to be sent.
-   **/
-  void sendWorkOrderMessage(const std::size_t worker_index,
-                            const serialization::WorkOrderMessage &proto);
-
-  void processShiftbossRegistrationMessage(const tmb::client_id shiftboss_client_id,
-                                           const std::size_t work_order_capacity);
-
-  void processSaveQueryResultResponseMessage(const tmb::client_id cli_id,
-                                             const relation_id result_relation_id);
-
-  /**
-   * @brief Check if we can collect new messages from the PolicyEnforcer.
-   *
-   * @param message_type The type of the last received message.
-   **/
-  bool canCollectNewMessages(const tmb::message_type_id message_type);
-
-  ShiftbossDirectory shiftboss_directory_;
-
-  CatalogDatabaseLite *catalog_database_;
-
-  // From a query id to a set of Shiftbosses that save query result.
-  std::unordered_map<std::size_t, std::unordered_set<std::size_t>> query_result_saved_shiftbosses_;
-
-  DISALLOW_COPY_AND_ASSIGN(ForemanDistributed);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_QUERY_EXECUTION_FOREMAN_DISTRIBUTED_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_execution/ForemanSingleNode.cpp
----------------------------------------------------------------------
diff --git a/query_execution/ForemanSingleNode.cpp b/query_execution/ForemanSingleNode.cpp
deleted file mode 100644
index 02799c7..0000000
--- a/query_execution/ForemanSingleNode.cpp
+++ /dev/null
@@ -1,257 +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_execution/ForemanSingleNode.hpp"
-
-#include <cstddef>
-#include <cstdio>
-#include <memory>
-#include <utility>
-#include <vector>
-
-#include "query_execution/AdmitRequestMessage.hpp"
-#include "query_execution/PolicyEnforcerBase.hpp"
-#include "query_execution/PolicyEnforcerSingleNode.hpp"
-#include "query_execution/QueryExecutionTypedefs.hpp"
-#include "query_execution/QueryExecutionUtil.hpp"
-#include "query_execution/WorkerDirectory.hpp"
-#include "query_execution/WorkerMessage.hpp"
-#include "threading/ThreadUtil.hpp"
-#include "utility/EqualsAnyConstant.hpp"
-#include "utility/Macros.hpp"
-
-#include "gflags/gflags.h"
-#include "glog/logging.h"
-
-#include "tmb/id_typedefs.h"
-#include "tmb/message_bus.h"
-#include "tmb/tagged_message.h"
-
-using std::move;
-using std::size_t;
-using std::unique_ptr;
-using std::vector;
-
-namespace quickstep {
-
-class QueryHandle;
-
-DEFINE_uint64(min_load_per_worker, 2, "The minimum load defined as the number "
-              "of pending work orders for the worker. This information is used "
-              "by the Foreman to assign work orders to worker threads");
-
-ForemanSingleNode::ForemanSingleNode(
-    const tmb::client_id main_thread_client_id,
-    WorkerDirectory *worker_directory,
-    tmb::MessageBus *bus,
-    CatalogDatabaseLite *catalog_database,
-    StorageManager *storage_manager,
-    const int cpu_id,
-    const size_t num_numa_nodes)
-    : ForemanBase(bus, cpu_id),
-      main_thread_client_id_(main_thread_client_id),
-      worker_directory_(DCHECK_NOTNULL(worker_directory)),
-      catalog_database_(DCHECK_NOTNULL(catalog_database)),
-      storage_manager_(DCHECK_NOTNULL(storage_manager)) {
-  const std::vector<QueryExecutionMessageType> sender_message_types{
-      kPoisonMessage,
-      kRebuildWorkOrderMessage,
-      kWorkOrderMessage,
-      kWorkloadCompletionMessage};
-
-  for (const auto message_type : sender_message_types) {
-    bus_->RegisterClientAsSender(foreman_client_id_, message_type);
-  }
-
-  const std::vector<QueryExecutionMessageType> receiver_message_types{
-      kAdmitRequestMessage,
-      kCatalogRelationNewBlockMessage,
-      kDataPipelineMessage,
-      kPoisonMessage,
-      kRebuildWorkOrderCompleteMessage,
-      kWorkOrderFeedbackMessage,
-      kWorkOrderCompleteMessage};
-
-  for (const auto message_type : receiver_message_types) {
-    bus_->RegisterClientAsReceiver(foreman_client_id_, message_type);
-  }
-
-  policy_enforcer_ = std::make_unique<PolicyEnforcerSingleNode>(
-      foreman_client_id_,
-      num_numa_nodes,
-      catalog_database_,
-      storage_manager_,
-      worker_directory_,
-      bus_);
-}
-
-void ForemanSingleNode::run() {
-  if (cpu_id_ >= 0) {
-    // We can pin the foreman thread to a CPU if specified.
-    ThreadUtil::BindToCPU(cpu_id_);
-  }
-
-  // Event loop
-  for (;;) {
-    // Receive() causes this thread to sleep until next message is received.
-    const AnnotatedMessage annotated_msg =
-        bus_->Receive(foreman_client_id_, 0, true);
-    const TaggedMessage &tagged_message = annotated_msg.tagged_message;
-    const tmb::message_type_id message_type = tagged_message.message_type();
-    switch (message_type) {
-      case kCatalogRelationNewBlockMessage:  // Fall through
-      case kDataPipelineMessage:
-      case kRebuildWorkOrderCompleteMessage:
-      case kWorkOrderCompleteMessage:
-      case kWorkOrderFeedbackMessage: {
-        policy_enforcer_->processMessage(tagged_message);
-        break;
-      }
-
-      case kAdmitRequestMessage: {
-        const AdmitRequestMessage *msg =
-            static_cast<const AdmitRequestMessage *>(tagged_message.message());
-        const vector<QueryHandle *> &query_handles = msg->getQueryHandles();
-
-        DCHECK(!query_handles.empty());
-        bool all_queries_admitted = true;
-        if (query_handles.size() == 1u) {
-          all_queries_admitted =
-              policy_enforcer_->admitQuery(query_handles.front());
-        } else {
-          all_queries_admitted = policy_enforcer_->admitQueries(query_handles);
-        }
-        if (!all_queries_admitted) {
-          LOG(WARNING) << "The scheduler could not admit all the queries";
-          // TODO(harshad) - Inform the main thread about the failure.
-        }
-        break;
-      }
-      case kPoisonMessage: {
-        if (policy_enforcer_->hasQueries()) {
-          LOG(WARNING) << "Foreman thread exiting while some queries are "
-                          "under execution or waiting to be admitted";
-        }
-        return;
-      }
-      default:
-        LOG(FATAL) << "Unknown message type to Foreman";
-    }
-
-    if (canCollectNewMessages(message_type)) {
-      vector<unique_ptr<WorkerMessage>> new_messages;
-      static_cast<PolicyEnforcerSingleNode*>(policy_enforcer_.get())->
-          getWorkerMessages(&new_messages);
-      dispatchWorkerMessages(new_messages);
-    }
-
-    // We check again, as some queries may produce zero work orders and finish
-    // their execution.
-    if (!policy_enforcer_->hasQueries()) {
-      // Signal the main thread that there are no queries to be executed.
-      // Currently the message doesn't have any real content.
-      TaggedMessage completion_tagged_message(kWorkloadCompletionMessage);
-      DLOG(INFO) << "ForemanSingleNode sent WorkloadCompletionMessage (typed '" << kWorkloadCompletionMessage
-                 << "') to CLI with TMB client ID " << main_thread_client_id_;
-      const tmb::MessageBus::SendStatus send_status =
-          QueryExecutionUtil::SendTMBMessage(
-              bus_,
-              foreman_client_id_,
-              main_thread_client_id_,
-              move(completion_tagged_message));
-      CHECK(send_status == tmb::MessageBus::SendStatus::kOK);
-    }
-  }
-}
-
-bool ForemanSingleNode::canCollectNewMessages(const tmb::message_type_id message_type) {
-  if (QUICKSTEP_EQUALS_ANY_CONSTANT(message_type,
-                                    kCatalogRelationNewBlockMessage,
-                                    kWorkOrderFeedbackMessage)) {
-    return false;
-  } else if (worker_directory_->getLeastLoadedWorker().second <=
-             FLAGS_min_load_per_worker) {
-    // If the least loaded worker has only one pending work order, we should
-    // collect new messages and dispatch them.
-    return true;
-  } else {
-    return false;
-  }
-}
-
-void ForemanSingleNode::dispatchWorkerMessages(const vector<unique_ptr<WorkerMessage>> &messages) {
-  for (const auto &message : messages) {
-    DCHECK(message != nullptr);
-    const int recipient_worker_thread_index = message->getRecipientHint();
-    if (recipient_worker_thread_index != WorkerMessage::kInvalidRecipientIndexHint) {
-      sendWorkerMessage(static_cast<size_t>(recipient_worker_thread_index),
-                        *message);
-      worker_directory_->incrementNumQueuedWorkOrders(recipient_worker_thread_index);
-    } else {
-      const size_t least_loaded_worker_thread_index = worker_directory_->getLeastLoadedWorker().first;
-      sendWorkerMessage(least_loaded_worker_thread_index, *message);
-      worker_directory_->incrementNumQueuedWorkOrders(least_loaded_worker_thread_index);
-    }
-  }
-}
-
-void ForemanSingleNode::sendWorkerMessage(const size_t worker_thread_index,
-                                          const WorkerMessage &message) {
-  tmb::message_type_id type;
-  if (message.getType() == WorkerMessage::WorkerMessageType::kRebuildWorkOrder) {
-    type = kRebuildWorkOrderMessage;
-  } else if (message.getType() == WorkerMessage::WorkerMessageType::kWorkOrder) {
-    type = kWorkOrderMessage;
-  } else {
-    FATAL_ERROR("Invalid WorkerMessageType");
-  }
-  TaggedMessage worker_tagged_message(&message, sizeof(message), type);
-
-  DLOG(INFO) << "ForemanSingleNode sent WorkOrderMessage (typed '" << type
-             << "') to Worker with TMB client ID " << worker_directory_->getClientID(worker_thread_index);
-  const tmb::MessageBus::SendStatus send_status =
-      QueryExecutionUtil::SendTMBMessage(bus_,
-                                         foreman_client_id_,
-                                         worker_directory_->getClientID(worker_thread_index),
-                                         move(worker_tagged_message));
-  CHECK(send_status == tmb::MessageBus::SendStatus::kOK);
-}
-
-void ForemanSingleNode::printWorkOrderProfilingResults(const std::size_t query_id,
-                                                       std::FILE *out) const {
-  // TODO(harshad) - Add the CPU core ID of the operator to the output. This
-  // will require modifying the WorkerDirectory to remember worker affinities.
-  // Until then, the users can refer to the worker_affinities provided to the
-  // cli to infer the CPU core ID where a given worker is pinned.
-  const std::vector<WorkOrderTimeEntry> &recorded_times =
-      policy_enforcer_->getProfilingResults(query_id);
-  fputs("Query ID,Worker ID,NUMA Socket,Operator ID,Time (microseconds)\n", out);
-  for (auto workorder_entry : recorded_times) {
-    const std::size_t worker_id = workorder_entry.worker_id;
-    fprintf(out,
-            "%lu,%lu,%d,%lu,%lu\n",
-            query_id,
-            worker_id,
-            worker_directory_->getNUMANode(worker_id),
-            workorder_entry.operator_id,  // Operator ID.
-            workorder_entry.end_time - workorder_entry.start_time);  // Time.
-  }
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_execution/ForemanSingleNode.hpp
----------------------------------------------------------------------
diff --git a/query_execution/ForemanSingleNode.hpp b/query_execution/ForemanSingleNode.hpp
deleted file mode 100644
index d2db51b..0000000
--- a/query_execution/ForemanSingleNode.hpp
+++ /dev/null
@@ -1,124 +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_EXECUTION_FOREMAN_HPP_
-#define QUICKSTEP_QUERY_EXECUTION_FOREMAN_HPP_
-
-#include <cstddef>
-#include <cstdio>
-#include <memory>
-#include <vector>
-
-#include "query_execution/ForemanBase.hpp"
-#include "utility/Macros.hpp"
-
-#include "tmb/id_typedefs.h"
-
-namespace tmb { class MessageBus; }
-
-namespace quickstep {
-
-class CatalogDatabaseLite;
-class StorageManager;
-class WorkerDirectory;
-class WorkerMessage;
-
-/** \addtogroup QueryExecution
- *  @{
- */
-
-/**
- * @brief The Foreman receives queries from the main thread, messages from the
- *        policy enforcer and dispatches the work to worker threads. It also
- *        receives work completion messages from workers.
- **/
-class ForemanSingleNode final : public ForemanBase {
- public:
-  /**
-   * @brief Constructor.
-   *
-   * @param main_thread_client_id The TMB client ID of the main thread.
-   * @param worker_directory The worker directory.
-   * @param bus A pointer to the TMB.
-   * @param catalog_database The catalog database where this query is executed.
-   * @param storage_manager The StorageManager to use.
-   * @param cpu_id The ID of the CPU to which the Foreman thread can be pinned.
-   * @param num_numa_nodes The number of NUMA nodes in the system.
-   *
-   * @note If cpu_id is not specified, Foreman thread can be possibly moved
-   *       around on different CPUs by the OS.
-  **/
-  ForemanSingleNode(const tmb::client_id main_thread_client_id,
-          WorkerDirectory *worker_directory,
-          tmb::MessageBus *bus,
-          CatalogDatabaseLite *catalog_database,
-          StorageManager *storage_manager,
-          const int cpu_id = -1,
-          const std::size_t num_numa_nodes = 1);
-
-  ~ForemanSingleNode() override {}
-
-  void printWorkOrderProfilingResults(const std::size_t query_id,
-                                      std::FILE *out) const override;
-
- protected:
-  void run() override;
-
- private:
-  /**
-   * @brief Dispatch schedulable WorkOrders, wrapped in WorkerMessages to the
-   *        worker threads.
-   *
-   * @param messages The messages to be dispatched.
-   **/
-  void dispatchWorkerMessages(
-      const std::vector<std::unique_ptr<WorkerMessage>> &messages);
-
-  /**
-   * @brief Send the given message to the specified worker.
-   *
-   * @param worker_thread_index The logical index of the recipient worker thread
-   *        in WorkerDirectory.
-   * @param message The WorkerMessage to be sent.
-   **/
-  void sendWorkerMessage(const std::size_t worker_thread_index,
-                         const WorkerMessage &message);
-
-  /**
-   * @brief Check if we can collect new messages from the PolicyEnforcer.
-   *
-   * @param message_type The type of the last received message.
-   **/
-  bool canCollectNewMessages(const tmb::message_type_id message_type);
-
-  const tmb::client_id main_thread_client_id_;
-
-  WorkerDirectory *worker_directory_;
-
-  CatalogDatabaseLite *catalog_database_;
-  StorageManager *storage_manager_;
-
-  DISALLOW_COPY_AND_ASSIGN(ForemanSingleNode);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_QUERY_EXECUTION_FOREMAN_HPP_


[13/51] [abbrv] [partial] incubator-quickstep git commit: remove c++ files

Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/ExecutionGenerator.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/ExecutionGenerator.hpp b/query_optimizer/ExecutionGenerator.hpp
deleted file mode 100644
index 55197c9..0000000
--- a/query_optimizer/ExecutionGenerator.hpp
+++ /dev/null
@@ -1,442 +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_EXECUTION_GENERATOR_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_EXECUTION_GENERATOR_HPP_
-
-#include <memory>
-#include <string>
-#include <unordered_map>
-
-#ifdef QUICKSTEP_DISTRIBUTED
-#include <unordered_set>
-#endif
-
-#include <vector>
-
-#include "catalog/CatalogTypedefs.hpp"
-#include "query_execution/QueryContext.hpp"
-#include "query_execution/QueryContext.pb.h"
-#include "query_optimizer/LIPFilterGenerator.hpp"
-#include "query_optimizer/QueryHandle.hpp"
-#include "query_optimizer/QueryPlan.hpp"
-#include "query_optimizer/cost_model/CostModel.hpp"
-#include "query_optimizer/expressions/ExprId.hpp"
-#include "query_optimizer/expressions/NamedExpression.hpp"
-#include "query_optimizer/expressions/Predicate.hpp"
-#include "query_optimizer/physical/Aggregate.hpp"
-#include "query_optimizer/physical/CopyFrom.hpp"
-#include "query_optimizer/physical/CreateIndex.hpp"
-#include "query_optimizer/physical/CreateTable.hpp"
-#include "query_optimizer/physical/DeleteTuples.hpp"
-#include "query_optimizer/physical/DropTable.hpp"
-#include "query_optimizer/physical/HashJoin.hpp"
-#include "query_optimizer/physical/InsertSelection.hpp"
-#include "query_optimizer/physical/InsertTuple.hpp"
-#include "query_optimizer/physical/NestedLoopsJoin.hpp"
-#include "query_optimizer/physical/Physical.hpp"
-#include "query_optimizer/physical/Sample.hpp"
-#include "query_optimizer/physical/Selection.hpp"
-#include "query_optimizer/physical/SharedSubplanReference.hpp"
-#include "query_optimizer/physical/Sort.hpp"
-#include "query_optimizer/physical/TableGenerator.hpp"
-#include "query_optimizer/physical/TableReference.hpp"
-#include "query_optimizer/physical/TopLevelPlan.hpp"
-#include "query_optimizer/physical/UpdateTable.hpp"
-#include "query_optimizer/physical/WindowAggregate.hpp"
-#include "utility/Macros.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-class CatalogAttribute;
-class CatalogDatabase;
-class CatalogRelation;
-class Predicate;
-
-namespace serialization {
-
-#ifdef QUICKSTEP_DISTRIBUTED
-class CatalogDatabase;
-#endif
-
-class InsertDestination;
-}  // namespace serialization
-
-namespace optimizer {
-
-/** \addtogroup QueryOptimizer
- *  @{
- */
-
-/**
- * @brief Generates an execution plan from a physical plan.
- */
-class ExecutionGenerator {
- public:
-  /**
-   * @brief Constructor. Does not take ownership of \p query_handle.
-   *
-   * @param catalog_database The catalog database where this query is executed.
-   * @param query_handle The pointer to the output query handle.
-   */
-  ExecutionGenerator(CatalogDatabase *catalog_database,
-                     QueryHandle *query_handle)
-      : catalog_database_(DCHECK_NOTNULL(catalog_database)),
-        query_handle_(DCHECK_NOTNULL(query_handle)),
-        execution_plan_(DCHECK_NOTNULL(query_handle->getQueryPlanMutable())),
-        query_context_proto_(DCHECK_NOTNULL(query_handle->getQueryContextProtoMutable())) {
-    query_context_proto_->set_query_id(query_handle_->query_id());
-#ifdef QUICKSTEP_DISTRIBUTED
-    catalog_database_cache_proto_ = DCHECK_NOTNULL(query_handle->getCatalogDatabaseCacheProtoMutable());
-#endif
-  }
-
-  /**
-   * @brief Destructor.
-   */
-  ~ExecutionGenerator() {}
-
-  /**
-   * @brief Generates an execution plan.
-   *        The physical_plan must be rooted by a TopLevelPlan.
-   *
-   * @param physical_plan The physical plan from which
-   *        the execution plan is created.
-   */
-  void generatePlan(const physical::PhysicalPtr &physical_plan);
-
- private:
-  /**
-   * @brief A CatalogRelation and the index of its producer operator.
-   *        If the relation is a base relation, \p execution_operator_index
-   *        is kInvalidOperatorIndex.
-   */
-  struct CatalogRelationInfo {
-    CatalogRelationInfo(const QueryPlan::DAGNodeIndex producer_operator_index_in,
-                        const CatalogRelation *relation_in)
-        : producer_operator_index(producer_operator_index_in),
-          relation(relation_in) {}
-
-    /**
-     * @return True if the relation is a stored relation (i.e. not a temporary relation
-     *         created by a relational operator).
-     */
-    bool isStoredRelation() const {
-      return producer_operator_index == kInvalidOperatorIndex;
-    }
-
-    const QueryPlan::DAGNodeIndex producer_operator_index;
-    const CatalogRelation *relation;
-
-    /**
-     * @brief Represents an invalid node index.
-     */
-    static constexpr QueryPlan::DAGNodeIndex kInvalidOperatorIndex = static_cast<QueryPlan::DAGNodeIndex>(-1);
-
-    // Copyable.
-  };
-
-  /**
-   * @brief Internal implementation of generating an execution plan
-   *        for a general physical plan.
-   *
-   * @param physical_plan The physical plan from which the execution
-   *                      plan is created.
-   */
-  void generatePlanInternal(const physical::PhysicalPtr &physical_plan);
-
-  /**
-   * @brief Finds the CatalogRelationInfo from <physical_to_output_relation_map_>
-   *        by the physical node \p physical. Returns NULL if not found.
-   *
-   * @param physical The physical node.
-   * @return A mutable pointer to the catalog relation output by the physical node.
-   */
-  const CatalogRelationInfo* findRelationInfoOutputByPhysical(
-      const physical::PhysicalPtr &physical) const {
-    std::unordered_map<physical::PhysicalPtr, CatalogRelationInfo>::const_iterator it =
-        physical_to_output_relation_map_.find(physical);
-    if (it == physical_to_output_relation_map_.end()) {
-      return nullptr;
-    }
-    return &it->second;
-  }
-
-  /**
-   * @brief Creates and returns a temporary relation as the output of
-   *        \p physical in \p catalog_relation_output, and a serialized insert
-   *        destination in \p insert_destination_output.
-   *
-   * @param physical The input physical node.
-   * @param catalog_relation_output The output catalog relation.
-   * @param insert_destination_proto The output insert destination in proto
-   *        form.
-   */
-  void createTemporaryCatalogRelation(
-      const physical::PhysicalPtr &physical,
-      const CatalogRelation **catalog_relation_output,
-      serialization::InsertDestination *insert_destination_proto);
-
-  /**
-   * @brief Returns a new distinct relation name.
-   *
-   * @return A new distinct relation name.
-   */
-  std::string getNewRelationName();
-
-  /**
-   * @brief Sets up the info of the CatalogRelation represented by TableReference.
-   *        TableReference is not converted to any operator.
-   *
-   * @param physical_plan The TableReference node.
-   */
-  void convertTableReference(const physical::TableReferencePtr &physical_plan);
-
-  /**
-   * @brief Converts a Sample(block/tuple) and sample percentage to a Sample operator.
-   *
-   * @param physical_plan The Sample to be converted.
-   */
-  void convertSample(const physical::SamplePtr &physical_plan);
-
-  /**
-   * @brief Attempt to convert a group of scalar projection expressions into a
-   *        simple vector of attribute IDs.
-   *
-   * @param project_expressions_group_index The group index of scalar projection
-   *        expressions in QueryContext proto.
-   * @param attributes A vector of attribute_ids that will be filled in with
-   *        the attributes to project if scalars constitute a pure projection.
-   * @return true if all the scalar expressions in the group were attributes and
-   *         conversion was successful, false otherwise.
-   **/
-  bool convertSimpleProjection(const QueryContext::scalar_group_id project_expressions_group_index,
-                               std::vector<attribute_id> *attributes) const;
-
-  /**
-   * @brief Converts a Selection to a Select operator.
-   *
-   * @param physical_plan The Selection to be converted.
-   */
-  void convertSelection(const physical::SelectionPtr &physical_plan);
-
-  /**
-   * @brief Adds a map entry in <physical_to_execution_map_> from the
-   *        SharedSubplanReference to the execution info of the
-   *        referenced subplan.
-   *
-   * @param physical_plan The SharedSubplanReference to be converted.
-   */
-  void convertSharedSubplanReference(const physical::SharedSubplanReferencePtr &physical_plan);
-
-  /**
-   * @brief Converts a HashJoin to BuildHash, HashJoin and
-   *        DestroyHash operators.
-   *
-   * @param physical_plan The HashJoin to be converted.
-   */
-  void convertHashJoin(const physical::HashJoinPtr &physical_plan);
-
-  /**
-   * @brief Converts a NestedLoopsJoin to a NestedLoopsJoin operator.
-   *
-   * @param physical_plan The NestedLoopsJoin to be converted.
-   */
-  void convertNestedLoopsJoin(const physical::NestedLoopsJoinPtr &physical_plan);
-
-  /**
-   * @brief Converts a CopyFrom to a TextScan and a SaveBlocks.
-   *
-   * @param physical_plan The CopyFrom to be converted.
-   */
-  void convertCopyFrom(const physical::CopyFromPtr &physical_plan);
-
-  /**
-   * @brief Converts a CreateIndex to a CreateIndex operator.
-   *
-   * @param physical_plan The CreateIndex to be converted.
-   */
-  void convertCreateIndex(const physical::CreateIndexPtr &physical_plan);
-
-  /**
-   * @brief Converts a CreateTable to a CreateTable operator.
-   *
-   * @param physical_plan The CreateTable to be converted.
-   */
-  void convertCreateTable(const physical::CreateTablePtr &physical_plan);
-
-  /**
-   * @brief If there is a selection predicate in the DeleteTuples
-   *        and the predicate value is not statically true,
-   *        DeleteTuples is converted to a Delete and a SaveBlocks;
-   *        if there is not a selection predicate or the predicate value
-   *        not statically true, it is converted to a DropTableOperator;
-   *        otherwise, no operator is created.
-   *
-   * @param physical_plan The DeleteTuples to be converted.
-   */
-  void convertDeleteTuples(const physical::DeleteTuplesPtr &physical_plan);
-
-  /**
-   * @brief Converts a DropTable to a DropTable operator.
-   *
-   * @param physical_plan The DropTable to be converted.
-   */
-  void convertDropTable(const physical::DropTablePtr &physical_plan);
-
-  /**
-   * @brief Converts an InsertSelection to a Select and a SaveBlocks.
-   *
-   * @param physical_plan The InsertSelection to be converted.
-   */
-  void convertInsertSelection(const physical::InsertSelectionPtr &physical_plan);
-
-  /**
-   * @brief Converts an InsertTuple to an Insert and a SaveBlocks.
-   *
-   * @param physical_plan The InsertTuple to be converted.
-   */
-  void convertInsertTuple(const physical::InsertTuplePtr &physical_plan);
-
-  /**
-   * @brief Converts an UpdateTable to an Update and a SaveBlocks.
-   *
-   * @param physical_plan The UpdateTable to be converted.
-   */
-  void convertUpdateTable(const physical::UpdateTablePtr &physical_plan);
-
-  /**
-   * @brief Converts a physical Aggregate to an Aggregation operator
-   *
-   * @param physical_plan The Aggregate to be converted.
-   */
-  void convertAggregate(const physical::AggregatePtr &physical_plan);
-
-  /**
-   * @brief Converts a physical Sort to SortRunGeneration and SortMergeRun.
-   *
-   * @param physical_plan The Sort to be converted.
-   */
-  void convertSort(const physical::SortPtr &physical_plan);
-
-  /**
-   * @brief Converts a physical TableGenerator to a TableGeneratorOperator.
-   *
-   * @param physical_plan The TableGenerator to be converted.
-   */
-  void convertTableGenerator(const physical::TableGeneratorPtr &physical_plan);
-
-  /**
-   * @brief Converts a physical WindowAggregate to a WindowAggregation operator.
-   *
-   * @param physical_plan The WindowAggregate to be converted.
-   */
-  void convertWindowAggregate(const physical::WindowAggregatePtr &physical_plan);
-
-  /**
-   * @brief Converts a list of NamedExpressions in the optimizer expression
-   *        system to scalars proto in QueryContext proto.
-   *
-   * @param named_expressions The list of NamedExpressions to be converted.
-   * @param scalar_group_proto The corresponding scalars proto in QueryContext
-   *        proto.
-   */
-  void convertNamedExpressions(
-      const std::vector<expressions::NamedExpressionPtr> &named_expressions,
-      serialization::QueryContext::ScalarGroup *scalar_group_proto);
-
-  /**
-   * @brief Converts a Predicate in the optimizer expression system to a
-   *        Predicate in the execution expression system. The caller should
-   *        takes ownership of the returned pointer.
-   *
-   * @param optimizer_predicate The Predicate to be converted.
-   * @return The corresponding Predicate in the execution expression system.
-   */
-  Predicate* convertPredicate(const expressions::PredicatePtr &optimizer_predicate) const;
-
-  /**
-   * @brief Drops all temporary relations created by the generator
-   *        from the database. Called to avoid side effects
-   *        when some exception or error occurs.
-   */
-  void dropAllTemporaryRelations();
-
-  CatalogDatabase *catalog_database_;
-
-  QueryHandle *query_handle_;
-  QueryPlan *execution_plan_;  // A part of QueryHandle.
-  serialization::QueryContext *query_context_proto_;  // A part of QueryHandle.
-
-#ifdef QUICKSTEP_DISTRIBUTED
-  serialization::CatalogDatabase *catalog_database_cache_proto_;  // A part of QueryHandle.
-
-  // Used to bookkeep relation ids for 'catalog_database_cache_proto_'.
-  std::unordered_set<relation_id> referenced_relation_ids_;
-#endif
-
-  /**
-   * @brief Used to generate distinct relation names for temporary relations.
-   */
-  relation_id rel_id_ = 0;
-
-  /**
-   * @brief For each entry <expr_id, catalog_attribute>,
-   *        the NamedExpression with the expr_id is to be replaced with
-   *        the catalog_attribute when an expression in the optimizer
-   *        system is converted to one in the execution system.
-   */
-  std::unordered_map<expressions::ExprId, const CatalogAttribute *> attribute_substitution_map_;
-
-  /**
-   * @brief Map from a physical node to its output relation info.
-   */
-  std::unordered_map<physical::PhysicalPtr, CatalogRelationInfo> physical_to_output_relation_map_;
-
-  /**
-   * @brief All temporary relations created during query processing.
-   */
-  std::vector<CatalogRelationInfo> temporary_relation_info_vec_;
-
-  /**
-   * @brief The cost model to use for estimating aggregation hash table size.
-   */
-  std::unique_ptr<cost::CostModel> cost_model_for_aggregation_;
-
-  /**
-   * @brief The cost model to use for estimating join hash table size.
-   */
-  std::unique_ptr<cost::CostModel> cost_model_for_hash_join_;
-
-  physical::TopLevelPlanPtr top_level_physical_plan_;
-
-  // Sub-generator for deploying LIP (lookahead information passing) filters.
-  std::unique_ptr<LIPFilterGenerator> lip_filter_generator_;
-
-  DISALLOW_COPY_AND_ASSIGN(ExecutionGenerator);
-};
-
-/** @} */
-
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_QUERY_OPTIMIZER_EXECUTION_GENERATOR_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/LIPFilterGenerator.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/LIPFilterGenerator.cpp b/query_optimizer/LIPFilterGenerator.cpp
deleted file mode 100644
index 404037e..0000000
--- a/query_optimizer/LIPFilterGenerator.cpp
+++ /dev/null
@@ -1,194 +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/LIPFilterGenerator.hpp"
-
-#include <map>
-#include <utility>
-#include <vector>
-
-#include "catalog/CatalogAttribute.hpp"
-#include "query_execution/QueryContext.pb.h"
-#include "relational_operators/RelationalOperator.hpp"
-#include "types/Type.hpp"
-#include "utility/lip_filter/LIPFilter.hpp"
-#include "utility/lip_filter/LIPFilter.pb.h"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-namespace optimizer {
-
-namespace E = ::quickstep::optimizer::expressions;
-namespace P = ::quickstep::optimizer::physical;
-
-void LIPFilterGenerator::registerAttributeMap(
-    const P::PhysicalPtr &node,
-    const std::unordered_map<E::ExprId, const CatalogAttribute *> &attribute_substitution_map) {
-  // Check if a builder is attached to node.
-  const auto &build_info_map = lip_filter_configuration_->getBuildInfoMap();
-  const auto build_it = build_info_map.find(node);
-  if (build_it != build_info_map.end()) {
-    auto &map_entry = attribute_map_[node];
-    for (const auto &info : build_it->second) {
-      E::ExprId attr_id = info.build_attribute->id();
-      map_entry.emplace(attr_id, attribute_substitution_map.at(attr_id));
-    }
-  }
-  // Check if a prober is attached to node.
-  const auto &probe_info_map = lip_filter_configuration_->getProbeInfoMap();
-  const auto probe_it = probe_info_map.find(node);
-  if (probe_it != probe_info_map.end()) {
-    auto &map_entry = attribute_map_[node];
-    for (const auto &info : probe_it->second) {
-      E::ExprId attr_id = info.probe_attribute->id();
-      map_entry.emplace(attr_id, attribute_substitution_map.at(attr_id));
-    }
-  }
-}
-
-void LIPFilterGenerator::deployLIPFilters(QueryPlan *execution_plan,
-                                          serialization::QueryContext *query_context_proto) const {
-  LIPFilterBuilderMap lip_filter_builder_map;
-
-  // Deploy builders
-  const auto &build_info_map = lip_filter_configuration_->getBuildInfoMap();
-  for (const auto &info : builder_infos_) {
-    const auto build_it = build_info_map.find(info.builder_node);
-    if (build_it != build_info_map.end()) {
-      deployBuilderInternal(execution_plan,
-                            query_context_proto,
-                            info.builder_node,
-                            info.builder_operator_index,
-                            build_it->second,
-                            &lip_filter_builder_map);
-    }
-  }
-
-  // Deploy probers
-  const auto &probe_info_map = lip_filter_configuration_->getProbeInfoMap();
-  for (const auto &info : prober_infos_) {
-    const auto probe_it = probe_info_map.find(info.prober_node);
-    if (probe_it != probe_info_map.end()) {
-      deployProberInteral(execution_plan,
-                          query_context_proto,
-                          info.prober_node,
-                          info.prober_operator_index,
-                          probe_it->second,
-                          lip_filter_builder_map);
-    }
-  }
-}
-
-void LIPFilterGenerator::deployBuilderInternal(
-    QueryPlan *execution_plan,
-    serialization::QueryContext *query_context_proto,
-    const physical::PhysicalPtr &builder_node,
-    const QueryPlan::DAGNodeIndex builder_operator_index,
-    const std::vector<physical::LIPFilterBuildInfo> &build_info_vec,
-    LIPFilterBuilderMap *lip_filter_builder_map) const {
-  const auto lip_deployment_index = query_context_proto->lip_filter_deployments_size();
-  auto *lip_filter_deployment_info_proto =
-      query_context_proto->add_lip_filter_deployments();
-  lip_filter_deployment_info_proto->set_action_type(serialization::LIPFilterActionType::BUILD);
-
-  const auto &builder_attribute_map = attribute_map_.at(builder_node);
-  for (const auto &info : build_info_vec) {
-    // Add the LIPFilter information into query context.
-    const QueryContext::lip_filter_id lip_filter_id = query_context_proto->lip_filters_size();
-    serialization::LIPFilter *lip_filter_proto = query_context_proto->add_lip_filters();
-    const CatalogAttribute *target_attr = builder_attribute_map.at(info.build_attribute->id());
-    const Type &attr_type = target_attr->getType();
-
-    switch (info.filter_type) {
-      case LIPFilterType::kSingleIdentityHashFilter: {
-        DCHECK(!attr_type.isVariableLength());
-        lip_filter_proto->set_lip_filter_type(
-            serialization::LIPFilterType::SINGLE_IDENTITY_HASH_FILTER);
-        lip_filter_proto->SetExtension(
-            serialization::SingleIdentityHashFilter::filter_cardinality, info.filter_cardinality);
-        lip_filter_proto->SetExtension(
-            serialization::SingleIdentityHashFilter::attribute_size, attr_type.minimumByteLength());
-        break;
-      }
-      default:
-        LOG(FATAL) << "Unsupported LIPFilter type";
-        break;
-    }
-
-    // Register the builder information which is needed later by the probers.
-    lip_filter_builder_map->emplace(
-        std::make_pair(info.build_attribute->id(), builder_node),
-        std::make_pair(lip_filter_id, builder_operator_index));
-
-    // Add the builder deployment information into query context.
-    auto *lip_filter_entry_proto = lip_filter_deployment_info_proto->add_entries();
-    lip_filter_entry_proto->set_lip_filter_id(lip_filter_id);
-    lip_filter_entry_proto->set_attribute_id(target_attr->getID());
-    lip_filter_entry_proto->mutable_attribute_type()->CopyFrom(attr_type.getProto());
-  }
-
-  // Attach the LIPFilterDeployment information to the RelationalOperator.
-  RelationalOperator *relop =
-      execution_plan->getQueryPlanDAGMutable()->getNodePayloadMutable(builder_operator_index);
-  relop->deployLIPFilters(lip_deployment_index);
-}
-
-void LIPFilterGenerator::deployProberInteral(
-    QueryPlan *execution_plan,
-    serialization::QueryContext *query_context_proto,
-    const physical::PhysicalPtr &prober_node,
-    const QueryPlan::DAGNodeIndex prober_operator_index,
-    const std::vector<physical::LIPFilterProbeInfo> &probe_info_vec,
-    const LIPFilterBuilderMap &lip_filter_builder_map) const {
-  const auto lip_deployment_index = query_context_proto->lip_filter_deployments_size();
-  auto *lip_filter_deployment_info_proto =
-      query_context_proto->add_lip_filter_deployments();
-  lip_filter_deployment_info_proto->set_action_type(serialization::LIPFilterActionType::PROBE);
-
-  const auto &prober_attribute_map = attribute_map_.at(prober_node);
-  for (const auto &info : probe_info_vec) {
-    // Find the corresponding builder for the to-be-probed LIPFilter.
-    const auto &builder_info =
-        lip_filter_builder_map.at(
-            std::make_pair(info.build_attribute->id(), info.builder));
-    const CatalogAttribute *target_attr = prober_attribute_map.at(info.probe_attribute->id());
-
-    // Add the prober deployment information into query context.
-    auto *lip_filter_entry_proto = lip_filter_deployment_info_proto->add_entries();
-    lip_filter_entry_proto->set_lip_filter_id(builder_info.first);
-    lip_filter_entry_proto->set_attribute_id(target_attr->getID());
-    lip_filter_entry_proto->mutable_attribute_type()->CopyFrom(
-        target_attr->getType().getProto());
-
-    // A prober must wait until the corresponding builder has completed building
-    // the LIPFilter.
-    execution_plan->addOrUpgradeDirectDependency(prober_operator_index,
-                                                 builder_info.second,
-                                                 true /* is_pipeline_breaker */);
-  }
-
-  // Attach the LIPFilterDeployment information to the RelationalOperator.
-  RelationalOperator *relop =
-      execution_plan->getQueryPlanDAGMutable()->getNodePayloadMutable(prober_operator_index);
-  relop->deployLIPFilters(lip_deployment_index);
-}
-
-}  // namespace optimizer
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/LIPFilterGenerator.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/LIPFilterGenerator.hpp b/query_optimizer/LIPFilterGenerator.hpp
deleted file mode 100644
index 9d191a1..0000000
--- a/query_optimizer/LIPFilterGenerator.hpp
+++ /dev/null
@@ -1,194 +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_LIP_FILTER_GENERATOR_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_LIP_FILTER_GENERATOR_HPP_
-
-#include <map>
-#include <unordered_map>
-#include <utility>
-#include <vector>
-
-#include "query_execution/QueryContext.hpp"
-#include "query_optimizer/QueryPlan.hpp"
-#include "query_optimizer/expressions/ExprId.hpp"
-#include "query_optimizer/physical/LIPFilterConfiguration.hpp"
-#include "query_optimizer/physical/Aggregate.hpp"
-#include "query_optimizer/physical/HashJoin.hpp"
-#include "query_optimizer/physical/Physical.hpp"
-#include "query_optimizer/physical/Selection.hpp"
-#include "utility/Macros.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-namespace serialization { class QueryContext; }
-
-class CatalogAttribute;
-
-namespace optimizer {
-
-/** \addtogroup QueryOptimizer
- *  @{
- */
-
-/**
- * @brief Generates backend LIPFilter deployments from physical plan's information.
- */
-class LIPFilterGenerator {
- public:
-  /**
-   * @brief Constructor.
-   *
-   * @param lip_filter_configuration The LIPFilter configuration information
-   *        generated by physical optimizer.
-   */
-  explicit LIPFilterGenerator(
-      const physical::LIPFilterConfigurationPtr &lip_filter_configuration)
-      : lip_filter_configuration_(lip_filter_configuration) {
-    DCHECK(lip_filter_configuration_ != nullptr);
-  }
-
-  /**
-   * @brief Collect the ExprId to CatalogAttribute mapping information for the
-   *        given physical node.
-   *
-   * @param node A physical plan node.
-   * @param attribute_substitution_map A map that maps each ExprId to the
-   *        backend relation's CatalogAttribute's.
-   */
-  void registerAttributeMap(
-      const physical::PhysicalPtr &node,
-      const std::unordered_map<expressions::ExprId, const CatalogAttribute *> &attribute_substitution_map);
-
-  /**
-   * @brief Add physical-to-execution mapping information for deploying LIPFilters
-   *        to an aggregation.
-   *
-   * @param aggregate A physical Aggregate node.
-   * @param aggregate_operator_index The index of the AggregationOperator that
-   *        corresponds to \p aggregate in the execution plan.
-   */
-  void addAggregateInfo(const physical::AggregatePtr &aggregate,
-                        const QueryPlan::DAGNodeIndex aggregate_operator_index) {
-    prober_infos_.emplace_back(aggregate, aggregate_operator_index);
-  }
-
-  /**
-   * @brief Add physical-to-execution mapping information for deploying LIPFilters
-   *        to a hash-join.
-   *
-   * @param hash_join A physical HashJoin node.
-   * @param build_operator_index The index of the BuildHashOperator that corresponds
-   *        to \p hash_join in the execution plan.
-   * @param join_operator_index The index of the HashJoinOperator that corresponds
-   *        to \p hash_join in the execution plan.
-   */
-  void addHashJoinInfo(const physical::HashJoinPtr &hash_join,
-                       const QueryPlan::DAGNodeIndex build_operator_index,
-                       const QueryPlan::DAGNodeIndex join_operator_index) {
-    builder_infos_.emplace_back(hash_join, build_operator_index);
-    prober_infos_.emplace_back(hash_join, join_operator_index);
-  }
-
-  /**
-   * @brief Add physical-to-execution mapping information for deploying LIPFilters
-   *        to a selection.
-   *
-   * @param selection A physical Selection node.
-   * @param select_operator_index The index of the SelectOperator that corresponds
-   *        to \p selection in the execution plan.
-   */
-  void addSelectionInfo(const physical::SelectionPtr &selection,
-                        const QueryPlan::DAGNodeIndex select_operator_index) {
-    prober_infos_.emplace_back(selection, select_operator_index);
-  }
-
-  /**
-   * @brief Deploy the LIPFilters to the execution plan.
-   *
-   * @param execution_plan The execution plan.
-   * @param query_context_proto QueryContext protobuf for the execution plan.
-   */
-  void deployLIPFilters(QueryPlan *execution_plan,
-                        serialization::QueryContext *query_context_proto) const;
-
- private:
-  /**
-   * @brief Internal data structure for representing a LIPFilter builder.
-   */
-  struct BuilderInfo {
-    BuilderInfo(const physical::PhysicalPtr &builder_node_in,
-                const QueryPlan::DAGNodeIndex builder_operator_index_in)
-        : builder_node(builder_node_in),
-          builder_operator_index(builder_operator_index_in) {
-    }
-    const physical::PhysicalPtr builder_node;
-    const QueryPlan::DAGNodeIndex builder_operator_index;
-  };
-
-  /**
-   * @brief Internal data structure for representing a LIPFilter prober.
-   */
-  struct ProberInfo {
-    ProberInfo(const physical::PhysicalPtr &prober_node_in,
-               const QueryPlan::DAGNodeIndex prober_operator_index_in)
-        : prober_node(prober_node_in),
-          prober_operator_index(prober_operator_index_in) {
-    }
-    const physical::PhysicalPtr prober_node;
-    const QueryPlan::DAGNodeIndex prober_operator_index;
-  };
-
-  // Maps each LIPFilter's building attribute to the LIPFilter's id in QueryContext
-  // as well as the LIPFilter's building relational operator's index.
-  typedef std::map<std::pair<expressions::ExprId, physical::PhysicalPtr>,
-                   std::pair<QueryContext::lip_filter_id, QueryPlan::DAGNodeIndex>> LIPFilterBuilderMap;
-
-  void deployBuilderInternal(QueryPlan *execution_plan,
-                             serialization::QueryContext *query_context_proto,
-                             const physical::PhysicalPtr &builder_node,
-                             const QueryPlan::DAGNodeIndex builder_operator_index,
-                             const std::vector<physical::LIPFilterBuildInfo> &build_info_vec,
-                             LIPFilterBuilderMap *lip_filter_builder_map) const;
-
-  void deployProberInteral(QueryPlan *execution_plan,
-                           serialization::QueryContext *query_context_proto,
-                           const physical::PhysicalPtr &prober_node,
-                           const QueryPlan::DAGNodeIndex prober_operator_index,
-                           const std::vector<physical::LIPFilterProbeInfo> &probe_info_vec,
-                           const LIPFilterBuilderMap &lip_filter_builder_map) const;
-
-  const physical::LIPFilterConfigurationPtr lip_filter_configuration_;
-
-  std::vector<BuilderInfo> builder_infos_;
-  std::vector<ProberInfo> prober_infos_;
-
-  std::map<physical::PhysicalPtr, std::map<expressions::ExprId, const CatalogAttribute *>> attribute_map_;
-
-  DISALLOW_COPY_AND_ASSIGN(LIPFilterGenerator);
-};
-
-/** @} */
-
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_QUERY_OPTIMIZER_LIP_FILTER_GENERATOR_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/LogicalGenerator.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/LogicalGenerator.cpp b/query_optimizer/LogicalGenerator.cpp
deleted file mode 100644
index abeca53..0000000
--- a/query_optimizer/LogicalGenerator.cpp
+++ /dev/null
@@ -1,87 +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/LogicalGenerator.hpp"
-
-#include <memory>
-#include <vector>
-
-#include "parser/ParseStatement.hpp"
-
-#include "query_optimizer/OptimizerContext.hpp"
-#include "query_optimizer/Validator.hpp"
-#include "query_optimizer/logical/Logical.hpp"
-#include "query_optimizer/resolver/Resolver.hpp"
-#include "query_optimizer/rules/CollapseProject.hpp"
-#include "query_optimizer/rules/GenerateJoins.hpp"
-#include "query_optimizer/rules/PushDownFilter.hpp"
-#include "query_optimizer/rules/PushDownSemiAntiJoin.hpp"
-#include "query_optimizer/rules/Rule.hpp"
-#include "query_optimizer/rules/UnnestSubqueries.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-namespace optimizer {
-
-namespace L = ::quickstep::optimizer::logical;
-
-LogicalGenerator::LogicalGenerator(OptimizerContext *optimizer_context)
-    : optimizer_context_(optimizer_context) {}
-
-LogicalGenerator::~LogicalGenerator() {}
-
-L::LogicalPtr LogicalGenerator::generatePlan(
-    const CatalogDatabase &catalog_database,
-    const ParseStatement &parse_statement) {
-  resolver::Resolver resolver(catalog_database, optimizer_context_);
-  DVLOG(4) << "Parse tree:\n" << parse_statement.toString();
-  logical_plan_ = resolver.resolve(parse_statement);
-  DVLOG(4) << "Initial logical plan:\n" << logical_plan_->toString();
-
-  optimizePlan();
-  DVLOG(4) << "Optimized logical plan:\n" << logical_plan_->toString();
-
-  return logical_plan_;
-}
-
-void LogicalGenerator::optimizePlan() {
-  std::vector<std::unique_ptr<Rule<L::Logical>>> rules;
-  if (optimizer_context_->has_nested_queries()) {
-    rules.emplace_back(new UnnestSubqueries(optimizer_context_));
-  }
-  rules.emplace_back(new PushDownSemiAntiJoin());
-  rules.emplace_back(new PushDownFilter());
-  rules.emplace_back(new GenerateJoins());
-  rules.emplace_back(new PushDownFilter());
-  rules.emplace_back(new CollapseProject());
-
-  for (std::unique_ptr<Rule<L::Logical>> &rule : rules) {
-    logical_plan_ = rule->apply(logical_plan_);
-    DVLOG(5) << "After applying rule " << rule->getName() << ":\n"
-             << logical_plan_->toString();
-  }
-
-#ifdef QUICKSTEP_DEBUG
-  Validate(logical_plan_);
-#endif
-}
-
-}  // namespace optimizer
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/LogicalGenerator.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/LogicalGenerator.hpp b/query_optimizer/LogicalGenerator.hpp
deleted file mode 100644
index 2898e6f..0000000
--- a/query_optimizer/LogicalGenerator.hpp
+++ /dev/null
@@ -1,89 +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_LOGICAL_GENERATOR_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_LOGICAL_GENERATOR_HPP_
-
-#include "query_optimizer/logical/Logical.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-
-class CatalogDatabase;
-class ParseStatement;
-
-namespace optimizer {
-
-class OptimizerContext;
-
-/** \addtogroup QueryOptimizer
- *  @{
- */
-
-/**
- * @brief Generates a logical plan from a parse tree.
- */
-class LogicalGenerator {
- public:
-  /**
-   * @brief Constructor.
-   *
-   * @param optimizer_context The optimizer context.
-   */
-  explicit LogicalGenerator(OptimizerContext *optimizer_context);
-
-  /**
-   * @brief Destructor.
-   */
-  ~LogicalGenerator();
-
-  /**
-   * @return The current logical plan.
-   */
-  const logical::LogicalPtr& logical_plan() const { return logical_plan_; }
-
-  /**
-   * @brief Converts the parse tree to a logical plan and optimizes the logical
-   *        plan by using rules.
-   *
-   * @param catalog_database The catalog database where this query is executed.
-   * @param parse_statement The parse tree to be converted.
-   * @return An optimized logical plan.
-   */
-  logical::LogicalPtr generatePlan(const CatalogDatabase &catalog_database,
-                                   const ParseStatement &parse_statement);
-
- private:
-  /**
-   * @brief Applies rules to the logical plan.
-   */
-  void optimizePlan();
-
-  OptimizerContext *optimizer_context_;
-  logical::LogicalPtr logical_plan_;
-
-  DISALLOW_COPY_AND_ASSIGN(LogicalGenerator);
-};
-
-/** @} */
-
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_QUERY_OPTIMIZER_LOGICAL_GENERATOR_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/LogicalToPhysicalMapper.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/LogicalToPhysicalMapper.hpp b/query_optimizer/LogicalToPhysicalMapper.hpp
deleted file mode 100644
index 869dad0..0000000
--- a/query_optimizer/LogicalToPhysicalMapper.hpp
+++ /dev/null
@@ -1,68 +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_LOGICAL_TO_PHYSICAL_MAPPER_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_LOGICAL_TO_PHYSICAL_MAPPER_HPP_
-
-#include "query_optimizer/logical/Logical.hpp"
-#include "query_optimizer/physical/Physical.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-namespace optimizer {
-
-/** \addtogroup QueryOptimizer
- *  @{
- */
-
-/**
- * @brief Abstract base class for PhysicalGenerator that provides a single
- *        method needed by Strategy objects. This class exists to resolve a
- *        cyclic dependency between PhysicalGenerator and the various
- *        subclasses of Strategy.
- **/
-class LogicalToPhysicalMapper {
- public:
-  virtual ~LogicalToPhysicalMapper() {
-  }
-
-  /**
-   * @brief Returns the physical plan for \p logical_plan.
-   *        Creates the physical plan if it is not yet created.
-   *
-   * @param logical_plan The input logical plan.
-   * @return The physical plan for the logical plan.
-   */
-  virtual physical::PhysicalPtr createOrGetPhysicalFromLogical(
-      const logical::LogicalPtr &logical_plan) = 0;
-
- protected:
-  LogicalToPhysicalMapper() {
-  }
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(LogicalToPhysicalMapper);
-};
-
-/** @} */
-
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_QUERY_OPTIMIZER_LOGICAL_TO_PHYSICAL_MAPPER_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/Optimizer.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/Optimizer.cpp b/query_optimizer/Optimizer.cpp
deleted file mode 100644
index b14c938..0000000
--- a/query_optimizer/Optimizer.cpp
+++ /dev/null
@@ -1,41 +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/Optimizer.hpp"
-
-#include "query_optimizer/ExecutionGenerator.hpp"
-#include "query_optimizer/LogicalGenerator.hpp"
-
-namespace quickstep {
-namespace optimizer {
-
-void Optimizer::generateQueryHandle(const ParseStatement &parse_statement,
-                                    CatalogDatabase *catalog_database,
-                                    OptimizerContext *optimizer_context,
-                                    QueryHandle *query_handle) {
-  LogicalGenerator logical_generator(optimizer_context);
-  ExecutionGenerator execution_generator(catalog_database, query_handle);
-
-  execution_generator.generatePlan(
-      physical_generator_.generatePlan(
-          logical_generator.generatePlan(*catalog_database, parse_statement)));
-}
-
-}  // namespace optimizer
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/Optimizer.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/Optimizer.hpp b/query_optimizer/Optimizer.hpp
deleted file mode 100644
index 36f956a..0000000
--- a/query_optimizer/Optimizer.hpp
+++ /dev/null
@@ -1,83 +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_OPTIMIZER_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_OPTIMIZER_HPP_
-
-#include "query_optimizer/PhysicalGenerator.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-
-class CatalogDatabase;
-class ParseStatement;
-class QueryHandle;
-
-namespace optimizer {
-
-class OptimizerContext;
-
-/** \addtogroup QueryOptimizer
- *  @{
- */
-
-/**
- * @brief Main class of the optimizer that creates and optimizes all types of query
- *        plans.
- */
-class Optimizer {
- public:
-  /**
-   * @brief Constructor.
-   */
-  Optimizer() {}
-
-  /**
-   * @brief Destructor.
-   */
-  ~Optimizer() {}
-
-  /**
-   * @brief Fills an execution plan as a list of operators,
-   *        and the query result relation in
-   *        \p query_handle for \p parse_statement.
-   * @note Does not take ownership of \p query_handle.
-   *
-   * @param parse_statement The parse tree of the input query.
-   * @param catalog_database The database that the query is executed on.
-   * @param optimizer_context The optimizer context of the input query.
-   * @param query_handle The generated query handle to output.
-   */
-  void generateQueryHandle(const ParseStatement &parse_statement,
-                           CatalogDatabase *catalog_database,
-                           OptimizerContext *optimizer_context,
-                           QueryHandle *query_handle);
-
- private:
-  PhysicalGenerator physical_generator_;
-
-  DISALLOW_COPY_AND_ASSIGN(Optimizer);
-};
-
-/** @} */
-
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_QUERY_OPTIMIZER_OPTIMIZER_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/OptimizerContext.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/OptimizerContext.cpp b/query_optimizer/OptimizerContext.cpp
deleted file mode 100644
index de7ba8c..0000000
--- a/query_optimizer/OptimizerContext.cpp
+++ /dev/null
@@ -1,30 +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/OptimizerContext.hpp"
-
-#include <string>
-
-namespace quickstep {
-namespace optimizer {
-
-const char *OptimizerContext::kInternalTemporaryRelationNamePrefix = "_qstemp_result_";
-
-}  // namespace optimizer
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/OptimizerContext.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/OptimizerContext.hpp b/query_optimizer/OptimizerContext.hpp
deleted file mode 100644
index d52c96c..0000000
--- a/query_optimizer/OptimizerContext.hpp
+++ /dev/null
@@ -1,104 +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_OPTIMIZER_CONTEXT_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_OPTIMIZER_CONTEXT_HPP_
-
-#include "query_optimizer/expressions/ExprId.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-
-namespace optimizer {
-
-/** \addtogroup QueryOptimizer
- *  @{
- */
-
-/**
- * @brief Stores stateful or common info used throughout the optimization of a
- *        query.
- */
-class OptimizerContext {
- public:
-  static const char *kInternalTemporaryRelationNamePrefix;
-
-  /**
-   * @brief Constructor.
-   */
-  OptimizerContext()
-      : current_expr_id_(-1),
-        has_nested_queries_(false),
-        is_catalog_changed_(false) {}
-
-  /**
-   * @brief Destructor.
-   */
-  ~OptimizerContext() {}
-
-  /**
-   * @brief Gets the next ExprId.
-   *
-   * @return A new ExprId.
-   */
-  expressions::ExprId nextExprId() {
-    return ++current_expr_id_;
-  }
-
-  /**
-   * @brief Indicate that the query has a nested subquery.
-   */
-  void set_has_nested_queries() {
-    has_nested_queries_ = true;
-  }
-
-  /**
-   * @return True if the query has a nested subquery.
-   */
-  bool has_nested_queries() const {
-    return has_nested_queries_;
-  }
-
-  /**
-   * @brief Sets <is_catalog_changed_> to be true to indicate the query will
-   *        modify the catalog permanently.
-   */
-  void set_is_catalog_changed() { is_catalog_changed_ = true; }
-
-  /**
-   * @return True if the catalog will be permanently changed after the query.
-   */
-  bool is_catalog_changed() const { return is_catalog_changed_; }
-
- private:
-  expressions::ExprId current_expr_id_;
-
-  bool has_nested_queries_;
-
-  bool is_catalog_changed_;
-
-  DISALLOW_COPY_AND_ASSIGN(OptimizerContext);
-};
-
-/** @} */
-
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_QUERY_OPTIMIZER_OPTIMIZER_CONTEXT_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/OptimizerTree.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/OptimizerTree.hpp b/query_optimizer/OptimizerTree.hpp
deleted file mode 100644
index 8ea2c6f..0000000
--- a/query_optimizer/OptimizerTree.hpp
+++ /dev/null
@@ -1,295 +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_OPTIMIZER_TREE_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_OPTIMIZER_TREE_HPP_
-
-#include <cstddef>
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "storage/StorageBlockLayout.pb.h"
-#include "utility/Macros.hpp"
-#include "utility/TreeStringSerializable.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-namespace optimizer {
-
-/** \addtogroup QueryOptimizer
- *  @{
- */
-
-/**
- * @brief Base class of OptimizerTree. This class is needed so that we may
- *        attach non-child type nodes to a tree in the string representation
- *        as long as the non-child type is a subclass of OptimizerTreeBase.
- *        For example, a Logical node may have a child tree node of an
- *        Expression type.
- */
-class OptimizerTreeBase
-    : public TreeStringSerializable<std::shared_ptr<const OptimizerTreeBase>> {
- public:
-  typedef std::shared_ptr<const OptimizerTreeBase> OptimizerTreeBaseNodePtr;
-
-  /**
-   * @brief Destructor.
-   */
-  ~OptimizerTreeBase() override {}
-
- protected:
-  /**
-   * @brief Constructor.
-   */
-  OptimizerTreeBase() {}
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(OptimizerTreeBase);
-};
-
-/**
- * @brief Base class for expressions, logical/physical trees.
- */
-template <class NodeType>
-class OptimizerTree : public OptimizerTreeBase {
- public:
-  typedef std::shared_ptr<const NodeType> OptimizerTreeNodePtr;
-
-  /**
-   * @brief Destructor.
-   */
-  ~OptimizerTree() override {}
-
-  /**
-   * @brief Returns the child node list.
-   *
-   * @return A vector of children.
-   */
-  const std::vector<OptimizerTreeNodePtr>& children() const {
-    return children_;
-  }
-
-  /**
-   * @brief Returns the number of child nodes.
-   *
-   * @return The number of child nodes.
-   */
-  std::size_t getNumChildren() const { return children_.size(); }
-
-  /**
-   * @brief Creates a copy with the child nodes replaced by \p new_children.
-   *
-   * @param new_children The children to be substituted for the existing ones.
-   * @return A copy with \p new_children as child nodes.
-   */
-  virtual OptimizerTreeNodePtr copyWithNewChildren(
-      const std::vector<OptimizerTreeNodePtr> &new_children) const = 0;
-
- protected:
-  /**
-   * @brief Constructor.
-   */
-  OptimizerTree() {}
-
-  /**
-   * @brief Adds a new child node to this tree node->
-   *
-   * @param child The node to add as a new child.
-   */
-  void addChild(const OptimizerTreeNodePtr &child) {
-    children_.push_back(child);
-  }
-
- private:
-  std::vector<OptimizerTreeNodePtr> children_;
-
-  DISALLOW_COPY_AND_ASSIGN(OptimizerTree);
-};
-
-/**
- * @brief A helper class for printing Protobuf messages in a simple flat-format.
- * @details Holds key-value pairs of a proto message. Key values are added as strings.
- *          To use, create a representation and then add properties:
- *             auto foo = new OptimizerProtoRepresentation<OptimizerPtrType>();
- *             foo.addProperty("friendly_name", proto.GetExtension(ProtoType::friendly_name));
- */
-template<class TreeNodeType>
-class OptimizerProtoRepresentation : public OptimizerTreeBase {
-  /**
-   * @brief Inner class which represents key-value properties of the given proto.
-   */
-  class OptimizerProtoPropertyRepresentation : public OptimizerTreeBase {
-   public:
-    OptimizerProtoPropertyRepresentation(std::string key, std::string value)
-        : key_(key), value_(value) {  }
-
-    std::string getName() const {
-      return "ProtoProperty";
-    }
-
-    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<TreeNodeType> *non_container_child_fields,
-                             std::vector<std::string> *container_child_field_names,
-                             std::vector<std::vector<TreeNodeType>> *container_child_fields) const {
-      inline_field_names->push_back(std::string("Property"));
-      inline_field_values->push_back(key_);
-
-      inline_field_names->push_back(std::string("Value"));
-      inline_field_values->push_back(value_);
-    }
-
-   private:
-    std::string key_;
-    std::string value_;
-  };  // class OptimizerProtoRepresentation
-
- public:
-  OptimizerProtoRepresentation() : properties_() { }
-
-  std::string getName() const {
-    return "ProtoDescription";
-  }
-
-  /**
-   * @brief Add a key-value type property to this proto representation.
-   * @details Internally, the instance creates another node to represent the
-   *          given values.
-   *
-   * @param key A string key.
-   * @param value A string value.
-   */
-  void addProperty(std::string key, std::string value) {
-    std::shared_ptr<const OptimizerProtoPropertyRepresentation> property(
-        new OptimizerProtoPropertyRepresentation(key, value));
-    properties_.push_back(property);
-  }
-
-  /**
-   * @brief Add a key-value type property to this proto representation.
-   * @details Internally, the instance creates another node to represent the
-   *          given values.
-   *
-   * @param key A string key.
-   * @param value An int value which is converted into a string.
-   */
-  void addProperty(std::string key, int value) {
-    std::shared_ptr<const OptimizerProtoPropertyRepresentation> property(
-        new OptimizerProtoPropertyRepresentation(key, std::to_string(value)));
-    properties_.push_back(property);
-  }
-
-  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<TreeNodeType> *non_container_child_fields,
-                           std::vector<std::string> *container_child_field_names,
-                           std::vector<std::vector<TreeNodeType>> *container_child_fields) const {
-    for (auto property : properties_) {
-      non_container_child_field_names->push_back("Property");
-      non_container_child_fields->push_back(property);
-    }
-  }
-  // A list of managed properties.
-  std::vector<std::shared_ptr<const OptimizerProtoPropertyRepresentation> > properties_;
-};
-
-/**
- * @brief Returns an optimizer node representation of a LayoutDescription.
- *
- * @param description A valid StorageBlockLayoutDescription.
- * @return A caller-managed optimizer tree node of the proto message.
- */
-template<class TreeNodeType>
-OptimizerProtoRepresentation<TreeNodeType>* getOptimizerRepresentationForProto(
-    const StorageBlockLayoutDescription *description) {
-  if (description == nullptr) {
-    return nullptr;
-  }
-
-  std::unique_ptr<OptimizerProtoRepresentation<TreeNodeType> >
-      node(new OptimizerProtoRepresentation<TreeNodeType>());
-
-  // Add properties based on the tuple storage block type.
-  const ::quickstep::TupleStorageSubBlockDescription &storage_block_description
-      = description->tuple_store_description();
-  switch (storage_block_description.sub_block_type()) {
-    case TupleStorageSubBlockDescription::PACKED_ROW_STORE: {
-      node->addProperty("blocktype", "rowstore");
-      break;
-    }
-    case TupleStorageSubBlockDescription::SPLIT_ROW_STORE: {
-      node->addProperty("blocktype", "split_rowstore");
-      break;
-    }
-    case TupleStorageSubBlockDescription::BASIC_COLUMN_STORE: {
-      node->addProperty("blocktype", "columnstore");
-      node->addProperty("sort",
-          storage_block_description.GetExtension(
-              quickstep::BasicColumnStoreTupleStorageSubBlockDescription::sort_attribute_id));
-      break;
-    }
-    case TupleStorageSubBlockDescription::COMPRESSED_COLUMN_STORE: {
-      node->addProperty("blocktype", "compressed_columnstore");
-      node->addProperty("sort",
-          storage_block_description.GetExtension(
-              quickstep::CompressedColumnStoreTupleStorageSubBlockDescription::sort_attribute_id));
-      for (int compressed_attribute = 0;
-           compressed_attribute < storage_block_description.ExtensionSize(
-               quickstep::CompressedColumnStoreTupleStorageSubBlockDescription::compressed_attribute_id);
-           ++compressed_attribute) {
-        node->addProperty("compress",
-            storage_block_description.GetExtension(
-                quickstep::CompressedColumnStoreTupleStorageSubBlockDescription::compressed_attribute_id,
-                compressed_attribute));
-      }
-      break;
-    }
-    case TupleStorageSubBlockDescription::COMPRESSED_PACKED_ROW_STORE: {
-      node->addProperty("blocktype", "compressed_packed_rowstore");
-      for (int compressed_attribute = 0;
-           compressed_attribute < storage_block_description.ExtensionSize(
-               quickstep::CompressedPackedRowStoreTupleStorageSubBlockDescription::compressed_attribute_id);
-           ++compressed_attribute) {
-        node->addProperty("compress",
-            storage_block_description.GetExtension(
-                quickstep::CompressedPackedRowStoreTupleStorageSubBlockDescription::compressed_attribute_id,
-                compressed_attribute));
-      }
-      break;
-    }
-    default: {
-      LOG(WARNING) << "Unrecognized block type in protobuf message.";
-      break;
-    }
-  }
-  // Every case will specify a slots number.
-  node->addProperty("slots", description->num_slots());
-  return node.release();
-}
-
-/** @} */
-
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_QUERY_OPTIMIZER_OPTIMIZER_TREE_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/PhysicalGenerator.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/PhysicalGenerator.cpp b/query_optimizer/PhysicalGenerator.cpp
deleted file mode 100644
index 7cb97dc..0000000
--- a/query_optimizer/PhysicalGenerator.cpp
+++ /dev/null
@@ -1,156 +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/PhysicalGenerator.hpp"
-
-#include <memory>
-#include <unordered_map>
-#include <vector>
-
-#include "query_optimizer/Validator.hpp"
-#include "query_optimizer/logical/Logical.hpp"
-#include "query_optimizer/physical/Physical.hpp"
-#include "query_optimizer/rules/AttachLIPFilters.hpp"
-#include "query_optimizer/rules/PruneColumns.hpp"
-#include "query_optimizer/rules/StarSchemaHashJoinOrderOptimization.hpp"
-#include "query_optimizer/rules/SwapProbeBuild.hpp"
-#include "query_optimizer/strategy/Aggregate.hpp"
-#include "query_optimizer/strategy/Join.hpp"
-#include "query_optimizer/strategy/OneToOne.hpp"
-#include "query_optimizer/strategy/Selection.hpp"
-#include "query_optimizer/strategy/Strategy.hpp"
-#include "utility/PlanVisualizer.hpp"
-
-#include "gflags/gflags.h"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-namespace optimizer {
-
-DEFINE_bool(reorder_hash_joins, true,
-            "If true, apply hash join order optimization to each group of hash "
-            "joins. The optimization applies a greedy algorithm to favor smaller "
-            "cardinality and selective tables to be joined first, which is suitable "
-            "for queries on star-schema tables.");
-
-DEFINE_bool(use_lip_filters, true,
-            "If true, use LIP (Lookahead Information Passing) filters to accelerate "
-            "query processing. LIP filters are effective for queries on star schema "
-            "tables (e.g. the SSB benchmark) and snowflake schema tables (e.g. the "
-            "TPC-H benchmark).");
-
-DEFINE_bool(visualize_plan, false,
-            "If true, visualize the final physical plan into a graph in DOT format "
-            "(DOT is a plain text graph description language). Then print the "
-            "generated graph through stderr.");
-
-namespace L = ::quickstep::optimizer::logical;
-namespace P = ::quickstep::optimizer::physical;
-namespace S = ::quickstep::optimizer::strategy;
-
-void PhysicalGenerator::createStrategies() {
-  // Note that the ordering matters.
-  // The strategy that can create better plans should be inserted first.
-  strategies_.emplace_back(new S::Join(this));
-  strategies_.emplace_back(new S::Aggregate(this));
-  strategies_.emplace_back(new S::Selection(this));
-  strategies_.emplace_back(new S::OneToOne(this));
-}
-
-P::PhysicalPtr PhysicalGenerator::generatePlan(
-    const L::LogicalPtr &logical_plan) {
-  physical_plan_ = generateInitialPlan(logical_plan);
-  return optimizePlan();
-}
-
-P::PhysicalPtr PhysicalGenerator::generateInitialPlan(
-    const L::LogicalPtr &logical_plan) {
-  // Choose the first generated physical plan as the best one.
-  P::PhysicalPtr physical_plan;
-  for (std::unique_ptr<S::Strategy> &strategy : strategies_) {
-    DVLOG(5) << "Apply strategy " << strategy->getName() << " to "
-             << logical_plan->getShortString();
-    if (strategy->generatePlan(logical_plan, &physical_plan)) {
-      DVLOG(5) << "Result:\n" << physical_plan->toString();
-      break;
-    }
-  }
-  CHECK(physical_plan != nullptr) << "No strategy for a logical plan:\n"
-                                  << logical_plan->toString();
-
-  // Memorize the created physical plan.
-  setBestPhysicalForLogical(logical_plan, physical_plan);
-  return physical_plan;
-}
-
-P::PhysicalPtr PhysicalGenerator::optimizePlan() {
-  std::vector<std::unique_ptr<Rule<P::Physical>>> rules;
-  rules.emplace_back(new PruneColumns());
-  if (FLAGS_reorder_hash_joins) {
-    rules.emplace_back(new StarSchemaHashJoinOrderOptimization());
-    rules.emplace_back(new PruneColumns());
-  } else {
-    rules.emplace_back(new SwapProbeBuild());
-  }
-  if (FLAGS_use_lip_filters) {
-    rules.emplace_back(new AttachLIPFilters());
-  }
-
-  for (std::unique_ptr<Rule<P::Physical>> &rule : rules) {
-    physical_plan_ = rule->apply(physical_plan_);
-    DVLOG(5) << "After applying rule " << rule->getName() << ":\n"
-             << physical_plan_->toString();
-  }
-
-  DVLOG(4) << "Optimized physical plan:\n" << physical_plan_->toString();
-
-  if (FLAGS_visualize_plan) {
-    quickstep::PlanVisualizer plan_visualizer;
-    std::cerr << "\n" << plan_visualizer.visualize(physical_plan_) << "\n";
-  }
-
-#ifdef QUICKSTEP_DEBUG
-  Validate(physical_plan_);
-#endif
-  return physical_plan_;
-}
-
-void PhysicalGenerator::setBestPhysicalForLogical(
-    const L::LogicalPtr &logical_plan, const P::PhysicalPtr &physical_plan) {
-  DCHECK(logical_plan != nullptr);
-  DCHECK(physical_plan != nullptr);
-  logical_to_physical_map_.emplace(logical_plan, physical_plan);
-}
-
-P::PhysicalPtr PhysicalGenerator::createOrGetPhysicalFromLogical(
-    const L::LogicalPtr &logical_plan) {
-  DCHECK(logical_plan != nullptr);
-  // Check if we have created the physical plan.
-  const std::unordered_map<L::LogicalPtr, P::PhysicalPtr>::const_iterator it =
-      logical_to_physical_map_.find(logical_plan);
-  if (it != logical_to_physical_map_.end()) {
-    return it->second;
-  }
-
-  return generateInitialPlan(logical_plan);
-}
-
-}  // namespace optimizer
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/PhysicalGenerator.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/PhysicalGenerator.hpp b/query_optimizer/PhysicalGenerator.hpp
deleted file mode 100644
index 886a173..0000000
--- a/query_optimizer/PhysicalGenerator.hpp
+++ /dev/null
@@ -1,141 +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_PHYSICAL_GENERATOR_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_PHYSICAL_GENERATOR_HPP_
-
-#include <memory>
-#include <unordered_map>
-#include <vector>
-
-#include "query_optimizer/LogicalToPhysicalMapper.hpp"
-#include "query_optimizer/logical/Logical.hpp"
-#include "query_optimizer/physical/Physical.hpp"
-#include "query_optimizer/strategy/Strategy.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-namespace optimizer {
-
-/** \addtogroup QueryOptimizer
- *  @{
- */
-
-/**
- * @brief Converts logical plans to physical plans.
- */
-class PhysicalGenerator : public LogicalToPhysicalMapper {
- public:
-  /**
-   * @brief Constructor
-   */
-  PhysicalGenerator() {
-    createStrategies();
-  }
-
-  /**
-   * @brief Destructor.
-   */
-  ~PhysicalGenerator() {}
-
-  /**
-   * @return The generated physical plan.
-   */
-  const physical::PhysicalPtr& physical_plan() const { return physical_plan_; }
-
-  /**
-   * @brief Generates and optimizes a physical plan for \p logical_plan.
-   *
-   * @param logical_plan The logical plan to be converted to a physical plan.
-   * @return The physical plan.
-   */
-  physical::PhysicalPtr generatePlan(const logical::LogicalPtr &logical_plan);
-
-  /**
-   * @brief Sets the best physical plan for \p logical_plan is \p physical_plan.
-   *
-   * @param logical_plan Logical plan.
-   * @param physical_plan The physical plan for the logical plan.
-   */
-  void setBestPhysicalForLogical(const logical::LogicalPtr &logical_plan,
-                                 const physical::PhysicalPtr &physical_plan);
-
-  physical::PhysicalPtr createOrGetPhysicalFromLogical(
-      const logical::LogicalPtr &logical_plan) final;
-
- private:
-  /**
-   * @brief Creates an initial physical plan for \p logical_plan.
-   *        It tries each strategy to the logical plan in order,
-   *        and the physical plan generated by the first strategy that can
-   *        be applied is chosen as the best initial physical plan.
-   *
-   *
-   * @param logical_plan The logical plan to be converted to a physical plan.
-   * @return The initial physical plan.
-   */
-  physical::PhysicalPtr generateInitialPlan(
-      const logical::LogicalPtr &logical_plan);
-
-  /**
-   * @brief Creates strategies for different types of physical nodes.
-   */
-  void createStrategies();
-
-  /**
-   * @brief Applies physical rules to the initial physical plan.
-   *
-   * @return The optimized physical plan.
-   */
-  physical::PhysicalPtr optimizePlan();
-
-  std::vector<std::unique_ptr<strategy::Strategy>> strategies_;
-
-  /**
-   * @brief Maps a logical plan to its initial physical plan.
-   *        We memorize every generated sub-physical plan in this map.
-   *        This map is currently useless, because each logical node is
-   *        visited only once and its physical plan won't be retrieved
-   *        from the map. This is used to allow strategy tests to change
-   *        the plans created for a logical plan by putting intended plans
-   *        into the map so that the generator won't apply a strategy to
-   *        create a plan for a logical node. It also makes testing on
-   *        different strategies to be relatively independent. A strategy test
-   *        only checks one type of physical plans, and manually provides other
-   *        types of physical plans that are not interested. This map will become
-   *        more useful when we have a cost model to evaluate the cost of a
-   *        physical plan. The best physical plan for a logical subplan may be shared
-   *        in multiple physical plans during the plan enumeration.
-   */
-  std::unordered_map<logical::LogicalPtr, physical::PhysicalPtr> logical_to_physical_map_;
-
-  /**
-   * @brief The complete physical plan.
-   */
-  physical::PhysicalPtr physical_plan_;
-
-  DISALLOW_COPY_AND_ASSIGN(PhysicalGenerator);
-};
-
-/** @} */
-
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_QUERY_OPTIMIZER_PHYSICAL_GENERATOR_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/QueryHandle.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/QueryHandle.hpp b/query_optimizer/QueryHandle.hpp
deleted file mode 100644
index 1ca6021..0000000
--- a/query_optimizer/QueryHandle.hpp
+++ /dev/null
@@ -1,163 +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_QUERY_HANDLE_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_QUERY_HANDLE_HPP_
-
-#include <cstddef>
-#include <cstdint>
-#include <memory>
-
-#include "catalog/Catalog.pb.h"
-#include "query_execution/QueryContext.pb.h"
-#include "query_optimizer/QueryPlan.hpp"
-#include "utility/Macros.hpp"
-
-#include "tmb/id_typedefs.h"
-
-namespace quickstep {
-
-class CatalogRelation;
-
-/** \addtogroup QueryOptimizer
- *  @{
- */
-
-/**
- * @brief A handle to hold the query plan and resultant relation, if any.
- **/
-class QueryHandle {
- public:
-  /**
-   * @brief Constructor.
-   *
-   * @param query_id The given query id.
-   * @param cli_id The client id of the CLI which submits the query.
-   * @param query_priority The priority of this query.
-   */
-  explicit QueryHandle(const std::size_t query_id,
-                       const tmb::client_id cli_id,
-                       const std::uint64_t query_priority = 1)
-      : query_id_(query_id),
-        cli_id_(cli_id),
-        query_priority_(query_priority),
-        query_plan_(new QueryPlan()),
-        query_result_relation_(nullptr) {}
-
-  ~QueryHandle() {}
-
-  /**
-   * @brief Get the query id.
-   *
-   * @return The query id.
-   */
-  std::size_t query_id() const {
-    return query_id_;
-  }
-
-  /**
-   * @brief Get the client id of the CLI which submits the query.
-   */
-  tmb::client_id getClientId() const {
-    return cli_id_;
-  }
-
-  /**
-   * @brief Get the query priority.
-   **/
-  const std::uint64_t query_priority() const {
-    return query_priority_;
-  }
-
-  /**
-   * @return The mutable query plan.
-   */
-  QueryPlan* getQueryPlanMutable() {
-    return query_plan_.get();
-  }
-
-  /**
-   * @return The query context in the protobuf format.
-   */
-  const serialization::QueryContext& getQueryContextProto() const {
-    return query_context_proto_;
-  }
-
-  /**
-   * @return The mutable query context in the protobuf format.
-   */
-  serialization::QueryContext* getQueryContextProtoMutable() {
-    return &query_context_proto_;
-  }
-
-  /**
-    * @return The catalog database cache in the protobuf format.
-    */
-  const serialization::CatalogDatabase& getCatalogDatabaseCacheProto() const {
-    return catalog_database_cache_proto_;
-  }
-
-  /**
-   * @return The mutable catalog database cache in the protobuf format.
-   */
-  serialization::CatalogDatabase* getCatalogDatabaseCacheProtoMutable() {
-    return &catalog_database_cache_proto_;
-  }
-
-  /**
-   * @brief Get the query result relation.
-   */
-  const CatalogRelation* getQueryResultRelation() const {
-    return query_result_relation_;
-  }
-
-  /**
-   * @brief Set the query result relation.
-   */
-  void setQueryResultRelation(const CatalogRelation *relation) {
-    query_result_relation_ = relation;
-  }
-
- private:
-  const std::size_t query_id_;
-
-  // The client id of the CLI which submits the query.
-  const tmb::client_id cli_id_;
-
-  const std::uint64_t query_priority_;
-
-  std::unique_ptr<QueryPlan> query_plan_;
-
-  serialization::QueryContext query_context_proto_;
-
-  // TODO(quickstep-team): Use Catalog to support multiple databases.
-  serialization::CatalogDatabase catalog_database_cache_proto_;
-
-  // NOTE(zuyu): The relation gets created by the optimizer,
-  //             and deleted by the Cli shell.
-  const CatalogRelation *query_result_relation_;
-
-  DISALLOW_COPY_AND_ASSIGN(QueryHandle);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_QUERY_OPTIMIZER_QUERY_HANDLE_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/QueryOptimizerConfig.h.in
----------------------------------------------------------------------
diff --git a/query_optimizer/QueryOptimizerConfig.h.in b/query_optimizer/QueryOptimizerConfig.h.in
deleted file mode 100644
index 3bdb6ce..0000000
--- a/query_optimizer/QueryOptimizerConfig.h.in
+++ /dev/null
@@ -1,20 +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.
- **/
-
-#cmakedefine QUICKSTEP_DISTRIBUTED

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/QueryOptimizerModule.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/QueryOptimizerModule.hpp b/query_optimizer/QueryOptimizerModule.hpp
deleted file mode 100644
index d7cb00a..0000000
--- a/query_optimizer/QueryOptimizerModule.hpp
+++ /dev/null
@@ -1,23 +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 QueryOptimizer
- *
- * A system to prepare and optimize query plans for parsed SQL statements.
- **/

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/QueryPlan.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/QueryPlan.hpp b/query_optimizer/QueryPlan.hpp
deleted file mode 100644
index ef6dff4..0000000
--- a/query_optimizer/QueryPlan.hpp
+++ /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.
- **/
-
-#ifndef QUICKSTEP_QUERY_OPTIMIZER_QUERY_PLAN_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_QUERY_PLAN_HPP_
-
-#include <unordered_map>
-#include <utility>
-
-#include "relational_operators/RelationalOperator.hpp"
-#include "utility/DAG.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-
-/** \addtogroup QueryOptimizer
- *  @{
- */
-
-/**
- * @brief A plan to execute a query.
- **/
-class QueryPlan {
- public:
-  typedef DAG<RelationalOperator, bool>::size_type_nodes DAGNodeIndex;
-
-  /**
-   * @brief Constructor.
-   */
-  QueryPlan() {}
-
-  /**
-   * @brief Create a relational operator node in the plan, and set its node
-   *        index.
-   *
-   * @param relational_operator The relational operator to be added to the plan.
-   * @return The node index in the exeuciton plan.
-   */
-  inline DAGNodeIndex addRelationalOperator(RelationalOperator *relational_operator) {
-    const DAGNodeIndex node_index = dag_operators_.createNode(relational_operator);
-    relational_operator->setOperatorIndex(node_index);
-    return node_index;
-  }
-
-  /**
-   * @brief Creates a link from \p producer_operator_index to \p consumer_operator_index
-   *        in the DAG.
-   *
-   * @param consumer_operator_index The index of the consumer operator.
-   * @param producer_operator_index The index of the producer operator.
-   * @param is_pipeline_breaker True if the result from the producer cannot be
-   *                            pipelined to the consumer, otherwise false.
-   */
-  inline void addDirectDependency(DAGNodeIndex consumer_operator_index,
-                                  DAGNodeIndex producer_operator_index,
-                                  bool is_pipeline_breaker) {
-    dag_operators_.createLink(producer_operator_index, consumer_operator_index, is_pipeline_breaker);
-  }
-
-  /**
-   * @brief Creates a link or upgrades the existing link from \p producer_operator_index
-   *        to \p consumer_operator_index in the DAG.
-   *
-   * Depending on whether there is an existing link from \p producer_operator_index
-   * to \p consumer_operator_index:
-   *   - Case 1, no existing link:
-   *         Creates a link with metadata set to is_pipeline_breaker.
-   *   - Case 2, existing link with metadata \p m:
-   *         Set m = (m | is_pipeline_break).
-   *
-   * @param consumer_operator_index The index of the consumer operator.
-   * @param producer_operator_index The index of the producer operator.
-   * @param is_pipeline_breaker True if the result from the producer cannot be
-   *                            pipelined to the consumer, otherwise false.
-   */
-  inline void addOrUpgradeDirectDependency(DAGNodeIndex consumer_operator_index,
-                                           DAGNodeIndex producer_operator_index,
-                                           bool is_pipeline_breaker) {
-    const auto &dependents = dag_operators_.getDependents(producer_operator_index);
-    const auto consumer_it = dependents.find(consumer_operator_index);
-    if (consumer_it == dependents.end()) {
-      dag_operators_.createLink(producer_operator_index,
-                                consumer_operator_index,
-                                is_pipeline_breaker);
-    } else {
-      dag_operators_.setLinkMetadata(producer_operator_index,
-                                     consumer_operator_index,
-                                     consumer_it->second | is_pipeline_breaker);
-    }
-  }
-
-  /**
-   * @brief Creates dependencies for a DropTable operator with index
-   *        \p drop_operator_index. If \p producer_operator_index
-   *        has any dependent, creates a link from \p drop_operator_index
-   *        to each dependent of \p producer_operator_index in the DAG;
-   *        otherwise, create a direct link between \p drop_operator_index
-   *        and \p producer_operator_index.
-   *
-   * @param dependent_operator_index The index of the DropTable operator node.
-   * @param dependency_operator_index The index of the operator node that outputs
-   *                                  the relation to be dropped by the operator
-   *                                  at \p dependent_operator_index.
-   */
-  inline void addDependenciesForDropOperator(DAGNodeIndex drop_operator_index,
-                                             DAGNodeIndex producer_operator_index) {
-    const std::unordered_map<DAGNodeIndex, bool> &direct_dependents =
-        dag_operators_.getDependents(producer_operator_index);
-    if (!direct_dependents.empty()) {
-      for (const std::pair<const DAGNodeIndex, bool> &direct_dependent : direct_dependents) {
-        dag_operators_.createLink(direct_dependent.first,
-                                  drop_operator_index,
-                                  true /* is_pipeline_breaker */);
-      }
-    } else {
-      dag_operators_.createLink(producer_operator_index,
-                                drop_operator_index,
-                                true /* is_pipeline_breaker */);
-    }
-  }
-
-  /**
-   * @return The DAG query plan.
-   */
-  const DAG<RelationalOperator, bool>& getQueryPlanDAG() const {
-    return dag_operators_;
-  }
-
-  /**
-   * @return The DAG query plan.
-   */
-  DAG<RelationalOperator, bool>* getQueryPlanDAGMutable() {
-    return &dag_operators_;
-  }
-
- private:
-  // A false value of the second template argument indicates that the
-  // link between two RelationalOperators is not a pipeline breaker.
-  // while a true value indicates that the link is a pipeline
-  // breaker. Streamed data won't move through pipeline breaker links.
-  DAG<RelationalOperator, bool> dag_operators_;
-
-  DISALLOW_COPY_AND_ASSIGN(QueryPlan);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_QUERY_OPTIMIZER_QUERY_PLAN_HPP_



[50/51] [abbrv] [partial] incubator-quickstep git commit: remove c++ files

Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
index 5dea02f..03c1f51 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,11 +1,4 @@
-/build
-/.tags
-/.tags_sorted_by_file
-/html
-/latex
-/cscope.out
-Makefile.in
-autom4te.cache
-.DS_Store
-.idea
-*~
+_site/
+.sass-cache/
+.jekyll-metadata
+.DS_STORE

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/BUILDING.md
----------------------------------------------------------------------
diff --git a/BUILDING.md b/BUILDING.md
deleted file mode 100644
index 97552c6..0000000
--- a/BUILDING.md
+++ /dev/null
@@ -1,206 +0,0 @@
-Quickstep Build Guide
-=====================
-
-
-What You Will Need
-------------------
-
-To build quickstep, you will need a C++ compiler that supports the C++14
-standard (GCC 4.9 or Clang 3.4 or higher are known to work), and CMake. If you
-have GNU Bison and Flex as well, they will be used to build the parser and
-lexer sources (otherwise, preprocessed sources made with Bison and Flex will be
-used).
-
-### Vagrant
-
-For your convenience, we have provided Vagrant virtual machine configurations
-that have a complete development environment for Quickstep with all necessary
-tools and dependencies already installed. [See here for instructions on how to
-use them](build/vagrant/README.md).
-
-### Getting CMake
-
-Quickstep uses the CMake build system.
-
-If you're on a Linux machine, most distributions' package managers have a
-package for CMake that you can install. The same goes for all of the major
-flavors of BSD UNIX (Free/Net/Open/Dragonfly), OpenSolaris, and Cygwin.
-
-If you're using Mac OS X or Windows, you can download CMake binaries from:
-http://www.cmake.org/download/
-
-On Mac or Windows, be sure to let the installer put links to the CMake command-
-line tools in bin or add them to your PATH.
-
-### Special Note: Building on Windows
-
-To build on Windows, you will need some variety of Microsoft's C++ compiler and
-the nmake tool (either from Visual Studio, Visual C++ Express, or the Windows
-SDK). Only Visual Studio 2015 or higher is sufficiently modern to build
-Quickstep.
-
-Once you have the necessary tools installed, run the "Visual Studio Command
-Prompt" (use the 64-bit version if you have it). Change into the build
-directory and run:
-
-    cmake -G "NMake Makefiles" ..
-
-The `-G "NMake Makefiles"` option tells CMake to generate makefiles for the nmake
-tool instead of project files for Visual Studio. You can also specify the usual
-cmake options described below like `-D CMAKE_BUILD_TYPE=Release`.
-
-Once cmake finishes, run `nmake` to actually build quickstep. Unfortunately,
-nmake does not support parallel jobs like UNIX make, so you're in for a bit of
-a wait.
-
-Configuring with CMake
-----------------------
-
-CMake recommends building outside of the source tree (a recommendation which we
-follow). For your convenience, a "build" directory with a skeleton of files
-needed for running quickstep is provided. cd into the build directory before
-running cmake.
-
-Like a conventional configure script, you can configure some settings about how
-quickstep is built when you invoke cmake. The most important is the build type.
-You can build an unoptimized build with debugging information by doing:
-
-    cmake -D CMAKE_BUILD_TYPE=Debug ..
-
-You can build a fast, optimized release build by doing:
-
-    cmake -D CMAKE_BUILD_TYPE=Release ..
-
-The first time you check out the Quickstep source repo, you will also need to
-fetch some third-party dependencies that are packaged as git submodules. Do
-this by running the following 2 commands in the root quickstep directory:
-
-    git submodule init
-    git submodule update
-
-### Advanced Configuration
-
-There are a number of advanced options you can pass to CMake to control how
-Quickstep is built. These all have sensible defaults, so you may skip this
-section and go straight to "Building" below if you are not interested.
-
-* **Using a non-default compiler**: CMake will automatically find and use your
-  system's default C and C++ compilers. If you wish to use some other
-  compilers, you can specify them on the cmake command line with the
-  `CMAKE_C_COMPILER` and `CMAKE_CXX_COMPILER` options. For example, if you
-  wish to use clang instead of gcc, you would do this:
-
-      cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_C_COMPILER=clang -D CMAKE_CXX_COMPILER=clang++ ../
-
-* **Disabling TCMalloc**: You can configure whether quickstep should use
-  tcmalloc (it does by default). tcmalloc stands for thread-cacheing malloc, it
-  is a very high-performance replacement for the standard libc malloc (it's
-  faster than standard malloc in virtually every case, at the cost of slightly
-  increased up-front memory usage. It performs especially well in
-  multi-threaded use). Nevertheless, there are a couple of cases where you
-  don't want to use tcmalloc. The first is when you plan on using valgrind to
-  check for memory leaks (using tcmalloc causes valgrind to report 0 bytes
-  leaked for every program). The second is if your OS doesn't work with
-  tcmalloc for some reason (we default to building without tcmalloc if CMake
-  detects an OS which is known not to work with it). Or, you may just want to
-  compile a DEBUG build faster by skipping an optional dependency. To build
-  without tcmalloc, add `-D USE_TCMALLOC=0` to your command line.
-* **Disabling Linenoise**: You can also configure whether quickstep should use
-  the linenoise command-line editing library, which provides command history
-  and editing in the interactive quickstep shell. This is usually desirable, so
-  it is enabled by default if CMake detects that the headers it depends on are
-  available (as they are on most modern UNIX systems). If you wish to override
-  the default setting for your OS, you can add `-D USE_LINENOISE=0` or
-  `-D USE_LINENOISE=1` to your command line.
-* **Vector Copy Elision Level**: Quickstep's vectorized expression-evaluation
-  system can be configured to build extra code that helps avoid making
-  intermediate copies of data, at the cost of increased code complexity and
-  build times. The `VECTOR_COPY_ELISION_LEVEL` option controls how aggressively
-  copies are avoided, and the default level of `selection` is a good balance
-  between efficiency and build time. `-D VECTOR_COPY_ELISION_LEVEL=none` will
-  build the fastest, while
-  `-D VECTOR_COPY_ELISION_LEVEL=joinwithbinaryexpressions` will compile *all*
-  the optional code and theoretically be the most efficient at runtime. To
-  quote the documentation for this option:
-> This options controls whether extra code paths for vectorized evaluation
-> of expressions and predicates directly on values inside storage blocks
-> without copying into ColumnVectors is enabled. This may improve
-> performance, but causes a combinatorial explosion of templated code to
-> be compiled, which may cause very long builds (especially in Release
-> mode) and very large executables (especially in Debug mode). The
-> valid settings for this option are, in order of increasing code paths:
-> none (attribute values are always copied into ColumnVectors before
-> computing expressions on them), selection (copies are elided for
-> single-relation SELECT operations), join (copies are also elided for
-> expressions in the output of hash joins, but binary expressions will
-> only elide a copy on one side, not both), and joinwithbinaryexpressions
-> (copies are elided for both sides of a binary expression over a join).
-
-* **Predicate Short-Circuiting**: The option
-  `ENABLE_VECTOR_PREDICATE_SHORT_CIRCUIT` can be turned on or off to control
-  how Quickstep evaluates complex predicates. Quoting from the option's
-  documentation:
-> If enabled, vectorized predicate evaluation for conjunctions and
-> disjunctions will keep track of a filter of tuples already known to
-> match or not match the overall predicate to reduce the number of
-> comparisons that actually need to be checked. Otherwise sub-predicates
-> will always be checked for all tuples in a block and their match sets
-> will be intersected/unioned after the fact. Turning this option on is
-> expected to reduce the number of comparisons performed, but it changes
-> the inner loop for predicate evaluation from simply incrementing a
-> tuple_id to scanning for bits set in a filter. Which option performs
-> best is likely to be dependent on the selectivity of sub-predicates for
-> a particular query.
-
-* **Rebuild Indices On Overflow**: If an `UPDATE` query causes an IndexSubBlock
-  to run out of space, it is possible that the index can be made to fit the
-  changed value if it is rebuilt to be more compact. If rebuilding fails or is
-  not attempted, the index will be marked invalid and will not be used. By
-  default, the Quickstep storage engine will always try to rebuild an index if
-  it runs out of space, but this behavior can be disabled by setting
-  `-D REBUILD_INDEX_ON_UPDATE_OVERFLOW=0`.
-* **Building With libc++**: The Clang compiler is usually used with the
-  system-default C++ standard library (on most Linux systems, this is GNU
-  libstdc++, which is packaged with GCC). Clang can also be used with the LLVM
-  project's own C++ standard library implementation libc++ (in fact, recent
-  versions of FreeBSD and Mac OS X use libc++ as the system default C++
-  standard library). If you are using Clang on a system that has libc++
-  installed but doesn't use it by default, add `-D USE_LIBCXX=1` to make
-  Clang use libc++.
-* **Link-Time Optimization**: Some compilers support link-time optimization,
-  where all the objects linked into an executable are analyzed and optimized
-  together as if they were a single translation unit. This potentially enables
-  some optimizations that might not otherwise be possible, but LTO requires a
-  *lot* of processing time and a fair amount of RAM. LTO can be turned on for
-  release builds with GCC or ICC by doing `-D ENABLE_LTO=1`. Be aware that the
-  build may take a very long time.
-
-Building
---------
-
-Once cmake finishes, you are ready to actually build quickstep by running
-`make` (or `nmake` on Windows) (this will also build bundled third-party
-libraries as necesary). If you want to see the actual commands that make is
-running, you can do `make VERBOSE=1`. It is highly recommended to do a parallel
-make to speed up the build time, which you can do with `make -jX`, where X is
-the number of parallel jobs (the number of CPU cores on your system is a good
-choice, unless you are low on RAM, in which case you may want to reduce the
-number of jobs).
-
-Running Quickstep
------------------
-
-To use quickstep, just run `quickstep_cli_shell` in the build directory. For the
-first time user, run once with `-initialize_db=true` to set up an empty catalog.
-Quickstep has number of command-line flags that control its behavior. Run
-`quickstep_cli_shell --help` to see a listing of the options and how to use
-them.
-
-Running Tests
--------------
-
-Quickstep comes with an extensive suite of unit tests. After a successful
-build, you can run the whole test suite by doing `make test` or `ctest`. If
-you use `ctest`, you may also run tests in parallel with `ctest -jX`, where
-X is the number of parallel jobs (as with `make`, your number of CPU cores is
-usually a good choice).

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/CMakeLists.txt b/CMakeLists.txt
deleted file mode 100644
index 126b47b..0000000
--- a/CMakeLists.txt
+++ /dev/null
@@ -1,784 +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.
-
-cmake_minimum_required (VERSION 2.8.6)
-project (QUICKSTEP)
-
-set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
-
-include(CheckCCompilerFlag)
-include(CheckCXXCompilerFlag)
-include(CheckCXXSourceCompiles)
-
-if (WIN32)
-  # Make Windows compilers shut up about using standard libc functions.
-  set_property(
-    DIRECTORY
-    APPEND PROPERTY COMPILE_DEFINITIONS _CRT_SECURE_NO_WARNINGS
-  )
-endif()
-
-include(CheckIncludeFiles)
-check_include_files(
-    "termios.h;unistd.h;stdlib.h;stdio.h;errno.h;string.h;stdlib.h;ctype.h;sys/types.h;sys/ioctl.h;unistd.h"
-    HAVE_LINENOISE_HEADERS)
-if (HAVE_LINENOISE_HEADERS)
-  option(USE_LINENOISE "Use linenoise command-line editing library" ON)
-else()
-  option(USE_LINENOISE "Use linenoise command-line editing library" OFF)
-endif()
-
-check_include_files("hdfs/hdfs.h" HAVE_LIBHDFS3_HEADERS)
-if (HAVE_LIBHDFS3_HEADERS)
-  option(ENABLE_HDFS "Enable HDFS FileManager" ON)
-else()
-  option(ENABLE_HDFS "Enable HDFS FileManager" OFF)
-endif()
-
-if (UNIX AND NOT CYGWIN)
-  option(USE_TCMALLOC "Use tcmalloc (Google's thread-cacheing malloc) instead of system-provided malloc" ON)
-else()
-  option(USE_TCMALLOC "Use tcmalloc (Google's thread-cacheing malloc) instead of system-provided malloc" OFF)
-endif()
-
-# Option to enable/disable LTO.
-option(ENABLE_LTO "Enable LTO (Link Time Optimization), if the compiler supports it." OFF)
-
-set(VECTOR_COPY_ELISION_MSG_LIST
-    "This options controls whether extra code paths for vectorized evaluation "
-    "of expressions and predicates directly on values inside storage blocks "
-    "without copying into ColumnVectors is enabled. This may improve "
-    "performance, but causes a combinatorial explosion of templated code to "
-    "be compiled, which may cause very long builds (especially in Release "
-    "mode) and very large executables (especially in Debug mode). The "
-    "valid settings for this option are, in order of increasing code paths: "
-    "none (attribute values are always copied into ColumnVectors before "
-    "computing expressions on them), selection (copies are elided for "
-    "single-relation SELECT operations), join (copies are also elided for "
-    "expressions in the output of hash joins, but binary expressions will "
-    "only elide a copy on one side, not both), and joinwithbinaryexpressions "
-    "(copies are elided for both sides of a binary expression over a join).")
-string(REPLACE ";" "" VECTOR_COPY_ELISION_MSG ${VECTOR_COPY_ELISION_MSG_LIST})
-
-set(VECTOR_COPY_ELISION_LEVEL "selection" CACHE STRING ${VECTOR_COPY_ELISION_MSG})
-set_property(CACHE VECTOR_COPY_ELISION_LEVEL PROPERTY STRINGS none selection join joinwithbinaryexpressions)
-
-if (${VECTOR_COPY_ELISION_LEVEL} STREQUAL "none")
-  message("Vector copy elision level set to: none")
-elseif(${VECTOR_COPY_ELISION_LEVEL} STREQUAL "selection")
-  message("Vector copy elision level set to: single-relation selection")
-  set_property(
-    DIRECTORY
-    APPEND PROPERTY COMPILE_DEFINITIONS QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_SELECTION
-  )
-elseif(${VECTOR_COPY_ELISION_LEVEL} STREQUAL "join")
-  message("Vector copy elision level set to: joins (limited to one side of binary expressions)")
-  set_property(
-    DIRECTORY
-    APPEND PROPERTY COMPILE_DEFINITIONS QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_SELECTION
-  )
-  set_property(
-    DIRECTORY
-    APPEND PROPERTY COMPILE_DEFINITIONS QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_JOIN
-  )
-elseif(${VECTOR_COPY_ELISION_LEVEL} STREQUAL "joinwithbinaryexpressions")
-  message("Vector copy elision level set to: joins (including binary expressions)")
-  set_property(
-    DIRECTORY
-    APPEND PROPERTY COMPILE_DEFINITIONS QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_SELECTION
-  )
-  set_property(
-    DIRECTORY
-    APPEND PROPERTY COMPILE_DEFINITIONS QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_JOIN
-  )
-  set_property(
-    DIRECTORY
-    APPEND PROPERTY COMPILE_DEFINITIONS QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_JOIN_WITH_BINARY_EXPRESSIONS
-  )
-else()
-  message(
-      FATAL_ERROR
-      "Unknown value for VECTOR_COPY_ELISION_LEVEL. Valid choices are: none, selection, join, joinwithbinaryexpressions")
-endif()
-
-# TODO(chasseur): There are some interesting performance experiments we could
-# do with short-circuiting turned on and off. We could even make it selective
-# based on the density of the filter bitmap.
-set(VECTOR_PREDICATE_SHORT_CIRCUIT_MSG_LIST
-    "If enabled, vectorized predicate evaluation for conjunctions and "
-    "disjunctions will keep track of a filter of tuples already known to "
-    "match or not match the overall predicate to reduce the number of "
-    "comparisons that actually need to be checked. Otherwise sub-predicates "
-    "will always be checked for all tuples in a block and their match sets "
-    "will be intersected/unioned after the fact. Turning this option on is "
-    "expected to reduce the number of comparisons performed, but it changes "
-    "the inner loop for predicate evaluation from simply incrementing a "
-    "tuple_id to scanning for bits set in a filter. Which option performs "
-    "best is likely to be dependent on the selectivity of sub-predicates for "
-    "a particular query.")
-string(REPLACE ";" "" VECTOR_PREDICATE_SHORT_CIRCUIT_MSG ${VECTOR_PREDICATE_SHORT_CIRCUIT_MSG_LIST})
-option(ENABLE_VECTOR_PREDICATE_SHORT_CIRCUIT ${VECTOR_PREDICATE_SHORT_CIRCUIT_MSG} ON)
-if (ENABLE_VECTOR_PREDICATE_SHORT_CIRCUIT)
-  set_property(
-    DIRECTORY
-    APPEND PROPERTY COMPILE_DEFINITIONS QUICKSTEP_ENABLE_VECTOR_PREDICATE_SHORT_CIRCUIT
-  )
-endif()
-
-option(ENABLE_DISTRIBUTED "Use the distributed version of Quickstep" OFF)
-
-if (BUILD_SHARED_LIBS)
-  set(GFLAGS_LIB_NAME gflags_nothreads-shared)
-else()
-  set(GFLAGS_LIB_NAME gflags_nothreads-static)
-endif()
-
-# Turn on the QUICKSTEP_DEBUG flag in the source if this is a debug build.
-if (CMAKE_MAJOR_VERSION GREATER 2)
-  cmake_policy(SET CMP0043 NEW)
-  set_property(
-    DIRECTORY
-    APPEND PROPERTY COMPILE_DEFINITIONS $<$<CONFIG:Debug>:QUICKSTEP_DEBUG>
-  )
-else()
-  set_property(
-    DIRECTORY
-    APPEND PROPERTY COMPILE_DEFINITIONS_DEBUG QUICKSTEP_DEBUG
-  )
-endif()
-
-# Include Google Perftools CPU Profiler. You probably want to
-# use this option with CMAKE_BUILD_TYPE=RelWithDebInfo.
-# Pass profiler_file_name to quickstep_cli_shell to actually
-# run the profiler. The profiler only starts collecting
-# samples after the first query, so that it runs against a
-# warm buffer pool and caches. If you want to profile everything,
-# including the first query run, set the environment variable
-# CPUPROFILE instead of passing the flag profile_file_name
-# Use google-pprof on the output file to convert it into a useful
-# format like graphviz (dot).
-option(ENABLE_GOOGLE_PROFILER "Include Google Perftools CPU Profiler." OFF)
-
-if (ENABLE_GOOGLE_PROFILER)
-  set_property(
-    DIRECTORY
-    APPEND PROPERTY COMPILE_DEFINITIONS QUICKSTEP_ENABLE_PROFILER
-  )
-
-  # TODO(navsan) Add a FindGperftools.cmake module and use that here.
-  check_include_files("gperftools/profiler.h" HAVE_GPERFTOOLS_PROFILER)
-  if (NOT HAVE_GPERFTOOLS_PROFILER)
-    message(FATAL_ERROR "Could not find gperftools. Ensure that it is installed.")
-  endif()
-  set(LIBS ${LIBS} profiler)
-endif()
-
-# Link against the system's threading library.
-find_package(Threads REQUIRED)
-set(LIBS ${LIBS} ${CMAKE_THREAD_LIBS_INIT})
-set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
-
-# Link with libnuma library if it's present
-find_package(LibNuma)
-if(LIBNUMA_FOUND)
-  include_directories(${LIBNUMA_INCLUDE_DIR})
-endif()
-
-# Enable C++14 support.
-set(CPP14_SUPPORTED FALSE)
-include(CheckCXXSourceCompiles)
-if(NOT CPP14_SUPPORTED)
-  if (MSVC_VERSION GREATER 1899)
-    message("Your C++ compiler appears to be Microsoft Visual Studio 2015 or "
-            "better, which supports C++14 by default.")
-    set(CPP14_SUPPORTED TRUE)
-  endif()
-endif()
-if (NOT CPP14_SUPPORTED)
-  CHECK_CXX_COMPILER_FLAG("-std=c++14" CXX_COMPILER_SUPPORTS_CPP14)
-  if (CXX_COMPILER_SUPPORTS_CPP14)
-    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
-    set(CPP14_SUPPORTED TRUE)
-  endif()
-endif()
-if (NOT CPP14_SUPPORTED)
-  CHECK_CXX_COMPILER_FLAG("-std=c++1y" CXX_COMPILER_SUPPORTS_CPP1Y)
-  if (CXX_COMPILER_SUPPORTS_CPP1Y)
-    message(WARNING "Your C++ compiler appears to support pre-standardized "
-                    "C++14 (AKA C++1y). Quickstep may fail to build if your "
-                    "compiler and standard library are not sufficiently C++14 "
-                    "compliant.")
-    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1y")
-    set(CPP14_SUPPORTED TRUE)
-  endif()
-endif()
-if (NOT CPP14_SUPPORTED)
-  CHECK_CXX_COMPILER_FLAG("-std=c++11" CXX_COMPILER_SUPPORTS_CPP11)
-  if (CXX_COMPILER_SUPPORTS_CPP11)
-    message(WARNING "Your C++ compiler appears to support C++11, but does not "
-                    "have flags to enable C++14 support. Quickstep may fail "
-                    "to build if your compiler and standard library are not "
-                    "sufficiently C++14 compliant.")
-    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
-    set(CPP14_SUPPORTED TRUE)
-  endif()
-endif()
-if (NOT CPP14_SUPPORTED)
-  CHECK_CXX_COMPILER_FLAG("-std=c++0x" CXX_COMPILER_SUPPORTS_CPP0X)
-  if (CXX_COMPILER_SUPPORTS_CPP0X)
-    message(WARNING "Your C++ compiler appears to only support "
-                    "pre-standardized C++0X (eventually ratified as C++11). "
-                    "Quickstep requires C++14 support, and the build is "
-                    "likely to fail if your compiler and standard library are "
-                    "not sufficiently C++14 compliant.")
-    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
-    set(CPP14_SUPPORTED TRUE)
-  endif()
-endif()
-if (NOT CPP14_SUPPORTED)
-  message (WARNING "Could not find flags to enable C++14 or C++11 support for "
-                   "your compiler. If your compiler does not support C++14 by "
-                   "default, Quickstep will fail to build.")
-endif()
-
-# Also define _ISOC11_SOURCE, which turns on C library declarations from C11.
-set_property(
-  DIRECTORY
-  APPEND PROPERTY COMPILE_DEFINITIONS _ISOC11_SOURCE
-)
-
-# Enable all warnings.
-if (MSVC)
-  CHECK_CXX_COMPILER_FLAG("/W3" MSVC_HAS_W3)
-  if (MSVC_HAS_W3)
-    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W3")
-  endif()
-else()
-  CHECK_CXX_COMPILER_FLAG("-Wall" COMPILER_HAS_WALL)
-  if (COMPILER_HAS_WALL)
-    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
-  endif()
-  CHECK_CXX_COMPILER_FLAG("-pedantic" COMPILER_HAS_PEDANTIC)
-  if (COMPILER_HAS_PEDANTIC)
-    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic")
-  endif()
-
-  # Treat warnings as errors, 'cause we hardcore.
-  CHECK_CXX_COMPILER_FLAG("-Werror" COMPILER_HAS_WERROR)
-  if (COMPILER_HAS_WERROR)
-    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
-  endif()
-
-  # Clang reports such warning when using Protoc 3.0 beta.
-  if(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
-    CHECK_CXX_COMPILER_FLAG("-Wno-extended-offsetof" COMPILER_HAS_WNO_EXTENDED_OFFSETOF)
-    if (COMPILER_HAS_WNO_EXTENDED_OFFSETOF)
-      set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-extended-offsetof")
-    endif()
-  endif()
-
-  # One of the protobuf headers includes a nested anonymous union within
-  # another anonymous type. Ordinarily we work around this by compiling the
-  # protobuf libraries themselves with "-Wno-nested-anon-types" and including
-  # the protobuf headers as "system" headers so that the compiler automatically
-  # suppresses warnings originating from them. XCode does not honor the
-  # system-include setting, however, so we must instead suppress the warnings
-  # with global CXXFLAGS for the project.
-  #
-  # TODO(chasseur): Once protobuf 3.0 has a stable release and Quickstep has
-  # upgraded, remove this workaround.
-  if (${CMAKE_GENERATOR} MATCHES "Xcode")
-    CHECK_CXX_COMPILER_FLAG("-Wno-nested-anon-types" XCODE_HAS_WNO_NESTED_ANON_TYPES)
-    if (XCODE_HAS_WNO_NESTED_ANON_TYPES)
-      set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-nested-anon-types")
-    endif()
-  endif()
-endif()
-
-# Option to use LLVM's libc++ even if it is not the default C++ standard
-# library on this platform.
-#
-# NOTE(chasseur): clang is the default compiler and libc++ is the default
-# standard library on recent versions of FreeBSD and Mac OS X. On some other
-# OSes (e.g. most Linux distributions), clang will compile against the
-# platform's default C++ library (e.g. GNU libstdc++) instead for reasons of
-# ABI/linking compatibility. This option allows us to override that behavior if
-# we want to.
-option(USE_LIBCXX "Use LLVM's libc++ instead of the default C++ standard library" OFF)
-if (USE_LIBCXX)
-  CHECK_CXX_COMPILER_FLAG("-stdlib=libc++" CXX_COMPILER_HAS_LIBCXX)
-  if (NOT CXX_COMPILER_HAS_LIBCXX)
-    message(FATAL_ERROR "USE_LIBCXX is set to ON, but compiler doesn't allow "
-                        "-stdlib=libc++ (are you using some compiler other "
-                        "than clang++?)")
-  endif()
-
-  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
-  set(THIRD_PARTY_CXX_FLAGS "${THIRD_PARTY_CXX_FLAGS} -stdlib=libc++")
-
-  # Check that a minimal program compiles and links. Clang will accept the
-  # command-line flag for libc++ even if the library isn't actually installed.
-  CHECK_CXX_SOURCE_COMPILES("
-    #include <string>
-    #include <iostream>
-
-    int main() {
-      std::string msg(\"hello world\");
-      std::cout << msg;
-      return 0;
-    }" LIBCXX_CHECK)
-    if (NOT LIBCXX_CHECK)
-      message(FATAL_ERROR "Compiler accepts -stdlib=libc++ flag, but cannot "
-                          "compile programs when it is turned on.")
-    endif()
-endif()
-
-if(CMAKE_COMPILER_IS_GNUCXX)
-  # Optimization flags for GCC.
-
-  # Strip binaries for release builds, except on Mac OS X, where this confuses
-  # the linker.
-  if (NOT (${CMAKE_SYSTEM_NAME} MATCHES "Darwin"))
-    set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -s")
-    set(CMAKE_EXE_LINKER_FLAGS_MINSIZEREL "${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL} -s")
-  endif()
-
-  # If using tcmalloc, prevent GCC from optimizing for builtin malloc and friends.
-  if(USE_TCMALLOC)
-    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free")
-  endif()
-
-  # Automatically optimize for host processor.
-  CHECK_CXX_COMPILER_FLAG("-march=native" GCC_HAS_MARCH_NATIVE)
-  if (GCC_HAS_MARCH_NATIVE)
-    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native")
-  endif()
-
-  # On 32-bit x86, GCC defaults to using i387 (not a typo) for floating-point
-  # math. This is slower than SSE, and also uses 80-bit temporaries that don't
-  # correspond to any of the IEEE 754 floating-point formats, so that rounding
-  # errors may be introduced relative to FPUs that do math in a normal IEEE 754
-  # encoding. Using SSE is preferable for both performance and correctness, so
-  # we enable it here.
-  if ((CMAKE_SIZEOF_VOID_P EQUAL 4)
-      AND ((CMAKE_SYSTEM_PROCESSOR MATCHES "[0-6x]86")
-           OR (CMAKE_SYSTEM_PROCESSOR MATCHES "amd64")))
-    CHECK_CXX_COMPILER_FLAG("-mfpmath=sse" GCC_HAS_MFPMATH_SSE)
-    if (GCC_HAS_MFPMATH_SSE)
-      set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfpmath=sse")
-    endif()
-  endif()
-
-  # Loop-transformation optimizations that aren't turned on by -O3
-  CHECK_CXX_COMPILER_FLAG("-ftree-loop-linear" GCC_HAS_FTREE_LOOP_LINEAR)
-  if (GCC_HAS_FTREE_LOOP_LINEAR)
-    set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -ftree-loop-linear")
-    set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -ftree-loop-linear")
-    set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} -ftree-loop-linear")
-  endif()
-
-  CHECK_CXX_COMPILER_FLAG("-ftree-loop-distribution" GCC_HAS_FTREE_LOOP_DISTRIBUTION)
-  if (GCC_HAS_FTREE_LOOP_DISTRIBUTION)
-    set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -ftree-loop-distribution")
-    set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -ftree-loop-distribution")
-    set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} -ftree-loop-distribution")
-  endif()
-
-  CHECK_CXX_COMPILER_FLAG("-floop-strip-mine" GCC_HAS_FLOOP_STRIP_MINE)
-  if (GCC_HAS_FLOOP_STRIP_MINE)
-    set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -floop-strip-mine")
-    set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -floop-strip-mine")
-    set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} -floop-strip-mine")
-  endif()
-
-  CHECK_CXX_COMPILER_FLAG("-floop-block" GCC_HAS_FLOOP_BLOCK)
-  if (GCC_HAS_FLOOP_BLOCK)
-    set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -floop-block")
-    set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -floop-block")
-    set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} -floop-block")
-  endif()
-
-  if (ENABLE_LTO)
-    # If GCC supports inter-procedural (link-time) optimizations, turn them on.
-    CHECK_CXX_COMPILER_FLAG("-flto" GCC_HAS_FLTO)
-    if (GCC_HAS_FLTO)
-      if(CMAKE_COMPILER_IS_GNUC)
-        set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -flto")
-        set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -flto")
-        set(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL} -flto")
-      endif()
-
-      set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -flto")
-      set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -flto")
-      set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} -flto")
-
-      set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -flto")
-      set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO} -flto")
-      set(CMAKE_EXE_LINKER_FLAGS_MINSIZEREL "${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL} -flto")
-    endif()
-  endif()
-elseif(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
-  # Optimization flags for Clang.
-
-  # Strip binaries for release builds, except on Mac OS X, where this confuses
-  # the linker.
-  if (NOT (${CMAKE_SYSTEM_NAME} MATCHES "Darwin"))
-    set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -s")
-    set(CMAKE_EXE_LINKER_FLAGS_MINSIZEREL "${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL} -s")
-  endif()
-
-  # Automatically optimize for host processor.
-  CHECK_CXX_COMPILER_FLAG("-march=native" CLANG_HAS_MARCH_NATIVE)
-  if(CLANG_HAS_MARCH_NATIVE)
-    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native")
-  endif()
-#  Getting LTO to work with clang is a bit of a nightmare because of linker and ar dependencies, so it's not enabled.
-#  set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O4")
-#  set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -O4")
-#  set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} -Os")
-elseif(${CMAKE_CXX_COMPILER_ID} MATCHES "Intel")
-  # Optimization flags for the Intel C++ compiler.
-  if (WIN32)
-    # /fast implies /O3 /Qipo /no-prec-div
-    # /QxHost automatically optimizes for host processor.
-    set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /fast /QxHost")
-    set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /fast /QxHost")
-    set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} /QxHost")
-  else()
-    set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -xHost")
-    set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -no-prec-div")
-    set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -no-prec-div")
-
-    if (ENABLE_LTO)
-      # Inter-procedural optimization requires using Intel's xiar tool instead
-      # of vanilla ar.
-      find_program(XIAR xiar)
-      if(XIAR)
-        set(CMAKE_AR "${XIAR}")
-
-        set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -ipo")
-        set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -ipo")
-      else()
-        message(WARNING "Could not find Intel xiar tool, so turning OFF inter-procedural "
-                        "optimizations for release builds.")
-      endif()
-    endif()
-
-  endif()
-elseif(MSVC)
-  # Microsoft Visual studio.
-  # Work around variadic template bug.
-  add_definitions( /D _VARIADIC_MAX=10 )
-endif()
-
-# Set the include directories to the project root directory and the root of the build tree (where
-# generated headers will go).
-include_directories(${PROJECT_SOURCE_DIR})
-include_directories(${CMAKE_CURRENT_BINARY_DIR})
-
-# Setup for third-party libs.
-#
-# NOTE(chasseur): If USE_LIBCXX is on, we should assume that we need to build
-# external third-party C++ libraries ourselves even if they are installed on
-# the system, because they may be linked against a different C++ standard
-# library (e.g. GNU libstdc++) that is not ABI-compatible. This applies only to
-# C++ libraries; pure C libraries should have no such issue.
-set(THIRD_PARTY_SOURCE_DIR "${PROJECT_SOURCE_DIR}/third_party")
-include(ExternalProject)
-
-if(USE_TCMALLOC)
-  if(WIN32)
-    message(FATAL_ERROR "You are building with tcmalloc on Windows. Our build system can not yet "
-                        "produce tcmalloc on Windows (and the tcmalloc port for Windows is "
-                        "incomplete anyway). You should use the system-provided malloc instead "
-                        "(invoke cmake with \"-D USE_TCMALLOC=0\").")
-  elseif(NOT UNIX)
-    message(WARNING "Your system does not appear to be UNIX or Windows, but you are building with "
-                    "tcmalloc. This is quite likely to fail, in which case you should use the "
-                    "system-provided malloc instead (invoke cmake with \"-D USE_TCMALLOC=0\").")
-  elseif(CYGWIN)
-    message(WARNING "You are building with tcmalloc on Windows. For many configurations, this is "
-                    "not stable. If you experience build errors, or runtime hangs/crashes, you "
-                    "should use the system-provided malloc instead (invoke cmake with "
-                    "\"-D USE_TCMALLOC=0\").")
-  endif()
-
-  # Build tcmalloc as a cmake ExternalProject.
-  ExternalProject_Add(
-    libtcmalloc_ext
-    PREFIX ${CMAKE_CURRENT_BINARY_DIR}/third_party/gperftools
-    SOURCE_DIR ${THIRD_PARTY_SOURCE_DIR}/gperftools
-    CONFIGURE_COMMAND <SOURCE_DIR>/configure
-        --prefix=<INSTALL_DIR>
-        --enable-minimal
-        --disable-debugalloc
-        CC=${CMAKE_C_COMPILER}
-        CXX=${CMAKE_CXX_COMPILER}
-        CFLAGS=${THIRD_PARTY_C_FLAGS}
-        CXXFLAGS=${THIRD_PARTY_CXX_FLAGS}
-    BUILD_COMMAND make
-    BUILD_IN_SOURCE 0
-    # Uncomment the next line to change the path of the build by products
-    #   as some generators, e.g. Ninja, may need it to build properly
-    # BUILD_BYPRODUCTS <INSTALL_DIR>/lib/libtcmalloc_minimal.a
-  )
-  if (BUILD_SHARED_LIBS)
-    add_library(libtcmalloc_minimal SHARED IMPORTED)
-    set_property(TARGET libtcmalloc_minimal PROPERTY IMPORTED_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/third_party/gperftools/lib/libtcmalloc_minimal.so)
-  else()
-    add_library(libtcmalloc_minimal STATIC IMPORTED)
-    set_property(TARGET libtcmalloc_minimal PROPERTY IMPORTED_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/third_party/gperftools/lib/libtcmalloc_minimal.a)
-  endif()
-  # Linking against tcmalloc also requires linking against the system threading
-  # library.
-  set_property(TARGET libtcmalloc_minimal PROPERTY IMPORTED_LINK_INTERFACE_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})
-  add_dependencies(libtcmalloc_minimal libtcmalloc_ext)
-  set(LIBS ${LIBS} libtcmalloc_minimal)
-
-  # With tcmalloc enabled, utility/Alignment.hpp includes tcmalloc.h, which can
-  # trigger a compiler warning about the linkage of the tc_mallinfo() function.
-  # This supresses that warning.
-  CHECK_CXX_COMPILER_FLAG("-Wno-return-type-c-linkage"
-                          COMPILER_HAS_WNO_RETURN_TYPE_C_LINKAGE)
-  if (COMPILER_HAS_WNO_RETURN_TYPE_C_LINKAGE)
-    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-return-type-c-linkage")
-  endif()
-endif()
-
-# Add Protocol Buffers.
-# First, see if protobufs are already installed on this system (unless
-# USE_LIBCXX is on, in which case we compile ourselves to be safe, in
-# accordance with the above note).
-set(PROTOBUF_GLOBAL_DEPS)
-if (NOT USE_LIBCXX)
-  include(FindProtobuf)
-endif()
-if(NOT PROTOBUF_FOUND)
-  # Build the copy of protobufs in third_party/
-  add_subdirectory("${THIRD_PARTY_SOURCE_DIR}/protobuf_cmake" "${CMAKE_CURRENT_BINARY_DIR}/third_party/protobuf")
-  set(PROTOBUF_FOUND 1)
-  set(PROTOBUF_INCLUDE_DIR "${THIRD_PARTY_SOURCE_DIR}/protobuf/src")
-  set(PROTOBUF_LIBRARY libprotobuf)
-  set(PROTOBUF_GLOBAL_DEPS protoc)
-  set(PROTOBUF_PROTOC_EXECUTABLE protoc)
-endif()
-include_directories(SYSTEM ${PROTOBUF_INCLUDE_DIR})
-
-# This function is partially based on a similar one from FindProtobuf.cmake,
-# but it adds the ability to scan .proto files for imports and automatically
-# set the proper dependencies.
-function(QS_PROTOBUF_GENERATE_CPP SRCS HDRS)
-  if(NOT ARGN)
-    message(SEND_ERROR "Error: QS_PROTOBUF_GENERATE_CPP() called without any proto files")
-    return()
-  endif()
-
-  set(${SRCS})
-  set(${HDRS})
-  foreach(FIL ${ARGN})
-    get_filename_component(ABS_FIL ${FIL} ABSOLUTE)
-    get_filename_component(FIL_WE ${FIL} NAME_WE)
-
-    # Scan for other protos imported in the .proto file.
-    set(PROTO_IMPORT_TARGETS)
-    file(STRINGS ${ABS_FIL} PROTO_SRC)
-    foreach(PROTO_SRC_LINE ${PROTO_SRC})
-      string(REGEX MATCH "import \"(.*)[.]proto\"" TMPMATCH ${PROTO_SRC_LINE})
-      if (CMAKE_MATCH_1)
-        string(REPLACE "/" "_" IMPORTED_PROTO_FLAT "${CMAKE_BINARY_DIR}/${CMAKE_MATCH_1}")
-        string(REPLACE ":" "_" IMPORTED_PROTO_FLAT ${IMPORTED_PROTO_FLAT})
-        list(APPEND PROTO_IMPORT_TARGETS "protoc_${IMPORTED_PROTO_FLAT}")
-      endif()
-    endforeach()
-
-    list(APPEND ${SRCS} "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb.cc")
-    list(APPEND ${HDRS} "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb.h")
-
-    # Note that this adds dependencies for the .proto file itself, as well as
-    # for any proto imports and the protobuf library if we have to build it
-    # ourselves.
-    add_custom_command(
-      OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb.cc"
-             "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb.h"
-      COMMAND  ${PROTOBUF_PROTOC_EXECUTABLE}
-      ARGS --cpp_out  ${CMAKE_BINARY_DIR} -I${PROJECT_SOURCE_DIR} ${ABS_FIL}
-      DEPENDS ${ABS_FIL} ${PROTO_IMPORT_TARGETS} ${PROTOBUF_GLOBAL_DEPS}
-      COMMENT "Running C++ protocol buffer compiler on ${FIL}"
-      VERBATIM)
-
-    # Make a custom global target so that we have something that protos in
-    # other directories can depend on for imports.
-    string(REPLACE "/" "_" PROTOC_TARGET_NAME "protoc_${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}")
-    string(REPLACE ":" "_" PROTOC_TARGET_NAME ${PROTOC_TARGET_NAME})
-    add_custom_target(${PROTOC_TARGET_NAME} DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb.h")
-  endforeach()
-
-  set_source_files_properties(${${SRCS}} ${${HDRS}} PROPERTIES GENERATED TRUE)
-  set(${SRCS} ${${SRCS}} PARENT_SCOPE)
-  set(${HDRS} ${${HDRS}} PARENT_SCOPE)
-endfunction()
-
-# Add gtest unit-testing framework.
-set(gtest_force_shared_crt ON CACHE BOOL "Link gtest against shared DLLs on Windows")
-add_subdirectory ("${THIRD_PARTY_SOURCE_DIR}/googletest/googletest"
-                  "${CMAKE_CURRENT_BINARY_DIR}/third_party/googletest/googletest")
-include_directories(SYSTEM "${THIRD_PARTY_SOURCE_DIR}/googletest/googletest/include")
-enable_testing()
-
-if (UNIX)
-  # Add google/benchmark micro-benchmarking framework.
-  # This does not build in Windows. It builds fine on NetBSD, but produces
-  # executables that always segfault on startup.
-  if (${CMAKE_SYSTEM_NAME} MATCHES "NetBSD")
-    message(WARNING "Building micro-benchmarks on NetBSD using google "
-                    "benchmark library. This will build fine, but as of "
-                    "NetBSD 6.1.5 the micro-benchmark executables always "
-                    "segfault on startup due to a bug in the implementation "
-                    "of c++11 threads on top of NetBSD's pthread library. "
-                    "This issue ONLY affects micro-benchmarks; quickstep "
-                    "itself, as well as unit tests and other utilities are "
-                    "not affected.")
-  endif()
-  add_subdirectory ("${THIRD_PARTY_SOURCE_DIR}/benchmark" "${CMAKE_CURRENT_BINARY_DIR}/third_party/benchmark")
-  include_directories("${THIRD_PARTY_SOURCE_DIR}/benchmark/include")
-endif()
-
-# Add required cmake-controlled third-party libraries (farmhash, gflags, glog, and re2).
-add_subdirectory ("${THIRD_PARTY_SOURCE_DIR}/farmhash" "${CMAKE_CURRENT_BINARY_DIR}/third_party/farmhash")
-
-add_subdirectory ("${THIRD_PARTY_SOURCE_DIR}/gflags" "${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags")
-include_directories("${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include")
-
-add_subdirectory ("${THIRD_PARTY_SOURCE_DIR}/glog" "${CMAKE_CURRENT_BINARY_DIR}/third_party/glog")
-if (WIN32)
-  set_property(
-    DIRECTORY
-    APPEND PROPERTY COMPILE_DEFINITIONS GOOGLE_GLOG_DLL_DECL=
-  )
-  include_directories(${THIRD_PARTY_SOURCE_DIR}/glog/src/windows)
-else()
-  include_directories(${THIRD_PARTY_SOURCE_DIR}/glog/src)
-  include_directories(${CMAKE_CURRENT_BINARY_DIR}/third_party)
-endif()
-
-add_subdirectory ("${THIRD_PARTY_SOURCE_DIR}/re2_cmake" "${CMAKE_CURRENT_BINARY_DIR}/third_party/re2")
-include_directories("${THIRD_PARTY_SOURCE_DIR}/re2")
-
-# Add optional linenoise command-line editing library.
-if (USE_LINENOISE)
-  if (NOT HAVE_LINENOISE_HEADERS)
-    message(WARNING "You are attempting to enable the linenoise command-line "
-                    "editing library, but CMake was unable to find the "
-                    "necessary headers on your system. Your build is likely "
-                    "to fail, in which case you should try again with "
-                    "-D USE_LINENOISE=0")
-  endif()
-  add_subdirectory ("${THIRD_PARTY_SOURCE_DIR}/linenoise" "${CMAKE_CURRENT_BINARY_DIR}/third_party/linenoise")
-endif()
-
-# Add optional libhdfs3 library
-if (ENABLE_HDFS)
-  find_package(Libhdfs3 REQUIRED)
-  include_directories(${LIBHDFS3_INCLUDE_DIR})
-endif()
-
-# Check if the BitWeaving index is included.
-if(EXISTS "${PROJECT_SOURCE_DIR}/storage/bitweaving/BitWeavingIndexSubBlock.hpp")
-  set(QUICKSTEP_HAVE_BITWEAVING TRUE)
-else()
-  set(QUICKSTEP_HAVE_BITWEAVING FALSE)
-endif()
-
-# Add TMB, but only enable the PureMemory implementation.
-set(ENABLE_PUREMEMORY ON CACHE BOOL "Enable PureMemory TMB")
-set(ENABLE_LEVELDB OFF CACHE BOOL "Enable LevelDB TMB")
-set(ENABLE_MEMORYMIRROR OFF CACHE BOOL "Enable MemoryMirror TMB")
-set(ENABLE_NATIVELOG OFF CACHE BOOL "Enable NativeLog TMB")
-
-# The distributed version requires to use the NativeNet implementation.
-if (NOT ENABLE_DISTRIBUTED)
-  set(ENABLE_NATIVENET OFF CACHE BOOL "Enable NativeNet TMB")
-endif()
-
-set(ENABLE ENABLE_SQLITE OFF CACHE BOOL "Enable SQLite TMB")
-set(ENABLE_VOLTDB OFF CACHE BOOL "Enable VoltDB TMB")
-set(ENABLE_ZOOKEEPER OFF CACHE BOOL "Enable Zookeeper TMB")
-
-add_subdirectory("${THIRD_PARTY_SOURCE_DIR}/tmb" "${CMAKE_CURRENT_BINARY_DIR}/third_party/tmb")
-include_directories(${TMB_INCLUDE_DIRS})
-
-if (ENABLE_DISTRIBUTED)
-  include_directories(${CMAKE_CURRENT_BINARY_DIR}/third_party/tmb/include)
-endif()
-
-# Add all of the module subdirectories. CMakeLists.txt in each of the subdirectories
-# defines how to build that module's libraries.
-add_subdirectory(catalog)
-add_subdirectory(cli)
-add_subdirectory(compression)
-add_subdirectory(expressions)
-add_subdirectory(parser)
-add_subdirectory(query_execution)
-add_subdirectory(query_optimizer)
-add_subdirectory(relational_operators)
-add_subdirectory(storage)
-add_subdirectory(threading)
-add_subdirectory(transaction)
-add_subdirectory(types)
-add_subdirectory(utility)
-add_subdirectory(yarn)
-
-# Build the quickstep_cli_shell executable.
-add_executable (quickstep_cli_shell cli/QuickstepCli.cpp)
-# Link against direct deps (will transitively pull in everything needed).
-target_link_libraries(quickstep_cli_shell
-                      ${GFLAGS_LIB_NAME}
-                      glog
-                      quickstep_catalog_CatalogRelation
-                      quickstep_cli_CommandExecutor
-                      quickstep_cli_DefaultsConfigurator
-                      quickstep_cli_DropRelation
-                      quickstep_cli_Flags
-                      quickstep_cli_InputParserUtil
-                      quickstep_cli_LineReader
-                      quickstep_cli_PrintToScreen
-                      quickstep_parser_ParseStatement
-                      quickstep_parser_SqlParserWrapper
-                      quickstep_queryexecution_ForemanSingleNode
-                      quickstep_queryexecution_QueryContext
-                      quickstep_queryexecution_QueryExecutionTypedefs
-                      quickstep_queryexecution_QueryExecutionUtil
-                      quickstep_queryexecution_Worker
-                      quickstep_queryexecution_WorkerDirectory
-                      quickstep_queryoptimizer_QueryHandle
-                      quickstep_queryoptimizer_QueryProcessor
-                      quickstep_storage_PreloaderThread
-                      quickstep_storage_StorageConstants
-                      quickstep_storage_StorageManager
-                      quickstep_threading_ThreadIDBasedMap
-                      quickstep_utility_ExecutionDAGVisualizer
-                      quickstep_utility_Macros
-                      quickstep_utility_PtrVector
-                      quickstep_utility_SqlError
-                      quickstep_utility_StringUtil)
-if (ENABLE_HDFS)
-  target_link_libraries(quickstep_cli_shell
-                        quickstep_storage_FileManagerHdfs)
-endif()
-
-# Link against other required system and third-party libraries.
-target_link_libraries(quickstep_cli_shell ${LIBS})

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/CREDITS.md
----------------------------------------------------------------------
diff --git a/CREDITS.md b/CREDITS.md
deleted file mode 100644
index 353456a..0000000
--- a/CREDITS.md
+++ /dev/null
@@ -1,12 +0,0 @@
-At the time of the intial commit in January 2016, here are the commit stats of the Quickstep committers over the past many years.
-
-| **Committer**   | **# commits**    | **++ lines**      | **-- lines**      |
-| :-------------- |-----------------:|------------------:|------------------:|
-| @craig-chasseur | 1,186            | 1,583,534         | 976,376           |
-| @qiangzeng      | 238              | 248,651           | 52,322            |
-| @hbdeshmukh     | 225              | 32,064            | 15,667            |
-| @shoban         | 218              | 31,260            | 14,219            |
-| @zuyu           | 151              | 24,645            | 14,452            |
-| @adalbertgerald | 120              | 9,319             | 6,315             |
-| @yinanli        | 28               | 1,211             | 493               |
-| @pateljm        | 24               | 724               | 365               |

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/DEV_README.md
----------------------------------------------------------------------
diff --git a/DEV_README.md b/DEV_README.md
deleted file mode 100644
index 04d5d66..0000000
--- a/DEV_README.md
+++ /dev/null
@@ -1,108 +0,0 @@
-# Apache Quickstep (Incubating)
-
-[![Travis Widget]][Travis]
-
-[Travis]: https://travis-ci.org/apache/incubator-quickstep
-[Travis Widget]: https://travis-ci.org/apache/incubator-quickstep.svg?branch=master
-
-Apache Quickstep is an experimental high-performance database engine designed with the
-aim of Data at Bare-Metal Speed. It began life in 2011 as a
-[research project at the University of Wisconsin](https://quickstep.cs.wisc.edu)
-and was acquired by [Pivotal](https://pivotal.io) in 2015.
-Quickstep entered incubation at the
-[Apache Software Foundation](https://www.apache.org) in April, 2016.
-
-## Getting Started (Building)
-
-A [build guide](BUILDING.md) is available which includes instructions for
-building Quickstep for the first time. You may also find it useful to use one
-of the [pre-made Vagrant boxes](build/vagrant) for Quickstep that are already
-set up with all of the development tools needed to build Quickstep.
-
-## Documentation
-
-All publicly-visible classes and functions in the Quickstep code base have
-Doxygen documentation. Simply run `doxygen` in the root of the Quickstep source
-to generate browsable HTML documentation. Of course, the Doxygen comments
-should also be useful when reading header files directly.
-
-In addition to the Doxygen and inline code comments explaining implementation
-details, a high-level overview for each module that comprises Quickstep is
-included in the README files in each subdirectory.
-
-## Architectural Overview
-
-Quickstep is composed of several different modules that handle different
-concerns of a database system. The main modules are:
-
-* [Utility](utility) - Reusable general-purpose code that is used by many
-  other modules.
-* [Threading](threading) - Provides a cross-platform abstraction for threads
-  and synchronization primitives that abstracts the underlying OS threading
-  features.
-* [Types](types) - The core type system used across all of Quickstep. Handles
-  details of how SQL types are stored, parsed, serialized & deserialized, and
-  converted. Also includes basic containers for typed values (tuples and
-  column-vectors) and low-level operations that apply to typed values (e.g.
-  basic arithmetic and comparisons).
-* [Catalog](catalog) - Keeps track of database schema as well as physical
-  storage information for relations (e.g. which physical blocks store a
-  relation's data, and any physical partitioning and placement information).
-* [Storage](storage) - Handles the physical storage of relation data in
-  self-contained, self-describing blocks, both in-memory and on persistent
-  storage (disk or a distributed filesystem). Also includes some heavyweight
-  run-time data structures used in query processing (e.g. hash tables for join
-  and aggregation). Includes a buffer manager component for managing memory
-  use and a file manager component that handles data persistence.
-* [Compression](compression) - A simple implementation of ordered dictionary
-  compression. Several storage formats in the Storage module are capable of
-  storing compressed column data and evaluating some expressions directly on
-  compressed data without decompressing. The common code supporting compression
-  is in this module.
-* [Expressions](expressions) - This module builds on the simple operations
-  provided by the Types module to support arbitrarily complex expressions over
-  data, including scalar expressions, predicates, and aggregate functions with
-  and without grouping.
-* [Relational Operators](relational_operators) - This module provides the
-  building blocks for queries in Quickstep. A query is represented as a
-  directed acyclic graph of relational operators, each of which is responsible
-  for applying some relational-algebraic operation(s) to tranform its input.
-  Operators generate individual self-contained "work orders" that can be
-  executed independently. Most operators are parallelism-friendly and generate
-  one work-order per storage block of input.
-* [Query Execution](query_execution) - Handles the actual scheduling and
-  execution of work from a query at runtime. The central class is the Foreman,
-  an independent thread with a global view of the query plan and progress. The
-  Foreman dispatches work-orders to stateless Worker threads and monitors their
-  progress, and also coordinates streaming of partial results between producers
-  and consumers in a query plan DAG to maximize parallelism. This module also
-  includes the QueryContext class, which holds global shared state for an
-  individual query and is designed to support easy
-  serialization/deserialization for distributed execution.
-* [Parser](parser) - A simple SQL lexer and parser that parses SQL syntax into
-  an abstract syntax tree for consumption by the Query Optimizer.
-* [Query Optimizer](query_optimizer) - Takes the abstract syntax tree generated
-  by the parser and transforms it into a runable query-plan DAG for the Query
-  Execution module. The Query Optimizer is responsible for resolving references
-  to relations and attributes in the query, checking it for semantic
-  correctness, and applying optimizations (e.g. filter pushdown, column
-  pruning, join ordering) as part of the transformation process.
-* [Command-Line Interface](cli) - An interactive SQL shell interface to
-  Quickstep.
-
-## Licensing
-
-Quickstep is licensed under the Apache License, Version 2.0. See [LICENSE](https://github.com/pivotalsoftware/quickstep/blob/master/LICENSE) for the full license text.
-
-## Disclaimer
-Apache Quickstep is an effort undergoing incubation at the Apache Software
-Foundation (ASF), sponsored by the Apache Incubator PMC.
-
-Incubation is required of all newly accepted projects until a further
-review indicates that the infrastructure, communications, and decision
-making process have stabilized in a manner consistent with other
-successful ASF projects.
-
-While incubation status is not necessarily a reflection of the
-completeness or stability of the code, it does indicate that the
-project has yet to be fully endorsed by the ASF.

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/DISCLAIMER
----------------------------------------------------------------------
diff --git a/DISCLAIMER b/DISCLAIMER
deleted file mode 100644
index 09d629d..0000000
--- a/DISCLAIMER
+++ /dev/null
@@ -1,11 +0,0 @@
-Apache Quickstep is an effort undergoing incubation at the Apache Software
-Foundation (ASF), sponsored by the Apache Incubator PMC.
-
-Incubation is required of all newly accepted projects until a further
-review indicates that the infrastructure, communications, and decision
-making process have stabilized in a manner consistent with other
-successful ASF projects.
-
-While incubation status is not necessarily a reflection of the
-completeness or stability of the code, it does indicate that the
-project has yet to be fully endorsed by the ASF.


[12/51] [abbrv] [partial] incubator-quickstep git commit: remove c++ files

Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/QueryProcessor.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/QueryProcessor.cpp b/query_optimizer/QueryProcessor.cpp
deleted file mode 100644
index d74eeba..0000000
--- a/query_optimizer/QueryProcessor.cpp
+++ /dev/null
@@ -1,79 +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/QueryProcessor.hpp"
-
-#include <fstream>
-#include <memory>
-#include <string>
-
-#include "catalog/Catalog.hpp"
-#include "catalog/Catalog.pb.h"
-#include "query_optimizer/Optimizer.hpp"
-#include "query_optimizer/OptimizerContext.hpp"
-
-using std::ifstream;
-using std::ofstream;
-
-namespace quickstep {
-
-void QueryProcessor::generateQueryHandle(const ParseStatement &statement,
-                                         QueryHandle *query_handle) {
-  optimizer::OptimizerContext optimizer_context;
-
-  optimizer_.generateQueryHandle(statement, getDefaultDatabase(), &optimizer_context, query_handle);
-
-  if (optimizer_context.is_catalog_changed() && !catalog_altered_) {
-    catalog_altered_ = true;
-  }
-
-  ++query_id_;
-}
-
-void QueryProcessor::saveCatalog() {
-  if (catalog_altered_) {
-    ofstream catalog_file(catalog_filename_.c_str());
-
-    if (!catalog_->getProto().SerializeToOstream(&catalog_file)) {
-      throw UnableToWriteCatalog(catalog_filename_);
-    }
-
-    catalog_file.close();
-
-    catalog_altered_ = false;
-  }
-}
-
-void QueryProcessor::loadCatalog() {
-  ifstream catalog_file(catalog_filename_.c_str());
-  if (!catalog_file.good()) {
-    throw UnableToReadCatalog(catalog_filename_);
-  }
-
-  serialization::Catalog catalog_proto;
-  if (!catalog_proto.ParseFromIstream(&catalog_file)) {
-    throw CatalogNotProto(catalog_filename_);
-  }
-  catalog_file.close();
-  catalog_ = std::make_unique<Catalog>(catalog_proto);
-
-  catalog_altered_ = false;
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/QueryProcessor.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/QueryProcessor.hpp b/query_optimizer/QueryProcessor.hpp
deleted file mode 100644
index 2b39b84..0000000
--- a/query_optimizer/QueryProcessor.hpp
+++ /dev/null
@@ -1,204 +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_QUERY_PROCESSOR_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_QUERY_PROCESSOR_HPP_
-
-#include <cstddef>
-#include <exception>
-#include <memory>
-#include <string>
-#include <utility>
-
-#include "catalog/Catalog.hpp"
-#include "query_optimizer/Optimizer.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-
-class CatalogDatabase;
-class ParseStatement;
-class QueryHandle;
-
-/** \addtogroup QueryOptimizer
- *  @{
- */
-
-/**
- * @brief Exception thrown when unable to read the catalog from disk.
- **/
-class UnableToReadCatalog : public std::exception {
- public:
-  /**
-   * @brief Constructor.
-   *
-   * @param filename The catalog filename provided.
-   **/
-  explicit UnableToReadCatalog(const std::string &filename)
-      : message_("UnableToReadCatalog: Unable to read catalog from file ") {
-    message_.append(filename);
-  }
-
-  ~UnableToReadCatalog() throw() {
-  }
-
-  virtual const char* what() const throw() {
-    return message_.c_str();
-  }
-
- private:
-  std::string message_;
-};
-
-/**
- * @brief Exception thrown when unable to write the catalog to disk.
- **/
-class UnableToWriteCatalog : public std::exception {
- public:
-  /**
-   * @brief Constructor.
-   *
-   * @param filename The catalog filename provided.
-   **/
-  explicit UnableToWriteCatalog(const std::string &filename)
-      : message_("UnableToWriteCatalog: Unable to write catalog to file ") {
-    message_.append(filename);
-  }
-
-  ~UnableToWriteCatalog() throw() {
-  }
-
-  virtual const char* what() const throw() {
-    return message_.c_str();
-  }
-
- private:
-  std::string message_;
-};
-
-/**
- * @brief Exception thrown when there is a Proto parse error when loading the
- *        catalog.
- **/
-class CatalogNotProto : public std::exception {
- public:
-  /**
-   * @brief Constructor.
-   *
-   * @param filename The catalog filename provided.
-   **/
-  explicit CatalogNotProto(const std::string &filename)
-      : message_("CatalogNotProto: The file ") {
-    message_.append(filename).append(" is not valid Proto");
-  }
-
-  ~CatalogNotProto() throw() {
-  }
-
-  virtual const char* what() const throw() {
-    return message_.c_str();
-  }
-
- private:
-  std::string message_;
-};
-
-
-/**
- * @brief An object which manages the state of quickstep and the execution of
- *        queries.
- **/
-class QueryProcessor {
- public:
-  /**
-   * @brief Constructor.
-   *
-   * @param catalog_filename The file to read the serialized catalog from.
-   **/
-  explicit QueryProcessor(std::string &&catalog_filename)  // NOLINT(whitespace/operators)
-      : catalog_filename_(std::move(catalog_filename)),
-        catalog_altered_(false),
-        query_id_(0) {
-    loadCatalog();
-  }
-
-  /**
-   * @brief Destructor.
-   **/
-  ~QueryProcessor() {}
-
-  /**
-   * @brief Get the next query id.
-   **/
-  std::size_t query_id() const {
-    return query_id_;
-  }
-
-  /**
-   * @brief Fill a query handle for the given parsed SQL statement. This
-   *        includes that the optimizer creates a QueryPlan inside the handle.
-   *
-   * @param statement The parsed SQL statement to generate a query handle for.
-   * @param query_handle The generated query handle to output.
-   **/
-  void generateQueryHandle(const ParseStatement &statement,
-                           QueryHandle *query_handle);
-
-  /**
-   * @brief Save the catalog back to disk.
-   **/
-  void saveCatalog();
-
-  /**
-   * @brief Set \p catalog_altered_ to true to indicate that the catalog
-   *        has been altered.
-   */
-  void markCatalogAltered() {
-    catalog_altered_ = true;
-  }
-
-  /**
-   * @brief Get the default database in the Catalog held by this
-   *        QueryProcessor.
-   **/
-  CatalogDatabase* getDefaultDatabase() const {
-    return catalog_->getDatabaseByNameMutable("default");
-  }
-
- private:
-  void loadCatalog();  // If it exists, free catalog_ before calling this
-
-  optimizer::Optimizer optimizer_;
-
-  const std::string catalog_filename_;
-
-  std::unique_ptr<Catalog> catalog_;
-
-  bool catalog_altered_;
-
-  std::size_t query_id_;
-
-  DISALLOW_COPY_AND_ASSIGN(QueryProcessor);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_QUERY_OPTIMIZER_QUERY_PROCESSOR_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/Validator.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/Validator.hpp b/query_optimizer/Validator.hpp
deleted file mode 100644
index 9f8b6fd..0000000
--- a/query_optimizer/Validator.hpp
+++ /dev/null
@@ -1,73 +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_VALIDATOR_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_VALIDATOR_HPP_
-
-#include <memory>
-#include <vector>
-
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "query_optimizer/expressions/ExpressionUtil.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-namespace optimizer {
-
-/** \addtogroup QueryOptimizer
- *  @{
- */
-
-/**
- * @brief Validate that the plan does not have a dangling attribute reference.
- *
- * @param plan The plan to be validated.
- */
-template <class PlanType>
-static void Validate(const std::shared_ptr<const PlanType> &plan) {
-  if (plan->getNumChildren() > 0) {
-    const std::vector<expressions::AttributeReferencePtr>
-        referenced_attributes = plan->getReferencedAttributes();
-    std::vector<expressions::AttributeReferencePtr> visible_attributes;
-    for (const std::shared_ptr<const PlanType> &child : plan->children()) {
-      Validate<PlanType>(child);
-      const std::vector<expressions::AttributeReferencePtr> input_attributes =
-          child->getOutputAttributes();
-      visible_attributes.insert(visible_attributes.end(),
-                                input_attributes.begin(),
-                                input_attributes.end());
-    }
-    for (const expressions::AttributeReferencePtr &referenced_attribute :
-         referenced_attributes) {
-      CHECK(expressions::ContainsExpression(visible_attributes,
-                                            referenced_attribute))
-          << "\nDangling attribute reference "
-          << referenced_attribute->getShortString() << " in the plan:\n"
-          << plan->toString();
-    }
-  }
-}
-
-/** @} */
-
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_QUERY_OPTIMIZER_VALIDATOR_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/cost_model/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/query_optimizer/cost_model/CMakeLists.txt b/query_optimizer/cost_model/CMakeLists.txt
deleted file mode 100644
index 032e34c..0000000
--- a/query_optimizer/cost_model/CMakeLists.txt
+++ /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.
-
-# Declare micro-libs:
-add_library(quickstep_queryoptimizer_costmodel_CostModel ../../empty_src.cpp CostModel.hpp)
-add_library(quickstep_queryoptimizer_costmodel_SimpleCostModel SimpleCostModel.cpp SimpleCostModel.hpp)
-add_library(quickstep_queryoptimizer_costmodel_StarSchemaSimpleCostModel
-            StarSchemaSimpleCostModel.cpp
-            StarSchemaSimpleCostModel.hpp)
-
-# Link dependencies:
-target_link_libraries(quickstep_queryoptimizer_costmodel_CostModel
-                      quickstep_queryoptimizer_physical_Aggregate
-                      quickstep_queryoptimizer_physical_Physical
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_costmodel_SimpleCostModel
-                      glog
-                      quickstep_catalog_CatalogRelation
-                      quickstep_catalog_CatalogRelationStatistics
-                      quickstep_queryoptimizer_costmodel_CostModel
-                      quickstep_queryoptimizer_physical_Aggregate
-                      quickstep_queryoptimizer_physical_HashJoin
-                      quickstep_queryoptimizer_physical_NestedLoopsJoin
-                      quickstep_queryoptimizer_physical_Physical
-                      quickstep_queryoptimizer_physical_PhysicalType
-                      quickstep_queryoptimizer_physical_Selection
-                      quickstep_queryoptimizer_physical_SharedSubplanReference
-                      quickstep_queryoptimizer_physical_Sort
-                      quickstep_queryoptimizer_physical_TableGenerator
-                      quickstep_queryoptimizer_physical_TableReference
-                      quickstep_queryoptimizer_physical_TopLevelPlan
-                      quickstep_queryoptimizer_physical_WindowAggregate
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_costmodel_StarSchemaSimpleCostModel
-                      glog
-                      quickstep_catalog_CatalogRelation
-                      quickstep_queryoptimizer_costmodel_CostModel
-                      quickstep_queryoptimizer_expressions_AttributeReference
-                      quickstep_queryoptimizer_expressions_ComparisonExpression
-                      quickstep_queryoptimizer_expressions_ExprId
-                      quickstep_queryoptimizer_expressions_ExpressionType
-                      quickstep_queryoptimizer_expressions_ExpressionUtil
-                      quickstep_queryoptimizer_expressions_LogicalAnd
-                      quickstep_queryoptimizer_expressions_LogicalOr
-                      quickstep_queryoptimizer_expressions_PatternMatcher
-                      quickstep_queryoptimizer_expressions_Predicate
-                      quickstep_queryoptimizer_physical_Aggregate
-                      quickstep_queryoptimizer_physical_HashJoin
-                      quickstep_queryoptimizer_physical_NestedLoopsJoin
-                      quickstep_queryoptimizer_physical_PatternMatcher
-                      quickstep_queryoptimizer_physical_Physical
-                      quickstep_queryoptimizer_physical_PhysicalType
-                      quickstep_queryoptimizer_physical_Selection
-                      quickstep_queryoptimizer_physical_SharedSubplanReference
-                      quickstep_queryoptimizer_physical_Sort
-                      quickstep_queryoptimizer_physical_TableGenerator
-                      quickstep_queryoptimizer_physical_TableReference
-                      quickstep_queryoptimizer_physical_TopLevelPlan
-                      quickstep_queryoptimizer_physical_WindowAggregate
-                      quickstep_utility_Macros)
-
-# Module all-in-one library:
-add_library(quickstep_queryoptimizer_costmodel ../../empty_src.cpp CostModelModule.hpp)
-target_link_libraries(quickstep_queryoptimizer_costmodel
-                      quickstep_queryoptimizer_costmodel_CostModel
-                      quickstep_queryoptimizer_costmodel_SimpleCostModel
-                      quickstep_queryoptimizer_costmodel_StarSchemaSimpleCostModel)

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/cost_model/CostModel.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/cost_model/CostModel.hpp b/query_optimizer/cost_model/CostModel.hpp
deleted file mode 100644
index 20bc208..0000000
--- a/query_optimizer/cost_model/CostModel.hpp
+++ /dev/null
@@ -1,83 +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 QUERY_OPTIMIZER_COST_MODEL_COST_MODEL_HPP_
-#define QUERY_OPTIMIZER_COST_MODEL_COST_MODEL_HPP_
-
-#include <cstddef>
-
-#include "query_optimizer/physical/Aggregate.hpp"
-#include "query_optimizer/physical/Physical.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-namespace optimizer {
-namespace cost {
-
-/** \addtogroup CostModel
- *  @{
- */
-
-/**
- * @brief Interface to a cost model of physical plans.
- */
-class CostModel {
- public:
-  /**
-   * @brief Destructor.
-   */
-  virtual ~CostModel() {}
-
-  /**
-   * @brief Estimate the cardinality of the output relation of \p physical_plan.
-   *
-   * @param physical_plan The physical plan for which the cardinality of the
-   *                      output relation is estimated.
-   * @return The estimated cardinality.
-   */
-  virtual std::size_t estimateCardinality(
-      const physical::PhysicalPtr &physical_plan) = 0;
-
-  /**
-   * @brief Estimate the number of groups of an aggregation.
-   *
-   * @param aggregate The physical plan of the aggregation.
-   * @return The estimated number of groups.
-   */
-  virtual std::size_t estimateNumGroupsForAggregate(const physical::AggregatePtr &aggregate) {
-    return estimateCardinality(aggregate);
-  }
-
- protected:
-  /**
-   * @brief Constructor.
-   */
-  CostModel() {}
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(CostModel);
-};
-
-/** @} */
-
-}  // namespace cost
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif /* QUERY_OPTIMIZER_COST_MODEL_COST_MODEL_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/cost_model/CostModelModule.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/cost_model/CostModelModule.hpp b/query_optimizer/cost_model/CostModelModule.hpp
deleted file mode 100644
index 41bc053..0000000
--- a/query_optimizer/cost_model/CostModelModule.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 CostModel
- *  @ingroup QueryOptimizer
- *
- * Models that estimate the costs of physical plans.
- **/

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/cost_model/SimpleCostModel.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/cost_model/SimpleCostModel.cpp b/query_optimizer/cost_model/SimpleCostModel.cpp
deleted file mode 100644
index a803c67..0000000
--- a/query_optimizer/cost_model/SimpleCostModel.cpp
+++ /dev/null
@@ -1,150 +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/cost_model/SimpleCostModel.hpp"
-
-#include <algorithm>
-#include <memory>
-
-#include "catalog/CatalogRelation.hpp"
-#include "catalog/CatalogRelationStatistics.hpp"
-#include "query_optimizer/physical/Aggregate.hpp"
-#include "query_optimizer/physical/NestedLoopsJoin.hpp"
-#include "query_optimizer/physical/HashJoin.hpp"
-#include "query_optimizer/physical/Physical.hpp"
-#include "query_optimizer/physical/PhysicalType.hpp"
-#include "query_optimizer/physical/Selection.hpp"
-#include "query_optimizer/physical/SharedSubplanReference.hpp"
-#include "query_optimizer/physical/Sort.hpp"
-#include "query_optimizer/physical/TableGenerator.hpp"
-#include "query_optimizer/physical/TableReference.hpp"
-#include "query_optimizer/physical/TopLevelPlan.hpp"
-#include "query_optimizer/physical/WindowAggregate.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-namespace optimizer {
-namespace cost {
-
-namespace P = ::quickstep::optimizer::physical;
-
-std::size_t SimpleCostModel::estimateCardinality(
-    const P::PhysicalPtr &physical_plan) {
-  switch (physical_plan->getPhysicalType()) {
-    case P::PhysicalType::kTopLevelPlan:
-      return estimateCardinalityForTopLevelPlan(
-          std::static_pointer_cast<const P::TopLevelPlan>(physical_plan));
-    case P::PhysicalType::kTableReference:
-      return estimateCardinalityForTableReference(
-          std::static_pointer_cast<const P::TableReference>(physical_plan));
-    case P::PhysicalType::kSelection:
-      return estimateCardinalityForSelection(
-          std::static_pointer_cast<const P::Selection>(physical_plan));
-    case P::PhysicalType::kTableGenerator:
-      return estimateCardinalityForTableGenerator(
-          std::static_pointer_cast<const P::TableGenerator>(physical_plan));
-    case P::PhysicalType::kHashJoin:
-      return estimateCardinalityForHashJoin(
-          std::static_pointer_cast<const P::HashJoin>(physical_plan));
-    case P::PhysicalType::kNestedLoopsJoin:
-      return estimateCardinalityForNestedLoopsJoin(
-          std::static_pointer_cast<const P::NestedLoopsJoin>(physical_plan));
-    case P::PhysicalType::kAggregate:
-      return estimateCardinalityForAggregate(
-          std::static_pointer_cast<const P::Aggregate>(physical_plan));
-    case P::PhysicalType::kSharedSubplanReference: {
-      const P::SharedSubplanReferencePtr shared_subplan_reference =
-          std::static_pointer_cast<const P::SharedSubplanReference>(physical_plan);
-      return estimateCardinality(
-          shared_subplans_[shared_subplan_reference->subplan_id()]);
-    }
-    case P::PhysicalType::kSort:
-      return estimateCardinalityForSort(
-          std::static_pointer_cast<const P::Sort>(physical_plan));
-    case P::PhysicalType::kWindowAggregate:
-      return estimateCardinalityForWindowAggregate(
-          std::static_pointer_cast<const P::WindowAggregate>(physical_plan));
-    default:
-      LOG(FATAL) << "Unsupported physical plan:" << physical_plan->toString();
-  }
-}
-
-std::size_t SimpleCostModel::estimateCardinalityForTopLevelPlan(
-    const P::TopLevelPlanPtr &physical_plan) {
-  return estimateCardinality(physical_plan->plan());
-}
-
-std::size_t SimpleCostModel::estimateCardinalityForTableReference(
-    const P::TableReferencePtr &physical_plan) {
-  const std::size_t num_tuples_in_relation =
-      physical_plan->relation()->getStatistics().getNumTuples();
-  if (num_tuples_in_relation == 0) {
-    return physical_plan->relation()->estimateTupleCardinality();
-  } else {
-    return num_tuples_in_relation;
-  }
-}
-
-std::size_t SimpleCostModel::estimateCardinalityForSelection(
-    const P::SelectionPtr &physical_plan) {
-  return estimateCardinality(physical_plan->input());
-}
-
-std::size_t SimpleCostModel::estimateCardinalityForSort(
-    const physical::SortPtr &physical_plan) {
-  std::size_t cardinality = estimateCardinality(
-      std::static_pointer_cast<const P::Sort>(physical_plan)->input());
-  return std::min(cardinality, static_cast<std::size_t>(physical_plan->limit()));
-}
-
-std::size_t SimpleCostModel::estimateCardinalityForTableGenerator(
-    const P::TableGeneratorPtr &physical_plan) {
-  return physical_plan->generator_function_handle()->getEstimatedCardinality();
-}
-
-std::size_t SimpleCostModel::estimateCardinalityForHashJoin(
-    const P::HashJoinPtr &physical_plan) {
-  return std::max(estimateCardinality(physical_plan->left()),
-                  estimateCardinality(physical_plan->right()));
-}
-
-std::size_t SimpleCostModel::estimateCardinalityForNestedLoopsJoin(
-    const P::NestedLoopsJoinPtr &physical_plan) {
-  return std::max(estimateCardinality(physical_plan->left()),
-                  estimateCardinality(physical_plan->right()));
-}
-
-std::size_t SimpleCostModel::estimateCardinalityForAggregate(
-    const physical::AggregatePtr &physical_plan) {
-  if (physical_plan->grouping_expressions().empty()) {
-    return 1;
-  }
-  return std::max(static_cast<std::size_t>(1),
-                  estimateCardinality(physical_plan->input()) / 10);
-}
-
-std::size_t SimpleCostModel::estimateCardinalityForWindowAggregate(
-    const physical::WindowAggregatePtr &physical_plan) {
-  return estimateCardinality(physical_plan->input());
-}
-
-}  // namespace cost
-}  // namespace optimizer
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/cost_model/SimpleCostModel.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/cost_model/SimpleCostModel.hpp b/query_optimizer/cost_model/SimpleCostModel.hpp
deleted file mode 100644
index 16366cd..0000000
--- a/query_optimizer/cost_model/SimpleCostModel.hpp
+++ /dev/null
@@ -1,113 +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 QUERY_OPTIMIZER_COST_MODEL_SIMPLE_COST_MODEL_HPP_
-#define QUERY_OPTIMIZER_COST_MODEL_SIMPLE_COST_MODEL_HPP_
-
-#include <cstddef>
-#include <vector>
-
-#include "query_optimizer/cost_model/CostModel.hpp"
-#include "query_optimizer/physical/Aggregate.hpp"
-#include "query_optimizer/physical/NestedLoopsJoin.hpp"
-#include "query_optimizer/physical/HashJoin.hpp"
-#include "query_optimizer/physical/Physical.hpp"
-#include "query_optimizer/physical/Selection.hpp"
-#include "query_optimizer/physical/Sort.hpp"
-#include "query_optimizer/physical/TableGenerator.hpp"
-#include "query_optimizer/physical/TableReference.hpp"
-#include "query_optimizer/physical/TopLevelPlan.hpp"
-#include "query_optimizer/physical/WindowAggregate.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-namespace optimizer {
-namespace cost {
-
-/** \addtogroup CostModel
- *  @{
- */
-
-/**
- * @brief A simple cost model.
- */
-class SimpleCostModel : public CostModel {
- public:
-  /**
-   * @brief Constructor.
-   */
-  explicit SimpleCostModel(const std::vector<physical::PhysicalPtr> &shared_subplans)
-      : shared_subplans_(shared_subplans) {}
-
-  std::size_t estimateCardinality(
-      const physical::PhysicalPtr &physical_plan) override;
-
- private:
-  // Returns the estimated cardinality of the input plan.
-  std::size_t estimateCardinalityForTopLevelPlan(
-      const physical::TopLevelPlanPtr &physical_plan);
-
-  // Returns the estimated cardinality of the relation.
-  std::size_t estimateCardinalityForTableReference(
-      const physical::TableReferencePtr &physical_plan);
-
-  // Returns the estimated cardinality of the input plan.
-  std::size_t estimateCardinalityForSelection(
-      const physical::SelectionPtr &physical_plan);
-
-  // Returns the estimated cardinality of the input plan.
-  std::size_t estimateCardinalityForTableGenerator(
-      const physical::TableGeneratorPtr &physical_plan);
-
-  // Returns the estimated cardinality as K if there is a LIMIT K clause,
-  // otherwise returns the estimated cardinality of the input plan.
-  std::size_t estimateCardinalityForSort(
-      const physical::SortPtr &physical_plan);
-
-  // Returns the larger value of the estimated cardinalities of two
-  // input plans.
-  std::size_t estimateCardinalityForHashJoin(
-      const physical::HashJoinPtr &physical_plan);
-
-  // Returns the larger value of the estimated cardinalities of two
-  // input plans.
-  std::size_t estimateCardinalityForNestedLoopsJoin(
-      const physical::NestedLoopsJoinPtr &physical_plan);
-
-  // Returns 1 for a scalar aggregation; otherwise, returns the estimated
-  // cardinality of the input plan divided by 10.
-  std::size_t estimateCardinalityForAggregate(
-      const physical::AggregatePtr &physical_plan);
-
-  // Return the estimated cardinality of the input plan.
-  std::size_t estimateCardinalityForWindowAggregate(
-      const physical::WindowAggregatePtr &physical_plan);
-
-  const std::vector<physical::PhysicalPtr> &shared_subplans_;
-
-  DISALLOW_COPY_AND_ASSIGN(SimpleCostModel);
-};
-
-/** @} */
-
-}  // namespace cost
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif /* QUERY_OPTIMIZER_COST_MODEL_SIMPLE_COST_MODEL_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/cost_model/StarSchemaSimpleCostModel.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/cost_model/StarSchemaSimpleCostModel.cpp b/query_optimizer/cost_model/StarSchemaSimpleCostModel.cpp
deleted file mode 100644
index 1075739..0000000
--- a/query_optimizer/cost_model/StarSchemaSimpleCostModel.cpp
+++ /dev/null
@@ -1,399 +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/cost_model/StarSchemaSimpleCostModel.hpp"
-
-#include <algorithm>
-#include <memory>
-#include <unordered_map>
-#include <vector>
-
-#include "catalog/CatalogRelation.hpp"
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "query_optimizer/expressions/ComparisonExpression.hpp"
-#include "query_optimizer/expressions/ExprId.hpp"
-#include "query_optimizer/expressions/ExpressionType.hpp"
-#include "query_optimizer/expressions/ExpressionUtil.hpp"
-#include "query_optimizer/expressions/LogicalAnd.hpp"
-#include "query_optimizer/expressions/LogicalOr.hpp"
-#include "query_optimizer/expressions/Predicate.hpp"
-#include "query_optimizer/expressions/PatternMatcher.hpp"
-#include "query_optimizer/physical/Aggregate.hpp"
-#include "query_optimizer/physical/NestedLoopsJoin.hpp"
-#include "query_optimizer/physical/HashJoin.hpp"
-#include "query_optimizer/physical/PatternMatcher.hpp"
-#include "query_optimizer/physical/Physical.hpp"
-#include "query_optimizer/physical/PhysicalType.hpp"
-#include "query_optimizer/physical/Selection.hpp"
-#include "query_optimizer/physical/SharedSubplanReference.hpp"
-#include "query_optimizer/physical/Sort.hpp"
-#include "query_optimizer/physical/TableGenerator.hpp"
-#include "query_optimizer/physical/TableReference.hpp"
-#include "query_optimizer/physical/TopLevelPlan.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-namespace optimizer {
-namespace cost {
-
-namespace E = ::quickstep::optimizer::expressions;
-namespace P = ::quickstep::optimizer::physical;
-
-std::size_t StarSchemaSimpleCostModel::estimateCardinality(
-    const P::PhysicalPtr &physical_plan) {
-  switch (physical_plan->getPhysicalType()) {
-    case P::PhysicalType::kTopLevelPlan:
-      return estimateCardinalityForTopLevelPlan(
-          std::static_pointer_cast<const P::TopLevelPlan>(physical_plan));
-    case P::PhysicalType::kTableReference:
-      return estimateCardinalityForTableReference(
-          std::static_pointer_cast<const P::TableReference>(physical_plan));
-    case P::PhysicalType::kSelection:
-      return estimateCardinalityForSelection(
-          std::static_pointer_cast<const P::Selection>(physical_plan));
-    case P::PhysicalType::kTableGenerator:
-      return estimateCardinalityForTableGenerator(
-          std::static_pointer_cast<const P::TableGenerator>(physical_plan));
-    case P::PhysicalType::kHashJoin:
-      return estimateCardinalityForHashJoin(
-          std::static_pointer_cast<const P::HashJoin>(physical_plan));
-    case P::PhysicalType::kNestedLoopsJoin:
-      return estimateCardinalityForNestedLoopsJoin(
-          std::static_pointer_cast<const P::NestedLoopsJoin>(physical_plan));
-    case P::PhysicalType::kAggregate:
-      return estimateCardinalityForAggregate(
-          std::static_pointer_cast<const P::Aggregate>(physical_plan));
-    case P::PhysicalType::kSharedSubplanReference: {
-      const P::SharedSubplanReferencePtr shared_subplan_reference =
-          std::static_pointer_cast<const P::SharedSubplanReference>(physical_plan);
-      return estimateCardinality(
-          shared_subplans_[shared_subplan_reference->subplan_id()]);
-    }
-    case P::PhysicalType::kSort:
-      return estimateCardinalityForSort(
-          std::static_pointer_cast<const P::Sort>(physical_plan));
-    case P::PhysicalType::kWindowAggregate:
-      return estimateCardinalityForWindowAggregate(
-          std::static_pointer_cast<const P::WindowAggregate>(physical_plan));
-    default:
-      LOG(FATAL) << "Unsupported physical plan:" << physical_plan->toString();
-  }
-}
-
-std::size_t StarSchemaSimpleCostModel::estimateCardinalityForTopLevelPlan(
-    const P::TopLevelPlanPtr &physical_plan) {
-  return estimateCardinality(physical_plan->plan());
-}
-
-std::size_t StarSchemaSimpleCostModel::estimateCardinalityForTableReference(
-    const P::TableReferencePtr &physical_plan) {
-  std::size_t num_tuples = physical_plan->relation()->getStatistics().getNumTuples();
-  if (num_tuples == 0) {
-    num_tuples = physical_plan->relation()->estimateTupleCardinality();
-  }
-  return num_tuples;
-}
-
-std::size_t StarSchemaSimpleCostModel::estimateCardinalityForSelection(
-    const P::SelectionPtr &physical_plan) {
-  double selectivity =
-      estimateSelectivityForPredicate(physical_plan->filter_predicate(), physical_plan);
-  return static_cast<std::size_t>(
-      estimateCardinality(physical_plan->input()) * selectivity);
-}
-
-std::size_t StarSchemaSimpleCostModel::estimateCardinalityForSort(
-    const physical::SortPtr &physical_plan) {
-  std::size_t cardinality = estimateCardinality(
-      std::static_pointer_cast<const P::Sort>(physical_plan)->input());
-  return std::min(cardinality, static_cast<std::size_t>(physical_plan->limit()));
-}
-
-std::size_t StarSchemaSimpleCostModel::estimateCardinalityForTableGenerator(
-    const P::TableGeneratorPtr &physical_plan) {
-  return physical_plan->generator_function_handle()->getEstimatedCardinality();
-}
-
-std::size_t StarSchemaSimpleCostModel::estimateCardinalityForHashJoin(
-    const P::HashJoinPtr &physical_plan) {
-  std::size_t left_cardinality = estimateCardinality(physical_plan->left());
-  std::size_t right_cardinality = estimateCardinality(physical_plan->right());
-  double left_selectivity = estimateSelectivity(physical_plan->left());
-  double right_selectivity = estimateSelectivity(physical_plan->right());
-  return std::max(static_cast<std::size_t>(left_cardinality * right_selectivity + 0.5),
-                  static_cast<std::size_t>(right_cardinality * left_selectivity + 0.5));
-}
-
-std::size_t StarSchemaSimpleCostModel::estimateCardinalityForNestedLoopsJoin(
-    const P::NestedLoopsJoinPtr &physical_plan) {
-  return std::max(estimateCardinality(physical_plan->left()),
-                  estimateCardinality(physical_plan->right()));
-}
-
-std::size_t StarSchemaSimpleCostModel::estimateCardinalityForAggregate(
-    const P::AggregatePtr &physical_plan) {
-  double filter_selectivity =
-      estimateSelectivityForPredicate(physical_plan->filter_predicate(), physical_plan);
-  return static_cast<std::size_t>(
-      estimateNumGroupsForAggregate(physical_plan) * filter_selectivity);
-}
-
-std::size_t StarSchemaSimpleCostModel::estimateCardinalityForWindowAggregate(
-    const P::WindowAggregatePtr &physical_plan) {
-  return estimateCardinality(physical_plan->input());
-}
-
-
-std::size_t StarSchemaSimpleCostModel::estimateNumGroupsForAggregate(
-    const physical::AggregatePtr &aggregate) {
-  if (aggregate->grouping_expressions().empty()) {
-    return 1uL;
-  }
-
-  std::size_t estimated_child_cardinality = estimateCardinality(aggregate->input());
-  std::size_t estimated_num_groups = 1;
-  std::size_t max_attr_num_distinct_values = 0;
-  for (const auto &expr : aggregate->grouping_expressions()) {
-    E::AttributeReferencePtr attr;
-    if (E::SomeAttributeReference::MatchesWithConditionalCast(expr, &attr)) {
-      std::size_t attr_num_distinct_values =
-          estimateNumDistinctValues(attr->id(), aggregate->input());
-      estimated_num_groups *= std::max(1uL, attr_num_distinct_values);
-      max_attr_num_distinct_values =
-          std::max(max_attr_num_distinct_values, attr_num_distinct_values);
-    } else {
-      // TODO(jianqiao): implement estimateNumDistinctValues() for expressions.
-      estimated_num_groups *= 64uL;
-    }
-  }
-  estimated_num_groups = std::max(
-      std::min(estimated_num_groups, estimated_child_cardinality / 10),
-      max_attr_num_distinct_values);
-  return estimated_num_groups;
-}
-
-
-std::size_t StarSchemaSimpleCostModel::estimateNumDistinctValues(
-    const expressions::ExprId attribute_id,
-    const physical::PhysicalPtr &physical_plan) {
-  DCHECK(E::ContainsExprId(physical_plan->getOutputAttributes(), attribute_id));
-
-  P::TableReferencePtr table_reference;
-  if (P::SomeTableReference::MatchesWithConditionalCast(physical_plan, &table_reference)) {
-    return getNumDistinctValues(attribute_id, table_reference);
-  }
-
-  double filter_selectivity = estimateSelectivityForFilterPredicate(physical_plan);
-  switch (physical_plan->getPhysicalType()) {
-    case P::PhysicalType::kSelection:  // Fall through
-    case P::PhysicalType::kAggregate: {
-      const P::PhysicalPtr &child = physical_plan->children()[0];
-      if (E::ContainsExprId(child->getOutputAttributes(), attribute_id)) {
-        std::size_t child_num_distinct_values =
-            estimateNumDistinctValues(attribute_id, child);
-        return static_cast<std::size_t>(
-            child_num_distinct_values * filter_selectivity + 0.5);
-      }
-      break;
-    }
-    case P::PhysicalType::kHashJoin: {
-      const P::HashJoinPtr &hash_join =
-          std::static_pointer_cast<const P::HashJoin>(physical_plan);
-      if (E::ContainsExprId(hash_join->left()->getOutputAttributes(), attribute_id)) {
-        std::size_t left_child_num_distinct_values =
-            estimateNumDistinctValues(attribute_id, hash_join->left());
-        double right_child_selectivity =
-            estimateSelectivity(hash_join->right());
-        return static_cast<std::size_t>(
-            left_child_num_distinct_values * right_child_selectivity * filter_selectivity + 0.5);
-      }
-      if (E::ContainsExprId(hash_join->right()->getOutputAttributes(), attribute_id)) {
-        std::size_t right_child_num_distinct_values =
-            estimateNumDistinctValues(attribute_id, hash_join->right());
-        double left_child_selectivity =
-            estimateSelectivity(hash_join->left());
-        return static_cast<std::size_t>(
-            right_child_num_distinct_values * left_child_selectivity * filter_selectivity + 0.5);
-      }
-    }
-    default:
-      break;
-  }
-
-  return 16uL;
-}
-
-double StarSchemaSimpleCostModel::estimateSelectivity(
-    const physical::PhysicalPtr &physical_plan) {
-  switch (physical_plan->getPhysicalType()) {
-    case P::PhysicalType::kSelection: {
-      const P::SelectionPtr &selection =
-          std::static_pointer_cast<const P::Selection>(physical_plan);
-      double filter_selectivity =
-          estimateSelectivityForPredicate(selection->filter_predicate(), selection);
-      double child_selectivity = estimateSelectivity(selection->input());
-      return filter_selectivity * child_selectivity;
-    }
-    case P::PhysicalType::kHashJoin: {
-      const P::HashJoinPtr &hash_join =
-          std::static_pointer_cast<const P::HashJoin>(physical_plan);
-      double filter_selectivity =
-          estimateSelectivityForPredicate(hash_join->residual_predicate(), hash_join);
-      double child_selectivity =
-          estimateSelectivity(hash_join->left()) * estimateSelectivity(hash_join->right());
-      return filter_selectivity * child_selectivity;
-    }
-    case P::PhysicalType::kNestedLoopsJoin: {
-      const P::NestedLoopsJoinPtr &nested_loop_join =
-          std::static_pointer_cast<const P::NestedLoopsJoin>(physical_plan);
-      double filter_selectivity =
-          estimateSelectivityForPredicate(nested_loop_join->join_predicate(), nested_loop_join);
-      double child_selectivity = std::min(
-          estimateSelectivity(nested_loop_join->left()),
-          estimateSelectivity(nested_loop_join->right()));
-      return filter_selectivity * child_selectivity;
-    }
-    case P::PhysicalType::kSharedSubplanReference: {
-      const P::SharedSubplanReferencePtr shared_subplan_reference =
-          std::static_pointer_cast<const P::SharedSubplanReference>(physical_plan);
-      return estimateSelectivity(
-          shared_subplans_[shared_subplan_reference->subplan_id()]);
-    }
-    default:
-      break;
-  }
-
-  if (physical_plan->getNumChildren() == 1) {
-    return estimateSelectivity(physical_plan->children()[0]);
-  }
-
-  return 1.0;
-}
-
-double StarSchemaSimpleCostModel::estimateSelectivityForFilterPredicate(
-    const physical::PhysicalPtr &physical_plan) {
-  E::PredicatePtr filter_predicate = nullptr;
-  switch (physical_plan->getPhysicalType()) {
-    case P::PhysicalType::kSelection:
-      filter_predicate =
-          std::static_pointer_cast<const P::Selection>(physical_plan)->filter_predicate();
-      break;
-    case P::PhysicalType::kAggregate:
-      filter_predicate =
-          std::static_pointer_cast<const P::Aggregate>(physical_plan)->filter_predicate();
-      break;
-    case P::PhysicalType::kHashJoin:
-      filter_predicate =
-          std::static_pointer_cast<const P::HashJoin>(physical_plan)->residual_predicate();
-      break;
-    case P::PhysicalType::kNestedLoopsJoin:
-      filter_predicate =
-          std::static_pointer_cast<const P::NestedLoopsJoin>(physical_plan)->join_predicate();
-      break;
-    default:
-      break;
-  }
-
-  if (filter_predicate == nullptr) {
-    return 1.0;
-  } else {
-    return estimateSelectivityForPredicate(filter_predicate, physical_plan);
-  }
-}
-
-
-double StarSchemaSimpleCostModel::estimateSelectivityForPredicate(
-    const expressions::PredicatePtr &filter_predicate,
-    const P::PhysicalPtr &physical_plan) {
-  if (filter_predicate == nullptr) {
-    return 1.0;
-  }
-
-  switch (filter_predicate->getExpressionType()) {
-    case E::ExpressionType::kComparisonExpression: {
-      // Case 1 - Number of distinct values statistics available
-      //   Case 1.1 - Equality comparison: 1.0 / num_distinct_values
-      //   Case 1.2 - Otherwise: 0.1
-      // Case 2 - Otherwise: 0.5
-      const E::ComparisonExpressionPtr &comparison_expression =
-          std::static_pointer_cast<const E::ComparisonExpression>(filter_predicate);
-      E::AttributeReferencePtr attr;
-      if ((E::SomeAttributeReference::MatchesWithConditionalCast(comparison_expression->left(), &attr) &&
-           E::SomeScalarLiteral::Matches(comparison_expression->right())) ||
-          (E::SomeAttributeReference::MatchesWithConditionalCast(comparison_expression->right(), &attr) &&
-           E::SomeScalarLiteral::Matches(comparison_expression->left()))) {
-        for (const auto &child : physical_plan->children()) {
-          if (E::ContainsExprId(child->getOutputAttributes(), attr->id())) {
-            const std::size_t child_num_distinct_values = estimateNumDistinctValues(attr->id(), child);
-            if (comparison_expression->isEqualityComparisonPredicate()) {
-              return 1.0 / child_num_distinct_values;
-            } else {
-              return 1.0 / std::max(std::min(child_num_distinct_values / 100.0, 10.0), 2.0);
-            }
-          }
-        }
-        return 0.1;
-      }
-      return 0.5;
-    }
-    case E::ExpressionType::kLogicalAnd: {
-      const E::LogicalAndPtr &logical_and =
-          std::static_pointer_cast<const E::LogicalAnd>(filter_predicate);
-      double selectivity = 1.0;
-      for (const auto &predicate : logical_and->operands()) {
-        selectivity = std::min(selectivity, estimateSelectivityForPredicate(predicate, physical_plan));
-      }
-      return selectivity;
-    }
-    case E::ExpressionType::kLogicalOr: {
-      const E::LogicalOrPtr &logical_or =
-          std::static_pointer_cast<const E::LogicalOr>(filter_predicate);
-      double selectivity = 0;
-      for (const auto &predicate : logical_or->operands()) {
-        selectivity += estimateSelectivityForPredicate(predicate, physical_plan);
-      }
-      return std::min(selectivity, 1.0);
-    }
-    default:
-      break;
-  }
-  return 1.0;
-}
-
-std::size_t StarSchemaSimpleCostModel::getNumDistinctValues(
-    const E::ExprId attribute_id,
-    const P::TableReferencePtr &table_reference) {
-  const CatalogRelation &relation = *table_reference->relation();
-  const std::vector<E::AttributeReferencePtr> &attributes = table_reference->attribute_list();
-  for (std::size_t i = 0; i < attributes.size(); ++i) {
-    if (attributes[i]->id() == attribute_id) {
-      std::size_t num_distinct_values = relation.getStatistics().getNumDistinctValues(i);
-      if (num_distinct_values > 0) {
-        return num_distinct_values;
-      }
-      break;
-    }
-  }
-  return estimateCardinalityForTableReference(table_reference);
-}
-
-}  // namespace cost
-}  // namespace optimizer
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/cost_model/StarSchemaSimpleCostModel.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/cost_model/StarSchemaSimpleCostModel.hpp b/query_optimizer/cost_model/StarSchemaSimpleCostModel.hpp
deleted file mode 100644
index 6f6aa29..0000000
--- a/query_optimizer/cost_model/StarSchemaSimpleCostModel.hpp
+++ /dev/null
@@ -1,157 +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 QUERY_OPTIMIZER_COST_MODEL_STAR_SCHEMA_SIMPLE_COST_MODEL_HPP_
-#define QUERY_OPTIMIZER_COST_MODEL_STAR_SCHEMA_SIMPLE_COST_MODEL_HPP_
-
-#include <cstddef>
-#include <vector>
-
-#include "query_optimizer/cost_model/CostModel.hpp"
-#include "query_optimizer/expressions/ExprId.hpp"
-#include "query_optimizer/expressions/Predicate.hpp"
-#include "query_optimizer/physical/Aggregate.hpp"
-#include "query_optimizer/physical/NestedLoopsJoin.hpp"
-#include "query_optimizer/physical/HashJoin.hpp"
-#include "query_optimizer/physical/Physical.hpp"
-#include "query_optimizer/physical/Selection.hpp"
-#include "query_optimizer/physical/Sort.hpp"
-#include "query_optimizer/physical/TableGenerator.hpp"
-#include "query_optimizer/physical/TableReference.hpp"
-#include "query_optimizer/physical/TopLevelPlan.hpp"
-#include "query_optimizer/physical/WindowAggregate.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-namespace optimizer {
-namespace cost {
-
-/** \addtogroup CostModel
- *  @{
- */
-
-/**
- * @brief A simple cost model for hash join planning.
- */
-class StarSchemaSimpleCostModel : public CostModel {
- public:
-  /**
-   * @brief Constructor.
-   */
-  explicit StarSchemaSimpleCostModel(const std::vector<physical::PhysicalPtr> &shared_subplans)
-      : shared_subplans_(shared_subplans) {}
-
-  /**
-   * @brief Estimate the cardinality of a physical plan.
-   *
-   * @param physical_plan The physical plan.
-   * @return The estimated cardinality.
-   */
-  std::size_t estimateCardinality(
-      const physical::PhysicalPtr &physical_plan) override;
-
-  /**
-   * @brief Estimate the number of groups in an aggregation.
-   *
-   * @param aggregate The physical plan of the aggregation.
-   * @return The estimated number of groups.
-   */
-  std::size_t estimateNumGroupsForAggregate(
-      const physical::AggregatePtr &aggregate) override;
-
-  /**
-   * @brief Estimate the number of distinct values of an attribute in a relation.
-   * 
-   * @param attribute_id The expression id of the target attribute.
-   * @param physical_plan The physical plan of the attribute's relation.
-   * @return The estimated number of distinct values for the attribute.
-   */
-  std::size_t estimateNumDistinctValues(const expressions::ExprId attribute_id,
-                                        const physical::PhysicalPtr &physical_plan);
-
-  /**
-   * @brief Estimate the "selectivity" of a physical plan under the assumption
-   *        that it acts as a filtered dimension table in a hash join.
-   *
-   * @param phyiscal_plan The physical plan.
-   * @return The estimated selectivity.
-   */
-  double estimateSelectivity(const physical::PhysicalPtr &physical_plan);
-
-  /**
-   * @brief Estimate the filter predicate's selectivity if it is present in
-   *        the input plan's root node.
-   *
-   * @param physical_plan The input physical plan.
-   * @return The estimated selectivity of the filter predicate if physical_plan
-   *         has such a filter predicate; 1.0 otherwise.
-   */
-  double estimateSelectivityForFilterPredicate(
-      const physical::PhysicalPtr &physical_plan);
-
- private:
-  std::size_t estimateCardinalityForAggregate(
-      const physical::AggregatePtr &physical_plan);
-
-  std::size_t estimateCardinalityForHashJoin(
-      const physical::HashJoinPtr &physical_plan);
-
-  std::size_t estimateCardinalityForNestedLoopsJoin(
-      const physical::NestedLoopsJoinPtr &physical_plan);
-
-  std::size_t estimateCardinalityForSelection(
-      const physical::SelectionPtr &physical_plan);
-
-  std::size_t estimateCardinalityForSort(
-      const physical::SortPtr &physical_plan);
-
-  std::size_t estimateCardinalityForTableGenerator(
-      const physical::TableGeneratorPtr &physical_plan);
-
-  std::size_t estimateCardinalityForTableReference(
-      const physical::TableReferencePtr &physical_plan);
-
-  std::size_t estimateCardinalityForTopLevelPlan(
-      const physical::TopLevelPlanPtr &physical_plan);
-
-  std::size_t estimateCardinalityForWindowAggregate(
-      const physical::WindowAggregatePtr &physical_plan);
-
-  double estimateSelectivityForPredicate(
-      const expressions::PredicatePtr &filter_predicate,
-      const physical::PhysicalPtr &physical_plan);
-
-  const std::vector<physical::PhysicalPtr> &shared_subplans_;
-
-  // Get the number of distinct values of an attribute in the table reference.
-  // If the stat is not avaiable, simply returns the table's cardinality.
-  std::size_t getNumDistinctValues(const expressions::ExprId attribute_id,
-                                   const physical::TableReferencePtr &table_reference);
-
-
-  DISALLOW_COPY_AND_ASSIGN(StarSchemaSimpleCostModel);
-};
-
-/** @} */
-
-}  // namespace cost
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif /* QUERY_OPTIMIZER_COST_MODEL_STAR_SCHEMA_SIMPLE_COST_MODEL_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/expressions/AggregateFunction.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/AggregateFunction.cpp b/query_optimizer/expressions/AggregateFunction.cpp
deleted file mode 100644
index cf2cb00..0000000
--- a/query_optimizer/expressions/AggregateFunction.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/AggregateFunction.hpp"
-
-#include <string>
-#include <utility>
-#include <vector>
-
-#include "expressions/aggregation/AggregateFunction.hpp"
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "query_optimizer/expressions/Expression.hpp"
-#include "query_optimizer/expressions/PatternMatcher.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 AggregateFunction::isNullable() const {
-  std::vector<const Type*> argument_types;
-  for (const ScalarPtr &argument : arguments_) {
-    argument_types.emplace_back(&argument->getValueType());
-  }
-
-  const Type *return_type = aggregate_.resultTypeForArgumentTypes(argument_types);
-  DCHECK(return_type != nullptr);
-  return return_type->isNullable();
-}
-
-const Type& AggregateFunction::getValueType() const {
-  std::vector<const Type*> argument_types;
-  for (const ScalarPtr &argument : arguments_) {
-    argument_types.emplace_back(&argument->getValueType());
-  }
-
-  const Type *return_type = aggregate_.resultTypeForArgumentTypes(argument_types);
-  DCHECK(return_type != nullptr);
-  return *return_type;
-}
-
-AggregateFunctionPtr AggregateFunction::Create(
-    const ::quickstep::AggregateFunction &aggregate,
-    const std::vector<ScalarPtr> &arguments,
-    const bool is_vector_aggregate,
-    const bool is_distinct) {
-#ifdef QUICKSTEP_DEBUG
-  std::vector<const Type*> argument_types;
-  for (const ScalarPtr &argument : arguments) {
-    argument_types.emplace_back(&argument->getValueType());
-  }
-  DCHECK(aggregate.canApplyToTypes(argument_types));
-#endif  // QUICKSTEP_DEBUG
-
-  return AggregateFunctionPtr(
-      new AggregateFunction(aggregate, arguments, is_vector_aggregate, is_distinct));
-}
-
-ExpressionPtr AggregateFunction::copyWithNewChildren(
-    const std::vector<ExpressionPtr> &new_children) const {
-  std::vector<ScalarPtr> new_arguments;
-  for (const ExpressionPtr &expression_ptr : new_children) {
-    ScalarPtr expr_as_scalar;
-    CHECK(SomeScalar::MatchesWithConditionalCast(expression_ptr, &expr_as_scalar))
-        << expression_ptr->toString();
-    new_arguments.emplace_back(std::move(expr_as_scalar));
-  }
-
-  return Create(aggregate_, new_arguments, is_vector_aggregate_, is_distinct_);
-}
-
-std::vector<AttributeReferencePtr> AggregateFunction::getReferencedAttributes() const {
-  std::vector<AttributeReferencePtr> referenced_attributes;
-  for (const ScalarPtr &argument : arguments_) {
-    const std::vector<AttributeReferencePtr> referenced_attributes_in_argument =
-        argument->getReferencedAttributes();
-    referenced_attributes.insert(referenced_attributes.end(),
-                                 referenced_attributes_in_argument.begin(),
-                                 referenced_attributes_in_argument.end());
-  }
-  return referenced_attributes;
-}
-
-void AggregateFunction::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("function");
-  inline_field_values->push_back(aggregate_.getName());
-
-  if (is_distinct_) {
-    inline_field_names->push_back("is_distinct");
-    inline_field_values->push_back("true");
-  }
-
-  container_child_field_names->push_back("");
-  container_child_fields->emplace_back(CastSharedPtrVector<OptimizerTreeBase>(arguments_));
-}
-
-}  // namespace expressions
-}  // namespace optimizer
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/expressions/AggregateFunction.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/AggregateFunction.hpp b/query_optimizer/expressions/AggregateFunction.hpp
deleted file mode 100644
index 108c661..0000000
--- a/query_optimizer/expressions/AggregateFunction.hpp
+++ /dev/null
@@ -1,180 +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_AGGREGATE_FUNCTION_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_EXPRESSIONS_AGGREGATE_FUNCTION_HPP_
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "query_optimizer/expressions/Expression.hpp"
-#include "query_optimizer/expressions/ExpressionType.hpp"
-#include "query_optimizer/expressions/Scalar.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-
-class AggregateFunction;
-class Type;
-
-namespace optimizer {
-namespace expressions {
-
-/** \addtogroup OptimizerExpressions
- *  @{
- */
-
-class AggregateFunction;
-typedef std::shared_ptr<const AggregateFunction> AggregateFunctionPtr;
-
-/**
- * @brief Represents an aggregate and its arguments in the optimizer. This
- *        class wraps some of the functionality from
- *        quickstep::AggregateFunction and represents a particular instance
- *        of an aggregate during query optimization.
- **/
-class AggregateFunction : public Expression {
- public:
-  /**
-   * @brief Destructor.
-   */
-  ~AggregateFunction() override {}
-
-  ExpressionType getExpressionType() const override {
-    return ExpressionType::kAggregateFunction;
-  }
-
-  std::string getName() const override {
-    return "AggregateFunction";
-  }
-
-  const Type& getValueType() const override;
-
-  bool isConstant() const override {
-    // Aggregate function is never considered as a constant expression.
-    return false;
-  }
-
-  ExpressionPtr copyWithNewChildren(
-      const std::vector<ExpressionPtr> &new_children) const override;
-
-  std::vector<AttributeReferencePtr> getReferencedAttributes() const override;
-
-  /**
-   * @return Whether the type of the return value is nullable.
-   **/
-  bool isNullable() const;
-
-  /**
-   * @return True if this aggregate is a vector aggregate (i.e. with GROUP BY).
-   **/
-  inline bool is_vector_aggregate() const {
-    return is_vector_aggregate_;
-  }
-
-  /**
-   * @return The AggregateFunction singleton (from the expression system)
-   *         for this node.
-   **/
-  inline const ::quickstep::AggregateFunction& getAggregate() const {
-    return aggregate_;
-  }
-
-  /**
-   * @return The list of scalar arguments to this aggregate.
-   **/
-  inline const std::vector<ScalarPtr>& getArguments() const {
-    return arguments_;
-  }
-
-  /*
-   * @return Whether this is a DISTINCT aggregation.
-   */
-  inline bool is_distinct() const {
-    return is_distinct_;
-  }
-
-  /**
-   * @brief Create a new AggregateFunction.
-   *
-   * @warning It is an error to call this with arguments that the given
-   *          aggregate can not apply to.
-   *
-   * @param aggregate The underlying AggregateFunction from the expression
-   *        system.
-   * @param arguments A list of arguments to the aggregate function.
-   * @param is_vector_aggregate Whether the aggregate has a GROUP BY clause.
-   * @param is_distinct Whether this is a DISTINCT aggregation.
-   * @return A new AggregateFunctionPtr.
-   **/
-  static AggregateFunctionPtr Create(const ::quickstep::AggregateFunction &aggregate,
-                                     const std::vector<ScalarPtr> &arguments,
-                                     const bool is_vector_aggregate,
-                                     const bool is_distinct);
-
- 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:
-  /**
-   * @brief Constructor.
-   *
-   * @param aggregate The actual AggregateFunction to use.
-   * @param arguments The scalar arguments to the aggregate function.
-   * @param is_vector_aggregate Indicates whether this aggregation is a vector
-   *                            aggregation (i.e. GROUP BY exists).
-   * @param is_distinct Indicates whether this is a DISTINCT aggregation.
-   */
-  AggregateFunction(const ::quickstep::AggregateFunction &aggregate,
-                    const std::vector<ScalarPtr> &arguments,
-                    const bool is_vector_aggregate,
-                    const bool is_distinct)
-      : aggregate_(aggregate),
-        arguments_(arguments),
-        is_vector_aggregate_(is_vector_aggregate),
-        is_distinct_(is_distinct) {
-    for (const ScalarPtr &child : arguments_) {
-      addChild(child);
-    }
-  }
-
-  const ::quickstep::AggregateFunction &aggregate_;
-  std::vector<ScalarPtr> arguments_;
-  const bool is_vector_aggregate_;
-  const bool is_distinct_;
-
-  DISALLOW_COPY_AND_ASSIGN(AggregateFunction);
-};
-
-/** @} */
-
-}  // namespace expressions
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_QUERY_OPTIMIZER_EXPRESSIONS_AGGREGATE_FUNCTION_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/expressions/Alias.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/Alias.cpp b/query_optimizer/expressions/Alias.cpp
deleted file mode 100644
index 30dade7..0000000
--- a/query_optimizer/expressions/Alias.cpp
+++ /dev/null
@@ -1,94 +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/Alias.hpp"
-
-#include <string>
-#include <unordered_map>
-#include <vector>
-
-#include "catalog/CatalogTypedefs.hpp"
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/Expression.hpp"
-#include "query_optimizer/expressions/NamedExpression.hpp"
-#include "query_optimizer/expressions/PatternMatcher.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-class Scalar;
-
-namespace optimizer {
-namespace expressions {
-
-Alias::Alias(attribute_id id,
-             const ExpressionPtr &expression,
-             const std::string &attribute_name,
-             const std::string &attribute_alias,
-             const std::string &table_name)
-    : NamedExpression(id, attribute_name, attribute_alias, table_name) {
-  AliasPtr attribute_child;
-  // Do not add an Alias as the child of another Alias.
-  if (SomeAlias::MatchesWithConditionalCast(expression, &attribute_child)) {
-    expression_ = attribute_child->expression();
-  } else {
-    expression_ = expression;
-  }
-  addChild(expression_);
-}
-
-ExpressionPtr Alias::copyWithNewChildren(
-    const std::vector<ExpressionPtr> &new_children) const {
-  DCHECK_EQ(new_children.size(), children().size());
-  return Alias::Create(id(),
-                       new_children[0],
-                       attribute_name(),
-                       attribute_alias(),
-                       relation_name());
-}
-
-::quickstep::Scalar *Alias::concretize(
-    const std::unordered_map<ExprId, const CatalogAttribute*> &substitution_map) const {
-  // Alias should be converted to a CatalogAttribute.
-  LOG(FATAL) << "Cannot concretize Alias to a scalar for evaluation";
-}
-
-void Alias::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 {
-  NamedExpression::getFieldStringItems(inline_field_names,
-                                       inline_field_values,
-                                       non_container_child_field_names,
-                                       non_container_child_fields,
-                                       container_child_field_names,
-                                       container_child_fields);
-
-  non_container_child_field_names->push_back("");
-  non_container_child_fields->push_back(expression_);
-}
-
-}  // namespace expressions
-}  // namespace optimizer
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/expressions/Alias.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/Alias.hpp b/query_optimizer/expressions/Alias.hpp
deleted file mode 100644
index e07f9fe..0000000
--- a/query_optimizer/expressions/Alias.hpp
+++ /dev/null
@@ -1,139 +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_ALIAS_HPP
-#define QUICKSTEP_QUERY_OPTIMIZER_EXPRESSIONS_ALIAS_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/NamedExpression.hpp"
-#include "query_optimizer/expressions/Scalar.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-
-class CatalogAttribute;
-class Scalar;
-class Type;
-
-namespace optimizer {
-namespace expressions {
-
-/** \addtogroup OptimizerExpressions
- *  @{
- */
-
-class Alias;
-typedef std::shared_ptr<const Alias> AliasPtr;
-
-/**
- * @brief Assigns an ID and a name to an expression so that the expression can be
- *        referenced by others. It corresponds to a new CatalogAttribute.
- */
-class Alias : public NamedExpression {
- public:
-  ExpressionType getExpressionType() const override { return ExpressionType::kAlias; }
-
-  std::string getName() const override { return "Alias"; }
-
-  const Type& getValueType() const override {
-    return expression_->getValueType();
-  }
-
-  bool isConstant() const override { return expression_->isConstant(); }
-
-  /**
-   * @brief Returns the named expression.
-   *
-   * @return The expression named by this Alias.
-   */
-  inline const ExpressionPtr& expression() const { return expression_; }
-
-  ExpressionPtr copyWithNewChildren(
-      const std::vector<ExpressionPtr> &new_children) const override;
-
-  std::vector<AttributeReferencePtr> getReferencedAttributes() const override {
-    return expression_->getReferencedAttributes();
-  }
-
-  ::quickstep::Scalar *concretize(
-      const std::unordered_map<ExprId, const CatalogAttribute*> &substitution_map) const override;
-
-  /**
-   * @brief Creates an immutable Alias. If \p expression is also an Alias,
-   *        its child expression rather than the Alias is the child expression
-   *        of the new Alias.
-   *
-   * @param id Expression ID.
-   * @param expression Expression that the alias is applied on.
-   * @param attribute_name The internal name (corresponding to the attribute
-   *                       name if being concretized).
-   * @param attribute_alias The display name (corresponding to the display name
-   *                        if being concretized).
-   * @param relation_name The name of the source relation.
-   * @return An immutable Alias.
-   */
-  static AliasPtr Create(ExprId id,
-                         const ExpressionPtr &expression,
-                         const std::string &attribute_name,
-                         const std::string &attribute_alias,
-                         const std::string &relation_name = "") {
-    return AliasPtr(new Alias(id,
-                              expression,
-                              attribute_name,
-                              attribute_alias,
-                              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:
-  Alias(ExprId id,
-        const ExpressionPtr &expression,
-        const std::string &attribute_name,
-        const std::string &attribute_alais,
-        const std::string &relation_name);
-
-  ExpressionPtr expression_;
-
-  DISALLOW_COPY_AND_ASSIGN(Alias);
-};
-
-/** @} */
-
-}  // namespace expressions
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_QUERY_OPTIMIZER_EXPRESSIONS_ALIAS_HPP */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/expressions/AttributeReference.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/AttributeReference.cpp b/query_optimizer/expressions/AttributeReference.cpp
deleted file mode 100644
index f0e49d4..0000000
--- a/query_optimizer/expressions/AttributeReference.cpp
+++ /dev/null
@@ -1,83 +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/AttributeReference.hpp"
-
-#include <string>
-#include <unordered_map>
-#include <vector>
-
-#include "expressions/scalar/ScalarAttribute.hpp"
-#include "query_optimizer/expressions/ExprId.hpp"
-#include "query_optimizer/expressions/Expression.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-namespace optimizer {
-namespace expressions {
-
-ExpressionPtr AttributeReference::copyWithNewChildren(
-    const std::vector<ExpressionPtr> &new_children) const {
-  DCHECK_EQ(new_children.size(), children().size());
-  return AttributeReference::Create(id(),
-                                    attribute_name(),
-                                    attribute_alias(),
-                                    relation_name(),
-                                    getValueType(),
-                                    scope());
-}
-
-std::vector<AttributeReferencePtr> AttributeReference::getReferencedAttributes()
-    const {
-  return { Create(id(), attribute_name(), attribute_alias(), relation_name(), getValueType(), scope()) };
-}
-
-::quickstep::Scalar *AttributeReference::concretize(
-    const std::unordered_map<ExprId, const CatalogAttribute*> &substitution_map) const {
-  const std::unordered_map<ExprId, const CatalogAttribute*>::const_iterator found_it =
-      substitution_map.find(id());
-  DCHECK(found_it != substitution_map.end()) << toString();
-  return new ::quickstep::ScalarAttribute(*found_it->second);
-}
-
-void AttributeReference::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 {
-  NamedExpression::getFieldStringItems(
-      inline_field_names,
-      inline_field_values,
-      non_container_child_field_names,
-      non_container_child_fields,
-      container_child_field_names,
-      container_child_fields);
-
-  if (scope_ == AttributeReferenceScope::kOuter) {
-    inline_field_names->push_back("is_outer_reference");
-    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/AttributeReference.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/AttributeReference.hpp b/query_optimizer/expressions/AttributeReference.hpp
deleted file mode 100644
index f5207b1..0000000
--- a/query_optimizer/expressions/AttributeReference.hpp
+++ /dev/null
@@ -1,151 +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_ATTRIBUTE_REFERENCE_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_EXPRESSIONS_ATTRIBUTE_REFERENCE_HPP_
-
-#include <memory>
-#include <string>
-#include <unordered_map>
-#include <vector>
-
-#include "catalog/CatalogTypedefs.hpp"
-#include "query_optimizer/expressions/ExprId.hpp"
-#include "query_optimizer/expressions/Expression.hpp"
-#include "query_optimizer/expressions/ExpressionType.hpp"
-#include "query_optimizer/expressions/NamedExpression.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-
-class CatalogAttribute;
-class Type;
-
-namespace optimizer {
-namespace expressions {
-
-/** \addtogroup OptimizerExpressions
- *  @{
- */
-
-/**
- * @brief The scope of the referenced attribute. I.e. whether the referenced
- *        attribute belongs to a local TableReference or comes from an outside
- *        TableReference. The outside case implies a correlated subquery.
- */
-enum class AttributeReferenceScope {
-  kLocal = 0,
-  kOuter
-};
-
-class AttributeReference;
-typedef std::shared_ptr<const AttributeReference> AttributeReferencePtr;
-
-/**
- * @brief Reference to the attribute created by an Alias or to an attribute in a
- *        base relation.
- */
-class AttributeReference : public NamedExpression {
- public:
-  ExpressionType getExpressionType() const override {
-    return ExpressionType::kAttributeReference;
-  }
-
-  std::string getName() const override { return "AttributeReference"; }
-
-  const Type& getValueType() const override { return type_; }
-
-  bool isConstant() const override { return false; }
-
-  /**
-   * @return The scope of the referenced attribute.
-   */
-  const AttributeReferenceScope scope() const {
-    return scope_;
-  }
-
-  ExpressionPtr copyWithNewChildren(
-      const std::vector<ExpressionPtr> &new_children) const override;
-
-  std::vector<AttributeReferencePtr> getReferencedAttributes() const override;
-
-  ::quickstep::Scalar* concretize(
-      const std::unordered_map<ExprId, const CatalogAttribute*> &substitution_map) const override;
-
-  /**
-   * @brief Creates an immutable AttributReference.
-   *
-   * @param attribute_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
-   *                        for printing purpose.
-   * @param relation_name The name of the relation where the reference
-   *                      expression comes from. This is only for
-   *                      printing purpose.
-   * @param type The type of the value of the referenced expression.
-   * @param scope The scope of the referenced attribute.
-   * @return An immutable AttributeReference.
-   */
-  static AttributeReferencePtr Create(ExprId attribute_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));
-  }
-
- 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:
-  AttributeReference(attribute_id attribute_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,
-                        attribute_name,
-                        attribute_alias,
-                        relation_name),
-        type_(type),
-        scope_(scope) {}
-
-  const Type &type_;
-  const AttributeReferenceScope scope_;
-
-  DISALLOW_COPY_AND_ASSIGN(AttributeReference);
-};
-
-/** @} */
-
-}  // namespace expressions
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_QUERY_OPTIMIZER_EXPRESSIONS_ATTRIBUTE_REFERENCE_HPP_ */


[35/51] [abbrv] [partial] incubator-quickstep git commit: remove c++ files

Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/scalar/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/expressions/scalar/CMakeLists.txt b/expressions/scalar/CMakeLists.txt
deleted file mode 100644
index 8f509da..0000000
--- a/expressions/scalar/CMakeLists.txt
+++ /dev/null
@@ -1,181 +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.
-
-# Declare micro-libs:
-add_library(quickstep_expressions_scalar_Scalar Scalar.cpp Scalar.hpp)
-add_library(quickstep_expressions_scalar_ScalarAttribute
-            ScalarAttribute.cpp
-            ScalarAttribute.hpp)
-add_library(quickstep_expressions_scalar_ScalarBinaryExpression
-            ScalarBinaryExpression.cpp
-            ScalarBinaryExpression.hpp)
-add_library(quickstep_expressions_scalar_ScalarCaseExpression
-            ScalarCaseExpression.cpp
-            ScalarCaseExpression.hpp)
-add_library(quickstep_expressions_scalar_ScalarLiteral
-            ScalarLiteral.cpp
-            ScalarLiteral.hpp)
-add_library(quickstep_expressions_scalar_ScalarUnaryExpression
-            ScalarUnaryExpression.cpp
-            ScalarUnaryExpression.hpp)
-
-# Link dependencies:
-target_link_libraries(quickstep_expressions_scalar_Scalar
-                      quickstep_catalog_CatalogTypedefs
-                      quickstep_expressions_Expressions_proto
-                      quickstep_storage_StorageBlockInfo
-                      quickstep_types_TypedValue
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_expressions_scalar_ScalarAttribute
-                      quickstep_catalog_CatalogAttribute
-                      quickstep_catalog_CatalogRelationSchema
-                      quickstep_catalog_CatalogTypedefs
-                      quickstep_expressions_Expressions_proto
-                      quickstep_expressions_scalar_Scalar
-                      quickstep_storage_StorageBlockInfo
-                      quickstep_storage_ValueAccessor
-                      quickstep_storage_ValueAccessorUtil
-                      quickstep_types_Type
-                      quickstep_types_TypedValue
-                      quickstep_types_containers_ColumnVector
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_expressions_scalar_ScalarBinaryExpression
-                      quickstep_catalog_CatalogTypedefs
-                      quickstep_expressions_Expressions_proto
-                      quickstep_expressions_scalar_Scalar
-                      quickstep_storage_StorageBlockInfo
-                      quickstep_storage_ValueAccessor
-                      quickstep_types_Type
-                      quickstep_types_TypeErrors
-                      quickstep_types_TypedValue
-                      quickstep_types_containers_ColumnVector
-                      quickstep_types_operations_Operation_proto
-                      quickstep_types_operations_binaryoperations_BinaryOperation
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_expressions_scalar_ScalarCaseExpression
-                      quickstep_catalog_CatalogTypedefs
-                      quickstep_expressions_Expressions_proto
-                      quickstep_expressions_predicate_Predicate
-                      quickstep_expressions_scalar_Scalar
-                      quickstep_storage_StorageBlockInfo
-                      quickstep_storage_TupleIdSequence
-                      quickstep_storage_ValueAccessor
-                      quickstep_storage_ValueAccessorUtil
-                      quickstep_types_Type
-                      quickstep_types_Type_proto
-                      quickstep_types_TypedValue
-                      quickstep_types_containers_ColumnVector
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_expressions_scalar_ScalarLiteral
-                      quickstep_catalog_CatalogTypedefs
-                      quickstep_expressions_Expressions_proto
-                      quickstep_expressions_scalar_Scalar
-                      quickstep_storage_StorageBlockInfo
-                      quickstep_storage_ValueAccessor
-                      quickstep_types_Type
-                      quickstep_types_Type_proto
-                      quickstep_types_TypedValue
-                      quickstep_types_TypedValue_proto
-                      quickstep_types_containers_ColumnVector
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_expressions_scalar_ScalarUnaryExpression
-                      quickstep_catalog_CatalogTypedefs
-                      quickstep_expressions_Expressions_proto
-                      quickstep_expressions_scalar_Scalar
-                      quickstep_storage_StorageBlockInfo
-                      quickstep_storage_ValueAccessor
-                      quickstep_types_Type
-                      quickstep_types_TypeErrors
-                      quickstep_types_TypedValue
-                      quickstep_types_containers_ColumnVector
-                      quickstep_types_operations_Operation_proto
-                      quickstep_types_operations_unaryoperations_UnaryOperation
-                      quickstep_utility_Macros)
-
-# Submodule all-in-one library:
-add_library(quickstep_expressions_scalar ../../empty_src.cpp)
-target_link_libraries(quickstep_expressions_scalar
-                      quickstep_expressions_scalar_Scalar
-                      quickstep_expressions_scalar_ScalarAttribute
-                      quickstep_expressions_scalar_ScalarBinaryExpression
-                      quickstep_expressions_scalar_ScalarCaseExpression
-                      quickstep_expressions_scalar_ScalarLiteral
-                      quickstep_expressions_scalar_ScalarUnaryExpression)
-
-# Tests:
-add_executable(ScalarCaseExpression_unittest
-               "${CMAKE_CURRENT_SOURCE_DIR}/tests/ScalarCaseExpression_unittest.cpp")
-target_link_libraries(ScalarCaseExpression_unittest
-                      gtest
-                      gtest_main
-                      quickstep_catalog_CatalogAttribute
-                      quickstep_catalog_CatalogRelation
-                      quickstep_catalog_CatalogRelationSchema
-                      quickstep_expressions_predicate_ComparisonPredicate
-                      quickstep_expressions_predicate_ConjunctionPredicate
-                      quickstep_expressions_predicate_DisjunctionPredicate
-                      quickstep_expressions_predicate_Predicate
-                      quickstep_expressions_scalar_Scalar
-                      quickstep_expressions_scalar_ScalarAttribute
-                      quickstep_expressions_scalar_ScalarBinaryExpression
-                      quickstep_expressions_scalar_ScalarCaseExpression
-                      quickstep_expressions_scalar_ScalarLiteral
-                      quickstep_expressions_scalar_ScalarUnaryExpression
-                      quickstep_storage_StorageBlockInfo
-                      quickstep_storage_TupleIdSequence
-                      quickstep_storage_ValueAccessor
-                      quickstep_types_TypeFactory
-                      quickstep_types_TypeID
-                      quickstep_types_TypedValue
-                      quickstep_types_containers_ColumnVector
-                      quickstep_types_containers_ColumnVectorsValueAccessor
-                      quickstep_types_operations_binaryoperations_BinaryOperationFactory
-                      quickstep_types_operations_binaryoperations_BinaryOperationID
-                      quickstep_types_operations_comparisons_ComparisonFactory
-                      quickstep_types_operations_comparisons_ComparisonID
-                      quickstep_types_operations_unaryoperations_UnaryOperationFactory
-                      quickstep_types_operations_unaryoperations_UnaryOperationID)
-add_test(ScalarCaseExpression_unittest ScalarCaseExpression_unittest)
-
-add_executable(Scalar_unittest "${CMAKE_CURRENT_SOURCE_DIR}/tests/Scalar_unittest.cpp")
-target_link_libraries(Scalar_unittest
-                      gtest
-                      gtest_main
-                      quickstep_catalog_CatalogAttribute
-                      quickstep_catalog_CatalogDatabase
-                      quickstep_catalog_CatalogRelation
-                      quickstep_expressions_ExpressionFactories
-                      quickstep_expressions_scalar_Scalar
-                      quickstep_expressions_scalar_ScalarAttribute
-                      quickstep_expressions_scalar_ScalarBinaryExpression
-                      quickstep_expressions_scalar_ScalarLiteral
-                      quickstep_expressions_scalar_ScalarUnaryExpression
-                      quickstep_types_DatetimeLit
-                      quickstep_types_IntervalLit
-                      quickstep_types_Type
-                      quickstep_types_TypeFactory
-                      quickstep_types_TypeID
-                      quickstep_types_TypedValue
-                      quickstep_types_operations_binaryoperations_BinaryOperation
-                      quickstep_types_operations_binaryoperations_BinaryOperationFactory
-                      quickstep_types_operations_binaryoperations_BinaryOperationID
-                      quickstep_types_operations_unaryoperations_NumericCastOperation
-                      quickstep_types_operations_unaryoperations_UnaryOperation
-                      quickstep_types_operations_unaryoperations_UnaryOperationFactory
-                      quickstep_types_operations_unaryoperations_UnaryOperationID
-                      quickstep_utility_Macros)
-add_test(Scalar_unittest Scalar_unittest)

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/scalar/Scalar.cpp
----------------------------------------------------------------------
diff --git a/expressions/scalar/Scalar.cpp b/expressions/scalar/Scalar.cpp
deleted file mode 100644
index a1c436c..0000000
--- a/expressions/scalar/Scalar.cpp
+++ /dev/null
@@ -1,38 +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 "expressions/scalar/Scalar.hpp"
-
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-
-const char *Scalar::kScalarDataSourceNames[] = {
-  "Literal",
-  "Attribute",
-  "UnaryExpression",
-  "BinaryExpression",
-  "SimpleCase"
-};
-
-const TypedValue& Scalar::getStaticValue() const {
-  FATAL_ERROR("Called getStaticValue() on a Scalar which does not have a static value");
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/scalar/Scalar.hpp
----------------------------------------------------------------------
diff --git a/expressions/scalar/Scalar.hpp b/expressions/scalar/Scalar.hpp
deleted file mode 100644
index 2db850a..0000000
--- a/expressions/scalar/Scalar.hpp
+++ /dev/null
@@ -1,242 +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_EXPRESSIONS_SCALAR_SCALAR_HPP_
-#define QUICKSTEP_EXPRESSIONS_SCALAR_SCALAR_HPP_
-
-#include <utility>
-#include <vector>
-
-#include "catalog/CatalogTypedefs.hpp"
-#include "expressions/Expressions.pb.h"
-#include "storage/StorageBlockInfo.hpp"
-#include "types/TypedValue.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-
-class ColumnVector;
-class Type;
-class ValueAccessor;
-
-struct SubBlocksReference;
-
-/** \addtogroup Expressions
- *  @{
- */
-
-/**
- * @brief Base class for anything which evaluates to a Scalar value.
- **/
-class Scalar {
- public:
-  /**
-   * @brief The possible provenance of Scalar values.
-   **/
-  enum ScalarDataSource {
-    kLiteral = 0,
-    kAttribute,
-    kUnaryExpression,
-    kBinaryExpression,
-    kCaseExpression,
-    kNumScalarDataSources  // Not a real ScalarDataSource, exists for counting purposes.
-  };
-
-  /**
-   * @brief Strings naming the elements in ScalarDataSource.
-   * @note String literals are defined out-of-line in Scalar.cpp
-   **/
-  static const char *kScalarDataSourceNames[kNumScalarDataSources];
-
-  /**
-   * @brief Virtual destructor.
-   **/
-  virtual ~Scalar() {
-  }
-
-  /**
-   * @brief Serialize this scalar in Protocol Buffer form.
-   *
-   * @return The Protocol Buffer representation of this scalar object.
-   **/
-  virtual serialization::Scalar getProto() const = 0;
-
-  /**
-   * @brief Make a deep copy of this Scalar.
-   *
-   * @return A cloned copy of this Scalar.
-   **/
-  virtual Scalar* clone() const = 0;
-
-  /**
-   * @brief Get the type of scalar value represented.
-   *
-   * @return The Type of the Scalar.
-   **/
-  inline const Type& getType() const {
-    return type_;
-  }
-
-  /**
-   * @brief Get the provenance of this scalar value.
-   *
-   * @return The source of this Scalar's data.
-   **/
-  virtual ScalarDataSource getDataSource() const = 0;
-
-  /**
-   * @brief Get this Scalar's value for the given tuple from a ValueAccessor.
-   * @note This only works for Scalars which can be evaluated for a single
-   *       table. Use getValueForJoinedTuples() where necessary.
-   *
-   * @param accessor The ValueAccessor that will be used to access the tuple to
-   *        evaluate this Scalar for.
-   * @param tuple The ID of the tuple in accessor (the absolute position) to
-   *        evaluate this Scalar for.
-   * @return The value of this scalar for the given tuple in the given
-   *         TupleStorageSubBlock.
-   **/
-  virtual TypedValue getValueForSingleTuple(const ValueAccessor &accessor,
-                                            const tuple_id tuple) const = 0;
-
-  /**
-   * @brief Get this Scalar's value for the given pair of joined tuples.
-   *
-   * @param left_accessor The ValueAccessor that the first of the joined
-   *        tuples can be read from (this does NOT necessarily correspond to
-   *        the left operand of a binary operation).
-   * @param left_relation_id The ID of the relation that left_tuple_store
-   *        belongs to.
-   * @param left_tuple_id The ID of the tuple in left_tuple_store to evaluate
-   *        this Scalar for.
-   * @param right_accessor The ValueAccessor that the second of the joined
-   *        tuples can be read from (this does NOT necessarily correspond to
-   *        the right operand of a binary operation).
-   * @param right_relation_id The ID of the relation that right_tuple_store
-   *        belongs to.
-   * @param right_tuple_id The ID of the tuple in right_tuple_store to evaluate
-   *        this Scalar for.
-   * @return The value of this scalar for the given tuples.
-   **/
-  virtual TypedValue getValueForJoinedTuples(
-      const ValueAccessor &left_accessor,
-      const relation_id left_relation_id,
-      const tuple_id left_tuple_id,
-      const ValueAccessor &right_accessor,
-      const relation_id right_relation_id,
-      const tuple_id right_tuple_id) const = 0;
-
-  /**
-   * @brief Determine whether this Scalar's value is static (i.e. whether it is
-   *        the same regardless of tuple).
-   *
-   * @return Whether this Scalar's value is static.
-   **/
-  virtual bool hasStaticValue() const {
-    return false;
-  }
-
-  /**
-   * @brief Get this Scalar's static value.
-   * @warning hasStaticValue() should be called first to check whether a static
-   *          value actually exists.
-   *
-   * @return This Scalar's static value.
-   **/
-  virtual const TypedValue& getStaticValue() const;
-
-  /**
-   * @brief If it is possible to get this Scalar's values directly from a
-   *        ValueAccessor, return the attribute_id that should be used to get
-   *        values.
-   *
-   * @return The attribute_id of this Scalar's values using a ValueAccessor,
-   *         or -1 if values can not be obtained directly from a ValueAccessor.
-   **/
-  virtual attribute_id getAttributeIdForValueAccessor() const {
-    return -1;
-  }
-
-  /**
-   * @brief If it is possible to get this Scalar's values directly from a
-   *        ValueAccessor, return the ID of the relation that such a
-   *        ValueAccessor should belong to.
-   *
-   * @return The relation_id for ValueAccessors that can directly produce this
-   *         Scalar's values, or -1 if values can not be obtained directly from
-   *         a ValueAccessor.
-   **/
-  virtual relation_id getRelationIdForValueAccessor() const {
-    return -1;
-  }
-
-  /**
-   * @brief Get this Scalar's values for all tuples accesible via a
-   *        ValueAccessor.
-   *
-   * @param accessor A ValueAccessor which this Scalar will be evaluated over.
-   * @param sub_blocks_ref If non-NULL, contains references to the
-   *        TupleStorageSubBlock that produced accessor and any IndexSubBlocks
-   *        in the same StorageBlock. These sub-blocks may be used for
-   *        fast-path (non-scan) evaluation of Predicates embedded in this
-   *        scalar (e.g. WHEN predicates in ScalarCaseExpression). May be NULL,
-   *        in which case scan-based evaluation is always used.
-   * @return A ColumnVector of this Scalar's values for each tuple accesible
-   *         via accessor.
-   **/
-  virtual ColumnVector* getAllValues(ValueAccessor *accessor,
-                                     const SubBlocksReference *sub_blocks_ref) const = 0;
-
-  /**
-   * @brief Get this Scalar's value for all specified joined tuples from two
-   *        ValueAccessors.
-   *
-   * @param left_relation_id The ID of the left relation in the join.
-   * @param left_accessor A ValueAccessor which will be used to access tuples
-   *        from the left relation.
-   * @param right_relation_id The ID of the right relation in the join.
-   * @param right_accessor A ValueAccessor which will be used to access tuples
-   *        from the right relation.
-   * @param joined_tuple_ids A series of pairs of tuple ids from the left and
-   *        right relations that will be joined.
-   * @return A ColumnVector of this Scalar's values for all the joined tuples
-   *         specified by joined_tuple_ids.
-   **/
-  virtual ColumnVector* getAllValuesForJoin(
-      const relation_id left_relation_id,
-      ValueAccessor *left_accessor,
-      const relation_id right_relation_id,
-      ValueAccessor *right_accessor,
-      const std::vector<std::pair<tuple_id, tuple_id>> &joined_tuple_ids) const = 0;
-
- protected:
-  explicit Scalar(const Type &type) : type_(type) {
-  }
-
-  const Type &type_;
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(Scalar);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_EXPRESSIONS_SCALAR_SCALAR_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/scalar/ScalarAttribute.cpp
----------------------------------------------------------------------
diff --git a/expressions/scalar/ScalarAttribute.cpp b/expressions/scalar/ScalarAttribute.cpp
deleted file mode 100644
index cc42084..0000000
--- a/expressions/scalar/ScalarAttribute.cpp
+++ /dev/null
@@ -1,214 +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 "expressions/scalar/ScalarAttribute.hpp"
-
-#include <utility>
-#include <vector>
-
-#include "catalog/CatalogAttribute.hpp"
-#include "catalog/CatalogRelationSchema.hpp"
-#include "catalog/CatalogTypedefs.hpp"
-#include "expressions/Expressions.pb.h"
-#include "storage/StorageBlockInfo.hpp"
-#include "storage/ValueAccessor.hpp"
-#include "storage/ValueAccessorUtil.hpp"
-#include "types/Type.hpp"
-#include "types/TypedValue.hpp"
-#include "types/containers/ColumnVector.hpp"
-#include "utility/Macros.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-ScalarAttribute::ScalarAttribute(const CatalogAttribute &attribute)
-    : Scalar(attribute.getType()),
-      attribute_(attribute) {
-}
-
-serialization::Scalar ScalarAttribute::getProto() const {
-  serialization::Scalar proto;
-  proto.set_data_source(serialization::Scalar::ATTRIBUTE);
-  proto.SetExtension(serialization::ScalarAttribute::relation_id, attribute_.getParent().getID());
-  proto.SetExtension(serialization::ScalarAttribute::attribute_id, attribute_.getID());
-
-  return proto;
-}
-
-Scalar* ScalarAttribute::clone() const {
-  return new ScalarAttribute(attribute_);
-}
-
-TypedValue ScalarAttribute::getValueForSingleTuple(const ValueAccessor &accessor,
-                                                   const tuple_id tuple) const {
-  return accessor.getTypedValueAtAbsolutePositionVirtual(attribute_.getID(), tuple);
-}
-
-TypedValue ScalarAttribute::getValueForJoinedTuples(
-    const ValueAccessor &left_accessor,
-    const relation_id left_relation_id,
-    const tuple_id left_tuple_id,
-    const ValueAccessor &right_accessor,
-    const relation_id right_relation_id,
-    const tuple_id right_tuple_id) const {
-  // FIXME(chasseur): This can get confused and break for self-joins.
-  DCHECK((attribute_.getParent().getID() == left_relation_id)
-         || (attribute_.getParent().getID() == right_relation_id));
-  if (attribute_.getParent().getID() == left_relation_id) {
-    return left_accessor.getTypedValueAtAbsolutePositionVirtual(attribute_.getID(),
-                                                                left_tuple_id);
-  } else {
-    return right_accessor.getTypedValueAtAbsolutePositionVirtual(attribute_.getID(),
-                                                                 right_tuple_id);
-  }
-}
-
-attribute_id ScalarAttribute::getAttributeIdForValueAccessor() const {
-  return attribute_.getID();
-}
-
-relation_id ScalarAttribute::getRelationIdForValueAccessor() const {
-  return attribute_.getParent().getID();
-}
-
-ColumnVector* ScalarAttribute::getAllValues(ValueAccessor *accessor,
-                                            const SubBlocksReference *sub_blocks_ref) const {
-  const attribute_id attr_id = attribute_.getID();
-  const Type &result_type = attribute_.getType();
-  return InvokeOnValueAccessorMaybeTupleIdSequenceAdapter(
-      accessor,
-      [&attr_id, &result_type](auto *accessor) -> ColumnVector* {  // NOLINT(build/c++11)
-    if (NativeColumnVector::UsableForType(result_type)) {
-      NativeColumnVector *result = new NativeColumnVector(result_type,
-                                                          accessor->getNumTuples());
-      accessor->beginIteration();
-      if (result_type.isNullable()) {
-        if (accessor->isColumnAccessorSupported()) {
-          // If ColumnAccessor is supported on the underlying accessor, we have a fast strided
-          // column accessor available for the iteration on the underlying block.
-          // Since the attributes can be null, ColumnAccessor template takes a 'true' argument.
-          std::unique_ptr<const ColumnAccessor<true>>
-              column_accessor(accessor->template getColumnAccessor<true>(attr_id));
-          while (accessor->next()) {
-            const void *value = column_accessor->getUntypedValue();  // Fast strided access.
-            if (value == nullptr) {
-              result->appendNullValue();
-            } else {
-              result->appendUntypedValue(value);
-            }
-          }
-        } else {
-          while (accessor->next()) {
-            const void *value = accessor->template getUntypedValue<true>(attr_id);
-            if (value == nullptr) {
-              result->appendNullValue();
-            } else {
-              result->appendUntypedValue(value);
-            }
-          }
-        }
-      } else {
-        if (accessor->isColumnAccessorSupported()) {
-          // Since the attributes cannot be null, ColumnAccessor template takes a 'false' argument.
-          std::unique_ptr<const ColumnAccessor<false>>
-              column_accessor(accessor->template getColumnAccessor<false>(attr_id));
-          while (accessor->next()) {
-            result->appendUntypedValue(column_accessor->getUntypedValue());  // Fast strided access.
-          }
-        } else {
-          while (accessor->next()) {
-            result->appendUntypedValue(
-                accessor->template getUntypedValue<false>(attr_id));
-          }
-        }
-      }
-      return result;
-    } else {
-      IndirectColumnVector *result = new IndirectColumnVector(result_type,
-                                                              accessor->getNumTuples());
-      accessor->beginIteration();
-      while (accessor->next()) {
-        result->appendTypedValue(accessor->getTypedValue(attr_id));
-      }
-      return result;
-    }
-  });
-}
-
-ColumnVector* ScalarAttribute::getAllValuesForJoin(
-    const relation_id left_relation_id,
-    ValueAccessor *left_accessor,
-    const relation_id right_relation_id,
-    ValueAccessor *right_accessor,
-    const std::vector<std::pair<tuple_id, tuple_id>> &joined_tuple_ids) const {
-  DCHECK((attribute_.getParent().getID() == left_relation_id)
-         || (attribute_.getParent().getID() == right_relation_id));
-
-  const attribute_id attr_id = attribute_.getID();
-  const Type &result_type = attribute_.getType();
-
-  const bool using_left_relation = (attribute_.getParent().getID() == left_relation_id);
-  ValueAccessor *accessor = using_left_relation ? left_accessor
-                                                : right_accessor;
-
-  return InvokeOnAnyValueAccessor(
-      accessor,
-      [&joined_tuple_ids,
-       &attr_id,
-       &result_type,
-       &using_left_relation](auto *accessor) -> ColumnVector* {  // NOLINT(build/c++11)
-    if (NativeColumnVector::UsableForType(result_type)) {
-      NativeColumnVector *result = new NativeColumnVector(result_type,
-                                                          joined_tuple_ids.size());
-      if (result_type.isNullable()) {
-        for (const std::pair<tuple_id, tuple_id> &joined_pair : joined_tuple_ids) {
-          const void *value = accessor->template getUntypedValueAtAbsolutePosition<true>(
-              attr_id,
-              using_left_relation ? joined_pair.first : joined_pair.second);
-          if (value == nullptr) {
-            result->appendNullValue();
-          } else {
-            result->appendUntypedValue(value);
-          }
-        }
-      } else {
-        for (const std::pair<tuple_id, tuple_id> &joined_pair : joined_tuple_ids) {
-          result->appendUntypedValue(
-              accessor->template getUntypedValueAtAbsolutePosition<false>(
-                  attr_id,
-                  using_left_relation ? joined_pair.first : joined_pair.second));
-        }
-      }
-      return result;
-    } else {
-      IndirectColumnVector *result = new IndirectColumnVector(result_type,
-                                                              joined_tuple_ids.size());
-      for (const std::pair<tuple_id, tuple_id> &joined_pair : joined_tuple_ids) {
-        result->appendTypedValue(
-              accessor->getTypedValueAtAbsolutePosition(
-                  attr_id,
-                  using_left_relation ? joined_pair.first : joined_pair.second));
-      }
-      return result;
-    }
-  });
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/scalar/ScalarAttribute.hpp
----------------------------------------------------------------------
diff --git a/expressions/scalar/ScalarAttribute.hpp b/expressions/scalar/ScalarAttribute.hpp
deleted file mode 100644
index c6a41df..0000000
--- a/expressions/scalar/ScalarAttribute.hpp
+++ /dev/null
@@ -1,105 +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_EXPRESSIONS_SCALAR_SCALAR_ATTRIBUTE_HPP_
-#define QUICKSTEP_EXPRESSIONS_SCALAR_SCALAR_ATTRIBUTE_HPP_
-
-#include <utility>
-#include <vector>
-
-#include "catalog/CatalogTypedefs.hpp"
-#include "expressions/Expressions.pb.h"
-#include "expressions/scalar/Scalar.hpp"
-#include "storage/StorageBlockInfo.hpp"
-#include "types/TypedValue.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-
-class CatalogAttribute;
-class ColumnVector;
-class ValueAccessor;
-
-struct SubBlocksReference;
-
-/** \addtogroup Expressions
- *  @{
- */
-
-/**
- * @brief Scalars which are attribute values from tuples.
- **/
-class ScalarAttribute : public Scalar {
- public:
-  /**
-   * @brief Constructor.
-   *
-   * @param attribute The attribute to use.
-   **/
-  explicit ScalarAttribute(const CatalogAttribute &attribute);
-
-  serialization::Scalar getProto() const override;
-
-  Scalar* clone() const override;
-
-  ScalarDataSource getDataSource() const override {
-    return kAttribute;
-  }
-
-  TypedValue getValueForSingleTuple(const ValueAccessor &accessor,
-                                    const tuple_id tuple) const override;
-
-  TypedValue getValueForJoinedTuples(
-      const ValueAccessor &left_accessor,
-      const relation_id left_relation_id,
-      const tuple_id left_tuple_id,
-      const ValueAccessor &right_accessor,
-      const relation_id right_relation_id,
-      const tuple_id right_tuple_id) const override;
-
-  attribute_id getAttributeIdForValueAccessor() const override;
-
-  relation_id getRelationIdForValueAccessor() const override;
-
-  ColumnVector* getAllValues(ValueAccessor *accessor,
-                             const SubBlocksReference *sub_blocks_ref) const override;
-
-  ColumnVector* getAllValuesForJoin(
-      const relation_id left_relation_id,
-      ValueAccessor *left_accessor,
-      const relation_id right_relation_id,
-      ValueAccessor *right_accessor,
-      const std::vector<std::pair<tuple_id, tuple_id>> &joined_tuple_ids) const override;
-
-  const CatalogAttribute& getAttribute() const {
-    return attribute_;
-  }
-
- protected:
-  const CatalogAttribute &attribute_;
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(ScalarAttribute);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_EXPRESSIONS_SCALAR_SCALAR_ATTRIBUTE_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/scalar/ScalarBinaryExpression.cpp
----------------------------------------------------------------------
diff --git a/expressions/scalar/ScalarBinaryExpression.cpp b/expressions/scalar/ScalarBinaryExpression.cpp
deleted file mode 100644
index 5fe6cde..0000000
--- a/expressions/scalar/ScalarBinaryExpression.cpp
+++ /dev/null
@@ -1,377 +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 "expressions/scalar/ScalarBinaryExpression.hpp"
-
-#include <memory>
-#include <string>
-#include <utility>
-#include <vector>
-
-#include "catalog/CatalogTypedefs.hpp"
-#include "expressions/Expressions.pb.h"
-#include "storage/ValueAccessor.hpp"
-#include "types/Type.hpp"
-#include "types/TypeErrors.hpp"
-#include "types/TypedValue.hpp"
-#include "types/containers/ColumnVector.hpp"
-#include "types/operations/Operation.pb.h"
-#include "types/operations/binary_operations/BinaryOperation.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-ScalarBinaryExpression::ScalarBinaryExpression(const BinaryOperation &operation,
-                                               Scalar *left_operand,
-                                               Scalar *right_operand)
-    : Scalar(*operation.resultTypeForArgumentTypes(left_operand->getType(),
-                                                   right_operand->getType())),
-      operation_(operation),
-      left_operand_(left_operand),
-      right_operand_(right_operand) {
-  initHelper(false);
-}
-
-serialization::Scalar ScalarBinaryExpression::getProto() const {
-  serialization::Scalar proto;
-  proto.set_data_source(serialization::Scalar::BINARY_EXPRESSION);
-  proto.MutableExtension(serialization::ScalarBinaryExpression::operation)->CopyFrom(operation_.getProto());
-  proto.MutableExtension(serialization::ScalarBinaryExpression::left_operand)->CopyFrom(left_operand_->getProto());
-  proto.MutableExtension(serialization::ScalarBinaryExpression::right_operand)->CopyFrom(right_operand_->getProto());
-
-  return proto;
-}
-
-Scalar* ScalarBinaryExpression::clone() const {
-  return new ScalarBinaryExpression(operation_,
-                                    left_operand_->clone(),
-                                    right_operand_->clone());
-}
-
-TypedValue ScalarBinaryExpression::getValueForSingleTuple(const ValueAccessor &accessor,
-                                                          const tuple_id tuple) const {
-  if (fast_operator_.get() == nullptr) {
-    return static_value_.makeReferenceToThis();
-  } else {
-    return fast_operator_->applyToTypedValues(left_operand_->getValueForSingleTuple(accessor, tuple),
-                                              right_operand_->getValueForSingleTuple(accessor, tuple));
-  }
-}
-
-TypedValue ScalarBinaryExpression::getValueForJoinedTuples(
-    const ValueAccessor &left_accessor,
-    const relation_id left_relation_id,
-    const tuple_id left_tuple_id,
-    const ValueAccessor &right_accessor,
-    const relation_id right_relation_id,
-    const tuple_id right_tuple_id) const {
-  if (fast_operator_.get() == nullptr) {
-    return static_value_.makeReferenceToThis();
-  } else {
-    return fast_operator_->applyToTypedValues(
-        left_operand_->getValueForJoinedTuples(left_accessor,
-                                               left_relation_id,
-                                               left_tuple_id,
-                                               right_accessor,
-                                               right_relation_id,
-                                               right_tuple_id),
-        right_operand_->getValueForJoinedTuples(left_accessor,
-                                                left_relation_id,
-                                                left_tuple_id,
-                                                right_accessor,
-                                                right_relation_id,
-                                                right_tuple_id));
-  }
-}
-
-ColumnVector* ScalarBinaryExpression::getAllValues(
-    ValueAccessor *accessor,
-    const SubBlocksReference *sub_blocks_ref) const {
-  if (fast_operator_.get() == nullptr) {
-    return ColumnVector::MakeVectorOfValue(getType(),
-                                           static_value_,
-                                           accessor->getNumTuplesVirtual());
-  } else {
-    // NOTE(chasseur): We don't check if BOTH operands have a static value,
-    // because if they did then this expression would also have a static value
-    // handled in the case above.
-    if (left_operand_->hasStaticValue()) {
-#ifdef QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_SELECTION
-      const attribute_id right_operand_attr_id
-          = right_operand_->getAttributeIdForValueAccessor();
-      if (right_operand_attr_id != -1) {
-        return fast_operator_->applyToStaticValueAndValueAccessor(
-            left_operand_->getStaticValue(),
-            accessor,
-            right_operand_attr_id);
-      }
-#endif  // QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_SELECTION
-
-      std::unique_ptr<ColumnVector> right_result(
-          right_operand_->getAllValues(accessor, sub_blocks_ref));
-      return fast_operator_->applyToStaticValueAndColumnVector(
-          left_operand_->getStaticValue(),
-          *right_result);
-    } else if (right_operand_->hasStaticValue()) {
-#ifdef QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_SELECTION
-      const attribute_id left_operand_attr_id
-          = left_operand_->getAttributeIdForValueAccessor();
-      if (left_operand_attr_id != -1) {
-        return fast_operator_->applyToValueAccessorAndStaticValue(
-            accessor,
-            left_operand_attr_id,
-            right_operand_->getStaticValue());
-      }
-#endif  // QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_SELECTION
-
-      std::unique_ptr<ColumnVector> left_result(
-          left_operand_->getAllValues(accessor, sub_blocks_ref));
-      return fast_operator_->applyToColumnVectorAndStaticValue(
-          *left_result,
-          right_operand_->getStaticValue());
-    } else {
-#ifdef QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_SELECTION
-      const attribute_id left_operand_attr_id
-          = left_operand_->getAttributeIdForValueAccessor();
-      const attribute_id right_operand_attr_id
-          = right_operand_->getAttributeIdForValueAccessor();
-
-      if (left_operand_attr_id != -1) {
-        if (right_operand_attr_id != -1) {
-          return fast_operator_->applyToSingleValueAccessor(accessor,
-                                                            left_operand_attr_id,
-                                                            right_operand_attr_id);
-        } else {
-          std::unique_ptr<ColumnVector> right_result(
-              right_operand_->getAllValues(accessor, sub_blocks_ref));
-          return fast_operator_->applyToValueAccessorAndColumnVector(accessor,
-                                                                     left_operand_attr_id,
-                                                                     *right_result);
-        }
-      } else if (right_operand_attr_id != -1) {
-        std::unique_ptr<ColumnVector> left_result(
-            left_operand_->getAllValues(accessor, sub_blocks_ref));
-        return fast_operator_->applyToColumnVectorAndValueAccessor(*left_result,
-                                                                   accessor,
-                                                                   right_operand_attr_id);
-      }
-#endif  // QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_SELECTION
-
-      std::unique_ptr<ColumnVector> left_result(
-          left_operand_->getAllValues(accessor, sub_blocks_ref));
-      std::unique_ptr<ColumnVector> right_result(
-          right_operand_->getAllValues(accessor, sub_blocks_ref));
-      return fast_operator_->applyToColumnVectors(*left_result, *right_result);
-    }
-  }
-}
-
-ColumnVector* ScalarBinaryExpression::getAllValuesForJoin(
-    const relation_id left_relation_id,
-    ValueAccessor *left_accessor,
-    const relation_id right_relation_id,
-    ValueAccessor *right_accessor,
-    const std::vector<std::pair<tuple_id, tuple_id>> &joined_tuple_ids) const {
-  if (fast_operator_.get() == nullptr) {
-    return ColumnVector::MakeVectorOfValue(getType(),
-                                           static_value_,
-                                           joined_tuple_ids.size());
-  } else {
-    if (left_operand_->hasStaticValue()) {
-#ifdef QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_JOIN
-      const attribute_id right_operand_attr_id
-          = right_operand_->getAttributeIdForValueAccessor();
-      if (right_operand_attr_id != -1) {
-        const relation_id right_operand_relation_id
-            = right_operand_->getRelationIdForValueAccessor();
-        DCHECK_NE(right_operand_relation_id, -1);
-        DCHECK((right_operand_relation_id == left_relation_id)
-               || (right_operand_relation_id == right_relation_id));
-        const bool using_left_relation = (right_operand_relation_id == left_relation_id);
-        ValueAccessor *right_operand_accessor = using_left_relation ? left_accessor
-                                                                    : right_accessor;
-        return fast_operator_->applyToStaticValueAndValueAccessorForJoin(
-            left_operand_->getStaticValue(),
-            right_operand_accessor,
-            using_left_relation,
-            right_operand_attr_id,
-            joined_tuple_ids);
-      }
-#endif  // QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_JOIN
-
-      std::unique_ptr<ColumnVector> right_result(
-          right_operand_->getAllValuesForJoin(left_relation_id,
-                                              left_accessor,
-                                              right_relation_id,
-                                              right_accessor,
-                                              joined_tuple_ids));
-      return fast_operator_->applyToStaticValueAndColumnVector(
-          left_operand_->getStaticValue(),
-          *right_result);
-    } else if (right_operand_->hasStaticValue()) {
-#ifdef QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_JOIN
-      const attribute_id left_operand_attr_id
-          = left_operand_->getAttributeIdForValueAccessor();
-      if (left_operand_attr_id != -1) {
-        const relation_id left_operand_relation_id
-            = left_operand_->getRelationIdForValueAccessor();
-        DCHECK_NE(left_operand_relation_id, -1);
-        DCHECK((left_operand_relation_id == left_relation_id)
-               || (left_operand_relation_id == right_relation_id));
-        const bool using_left_relation = (left_operand_relation_id == left_relation_id);
-        ValueAccessor *left_operand_accessor = using_left_relation ? left_accessor
-                                                                   : right_accessor;
-        return fast_operator_->applyToValueAccessorAndStaticValueForJoin(
-            left_operand_accessor,
-            using_left_relation,
-            left_operand_attr_id,
-            right_operand_->getStaticValue(),
-            joined_tuple_ids);
-      }
-#endif  // QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_JOIN
-
-      std::unique_ptr<ColumnVector> left_result(
-          left_operand_->getAllValuesForJoin(left_relation_id,
-                                             left_accessor,
-                                             right_relation_id,
-                                             right_accessor,
-                                             joined_tuple_ids));
-      return fast_operator_->applyToColumnVectorAndStaticValue(
-          *left_result,
-          right_operand_->getStaticValue());
-    } else {
-#ifdef QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_JOIN
-      const attribute_id left_operand_attr_id
-          = left_operand_->getAttributeIdForValueAccessor();
-      const attribute_id right_operand_attr_id
-          = right_operand_->getAttributeIdForValueAccessor();
-      if (left_operand_attr_id != -1) {
-        const relation_id left_operand_relation_id
-            = left_operand_->getRelationIdForValueAccessor();
-        DCHECK_NE(left_operand_relation_id, -1);
-        DCHECK((left_operand_relation_id == left_relation_id)
-               || (left_operand_relation_id == right_relation_id));
-        const bool using_left_relation_for_left_operand
-            = (left_operand_relation_id == left_relation_id);
-        ValueAccessor *left_operand_accessor = using_left_relation_for_left_operand ? left_accessor
-                                                                                    : right_accessor;
-
-#ifdef QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_JOIN_WITH_BINARY_EXPRESSIONS
-        if (right_operand_attr_id != -1) {
-          const relation_id right_operand_relation_id
-              = right_operand_->getRelationIdForValueAccessor();
-          DCHECK_NE(right_operand_relation_id, -1);
-          DCHECK((right_operand_relation_id == left_relation_id)
-                 || (right_operand_relation_id == right_relation_id));
-          const bool using_left_relation_for_right_operand
-              = (right_operand_relation_id == left_relation_id);
-          ValueAccessor *right_operand_accessor = using_left_relation_for_right_operand ? left_accessor
-                                                                                        : right_accessor;
-          return fast_operator_->applyToValueAccessorsForJoin(left_operand_accessor,
-                                                              using_left_relation_for_left_operand,
-                                                              left_operand_attr_id,
-                                                              right_operand_accessor,
-                                                              using_left_relation_for_right_operand,
-                                                              right_operand_attr_id,
-                                                              joined_tuple_ids);
-        }
-#endif  // QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_JOIN_WITH_BINARY_EXPRESSIONS
-        std::unique_ptr<ColumnVector> right_result(
-            right_operand_->getAllValuesForJoin(left_relation_id,
-                                                left_accessor,
-                                                right_relation_id,
-                                                right_accessor,
-                                                joined_tuple_ids));
-
-        return fast_operator_->applyToValueAccessorAndColumnVectorForJoin(
-            left_operand_accessor,
-            using_left_relation_for_left_operand,
-            left_operand_attr_id,
-            *right_result,
-            joined_tuple_ids);
-      } else if (right_operand_attr_id != -1) {
-        const relation_id right_operand_relation_id
-            = right_operand_->getRelationIdForValueAccessor();
-        DCHECK_NE(right_operand_relation_id, -1);
-        DCHECK((right_operand_relation_id == left_relation_id)
-               || (right_operand_relation_id == right_relation_id));
-        const bool using_left_relation_for_right_operand
-            = (right_operand_relation_id == left_relation_id);
-        ValueAccessor *right_operand_accessor = using_left_relation_for_right_operand ? left_accessor
-                                                                                      : right_accessor;
-
-        std::unique_ptr<ColumnVector> left_result(
-            left_operand_->getAllValuesForJoin(left_relation_id,
-                                               left_accessor,
-                                               right_relation_id,
-                                               right_accessor,
-                                               joined_tuple_ids));
-        return fast_operator_->applyToColumnVectorAndValueAccessorForJoin(
-            *left_result,
-            right_operand_accessor,
-            using_left_relation_for_right_operand,
-            right_operand_attr_id,
-            joined_tuple_ids);
-      }
-#endif  // QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_JOIN
-
-      std::unique_ptr<ColumnVector> left_result(
-          left_operand_->getAllValuesForJoin(left_relation_id,
-                                             left_accessor,
-                                             right_relation_id,
-                                             right_accessor,
-                                             joined_tuple_ids));
-      std::unique_ptr<ColumnVector> right_result(
-          right_operand_->getAllValuesForJoin(left_relation_id,
-                                              left_accessor,
-                                              right_relation_id,
-                                              right_accessor,
-                                              joined_tuple_ids));
-      return fast_operator_->applyToColumnVectors(*left_result, *right_result);
-    }
-  }
-}
-
-void ScalarBinaryExpression::initHelper(bool own_children) {
-  if (operation_.canApplyToTypes(left_operand_->getType(), right_operand_->getType())) {
-    if (left_operand_->hasStaticValue() && right_operand_->hasStaticValue()) {
-      static_value_ = operation_.applyToChecked(left_operand_->getStaticValue(),
-                                                left_operand_->getType(),
-                                                right_operand_->getStaticValue(),
-                                                right_operand_->getType());
-    } else {
-      fast_operator_.reset(operation_.makeUncheckedBinaryOperatorForTypes(left_operand_->getType(),
-                                                                           right_operand_->getType()));
-    }
-  } else {
-    const Type &left_operand_type = left_operand_->getType();
-    const Type &right_operand_type = right_operand_->getType();
-    if (!own_children) {
-      left_operand_.release();
-      right_operand_.release();
-    }
-    throw OperationInapplicableToType(operation_.getName(),
-                                      2,
-                                      left_operand_type.getName().c_str(),
-                                      right_operand_type.getName().c_str());
-  }
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/scalar/ScalarBinaryExpression.hpp
----------------------------------------------------------------------
diff --git a/expressions/scalar/ScalarBinaryExpression.hpp b/expressions/scalar/ScalarBinaryExpression.hpp
deleted file mode 100644
index c84792a..0000000
--- a/expressions/scalar/ScalarBinaryExpression.hpp
+++ /dev/null
@@ -1,130 +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_EXPRESSIONS_SCALAR_SCALAR_BINARY_EXPRESSION_HPP_
-#define QUICKSTEP_EXPRESSIONS_SCALAR_SCALAR_BINARY_EXPRESSION_HPP_
-
-#include <memory>
-#include <utility>
-#include <vector>
-
-#include "catalog/CatalogTypedefs.hpp"
-#include "expressions/Expressions.pb.h"
-#include "expressions/scalar/Scalar.hpp"
-#include "storage/StorageBlockInfo.hpp"
-#include "types/TypedValue.hpp"
-#include "types/operations/binary_operations/BinaryOperation.hpp"
-#include "utility/Macros.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-class ColumnVector;
-class ValueAccessor;
-
-struct SubBlocksReference;
-
-/** \addtogroup Expressions
- *  @{
- */
-
-/**
- * @brief Expressions which are based on a BinaryOperation.
- **/
-class ScalarBinaryExpression : public Scalar {
- public:
-  /**
-   * @brief Constructor.
-   *
-   * @param operation The binary operation to be performed.
-   * @param left_operand The left argument of the operation, which this
-   *        ScalarBinaryExpression takes ownership of.
-   * @param right_operand The right argument of the operation, which this
-   *        ScalarBinaryExpression takes ownership of.
-   **/
-  ScalarBinaryExpression(const BinaryOperation &operation,
-                         Scalar *left_operand,
-                         Scalar *right_operand);
-
-  /**
-   * @brief Destructor
-   **/
-  ~ScalarBinaryExpression() override {
-  }
-
-  serialization::Scalar getProto() const override;
-
-  Scalar* clone() const override;
-
-  ScalarDataSource getDataSource() const override {
-    return kBinaryExpression;
-  }
-
-  TypedValue getValueForSingleTuple(const ValueAccessor &accessor,
-                                    const tuple_id tuple) const override;
-
-  TypedValue getValueForJoinedTuples(
-      const ValueAccessor &left_accessor,
-      const relation_id left_relation_id,
-      const tuple_id left_tuple_id,
-      const ValueAccessor &right_accessor,
-      const relation_id right_relation_id,
-      const tuple_id right_tuple_id) const override;
-
-  bool hasStaticValue() const override {
-    return fast_operator_.get() == nullptr;
-  }
-
-  const TypedValue& getStaticValue() const override {
-    DCHECK(hasStaticValue());
-    return static_value_;
-  }
-
-  ColumnVector* getAllValues(ValueAccessor *accessor,
-                             const SubBlocksReference *sub_blocks_ref) const override;
-
-  ColumnVector* getAllValuesForJoin(
-      const relation_id left_relation_id,
-      ValueAccessor *left_accessor,
-      const relation_id right_relation_id,
-      ValueAccessor *right_accessor,
-      const std::vector<std::pair<tuple_id, tuple_id>> &joined_tuple_ids) const override;
-
- private:
-  void initHelper(bool own_children);
-
-  const BinaryOperation &operation_;
-
-  std::unique_ptr<Scalar> left_operand_;
-  std::unique_ptr<Scalar> right_operand_;
-  TypedValue static_value_;
-  std::unique_ptr<UncheckedBinaryOperator> fast_operator_;
-
-  friend class PredicateTest;
-  friend class ScalarTest;
-
-  DISALLOW_COPY_AND_ASSIGN(ScalarBinaryExpression);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_EXPRESSIONS_SCALAR_SCALAR_BINARY_EXPRESSION_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/scalar/ScalarCaseExpression.cpp
----------------------------------------------------------------------
diff --git a/expressions/scalar/ScalarCaseExpression.cpp b/expressions/scalar/ScalarCaseExpression.cpp
deleted file mode 100644
index c81f723..0000000
--- a/expressions/scalar/ScalarCaseExpression.cpp
+++ /dev/null
@@ -1,515 +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 "expressions/scalar/ScalarCaseExpression.hpp"
-
-#include <cstddef>
-#include <memory>
-#include <utility>
-#include <vector>
-
-#include "catalog/CatalogTypedefs.hpp"
-#include "expressions/Expressions.pb.h"
-#include "expressions/predicate/Predicate.hpp"
-#include "expressions/scalar/Scalar.hpp"
-#include "storage/TupleIdSequence.hpp"
-#include "storage/ValueAccessor.hpp"
-#include "storage/ValueAccessorUtil.hpp"
-#include "types/Type.hpp"
-#include "types/Type.pb.h"
-#include "types/TypedValue.hpp"
-#include "types/containers/ColumnVector.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-ScalarCaseExpression::ScalarCaseExpression(
-    const Type &result_type,
-    std::vector<std::unique_ptr<Predicate>> &&when_predicates,
-    std::vector<std::unique_ptr<Scalar>> &&result_expressions,
-    Scalar *else_result_expression)
-    : Scalar(result_type),
-      when_predicates_(std::move(when_predicates)),
-      result_expressions_(std::move(result_expressions)),
-      else_result_expression_(else_result_expression),
-      fixed_result_expression_(nullptr),
-      has_static_value_(false) {
-  DCHECK_EQ(when_predicates_.size(), result_expressions_.size());
-  DCHECK(else_result_expression_ != nullptr);
-
-#ifdef QUICKSTEP_DEBUG
-  for (const std::unique_ptr<Scalar> &result_expr : result_expressions_) {
-    DCHECK(result_expr->getType().isSubsumedBy(type_));
-  }
-#endif  // QUICKSTEP_DEBUG
-
-  DCHECK(else_result_expression_->getType().isSubsumedBy(type_));
-
-  // Resolve case branch statically if possible.
-  bool static_case_branch = true;
-  for (std::vector<std::unique_ptr<Predicate>>::size_type case_idx = 0;
-       case_idx < when_predicates_.size();
-       ++case_idx) {
-    if (when_predicates_[case_idx]->hasStaticResult()) {
-      if (when_predicates_[case_idx]->getStaticResult()) {
-        fixed_result_expression_ = result_expressions_[case_idx].get();
-        break;
-      }
-    } else {
-      static_case_branch = false;
-    }
-  }
-
-  if (static_case_branch && (fixed_result_expression_ == nullptr)) {
-    fixed_result_expression_ = else_result_expression_.get();
-  }
-
-  if (fixed_result_expression_ != nullptr) {
-    if (fixed_result_expression_->hasStaticValue()) {
-      has_static_value_ = true;
-      static_value_ = fixed_result_expression_->getStaticValue();
-    } else {
-      // CASE always goes to the same branch, but its value is not static.
-    }
-  }
-}
-
-serialization::Scalar ScalarCaseExpression::getProto() const {
-  serialization::Scalar proto;
-  proto.set_data_source(serialization::Scalar::CASE_EXPRESSION);
-  proto.MutableExtension(serialization::ScalarCaseExpression::result_type)
-      ->CopyFrom(type_.getProto());
-  for (const std::unique_ptr<Predicate> &when_pred : when_predicates_) {
-    proto.AddExtension(serialization::ScalarCaseExpression::when_predicate)
-      ->CopyFrom(when_pred->getProto());
-  }
-  for (const std::unique_ptr<Scalar> &result_expr : result_expressions_) {
-    proto.AddExtension(serialization::ScalarCaseExpression::result_expression)
-      ->CopyFrom(result_expr->getProto());
-  }
-  proto.MutableExtension(serialization::ScalarCaseExpression::else_result_expression)
-      ->CopyFrom(else_result_expression_->getProto());
-
-  return proto;
-}
-
-Scalar* ScalarCaseExpression::clone() const {
-  std::vector<std::unique_ptr<Predicate>> when_predicate_clones;
-  when_predicate_clones.reserve(when_predicates_.size());
-  for (const std::unique_ptr<Predicate> &when_pred : when_predicates_) {
-    when_predicate_clones.emplace_back(when_pred->clone());
-  }
-
-  std::vector<std::unique_ptr<Scalar>> result_expression_clones;
-  result_expression_clones.reserve(result_expressions_.size());
-  for (const std::unique_ptr<Scalar> &result_expr : result_expressions_) {
-    result_expression_clones.emplace_back(result_expr->clone());
-  }
-
-  return new ScalarCaseExpression(type_,
-                                  std::move(when_predicate_clones),
-                                  std::move(result_expression_clones),
-                                  else_result_expression_->clone());
-}
-
-TypedValue ScalarCaseExpression::getValueForSingleTuple(
-    const ValueAccessor &accessor,
-    const tuple_id tuple) const {
-  if (has_static_value_) {
-    return static_value_.makeReferenceToThis();
-  } else if (fixed_result_expression_ != nullptr) {
-    return fixed_result_expression_->getValueForSingleTuple(accessor, tuple);
-  } else {
-    for (std::vector<std::unique_ptr<Predicate>>::size_type case_idx = 0;
-         case_idx < when_predicates_.size();
-         ++case_idx) {
-      if (when_predicates_[case_idx]->matchesForSingleTuple(accessor, tuple)) {
-        return result_expressions_[case_idx]->getValueForSingleTuple(accessor, tuple);
-      }
-    }
-    return else_result_expression_->getValueForSingleTuple(accessor, tuple);
-  }
-}
-
-TypedValue ScalarCaseExpression::getValueForJoinedTuples(
-    const ValueAccessor &left_accessor,
-    const relation_id left_relation_id,
-    const tuple_id left_tuple_id,
-    const ValueAccessor &right_accessor,
-    const relation_id right_relation_id,
-    const tuple_id right_tuple_id) const {
-  if (has_static_value_) {
-    return static_value_.makeReferenceToThis();
-  } else if (fixed_result_expression_ != nullptr) {
-    return fixed_result_expression_->getValueForJoinedTuples(left_accessor,
-                                                             left_relation_id,
-                                                             left_tuple_id,
-                                                             right_accessor,
-                                                             right_relation_id,
-                                                             right_tuple_id);
-  } else {
-    for (std::vector<std::unique_ptr<Predicate>>::size_type case_idx = 0;
-         case_idx < when_predicates_.size();
-         ++case_idx) {
-      if (when_predicates_[case_idx]->matchesForJoinedTuples(left_accessor,
-                                                             left_relation_id,
-                                                             left_tuple_id,
-                                                             right_accessor,
-                                                             right_relation_id,
-                                                             right_tuple_id)) {
-        return result_expressions_[case_idx]->getValueForJoinedTuples(
-            left_accessor,
-            left_relation_id,
-            left_tuple_id,
-            right_accessor,
-            right_relation_id,
-            right_tuple_id);
-      }
-    }
-    return else_result_expression_->getValueForJoinedTuples(
-        left_accessor,
-        left_relation_id,
-        left_tuple_id,
-        right_accessor,
-        right_relation_id,
-        right_tuple_id);
-  }
-}
-
-ColumnVector* ScalarCaseExpression::getAllValues(
-    ValueAccessor *accessor,
-    const SubBlocksReference *sub_blocks_ref) const {
-  return InvokeOnValueAccessorMaybeTupleIdSequenceAdapter(
-      accessor,
-      [&](auto *accessor) -> ColumnVector* {  // NOLINT(build/c++11)
-    if (has_static_value_) {
-      return ColumnVector::MakeVectorOfValue(type_,
-                                             static_value_,
-                                             accessor->getNumTuples());
-    } else if (fixed_result_expression_ != nullptr) {
-      return fixed_result_expression_->getAllValues(accessor, sub_blocks_ref);
-    }
-
-    const TupleIdSequence *accessor_sequence = accessor->getTupleIdSequence();
-
-    // Initially set '*else_matches' to cover all tuples from the
-    // ValueAccessor.
-    std::unique_ptr<TupleIdSequence> else_matches;
-    if (accessor_sequence != nullptr) {
-      else_matches.reset(new TupleIdSequence(accessor_sequence->length()));
-      else_matches->assignFrom(*accessor_sequence);
-    } else {
-      else_matches.reset(new TupleIdSequence(accessor->getEndPosition()));
-      else_matches->setRange(0, else_matches->length(), true);
-    }
-
-    // Generate a TupleIdSequence of matches for each branch in the CASE.
-    std::vector<std::unique_ptr<TupleIdSequence>> case_matches;
-    for (std::vector<std::unique_ptr<Predicate>>::size_type case_idx = 0;
-         case_idx < when_predicates_.size();
-         ++case_idx) {
-      if (else_matches->empty()) {
-        break;
-      }
-
-      case_matches.emplace_back(when_predicates_[case_idx]->getAllMatches(
-          accessor,
-          sub_blocks_ref,
-          else_matches.get(),
-          accessor_sequence));
-      else_matches->intersectWithComplement(*case_matches.back());
-    }
-
-    // Generate a ColumnVector of all the values for each case.
-    std::vector<std::unique_ptr<ColumnVector>> case_results;
-    for (std::vector<std::unique_ptr<TupleIdSequence>>::size_type case_idx = 0;
-         case_idx < case_matches.size();
-         ++case_idx) {
-      std::unique_ptr<ValueAccessor> case_accessor(
-          accessor->createSharedTupleIdSequenceAdapter(*case_matches[case_idx]));
-      case_results.emplace_back(
-          result_expressions_[case_idx]->getAllValues(case_accessor.get(), sub_blocks_ref));
-    }
-
-    std::unique_ptr<ColumnVector> else_results;
-    if (!else_matches->empty()) {
-      std::unique_ptr<ValueAccessor> else_accessor(
-          accessor->createSharedTupleIdSequenceAdapter(*else_matches));
-      else_results.reset(else_result_expression_->getAllValues(else_accessor.get(), sub_blocks_ref));
-    }
-
-    // Multiplex per-case results into a single ColumnVector with values in the
-    // correct positions.
-    return this->multiplexColumnVectors(
-        accessor->getNumTuples(),
-        accessor_sequence,
-        case_matches,
-        *else_matches,
-        &case_results,
-        else_results.get());
-  });
-}
-
-ColumnVector* ScalarCaseExpression::getAllValuesForJoin(
-    const relation_id left_relation_id,
-    ValueAccessor *left_accessor,
-    const relation_id right_relation_id,
-    ValueAccessor *right_accessor,
-    const std::vector<std::pair<tuple_id, tuple_id>> &joined_tuple_ids) const {
-  // Slice 'joined_tuple_ids' apart by case.
-  //
-  // NOTE(chasseur): We use TupleIdSequence to keep track of the positions in
-  // 'joined_tuple_ids' that match for a particular case. This is a bit hacky,
-  // since TupleIdSequence is intended to represent tuple IDs in one block.
-  // All we're really using it for is to multiplex results into the right
-  // place.
-  //
-  // TODO(chasseur): Currently case predicates are evaluated tuple-at-a-time
-  // here (just like in a NestedLoopsJoin). If and when we implement vectorized
-  // evaluation of nested-loops predicates (or just filtration of joined IDs),
-  // we should use that here.
-  TupleIdSequence else_positions(joined_tuple_ids.size());
-  else_positions.setRange(0, joined_tuple_ids.size(), true);
-
-  std::vector<std::unique_ptr<TupleIdSequence>> case_positions;
-  std::vector<std::vector<std::pair<tuple_id, tuple_id>>> case_matches;
-  for (std::vector<std::unique_ptr<Predicate>>::size_type case_idx = 0;
-       case_idx < when_predicates_.size();
-       ++case_idx) {
-    if (else_positions.empty()) {
-      break;
-    }
-
-    TupleIdSequence *current_case_positions = new TupleIdSequence(joined_tuple_ids.size());
-    case_positions.emplace_back(current_case_positions);
-
-    case_matches.resize(case_matches.size() + 1);
-    std::vector<std::pair<tuple_id, tuple_id>> &current_case_matches = case_matches.back();
-
-    const Predicate &case_predicate = *when_predicates_[case_idx];
-    for (tuple_id pos : else_positions) {
-      const std::pair<tuple_id, tuple_id> check_pair = joined_tuple_ids[pos];
-      if (case_predicate.matchesForJoinedTuples(*left_accessor,
-                                                left_relation_id,
-                                                check_pair.first,
-                                                *right_accessor,
-                                                right_relation_id,
-                                                check_pair.second)) {
-        current_case_positions->set(pos, true);
-        current_case_matches.emplace_back(check_pair);
-      }
-    }
-
-    else_positions.intersectWithComplement(*current_case_positions);
-  }
-
-  // Generate a ColumnVector of all the values for each case.
-  std::vector<std::unique_ptr<ColumnVector>> case_results;
-  for (std::vector<std::vector<std::pair<tuple_id, tuple_id>>>::size_type case_idx = 0;
-       case_idx < case_matches.size();
-       ++case_idx) {
-    case_results.emplace_back(result_expressions_[case_idx]->getAllValuesForJoin(
-        left_relation_id,
-        left_accessor,
-        right_relation_id,
-        right_accessor,
-        case_matches[case_idx]));
-  }
-
-  std::unique_ptr<ColumnVector> else_results;
-  if (!else_positions.empty()) {
-    std::vector<std::pair<tuple_id, tuple_id>> else_matches;
-    for (tuple_id pos : else_positions) {
-      else_matches.emplace_back(joined_tuple_ids[pos]);
-    }
-
-    else_results.reset(else_result_expression_->getAllValuesForJoin(
-        left_relation_id,
-        left_accessor,
-        right_relation_id,
-        right_accessor,
-        else_matches));
-  }
-
-  // Multiplex per-case results into a single ColumnVector with values in the
-  // correct positions.
-  return multiplexColumnVectors(
-      joined_tuple_ids.size(),
-      nullptr,
-      case_positions,
-      else_positions,
-      &case_results,
-      else_results.get());
-}
-
-void ScalarCaseExpression::MultiplexNativeColumnVector(
-    const TupleIdSequence *source_sequence,
-    const TupleIdSequence &case_matches,
-    const NativeColumnVector &case_result,
-    NativeColumnVector *output) {
-  if (source_sequence == nullptr) {
-    if (case_result.typeIsNullable()) {
-      TupleIdSequence::const_iterator output_pos_it = case_matches.begin();
-      for (std::size_t input_pos = 0;
-           input_pos < case_result.size();
-           ++input_pos, ++output_pos_it) {
-        const void *value = case_result.getUntypedValue<true>(input_pos);
-        if (value == nullptr) {
-          output->positionalWriteNullValue(*output_pos_it);
-        } else {
-          output->positionalWriteUntypedValue(*output_pos_it, value);
-        }
-      }
-    } else {
-      TupleIdSequence::const_iterator output_pos_it = case_matches.begin();
-      for (std::size_t input_pos = 0;
-           input_pos < case_result.size();
-           ++input_pos, ++output_pos_it) {
-        output->positionalWriteUntypedValue(*output_pos_it,
-                                            case_result.getUntypedValue<false>(input_pos));
-      }
-    }
-  } else {
-    if (case_result.typeIsNullable()) {
-      std::size_t input_pos = 0;
-      TupleIdSequence::const_iterator source_sequence_it = source_sequence->begin();
-      for (std::size_t output_pos = 0;
-           output_pos < output->size();
-           ++output_pos, ++source_sequence_it) {
-        if (case_matches.get(*source_sequence_it)) {
-          const void *value = case_result.getUntypedValue<true>(input_pos++);
-          if (value == nullptr) {
-            output->positionalWriteNullValue(output_pos);
-          } else {
-            output->positionalWriteUntypedValue(output_pos, value);
-          }
-        }
-      }
-    } else {
-      std::size_t input_pos = 0;
-      TupleIdSequence::const_iterator source_sequence_it = source_sequence->begin();
-      for (std::size_t output_pos = 0;
-           output_pos < output->size();
-           ++output_pos, ++source_sequence_it) {
-        if (case_matches.get(*source_sequence_it)) {
-          output->positionalWriteUntypedValue(output_pos,
-                                              case_result.getUntypedValue<false>(input_pos++));
-        }
-      }
-    }
-  }
-}
-
-void ScalarCaseExpression::MultiplexIndirectColumnVector(
-    const TupleIdSequence *source_sequence,
-    const TupleIdSequence &case_matches,
-    IndirectColumnVector *case_result,
-    IndirectColumnVector *output) {
-  if (source_sequence == nullptr) {
-    TupleIdSequence::const_iterator output_pos_it = case_matches.begin();
-    for (std::size_t input_pos = 0;
-         input_pos < case_result->size();
-         ++input_pos, ++output_pos_it) {
-      output->positionalWriteTypedValue(*output_pos_it,
-                                        case_result->moveTypedValue(input_pos));
-    }
-  } else {
-    std::size_t input_pos = 0;
-    TupleIdSequence::const_iterator source_sequence_it = source_sequence->begin();
-    for (std::size_t output_pos = 0;
-         output_pos < output->size();
-         ++output_pos, ++source_sequence_it) {
-      if (case_matches.get(*source_sequence_it)) {
-        output->positionalWriteTypedValue(output_pos,
-                                          case_result->moveTypedValue(input_pos++));
-      }
-    }
-  }
-}
-
-ColumnVector* ScalarCaseExpression::multiplexColumnVectors(
-    const std::size_t output_size,
-    const TupleIdSequence *source_sequence,
-    const std::vector<std::unique_ptr<TupleIdSequence>> &case_matches,
-    const TupleIdSequence &else_matches,
-    std::vector<std::unique_ptr<ColumnVector>> *case_results,
-    ColumnVector *else_result) const {
-  DCHECK_EQ(case_matches.size(), case_results->size());
-
-  if (NativeColumnVector::UsableForType(type_)) {
-    std::unique_ptr<NativeColumnVector> native_result(
-        new NativeColumnVector(type_, output_size));
-    native_result->prepareForPositionalWrites();
-
-    for (std::vector<std::unique_ptr<TupleIdSequence>>::size_type case_idx = 0;
-         case_idx < case_matches.size();
-         ++case_idx) {
-      DCHECK((*case_results)[case_idx]->isNative());
-      if (!case_matches[case_idx]->empty()) {
-        MultiplexNativeColumnVector(
-            source_sequence,
-            *case_matches[case_idx],
-            static_cast<const NativeColumnVector&>(*(*case_results)[case_idx]),
-            native_result.get());
-      }
-    }
-
-    if (else_result != nullptr) {
-      DCHECK(else_result->isNative());
-      DCHECK(!else_matches.empty());
-      MultiplexNativeColumnVector(source_sequence,
-                                  else_matches,
-                                  static_cast<const NativeColumnVector&>(*else_result),
-                                  native_result.get());
-    }
-
-    return native_result.release();
-  } else {
-    std::unique_ptr<IndirectColumnVector> indirect_result(
-        new IndirectColumnVector(type_, output_size));
-    indirect_result->prepareForPositionalWrites();
-
-    for (std::vector<std::unique_ptr<TupleIdSequence>>::size_type case_idx = 0;
-         case_idx < case_matches.size();
-         ++case_idx) {
-      DCHECK(!(*case_results)[case_idx]->isNative());
-      if (!case_matches[case_idx]->empty()) {
-        MultiplexIndirectColumnVector(
-            source_sequence,
-            *case_matches[case_idx],
-            static_cast<IndirectColumnVector*>((*case_results)[case_idx].get()),
-            indirect_result.get());
-      }
-    }
-
-    if (else_result != nullptr) {
-      DCHECK(!else_result->isNative());
-      DCHECK(!else_matches.empty());
-      MultiplexIndirectColumnVector(source_sequence,
-                                    else_matches,
-                                    static_cast<IndirectColumnVector*>(else_result),
-                                    indirect_result.get());
-    }
-
-    return indirect_result.release();
-  }
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/scalar/ScalarCaseExpression.hpp
----------------------------------------------------------------------
diff --git a/expressions/scalar/ScalarCaseExpression.hpp b/expressions/scalar/ScalarCaseExpression.hpp
deleted file mode 100644
index e6809fa..0000000
--- a/expressions/scalar/ScalarCaseExpression.hpp
+++ /dev/null
@@ -1,202 +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_EXPRESSIONS_SCALAR_SCALAR_CASE_EXPRESSION_HPP_
-#define QUICKSTEP_EXPRESSIONS_SCALAR_SCALAR_CASE_EXPRESSION_HPP_
-
-#include <cstddef>
-#include <memory>
-#include <utility>
-#include <vector>
-
-#include "catalog/CatalogTypedefs.hpp"
-#include "expressions/Expressions.pb.h"
-#include "expressions/predicate/Predicate.hpp"
-#include "expressions/scalar/Scalar.hpp"
-#include "storage/StorageBlockInfo.hpp"
-#include "types/TypedValue.hpp"
-#include "utility/Macros.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-class ColumnVector;
-class IndirectColumnVector;
-class NativeColumnVector;
-class TupleIdSequence;
-class Type;
-class ValueAccessor;
-
-struct SubBlocksReference;
-
-/** \addtogroup Expressions
- *  @{
- */
-
-/**
- * @brief A SQL CASE expression, which consists of one or more Predicates from
- *        WHEN clauses that map to Scalars which are evaluated conditionally
- *        for the first matching WHEN predicate. Also contains a Scalar for the
- *        ELSE case where no WHEN predicate matches.
- * @note This class implements the most general form of a SQL case expression,
- *       a "searched CASE" expression. For other forms of the CASE expression
- *       (e.g. "simple CASE") the optimizer is responsible for resolving into
- *       this general form.
- **/
-class ScalarCaseExpression : public Scalar {
- public:
-  /**
-   * @brief Constructor.
-   *
-   * @param result_type The Type for values produced by this expression. Must
-   *        subsume the types of all result_expressions and
-   *        else_result_expression.
-   * @param when_predicates A vector of Predicates, one for each WHEN clause,
-   *        in descending order of priority. Will be moved-from.
-   * @param result_expressions A vector of Scalars, each of which is a THEN
-   *        expression corresponding to the WHEN clause in the same position in
-   *        when_predicates. Will be moved-from.
-   * @param else_result_expression A Scalar whose value will be used when none
-   *        of the when_predicates match. This is a required parameter. SQL
-   *        allows the ELSE clause of a CASE expression to be ommitted, in
-   *        which case it defaults to NULL. For compliance with the SQL
-   *        standard, an explicit ScalarLiteral with a NULL value should be
-   *        supplied here for such cases.
-   **/
-  ScalarCaseExpression(const Type &result_type,
-                       std::vector<std::unique_ptr<Predicate>> &&when_predicates,
-                       std::vector<std::unique_ptr<Scalar>> &&result_expressions,
-                       Scalar *else_result_expression);
-
-  ~ScalarCaseExpression() override {
-  }
-
-  serialization::Scalar getProto() const override;
-
-  Scalar* clone() const override;
-
-  ScalarDataSource getDataSource() const override {
-    return kCaseExpression;
-  }
-
-  TypedValue getValueForSingleTuple(const ValueAccessor &accessor,
-                                    const tuple_id tuple) const override;
-
-  TypedValue getValueForJoinedTuples(
-      const ValueAccessor &left_accessor,
-      const relation_id left_relation_id,
-      const tuple_id left_tuple_id,
-      const ValueAccessor &right_accessor,
-      const relation_id right_relation_id,
-      const tuple_id right_tuple_id) const override;
-
-  bool hasStaticValue() const override {
-    return has_static_value_;
-  }
-
-  const TypedValue& getStaticValue() const override {
-    DCHECK(has_static_value_);
-    return static_value_;
-  }
-
-  attribute_id getAttributeIdForValueAccessor() const override {
-    if (fixed_result_expression_ != nullptr) {
-      return fixed_result_expression_->getAttributeIdForValueAccessor();
-    } else {
-      return -1;
-    }
-  }
-
-  relation_id getRelationIdForValueAccessor() const override {
-    if (fixed_result_expression_ != nullptr) {
-      return fixed_result_expression_->getRelationIdForValueAccessor();
-    } else {
-      return -1;
-    }
-  }
-
-  ColumnVector* getAllValues(ValueAccessor *accessor,
-                             const SubBlocksReference *sub_blocks_ref) const override;
-
-  ColumnVector* getAllValuesForJoin(
-      const relation_id left_relation_id,
-      ValueAccessor *left_accessor,
-      const relation_id right_relation_id,
-      ValueAccessor *right_accessor,
-      const std::vector<std::pair<tuple_id, tuple_id>> &joined_tuple_ids) const override;
-
- private:
-  // Merge the values in the NativeColumnVector 'case_result' into '*output' at
-  // the positions specified by 'case_matches'. If '*source_sequence' is
-  // non-NULL, it indicates which positions actually have tuples in the input,
-  // otherwise it is assumed that there are no holes in the input.
-  static void MultiplexNativeColumnVector(
-      const TupleIdSequence *source_sequence,
-      const TupleIdSequence &case_matches,
-      const NativeColumnVector &case_result,
-      NativeColumnVector *output);
-
-  // Same as MultiplexNativeColumnVector(), but works on IndirectColumnVectors
-  // instead of NativeColumnVectors.
-  static void MultiplexIndirectColumnVector(
-      const TupleIdSequence *source_sequence,
-      const TupleIdSequence &case_matches,
-      IndirectColumnVector *case_result,
-      IndirectColumnVector *output);
-
-  // Create and return a new ColumnVector by multiplexing the ColumnVectors
-  // containing results for individual CASE branches at the appropriate
-  // positions. 'output_size' is the total number of values in the output.
-  // '*source_sequence' indicates which positions actually have tuples in the
-  // input (if NULL, it is assumed there are no holes in the input).
-  // 'case_matches' are the sequences of tuple_ids matching each WHEN clause in
-  // order. 'else_matches' indicates the tuple_ids that did not match any of
-  // the explicit WHEN clauses. Similarly, '*case_results' are the values
-  // generated for the tuples matching each WHEN clause, and '*else_results'
-  // are the values generated for the ELSE tuples.
-  ColumnVector* multiplexColumnVectors(
-      const std::size_t output_size,
-      const TupleIdSequence *source_sequence,
-      const std::vector<std::unique_ptr<TupleIdSequence>> &case_matches,
-      const TupleIdSequence &else_matches,
-      std::vector<std::unique_ptr<ColumnVector>> *case_results,
-      ColumnVector *else_result) const;
-
-  std::vector<std::unique_ptr<Predicate>> when_predicates_;
-  std::vector<std::unique_ptr<Scalar>> result_expressions_;
-  std::unique_ptr<Scalar> else_result_expression_;
-
-  // If the CASE always evaluates to the same branch, this points to the result
-  // expression for that branch. Note that this is different from having a
-  // static value, because the result expression itself can have a
-  // tuple-dependent value.
-  const Scalar *fixed_result_expression_;
-
-  bool has_static_value_;
-  TypedValue static_value_;
-
-  DISALLOW_COPY_AND_ASSIGN(ScalarCaseExpression);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_EXPRESSIONS_SCALAR_SCALAR_CASE_EXPRESSION_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/scalar/ScalarLiteral.cpp
----------------------------------------------------------------------
diff --git a/expressions/scalar/ScalarLiteral.cpp b/expressions/scalar/ScalarLiteral.cpp
deleted file mode 100644
index 48b5574..0000000
--- a/expressions/scalar/ScalarLiteral.cpp
+++ /dev/null
@@ -1,70 +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 "expressions/scalar/ScalarLiteral.hpp"
-
-#include <utility>
-#include <vector>
-
-#include "expressions/Expressions.pb.h"
-#include "storage/ValueAccessor.hpp"
-#include "types/Type.hpp"
-#include "types/Type.pb.h"
-#include "types/TypedValue.hpp"
-#include "types/TypedValue.pb.h"
-#include "types/containers/ColumnVector.hpp"
-
-namespace quickstep {
-
-serialization::Scalar ScalarLiteral::getProto() const {
-  serialization::Scalar proto;
-  proto.set_data_source(serialization::Scalar::LITERAL);
-  proto.MutableExtension(serialization::ScalarLiteral::literal)
-      ->CopyFrom(internal_literal_.getProto());
-  proto.MutableExtension(serialization::ScalarLiteral::literal_type)
-      ->CopyFrom(type_.getProto());
-
-  return proto;
-}
-
-Scalar* ScalarLiteral::clone() const {
-  return new ScalarLiteral(internal_literal_, type_);
-}
-
-ColumnVector* ScalarLiteral::getAllValues(
-    ValueAccessor *accessor,
-    const SubBlocksReference *sub_blocks_ref) const {
-  return ColumnVector::MakeVectorOfValue(
-      type_,
-      internal_literal_,
-      accessor->getNumTuplesVirtual());
-}
-
-ColumnVector* ScalarLiteral::getAllValuesForJoin(
-    const relation_id left_relation_id,
-    ValueAccessor *left_accessor,
-    const relation_id right_relation_id,
-    ValueAccessor *right_accessor,
-    const std::vector<std::pair<tuple_id, tuple_id>> &joined_tuple_ids) const {
-  return ColumnVector::MakeVectorOfValue(type_,
-                                         internal_literal_,
-                                         joined_tuple_ids.size());
-}
-
-}  // namespace quickstep



[37/51] [abbrv] [partial] incubator-quickstep git commit: remove c++ files

Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/aggregation/tests/AggregationHandleMin_unittest.cpp
----------------------------------------------------------------------
diff --git a/expressions/aggregation/tests/AggregationHandleMin_unittest.cpp b/expressions/aggregation/tests/AggregationHandleMin_unittest.cpp
deleted file mode 100644
index 6e6d188..0000000
--- a/expressions/aggregation/tests/AggregationHandleMin_unittest.cpp
+++ /dev/null
@@ -1,822 +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 <cstddef>
-#include <cstdint>
-#include <cstring>
-#include <memory>
-#include <sstream>
-#include <string>
-#include <vector>
-
-#include "catalog/CatalogTypedefs.hpp"
-#include "expressions/aggregation/AggregateFunction.hpp"
-#include "expressions/aggregation/AggregateFunctionFactory.hpp"
-#include "expressions/aggregation/AggregationHandle.hpp"
-#include "expressions/aggregation/AggregationHandleMin.hpp"
-#include "expressions/aggregation/AggregationID.hpp"
-#include "storage/AggregationOperationState.hpp"
-#include "storage/FastHashTableFactory.hpp"
-#include "storage/StorageManager.hpp"
-#include "types/CharType.hpp"
-#include "types/DatetimeIntervalType.hpp"
-#include "types/DatetimeLit.hpp"
-#include "types/DatetimeType.hpp"
-#include "types/DoubleType.hpp"
-#include "types/FloatType.hpp"
-#include "types/IntType.hpp"
-#include "types/IntervalLit.hpp"
-#include "types/LongType.hpp"
-#include "types/Type.hpp"
-#include "types/TypeFactory.hpp"
-#include "types/TypeID.hpp"
-#include "types/TypedValue.hpp"
-#include "types/VarCharType.hpp"
-#include "types/YearMonthIntervalType.hpp"
-#include "types/containers/ColumnVector.hpp"
-
-#ifdef QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_SELECTION
-#include "types/containers/ColumnVectorsValueAccessor.hpp"
-#endif
-
-#include "types/operations/comparisons/Comparison.hpp"
-#include "types/operations/comparisons/ComparisonFactory.hpp"
-#include "types/operations/comparisons/ComparisonID.hpp"
-
-#include "gtest/gtest.h"
-
-namespace quickstep {
-
-class AggregationHandleMinTest : public ::testing::Test {
- protected:
-  static const int kNumSamples = 200;
-  static const int kIterations = 5;
-
-  // Helper method that calls AggregationHandleMin::iterateUnaryInl() to
-  // aggregate 'value' into '*state'.
-  void iterateHandle(AggregationState *state, const TypedValue &value) {
-    static_cast<const AggregationHandleMin &>(*aggregation_handle_min_)
-        .iterateUnaryInl(static_cast<AggregationStateMin *>(state), value);
-  }
-
-  void initializeHandle(const Type &type) {
-    aggregation_handle_min_.reset(
-        AggregateFunctionFactory::Get(AggregationID::kMin)
-            .createHandle(std::vector<const Type *>(1, &type)));
-    aggregation_handle_min_state_.reset(
-        aggregation_handle_min_->createInitialState());
-  }
-
-  static bool ApplyToTypesTest(TypeID typeID) {
-    const Type &type =
-        (typeID == kChar || typeID == kVarChar)
-            ? TypeFactory::GetType(typeID, static_cast<std::size_t>(10))
-            : TypeFactory::GetType(typeID);
-
-    return AggregateFunctionFactory::Get(AggregationID::kMin)
-        .canApplyToTypes(std::vector<const Type *>(1, &type));
-  }
-
-  static bool ResultTypeForArgumentTypeTest(TypeID input_type_id,
-                                            TypeID output_type_id) {
-    const Type *result_type =
-        AggregateFunctionFactory::Get(AggregationID::kMin)
-            .resultTypeForArgumentTypes(std::vector<const Type *>(
-                1, &TypeFactory::GetType(input_type_id)));
-    return (result_type->getTypeID() == output_type_id);
-  }
-
-  template <typename CppType>
-  static void CheckMinValue(CppType expected,
-                            const AggregationHandle &handle,
-                            const AggregationState &state) {
-    EXPECT_EQ(expected, handle.finalize(state).getLiteral<CppType>());
-  }
-
-  template <typename CppType>
-  static void CheckMinValue(CppType expected, const TypedValue &value) {
-    EXPECT_EQ(expected, value.getLiteral<CppType>());
-  }
-
-  static void CheckMinString(const std::string &expected,
-                             const AggregationHandle &handle,
-                             const AggregationState &state) {
-    TypedValue value = handle.finalize(state);
-
-    ASSERT_EQ(expected.length(), value.getAsciiStringLength());
-    EXPECT_EQ(0,
-              std::strncmp(expected.c_str(),
-                           static_cast<const char *>(value.getDataPtr()),
-                           value.getAsciiStringLength()));
-  }
-
-  // Static templated method to initialize data types.
-  template <typename CppType>
-  void SetDataType(int value, CppType *data) {
-    *data = value;
-  }
-
-  template <typename GenericType>
-  void checkAggregationMinGeneric() {
-    const GenericType &type = GenericType::Instance(true);
-    initializeHandle(type);
-    EXPECT_TRUE(
-        aggregation_handle_min_->finalize(*aggregation_handle_min_state_)
-            .isNull());
-
-    typename GenericType::cpptype val;
-    typename GenericType::cpptype min;
-    SetDataType(1000, &min);
-
-    iterateHandle(aggregation_handle_min_state_.get(), type.makeNullValue());
-    for (int i = 0; i < kIterations; ++i) {
-      for (int j = kNumSamples - 1; j >= 0; --j) {
-        if (type.getTypeID() == kInt || type.getTypeID() == kLong) {
-          SetDataType(i * kNumSamples + j - 10, &val);
-        } else {
-          SetDataType(static_cast<float>(i * kNumSamples + j - 10) / 10, &val);
-        }
-        iterateHandle(aggregation_handle_min_state_.get(),
-                      type.makeValue(&val));
-        if (min > val) {
-          min = val;
-        }
-      }
-    }
-    iterateHandle(aggregation_handle_min_state_.get(), type.makeNullValue());
-    CheckMinValue<typename GenericType::cpptype>(
-        min, *aggregation_handle_min_, *aggregation_handle_min_state_);
-
-    // Test mergeStates().
-    std::unique_ptr<AggregationState> merge_state(
-        aggregation_handle_min_->createInitialState());
-    aggregation_handle_min_->mergeStates(*merge_state,
-                                         aggregation_handle_min_state_.get());
-
-    iterateHandle(merge_state.get(), type.makeNullValue());
-    for (int i = 0; i < kIterations; ++i) {
-      for (int j = kNumSamples - 1; j >= 0; --j) {
-        if (type.getTypeID() == kInt || type.getTypeID() == kLong) {
-          SetDataType(i * kNumSamples + j - 20, &val);
-        } else {
-          SetDataType(static_cast<float>(i * kNumSamples + j - 20) / 10, &val);
-        }
-        iterateHandle(merge_state.get(), type.makeValue(&val));
-        if (min > val) {
-          min = val;
-        }
-      }
-    }
-    aggregation_handle_min_->mergeStates(*merge_state,
-                                         aggregation_handle_min_state_.get());
-    CheckMinValue<typename GenericType::cpptype>(
-        min, *aggregation_handle_min_, *aggregation_handle_min_state_);
-  }
-
-  template <typename GenericType>
-  ColumnVector* createColumnVectorGeneric(const Type &type,
-                                          typename GenericType::cpptype *min) {
-    NativeColumnVector *column =
-        new NativeColumnVector(type, kIterations * kNumSamples + 3);
-
-    typename GenericType::cpptype val;
-    SetDataType(1000, min);
-
-    column->appendTypedValue(type.makeNullValue());
-    for (int i = 0; i < kIterations; ++i) {
-      for (int j = kNumSamples - 1; j >= 0; --j) {
-        if (type.getTypeID() == kInt || type.getTypeID() == kLong) {
-          SetDataType(i * kNumSamples + j - 10, &val);
-        } else {
-          SetDataType(static_cast<float>(i * kNumSamples + j - 10) / 10, &val);
-        }
-        column->appendTypedValue(type.makeValue(&val));
-        if (*min > val) {
-          *min = val;
-        }
-      }
-      // One NULL in the middle.
-      if (i == kIterations / 2) {
-        column->appendTypedValue(type.makeNullValue());
-      }
-    }
-    column->appendTypedValue(type.makeNullValue());
-
-    return column;
-  }
-
-  template <typename GenericType>
-  void checkAggregationMinGenericColumnVector() {
-    const GenericType &type = GenericType::Instance(true);
-    initializeHandle(type);
-    EXPECT_TRUE(
-        aggregation_handle_min_->finalize(*aggregation_handle_min_state_)
-            .isNull());
-
-    typename GenericType::cpptype min;
-    std::vector<std::unique_ptr<ColumnVector>> column_vectors;
-    column_vectors.emplace_back(
-        createColumnVectorGeneric<GenericType>(type, &min));
-
-    std::unique_ptr<AggregationState> cv_state(
-        aggregation_handle_min_->accumulateColumnVectors(column_vectors));
-
-    // Test the state generated directly by accumulateColumnVectors(), and also
-    // test after merging back.
-    CheckMinValue<typename GenericType::cpptype>(
-        min, *aggregation_handle_min_, *cv_state);
-
-    aggregation_handle_min_->mergeStates(*cv_state,
-                                         aggregation_handle_min_state_.get());
-    CheckMinValue<typename GenericType::cpptype>(
-        min, *aggregation_handle_min_, *aggregation_handle_min_state_);
-  }
-
-#ifdef QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_SELECTION
-  template <typename GenericType>
-  void checkAggregationMinGenericValueAccessor() {
-    const GenericType &type = GenericType::Instance(true);
-    initializeHandle(type);
-    EXPECT_TRUE(
-        aggregation_handle_min_->finalize(*aggregation_handle_min_state_)
-            .isNull());
-
-    std::unique_ptr<ColumnVectorsValueAccessor> accessor(
-        new ColumnVectorsValueAccessor());
-
-    typename GenericType::cpptype min;
-    accessor->addColumn(createColumnVectorGeneric<GenericType>(type, &min));
-
-    std::unique_ptr<AggregationState> va_state(
-        aggregation_handle_min_->accumulateValueAccessor(
-            accessor.get(), std::vector<attribute_id>(1, 0)));
-
-    // Test the state generated directly by accumulateValueAccessor(), and also
-    // test after merging back.
-    CheckMinValue<typename GenericType::cpptype>(
-        min, *aggregation_handle_min_, *va_state);
-
-    aggregation_handle_min_->mergeStates(*va_state,
-                                         aggregation_handle_min_state_.get());
-    CheckMinValue<typename GenericType::cpptype>(
-        min, *aggregation_handle_min_, *aggregation_handle_min_state_);
-  }
-#endif  // QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_SELECTION
-
-  template <typename StringType>
-  void checkAggregationMinString() {
-    const StringType &type = StringType::Instance(10, true);
-    initializeHandle(type);
-    EXPECT_TRUE(
-        aggregation_handle_min_->finalize(*aggregation_handle_min_state_)
-            .isNull());
-
-    std::unique_ptr<UncheckedComparator> fast_comparator_;
-    fast_comparator_.reset(ComparisonFactory::GetComparison(ComparisonID::kLess)
-                               .makeUncheckedComparatorForTypes(type, type));
-    std::string string_literal;
-    std::string min = "z";
-    int val;
-    iterateHandle(aggregation_handle_min_state_.get(), type.makeNullValue());
-    for (int i = 0; i < kIterations; ++i) {
-      for (int j = kNumSamples - 1; j >= 0; --j) {
-        val = i * kNumSamples + j;
-        std::ostringstream oss;
-        oss << "test" << val;
-        string_literal = oss.str();
-
-        iterateHandle(
-            aggregation_handle_min_state_.get(),
-            type.makeValue(string_literal.c_str(), string_literal.length() + 1)
-                .ensureNotReference());
-        if (fast_comparator_->compareDataPtrs(string_literal.c_str(),
-                                              min.c_str())) {
-          min = string_literal;
-        }
-      }
-    }
-    iterateHandle(aggregation_handle_min_state_.get(), type.makeNullValue());
-    CheckMinString(
-        min, *aggregation_handle_min_, *aggregation_handle_min_state_);
-
-    // Test mergeStates().
-    std::unique_ptr<AggregationState> merge_state(
-        aggregation_handle_min_->createInitialState());
-    aggregation_handle_min_->mergeStates(*merge_state,
-                                         aggregation_handle_min_state_.get());
-
-    iterateHandle(merge_state.get(), type.makeNullValue());
-    for (int i = 0; i < kIterations; ++i) {
-      for (int j = kNumSamples - 1; j >= 0; --j) {
-        val = i * kNumSamples + j;
-        std::ostringstream oss;
-        oss << "min" << val;
-        string_literal = oss.str();
-
-        iterateHandle(
-            merge_state.get(),
-            type.makeValue(string_literal.c_str(), string_literal.length() + 1)
-                .ensureNotReference());
-        if (fast_comparator_->compareDataPtrs(string_literal.c_str(),
-                                              min.c_str())) {
-          min = string_literal;
-        }
-      }
-    }
-    aggregation_handle_min_->mergeStates(*merge_state,
-                                         aggregation_handle_min_state_.get());
-    CheckMinString(
-        min, *aggregation_handle_min_, *aggregation_handle_min_state_);
-  }
-
-  template <typename ColumnVectorType>
-  ColumnVector* createColumnVectorString(const Type &type, std::string *min) {
-    ColumnVectorType *column =
-        new ColumnVectorType(type, kIterations * kNumSamples + 3);
-    std::unique_ptr<UncheckedComparator> fast_comparator_;
-    fast_comparator_.reset(ComparisonFactory::GetComparison(ComparisonID::kLess)
-                               .makeUncheckedComparatorForTypes(type, type));
-    std::string string_literal;
-    *min = "z";
-    int val;
-    column->appendTypedValue(type.makeNullValue());
-    for (int i = 0; i < kIterations; ++i) {
-      for (int j = kNumSamples - 1; j >= 0; --j) {
-        val = i * kNumSamples + j;
-        std::ostringstream oss;
-        oss << "test" << val;
-        string_literal = oss.str();
-
-        column->appendTypedValue(
-            type.makeValue(string_literal.c_str(), string_literal.length() + 1)
-                .ensureNotReference());
-        if (fast_comparator_->compareDataPtrs(string_literal.c_str(),
-                                              min->c_str())) {
-          *min = string_literal;
-        }
-      }
-      // One NULL in the middle.
-      if (i == kIterations / 2) {
-        column->appendTypedValue(type.makeNullValue());
-      }
-    }
-    column->appendTypedValue(type.makeNullValue());
-
-    return column;
-  }
-
-  template <typename StringType, typename ColumnVectorType>
-  void checkAggregationMinStringColumnVector() {
-    const StringType &type = StringType::Instance(10, true);
-    initializeHandle(type);
-    EXPECT_TRUE(
-        aggregation_handle_min_->finalize(*aggregation_handle_min_state_)
-            .isNull());
-
-    std::string min;
-    std::vector<std::unique_ptr<ColumnVector>> column_vectors;
-    column_vectors.emplace_back(
-        createColumnVectorString<ColumnVectorType>(type, &min));
-
-    std::unique_ptr<AggregationState> cv_state(
-        aggregation_handle_min_->accumulateColumnVectors(column_vectors));
-
-    // Test the state generated directly by accumulateColumnVectors(), and also
-    // test after merging back.
-    CheckMinString(min, *aggregation_handle_min_, *cv_state);
-
-    aggregation_handle_min_->mergeStates(*cv_state,
-                                         aggregation_handle_min_state_.get());
-    CheckMinString(
-        min, *aggregation_handle_min_, *aggregation_handle_min_state_);
-  }
-
-#ifdef QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_SELECTION
-  template <typename StringType, typename ColumnVectorType>
-  void checkAggregationMinStringValueAccessor() {
-    const StringType &type = StringType::Instance(10, true);
-    initializeHandle(type);
-    EXPECT_TRUE(
-        aggregation_handle_min_->finalize(*aggregation_handle_min_state_)
-            .isNull());
-
-    std::string min;
-    std::unique_ptr<ColumnVectorsValueAccessor> accessor(
-        new ColumnVectorsValueAccessor());
-    accessor->addColumn(createColumnVectorString<ColumnVectorType>(type, &min));
-
-    std::unique_ptr<AggregationState> va_state(
-        aggregation_handle_min_->accumulateValueAccessor(
-            accessor.get(), std::vector<attribute_id>(1, 0)));
-
-    // Test the state generated directly by accumulateValueAccessor(), and also
-    // test after merging back.
-    CheckMinString(min, *aggregation_handle_min_, *va_state);
-
-    aggregation_handle_min_->mergeStates(*va_state,
-                                         aggregation_handle_min_state_.get());
-    CheckMinString(
-        min, *aggregation_handle_min_, *aggregation_handle_min_state_);
-  }
-#endif  // QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_SELECTION
-
-  std::unique_ptr<AggregationHandle> aggregation_handle_min_;
-  std::unique_ptr<AggregationState> aggregation_handle_min_state_;
-  std::unique_ptr<StorageManager> storage_manager_;
-};
-
-template <>
-void AggregationHandleMinTest::CheckMinValue<float>(
-    float val, const AggregationHandle &handle, const AggregationState &state) {
-  EXPECT_FLOAT_EQ(val, handle.finalize(state).getLiteral<float>());
-}
-
-template <>
-void AggregationHandleMinTest::CheckMinValue<double>(
-    double val,
-    const AggregationHandle &handle,
-    const AggregationState &state) {
-  EXPECT_DOUBLE_EQ(val, handle.finalize(state).getLiteral<double>());
-}
-
-template <>
-void AggregationHandleMinTest::SetDataType<DatetimeLit>(int value,
-                                                        DatetimeLit *data) {
-  data->ticks = value;
-}
-
-template <>
-void AggregationHandleMinTest::SetDataType<DatetimeIntervalLit>(
-    int value, DatetimeIntervalLit *data) {
-  data->interval_ticks = value;
-}
-
-template <>
-void AggregationHandleMinTest::SetDataType<YearMonthIntervalLit>(
-    int value, YearMonthIntervalLit *data) {
-  data->months = value;
-}
-
-typedef AggregationHandleMinTest AggregationHandleMinDeathTest;
-
-TEST_F(AggregationHandleMinTest, IntTypeTest) {
-  checkAggregationMinGeneric<IntType>();
-}
-
-TEST_F(AggregationHandleMinTest, LongTypeTest) {
-  checkAggregationMinGeneric<LongType>();
-}
-
-TEST_F(AggregationHandleMinTest, FloatTypeTest) {
-  checkAggregationMinGeneric<FloatType>();
-}
-
-TEST_F(AggregationHandleMinTest, DoubleTypeTest) {
-  checkAggregationMinGeneric<DoubleType>();
-}
-
-TEST_F(AggregationHandleMinTest, DatetimeType) {
-  checkAggregationMinGeneric<DatetimeType>();
-}
-
-TEST_F(AggregationHandleMinTest, DatetimeIntervalType) {
-  checkAggregationMinGeneric<DatetimeIntervalType>();
-}
-
-TEST_F(AggregationHandleMinTest, YearMonthIntervalType) {
-  checkAggregationMinGeneric<YearMonthIntervalType>();
-}
-
-TEST_F(AggregationHandleMinTest, CharTypeTest) {
-  checkAggregationMinString<CharType>();
-}
-
-TEST_F(AggregationHandleMinTest, VarCharTypeTest) {
-  checkAggregationMinString<VarCharType>();
-}
-
-TEST_F(AggregationHandleMinTest, IntTypeColumnVectorTest) {
-  checkAggregationMinGenericColumnVector<IntType>();
-}
-
-TEST_F(AggregationHandleMinTest, LongTypeColumnVectorTest) {
-  checkAggregationMinGenericColumnVector<LongType>();
-}
-
-TEST_F(AggregationHandleMinTest, FloatTypeColumnVectorTest) {
-  checkAggregationMinGenericColumnVector<FloatType>();
-}
-
-TEST_F(AggregationHandleMinTest, DoubleTypeColumnVectorTest) {
-  checkAggregationMinGenericColumnVector<DoubleType>();
-}
-
-TEST_F(AggregationHandleMinTest, DatetimeTypeColumnVectorTest) {
-  checkAggregationMinGenericColumnVector<DatetimeType>();
-}
-
-TEST_F(AggregationHandleMinTest, DatetimeIntervalTypeColumnVectorTest) {
-  checkAggregationMinGenericColumnVector<DatetimeIntervalType>();
-}
-
-TEST_F(AggregationHandleMinTest, YearMonthIntervalTypeColumnVectorTest) {
-  checkAggregationMinGenericColumnVector<YearMonthIntervalType>();
-}
-
-TEST_F(AggregationHandleMinTest, CharTypeColumnVectorTest) {
-  checkAggregationMinStringColumnVector<CharType, NativeColumnVector>();
-}
-
-TEST_F(AggregationHandleMinTest, VarCharTypeColumnVectorTest) {
-  checkAggregationMinStringColumnVector<VarCharType, IndirectColumnVector>();
-}
-
-#ifdef QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_SELECTION
-TEST_F(AggregationHandleMinTest, IntTypeValueAccessorTest) {
-  checkAggregationMinGenericValueAccessor<IntType>();
-}
-
-TEST_F(AggregationHandleMinTest, LongTypeValueAccessorTest) {
-  checkAggregationMinGenericValueAccessor<LongType>();
-}
-
-TEST_F(AggregationHandleMinTest, FloatTypeValueAccessorTest) {
-  checkAggregationMinGenericValueAccessor<FloatType>();
-}
-
-TEST_F(AggregationHandleMinTest, DoubleTypeValueAccessorTest) {
-  checkAggregationMinGenericValueAccessor<DoubleType>();
-}
-
-TEST_F(AggregationHandleMinTest, DatetimeTypeValueAccessorTest) {
-  checkAggregationMinGenericValueAccessor<DatetimeType>();
-}
-
-TEST_F(AggregationHandleMinTest, DatetimeIntervalTypeValueAccessorTest) {
-  checkAggregationMinGenericValueAccessor<DatetimeIntervalType>();
-}
-
-TEST_F(AggregationHandleMinTest, YearMonthIntervalTypeValueAccessorTest) {
-  checkAggregationMinGenericValueAccessor<YearMonthIntervalType>();
-}
-
-TEST_F(AggregationHandleMinTest, CharTypeValueAccessorTest) {
-  checkAggregationMinStringValueAccessor<CharType, NativeColumnVector>();
-}
-
-TEST_F(AggregationHandleMinTest, VarCharTypeValueAccessorTest) {
-  checkAggregationMinStringValueAccessor<VarCharType, IndirectColumnVector>();
-}
-#endif  // QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_SELECTION
-
-#ifdef QUICKSTEP_DEBUG
-TEST_F(AggregationHandleMinDeathTest, WrongTypeTest) {
-  const Type &int_non_null_type = IntType::Instance(false);
-  const Type &long_type = LongType::Instance(true);
-  const Type &double_type = DoubleType::Instance(true);
-  const Type &float_type = FloatType::Instance(true);
-  const Type &char_type = CharType::Instance(true, 10);
-  const Type &varchar_type = VarCharType::Instance(true, 10);
-
-  initializeHandle(IntType::Instance(true));
-  int int_val = 0;
-  std::int64_t long_val = 0;
-  double double_val = 0;
-  float float_val = 0;
-
-  iterateHandle(aggregation_handle_min_state_.get(),
-                int_non_null_type.makeValue(&int_val));
-
-  EXPECT_DEATH(iterateHandle(aggregation_handle_min_state_.get(),
-                             long_type.makeValue(&long_val)),
-               "");
-  EXPECT_DEATH(iterateHandle(aggregation_handle_min_state_.get(),
-                             double_type.makeValue(&double_val)),
-               "");
-  EXPECT_DEATH(iterateHandle(aggregation_handle_min_state_.get(),
-                             float_type.makeValue(&float_val)),
-               "");
-  EXPECT_DEATH(iterateHandle(aggregation_handle_min_state_.get(),
-                             char_type.makeValue("asdf", 5)),
-               "");
-  EXPECT_DEATH(iterateHandle(aggregation_handle_min_state_.get(),
-                             varchar_type.makeValue("asdf", 5)),
-               "");
-
-  // Test mergeStates() with incorrectly typed handles.
-  std::unique_ptr<AggregationHandle> aggregation_handle_min_long(
-      AggregateFunctionFactory::Get(AggregationID::kMin)
-          .createHandle(std::vector<const Type *>(1, &long_type)));
-  std::unique_ptr<AggregationState> aggregation_state_min_merge_long(
-      aggregation_handle_min_long->createInitialState());
-  static_cast<const AggregationHandleMin &>(*aggregation_handle_min_long)
-      .iterateUnaryInl(static_cast<AggregationStateMin *>(
-                           aggregation_state_min_merge_long.get()),
-                       long_type.makeValue(&long_val));
-  EXPECT_DEATH(
-      aggregation_handle_min_->mergeStates(*aggregation_state_min_merge_long,
-                                           aggregation_handle_min_state_.get()),
-      "");
-
-  std::unique_ptr<AggregationHandle> aggregation_handle_min_double(
-      AggregateFunctionFactory::Get(AggregationID::kMin)
-          .createHandle(std::vector<const Type *>(1, &double_type)));
-  std::unique_ptr<AggregationState> aggregation_state_min_merge_double(
-      aggregation_handle_min_double->createInitialState());
-  static_cast<const AggregationHandleMin &>(*aggregation_handle_min_double)
-      .iterateUnaryInl(static_cast<AggregationStateMin *>(
-                           aggregation_state_min_merge_double.get()),
-                       double_type.makeValue(&double_val));
-  EXPECT_DEATH(
-      aggregation_handle_min_->mergeStates(*aggregation_state_min_merge_double,
-                                           aggregation_handle_min_state_.get()),
-      "");
-
-  std::unique_ptr<AggregationHandle> aggregation_handle_min_float(
-      AggregateFunctionFactory::Get(AggregationID::kMin)
-          .createHandle(std::vector<const Type *>(1, &float_type)));
-  std::unique_ptr<AggregationState> aggregation_state_min_merge_float(
-      aggregation_handle_min_float->createInitialState());
-  static_cast<const AggregationHandleMin &>(*aggregation_handle_min_float)
-      .iterateUnaryInl(static_cast<AggregationStateMin *>(
-                           aggregation_state_min_merge_float.get()),
-                       float_type.makeValue(&float_val));
-  EXPECT_DEATH(
-      aggregation_handle_min_->mergeStates(*aggregation_state_min_merge_float,
-                                           aggregation_handle_min_state_.get()),
-      "");
-}
-#endif
-
-TEST_F(AggregationHandleMinTest, canApplyToTypeTest) {
-  EXPECT_TRUE(ApplyToTypesTest(kInt));
-  EXPECT_TRUE(ApplyToTypesTest(kLong));
-  EXPECT_TRUE(ApplyToTypesTest(kFloat));
-  EXPECT_TRUE(ApplyToTypesTest(kDouble));
-  EXPECT_TRUE(ApplyToTypesTest(kChar));
-  EXPECT_TRUE(ApplyToTypesTest(kVarChar));
-}
-
-TEST_F(AggregationHandleMinTest, ResultTypeForArgumentTypeTest) {
-  EXPECT_TRUE(ResultTypeForArgumentTypeTest(kInt, kInt));
-  EXPECT_TRUE(ResultTypeForArgumentTypeTest(kLong, kLong));
-  EXPECT_TRUE(ResultTypeForArgumentTypeTest(kFloat, kFloat));
-  EXPECT_TRUE(ResultTypeForArgumentTypeTest(kDouble, kDouble));
-}
-
-TEST_F(AggregationHandleMinTest, GroupByTableMergeTest) {
-  const Type &int_non_null_type = IntType::Instance(false);
-  initializeHandle(int_non_null_type);
-  storage_manager_.reset(new StorageManager("./test_min_data"));
-  std::unique_ptr<AggregationStateHashTableBase> source_hash_table(
-      AggregationStateFastHashTableFactory::CreateResizable(
-          HashTableImplType::kSeparateChaining,
-          std::vector<const Type *>(1, &int_non_null_type),
-          10,
-          {aggregation_handle_min_.get()->getPayloadSize()},
-          {aggregation_handle_min_.get()},
-          storage_manager_.get()));
-  std::unique_ptr<AggregationStateHashTableBase> destination_hash_table(
-      AggregationStateFastHashTableFactory::CreateResizable(
-          HashTableImplType::kSeparateChaining,
-          std::vector<const Type *>(1, &int_non_null_type),
-          10,
-          {aggregation_handle_min_.get()->getPayloadSize()},
-          {aggregation_handle_min_.get()},
-          storage_manager_.get()));
-
-  AggregationStateFastHashTable *destination_hash_table_derived =
-      static_cast<AggregationStateFastHashTable *>(
-          destination_hash_table.get());
-
-  AggregationStateFastHashTable *source_hash_table_derived =
-      static_cast<AggregationStateFastHashTable *>(source_hash_table.get());
-
-  AggregationHandleMin *aggregation_handle_min_derived =
-      static_cast<AggregationHandleMin *>(aggregation_handle_min_.get());
-  // We create three keys: first is present in both the hash tables, second key
-  // is present only in the source hash table while the third key is present
-  // the destination hash table only.
-  std::vector<TypedValue> common_key;
-  common_key.emplace_back(0);
-  std::vector<TypedValue> exclusive_source_key, exclusive_destination_key;
-  exclusive_source_key.emplace_back(1);
-  exclusive_destination_key.emplace_back(2);
-
-  const int common_key_source_min = 3000;
-  TypedValue common_key_source_min_val(common_key_source_min);
-
-  const int common_key_destination_min = 4000;
-  TypedValue common_key_destination_min_val(common_key_destination_min);
-
-  const int exclusive_key_source_min = 100;
-  TypedValue exclusive_key_source_min_val(exclusive_key_source_min);
-
-  const int exclusive_key_destination_min = 200;
-  TypedValue exclusive_key_destination_min_val(exclusive_key_destination_min);
-
-  std::unique_ptr<AggregationStateMin> common_key_source_state(
-      static_cast<AggregationStateMin *>(
-          aggregation_handle_min_->createInitialState()));
-  std::unique_ptr<AggregationStateMin> common_key_destination_state(
-      static_cast<AggregationStateMin *>(
-          aggregation_handle_min_->createInitialState()));
-  std::unique_ptr<AggregationStateMin> exclusive_key_source_state(
-      static_cast<AggregationStateMin *>(
-          aggregation_handle_min_->createInitialState()));
-  std::unique_ptr<AggregationStateMin> exclusive_key_destination_state(
-      static_cast<AggregationStateMin *>(
-          aggregation_handle_min_->createInitialState()));
-
-  // Create min value states for keys.
-  aggregation_handle_min_derived->iterateUnaryInl(common_key_source_state.get(),
-                                                  common_key_source_min_val);
-  int actual_val = aggregation_handle_min_->finalize(*common_key_source_state)
-                       .getLiteral<int>();
-  EXPECT_EQ(common_key_source_min_val.getLiteral<int>(), actual_val);
-
-  aggregation_handle_min_derived->iterateUnaryInl(
-      common_key_destination_state.get(), common_key_destination_min_val);
-  actual_val = aggregation_handle_min_->finalize(*common_key_destination_state)
-                   .getLiteral<int>();
-  EXPECT_EQ(common_key_destination_min_val.getLiteral<int>(), actual_val);
-
-  aggregation_handle_min_derived->iterateUnaryInl(
-      exclusive_key_destination_state.get(), exclusive_key_destination_min_val);
-  actual_val =
-      aggregation_handle_min_->finalize(*exclusive_key_destination_state)
-          .getLiteral<int>();
-  EXPECT_EQ(exclusive_key_destination_min_val.getLiteral<int>(), actual_val);
-
-  aggregation_handle_min_derived->iterateUnaryInl(
-      exclusive_key_source_state.get(), exclusive_key_source_min_val);
-  actual_val = aggregation_handle_min_->finalize(*exclusive_key_source_state)
-                   .getLiteral<int>();
-  EXPECT_EQ(exclusive_key_source_min_val.getLiteral<int>(), actual_val);
-
-  // Add the key-state pairs to the hash tables.
-  unsigned char buffer[100];
-  buffer[0] = '\0';
-  memcpy(buffer + 1,
-         common_key_source_state.get()->getPayloadAddress(),
-         aggregation_handle_min_.get()->getPayloadSize());
-  source_hash_table_derived->putCompositeKey(common_key, buffer);
-
-  memcpy(buffer + 1,
-         common_key_destination_state.get()->getPayloadAddress(),
-         aggregation_handle_min_.get()->getPayloadSize());
-  destination_hash_table_derived->putCompositeKey(common_key, buffer);
-
-  memcpy(buffer + 1,
-         exclusive_key_source_state.get()->getPayloadAddress(),
-         aggregation_handle_min_.get()->getPayloadSize());
-  source_hash_table_derived->putCompositeKey(exclusive_source_key, buffer);
-
-  memcpy(buffer + 1,
-         exclusive_key_destination_state.get()->getPayloadAddress(),
-         aggregation_handle_min_.get()->getPayloadSize());
-  destination_hash_table_derived->putCompositeKey(exclusive_destination_key,
-                                                      buffer);
-
-  EXPECT_EQ(2u, destination_hash_table_derived->numEntries());
-  EXPECT_EQ(2u, source_hash_table_derived->numEntries());
-
-  AggregationOperationState::mergeGroupByHashTables(
-      source_hash_table.get(), destination_hash_table.get());
-
-  EXPECT_EQ(3u, destination_hash_table_derived->numEntries());
-
-  CheckMinValue<int>(
-      common_key_source_min_val.getLiteral<int>(),
-      aggregation_handle_min_derived->finalizeHashTableEntryFast(
-          destination_hash_table_derived->getSingleCompositeKey(common_key) +
-          1));
-  CheckMinValue<int>(exclusive_key_destination_min_val.getLiteral<int>(),
-                     aggregation_handle_min_derived->finalizeHashTableEntryFast(
-                         destination_hash_table_derived->getSingleCompositeKey(
-                             exclusive_destination_key) +
-                         1));
-  CheckMinValue<int>(exclusive_key_source_min_val.getLiteral<int>(),
-                     aggregation_handle_min_derived->finalizeHashTableEntryFast(
-                         source_hash_table_derived->getSingleCompositeKey(
-                             exclusive_source_key) +
-                         1));
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/aggregation/tests/AggregationHandleSum_unittest.cpp
----------------------------------------------------------------------
diff --git a/expressions/aggregation/tests/AggregationHandleSum_unittest.cpp b/expressions/aggregation/tests/AggregationHandleSum_unittest.cpp
deleted file mode 100644
index 1d1c084..0000000
--- a/expressions/aggregation/tests/AggregationHandleSum_unittest.cpp
+++ /dev/null
@@ -1,611 +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 <cstddef>
-#include <cstdint>
-#include <memory>
-#include <vector>
-
-#include "catalog/CatalogTypedefs.hpp"
-#include "expressions/aggregation/AggregateFunction.hpp"
-#include "expressions/aggregation/AggregateFunctionFactory.hpp"
-#include "expressions/aggregation/AggregationHandle.hpp"
-#include "expressions/aggregation/AggregationHandleSum.hpp"
-#include "expressions/aggregation/AggregationID.hpp"
-#include "storage/AggregationOperationState.hpp"
-#include "storage/FastHashTableFactory.hpp"
-#include "storage/StorageManager.hpp"
-#include "types/CharType.hpp"
-#include "types/DatetimeIntervalType.hpp"
-#include "types/DoubleType.hpp"
-#include "types/FloatType.hpp"
-#include "types/IntType.hpp"
-#include "types/IntervalLit.hpp"
-#include "types/LongType.hpp"
-#include "types/Type.hpp"
-#include "types/TypeFactory.hpp"
-#include "types/TypeID.hpp"
-#include "types/TypedValue.hpp"
-#include "types/VarCharType.hpp"
-#include "types/YearMonthIntervalType.hpp"
-#include "types/containers/ColumnVector.hpp"
-
-#ifdef QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_SELECTION
-#include "types/containers/ColumnVectorsValueAccessor.hpp"
-#endif
-
-#include "gtest/gtest.h"
-
-namespace quickstep {
-
-class AggregationHandleSumTest : public ::testing::Test {
- protected:
-  static const int kNumSamples = 1000;
-
-  // Helper method that calls AggregationHandleSum::iterateUnaryInl() to
-  // aggregate 'value' into '*state'.
-  void iterateHandle(AggregationState *state, const TypedValue &value) {
-    static_cast<const AggregationHandleSum &>(*aggregation_handle_sum_)
-        .iterateUnaryInl(static_cast<AggregationStateSum *>(state), value);
-  }
-
-  void initializeHandle(const Type &type) {
-    aggregation_handle_sum_.reset(
-        AggregateFunctionFactory::Get(AggregationID::kSum)
-            .createHandle(std::vector<const Type *>(1, &type)));
-    aggregation_handle_sum_state_.reset(
-        aggregation_handle_sum_->createInitialState());
-  }
-
-  static bool ApplyToTypesTest(TypeID typeID) {
-    const Type &type =
-        (typeID == kChar || typeID == kVarChar)
-            ? TypeFactory::GetType(typeID, static_cast<std::size_t>(10))
-            : TypeFactory::GetType(typeID);
-
-    return AggregateFunctionFactory::Get(AggregationID::kSum)
-        .canApplyToTypes(std::vector<const Type *>(1, &type));
-  }
-
-  static bool ResultTypeForArgumentTypeTest(TypeID input_type_id,
-                                            TypeID output_type_id) {
-    const Type *result_type =
-        AggregateFunctionFactory::Get(AggregationID::kSum)
-            .resultTypeForArgumentTypes(std::vector<const Type *>(
-                1, &TypeFactory::GetType(input_type_id)));
-    return (result_type->getTypeID() == output_type_id);
-  }
-
-  template <typename CppType>
-  static void CheckSumValue(CppType expected,
-                            const AggregationHandle &target,
-                            const AggregationState &state) {
-    EXPECT_EQ(expected, target.finalize(state).getLiteral<CppType>());
-  }
-
-  template <typename CppType>
-  static void CheckSumValue(CppType expected, const TypedValue &value) {
-    EXPECT_EQ(expected, value.getLiteral<CppType>());
-  }
-
-  // Static templated method to set a meaningful to data types.
-  template <typename CppType>
-  static void SetDataType(int value, CppType *data) {
-    *data = value;
-  }
-
-  template <typename GenericType, typename PrecisionType>
-  void checkAggregationSumGeneric() {
-    const GenericType &type = GenericType::Instance(true);
-
-    initializeHandle(type);
-    EXPECT_TRUE(
-        aggregation_handle_sum_->finalize(*aggregation_handle_sum_state_)
-            .isNull());
-
-    typename GenericType::cpptype val;
-    typename PrecisionType::cpptype sum;
-    SetDataType(0, &sum);
-
-    iterateHandle(aggregation_handle_sum_state_.get(), type.makeNullValue());
-    for (int i = 0; i < kNumSamples; ++i) {
-      if (type.getTypeID() == kInt || type.getTypeID() == kLong) {
-        SetDataType(i - 10, &val);
-      } else {
-        SetDataType(static_cast<float>(i - 10) / 10, &val);
-      }
-      iterateHandle(aggregation_handle_sum_state_.get(), type.makeValue(&val));
-      sum += val;
-    }
-    iterateHandle(aggregation_handle_sum_state_.get(), type.makeNullValue());
-    CheckSumValue<typename PrecisionType::cpptype>(
-        sum, *aggregation_handle_sum_, *aggregation_handle_sum_state_);
-
-    // Test mergeStates().
-    std::unique_ptr<AggregationState> merge_state(
-        aggregation_handle_sum_->createInitialState());
-    aggregation_handle_sum_->mergeStates(*merge_state,
-                                         aggregation_handle_sum_state_.get());
-
-    iterateHandle(merge_state.get(), type.makeNullValue());
-    for (int i = 0; i < kNumSamples; ++i) {
-      if (type.getTypeID() == kInt || type.getTypeID() == kLong) {
-        SetDataType(i - 10, &val);
-      } else {
-        SetDataType(static_cast<float>(i - 10) / 10, &val);
-      }
-      iterateHandle(merge_state.get(), type.makeValue(&val));
-      sum += val;
-    }
-    aggregation_handle_sum_->mergeStates(*merge_state,
-                                         aggregation_handle_sum_state_.get());
-    CheckSumValue<typename PrecisionType::cpptype>(
-        sum, *aggregation_handle_sum_, *aggregation_handle_sum_state_);
-  }
-
-  template <typename GenericType, typename Output>
-  ColumnVector* createColumnVectorGeneric(const Type &type, Output *sum) {
-    NativeColumnVector *column = new NativeColumnVector(type, kNumSamples + 3);
-
-    typename GenericType::cpptype val;
-    SetDataType(0, sum);
-
-    column->appendTypedValue(type.makeNullValue());
-    for (int i = 0; i < kNumSamples; ++i) {
-      if (type.getTypeID() == kInt || type.getTypeID() == kLong) {
-        SetDataType(i - 10, &val);
-      } else {
-        SetDataType(static_cast<float>(i - 10) / 10, &val);
-      }
-      column->appendTypedValue(type.makeValue(&val));
-      *sum += val;
-      // One NULL in the middle.
-      if (i == kNumSamples / 2) {
-        column->appendTypedValue(type.makeNullValue());
-      }
-    }
-    column->appendTypedValue(type.makeNullValue());
-
-    return column;
-  }
-
-  template <typename GenericType, typename PrecisionType>
-  void checkAggregationSumGenericColumnVector() {
-    const GenericType &type = GenericType::Instance(true);
-
-    initializeHandle(type);
-    EXPECT_TRUE(
-        aggregation_handle_sum_->finalize(*aggregation_handle_sum_state_)
-            .isNull());
-
-    typename PrecisionType::cpptype sum;
-    std::vector<std::unique_ptr<ColumnVector>> column_vectors;
-    column_vectors.emplace_back(
-        createColumnVectorGeneric<GenericType, typename PrecisionType::cpptype>(
-            type, &sum));
-
-    std::unique_ptr<AggregationState> cv_state(
-        aggregation_handle_sum_->accumulateColumnVectors(column_vectors));
-
-    // Test the state generated directly by accumulateColumnVectors(), and also
-    // test after merging back.
-    CheckSumValue<typename PrecisionType::cpptype>(
-        sum, *aggregation_handle_sum_, *cv_state);
-
-    aggregation_handle_sum_->mergeStates(*cv_state,
-                                         aggregation_handle_sum_state_.get());
-    CheckSumValue<typename PrecisionType::cpptype>(
-        sum, *aggregation_handle_sum_, *aggregation_handle_sum_state_);
-  }
-
-#ifdef QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_SELECTION
-  template <typename GenericType, typename PrecisionType>
-  void checkAggregationSumGenericValueAccessor() {
-    const GenericType &type = GenericType::Instance(true);
-
-    initializeHandle(type);
-    EXPECT_TRUE(
-        aggregation_handle_sum_->finalize(*aggregation_handle_sum_state_)
-            .isNull());
-
-    typename PrecisionType::cpptype sum;
-    std::unique_ptr<ColumnVectorsValueAccessor> accessor(
-        new ColumnVectorsValueAccessor());
-    accessor->addColumn(
-        createColumnVectorGeneric<GenericType, typename PrecisionType::cpptype>(
-            type, &sum));
-
-    std::unique_ptr<AggregationState> va_state(
-        aggregation_handle_sum_->accumulateValueAccessor(
-            accessor.get(), std::vector<attribute_id>(1, 0)));
-
-    // Test the state generated directly by accumulateValueAccessor(), and also
-    // test after merging back.
-    CheckSumValue<typename PrecisionType::cpptype>(
-        sum, *aggregation_handle_sum_, *va_state);
-
-    aggregation_handle_sum_->mergeStates(*va_state,
-                                         aggregation_handle_sum_state_.get());
-    CheckSumValue<typename PrecisionType::cpptype>(
-        sum, *aggregation_handle_sum_, *aggregation_handle_sum_state_);
-  }
-#endif  // QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_SELECTION
-
-  std::unique_ptr<AggregationHandle> aggregation_handle_sum_;
-  std::unique_ptr<AggregationState> aggregation_handle_sum_state_;
-  std::unique_ptr<StorageManager> storage_manager_;
-};
-
-const int AggregationHandleSumTest::kNumSamples;
-
-template <>
-void AggregationHandleSumTest::CheckSumValue<float>(
-    float val, const AggregationHandle &handle, const AggregationState &state) {
-  EXPECT_FLOAT_EQ(val, handle.finalize(state).getLiteral<float>());
-}
-
-template <>
-void AggregationHandleSumTest::CheckSumValue<double>(
-    double val,
-    const AggregationHandle &handle,
-    const AggregationState &state) {
-  EXPECT_DOUBLE_EQ(val, handle.finalize(state).getLiteral<double>());
-}
-
-template <>
-void AggregationHandleSumTest::SetDataType<DatetimeIntervalLit>(
-    int value, DatetimeIntervalLit *data) {
-  data->interval_ticks = value;
-}
-
-template <>
-void AggregationHandleSumTest::SetDataType<YearMonthIntervalLit>(
-    int value, YearMonthIntervalLit *data) {
-  data->months = value;
-}
-
-typedef AggregationHandleSumTest AggregationHandleSumDeathTest;
-
-TEST_F(AggregationHandleSumTest, IntTypeTest) {
-  checkAggregationSumGeneric<IntType, LongType>();
-}
-
-TEST_F(AggregationHandleSumTest, LongTypeTest) {
-  checkAggregationSumGeneric<LongType, LongType>();
-}
-
-TEST_F(AggregationHandleSumTest, FloatTypeTest) {
-  checkAggregationSumGeneric<FloatType, DoubleType>();
-}
-
-TEST_F(AggregationHandleSumTest, DoubleTypeTest) {
-  checkAggregationSumGeneric<DoubleType, DoubleType>();
-}
-
-TEST_F(AggregationHandleSumTest, DatetimeIntervalTypeTest) {
-  checkAggregationSumGeneric<DatetimeIntervalType, DatetimeIntervalType>();
-}
-
-TEST_F(AggregationHandleSumTest, YearMonthIntervalTypeTest) {
-  checkAggregationSumGeneric<YearMonthIntervalType, YearMonthIntervalType>();
-}
-
-TEST_F(AggregationHandleSumTest, IntTypeColumnVectorTest) {
-  checkAggregationSumGenericColumnVector<IntType, LongType>();
-}
-
-TEST_F(AggregationHandleSumTest, LongTypeColumnVectorTest) {
-  checkAggregationSumGenericColumnVector<LongType, LongType>();
-}
-
-TEST_F(AggregationHandleSumTest, FloatTypeColumnVectorTest) {
-  checkAggregationSumGenericColumnVector<FloatType, DoubleType>();
-}
-
-TEST_F(AggregationHandleSumTest, DoubleTypeColumnVectorTest) {
-  checkAggregationSumGenericColumnVector<DoubleType, DoubleType>();
-}
-
-TEST_F(AggregationHandleSumTest, DatetimeIntervalTypeColumnVectorTest) {
-  checkAggregationSumGenericColumnVector<DatetimeIntervalType,
-                                         DatetimeIntervalType>();
-}
-
-TEST_F(AggregationHandleSumTest, YearMonthIntervalTypeColumnVectorTest) {
-  checkAggregationSumGenericColumnVector<YearMonthIntervalType,
-                                         YearMonthIntervalType>();
-}
-
-#ifdef QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_SELECTION
-TEST_F(AggregationHandleSumTest, IntTypeValueAccessorTest) {
-  checkAggregationSumGenericValueAccessor<IntType, LongType>();
-}
-
-TEST_F(AggregationHandleSumTest, LongTypeValueAccessorTest) {
-  checkAggregationSumGenericValueAccessor<LongType, LongType>();
-}
-
-TEST_F(AggregationHandleSumTest, FloatTypeValueAccessorTest) {
-  checkAggregationSumGenericValueAccessor<FloatType, DoubleType>();
-}
-
-TEST_F(AggregationHandleSumTest, DoubleTypeValueAccessorTest) {
-  checkAggregationSumGenericValueAccessor<DoubleType, DoubleType>();
-}
-
-TEST_F(AggregationHandleSumTest, DatetimeIntervalTypeValueAccessorTest) {
-  checkAggregationSumGenericValueAccessor<DatetimeIntervalType,
-                                          DatetimeIntervalType>();
-}
-
-TEST_F(AggregationHandleSumTest, YearMonthIntervalTypeValueAccessorTest) {
-  checkAggregationSumGenericValueAccessor<YearMonthIntervalType,
-                                          YearMonthIntervalType>();
-}
-#endif  // QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_SELECTION
-
-#ifdef QUICKSTEP_DEBUG
-TEST_F(AggregationHandleSumDeathTest, CharTypeTest) {
-  const Type &type = CharType::Instance(true, 10);
-  EXPECT_DEATH(initializeHandle(type), "");
-}
-
-TEST_F(AggregationHandleSumDeathTest, VarTypeTest) {
-  const Type &type = VarCharType::Instance(true, 10);
-  EXPECT_DEATH(initializeHandle(type), "");
-}
-
-TEST_F(AggregationHandleSumDeathTest, WrongTypeTest) {
-  const Type &int_non_null_type = IntType::Instance(false);
-  const Type &long_type = LongType::Instance(true);
-  const Type &double_type = DoubleType::Instance(true);
-  const Type &float_type = FloatType::Instance(true);
-  const Type &char_type = CharType::Instance(true, 10);
-  const Type &varchar_type = VarCharType::Instance(true, 10);
-
-  initializeHandle(IntType::Instance(true));
-  int int_val = 0;
-  std::int64_t long_val = 0;
-  double double_val = 0;
-  float float_val = 0;
-
-  // Passes.
-  iterateHandle(aggregation_handle_sum_state_.get(),
-                int_non_null_type.makeValue(&int_val));
-
-  EXPECT_DEATH(iterateHandle(aggregation_handle_sum_state_.get(),
-                             long_type.makeValue(&long_val)),
-               "");
-  EXPECT_DEATH(iterateHandle(aggregation_handle_sum_state_.get(),
-                             double_type.makeValue(&double_val)),
-               "");
-  EXPECT_DEATH(iterateHandle(aggregation_handle_sum_state_.get(),
-                             float_type.makeValue(&float_val)),
-               "");
-  EXPECT_DEATH(iterateHandle(aggregation_handle_sum_state_.get(),
-                             char_type.makeValue("asdf", 5)),
-               "");
-  EXPECT_DEATH(iterateHandle(aggregation_handle_sum_state_.get(),
-                             varchar_type.makeValue("asdf", 5)),
-               "");
-
-  // Test mergeStates() with incorrectly typed handles.
-  std::unique_ptr<AggregationHandle> aggregation_handle_sum_double(
-      AggregateFunctionFactory::Get(AggregationID::kSum)
-          .createHandle(std::vector<const Type *>(1, &double_type)));
-  std::unique_ptr<AggregationState> aggregation_state_sum_merge_double(
-      aggregation_handle_sum_double->createInitialState());
-  static_cast<const AggregationHandleSum &>(*aggregation_handle_sum_double)
-      .iterateUnaryInl(static_cast<AggregationStateSum *>(
-                           aggregation_state_sum_merge_double.get()),
-                       double_type.makeValue(&double_val));
-  EXPECT_DEATH(
-      aggregation_handle_sum_->mergeStates(*aggregation_state_sum_merge_double,
-                                           aggregation_handle_sum_state_.get()),
-      "");
-
-  std::unique_ptr<AggregationHandle> aggregation_handle_sum_float(
-      AggregateFunctionFactory::Get(AggregationID::kSum)
-          .createHandle(std::vector<const Type *>(1, &float_type)));
-  std::unique_ptr<AggregationState> aggregation_state_sum_merge_float(
-      aggregation_handle_sum_float->createInitialState());
-  static_cast<const AggregationHandleSum &>(*aggregation_handle_sum_float)
-      .iterateUnaryInl(static_cast<AggregationStateSum *>(
-                           aggregation_state_sum_merge_float.get()),
-                       float_type.makeValue(&float_val));
-  EXPECT_DEATH(
-      aggregation_handle_sum_->mergeStates(*aggregation_state_sum_merge_float,
-                                           aggregation_handle_sum_state_.get()),
-      "");
-}
-#endif
-
-TEST_F(AggregationHandleSumTest, canApplyToTypeTest) {
-  EXPECT_TRUE(ApplyToTypesTest(kInt));
-  EXPECT_TRUE(ApplyToTypesTest(kLong));
-  EXPECT_TRUE(ApplyToTypesTest(kFloat));
-  EXPECT_TRUE(ApplyToTypesTest(kDouble));
-  EXPECT_FALSE(ApplyToTypesTest(kChar));
-  EXPECT_FALSE(ApplyToTypesTest(kVarChar));
-  EXPECT_FALSE(ApplyToTypesTest(kDatetime));
-  EXPECT_TRUE(ApplyToTypesTest(kDatetimeInterval));
-  EXPECT_TRUE(ApplyToTypesTest(kYearMonthInterval));
-}
-
-TEST_F(AggregationHandleSumTest, ResultTypeForArgumentTypeTest) {
-  EXPECT_TRUE(ResultTypeForArgumentTypeTest(kInt, kLong));
-  EXPECT_TRUE(ResultTypeForArgumentTypeTest(kLong, kLong));
-  EXPECT_TRUE(ResultTypeForArgumentTypeTest(kFloat, kDouble));
-  EXPECT_TRUE(ResultTypeForArgumentTypeTest(kDouble, kDouble));
-  EXPECT_TRUE(
-      ResultTypeForArgumentTypeTest(kDatetimeInterval, kDatetimeInterval));
-  EXPECT_TRUE(
-      ResultTypeForArgumentTypeTest(kYearMonthInterval, kYearMonthInterval));
-}
-
-TEST_F(AggregationHandleSumTest, GroupByTableMergeTest) {
-  const Type &long_non_null_type = LongType::Instance(false);
-  initializeHandle(long_non_null_type);
-  storage_manager_.reset(new StorageManager("./test_sum_data"));
-  std::unique_ptr<AggregationStateHashTableBase> source_hash_table(
-      AggregationStateFastHashTableFactory::CreateResizable(
-          HashTableImplType::kSeparateChaining,
-          std::vector<const Type *>(1, &long_non_null_type),
-          10,
-          {aggregation_handle_sum_.get()->getPayloadSize()},
-          {aggregation_handle_sum_.get()},
-          storage_manager_.get()));
-  std::unique_ptr<AggregationStateHashTableBase> destination_hash_table(
-      AggregationStateFastHashTableFactory::CreateResizable(
-          HashTableImplType::kSeparateChaining,
-          std::vector<const Type *>(1, &long_non_null_type),
-          10,
-          {aggregation_handle_sum_.get()->getPayloadSize()},
-          {aggregation_handle_sum_.get()},
-          storage_manager_.get()));
-
-  AggregationStateFastHashTable *destination_hash_table_derived =
-      static_cast<AggregationStateFastHashTable *>(
-          destination_hash_table.get());
-
-  AggregationStateFastHashTable *source_hash_table_derived =
-      static_cast<AggregationStateFastHashTable *>(source_hash_table.get());
-
-  AggregationHandleSum *aggregation_handle_sum_derived =
-      static_cast<AggregationHandleSum *>(aggregation_handle_sum_.get());
-  // We create three keys: first is present in both the hash tables, second key
-  // is present only in the source hash table while the third key is present
-  // the destination hash table only.
-  std::vector<TypedValue> common_key;
-  common_key.emplace_back(static_cast<std::int64_t>(0));
-  std::vector<TypedValue> exclusive_source_key, exclusive_destination_key;
-  exclusive_source_key.emplace_back(static_cast<std::int64_t>(1));
-  exclusive_destination_key.emplace_back(static_cast<std::int64_t>(2));
-
-  const std::int64_t common_key_source_sum = 3000;
-  TypedValue common_key_source_sum_val(common_key_source_sum);
-
-  const std::int64_t common_key_destination_sum = 4000;
-  TypedValue common_key_destination_sum_val(common_key_destination_sum);
-
-  const std::int64_t merged_common_key =
-      common_key_source_sum + common_key_destination_sum;
-  TypedValue common_key_merged_val(merged_common_key);
-
-  const std::int64_t exclusive_key_source_sum = 100;
-  TypedValue exclusive_key_source_sum_val(exclusive_key_source_sum);
-
-  const std::int64_t exclusive_key_destination_sum = 200;
-  TypedValue exclusive_key_destination_sum_val(exclusive_key_destination_sum);
-
-  std::unique_ptr<AggregationStateSum> common_key_source_state(
-      static_cast<AggregationStateSum *>(
-          aggregation_handle_sum_->createInitialState()));
-  std::unique_ptr<AggregationStateSum> common_key_destination_state(
-      static_cast<AggregationStateSum *>(
-          aggregation_handle_sum_->createInitialState()));
-  std::unique_ptr<AggregationStateSum> exclusive_key_source_state(
-      static_cast<AggregationStateSum *>(
-          aggregation_handle_sum_->createInitialState()));
-  std::unique_ptr<AggregationStateSum> exclusive_key_destination_state(
-      static_cast<AggregationStateSum *>(
-          aggregation_handle_sum_->createInitialState()));
-
-  // Create sum value states for keys.
-  aggregation_handle_sum_derived->iterateUnaryInl(common_key_source_state.get(),
-                                                  common_key_source_sum_val);
-  std::int64_t actual_val =
-      aggregation_handle_sum_->finalize(*common_key_source_state)
-          .getLiteral<std::int64_t>();
-  EXPECT_EQ(common_key_source_sum_val.getLiteral<std::int64_t>(), actual_val);
-
-  aggregation_handle_sum_derived->iterateUnaryInl(
-      common_key_destination_state.get(), common_key_destination_sum_val);
-  actual_val = aggregation_handle_sum_->finalize(*common_key_destination_state)
-                   .getLiteral<std::int64_t>();
-  EXPECT_EQ(common_key_destination_sum_val.getLiteral<std::int64_t>(),
-            actual_val);
-
-  aggregation_handle_sum_derived->iterateUnaryInl(
-      exclusive_key_destination_state.get(), exclusive_key_destination_sum_val);
-  actual_val =
-      aggregation_handle_sum_->finalize(*exclusive_key_destination_state)
-          .getLiteral<std::int64_t>();
-  EXPECT_EQ(exclusive_key_destination_sum_val.getLiteral<std::int64_t>(),
-            actual_val);
-
-  aggregation_handle_sum_derived->iterateUnaryInl(
-      exclusive_key_source_state.get(), exclusive_key_source_sum_val);
-  actual_val = aggregation_handle_sum_->finalize(*exclusive_key_source_state)
-                   .getLiteral<std::int64_t>();
-  EXPECT_EQ(exclusive_key_source_sum_val.getLiteral<std::int64_t>(),
-            actual_val);
-
-  // Add the key-state pairs to the hash tables.
-  unsigned char buffer[100];
-  buffer[0] = '\0';
-  memcpy(buffer + 1,
-         common_key_source_state.get()->getPayloadAddress(),
-         aggregation_handle_sum_.get()->getPayloadSize());
-  source_hash_table_derived->putCompositeKey(common_key, buffer);
-
-  memcpy(buffer + 1,
-         common_key_destination_state.get()->getPayloadAddress(),
-         aggregation_handle_sum_.get()->getPayloadSize());
-  destination_hash_table_derived->putCompositeKey(common_key, buffer);
-
-  memcpy(buffer + 1,
-         exclusive_key_source_state.get()->getPayloadAddress(),
-         aggregation_handle_sum_.get()->getPayloadSize());
-  source_hash_table_derived->putCompositeKey(exclusive_source_key, buffer);
-
-  memcpy(buffer + 1,
-         exclusive_key_destination_state.get()->getPayloadAddress(),
-         aggregation_handle_sum_.get()->getPayloadSize());
-  destination_hash_table_derived->putCompositeKey(exclusive_destination_key,
-                                                      buffer);
-
-  EXPECT_EQ(2u, destination_hash_table_derived->numEntries());
-  EXPECT_EQ(2u, source_hash_table_derived->numEntries());
-
-  AggregationOperationState::mergeGroupByHashTables(
-      source_hash_table.get(), destination_hash_table.get());
-
-  EXPECT_EQ(3u, destination_hash_table_derived->numEntries());
-
-  CheckSumValue<std::int64_t>(
-      common_key_merged_val.getLiteral<std::int64_t>(),
-      aggregation_handle_sum_derived->finalizeHashTableEntryFast(
-          destination_hash_table_derived->getSingleCompositeKey(common_key) +
-          1));
-  CheckSumValue<std::int64_t>(
-      exclusive_key_destination_sum_val.getLiteral<std::int64_t>(),
-      aggregation_handle_sum_derived->finalizeHashTableEntryFast(
-          destination_hash_table_derived->getSingleCompositeKey(
-              exclusive_destination_key) +
-          1));
-  CheckSumValue<std::int64_t>(
-      exclusive_key_source_sum_val.getLiteral<std::int64_t>(),
-      aggregation_handle_sum_derived->finalizeHashTableEntryFast(
-          source_hash_table_derived->getSingleCompositeKey(
-              exclusive_source_key) +
-          1));
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/predicate/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/expressions/predicate/CMakeLists.txt b/expressions/predicate/CMakeLists.txt
deleted file mode 100644
index b90562c..0000000
--- a/expressions/predicate/CMakeLists.txt
+++ /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.
-
-# Declare micro-libs:
-add_library(quickstep_expressions_predicate_ComparisonPredicate
-            ComparisonPredicate.cpp
-            ComparisonPredicate.hpp)
-add_library(quickstep_expressions_predicate_ConjunctionPredicate
-            ConjunctionPredicate.cpp
-            ConjunctionPredicate.hpp)
-add_library(quickstep_expressions_predicate_DisjunctionPredicate
-            DisjunctionPredicate.cpp
-            DisjunctionPredicate.hpp)
-add_library(quickstep_expressions_predicate_NegationPredicate
-            NegationPredicate.cpp
-            NegationPredicate.hpp)
-add_library(quickstep_expressions_predicate_Predicate
-            Predicate.cpp
-            Predicate.hpp)
-add_library(quickstep_expressions_predicate_PredicateCost
-            ../../empty_src.cpp
-            PredicateCost.hpp)
-add_library(quickstep_expressions_predicate_PredicateWithList
-            ../../empty_src.cpp
-            PredicateWithList.hpp)
-add_library(quickstep_expressions_predicate_TrivialPredicates
-            ../../empty_src.cpp
-            TrivialPredicates.hpp)
-
-# Link dependencies:
-target_link_libraries(quickstep_expressions_predicate_ComparisonPredicate
-                      quickstep_catalog_CatalogAttribute
-                      quickstep_catalog_CatalogTypedefs
-                      quickstep_expressions_Expressions_proto
-                      quickstep_expressions_predicate_Predicate
-                      quickstep_expressions_predicate_PredicateCost
-                      quickstep_expressions_scalar_Scalar
-                      quickstep_expressions_scalar_ScalarAttribute
-                      quickstep_storage_IndexSubBlock
-                      quickstep_storage_StorageBlockInfo
-                      quickstep_storage_SubBlocksReference
-                      quickstep_storage_TupleStorageSubBlock
-                      quickstep_storage_ValueAccessor
-                      quickstep_types_Type
-                      quickstep_types_TypeErrors
-                      quickstep_types_TypedValue
-                      quickstep_types_containers_ColumnVector
-                      quickstep_types_operations_Operation_proto
-                      quickstep_types_operations_comparisons_Comparison
-                      quickstep_utility_Macros
-                      quickstep_utility_PtrVector)
-target_link_libraries(quickstep_expressions_predicate_ConjunctionPredicate
-                      quickstep_catalog_CatalogTypedefs
-                      quickstep_expressions_Expressions_proto
-                      quickstep_expressions_predicate_Predicate
-                      quickstep_expressions_predicate_PredicateWithList
-                      quickstep_storage_StorageBlockInfo
-                      quickstep_storage_TupleIdSequence
-                      quickstep_storage_ValueAccessor
-                      quickstep_utility_Macros
-                      quickstep_utility_PtrList)
-target_link_libraries(quickstep_expressions_predicate_DisjunctionPredicate
-                      quickstep_catalog_CatalogTypedefs
-                      quickstep_expressions_Expressions_proto
-                      quickstep_expressions_predicate_Predicate
-                      quickstep_expressions_predicate_PredicateWithList
-                      quickstep_storage_StorageBlockInfo
-                      quickstep_storage_TupleIdSequence
-                      quickstep_storage_ValueAccessor
-                      quickstep_utility_Macros
-                      quickstep_utility_PtrList)
-target_link_libraries(quickstep_expressions_predicate_NegationPredicate
-                      quickstep_catalog_CatalogTypedefs
-                      quickstep_expressions_Expressions_proto
-                      quickstep_expressions_predicate_Predicate
-                      quickstep_storage_StorageBlockInfo
-                      quickstep_storage_TupleIdSequence
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_expressions_predicate_Predicate
-                      quickstep_catalog_CatalogTypedefs
-                      quickstep_expressions_Expressions_proto
-                      quickstep_storage_StorageBlockInfo
-                      quickstep_storage_TupleIdSequence
-                      quickstep_storage_ValueAccessor
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_expressions_predicate_PredicateWithList
-                      quickstep_expressions_predicate_Predicate
-                      quickstep_utility_Macros
-                      quickstep_utility_PtrList)
-target_link_libraries(quickstep_expressions_predicate_TrivialPredicates
-                      quickstep_catalog_CatalogTypedefs
-                      quickstep_expressions_Expressions_proto
-                      quickstep_expressions_predicate_Predicate
-                      quickstep_storage_StorageBlockInfo
-                      quickstep_utility_Macros)
-
-# Submodule all-in-one library:
-add_library(quickstep_expressions_predicate ../../empty_src.cpp)
-target_link_libraries(quickstep_expressions_predicate
-                      quickstep_expressions_predicate_ComparisonPredicate
-                      quickstep_expressions_predicate_ConjunctionPredicate
-                      quickstep_expressions_predicate_DisjunctionPredicate
-                      quickstep_expressions_predicate_NegationPredicate
-                      quickstep_expressions_predicate_Predicate
-                      quickstep_expressions_predicate_PredicateCost
-                      quickstep_expressions_predicate_PredicateWithList
-                      quickstep_expressions_predicate_TrivialPredicates)
-
-# Tests:
-add_executable(Predicate_unittest "${CMAKE_CURRENT_SOURCE_DIR}/tests/Predicate_unittest.cpp")
-target_link_libraries(Predicate_unittest
-                      gtest
-                      gtest_main
-                      quickstep_catalog_CatalogAttribute
-                      quickstep_catalog_CatalogDatabase
-                      quickstep_catalog_CatalogRelation
-                      quickstep_expressions_ExpressionFactories
-                      quickstep_expressions_predicate_ComparisonPredicate
-                      quickstep_expressions_predicate_ConjunctionPredicate
-                      quickstep_expressions_predicate_DisjunctionPredicate
-                      quickstep_expressions_predicate_NegationPredicate
-                      quickstep_expressions_predicate_Predicate
-                      quickstep_expressions_predicate_PredicateWithList
-                      quickstep_expressions_predicate_TrivialPredicates
-                      quickstep_expressions_scalar_Scalar
-                      quickstep_expressions_scalar_ScalarAttribute
-                      quickstep_expressions_scalar_ScalarBinaryExpression
-                      quickstep_expressions_scalar_ScalarLiteral
-                      quickstep_expressions_scalar_ScalarUnaryExpression
-                      quickstep_types_DatetimeLit
-                      quickstep_types_IntervalLit
-                      quickstep_types_Type
-                      quickstep_types_TypeFactory
-                      quickstep_types_TypeID
-                      quickstep_types_TypedValue
-                      quickstep_types_operations_binaryoperations_BinaryOperation
-                      quickstep_types_operations_binaryoperations_BinaryOperationID
-                      quickstep_types_operations_comparisons_Comparison
-                      quickstep_types_operations_comparisons_ComparisonFactory
-                      quickstep_types_operations_comparisons_ComparisonID
-                      quickstep_types_operations_unaryoperations_UnaryOperation
-                      quickstep_types_operations_unaryoperations_UnaryOperationID
-                      quickstep_utility_Macros
-                      quickstep_utility_PtrList)
-add_test(Predicate_unittest Predicate_unittest)

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/predicate/ComparisonPredicate.cpp
----------------------------------------------------------------------
diff --git a/expressions/predicate/ComparisonPredicate.cpp b/expressions/predicate/ComparisonPredicate.cpp
deleted file mode 100644
index 5f8612e..0000000
--- a/expressions/predicate/ComparisonPredicate.cpp
+++ /dev/null
@@ -1,376 +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 "expressions/predicate/ComparisonPredicate.hpp"
-
-#include <cstddef>
-#include <limits>
-#include <memory>
-#include <string>
-#include <utility>
-#include <vector>
-
-#include "catalog/CatalogAttribute.hpp"
-#include "expressions/Expressions.pb.h"
-#include "expressions/predicate/PredicateCost.hpp"
-#include "expressions/scalar/Scalar.hpp"
-#include "expressions/scalar/ScalarAttribute.hpp"
-#include "storage/IndexSubBlock.hpp"
-#include "storage/SubBlocksReference.hpp"
-#include "storage/TupleStorageSubBlock.hpp"
-#include "storage/ValueAccessor.hpp"
-#include "types/Type.hpp"
-#include "types/TypeErrors.hpp"
-#include "types/TypedValue.hpp"
-#include "types/containers/ColumnVector.hpp"
-#include "types/operations/Operation.pb.h"
-#include "types/operations/comparisons/Comparison.hpp"
-#include "utility/Macros.hpp"
-#include "utility/PtrVector.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-class TupleIdSequence;
-
-ComparisonPredicate::ComparisonPredicate(const Comparison &comparison,
-                                         Scalar *left_operand,
-                                         Scalar *right_operand)
-    : comparison_(comparison),
-      left_operand_(left_operand),
-      right_operand_(right_operand) {
-  initHelper(false);
-}
-
-serialization::Predicate ComparisonPredicate::getProto() const {
-  serialization::Predicate proto;
-  proto.set_predicate_type(serialization::Predicate::COMPARISON);
-  proto.MutableExtension(serialization::ComparisonPredicate::comparison)->CopyFrom(comparison_.getProto());
-  proto.MutableExtension(serialization::ComparisonPredicate::left_operand)->CopyFrom(left_operand_->getProto());
-  proto.MutableExtension(serialization::ComparisonPredicate::right_operand)->CopyFrom(right_operand_->getProto());
-
-  return proto;
-}
-
-Predicate* ComparisonPredicate::clone() const {
-  return new ComparisonPredicate(comparison_,
-                                 left_operand_->clone(),
-                                 right_operand_->clone());
-}
-
-bool ComparisonPredicate::isAttributeLiteralComparisonPredicate() const {
-  return (left_operand_->hasStaticValue() && (right_operand_->getDataSource() == Scalar::kAttribute))
-         || (right_operand_->hasStaticValue() && (left_operand_->getDataSource() == Scalar::kAttribute));
-}
-
-bool ComparisonPredicate::matchesForSingleTuple(const ValueAccessor &accessor,
-                                                const tuple_id tuple) const {
-  if (fast_comparator_.get() == nullptr) {
-    return static_result_;
-  } else {
-    return fast_comparator_->compareTypedValues(left_operand_->getValueForSingleTuple(accessor, tuple),
-                                                right_operand_->getValueForSingleTuple(accessor, tuple));
-  }
-}
-
-bool ComparisonPredicate::matchesForJoinedTuples(
-    const ValueAccessor &left_accessor,
-    const relation_id left_relation_id,
-    const tuple_id left_tuple_id,
-    const ValueAccessor &right_accessor,
-    const relation_id right_relation_id,
-    const tuple_id right_tuple_id) const {
-  if (fast_comparator_.get() == nullptr) {
-    return static_result_;
-  } else {
-    return fast_comparator_->compareTypedValues(
-        left_operand_->getValueForJoinedTuples(left_accessor,
-                                               left_relation_id,
-                                               left_tuple_id,
-                                               right_accessor,
-                                               right_relation_id,
-                                               right_tuple_id),
-        right_operand_->getValueForJoinedTuples(left_accessor,
-                                                left_relation_id,
-                                                left_tuple_id,
-                                                right_accessor,
-                                                right_relation_id,
-                                                right_tuple_id));
-  }
-}
-
-TupleIdSequence* ComparisonPredicate::getAllMatches(
-    ValueAccessor *accessor,
-    const SubBlocksReference *sub_blocks_ref,
-    const TupleIdSequence *filter,
-    const TupleIdSequence *existence_map) const {
-#ifdef QUICKSTEP_ENABLE_VECTOR_PREDICATE_SHORT_CIRCUIT
-  static constexpr bool short_circuit = true;
-#else
-  static constexpr bool short_circuit = false;
-#endif
-
-  if (fast_comparator_.get() == nullptr) {
-    return GenerateSequenceForStaticResult(accessor, filter, existence_map, static_result_);
-  } else if (sub_blocks_ref != nullptr && comparison_.isBasicComparison()) {
-    // NOTE(Jianqiao): sub-block indices only apply to basic comparisons.
-
-    // Try to find a method faster than a simple scan to evaluate this
-    // comparison.
-    std::size_t fastest_subblock = std::numeric_limits<std::size_t>::max();
-    predicate_cost_t lowest_cost
-        = sub_blocks_ref->tuple_store.estimatePredicateEvaluationCost(*this);
-    for (std::size_t index_id = 0; index_id < sub_blocks_ref->indices.size(); ++index_id) {
-      if (sub_blocks_ref->indices_consistent[index_id]) {
-        const predicate_cost_t index_cost
-            = sub_blocks_ref->indices[index_id].estimatePredicateEvaluationCost(*this);
-        if (index_cost < lowest_cost) {
-          fastest_subblock = index_id;
-          lowest_cost = index_cost;
-        }
-      }
-    }
-    if (fastest_subblock != std::numeric_limits<std::size_t>::max()) {
-      return sub_blocks_ref->indices[fastest_subblock].getMatchesForPredicate(*this, filter);
-    } else if (!PredicateCostIsSimpleScan(lowest_cost)) {
-      return sub_blocks_ref->tuple_store.getMatchesForPredicate(*this, filter);
-    }
-  }
-
-  // When short-circuiting is turned on, we should only evaluate the comparison
-  // for tuples that are set in '*filter'. We might need to generate a
-  // ColumnVector of values for the operand on either side of the comparison
-  // with a call to Scalar::getAllValues() before we evaluate the comparison,
-  // but we only actually care about the operand's values for the tuples that
-  // are set in '*filter' (evaluating the Scalar's value for other tuples would
-  // be a waste of memory and computation). Therefore, we set up a
-  // ValueAccessor here that only iterates over the tuples in '*filter', and we
-  // pass it in to Scalar::getAllValues() calls below so that we only generate
-  // those values that we actually need to check. We use '*filter' in place of
-  // the existence bitmap in such cases, because the filter effectively IS the
-  // existence bitmap for '*short_circuit_adapter' (this way, the tuple IDs
-  // don't get screwed up and still correspond to the original "physical" IDs
-  // in the block).
-  std::unique_ptr<ValueAccessor> short_circuit_adapter;
-  if (short_circuit && (filter != nullptr)) {
-    short_circuit_adapter.reset(accessor->createSharedTupleIdSequenceAdapterVirtual(*filter));
-  }
-
-  // NOTE(chasseur): We don't check if both operations have a static value,
-  // because if they did then this comparison would have a static result
-  // which is handled above.
-  if (left_operand_->hasStaticValue()) {
-#ifdef QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_SELECTION
-    const attribute_id right_operand_attr_id
-        = right_operand_->getAttributeIdForValueAccessor();
-    if (right_operand_attr_id != -1) {
-      return fast_comparator_->compareStaticValueAndValueAccessor(
-          left_operand_->getStaticValue(),
-          accessor,
-          right_operand_attr_id,
-          filter);
-    }
-#endif  // QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_SELECTION
-
-    if (short_circuit_adapter) {
-      std::unique_ptr<ColumnVector> right_values(right_operand_->getAllValues(
-          short_circuit_adapter.get(),
-          sub_blocks_ref));
-      return fast_comparator_->compareStaticValueAndColumnVector(
-          left_operand_->getStaticValue(),
-          *right_values,
-          nullptr,
-          filter);
-    } else {
-      std::unique_ptr<ColumnVector> right_values(right_operand_->getAllValues(
-          accessor,
-          sub_blocks_ref));
-      return fast_comparator_->compareStaticValueAndColumnVector(
-          left_operand_->getStaticValue(),
-          *right_values,
-          filter,
-          existence_map);
-    }
-  } else if (right_operand_->hasStaticValue()) {
-#ifdef QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_SELECTION
-    const attribute_id left_operand_attr_id
-        = left_operand_->getAttributeIdForValueAccessor();
-    if (left_operand_attr_id != -1) {
-      return fast_comparator_->compareValueAccessorAndStaticValue(
-          accessor,
-          left_operand_attr_id,
-          right_operand_->getStaticValue(),
-          filter);
-    }
-#endif  // QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_SELECTION
-
-    if (short_circuit_adapter) {
-      std::unique_ptr<ColumnVector> left_values(left_operand_->getAllValues(
-          short_circuit_adapter.get(),
-          sub_blocks_ref));
-      return fast_comparator_->compareColumnVectorAndStaticValue(
-          *left_values,
-          right_operand_->getStaticValue(),
-          nullptr,
-          filter);
-    } else {
-      std::unique_ptr<ColumnVector> left_values(left_operand_->getAllValues(
-          accessor,
-          sub_blocks_ref));
-      return fast_comparator_->compareColumnVectorAndStaticValue(
-          *left_values,
-          right_operand_->getStaticValue(),
-          filter,
-          existence_map);
-    }
-  } else {
-#ifdef QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_SELECTION
-    const attribute_id left_operand_attr_id
-        = left_operand_->getAttributeIdForValueAccessor();
-    const attribute_id right_operand_attr_id
-        = right_operand_->getAttributeIdForValueAccessor();
-
-    if (left_operand_attr_id != -1) {
-      if (right_operand_attr_id != -1) {
-        return fast_comparator_->compareSingleValueAccessor(accessor,
-                                                            left_operand_attr_id,
-                                                            right_operand_attr_id,
-                                                            filter);
-      } else {
-        if (short_circuit_adapter) {
-          std::unique_ptr<ColumnVector> right_values(right_operand_->getAllValues(
-              short_circuit_adapter.get(),
-              sub_blocks_ref));
-          return fast_comparator_->compareValueAccessorAndColumnVector(
-              short_circuit_adapter.get(),
-              left_operand_attr_id,
-              *right_values,
-              nullptr,
-              filter);
-        } else {
-          std::unique_ptr<ColumnVector> right_values(right_operand_->getAllValues(
-              accessor,
-              sub_blocks_ref));
-          return fast_comparator_->compareValueAccessorAndColumnVector(accessor,
-                                                                       left_operand_attr_id,
-                                                                       *right_values,
-                                                                       filter,
-                                                                       existence_map);
-        }
-      }
-    } else if (right_operand_attr_id != -1) {
-      if (short_circuit_adapter) {
-        std::unique_ptr<ColumnVector> left_values(left_operand_->getAllValues(
-            short_circuit_adapter.get(),
-            sub_blocks_ref));
-        return fast_comparator_->compareColumnVectorAndValueAccessor(
-            *left_values,
-            short_circuit_adapter.get(),
-            right_operand_attr_id,
-            nullptr,
-            filter);
-      } else {
-        std::unique_ptr<ColumnVector> left_values(left_operand_->getAllValues(
-            accessor,
-            sub_blocks_ref));
-        return fast_comparator_->compareColumnVectorAndValueAccessor(*left_values,
-                                                                     accessor,
-                                                                     right_operand_attr_id,
-                                                                     filter,
-                                                                     existence_map);
-      }
-    }
-#endif  // QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_SELECTION
-
-    if (short_circuit_adapter) {
-      std::unique_ptr<ColumnVector> left_values(left_operand_->getAllValues(
-          short_circuit_adapter.get(),
-          sub_blocks_ref));
-      std::unique_ptr<ColumnVector> right_values(right_operand_->getAllValues(
-          short_circuit_adapter.get(),
-          sub_blocks_ref));
-      return fast_comparator_->compareColumnVectors(*left_values,
-                                                    *right_values,
-                                                    nullptr,
-                                                    filter);
-    } else {
-      std::unique_ptr<ColumnVector> left_values(left_operand_->getAllValues(
-          accessor,
-          sub_blocks_ref));
-      std::unique_ptr<ColumnVector> right_values(right_operand_->getAllValues(
-          accessor,
-          sub_blocks_ref));
-      return fast_comparator_->compareColumnVectors(*left_values,
-                                                    *right_values,
-                                                    filter,
-                                                    existence_map);
-    }
-  }
-}
-
-bool ComparisonPredicate::getStaticResult() const {
-  if (fast_comparator_.get() == nullptr) {
-    return static_result_;
-  } else {
-    FATAL_ERROR("Called getStaticResult() on a predicate which has no static result");
-  }
-}
-
-std::pair<bool, attribute_id> ComparisonPredicate::getAttributeFromAttributeLiteralComparison() const {
-  DCHECK(isAttributeLiteralComparisonPredicate());
-  if (left_operand_->hasStaticValue()) {
-    DCHECK_EQ(Scalar::kAttribute, right_operand_->getDataSource());
-    return std::pair<bool, attribute_id>(
-        false,
-        static_cast<const ScalarAttribute&>(*right_operand_).getAttribute().getID());
-  } else {
-    DCHECK_EQ(Scalar::kAttribute, left_operand_->getDataSource());
-    return std::pair<bool, attribute_id>(
-        true,
-        static_cast<const ScalarAttribute&>(*left_operand_).getAttribute().getID());
-  }
-}
-
-void ComparisonPredicate::initHelper(bool own_children) {
-  if (comparison_.canCompareTypes(left_operand_->getType(), right_operand_->getType())) {
-    if (left_operand_->hasStaticValue() && right_operand_->hasStaticValue()) {
-      static_result_ = comparison_.compareTypedValuesChecked(left_operand_->getStaticValue(),
-                                                             left_operand_->getType(),
-                                                             right_operand_->getStaticValue(),
-                                                             right_operand_->getType());
-    } else {
-      fast_comparator_.reset(comparison_.makeUncheckedComparatorForTypes(left_operand_->getType(),
-                                                                         right_operand_->getType()));
-    }
-  } else {
-    const Type &left_operand_type = left_operand_->getType();
-    const Type &right_operand_type = right_operand_->getType();
-    if (!own_children) {
-      left_operand_.release();
-      right_operand_.release();
-    }
-    throw OperationInapplicableToType(comparison_.getName(),
-                                      2,
-                                      left_operand_type.getName().c_str(),
-                                      right_operand_type.getName().c_str());
-  }
-}
-
-}  // namespace quickstep


[08/51] [abbrv] [partial] incubator-quickstep git commit: remove c++ files

Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/logical/CopyFrom.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/logical/CopyFrom.hpp b/query_optimizer/logical/CopyFrom.hpp
deleted file mode 100644
index 7c5907f..0000000
--- a/query_optimizer/logical/CopyFrom.hpp
+++ /dev/null
@@ -1,147 +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_LOGICAL_COPYFROM_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_LOGICAL_COPYFROM_HPP_
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "query_optimizer/logical/Logical.hpp"
-#include "query_optimizer/logical/LogicalType.hpp"
-#include "utility/Macros.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-class CatalogRelation;
-
-namespace optimizer {
-namespace logical {
-
-/** \addtogroup OptimizerLogical
- *  @{
- */
-
-class CopyFrom;
-typedef std::shared_ptr<const CopyFrom> CopyFromPtr;
-
-/**
- * @brief Represents an operation that copies data from a text file to a relation.
- */
-class CopyFrom : public Logical {
- public:
-  LogicalType getLogicalType() const override { return LogicalType::kCopyFrom; }
-
-  std::string getName() const override { return "CopyFrom"; }
-
-  /**
-   * @return The catalog relation to insert the tuples to.
-   */
-  const CatalogRelation* catalog_relation() const { return catalog_relation_; }
-
-  /**
-   * @return The name of the file to read the data from.
-   */
-  const std::string& file_name() const { return file_name_; }
-
-  /**
-   * @return The delimiter used in the text file to separate columns.
-   */
-  const char column_delimiter() const { return column_delimiter_; }
-
-  /**
-   * @return Whether to decode escape sequences in the text file.
-   */
-  bool escape_strings() const { return escape_strings_; }
-
-  LogicalPtr copyWithNewChildren(
-      const std::vector<LogicalPtr> &new_children) const override {
-    DCHECK(new_children.empty());
-    return Create(catalog_relation_, file_name_, column_delimiter_,
-                  escape_strings_);
-  }
-
-  std::vector<expressions::AttributeReferencePtr> getOutputAttributes() const override {
-    return std::vector<expressions::AttributeReferencePtr>();
-  }
-
-  std::vector<expressions::AttributeReferencePtr> getReferencedAttributes() const override {
-    return std::vector<expressions::AttributeReferencePtr>();
-  }
-
-  /**
-   * @brief Creates a CopyFrom logical node.
-   *
-   * @param catalog_relation The catalog relation to insert the tuples to.
-   * @param file_name The name of the file to read the data from.
-   * @param column_delimiter The delimiter used in the text file to separate
-   *                         columns.
-   * @param escape_strings Whether to decode escape sequences in the text file.
-   * @return An immutable CopyFrom logical node.
-   */
-  static CopyFromPtr Create(const CatalogRelation *catalog_relation,
-                            const std::string &file_name,
-                            const char column_delimiter,
-                            bool escape_strings) {
-    return CopyFromPtr(new CopyFrom(catalog_relation,
-                                    file_name,
-                                    column_delimiter,
-                                    escape_strings));
-  }
-
- 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:
-  CopyFrom(const CatalogRelation *catalog_relation,
-           const std::string &file_name,
-           const char column_delimiter,
-           bool escape_strings)
-      : catalog_relation_(catalog_relation),
-        file_name_(file_name),
-        column_delimiter_(column_delimiter),
-        escape_strings_(escape_strings) {}
-
-  const CatalogRelation *catalog_relation_;
-  std::string file_name_;
-
-  const char column_delimiter_;
-  const bool escape_strings_;
-
-  DISALLOW_COPY_AND_ASSIGN(CopyFrom);
-};
-
-/** @} */
-
-}  // namespace logical
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_QUERY_OPTIMIZER_LOGICAL_COPYFROM_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/logical/CreateIndex.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/logical/CreateIndex.cpp b/query_optimizer/logical/CreateIndex.cpp
deleted file mode 100644
index 0166716..0000000
--- a/query_optimizer/logical/CreateIndex.cpp
+++ /dev/null
@@ -1,56 +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/logical/CreateIndex.hpp"
-
-#include <string>
-#include <vector>
-
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "utility/Cast.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-namespace optimizer {
-namespace logical {
-
-void CreateIndex::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("index_name");
-  inline_field_values->push_back(index_name_);
-
-  non_container_child_field_names->push_back("relation");
-  non_container_child_fields->push_back(input_);
-
-  container_child_field_names->push_back("index_attributes");
-  container_child_fields->push_back(CastSharedPtrVector<OptimizerTreeBase>(index_attributes_));
-
-  inline_field_names->push_back("serialized_index_description");
-  inline_field_values->push_back(index_description_->DebugString());
-}
-
-}  // namespace logical
-}  // namespace optimizer
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/logical/CreateIndex.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/logical/CreateIndex.hpp b/query_optimizer/logical/CreateIndex.hpp
deleted file mode 100644
index 4ad762d..0000000
--- a/query_optimizer/logical/CreateIndex.hpp
+++ /dev/null
@@ -1,148 +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_LOGICAL_CREATEINDEX_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_LOGICAL_CREATEINDEX_HPP_
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "query_optimizer/logical/Logical.hpp"
-#include "query_optimizer/logical/LogicalType.hpp"
-#include "storage/StorageBlockLayout.pb.h"
-#include "utility/Macros.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-namespace optimizer {
-namespace logical {
-
-/** \addtogroup OptimizerLogical
- *  @{
- */
-
-class CreateIndex;
-typedef std::shared_ptr<const CreateIndex> CreateIndexPtr;
-
-/**
- * @brief Represents an operation that creates a new index.
- */
-class CreateIndex : public Logical {
- public:
-  LogicalType getLogicalType() const override { return LogicalType::kCreateIndex; }
-
-  std::string getName() const override { return "CreateIndex"; }
-
-  /**
-   * @return The input that produces the relation to create index upon.
-   */
-  const LogicalPtr& input() const { return input_; }
-
-  /**
-   * @return The name of the index to be created.
-   */
-  const std::string& index_name() const { return index_name_; }
-
-  /**
-   * @return The list of attributes to build index upon.
-   */
-  const std::vector<expressions::AttributeReferencePtr>& index_attributes() const {
-    return index_attributes_;
-  }
-
-  /**
-   * @return Shared pointer to the index properties.
-   */
-  std::shared_ptr<const IndexSubBlockDescription> index_description() const {
-    return index_description_;
-  }
-
-  LogicalPtr copyWithNewChildren(
-      const std::vector<LogicalPtr> &new_children) const override {
-    DCHECK_EQ(getNumChildren(), new_children.size());
-    return Create(new_children[0], index_name_, index_attributes_, index_description_);
-  }
-
-  std::vector<expressions::AttributeReferencePtr> getOutputAttributes() const override {
-    return index_attributes_;
-  }
-
-  std::vector<expressions::AttributeReferencePtr> getReferencedAttributes() const override {
-    return index_attributes_;
-  }
-
-  /**
-   * @brief Creates a CreateIndex logical node that represents an operation to
-   *        create a new index.
-   *
-   * @param input The input produces the relation to create index upon.
-   * @param index_name The name of the index to create.
-   * @param index_attributes Set of attributes to create index upon.
-   * @param index_description A proto block describing the set of properties for this index
-   * @return An immutable CreateIndex node.
-   */
-  static CreateIndexPtr Create(
-      const LogicalPtr &input,
-      const std::string &index_name,
-      const std::vector<expressions::AttributeReferencePtr> &index_attributes,
-      const std::shared_ptr<const IndexSubBlockDescription> &index_description) {
-    return CreateIndexPtr(new CreateIndex(input, index_name, index_attributes, index_description));
-  }
-
- 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:
-  CreateIndex(
-      const LogicalPtr &input,
-      const std::string &index_name,
-      const std::vector<expressions::AttributeReferencePtr> &index_attributes,
-      const std::shared_ptr<const IndexSubBlockDescription> &index_description)
-      : input_(input),
-        index_name_(index_name),
-        index_attributes_(index_attributes),
-        index_description_(index_description) {
-    addChild(input_);
-  }
-
-  const LogicalPtr input_;
-  const std::string index_name_;
-  const std::vector<expressions::AttributeReferencePtr> index_attributes_;
-  std::shared_ptr<const IndexSubBlockDescription> index_description_;
-
-  DISALLOW_COPY_AND_ASSIGN(CreateIndex);
-};
-
-/** @} */
-
-}  // namespace logical
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_QUERY_OPTIMIZER_LOGICAL_CREATEINDEX_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/logical/CreateTable.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/logical/CreateTable.cpp b/query_optimizer/logical/CreateTable.cpp
deleted file mode 100644
index 111d04b..0000000
--- a/query_optimizer/logical/CreateTable.cpp
+++ /dev/null
@@ -1,56 +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/logical/CreateTable.hpp"
-
-#include <string>
-#include <vector>
-
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "utility/Cast.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-namespace optimizer {
-namespace logical {
-
-void CreateTable::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("relation");
-  inline_field_values->push_back(relation_name_);
-
-  container_child_field_names->push_back("attributes");
-  container_child_fields->push_back(CastSharedPtrVector<OptimizerTreeBase>(attributes_));
-
-  // The tree representation of the LayoutDescription object, if specified by the user.
-  if (block_properties_representation_) {
-    non_container_child_field_names->push_back("block_properties");
-    non_container_child_fields->push_back(block_properties_representation_);
-  }
-}
-
-}  // namespace logical
-}  // namespace optimizer
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/logical/CreateTable.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/logical/CreateTable.hpp b/query_optimizer/logical/CreateTable.hpp
deleted file mode 100644
index cc7c6d7..0000000
--- a/query_optimizer/logical/CreateTable.hpp
+++ /dev/null
@@ -1,141 +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_LOGICAL_CREATETABLE_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_LOGICAL_CREATETABLE_HPP_
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "query_optimizer/logical/Logical.hpp"
-#include "query_optimizer/logical/LogicalType.hpp"
-#include "storage/StorageBlockLayout.pb.h"
-#include "utility/Macros.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-namespace optimizer {
-namespace logical {
-
-/** \addtogroup OptimizerLogical
- *  @{
- */
-
-class CreateTable;
-typedef std::shared_ptr<const CreateTable> CreateTablePtr;
-
-/**
- * @brief Represents an operation that creates a new table.
- */
-class CreateTable : public Logical {
- public:
-  LogicalType getLogicalType() const override { return LogicalType::kCreateTable; }
-
-  std::string getName() const override { return "CreateTable"; }
-
-  /**
-   * @return The name of the relation to be inserted.
-   */
-  const std::string& relation_name() const { return relation_name_; }
-
-  /**
-   * @return Attribute list of the relation.
-   */
-  const std::vector<expressions::AttributeReferencePtr>& attributes() const {
-    return attributes_;
-  }
-
-  /**
-   * @return Shared pointer to the block properties.
-   */
-  const std::shared_ptr<const StorageBlockLayoutDescription> block_properties() const {
-    return block_properties_;
-  }
-
-  LogicalPtr copyWithNewChildren(
-      const std::vector<LogicalPtr> &new_children) const override {
-    DCHECK_EQ(getNumChildren(), new_children.size());
-    return Create(relation_name_, attributes_, block_properties_);
-  }
-
-  std::vector<expressions::AttributeReferencePtr> getOutputAttributes() const override {
-    return attributes_;
-  }
-
-  std::vector<expressions::AttributeReferencePtr> getReferencedAttributes() const override {
-    return attributes_;
-  }
-
-  /**
-   * @brief Creates a CreateTable logical node that represents an operation to
-   *        create a new table.
-   *
-   * @param relation_name The name of the relation to be inserted.
-   * @param attributes Schema of the relation.
-   * @param block_properties The physical layout description of this block.
-   *        Note that the pointer's ownership is assumed and shared by
-   *        Logical::CreateTable and Physical::CreateTable.
-   * @return An immutable CreateTable node.
-   */
-  static CreateTablePtr Create(
-      const std::string &relation_name,
-      const std::vector<expressions::AttributeReferencePtr> &attributes,
-      const std::shared_ptr<const StorageBlockLayoutDescription> &block_properties) {
-    return CreateTablePtr(new CreateTable(relation_name, attributes, block_properties));
-  }
-
- 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:
-  CreateTable(
-      const std::string &relation_name,
-      const std::vector<expressions::AttributeReferencePtr> &attributes,
-      const std::shared_ptr<const StorageBlockLayoutDescription> &block_properties)
-      : relation_name_(relation_name),
-        attributes_(attributes),
-        block_properties_(block_properties),
-        block_properties_representation_(
-            getOptimizerRepresentationForProto<OptimizerTreeBaseNodePtr>(block_properties_.get())) {}
-
-  std::string relation_name_;
-  std::vector<expressions::AttributeReferencePtr> attributes_;
-  std::shared_ptr<const StorageBlockLayoutDescription> block_properties_;
-  std::shared_ptr<const OptimizerProtoRepresentation<OptimizerTreeBaseNodePtr> > block_properties_representation_;
-
-  DISALLOW_COPY_AND_ASSIGN(CreateTable);
-};
-
-/** @} */
-
-}  // namespace logical
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_QUERY_OPTIMIZER_LOGICAL_CREATETABLE_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/logical/DeleteTuples.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/logical/DeleteTuples.cpp b/query_optimizer/logical/DeleteTuples.cpp
deleted file mode 100644
index f62e270..0000000
--- a/query_optimizer/logical/DeleteTuples.cpp
+++ /dev/null
@@ -1,63 +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/logical/DeleteTuples.hpp"
-
-#include <string>
-#include <vector>
-
-#include "catalog/CatalogRelation.hpp"
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "query_optimizer/expressions/Predicate.hpp"
-
-namespace quickstep {
-namespace optimizer {
-namespace logical {
-
-namespace E = ::quickstep::optimizer::expressions;
-
-std::vector<E::AttributeReferencePtr> DeleteTuples::getReferencedAttributes() const {
-  if (predicate_ != nullptr) {
-    return predicate_->getReferencedAttributes();
-  } else {
-    return std::vector<E::AttributeReferencePtr>();
-  }
-}
-
-void DeleteTuples::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("input");
-  non_container_child_fields->push_back(input_);
-
-  if (predicate_ != nullptr) {
-    non_container_child_field_names->push_back("predicate");
-    non_container_child_fields->push_back(predicate_);
-  }
-}
-
-}  // namespace logical
-}  // namespace optimizer
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/logical/DeleteTuples.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/logical/DeleteTuples.hpp b/query_optimizer/logical/DeleteTuples.hpp
deleted file mode 100644
index 8ecd82f..0000000
--- a/query_optimizer/logical/DeleteTuples.hpp
+++ /dev/null
@@ -1,126 +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_LOGICAL_DELETE_TUPLES_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_LOGICAL_DELETE_TUPLES_HPP_
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "query_optimizer/expressions/Predicate.hpp"
-#include "query_optimizer/logical/Logical.hpp"
-#include "query_optimizer/logical/LogicalType.hpp"
-#include "utility/Macros.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-class CatalogRelation;
-
-namespace optimizer {
-namespace logical {
-
-/** \addtogroup OptimizerLogical
- *  @{
- */
-
-class DeleteTuples;
-typedef std::shared_ptr<const DeleteTuples> DeleteTuplesPtr;
-
-/**
- * @brief Deletes tuples on which a predicate <predicate_> is evaluated to true.
- */
-class DeleteTuples : public Logical {
- public:
-  LogicalType getLogicalType() const override { return LogicalType::kDeleteTuples; }
-
-  std::string getName() const override { return "DeleteTuples"; }
-
-  /**
-   * @return The logical node that produces the relation where the DeleteTuples
-   *         is applied.
-   */
-  const LogicalPtr& input() const { return input_; }
-
-  /**
-   * @return The predicate used to determine whether a tuple should be deleted.
-   */
-  const expressions::PredicatePtr& predicate() const { return predicate_; }
-
-  LogicalPtr copyWithNewChildren(
-      const std::vector<LogicalPtr> &new_children) const override {
-    DCHECK_EQ(getNumChildren(), new_children.size());
-    return Create(new_children[0], predicate_);
-  }
-
-  std::vector<expressions::AttributeReferencePtr> getOutputAttributes() const override {
-    return {};
-  }
-
-  std::vector<expressions::AttributeReferencePtr> getReferencedAttributes() const override;
-
-  /**
-   * @brief Creates a DeleteTuples logical node that represents an operation to
-   *        delete tuples on which \p predicate is evaluated to true from the
-   *        relation output by \p input.
-   *
-   * @param input The logical node that produces the relation where the
-   *              DeleteTuples is applied.
-   * @param predicate The predicate used to determine whether a tuple needs to
-   *                  be deleted.
-   * @return An immutable DeleteTuples node.
-   */
-  static DeleteTuplesPtr Create(const LogicalPtr &input,
-                                const expressions::PredicatePtr &predicate) {
-    return DeleteTuplesPtr(new DeleteTuples(input, predicate));
-  }
-
- 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:
-  DeleteTuples(const LogicalPtr &input,
-               const expressions::PredicatePtr &predicate)
-      : input_(input), predicate_(predicate) {
-    addChild(input_);
-  }
-
-  LogicalPtr input_;
-  expressions::PredicatePtr predicate_;
-
-  DISALLOW_COPY_AND_ASSIGN(DeleteTuples);
-};
-
-/** @} */
-
-}  // namespace logical
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_QUERY_OPTIMIZER_LOGICAL_DELETE_TUPLES_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/logical/DropTable.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/logical/DropTable.cpp b/query_optimizer/logical/DropTable.cpp
deleted file mode 100644
index 4936dfa..0000000
--- a/query_optimizer/logical/DropTable.cpp
+++ /dev/null
@@ -1,48 +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/logical/DropTable.hpp"
-
-#include <string>
-#include <vector>
-
-#include "catalog/CatalogRelation.hpp"
-#include "query_optimizer/OptimizerTree.hpp"
-
-namespace quickstep {
-
-class CatalogRelation;
-
-namespace optimizer {
-namespace logical {
-
-void DropTable::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("relation");
-  inline_field_values->push_back(catalog_relation_->getName());
-}
-
-}  // namespace logical
-}  // namespace optimizer
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/logical/DropTable.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/logical/DropTable.hpp b/query_optimizer/logical/DropTable.hpp
deleted file mode 100644
index ce70256..0000000
--- a/query_optimizer/logical/DropTable.hpp
+++ /dev/null
@@ -1,111 +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_LOGICAL_DROPTABLE_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_LOGICAL_DROPTABLE_HPP_
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "query_optimizer/logical/Logical.hpp"
-#include "query_optimizer/logical/LogicalType.hpp"
-#include "utility/Macros.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-class CatalogRelation;
-
-namespace optimizer {
-namespace logical {
-
-/** \addtogroup OptimizerLogical
- *  @{
- */
-
-class DropTable;
-typedef std::shared_ptr<const DropTable> DropTablePtr;
-
-/**
- * @brief Drops a table.
- */
-class DropTable : public Logical {
- public:
-  LogicalType getLogicalType() const override { return LogicalType::kDropTable; }
-
-  std::string getName() const override { return "DropTable"; }
-
-  /**
-   * @return Gets the catalog relation to be dropped.
-   */
-  const CatalogRelation* catalog_relation() const { return catalog_relation_; }
-
-  LogicalPtr copyWithNewChildren(
-      const std::vector<LogicalPtr> &new_children) const override {
-    DCHECK(new_children.empty());
-    return Create(catalog_relation_);
-  }
-
-  std::vector<expressions::AttributeReferencePtr> getOutputAttributes() const override {
-    return std::vector<expressions::AttributeReferencePtr>();
-  }
-
-  std::vector<expressions::AttributeReferencePtr> getReferencedAttributes() const override {
-    return std::vector<expressions::AttributeReferencePtr>();
-  }
-
-  /**
-   * @brief Creates a DropTable logical node that drops \p catalog_relation.
-   *
-   * @param catalog_relation The relation to be dropped.
-   * @return An immutable DropTable node.
-   */
-  static DropTablePtr Create(const CatalogRelation *catalog_relation) {
-    return DropTablePtr(new DropTable(catalog_relation));
-  }
-
- 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 DropTable(const CatalogRelation *catalog_relation)
-      : catalog_relation_(catalog_relation) {}
-
-  const CatalogRelation *catalog_relation_;
-
-  DISALLOW_COPY_AND_ASSIGN(DropTable);
-};
-
-/** @} */
-
-}  // namespace logical
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_QUERY_OPTIMIZER_LOGICAL_DROPTABLE_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/logical/Filter.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/logical/Filter.cpp b/query_optimizer/logical/Filter.cpp
deleted file mode 100644
index 4346b89..0000000
--- a/query_optimizer/logical/Filter.cpp
+++ /dev/null
@@ -1,83 +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/logical/Filter.hpp"
-
-#include <string>
-#include <vector>
-
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/PatternMatcher.hpp"
-#include "query_optimizer/expressions/Predicate.hpp"
-#include "query_optimizer/logical/PatternMatcher.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-namespace optimizer {
-namespace logical {
-
-namespace E = ::quickstep::optimizer::expressions;
-
-Filter::Filter(const LogicalPtr &input,
-               const E::PredicatePtr &filter_predicate) {
-  FilterPtr child_filter;
-  LogicalPtr flattened_input;
-
-  // Flatten the Filer on top of another Filter
-  if (SomeFilter::MatchesWithConditionalCast(input, &child_filter)) {
-    flattened_input = child_filter->input();
-    filter_predicate_ = E::LogicalAnd::Create(
-        {filter_predicate, child_filter->filter_predicate()} /* operands */);
-  } else {
-    flattened_input = input;
-    filter_predicate_ = filter_predicate;
-  }
-  addChild(flattened_input);
-  addInputExpression(filter_predicate_);
-}
-
-LogicalPtr Filter::copyWithNewInputExpressions(
-    const std::vector<expressions::ExpressionPtr> &input_expressions) const {
-  DCHECK_EQ(1u, input_expressions.size());
-
-  E::PredicatePtr new_filter_predicate;
-  E::SomePredicate::MatchesWithConditionalCast(input_expressions[0], &new_filter_predicate);
-  DCHECK(new_filter_predicate != nullptr);
-
-  return Create(children()[0], new_filter_predicate);
-}
-
-void Filter::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("input");
-  non_container_child_field_names->push_back("filter_predicate");
-
-  non_container_child_fields->push_back(input());
-  non_container_child_fields->push_back(filter_predicate_);
-}
-
-}  // namespace logical
-}  // namespace optimizer
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/logical/Filter.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/logical/Filter.hpp b/query_optimizer/logical/Filter.hpp
deleted file mode 100644
index 62623e2..0000000
--- a/query_optimizer/logical/Filter.hpp
+++ /dev/null
@@ -1,148 +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_LOGICAL_FILTER_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_LOGICAL_FILTER_HPP_
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "query_optimizer/expressions/Expression.hpp"
-#include "query_optimizer/expressions/LogicalAnd.hpp"
-#include "query_optimizer/expressions/Predicate.hpp"
-#include "query_optimizer/logical/Logical.hpp"
-#include "query_optimizer/logical/LogicalType.hpp"
-#include "utility/Macros.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-namespace optimizer {
-namespace logical {
-
-/** \addtogroup OptimizerLogical
- *  @{
- */
-
-class Filter;
-typedef std::shared_ptr<const Filter> FilterPtr;
-
-/**
- * @brief Applies a filter to the input tuples and outputs a tuple only if the
- *        filter evaluates to true.
- */
-class Filter : public Logical {
- public:
-  LogicalType getLogicalType() const override { return LogicalType::kFilter; }
-
-  std::string getName() const override { return "Filter"; }
-
-  /**
-   * @return The filter predicate.
-   */
-  const expressions::PredicatePtr& filter_predicate() const {
-    return filter_predicate_;
-  }
-
-  /**
-   * @return The input operator.
-   */
-  const LogicalPtr& input() const { return children()[0]; }
-
-  LogicalPtr copyWithNewChildren(
-      const std::vector<LogicalPtr> &new_children) const override {
-    DCHECK_EQ(new_children.size(), children().size());
-    return Filter::Create(new_children[0], filter_predicate_);
-  }
-
-  LogicalPtr copyWithNewInputExpressions(
-      const std::vector<expressions::ExpressionPtr> &input_expressions) const override;
-
-  std::vector<expressions::AttributeReferencePtr> getOutputAttributes() const override {
-    return input()->getOutputAttributes();
-  }
-
-  std::vector<expressions::AttributeReferencePtr> getReferencedAttributes() const override {
-    return filter_predicate_->getReferencedAttributes();
-  }
-
-  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;
-
-  /**
-   * @brief Creates a Filter that applies \p filter_predicate to the tuples
-   *        produced by \p input.
-   * @note If the input is a Filter, it will be pulled up and merged into the
-   *       new Filter.
-   *
-   * @param input The input operator.
-   * @param filter_predicate The filter predicate.
-   * @return An immutable Filter.
-   */
-  static FilterPtr Create(const LogicalPtr &input,
-                          const expressions::PredicatePtr &filter_predicate) {
-    return FilterPtr(new Filter(input, filter_predicate));
-  }
-
-  /**
-   * @brief Construct a (conjunctive) predicate on \p filter_predicates and
-   *        creates a Filter that applies the predicates to the tuples produced
-   *        by \p input.
-   * @note If the input is a Filter, it will be pulled up and merged into the
-   *       new Filter.
-   *
-   * @param input The input operator.
-   * @param filter_predicates The filter predicates to be applied to the input.
-   * @return An immutable Filter.
-   */
-  static FilterPtr Create(
-      const LogicalPtr &input,
-      const std::vector<expressions::PredicatePtr> &filter_predicates) {
-    if (filter_predicates.size() > 1u) {
-      return Create(input, expressions::LogicalAnd::Create(filter_predicates));
-    } else {
-      return Create(input, filter_predicates[0]);
-    }
-  }
-
- private:
-  Filter(const LogicalPtr &input,
-         const expressions::PredicatePtr &filter_predicate);
-
-  expressions::PredicatePtr filter_predicate_;
-
-  DISALLOW_COPY_AND_ASSIGN(Filter);
-};
-
-/** @} */
-
-}  // namespace logical
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_QUERY_OPTIMIZER_LOGICAL_FILTER_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/logical/HashJoin.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/logical/HashJoin.hpp b/query_optimizer/logical/HashJoin.hpp
deleted file mode 100644
index b0e63e7..0000000
--- a/query_optimizer/logical/HashJoin.hpp
+++ /dev/null
@@ -1,245 +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_LOGICAL_HASH_JOIN_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_LOGICAL_HASH_JOIN_HPP_
-
-#include <memory>
-#include <string>
-#include <type_traits>
-#include <vector>
-
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "query_optimizer/expressions/ExpressionUtil.hpp"
-#include "query_optimizer/expressions/Predicate.hpp"
-#include "query_optimizer/logical/BinaryJoin.hpp"
-#include "query_optimizer/logical/Logical.hpp"
-#include "query_optimizer/logical/LogicalType.hpp"
-#include "utility/Cast.hpp"
-#include "utility/Macros.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-namespace optimizer {
-namespace logical {
-
-/** \addtogroup OptimizerLogical
- *  @{
- */
-
-class HashJoin;
-typedef std::shared_ptr<const HashJoin> HashJoinPtr;
-
-/**
- * @brief Hash join operator. It takes two relations and a single equality
- *        predicate between a pair of attributes from each input relation as input,
- *        scans one relation and probes the hash table on the other relation.
- */
-class HashJoin : public BinaryJoin {
- public:
-  enum class JoinType {
-    kInnerJoin = 0,
-    kLeftSemiJoin,
-    kLeftAntiJoin,
-    kLeftOuterJoin
-  };
-
-  LogicalType getLogicalType() const override { return LogicalType::kHashJoin; }
-
-  std::string getName() const override {
-    switch (join_type_) {
-      case JoinType::kInnerJoin:
-        return "HashJoin";
-      case JoinType::kLeftSemiJoin:
-        return "HashLeftSemiJoin";
-      case JoinType::kLeftAntiJoin:
-        return "HashLeftAntiJoin";
-      case JoinType::kLeftOuterJoin:
-        return "HashLeftOuterJoin";
-      default:
-        LOG(FATAL) << "Invalid JoinType: "
-                   << static_cast<typename std::underlying_type<JoinType>::type>(join_type_);
-    }
-  }
-
-  /**
-   * @brief Join attributes in the left logical 'left_'.
-   */
-  const std::vector<expressions::AttributeReferencePtr>& left_join_attributes() const {
-    return left_join_attributes_;
-  }
-
-  /**
-   * @brief Join attributes in the right logical 'right_'.
-   */
-  const std::vector<expressions::AttributeReferencePtr>& right_join_attributes() const {
-    return right_join_attributes_;
-  }
-
-  /**
-   * @brief The filtering predicate evaluated after join.
-   */
-  const expressions::PredicatePtr& residual_predicate() const {
-    return residual_predicate_;
-  }
-
-  /**
-   * @return Join type of this hash join.
-   */
-  JoinType join_type() const {
-    return join_type_;
-  }
-
-  LogicalPtr copyWithNewChildren(
-      const std::vector<LogicalPtr> &new_children) const override {
-    DCHECK_EQ(new_children.size(), children().size());
-    return HashJoin::Create(new_children[0],
-                            new_children[1],
-                            left_join_attributes_,
-                            right_join_attributes_,
-                            residual_predicate_,
-                            join_type_);
-  }
-
-  std::vector<expressions::AttributeReferencePtr> getOutputAttributes() const override {
-    if (join_type_ != JoinType::kLeftOuterJoin) {
-      return BinaryJoin::getOutputAttributes();
-    }
-
-    // For left outer join, all the output attributes from the right relation
-    // must be nullable.
-    std::vector<expressions::AttributeReferencePtr> output_attributes =
-        left()->getOutputAttributes();
-    const std::vector<expressions::AttributeReferencePtr> right_nullable_output_attributes =
-        GetNullableAttributeVector(right()->getOutputAttributes());
-    output_attributes.insert(output_attributes.end(),
-                             right_nullable_output_attributes.begin(),
-                             right_nullable_output_attributes.end());
-    return output_attributes;
-  }
-
-  std::vector<expressions::AttributeReferencePtr> getReferencedAttributes() const override {
-    std::vector<expressions::AttributeReferencePtr> referenced_attributes =
-        left_join_attributes_;
-    referenced_attributes.insert(referenced_attributes.end(),
-                                 right_join_attributes_.begin(),
-                                 right_join_attributes_.end());
-    if (residual_predicate_ != nullptr) {
-      const std::vector<expressions::AttributeReferencePtr> referenced_attributes_in_residual =
-          residual_predicate_->getReferencedAttributes();
-      referenced_attributes.insert(referenced_attributes.end(),
-                                   referenced_attributes_in_residual.begin(),
-                                   referenced_attributes_in_residual.end());
-    }
-    return referenced_attributes;
-  }
-
-  /**
-   * @brief Creates a logical HashJoin operator that combines two relations
-   *        produced by the two input operator using join predicate. The node
-   *        does not specify which one of the two relations is the build or
-   *        the probe relation. The join predicate is the conjunction of
-   *        equality predicates for pairs in left_join_attributes and
-   *        right_join_attributes.
-   *
-   * @param left The left input operator.
-   * @param right The right input operator.
-   * @param left_join_attributes The join attributes in the 'left'.
-   * @param right_join_attributes The join attributes in the 'right'.
-   * @param Join type of this hash join.
-   * @return An immutable HashJoin.
-   */
-  static HashJoinPtr Create(const LogicalPtr &left,
-                            const LogicalPtr &right,
-                            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) {
-    return HashJoinPtr(
-        new HashJoin(left,
-                     right,
-                     left_join_attributes,
-                     right_join_attributes,
-                     residual_predicate,
-                     join_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 {
-    BinaryJoin::getFieldStringItems(inline_field_names,
-                                    inline_field_values,
-                                    non_container_child_field_names,
-                                    non_container_child_fields,
-                                    container_child_field_names,
-                                    container_child_fields);
-
-    if (residual_predicate_ != nullptr) {
-      non_container_child_field_names->push_back("residual_predicate");
-      non_container_child_fields->push_back(residual_predicate_);
-    }
-
-    container_child_field_names->push_back("left_join_attributes");
-    container_child_fields->push_back(CastSharedPtrVector<OptimizerTreeBase>(left_join_attributes_));
-    container_child_field_names->push_back("right_join_attributes");
-    container_child_fields->push_back(CastSharedPtrVector<OptimizerTreeBase>(right_join_attributes_));
-  }
-
- private:
-  HashJoin(const LogicalPtr &left,
-           const LogicalPtr &right,
-           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)
-      : BinaryJoin(left, right),
-        left_join_attributes_(left_join_attributes),
-        right_join_attributes_(right_join_attributes),
-        residual_predicate_(residual_predicate),
-        join_type_(join_type) {
-    DCHECK_EQ(left_join_attributes.size(), right_join_attributes.size());
-    DCHECK(!left_join_attributes.empty() || residual_predicate != nullptr);
-
-    if (residual_predicate_ != nullptr) {
-      addInputExpression(residual_predicate_);
-    }
-  }
-
-  std::vector<expressions::AttributeReferencePtr> left_join_attributes_;
-  std::vector<expressions::AttributeReferencePtr> right_join_attributes_;
-  expressions::PredicatePtr residual_predicate_;
-  const JoinType join_type_;
-
-  DISALLOW_COPY_AND_ASSIGN(HashJoin);
-};
-
-/** @} */
-
-}  // namespace logical
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_QUERY_OPTIMIZER_LOGICAL_HASH_JOIN_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/logical/InsertSelection.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/logical/InsertSelection.cpp b/query_optimizer/logical/InsertSelection.cpp
deleted file mode 100644
index 3bcbc20..0000000
--- a/query_optimizer/logical/InsertSelection.cpp
+++ /dev/null
@@ -1,47 +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/logical/InsertSelection.hpp"
-
-#include <string>
-#include <vector>
-
-#include "query_optimizer/OptimizerTree.hpp"
-
-namespace quickstep {
-namespace optimizer {
-namespace logical {
-
-void InsertSelection::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("destination");
-  non_container_child_fields->push_back(destination_);
-
-  non_container_child_field_names->push_back("selection");
-  non_container_child_fields->push_back(selection_);
-}
-
-}  // namespace logical
-}  // namespace optimizer
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/logical/InsertSelection.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/logical/InsertSelection.hpp b/query_optimizer/logical/InsertSelection.hpp
deleted file mode 100644
index 9cdbb1c..0000000
--- a/query_optimizer/logical/InsertSelection.hpp
+++ /dev/null
@@ -1,122 +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_LOGICAL_INSERT_SELECTION_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_LOGICAL_INSERT_SELECTION_HPP_
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "query_optimizer/logical/Logical.hpp"
-#include "query_optimizer/logical/LogicalType.hpp"
-#include "utility/Macros.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-namespace optimizer {
-namespace logical {
-
-/** \addtogroup OptimizerLogical
- *  @{
- */
-
-class InsertSelection;
-typedef std::shared_ptr<const InsertSelection> InsertSelectionPtr;
-
-/**
- * @brief Inserts the results from a SELECT query into a relation.
- */
-class InsertSelection : public Logical {
- public:
-  LogicalType getLogicalType() const override { return LogicalType::kInsertSelection; }
-
-  std::string getName() const override { return "InsertSelection"; }
-
-  /**
-   * @return The destination relation to insert the selection to.
-   */
-  const LogicalPtr& destination() const { return destination_; }
-
-  /**
-   * @return The selection to be inserted.
-   */
-  const LogicalPtr& selection() const { return selection_; }
-
-  LogicalPtr copyWithNewChildren(
-      const std::vector<LogicalPtr> &new_children) const override {
-    DCHECK_EQ(getNumChildren(), new_children.size());
-    return Create(new_children[0], new_children[1]);
-  }
-
-  std::vector<expressions::AttributeReferencePtr> getOutputAttributes() const override {
-    return {};
-  }
-
-  std::vector<expressions::AttributeReferencePtr> getReferencedAttributes() const override {
-    return selection_->getOutputAttributes();
-  }
-
-  /**
-   * @brief Creates an InsertSelection logical node.
-   *
-   * @param destination The destination relation to insert the selection to.
-   * @param selection The selection to be inserted.
-   * @return An immutable InsertSelection node.
-   */
-  static InsertSelectionPtr Create(
-      const LogicalPtr &destination,
-      const LogicalPtr &selection) {
-    return InsertSelectionPtr(new InsertSelection(destination, selection));
-  }
-
- 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:
-  InsertSelection(const LogicalPtr &destination,
-                  const LogicalPtr &selection)
-      : destination_(destination),
-        selection_(selection) {
-    addChild(destination);
-    addChild(selection);
-  }
-
-  LogicalPtr destination_;
-  LogicalPtr selection_;
-
-  DISALLOW_COPY_AND_ASSIGN(InsertSelection);
-};
-
-/** @} */
-
-}  // namespace logical
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_QUERY_OPTIMIZER_LOGICAL_INSERT_SELECTION_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/logical/InsertTuple.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/logical/InsertTuple.cpp b/query_optimizer/logical/InsertTuple.cpp
deleted file mode 100644
index e5ffa35..0000000
--- a/query_optimizer/logical/InsertTuple.cpp
+++ /dev/null
@@ -1,50 +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/logical/InsertTuple.hpp"
-
-#include <string>
-#include <vector>
-
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/ScalarLiteral.hpp"
-#include "query_optimizer/logical/Logical.hpp"
-#include "utility/Cast.hpp"
-
-namespace quickstep {
-namespace optimizer {
-namespace logical {
-
-void InsertTuple::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("input");
-  non_container_child_fields->push_back(input_);
-
-  container_child_field_names->push_back("column_values");
-  container_child_fields->push_back(CastSharedPtrVector<OptimizerTreeBase>(column_values_));
-}
-
-}  // namespace logical
-}  // namespace optimizer
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/logical/InsertTuple.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/logical/InsertTuple.hpp b/query_optimizer/logical/InsertTuple.hpp
deleted file mode 100644
index fd0301e..0000000
--- a/query_optimizer/logical/InsertTuple.hpp
+++ /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.
- **/
-
-#ifndef QUICKSTEP_QUERY_OPTIMIZER_LOGICAL_INSERT_TUPLE_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_LOGICAL_INSERT_TUPLE_HPP_
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "query_optimizer/expressions/ScalarLiteral.hpp"
-#include "query_optimizer/logical/Logical.hpp"
-#include "query_optimizer/logical/LogicalType.hpp"
-#include "utility/Macros.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-namespace optimizer {
-namespace logical {
-
-/** \addtogroup OptimizerLogical
- *  @{
- */
-
-class InsertTuple;
-typedef std::shared_ptr<const InsertTuple> InsertTuplePtr;
-
-/**
- * @brief Inserts a tuple with <column_values_> into a relation.
- */
-class InsertTuple : public Logical {
- public:
-  LogicalType getLogicalType() const override { return LogicalType::kInsertTuple; }
-
-  std::string getName() const override { return "InsertTuple"; }
-
-  /**
-   * @return The input that produces the relation to insert the tuple to.
-   */
-  const LogicalPtr& input() const { return input_; }
-
-  /**
-   * @return Column values to be used to compose a new tuple.
-   */
-  const std::vector<expressions::ScalarLiteralPtr>& column_values() const {
-    return column_values_;
-  }
-
-  LogicalPtr copyWithNewChildren(
-      const std::vector<LogicalPtr> &new_children) const override {
-    DCHECK_EQ(getNumChildren(), new_children.size());
-    return Create(new_children[0], column_values_);
-  }
-
-  std::vector<expressions::AttributeReferencePtr> getOutputAttributes() const override {
-    return {};
-  }
-
-  std::vector<expressions::AttributeReferencePtr> getReferencedAttributes() const override {
-    return {};
-  }
-
-  /**
-   * @brief Creates an InsertTuple logical node.
-   *
-   * @param input The input produces the relation to insert the tuple to.
-   * @param column_values The column values of the tuple to be inserted.
-   * @return An immutable InsertTuple node.
-   */
-  static InsertTuplePtr Create(
-      const LogicalPtr &input,
-      const std::vector<expressions::ScalarLiteralPtr> &column_values) {
-    return InsertTuplePtr(new InsertTuple(input, column_values));
-  }
-
- 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:
-  InsertTuple(const LogicalPtr &input,
-              const std::vector<expressions::ScalarLiteralPtr> &column_values)
-      : input_(input), column_values_(column_values) {
-    addChild(input_);
-  }
-
-  LogicalPtr input_;
-  std::vector<expressions::ScalarLiteralPtr> column_values_;
-
-  DISALLOW_COPY_AND_ASSIGN(InsertTuple);
-};
-
-/** @} */
-
-}  // namespace logical
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_QUERY_OPTIMIZER_LOGICAL_INSERT_TUPLE_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/logical/Join.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/logical/Join.hpp b/query_optimizer/logical/Join.hpp
deleted file mode 100644
index ae74816..0000000
--- a/query_optimizer/logical/Join.hpp
+++ /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.
- **/
-
-#ifndef QUICKSTEP_QUERY_OPTIMIZER_LOGICAL_JOIN_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_LOGICAL_JOIN_HPP_
-
-#include <memory>
-#include "query_optimizer/logical/Logical.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-namespace optimizer {
-namespace logical {
-
-/** \addtogroup OptimizerLogical
- *  @{
- */
-
-class Join;
-typedef std::shared_ptr<const Join> JoinPtr;
-
-/**
- * @brief Base class for logical join operator that combines tuples from two or
- *        more relations based on join predicates.
- */
-class Join : public Logical {
- public:
-  /**
-   * @brief Destructor.
-   */
-  ~Join() override {}
-
- protected:
-  /**
-   * @brief Constructor.
-   */
-  Join() {}
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(Join);
-};
-
-/** @} */
-
-}  // namespace logical
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_QUERY_OPTIMIZER_LOGICAL_JOIN_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/logical/Logical.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/logical/Logical.hpp b/query_optimizer/logical/Logical.hpp
deleted file mode 100644
index 6396f15..0000000
--- a/query_optimizer/logical/Logical.hpp
+++ /dev/null
@@ -1,139 +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_LOGICAL_LOGICAL_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_LOGICAL_LOGICAL_HPP_
-
-#include <memory>
-#include <vector>
-
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "query_optimizer/expressions/Expression.hpp"
-#include "query_optimizer/logical/LogicalType.hpp"
-#include "utility/Macros.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-namespace optimizer {
-namespace logical {
-
-/** \addtogroup OptimizerLogical
- *  @{
- */
-
-class Logical;
-typedef std::shared_ptr<const Logical> LogicalPtr;
-
-/**
- * @brief Base class for all logical operator/node.
- */
-class Logical : public OptimizerTree<Logical>,
-                public std::enable_shared_from_this<const Logical> {
- public:
-  /**
-   * @brief Destructor.
-   */
-  ~Logical() {}
-
-  /**
-   * @return The type of this logical operator.
-   */
-  virtual LogicalType getLogicalType() const = 0;
-
-  /**
-   * @return The references to the output attributes produced by this logical
-   * operator.
-   */
-  virtual std::vector<expressions::AttributeReferencePtr> getOutputAttributes() const = 0;
-
-  /**
-   * @return The references to the input attributes used in this logical
-   * operator.
-   */
-  virtual std::vector<expressions::AttributeReferencePtr> getReferencedAttributes() const = 0;
-
-  /**
-   * @brief Make a copy of this logical node with input expressions replaced by
-   *        input_expression.
-   *
-   * @return A copy of this logical node with the new input expressions.
-   */
-  virtual LogicalPtr copyWithNewInputExpressions(
-      const std::vector<expressions::ExpressionPtr> &input_expressions) const {
-    // Default implementation: return a shared reference to "this" when there is
-    // no change.
-    DCHECK(input_expressions.empty());
-    return shared_from_this();
-  }
-
-  /**
-   * @return The input expressions in this Logical.
-   */
-  const std::vector<expressions::ExpressionPtr>& input_expressions() const {
-    return input_expressions_;
-  }
-
-  /**
-   * @return The input attributes, which are the union set of the output attributes of
-   *         all children.
-   */
-  std::vector<expressions::AttributeReferencePtr> getInputAttributes() const {
-    std::vector<expressions::AttributeReferencePtr> input_attributes;
-    for (const LogicalPtr &child : children()) {
-      const std::vector<expressions::AttributeReferencePtr> child_output_attributes =
-          child->getOutputAttributes();
-      input_attributes.insert(input_attributes.end(),
-                              child_output_attributes.begin(),
-                              child_output_attributes.end());
-    }
-    return input_attributes;
-  }
-
- protected:
-  /**
-   * @brief Constructor.
-   */
-  Logical() {}
-
-  template <class ExpressionClass>
-  void addInputExpressions(const std::vector<ExpressionClass> &new_input_expressions) {
-    input_expressions_.insert(input_expressions_.end(),
-                              new_input_expressions.begin(),
-                              new_input_expressions.end());
-  }
-
-  void addInputExpression(const expressions::ExpressionPtr &new_input_expression) {
-    input_expressions_.emplace_back(new_input_expression);
-  }
-
-  std::vector<expressions::ExpressionPtr> input_expressions_;
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(Logical);
-};
-
-/** @} */
-
-}  // namespace logical
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_QUERY_OPTIMIZER_LOGICAL_LOGICAL_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/logical/LogicalType.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/logical/LogicalType.hpp b/query_optimizer/logical/LogicalType.hpp
deleted file mode 100644
index d1011b0..0000000
--- a/query_optimizer/logical/LogicalType.hpp
+++ /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.
- **/
-
-#ifndef QUICKSTEP_QUERY_OPTIMIZER_LOGICAL_LOGICAL_TYPE_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_LOGICAL_LOGICAL_TYPE_HPP_
-
-namespace quickstep {
-namespace optimizer {
-namespace logical {
-
-/** \addtogroup OptimizerExpressions
- *  @{
- */
-
-/**
- * @brief Optimizer logical node types.
- **/
-enum class LogicalType {
-  kAggregate,
-  kCopyFrom,
-  kCreateIndex,
-  kCreateTable,
-  kDeleteTuples,
-  kDropTable,
-  kFilter,
-  kHashJoin,
-  kInsertSelection,
-  kInsertTuple,
-  kMultiwayCartesianJoin,
-  kNestedLoopsJoin,
-  kProject,
-  kSample,
-  kSharedSubplanReference,
-  kSort,
-  kTableGenerator,
-  kTableReference,
-  kTopLevelPlan,
-  kUpdateTable,
-  kWindowAggregate
-};
-
-/** @} */
-
-}  // namespace logical
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_QUERY_OPTIMIZER_LOGICAL_LOGICAL_TYPE_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/logical/MultiwayCartesianJoin.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/logical/MultiwayCartesianJoin.cpp b/query_optimizer/logical/MultiwayCartesianJoin.cpp
deleted file mode 100644
index 60a0e22..0000000
--- a/query_optimizer/logical/MultiwayCartesianJoin.cpp
+++ /dev/null
@@ -1,67 +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/logical/MultiwayCartesianJoin.hpp"
-
-#include <string>
-#include <vector>
-
-#include "query_optimizer/OptimizerTree.hpp"
-#include "utility/Cast.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-namespace optimizer {
-namespace logical {
-
-namespace E = ::quickstep::optimizer::expressions;
-
-std::vector<E::AttributeReferencePtr> MultiwayCartesianJoin::getOutputAttributes() const {
-  std::vector<E::AttributeReferencePtr> output_attributes;
-  for (const LogicalPtr &operand : operands()) {
-    const std::vector<E::AttributeReferencePtr> output_attributes_in_operand =
-        operand->getOutputAttributes();
-    output_attributes.insert(output_attributes.end(),
-                             output_attributes_in_operand.begin(),
-                             output_attributes_in_operand.end());
-  }
-  return output_attributes;
-}
-
-LogicalPtr MultiwayCartesianJoin::copyWithNewChildren(
-    const std::vector<LogicalPtr> &new_children) const {
-  DCHECK_EQ(new_children.size(), children().size());
-  return MultiwayCartesianJoin::Create(new_children);
-}
-
-void MultiwayCartesianJoin::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("");
-  container_child_fields->push_back(CastSharedPtrVector<OptimizerTreeBase>(operands_));
-}
-
-}  // namespace logical
-}  // namespace optimizer
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/logical/MultiwayCartesianJoin.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/logical/MultiwayCartesianJoin.hpp b/query_optimizer/logical/MultiwayCartesianJoin.hpp
deleted file mode 100644
index 6f9121d..0000000
--- a/query_optimizer/logical/MultiwayCartesianJoin.hpp
+++ /dev/null
@@ -1,113 +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_MULTIWAY_CARTESIAN_JOIN_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_MULTIWAY_CARTESIAN_JOIN_HPP_
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "query_optimizer/logical/Logical.hpp"
-#include "query_optimizer/logical/LogicalType.hpp"
-#include "query_optimizer/logical/Join.hpp"
-#include "utility/Macros.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-namespace optimizer {
-namespace logical {
-
-/** \addtogroup OptimizerLogical
- *  @{
- */
-
-class MultiwayCartesianJoin;
-typedef std::shared_ptr<const MultiwayCartesianJoin> MultiwayCartesianJoinPtr;
-
-/**
- * @brief Produces cartesian product of all input relations. This is used in the
- *        initial and intermediate logical plan only, and is replaced by other
- *        join operators in the final logical plan.
- */
-class MultiwayCartesianJoin : public Join {
- public:
-  LogicalType getLogicalType() const override {
-    return LogicalType::kMultiwayCartesianJoin;
-  }
-
-  std::string getName() const override { return "MultiwayCartesianJoin"; }
-
-  /**
-   * @return The input operators.
-   */
-  const std::vector<LogicalPtr>& operands() const { return operands_; }
-
-  LogicalPtr copyWithNewChildren(
-      const std::vector<LogicalPtr> &new_children) const override;
-
-  std::vector<expressions::AttributeReferencePtr> getOutputAttributes() const override;
-
-  std::vector<expressions::AttributeReferencePtr> getReferencedAttributes() const override {
-    return {};
-  }
-
-  /**
-   * @brief Creates a MultiwayCartesianJoin with \p operands as input operators.
-   *
-   * @param operands Input operators.
-   * @return An immutable MultiwayCartesianJoin.
-   */
-  static MultiwayCartesianJoinPtr Create(
-      const std::vector<LogicalPtr> &operands) {
-    DCHECK_GT(operands.size(), 1u);
-    return MultiwayCartesianJoinPtr(new MultiwayCartesianJoin(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 MultiwayCartesianJoin(const std::vector<LogicalPtr> &operands)
-      : operands_(operands) {
-    for (const LogicalPtr &operand : operands) {
-      addChild(operand);
-    }
-  }
-  std::vector<LogicalPtr> operands_;
-
-  DISALLOW_COPY_AND_ASSIGN(MultiwayCartesianJoin);
-};
-
-/** @} */
-
-}  // namespace logical
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_QUERY_OPTIMIZER_MULTIWAY_CARTESIAN_JOIN_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/logical/NestedLoopsJoin.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/logical/NestedLoopsJoin.hpp b/query_optimizer/logical/NestedLoopsJoin.hpp
deleted file mode 100644
index 5950e1d..0000000
--- a/query_optimizer/logical/NestedLoopsJoin.hpp
+++ /dev/null
@@ -1,154 +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_LOGICAL_NESTED_LOOPS_JOIN_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_LOGICAL_NESTED_LOOPS_JOIN_HPP_
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/AttributeReference.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 "query_optimizer/logical/BinaryJoin.hpp"
-#include "query_optimizer/logical/Logical.hpp"
-#include "query_optimizer/logical/LogicalType.hpp"
-#include "utility/Macros.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-namespace optimizer {
-namespace logical {
-
-/** \addtogroup OptimizerLogical
- *  @{
- */
-
-class NestedLoopsJoin;
-typedef std::shared_ptr<const NestedLoopsJoin> NestedLoopsJoinPtr;
-
-/**
- * @brief Logical nested loops join operator that joins two relations by using
- *        two nested loops.
- */
-class NestedLoopsJoin : public BinaryJoin {
- public:
-  LogicalType getLogicalType() const override {
-    return LogicalType::kNestedLoopsJoin;
-  }
-
-  std::string getName() const override { return "NestedLoopsJoin"; }
-
-  /**
-   * @return The join predicate.
-   */
-  const expressions::PredicatePtr& join_predicate() const {
-    return join_predicate_;
-  }
-
-  LogicalPtr copyWithNewChildren(
-      const std::vector<LogicalPtr> &new_children) const override {
-    DCHECK_EQ(new_children.size(), children().size());
-    return NestedLoopsJoin::Create(new_children[0],
-                                   new_children[1],
-                                   join_predicate_);
-  }
-
-  LogicalPtr copyWithNewInputExpressions(
-      const std::vector<expressions::ExpressionPtr> &input_expressions) const override {
-    DCHECK_EQ(1u, input_expressions.size());
-
-    expressions::PredicatePtr new_filter_predicate;
-    expressions::SomePredicate::MatchesWithConditionalCast(input_expressions[0],
-                                                           &new_filter_predicate);
-    DCHECK(new_filter_predicate != nullptr);
-
-    return Create(left(), right(), new_filter_predicate);
-  }
-
-  std::vector<expressions::AttributeReferencePtr> getReferencedAttributes() const override {
-    return join_predicate_->getReferencedAttributes();
-  }
-
-  /**
-   * @brief Creates a NestedLoopsJoin that joins \p left_operand and
-   *        \p right_operand based on \p join_predicate.
-   *
-   * @param left_operand The left input operator.
-   * @param right_operand The right input operator.
-   * @param join_predicate The join predicate. Can be NULL for a cross-product join.
-   * @return An immutable NestedLoopsJoin.
-   */
-  static NestedLoopsJoinPtr Create(
-      const LogicalPtr &left_operand,
-      const LogicalPtr &right_operand,
-      const expressions::PredicatePtr &join_predicate) {
-    if (join_predicate == nullptr) {
-      return NestedLoopsJoinPtr(new NestedLoopsJoin(left_operand,
-                                                    right_operand,
-                                                    expressions::PredicateLiteral::Create(true)));
-    } else {
-      return NestedLoopsJoinPtr(new NestedLoopsJoin(left_operand, right_operand, join_predicate));
-    }
-  }
-
- 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 {
-    BinaryJoin::getFieldStringItems(inline_field_names,
-                                    inline_field_values,
-                                    non_container_child_field_names,
-                                    non_container_child_fields,
-                                    container_child_field_names,
-                                    container_child_fields);
-    non_container_child_field_names->push_back("join_predicate");
-    non_container_child_fields->push_back(join_predicate_);
-  }
-
- private:
-  NestedLoopsJoin(const LogicalPtr &left_operand,
-                  const LogicalPtr &right_operand,
-                  const expressions::PredicatePtr &join_predicate)
-      : BinaryJoin(left_operand, right_operand),
-        join_predicate_(join_predicate) {
-    addInputExpression(join_predicate);
-  }
-
-  expressions::PredicatePtr join_predicate_;
-
-  DISALLOW_COPY_AND_ASSIGN(NestedLoopsJoin);
-};
-
-/** @} */
-
-}  // namespace logical
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_QUERY_OPTIMIZER_LOGICAL_NESTED_LOOPS_JOIN_HPP_ */



[31/51] [abbrv] [partial] incubator-quickstep git commit: remove c++ files

Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/parser/ParseAttributeDefinition.cpp
----------------------------------------------------------------------
diff --git a/parser/ParseAttributeDefinition.cpp b/parser/ParseAttributeDefinition.cpp
deleted file mode 100644
index ec6508b..0000000
--- a/parser/ParseAttributeDefinition.cpp
+++ /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.
- **/
-
-#include "parser/ParseAttributeDefinition.hpp"
-
-#include <string>
-#include <vector>
-
-#include "parser/ParseString.hpp"
-#include "types/Type.hpp"
-#include "utility/PtrList.hpp"
-
-namespace quickstep {
-
-ParseAttributeDefinition::ParseAttributeDefinition(const int line_number,
-                                                   const int column_number,
-                                                   ParseString *name,
-                                                   ParseDataType *data_type,
-                                                   PtrList<ParseColumnConstraint> *constraint_list)
-    : ParseTreeNode(line_number, column_number), name_(name), data_type_(data_type) {
-  if (constraint_list != nullptr) {
-    for (PtrList<ParseColumnConstraint>::const_iterator it = constraint_list->begin();
-         it != constraint_list->end();
-         ++it) {
-      it->applyTo(this);
-    }
-
-    delete constraint_list;
-  }
-}
-
-void ParseAttributeDefinition::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<const ParseTreeNode*> *non_container_child_fields,
-    std::vector<std::string> *container_child_field_names,
-    std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const {
-  inline_field_names->push_back("name");
-  inline_field_values->push_back(name_->value());
-  inline_field_names->push_back("type");
-  inline_field_values->push_back(data_type_->getType().getName());
-}
-
-void ParseColumnConstraintNull::applyTo(ParseAttributeDefinition *target) const {
-  target->data_type_->type_ = &(target->data_type_->type_->getNullableVersion());
-}
-
-void ParseColumnConstraintNull::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<const ParseTreeNode*> *non_container_child_fields,
-    std::vector<std::string> *container_child_field_names,
-    std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const {
-  inline_field_names->push_back("nullable");
-  inline_field_values->push_back("true");
-}
-
-void ParseColumnConstraintNotNull::applyTo(ParseAttributeDefinition *target) const {
-  target->data_type_->type_ = &(target->data_type_->type_->getNonNullableVersion());
-}
-
-void ParseColumnConstraintNotNull::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<const ParseTreeNode*> *non_container_child_fields,
-    std::vector<std::string> *container_child_field_names,
-    std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const {
-  inline_field_names->push_back("nullable");
-  inline_field_values->push_back("false");
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/parser/ParseAttributeDefinition.hpp
----------------------------------------------------------------------
diff --git a/parser/ParseAttributeDefinition.hpp b/parser/ParseAttributeDefinition.hpp
deleted file mode 100644
index 5c20d13..0000000
--- a/parser/ParseAttributeDefinition.hpp
+++ /dev/null
@@ -1,255 +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_PARSER_PARSE_ATTRIBUTE_DEFINITION_HPP_
-#define QUICKSTEP_PARSER_PARSE_ATTRIBUTE_DEFINITION_HPP_
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "parser/ParseString.hpp"
-#include "parser/ParseTreeNode.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-
-class ParseColumnConstraint;
-class Type;
-
-template <class T> class PtrList;
-
-/** \addtogroup Parser
- *  @{
- */
-
-/**
- * @brief Parsed representation of a data type.
- **/
-class ParseDataType {
- public:
-  /**
-   * @brief Constructor.
-   *
-   * @param type The Type of the data.
-   **/
-  explicit ParseDataType(const Type &type)
-      : type_(&type) {
-  }
-
-  /**
-   * @brief Get the type.
-   *
-   * @return The Type.
-   **/
-  const Type& getType() const {
-    return *type_;
-  }
-
- private:
-  // Use a pointer instead of a reference so that it may be modified by column
-  // constraints.
-  const Type *type_;
-
-  friend class ParseColumnConstraintNull;
-  friend class ParseColumnConstraintNotNull;
-
-  DISALLOW_COPY_AND_ASSIGN(ParseDataType);
-};
-
-/**
- * @brief Parsed representation of an attribute definition
- **/
-class ParseAttributeDefinition : public ParseTreeNode {
- public:
-  /**
-   * @brief Constructor
-   *
-   * @param line_number Line number of the first token of this node in the SQL statement.
-   * @param column_number Column number of the first token of this node in the SQL statement.
-   * @param name The attribute name.
-   * @param data_type The parsed data type (becomes owned by this
-   *        ParseAttributeDefinition).
-   * @param constraint_list An optional list of column constraints (may be NULL
-   *        if no constraints).
-   **/
-  ParseAttributeDefinition(const int line_number,
-                           const int column_number,
-                           ParseString *name,
-                           ParseDataType *data_type,
-                           PtrList<ParseColumnConstraint> *constraint_list);
-
-  /**
-   * @brief Destructor
-   **/
-  ~ParseAttributeDefinition() override {}
-
-  std::string getName() const override {
-    return "AttributeDefinition";
-  }
-
-  /**
-   * @brief Get the attribute name
-   *
-   * @return The attribute name
-   **/
-  const ParseString* name() const {
-    return name_.get();
-  }
-
-  /**
-   * @brief Get the parsed data type
-   *
-   * @return The data type
-   **/
-  const ParseDataType& data_type() const {
-    return *data_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<const ParseTreeNode*> *non_container_child_fields,
-      std::vector<std::string> *container_child_field_names,
-      std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const override;
-
- private:
-  std::unique_ptr<ParseString> name_;
-  std::unique_ptr<ParseDataType> data_type_;
-
-  friend class ParseColumnConstraintNull;
-  friend class ParseColumnConstraintNotNull;
-
-  DISALLOW_COPY_AND_ASSIGN(ParseAttributeDefinition);
-};
-
-/**
- * @brief A column constraint that can be applied to an attribute definition.
- **/
-class ParseColumnConstraint : public ParseTreeNode {
- public:
-  /**
-   * @brief Virtual destructor.
-   **/
-  ~ParseColumnConstraint() override {
-  }
-
-  /**
-   * @brief Apply this constraint to an attribute definition.
-   *
-   * @param target The attribute definition to modify with this constraint.
-   **/
-  virtual void applyTo(ParseAttributeDefinition *target) const = 0;
-
- protected:
-  ParseColumnConstraint(const int line_number, const int column_number)
-      : ParseTreeNode(line_number, column_number) {
-  }
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(ParseColumnConstraint);
-};
-
-/**
- * @brief A column constraint allowing NULL values.
- **/
-class ParseColumnConstraintNull: public ParseColumnConstraint {
- public:
-  /**
-   * @brief Constructor.
-   *
-   * @param line_number Line number of the first token of this node in the SQL statement.
-   * @param column_number Column number of the first token of this node in the SQL statement.
-   **/
-  ParseColumnConstraintNull(const int line_number, const int column_number)
-      : ParseColumnConstraint(line_number, column_number) {
-  }
-
-  /**
-   * @brief Destructor.
-   */
-  ~ParseColumnConstraintNull() override {
-  }
-
-  std::string getName() const override {
-    return "NullablityColumnConstraint";
-  }
-
-  void applyTo(ParseAttributeDefinition *target) const override;
-
- 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<const ParseTreeNode*> *non_container_child_fields,
-      std::vector<std::string> *container_child_field_names,
-      std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const override;
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(ParseColumnConstraintNull);
-};
-
-/**
- * @brief A column constraint disallowing NULL values.
- **/
-class ParseColumnConstraintNotNull: public ParseColumnConstraint {
- public:
-  /**
-   * @brief Constructor.
-   *
-   * @param line_number Line number of the first token of this node in the SQL statement.
-   * @param column_number Column number of the first token of this node in the SQL statement.
-   **/
-  ParseColumnConstraintNotNull(const int line_number, const int column_number)
-     : ParseColumnConstraint(line_number, column_number) {
-  }
-
-  /**
-   * @brief Destructor.
-   */
-  ~ParseColumnConstraintNotNull() override {
-  }
-
-  std::string getName() const override {
-    return "NullablityColumnConstraint";
-  }
-
-  void applyTo(ParseAttributeDefinition *target) const override;
-
- 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<const ParseTreeNode*> *non_container_child_fields,
-      std::vector<std::string> *container_child_field_names,
-      std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const override;
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(ParseColumnConstraintNotNull);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_PARSER_PARSE_ATTRIBUTE_DEFINITION_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/parser/ParseBasicExpressions.cpp
----------------------------------------------------------------------
diff --git a/parser/ParseBasicExpressions.cpp b/parser/ParseBasicExpressions.cpp
deleted file mode 100644
index b0b1247..0000000
--- a/parser/ParseBasicExpressions.cpp
+++ /dev/null
@@ -1,233 +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 "parser/ParseBasicExpressions.hpp"
-
-#include <string>
-#include <vector>
-
-#include "parser/ParseLiteralValue.hpp"
-#include "parser/ParseString.hpp"
-#include "types/operations/binary_operations/BinaryOperation.hpp"
-#include "types/operations/unary_operations/UnaryOperation.hpp"
-
-using std::string;
-
-namespace quickstep {
-
-void ParseScalarLiteral::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<const ParseTreeNode*> *non_container_child_fields,
-    std::vector<std::string> *container_child_field_names,
-    std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const {
-  non_container_child_field_names->push_back("");
-  non_container_child_fields->push_back(literal_value_.get());
-}
-
-string ParseAttribute::generateName() const {
-  string name;
-  if (rel_name_ != nullptr) {
-    name.append(rel_name_->value());
-    name.append(".");
-  }
-  name.append(attr_name_->value());
-  return name;
-}
-
-void ParseAttribute::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<const ParseTreeNode*> *non_container_child_fields,
-    std::vector<std::string> *container_child_field_names,
-    std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const {
-  inline_field_names->push_back("attribute_name");
-  inline_field_values->push_back(attr_name_->value());
-
-  if (rel_name_ != nullptr) {
-    inline_field_names->push_back("relation_name");
-    inline_field_values->push_back(rel_name_->value());
-  }
-}
-
-std::string ParseUnaryExpression::getName() const {
-  return op_.getName();
-}
-
-string ParseUnaryExpression::generateName() const {
-  string name(op_.getShortName());
-  name.append(operand_->generateName());
-  return name;
-}
-
-void ParseUnaryExpression::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<const ParseTreeNode*> *non_container_child_fields,
-    std::vector<std::string> *container_child_field_names,
-    std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const {
-  non_container_child_field_names->push_back("");
-  non_container_child_fields->push_back(operand_.get());
-}
-
-std::string ParseBinaryExpression::getName() const {
-  return op_.getName();
-}
-
-string ParseBinaryExpression::generateName() const {
-  string name("(");
-  name.append(left_operand_->generateName());
-  name.append(op_.getShortName());
-  name.append(right_operand_->generateName());
-  name.push_back(')');
-  return name;
-}
-
-void ParseBinaryExpression::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<const ParseTreeNode*> *non_container_child_fields,
-    std::vector<std::string> *container_child_field_names,
-    std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const  {
-  non_container_child_field_names->push_back("left_operand");
-  non_container_child_fields->push_back(left_operand_.get());
-
-  non_container_child_field_names->push_back("right_operand");
-  non_container_child_fields->push_back(right_operand_.get());
-}
-
-std::string ParseFunctionCall::generateName() const {
-  string name(name_->value());
-  name.push_back('(');
-  if (star_ != nullptr) {
-    name.push_back('*');
-  } else {
-    if (is_distinct_) {
-      name.append("DISTINCT ");
-    }
-    bool first = true;
-    for (const ParseExpression &argument : *arguments_) {
-      if (!first) {
-        name.append(", ");
-      } else {
-        first = false;
-      }
-      name.append(argument.generateName());
-    }
-  }
-  name.push_back(')');
-  return name;
-}
-
-void ParseFunctionCall::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<const ParseTreeNode*> *non_container_child_fields,
-    std::vector<std::string> *container_child_field_names,
-    std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const {
-  inline_field_names->push_back("name");
-  inline_field_values->push_back(name_->value());
-
-  if (is_distinct_) {
-    inline_field_names->push_back("is_distinct");
-    inline_field_values->push_back("true");
-  }
-
-  if (star_ != nullptr) {
-    inline_field_names->push_back("is_star");
-    inline_field_values->push_back("true");
-  } else {
-    for (const ParseExpression &argument : *arguments_) {
-      non_container_child_field_names->push_back("");
-      non_container_child_fields->push_back(&argument);
-    }
-
-    if (window_name_ != nullptr) {
-      inline_field_names->push_back("window_name");
-      inline_field_values->push_back(window_name_->value());
-    }
-
-    if (window_ != nullptr) {
-      non_container_child_field_names->push_back("window");
-      non_container_child_fields->push_back(window_.get());
-    }
-  }
-}
-
-std::string ParseExtractFunction::generateName() const {
-  std::string name;
-  name.append("EXTRACT(");
-  name.append(extract_field_->value());
-  name.append(" FROM ");
-  name.append(date_expression_->generateName());
-  name.push_back(')');
-  return name;
-}
-
-void ParseExtractFunction::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<const ParseTreeNode*> *non_container_child_fields,
-    std::vector<std::string> *container_child_field_names,
-    std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const {
-  inline_field_names->push_back("unit");
-  inline_field_values->push_back(extract_field_->value());
-
-  non_container_child_field_names->push_back("date_expression");
-  non_container_child_fields->push_back(date_expression_.get());
-}
-
-std::string ParseSubstringFunction::generateName() const {
-  std::string name;
-  name.append("SUBSTRING(");
-  name.append(operand_->generateName());
-  name.append(" FROM ");
-  name.append(std::to_string(start_position_));
-  if (length_ != kDefaultLength) {
-    name.append(" FOR ");
-    name.append(std::to_string(length_));
-  }
-  name.push_back(')');
-  return name;
-}
-
-void ParseSubstringFunction::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<const ParseTreeNode*> *non_container_child_fields,
-    std::vector<std::string> *container_child_field_names,
-    std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const {
-  inline_field_names->push_back("start_position");
-  inline_field_values->push_back(std::to_string(start_position_));
-
-  inline_field_names->push_back("length");
-  inline_field_values->push_back(std::to_string(length_));
-
-  non_container_child_field_names->push_back("operand");
-  non_container_child_fields->push_back(operand_.get());
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/parser/ParseBasicExpressions.hpp
----------------------------------------------------------------------
diff --git a/parser/ParseBasicExpressions.hpp b/parser/ParseBasicExpressions.hpp
deleted file mode 100644
index d8de669..0000000
--- a/parser/ParseBasicExpressions.hpp
+++ /dev/null
@@ -1,640 +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_PARSER_PARSE_BASIC_EXPRESSIONS_HPP_
-#define QUICKSTEP_PARSER_PARSE_BASIC_EXPRESSIONS_HPP_
-
-#include <cstddef>
-#include <limits>
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "parser/ParseExpression.hpp"
-#include "parser/ParseLiteralValue.hpp"
-#include "parser/ParseString.hpp"
-#include "parser/ParseTreeNode.hpp"
-#include "parser/ParseWindow.hpp"
-#include "utility/Macros.hpp"
-#include "utility/PtrList.hpp"
-
-namespace quickstep {
-
-class BinaryOperation;
-class UnaryOperation;
-
-/** \addtogroup Parser
- *  @{
- */
-
-/**
- * @brief The parsed representation of a literal value.
- **/
-class ParseScalarLiteral : public ParseExpression {
- public:
-  /**
-   * @brief Constructor.
-   *
-   * @param literal_value The parsed literal value to represent, which becomes
-   *        owned by this ParseScalarLiteral.
-   **/
-  explicit ParseScalarLiteral(ParseLiteralValue *literal_value)
-      : ParseExpression(literal_value->line_number(),
-                        literal_value->column_number()),
-                        literal_value_(literal_value) {
-  }
-
-  /**
-   * @brief Destructor.
-   */
-  ~ParseScalarLiteral() override {
-  }
-
-  /**
-   * @brief Gets the parsed literal value.
-   *
-   * @return The parsed literal value.
-   */
-  const ParseLiteralValue* literal_value() const {
-    return literal_value_.get();
-  }
-
-  ExpressionType getExpressionType() const override {
-    return kScalarLiteral;
-  }
-
-  std::string getName() const override {
-    return "Literal";
-  }
-
-  std::string generateName() const override {
-    return literal_value_->generateName();
-  }
-
- 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<const ParseTreeNode*> *non_container_child_fields,
-      std::vector<std::string> *container_child_field_names,
-      std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const override;
-
- private:
-  std::unique_ptr<ParseLiteralValue> literal_value_;
-
-  DISALLOW_COPY_AND_ASSIGN(ParseScalarLiteral);
-};
-
-
-/**
- * @brief The parsed representation of an attribute reference.
- **/
-class ParseAttribute : public ParseExpression {
- public:
-  /**
-   * @brief Constructor.
-   *
-   * @param line_number Line number of the first token of this node in the SQL statement.
-   * @param column_number Column number of the first token of this node in the SQL statement.
-   * @param attr_name The name of the attribute.
-   * @param rel_name An optional relation name to qualify the attribute name
-   *                 (by default, all relations in the FROM list will be searched for
-   *                 the attribute).
-   **/
-  ParseAttribute(const int line_number,
-                 const int column_number,
-                 ParseString *attr_name,
-                 ParseString *rel_name = nullptr)
-      : ParseExpression(line_number, column_number),
-        attr_name_(attr_name),
-        rel_name_(rel_name) {
-  }
-
-  /**
-   * @brief Destructor.
-   */
-  ~ParseAttribute() override {}
-
-  ExpressionType getExpressionType() const override {
-    return kAttribute;
-  }
-
-  std::string getName() const override {
-    return "AttributeReference";
-  }
-
-  /**
-   * @return Attribute name.
-   */
-  const ParseString* attr_name() const {
-    return attr_name_.get();
-  }
-
-  /**
-   * @return Relation name.
-   */
-  const ParseString* rel_name() const {
-    return rel_name_.get();
-  }
-
-  std::string generateName() const override;
-
- 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<const ParseTreeNode*> *non_container_child_fields,
-      std::vector<std::string> *container_child_field_names,
-      std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const override;
-
- private:
-  std::unique_ptr<ParseString> attr_name_, rel_name_;
-
-  DISALLOW_COPY_AND_ASSIGN(ParseAttribute);
-};
-
-
-/**
- * @brief The parsed representation of an unary operation applied to an expression.
- **/
-class ParseUnaryExpression : public ParseExpression {
- public:
-  /**
-   * @brief Constructor.
-   *
-   * @param line_number Line number of the first token of this node in the SQL statement.
-   * @param column_number Column number of the first token of this node in the SQL statement.
-   * @param op The UnaryOperation from the quickstep type system to apply.
-   * @param operand The parsed scalar representation of the unary operation's
-   *        argument, which becomes owned by this ParseScalarUnaryExpression.
-   **/
-  ParseUnaryExpression(const int line_number,
-                       const int column_number,
-                       const UnaryOperation &op,
-                       ParseExpression *operand)
-      : ParseExpression(line_number, column_number),
-        op_(op),
-        operand_(operand) {
-  }
-
-  /**
-   * @brief Destructor.
-   */
-  ~ParseUnaryExpression() override {
-  }
-
-  ExpressionType getExpressionType() const override {
-    return kUnaryExpression;
-  }
-
-  std::string getName() const override;
-
-  /**
-   * @return The unary operation.
-   */
-  const UnaryOperation& op() const {
-    return op_;
-  }
-
-  /**
-   * @return The operand expression.
-   */
-  const ParseExpression* operand() const {
-    return operand_.get();
-  }
-
-  std::string generateName() const override;
-
- 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<const ParseTreeNode*> *non_container_child_fields,
-      std::vector<std::string> *container_child_field_names,
-      std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const override;
-
- private:
-  const UnaryOperation &op_;
-  std::unique_ptr<ParseExpression> operand_;
-
-  DISALLOW_COPY_AND_ASSIGN(ParseUnaryExpression);
-};
-
-/**
- * @brief The parsed representation of a binary operation applied to two
- *        expressions.
- **/
-class ParseBinaryExpression : public ParseExpression {
- public:
-  /**
-   * @brief Constructor.
-   *
-   * @param line_number Line number of the binary operator token in the SQL statement.
-   * @param column_number Column number of the binary operator token in the SQL statement.
-   * @param op The BinaryOperation from the quickstep type system to apply.
-   * @param left_operand The parsed scalar representation of the binary
-   *        operation's left argument, which becomes owned by this
-   *        ParseScalarBinaryExpression.
-   * @param right_operand The parsed scalar representation of the binary
-   *        operation's right argument, which becomes owned by this
-   *        ParseScalarBinaryExpression.
-   **/
-  ParseBinaryExpression(const int line_number,
-                        const int column_number,
-                        const BinaryOperation &op,
-                        ParseExpression *left_operand,
-                        ParseExpression *right_operand)
-      : ParseExpression(line_number, column_number),
-        op_(op),
-        left_operand_(left_operand),
-        right_operand_(right_operand) {
-  }
-
-  /**
-   * @brief Destructor.
-   */
-  ~ParseBinaryExpression() override {
-  }
-
-  ExpressionType getExpressionType() const override {
-    return kBinaryExpression;
-  }
-
-  std::string getName() const override;
-
-  /**
-   * @return The binary operation.
-   */
-  const BinaryOperation& op() const {
-    return op_;
-  }
-
-  /**
-   * @return The left operand expression.
-   */
-  const ParseExpression* left_operand() const {
-    return left_operand_.get();
-  }
-
-  /**
-   * @return The right operand expression.
-   */
-  const ParseExpression* right_operand() const {
-    return right_operand_.get();
-  }
-
-  std::string generateName() const override;
-
- 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<const ParseTreeNode*> *non_container_child_fields,
-      std::vector<std::string> *container_child_field_names,
-      std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const override;
-
- private:
-  const BinaryOperation &op_;
-  std::unique_ptr<ParseExpression> left_operand_;
-  std::unique_ptr<ParseExpression> right_operand_;
-
-  DISALLOW_COPY_AND_ASSIGN(ParseBinaryExpression);
-};
-
-/**
- * @brief The parsed representation of '*' as a function argument.
- */
-class ParseStar : public ParseTreeNode {
- public:
-  ParseStar(const int line_number, const int column_number)
-      : ParseTreeNode(line_number, column_number) {}
-
-  std::string getName() const override {
-    return "Star";
-  }
-
- 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<const ParseTreeNode*> *non_container_child_fields,
-      std::vector<std::string> *container_child_field_names,
-      std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const override {}
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(ParseStar);
-};
-
-/**
- * @brief Parsed function call in the form of a name with a list of arguments in parentheses.
- */
-class ParseFunctionCall : public ParseExpression {
- public:
-  /**
-   * @brief Constructor.
-   * @note Takes ownership of all pointers.
-   *
-   * @param line_number The line number of the first token of the function call.
-   * @param column_number The column number of the first token of the first call.
-   * @param is_distinct Whether this function call contains the DISTINCT keyword.
-   * @param name The function name.
-   * @param arguments The function argument list.
-   */
-  ParseFunctionCall(const int line_number,
-                    const int column_number,
-                    const bool is_distinct,
-                    ParseString *name,
-                    PtrList<ParseExpression> *arguments)
-      : ParseExpression(line_number, column_number),
-        is_distinct_(is_distinct),
-        name_(name),
-        arguments_(arguments) {
-  }
-
-  /**
-   * @brief Constructor for a function call that has "*" as the argument.
-   * @note Takes ownership of all pointers.
-   *
-   * @param line_number The line number of the first token of the function call.
-   * @param column_number The column number of the first token of the function call.
-   * @param name The function name.
-   * @param star The parsed star.
-   */
-  ParseFunctionCall(const int line_number, const int column_number, ParseString *name, ParseStar *star)
-      : ParseExpression(line_number, column_number),
-        is_distinct_(false),
-        name_(name),
-        star_(star) {
-  }
-
-  /**
-   * @brief Destructor.
-   */
-  ~ParseFunctionCall() override {
-  }
-
-  ExpressionType getExpressionType() const override {
-    return kFunctionCall;
-  }
-
-  std::string getName() const override {
-    return "FunctionCall";
-  }
-
-  /**
-   * @return Whether this function call contains the DISTINCT keyword.
-   */
-  bool is_distinct() const {
-    return is_distinct_;
-  }
-
-  /**
-   * @return The function name.
-   */
-  const ParseString* name() const {
-    return name_.get();
-  }
-
-  /**
-   * @return The argument list.
-   */
-  const PtrList<ParseExpression>* arguments() const {
-    return arguments_.get();
-  }
-
-  /**
-   * @return The parsed star.
-   */
-  const ParseStar* star() const {
-    return star_.get();
-  }
-
-  /**
-   * @return The window name.
-   **/
-  const ParseString* window_name() const {
-    return window_name_.get();
-  }
-
-  /**
-   * @return The window.
-   **/
-  const ParseWindow* window() const {
-    return window_.get();
-  }
-
-  /**
-   * @brief Check if this function is a window aggregation function
-   *
-   * @return True if this function is a window aggregation function; false
-   *         otherwise.
-   **/
-  bool isWindow() const {
-    return window_name_ != nullptr || window_ != nullptr;
-  }
-
-  /**
-   * @brief Set the window name.
-   * @param window_name The window name.
-   **/
-  void setWindowName(ParseString *window_name) {
-    window_name_.reset(window_name);
-  }
-
-  /**
-   * @brief Set the window.
-   * @param window The window.
-   **/
-  void setWindow(ParseWindow *window) {
-    window_.reset(window);
-  }
-
-  std::string generateName() const override;
-
- 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<const ParseTreeNode*> *non_container_child_fields,
-      std::vector<std::string> *container_child_field_names,
-      std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const override;
-
- private:
-  const bool is_distinct_;
-  std::unique_ptr<ParseString> name_;
-  // Either <arguments_> or <star_> is NULL.
-  std::unique_ptr<PtrList<ParseExpression>> arguments_;
-  std::unique_ptr<ParseStar> star_;
-  // A window aggregation function should have either <window_name_> or <window_> but not both.
-  // <window_name_> and <window_> will both be NULL if it is not a window function.
-  std::unique_ptr<ParseString> window_name_;
-  std::unique_ptr<ParseWindow> window_;
-
-  DISALLOW_COPY_AND_ASSIGN(ParseFunctionCall);
-};
-
-
-/**
- * @brief Parsed representation of EXTRACT(unit FROM date).
- */
-class ParseExtractFunction : public ParseExpression {
- public:
-  /**
-   * @brief Constructor.
-   *
-   * @param line_number The line number of the token "extract" in the statement.
-   * @param column_number The column number of the token "extract in the statement.
-   * @param extract_field The field to extract.
-   * @param source_expression The expression to extract a field from.
-   */
-  ParseExtractFunction(const int line_number,
-                       const int column_number,
-                       ParseString *extract_field,
-                       ParseExpression *date_expression)
-      : ParseExpression(line_number, column_number),
-        extract_field_(extract_field),
-        date_expression_(date_expression) {
-  }
-
-  ExpressionType getExpressionType() const override {
-    return kExtract;
-  }
-
-  std::string getName() const override {
-    return "Extract";
-  }
-
-  /**
-   * @return The field to extract.
-   */
-  const ParseString* extract_field() const {
-    return extract_field_.get();
-  }
-
-  /**
-   * @return The expression to extract a field from.
-   */
-  const ParseExpression* date_expression() const {
-    return date_expression_.get();
-  }
-
-  std::string generateName() const override;
-
- 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<const ParseTreeNode*> *non_container_child_fields,
-      std::vector<std::string> *container_child_field_names,
-      std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const override;
-
- private:
-  std::unique_ptr<ParseString> extract_field_;
-  std::unique_ptr<ParseExpression> date_expression_;
-
-  DISALLOW_COPY_AND_ASSIGN(ParseExtractFunction);
-};
-
-
-/**
- * @brief Parsed representation of the substring function.
- */
-class ParseSubstringFunction : public ParseExpression {
- public:
-  static constexpr std::size_t kDefaultLength = std::numeric_limits<std::size_t>::max();
-
-  /**
-   * @brief Constructor.
-   *
-   * @param line_number The line number of the first token of the function call.
-   * @param column_number The column number of the first token of the function call.
-   * @param operand The operand of the substring.
-   * @param start_position The 1-based starting position of the substring.
-   * @param length Optional substring length.
-   */
-  ParseSubstringFunction(const int line_number,
-                         const int column_number,
-                         ParseExpression *operand,
-                         const std::size_t start_position,
-                         const std::size_t length = kDefaultLength)
-      : ParseExpression(line_number, column_number),
-        operand_(operand),
-        start_position_(start_position),
-        length_(length) {}
-
-  ExpressionType getExpressionType() const override {
-    return kSubstring;
-  }
-
-  std::string getName() const override {
-    return "Substring";
-  }
-
-  /**
-   * @return The operand of the substring.
-   */
-  const ParseExpression* operand() const {
-    return operand_.get();
-  }
-
-  /**
-   * @return The 1-based starting position of the substring.
-   */
-  std::size_t start_position() const {
-    return start_position_;
-  }
-
-  /**
-   * @return Then substring length.
-   */
-  std::size_t length() const {
-    return length_;
-  }
-
-  std::string generateName() const override;
-
- 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<const ParseTreeNode*> *non_container_child_fields,
-      std::vector<std::string> *container_child_field_names,
-      std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const override;
-
- private:
-  std::unique_ptr<ParseExpression> operand_;
-  const std::size_t start_position_;
-  const std::size_t length_;
-
-  DISALLOW_COPY_AND_ASSIGN(ParseSubstringFunction);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_PARSER_PARSE_BASIC_EXPRESSIONS_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/parser/ParseBlockProperties.cpp
----------------------------------------------------------------------
diff --git a/parser/ParseBlockProperties.cpp b/parser/ParseBlockProperties.cpp
deleted file mode 100644
index 31c30a0..0000000
--- a/parser/ParseBlockProperties.cpp
+++ /dev/null
@@ -1,31 +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 "parser/ParseBlockProperties.hpp"
-
-#include <string>
-
-namespace quickstep {
-
-const std::string ParseBlockProperties::kKeyBlockSizeMB = "blocksizemb";
-const std::string ParseBlockProperties::kKeyCompress = "compress";
-const std::string ParseBlockProperties::kKeySort = "sort";
-const std::string ParseBlockProperties::kKeyType = "type";
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/parser/ParseBlockProperties.hpp
----------------------------------------------------------------------
diff --git a/parser/ParseBlockProperties.hpp b/parser/ParseBlockProperties.hpp
deleted file mode 100644
index ce0cd92..0000000
--- a/parser/ParseBlockProperties.hpp
+++ /dev/null
@@ -1,256 +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_PARSER_PARSE_BLOCK_PROPERTIES_HPP_
-#define QUICKSTEP_PARSER_PARSE_BLOCK_PROPERTIES_HPP_
-
-#include <cstdint>
-#include <memory>
-#include <set>
-#include <string>
-#include <vector>
-
-#include "parser/ParseKeyValue.hpp"
-#include "parser/ParseString.hpp"
-#include "parser/ParseTreeNode.hpp"
-#include "utility/Macros.hpp"
-#include "utility/PtrList.hpp"
-#include "utility/StringUtil.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-/** \addtogroup Parser
- *  @{
- */
-
-/**
- * @brief Encapsulates the BlockProperties key-value list. Makes the job
- *        of resolving BlockProperties easy.
- */
-class ParseBlockProperties : public ParseTreeNode {
-  // Valid key names for the BlockProperties.
-  static const std::string kKeyBlockSizeMB;
-  static const std::string kKeyCompress;
-  static const std::string kKeySort;
-  static const std::string kKeyType;
-
- public:
-  /**
-   * @brief Constructor.
-   *
-   * @param line_number Beginning line number.
-   * @param column_number Beginning column number.
-   * @param properties PtrList to the KeyValues.
-   */
-  ParseBlockProperties(int line_number,
-                       int column_number,
-                       PtrList<ParseKeyValue> *properties)
-      : ParseTreeNode(line_number, column_number),
-        properties_(properties) { }
-
-  /**
-   * @return The name of this entity.
-   */
-  std::string getName() const override {
-    return "BlockProperties";
-  }
-
-  /**
-   * @brief Returns the first repeated key contained in the key-value list.
-   * @details A repeated key is any 2 key-values with case-insensitive matching
-   *          key names.
-   *
-   * @return A pointer to the first repeated key-value or nullptr if there
-   *         are no repetitions.
-   */
-  const ParseKeyValue* getFirstRepeatedKeyValue() const {
-    std::set<std::string> seen_keys;
-    for (const ParseKeyValue &key_value : *properties_) {
-      std::string lower_key = ToLower(key_value.key()->value());
-      std::set<std::string>::iterator itr = seen_keys.find(lower_key);
-      if (itr != seen_keys.end()) {
-        return &key_value;
-      }
-      seen_keys.insert(lower_key);
-    }
-    return nullptr;
-  }
-
-  /**
-   * @brief Returns the first invalid key contained in the key-value list.
-   * @details An invalid key-value is a key-value with a key whose case-insensitive
-   *          string does not match one of the valid key names.
-   *
-   * @return A pointer to the first invalid key-value or nullptr if there none.
-   */
-  const ParseKeyValue* getFirstInvalidKeyValue() const {
-    std::set<std::string> valid_names({kKeyCompress,
-        kKeyType, kKeySort, kKeyBlockSizeMB});
-    for (const ParseKeyValue &key_value : *properties_) {
-      std::string lower_key = ToLower(key_value.key()->value());
-      std::set<std::string>::iterator itr = valid_names.find(lower_key);
-      if (itr == valid_names.end()) {
-        return &key_value;
-      }
-    }
-    return nullptr;
-  }
-
-  /**
-   * @brief Gets the ParseString value of the type property.
-   *
-   * @return ParseString value of the type property or nullptr if the type
-   *         was incorrect ParseKeyValue type or not specified.
-   */
-  const ParseString* getType() const {
-    const ParseKeyValue *type_key_value = getKeyValueByName(kKeyType);
-    if (type_key_value == nullptr) {
-      return nullptr;
-    }
-    if (type_key_value->getKeyValueType() !=
-        ParseKeyValue::KeyValueType::kStringString) {
-      return nullptr;
-    }
-    return static_cast<const ParseKeyStringValue*>(type_key_value)->value();
-  }
-
-  /**
-   * @brief Gets the ParseString value of the sort property.
-   *
-   * @return ParseString value of the sort property or nullptr if the type
-   *         was not a ParseKeyStringValue or was not specified.
-   */
-  const ParseString* getSort() const {
-    const ParseKeyValue *sort_key_value = getKeyValueByName(kKeySort);
-    if (sort_key_value == nullptr) {
-      return nullptr;
-    }
-    if (sort_key_value->getKeyValueType() !=
-        ParseKeyValue::KeyValueType::kStringString) {
-      return nullptr;
-    }
-    return static_cast<const ParseKeyStringValue*>(sort_key_value)->value();
-  }
-
-  /**
-   * @brief Get the list of compressed column names.
-   * @note Check compressAll() first to see if all columns are to be compressed.
-   *
-   * @return A list of column names to compress.
-   */
-  const PtrList<ParseString>* getCompressed() const {
-    const ParseKeyValue *compress_key_value = getKeyValueByName(kKeyCompress);
-    if (compress_key_value == nullptr) {
-      return nullptr;
-    }
-    if (compress_key_value->getKeyValueType() !=
-        ParseKeyValue::KeyValueType::kStringStringList) {
-      return nullptr;
-    }
-    return static_cast<const ParseKeyStringList*>(compress_key_value)->value();
-  }
-
-  /**
-   * @brief True if the user specified to compress all columns.
-   */
-  bool compressAll() const {
-    const ParseKeyValue *compress_key_value = getKeyValueByName(kKeyCompress);
-    if (compress_key_value == nullptr) {
-      return false;
-    }
-    if (compress_key_value->getKeyValueType() !=
-        ParseKeyValue::KeyValueType::kStringString) {
-      return false;
-    }
-    // The StringString value from the parser should always be, 'ALL'.
-    DCHECK(static_cast<const ParseKeyStringValue*>(compress_key_value)
-        ->value()->value().compare("ALL") == 0)
-            << "BlockProperties got an invalid COMPRESS value.";
-    return true;
-  }
-
-  /**
-   * @return Pointer to the blocksize property, nullptr if not specified.
-   */
-  const ParseKeyValue* getBlockSizeMb() const {
-    return getKeyValueByName(kKeyBlockSizeMB);
-  }
-
-  /**
-   * @return the blocksizemb property or -1 if not specified or not an int.
-   */
-  std::int64_t getBlockSizeMbValue() const {
-    const ParseKeyValue *size_key_value = getKeyValueByName(kKeyBlockSizeMB);
-    if (size_key_value == nullptr) {
-      return -1;
-    }
-    if (size_key_value->getKeyValueType() !=
-        ParseKeyValue::KeyValueType::kStringInteger) {
-      return -1;
-    }
-    std::int64_t numeric_value =
-        static_cast<const ParseKeyIntegerValue*>(size_key_value)->value()->long_value();
-    return numeric_value;
-  }
-
-  /**
-   * @return True if the user specified the size property. Note that returning
-   *         true does not mean the property was valid.
-   */
-  bool hasBlockSizeMb() const {
-    return getKeyValueByName(kKeyBlockSizeMB) != nullptr;
-  }
-
- 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<const ParseTreeNode*> *non_container_child_fields,
-      std::vector<std::string> *container_child_field_names,
-      std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const override {
-    for (const ParseKeyValue &block_property : *properties_) {
-      non_container_child_field_names->push_back("block_property");
-      non_container_child_fields->push_back(&block_property);
-    }
-  }
-
- private:
-  const ParseKeyValue* getKeyValueByName(const std::string &name) const {
-    // Get the first occurance of this name.
-    for (const ParseKeyValue &key_value : *properties_) {
-      if (ToLower(key_value.key()->value()).compare(name) == 0) {
-        return &key_value;
-      }
-    }
-    return nullptr;
-  }
-
-  std::unique_ptr<PtrList<ParseKeyValue> > properties_;
-
-  DISALLOW_COPY_AND_ASSIGN(ParseBlockProperties);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  /* QUICKSTEP_PARSER_PARSE_BLOCK_PROPERTIES_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/parser/ParseCaseExpressions.cpp
----------------------------------------------------------------------
diff --git a/parser/ParseCaseExpressions.cpp b/parser/ParseCaseExpressions.cpp
deleted file mode 100644
index 47f2a33..0000000
--- a/parser/ParseCaseExpressions.cpp
+++ /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.
- **/
-
-#include "parser/ParseCaseExpressions.hpp"
-
-#include <memory>
-#include <sstream>
-#include <string>
-#include <vector>
-
-#include "parser/ParseExpression.hpp"
-#include "parser/ParsePredicate.hpp"
-#include "parser/ParseTreeNode.hpp"
-
-namespace quickstep {
-
-void ParseSimpleWhenClause::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<const ParseTreeNode*> *non_container_child_fields,
-    std::vector<std::string> *container_child_field_names,
-    std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const {
-  non_container_child_field_names->push_back("condition_operand");
-  non_container_child_fields->push_back(condition_operand_.get());
-
-  non_container_child_field_names->push_back("result_expression");
-  non_container_child_fields->push_back(result_expression_.get());
-}
-
-void ParseSearchedWhenClause::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<const ParseTreeNode*> *non_container_child_fields,
-    std::vector<std::string> *container_child_field_names,
-    std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const {
-  non_container_child_field_names->push_back("condition_predicate");
-  non_container_child_fields->push_back(condition_predicate_.get());
-
-  non_container_child_field_names->push_back("result_expression");
-  non_container_child_fields->push_back(result_expression_.get());
-}
-
-std::string ParseSimpleCaseExpression::generateName() const {
-  std::ostringstream out;
-  out << "CASE " << case_operand_->generateName();
-  for (const ParseSimpleWhenClause &when_clause : *when_clauses_) {
-    out << " WHEN " << when_clause.condition_operand()->generateName()
-        << " THEN " << when_clause.result_expression()->generateName();
-  }
-  if (else_result_expression_ != nullptr) {
-    out << " ELSE " << else_result_expression_->generateName();
-  }
-  out << " END";
-  return out.str();
-}
-
-void ParseSimpleCaseExpression::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<const ParseTreeNode*> *non_container_child_fields,
-    std::vector<std::string> *container_child_field_names,
-    std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const {
-  non_container_child_field_names->push_back("case_operand");
-  non_container_child_fields->push_back(case_operand_.get());
-
-  container_child_field_names->push_back("when_clauses");
-  container_child_fields->emplace_back();
-  for (const ParseSimpleWhenClause &when_clause : *when_clauses_) {
-    container_child_fields->back().push_back(&when_clause);
-  }
-
-  if (else_result_expression_ != nullptr) {
-    non_container_child_field_names->push_back("else_result_expression");
-    non_container_child_fields->push_back(else_result_expression_.get());
-  }
-}
-
-std::string ParseSearchedCaseExpression::generateName() const {
-  std::ostringstream out;
-  out << "CASE";
-  for (const ParseSearchedWhenClause &when_clause : *when_clauses_) {
-    // TODO(jianqiao): implement generateName() for Predicate.
-    out << " WHEN " << when_clause.condition_predicate()->getShortString()
-        << " THEN " << when_clause.result_expression()->generateName();
-  }
-  if (else_result_expression_ != nullptr) {
-    out << " ELSE " << else_result_expression_->generateName();
-  }
-  out << " END";
-  return out.str();
-}
-
-void ParseSearchedCaseExpression::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<const ParseTreeNode*> *non_container_child_fields,
-    std::vector<std::string> *container_child_field_names,
-    std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const {
-  container_child_field_names->push_back("when_clauses");
-  container_child_fields->emplace_back();
-  for (const ParseSearchedWhenClause &when_clause : *when_clauses_) {
-    container_child_fields->back().push_back(&when_clause);
-  }
-
-  if (else_result_expression_ != nullptr) {
-    non_container_child_field_names->push_back("else_result_expression");
-    non_container_child_fields->push_back(else_result_expression_.get());
-  }
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/parser/ParseCaseExpressions.hpp
----------------------------------------------------------------------
diff --git a/parser/ParseCaseExpressions.hpp b/parser/ParseCaseExpressions.hpp
deleted file mode 100644
index 6bc0b00..0000000
--- a/parser/ParseCaseExpressions.hpp
+++ /dev/null
@@ -1,315 +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_PARSER_PARSE_CASE_EXPRESSIONS_HPP_
-#define QUICKSTEP_PARSER_PARSE_CASE_EXPRESSIONS_HPP_
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "parser/ParseExpression.hpp"
-#include "parser/ParsePredicate.hpp"
-#include "parser/ParseTreeNode.hpp"
-#include "utility/Macros.hpp"
-#include "utility/PtrVector.hpp"
-
-namespace quickstep {
-
-/** \addtogroup Parser
- *  @{
- */
-
-/**
- * @brief The parsed representation of a WHEN clause in a simple CASE
- *        expression (WHEN <condition operand> THEN <result expression>).
- */
-class ParseSimpleWhenClause : public ParseTreeNode {
- public:
-  /**
-   * @brief Constructor. Takes ownership of all pointers.
-   *
-   * @param line_number The line number of "WHEN" in the SQL statement.
-   * @param column_number The column number of "WHEN" in the SQL statement.
-   * @param check_operand The condition operand to be compared with the
-   *                      CASE operand (not in this class) of the CASE
-   *                      expression.
-   * @param result_expression The result expression for this condition.
-   */
-  ParseSimpleWhenClause(int line_number,
-                        int column_number,
-                        ParseExpression *condition_operand,
-                        ParseExpression *result_expression)
-      : ParseTreeNode(line_number, column_number),
-        condition_operand_(condition_operand),
-        result_expression_(result_expression) {
-  }
-
-  std::string getName() const override {
-    return "SimpleWhenClause";
-  }
-
-  /**
-   * @return The condition operand.
-   */
-  const ParseExpression* condition_operand() const {
-    return condition_operand_.get();
-  }
-
-  /**
-   * @return The result expression for this condition.
-   */
-  const ParseExpression* result_expression() const {
-    return result_expression_.get();
-  }
-
- 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<const ParseTreeNode*> *non_container_child_fields,
-      std::vector<std::string> *container_child_field_names,
-      std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const override;
-
- private:
-  std::unique_ptr<ParseExpression> condition_operand_;
-  std::unique_ptr<ParseExpression> result_expression_;
-
-  DISALLOW_COPY_AND_ASSIGN(ParseSimpleWhenClause);
-};
-
-/**
- * @brief The parsed representation of a WHEN clause in a searched CASE
- *        expression (WHEN <condition predicate> THEN <result expression>).
- *
- */
-class ParseSearchedWhenClause : public ParseTreeNode {
- public:
-  /**
-   * @brief Constructor. Takes ownership of all pointers.
-   *
-   * @param line_number The line number of "WHEN" in the SQL statement.
-   * @param column_number The column number of "WHEN" in the SQL statement.
-   * @param condition_predicate The condition predicate.
-   * @param result_expression The result expression for this condition.
-   */
-  ParseSearchedWhenClause(int line_number,
-                          int column_number,
-                          ParsePredicate *condition_predicate,
-                          ParseExpression *result_expression)
-      : ParseTreeNode(line_number, column_number),
-        condition_predicate_(condition_predicate),
-        result_expression_(result_expression) {
-  }
-
-  std::string getName() const override {
-    return "SearchedWhenClause";
-  }
-
-  /**
-   * @return The condition predicate.
-   */
-  const ParsePredicate* condition_predicate() const {
-    return condition_predicate_.get();
-  }
-
-  /**
-   * @return The result expression.
-   */
-  const ParseExpression* result_expression() const {
-    return result_expression_.get();
-  }
-
- 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<const ParseTreeNode*> *non_container_child_fields,
-      std::vector<std::string> *container_child_field_names,
-      std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const override;
-
- private:
-  std::unique_ptr<ParsePredicate> condition_predicate_;
-  std::unique_ptr<ParseExpression> result_expression_;
-
-  DISALLOW_COPY_AND_ASSIGN(ParseSearchedWhenClause);
-};
-
-/**
- * @brief The parsed representation of a simple CASE expression:
- *           CASE <case operand>
- *               WHEN <condition_operand> THEN <result_expression>
- *               [...n]
- *               [ELSE <else_result_expression>]
- *           END
- *        It returns the <result_expression> of the first <case operand> = <when_operand>
- *        that evaluates to true; if none is found and <else_result_expression> exists,
- *        returns <else_result_expression>; otherwise, returns NULL.
- **/
-class ParseSimpleCaseExpression : public ParseExpression {
- public:
-  /**
-   * @brief Constructor. Takes ownership of all pointers.
-   *
-   * @param line_number The line number of "CASE" in the SQL statement.
-   * @param column_number The column number of "CASE" in the SQL statement.
-   * @param case_operand The CASE operand.
-   * @param when_clauses A vector of WHEN clauses, each having a check operand to
-   *                     be compared with the CASE operand and a result expression
-   *                     to be evaluated if the condition is satisfied.
-   * @param else_result_expression Optional ELSE result expression.
-   */
-  ParseSimpleCaseExpression(int line_number,
-                            int column_number,
-                            ParseExpression *case_operand,
-                            PtrVector<ParseSimpleWhenClause> *when_clauses,
-                            ParseExpression *else_result_expression)
-      : ParseExpression(line_number, column_number),
-        case_operand_(case_operand),
-        when_clauses_(when_clauses),
-        else_result_expression_(else_result_expression) {
-  }
-
-  std::string getName() const override {
-    return "SimpleCaseExpression";
-  }
-
-  ExpressionType getExpressionType() const override {
-    return kSimpleCaseExpression;
-  }
-
-  /**
-   * @return The CASE operand.
-   */
-  const ParseExpression* case_operand() const {
-    return case_operand_.get();
-  }
-
-  /**
-   * @return The vector of WHEN clauses.
-   */
-  const PtrVector<ParseSimpleWhenClause>* when_clauses() const {
-    return when_clauses_.get();
-  }
-
-  /**
-   * @return The ELSE result expression. Can be NULL.
-   */
-  const ParseExpression* else_result_expression() const {
-    return else_result_expression_.get();
-  }
-
-  std::string generateName() const override;
-
- 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<const ParseTreeNode*> *non_container_child_fields,
-      std::vector<std::string> *container_child_field_names,
-      std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const override;
-
- private:
-  std::unique_ptr<ParseExpression> case_operand_;
-  std::unique_ptr<PtrVector<ParseSimpleWhenClause>> when_clauses_;
-  std::unique_ptr<ParseExpression> else_result_expression_;
-
-  DISALLOW_COPY_AND_ASSIGN(ParseSimpleCaseExpression);
-};
-
-/**
- * @brief The parsed representation of a searched CASE expression:
- *           CASE
- *               WHEN <condition_predicate> THEN <result_expression>
- *               [...n]
- *               [ELSE <else_result_expression>]
- *           END
- *        It returns the <result_expression> of the first <condition_predicate>
- *        that evaluates to true; if none is found and <else_result_expression> exists,
- *        returns <else_result_expression>; otherwise, returns NULL.
- */
-class ParseSearchedCaseExpression : public ParseExpression {
- public:
-  /**
-   * @brief Constructor. Takes ownership of all pointers.
-   *
-   * @param line_number The line number of "CASE" in the SQL statement.
-   * @param column_number The column number of "CASE" in the SQL statement.
-   * @param when_clauses A vector of WHEN clauses, each having a predicate
-   *                     and a result expression to be evaluate if
-   *                     the predicate evaluates to true.
-   * @param else_result_expression Optional ELSE result expression.
-   */
-  ParseSearchedCaseExpression(int line_number,
-                              int column_number,
-                              PtrVector<ParseSearchedWhenClause> *when_clauses,
-                              ParseExpression *else_result_expression)
-      : ParseExpression(line_number, column_number),
-        when_clauses_(when_clauses),
-        else_result_expression_(else_result_expression) {
-  }
-
-  std::string getName() const override {
-    return "SearchedCaseExpression";
-  }
-
-  ExpressionType getExpressionType() const override {
-    return kSearchedCaseExpression;
-  }
-
-  /**
-   * @return The vector of WHEN clauses.
-   */
-  const PtrVector<ParseSearchedWhenClause>* when_clauses() const {
-    return when_clauses_.get();
-  }
-
-  /**
-   * @return The ELSE result expression. Can be NULL.
-   */
-  const ParseExpression* else_result_expression() const {
-    return else_result_expression_.get();
-  }
-
-  std::string generateName() const override;
-
- 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<const ParseTreeNode*> *non_container_child_fields,
-      std::vector<std::string> *container_child_field_names,
-      std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const override;
-
- private:
-  std::unique_ptr<PtrVector<ParseSearchedWhenClause>> when_clauses_;
-  std::unique_ptr<ParseExpression> else_result_expression_;
-
-  DISALLOW_COPY_AND_ASSIGN(ParseSearchedCaseExpression);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_PARSER_PARSE_CASE_EXPRESSIONS_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/parser/ParseExpression.hpp
----------------------------------------------------------------------
diff --git a/parser/ParseExpression.hpp b/parser/ParseExpression.hpp
deleted file mode 100644
index 1b9ade4..0000000
--- a/parser/ParseExpression.hpp
+++ /dev/null
@@ -1,82 +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_PARSER_PARSE_EXPRESSION_HPP_
-#define QUICKSTEP_PARSER_PARSE_EXPRESSION_HPP_
-
-#include <string>
-
-#include "parser/ParseTreeNode.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-
-/** \addtogroup Parser
- *  @{
- */
-
-/**
- * @brief The parsed representation of an expression.
- **/
-class ParseExpression : public ParseTreeNode {
- public:
-  enum ExpressionType {
-    kAttribute,
-    kBinaryExpression,
-    kExtract,
-    kFunctionCall,
-    kScalarLiteral,
-    kSearchedCaseExpression,
-    kSimpleCaseExpression,
-    kSubqueryExpression,
-    kSubstring,
-    kUnaryExpression,
-  };
-
-  /**
-   * @brief Virtual destructor.
-   **/
-  ~ParseExpression() override {
-  }
-
-  /**
-   * @return The expression type.
-   */
-  virtual ExpressionType getExpressionType() const = 0;
-
-  /**
-   * @brief Get a human-readable representation of this expression.
-   *
-   * @return The human-readable form of this expression.
-   **/
-  virtual std::string generateName() const = 0;
-
- protected:
-  ParseExpression(const int line_number, const int column_number)
-      : ParseTreeNode(line_number, column_number) {
-  }
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(ParseExpression);
-};
-
-
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_PARSER_PARSE_EXPRESSION_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/parser/ParseGeneratorTableReference.cpp
----------------------------------------------------------------------
diff --git a/parser/ParseGeneratorTableReference.cpp b/parser/ParseGeneratorTableReference.cpp
deleted file mode 100644
index d8f5a48..0000000
--- a/parser/ParseGeneratorTableReference.cpp
+++ /dev/null
@@ -1,40 +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 "parser/ParseGeneratorTableReference.hpp"
-
-#include <string>
-#include <vector>
-
-namespace quickstep {
-
-class ParseTreeNode;
-
-void ParseGeneratorTableReference::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<const ParseTreeNode*> *non_container_child_fields,
-    std::vector<std::string> *container_child_field_names,
-    std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const {
-  non_container_child_field_names->push_back("");
-  non_container_child_fields->push_back(generator_function_.get());
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/parser/ParseGeneratorTableReference.hpp
----------------------------------------------------------------------
diff --git a/parser/ParseGeneratorTableReference.hpp b/parser/ParseGeneratorTableReference.hpp
deleted file mode 100644
index 4604b87..0000000
--- a/parser/ParseGeneratorTableReference.hpp
+++ /dev/null
@@ -1,93 +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_PARSER_PARSE_GENERATOR_TABLE_REFERENCE_HPP_
-#define QUICKSTEP_PARSER_PARSE_GENERATOR_TABLE_REFERENCE_HPP_
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "parser/ParseBasicExpressions.hpp"
-#include "parser/ParseTableReference.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-
-class ParseTreeNode;
-
-/** \addtogroup Parser
- *  @{
- */
-
-/**
- * @brief A table that is generated by a generator function.
- */
-class ParseGeneratorTableReference : public ParseTableReference {
- public:
-  /**
-   * @brief Constructor. Takes ownership of \p generator_function.
-   *
-   * @param line_number The line number of the first token of the table reference.
-   * @param column_number The column number of the first token of the table reference.
-   * @param generator_function_ The parsed generator function.
-   */
-  ParseGeneratorTableReference(const int line_number,
-                               const int column_number,
-                               ParseFunctionCall *generator_function)
-      : ParseTableReference(line_number, column_number),
-        generator_function_(generator_function) {
-  }
-
-  /**
-   * @brief Destructor.
-   */
-  ~ParseGeneratorTableReference() override {}
-
-  TableReferenceType getTableReferenceType() const override {
-    return kGeneratorTableReference;
-  }
-
-  std::string getName() const override { return "TableGenerator"; }
-
-  /**
-   * @return The parsed generator function.
-   */
-  const ParseFunctionCall* generator_function() const { return generator_function_.get(); }
-
- 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<const ParseTreeNode*> *non_container_child_fields,
-      std::vector<std::string> *container_child_field_names,
-      std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const override;
-
- private:
-  std::unique_ptr<ParseFunctionCall> generator_function_;
-
-  DISALLOW_COPY_AND_ASSIGN(ParseGeneratorTableReference);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_PARSER_PARSE_GENERATOR_TABLE_REFERENCE_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/parser/ParseGroupBy.cpp
----------------------------------------------------------------------
diff --git a/parser/ParseGroupBy.cpp b/parser/ParseGroupBy.cpp
deleted file mode 100644
index 324a4c6..0000000
--- a/parser/ParseGroupBy.cpp
+++ /dev/null
@@ -1,41 +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 "parser/ParseGroupBy.hpp"
-
-#include <string>
-#include <vector>
-
-#include "parser/ParseExpression.hpp"
-
-namespace quickstep {
-
-void ParseGroupBy::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<const ParseTreeNode*> *non_container_child_fields,
-                                       std::vector<std::string> *container_child_field_names,
-                                       std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const {
-  for (const ParseExpression &group_by_expression : *grouping_expressions_) {
-    non_container_child_field_names->push_back("");
-    non_container_child_fields->push_back(&group_by_expression);
-  }
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/parser/ParseGroupBy.hpp
----------------------------------------------------------------------
diff --git a/parser/ParseGroupBy.hpp b/parser/ParseGroupBy.hpp
deleted file mode 100644
index 1e36cd0..0000000
--- a/parser/ParseGroupBy.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_PARSER_PARSE_GROUP_BY_HPP_
-#define QUICKSTEP_PARSER_PARSE_GROUP_BY_HPP_
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "parser/ParseExpression.hpp"
-#include "parser/ParseTreeNode.hpp"
-#include "utility/Macros.hpp"
-#include "utility/PtrList.hpp"
-
-namespace quickstep {
-
-/** \addtogroup Parser
- *  @{
- */
-
-/**
- * @brief The parsed representaiton of a GROUP BY clause.
- */
-class ParseGroupBy : public ParseTreeNode {
- public:
-  /**
-   * @brief Constructor.
-   *
-   * @param line_number The line number of "GROUP" in the SQL statement.
-   * @param column_number The column number of "GROUP" in the SQL statement.
-   * @param group_by_expressions The group by expressions.
-   */
-  ParseGroupBy(const int line_number, const int column_number, PtrList<ParseExpression> *grouping_expressions)
-      : ParseTreeNode(line_number, column_number),
-        grouping_expressions_(grouping_expressions) {
-  }
-
-  /**
-   * @brief Destructor.
-   */
-  ~ParseGroupBy() override {}
-
-  /**
-   * @brief Gets the GROUP BY expressions.
-   *
-   * @return GROUP BY expressions.
-   */
-  const PtrList<ParseExpression>* grouping_expressions() const {
-    return grouping_expressions_.get();
-  }
-
-  std::string getName() const override {
-    return "GroupBy";
-  }
-
- 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<const ParseTreeNode*> *non_container_child_fields,
-                           std::vector<std::string> *container_child_field_names,
-                           std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const override;
-
- private:
-  std::unique_ptr<PtrList<ParseExpression>> grouping_expressions_;
-
-  DISALLOW_COPY_AND_ASSIGN(ParseGroupBy);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_PARSER_PARSEGROUPBY_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/parser/ParseHaving.cpp
----------------------------------------------------------------------
diff --git a/parser/ParseHaving.cpp b/parser/ParseHaving.cpp
deleted file mode 100644
index 277f922..0000000
--- a/parser/ParseHaving.cpp
+++ /dev/null
@@ -1,39 +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 "parser/ParseHaving.hpp"
-
-#include <string>
-#include <vector>
-
-#include "parser/ParsePredicate.hpp"
-
-namespace quickstep {
-
-void ParseHaving::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<const ParseTreeNode*> *non_container_child_fields,
-                                      std::vector<std::string> *container_child_field_names,
-                                      std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const {
-  non_container_child_field_names->push_back("");
-  non_container_child_fields->push_back(having_predicate_.get());
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/parser/ParseHaving.hpp
----------------------------------------------------------------------
diff --git a/parser/ParseHaving.hpp b/parser/ParseHaving.hpp
deleted file mode 100644
index 1059a7a..0000000
--- a/parser/ParseHaving.hpp
+++ /dev/null
@@ -1,89 +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_PARSER_PARSE_HAVING_HPP_
-#define QUICKSTEP_PARSER_PARSE_HAVING_HPP_
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "parser/ParsePredicate.hpp"
-#include "parser/ParseTreeNode.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-
-/** \addtogroup Parser
- *  @{
- */
-
-/**
- * @brief The parsed representation of HAVING.
- */
-class ParseHaving : public ParseTreeNode {
- public:
-  /**
-   * @brief Constructor.
-   *
-   * @param line_number The line number of "HAVING" in the SQL statement.
-   * @param column_number The column number of "HAVING" in the SQL statement.
-   * @param having_predicate The HAVING predicate.
-   */
-  ParseHaving(const int line_number, const int column_number, ParsePredicate *having_predicate)
-      : ParseTreeNode(line_number, column_number), having_predicate_(having_predicate) {
-  }
-
-  /**
-   * @brief Destructor.
-   */
-  ~ParseHaving() override {}
-
-  /**
-   * @brief Gets the HAVING predicate.
-   *
-   * @return HAVING predicate
-   */
-  const ParsePredicate *having_predicate() const {
-    return having_predicate_.get();
-  }
-
-  std::string getName() const override {
-    return "HAVING";
-  }
-
- 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<const ParseTreeNode*> *non_container_child_fields,
-                           std::vector<std::string> *container_child_field_names,
-                           std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const override;
-
- private:
-  std::unique_ptr<ParsePredicate> having_predicate_;
-
-  DISALLOW_COPY_AND_ASSIGN(ParseHaving);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_PARSER_PARSEHAVING_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/parser/ParseIndexProperties.cpp
----------------------------------------------------------------------
diff --git a/parser/ParseIndexProperties.cpp b/parser/ParseIndexProperties.cpp
deleted file mode 100644
index 8268b5c..0000000
--- a/parser/ParseIndexProperties.cpp
+++ /dev/null
@@ -1,29 +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 "parser/ParseIndexProperties.hpp"
-
-namespace quickstep {
-  // Initialize constants for various index properties.
-  const char *BitWeavingIndexProperties::kBitWeavingType = "type";
-  const char *BloomFilterIndexProperties::kBloomFilterSizeInBytes = "size";
-  const char *BloomFilterIndexProperties::kBloomFilterNumHashes = "num_hashes";
-  const char *BloomFilterIndexProperties::kBloomFilterProjectElementCount = "projected_element_count";
-
-}  // namespace quickstep



[24/51] [abbrv] [partial] incubator-quickstep git commit: remove c++ files

Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/parser/preprocessed/SqlParser_gen.cpp
----------------------------------------------------------------------
diff --git a/parser/preprocessed/SqlParser_gen.cpp b/parser/preprocessed/SqlParser_gen.cpp
deleted file mode 100644
index 283bcbe..0000000
--- a/parser/preprocessed/SqlParser_gen.cpp
+++ /dev/null
@@ -1,6118 +0,0 @@
-/* A Bison parser, made by GNU Bison 3.0.2.  */
-
-/* Bison implementation for Yacc-like parsers in C
-
-   Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
-
-   This program is free software: you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation, either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
-
-/* As a special exception, you may create a larger work that contains
-   part or all of the Bison parser skeleton and distribute that work
-   under terms of your choice, so long as that work isn't itself a
-   parser generator using the skeleton or a modified version thereof
-   as a parser skeleton.  Alternatively, if you modify or redistribute
-   the parser skeleton itself, you may (at your option) remove this
-   special exception, which will cause the skeleton and the resulting
-   Bison output files to be licensed under the GNU General Public
-   License without this special exception.
-
-   This special exception was added by the Free Software Foundation in
-   version 2.2 of Bison.  */
-
-/* C LALR(1) parser skeleton written by Richard Stallman, by
-   simplifying the original so-called "semantic" parser.  */
-
-/* All symbols defined below should begin with yy or YY, to avoid
-   infringing on user name space.  This should be done even for local
-   variables, as they might otherwise be expanded by user macros.
-   There are some unavoidable exceptions within include files to
-   define necessary library symbols; they are noted "INFRINGES ON
-   USER NAME SPACE" below.  */
-
-/* Identify Bison output.  */
-#define YYBISON 1
-
-/* Bison version.  */
-#define YYBISON_VERSION "3.0.2"
-
-/* Skeleton name.  */
-#define YYSKELETON_NAME "yacc.c"
-
-/* Pure parsers.  */
-#define YYPURE 1
-
-/* Push parsers.  */
-#define YYPUSH 0
-
-/* Pull parsers.  */
-#define YYPULL 1
-
-
-/* Substitute the variable and function names.  */
-#define yyparse         quickstep_yyparse
-#define yylex           quickstep_yylex
-#define yyerror         quickstep_yyerror
-#define yydebug         quickstep_yydebug
-#define yynerrs         quickstep_yynerrs
-
-
-/* Copy the first part of user declarations.  */
-#line 35 "../SqlParser.ypp" /* yacc.c:339  */
-
-
-/* Override the default definition, as we only need <first_line> and <first_column>. */
-typedef struct YYLTYPE {
-  int first_line;
-  int first_column;
-} YYLTYPE;
-
-#define YYLTYPE_IS_DECLARED 1
-
-/*
- * Modified from the default YYLLOC_DEFAULT
- * (http://www.gnu.org/software/bison/manual/html_node/Location-Default-Action.html).
- * The assignments for last_line and last_column are removed as they are not used.
- */
-#define YYLLOC_DEFAULT(current, rhs, n)                         \
-  do {                                                          \
-    if (n) {                                                    \
-      (current).first_line   = YYRHSLOC(rhs, 1).first_line;     \
-      (current).first_column = YYRHSLOC(rhs, 1).first_column;   \
-    } else {                                                    \
-      /* empty RHS */                                           \
-      (current).first_line = YYRHSLOC(rhs, 0).first_line;       \
-      (current).first_column = YYRHSLOC(rhs, 0).first_column;   \
-    }                                                           \
-  } while (0)
-
-#line 64 "../SqlParser.ypp" /* yacc.c:339  */
-
-#include <cstdlib>
-#include <string>
-#include <utility>
-
-#include "catalog/PartitionSchemeHeader.hpp"
-#include "parser/ParseAssignment.hpp"
-#include "parser/ParseAttributeDefinition.hpp"
-#include "parser/ParseBasicExpressions.hpp"
-#include "parser/ParseBlockProperties.hpp"
-#include "parser/ParseCaseExpressions.hpp"
-#include "parser/ParseExpression.hpp"
-#include "parser/ParseGeneratorTableReference.hpp"
-#include "parser/ParseGroupBy.hpp"
-#include "parser/ParseHaving.hpp"
-#include "parser/ParseJoinedTableReference.hpp"
-#include "parser/ParseKeyValue.hpp"
-#include "parser/ParseLimit.hpp"
-#include "parser/ParseLiteralValue.hpp"
-#include "parser/ParseOrderBy.hpp"
-#include "parser/ParsePartitionClause.hpp"
-#include "parser/ParsePredicate.hpp"
-#include "parser/ParsePredicateExists.hpp"
-#include "parser/ParsePredicateInTableQuery.hpp"
-#include "parser/ParsePriority.hpp"
-#include "parser/ParserUtil.hpp"
-#include "parser/ParseSample.hpp"
-#include "parser/ParseSelect.hpp"
-#include "parser/ParseSelectionClause.hpp"
-#include "parser/ParseSimpleTableReference.hpp"
-#include "parser/ParseStatement.hpp"
-#include "parser/ParseString.hpp"
-#include "parser/ParseSubqueryExpression.hpp"
-#include "parser/ParseSubqueryTableReference.hpp"
-#include "parser/ParseTableReference.hpp"
-#include "parser/ParseWindow.hpp"
-#include "storage/StorageBlockInfo.hpp"
-#include "types/Type.hpp"
-#include "types/TypeFactory.hpp"
-#include "types/TypeID.hpp"
-#include "types/operations/binary_operations/BinaryOperation.hpp"
-#include "types/operations/binary_operations/BinaryOperationFactory.hpp"
-#include "types/operations/binary_operations/BinaryOperationID.hpp"
-#include "types/operations/comparisons/Comparison.hpp"
-#include "types/operations/comparisons/ComparisonFactory.hpp"
-#include "types/operations/comparisons/ComparisonID.hpp"
-#include "types/operations/unary_operations/UnaryOperation.hpp"
-#include "types/operations/unary_operations/UnaryOperationFactory.hpp"
-#include "types/operations/unary_operations/UnaryOperationID.hpp"
-#include "utility/PtrList.hpp"
-#include "utility/PtrVector.hpp"
-
-// Needed for Bison 2.6 and higher, which do not automatically provide this typedef.
-typedef void* yyscan_t;
-
-#line 156 "SqlParser_gen.cpp" /* yacc.c:339  */
-
-# ifndef YY_NULLPTR
-#  if defined __cplusplus && 201103L <= __cplusplus
-#   define YY_NULLPTR nullptr
-#  else
-#   define YY_NULLPTR 0
-#  endif
-# endif
-
-/* Enabling verbose error messages.  */
-#ifdef YYERROR_VERBOSE
-# undef YYERROR_VERBOSE
-# define YYERROR_VERBOSE 1
-#else
-# define YYERROR_VERBOSE 0
-#endif
-
-/* In a future release of Bison, this section will be replaced
-   by #include "SqlParser_gen.hpp".  */
-#ifndef YY_QUICKSTEP_YY_SQLPARSER_GEN_HPP_INCLUDED
-# define YY_QUICKSTEP_YY_SQLPARSER_GEN_HPP_INCLUDED
-/* Debug traces.  */
-#ifndef YYDEBUG
-# define YYDEBUG 0
-#endif
-#if YYDEBUG
-extern int quickstep_yydebug;
-#endif
-
-/* Token type.  */
-#ifndef YYTOKENTYPE
-# define YYTOKENTYPE
-  enum yytokentype
-  {
-    TOKEN_COMMAND = 258,
-    TOKEN_NAME = 259,
-    TOKEN_STRING_SINGLE_QUOTED = 260,
-    TOKEN_STRING_DOUBLE_QUOTED = 261,
-    TOKEN_UNSIGNED_NUMVAL = 262,
-    TOKEN_OR = 263,
-    TOKEN_AND = 264,
-    TOKEN_NOT = 265,
-    TOKEN_EQ = 266,
-    TOKEN_LT = 267,
-    TOKEN_LEQ = 268,
-    TOKEN_GT = 269,
-    TOKEN_GEQ = 270,
-    TOKEN_NEQ = 271,
-    TOKEN_LIKE = 272,
-    TOKEN_REGEXP = 273,
-    TOKEN_BETWEEN = 274,
-    TOKEN_IS = 275,
-    UNARY_PLUS = 276,
-    UNARY_MINUS = 277,
-    TOKEN_ADD = 278,
-    TOKEN_ALL = 279,
-    TOKEN_ALTER = 280,
-    TOKEN_AS = 281,
-    TOKEN_ASC = 282,
-    TOKEN_BIGINT = 283,
-    TOKEN_BIT = 284,
-    TOKEN_BITWEAVING = 285,
-    TOKEN_BLOCKPROPERTIES = 286,
-    TOKEN_BLOCKSAMPLE = 287,
-    TOKEN_BLOOM_FILTER = 288,
-    TOKEN_CSB_TREE = 289,
-    TOKEN_BY = 290,
-    TOKEN_CASE = 291,
-    TOKEN_CHARACTER = 292,
-    TOKEN_CHECK = 293,
-    TOKEN_COLUMN = 294,
-    TOKEN_CONSTRAINT = 295,
-    TOKEN_COPY = 296,
-    TOKEN_CREATE = 297,
-    TOKEN_CURRENT = 298,
-    TOKEN_DATE = 299,
-    TOKEN_DATETIME = 300,
-    TOKEN_DAY = 301,
-    TOKEN_DECIMAL = 302,
-    TOKEN_DEFAULT = 303,
-    TOKEN_DELETE = 304,
-    TOKEN_DELIMITER = 305,
-    TOKEN_DESC = 306,
-    TOKEN_DISTINCT = 307,
-    TOKEN_DOUBLE = 308,
-    TOKEN_DROP = 309,
-    TOKEN_ELSE = 310,
-    TOKEN_END = 311,
-    TOKEN_ESCAPE_STRINGS = 312,
-    TOKEN_EXISTS = 313,
-    TOKEN_EXTRACT = 314,
-    TOKEN_FALSE = 315,
-    TOKEN_FIRST = 316,
-    TOKEN_FLOAT = 317,
-    TOKEN_FOLLOWING = 318,
-    TOKEN_FOR = 319,
-    TOKEN_FOREIGN = 320,
-    TOKEN_FROM = 321,
-    TOKEN_FULL = 322,
-    TOKEN_GROUP = 323,
-    TOKEN_HASH = 324,
-    TOKEN_HAVING = 325,
-    TOKEN_HOUR = 326,
-    TOKEN_IN = 327,
-    TOKEN_INDEX = 328,
-    TOKEN_INNER = 329,
-    TOKEN_INSERT = 330,
-    TOKEN_INTEGER = 331,
-    TOKEN_INTERVAL = 332,
-    TOKEN_INTO = 333,
-    TOKEN_JOIN = 334,
-    TOKEN_KEY = 335,
-    TOKEN_LAST = 336,
-    TOKEN_LEFT = 337,
-    TOKEN_LIMIT = 338,
-    TOKEN_LONG = 339,
-    TOKEN_MINUTE = 340,
-    TOKEN_MONTH = 341,
-    TOKEN_NULL = 342,
-    TOKEN_NULLS = 343,
-    TOKEN_OFF = 344,
-    TOKEN_ON = 345,
-    TOKEN_ORDER = 346,
-    TOKEN_OUTER = 347,
-    TOKEN_OVER = 348,
-    TOKEN_PARTITION = 349,
-    TOKEN_PARTITIONS = 350,
-    TOKEN_PERCENT = 351,
-    TOKEN_PRECEDING = 352,
-    TOKEN_PRIMARY = 353,
-    TOKEN_PRIORITY = 354,
-    TOKEN_QUIT = 355,
-    TOKEN_RANGE = 356,
-    TOKEN_REAL = 357,
-    TOKEN_REFERENCES = 358,
-    TOKEN_RIGHT = 359,
-    TOKEN_ROW = 360,
-    TOKEN_ROW_DELIMITER = 361,
-    TOKEN_ROWS = 362,
-    TOKEN_SECOND = 363,
-    TOKEN_SELECT = 364,
-    TOKEN_SET = 365,
-    TOKEN_SMA = 366,
-    TOKEN_SMALLINT = 367,
-    TOKEN_SUBSTRING = 368,
-    TOKEN_TABLE = 369,
-    TOKEN_THEN = 370,
-    TOKEN_TIME = 371,
-    TOKEN_TIMESTAMP = 372,
-    TOKEN_TRUE = 373,
-    TOKEN_TUPLESAMPLE = 374,
-    TOKEN_UNBOUNDED = 375,
-    TOKEN_UNIQUE = 376,
-    TOKEN_UPDATE = 377,
-    TOKEN_USING = 378,
-    TOKEN_VALUES = 379,
-    TOKEN_VARCHAR = 380,
-    TOKEN_WHEN = 381,
-    TOKEN_WHERE = 382,
-    TOKEN_WINDOW = 383,
-    TOKEN_WITH = 384,
-    TOKEN_YEAR = 385,
-    TOKEN_YEARMONTH = 386,
-    TOKEN_EOF = 387,
-    TOKEN_LEX_ERROR = 388
-  };
-#endif
-
-/* Value type.  */
-#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
-typedef union YYSTYPE YYSTYPE;
-union YYSTYPE
-{
-#line 120 "../SqlParser.ypp" /* yacc.c:355  */
-
-  quickstep::ParseString *string_value_;
-
-  quickstep::PtrList<quickstep::ParseString> *string_list_;
-
-  bool boolean_value_;
-
-  quickstep::NumericParseLiteralValue *numeric_literal_value_;
-  quickstep::ParseLiteralValue *literal_value_;
-  quickstep::PtrList<quickstep::ParseScalarLiteral> *literal_value_list_;
-
-  quickstep::ParseExpression *expression_;
-
-  quickstep::ParseScalarLiteral *scalar_literal_;
-  quickstep::ParseAttribute *attribute_;
-  quickstep::PtrList<quickstep::ParseAttribute> *attribute_list_;
-
-  quickstep::ParsePredicate *predicate_;
-
-  quickstep::ParseSubqueryExpression *subquery_expression_;
-
-  quickstep::PtrVector<quickstep::ParseSimpleWhenClause> *simple_when_clause_list_;
-  quickstep::ParseSimpleWhenClause *simple_when_clause_;
-
-  quickstep::PtrVector<quickstep::ParseSearchedWhenClause> *searched_when_clause_list_;
-  quickstep::ParseSearchedWhenClause *searched_when_clause_;
-
-  quickstep::ParseSelectionClause *selection_;
-  quickstep::ParseSelectionItem *selection_item_;
-  quickstep::ParseSelectionList *selection_list_;
-
-  quickstep::ParseTableReference *table_reference_;
-  quickstep::PtrList<quickstep::ParseTableReference> *table_reference_list_;
-  quickstep::ParseTableReferenceSignature *table_reference_signature_;
-
-  quickstep::ParseJoinedTableReference::JoinType join_type_;
-
-  quickstep::ParseDataType *data_type_;
-  quickstep::ParseAttributeDefinition *attribute_definition_;
-  quickstep::ParseColumnConstraint *column_constraint_;
-  quickstep::PtrList<quickstep::ParseColumnConstraint> *column_constraint_list_;
-  quickstep::PtrList<quickstep::ParseAttributeDefinition> *attribute_definition_list_;
-
-  quickstep::ParseKeyValue *key_value_;
-  quickstep::PtrList<quickstep::ParseKeyValue> *key_value_list_;
-  quickstep::ParseKeyStringValue *key_string_value_;
-  quickstep::ParseKeyStringList *key_string_list_;
-  quickstep::ParseKeyIntegerValue *key_integer_value_;
-
-  quickstep::ParseCopyFromParams *copy_from_params_;
-
-  quickstep::ParseAssignment *assignment_;
-  quickstep::PtrList<quickstep::ParseAssignment> *assignment_list_;
-
-  quickstep::ParseCommand *command_;
-  quickstep::PtrVector<quickstep::ParseString> *command_argument_list_;
-
-  quickstep::ParseStatement *statement_;
-  quickstep::ParseStatementSelect *select_statement_;
-  quickstep::ParseStatementUpdate *update_statement_;
-  quickstep::ParseStatementInsert *insert_statement_;
-  quickstep::ParseStatementDelete *delete_statement_;
-  quickstep::ParseStatementCopyFrom *copy_from_statement_;
-  quickstep::ParseStatementCreateTable *create_table_statement_;
-  quickstep::ParsePartitionClause *partition_clause_;
-  quickstep::ParseBlockProperties *block_properties_;
-  quickstep::ParseStatementDropTable *drop_table_statement_;
-  quickstep::ParseStatementQuit *quit_statement_;
-
-  const quickstep::Comparison *comparison_;
-  const quickstep::UnaryOperation *unary_operation_;
-  const quickstep::BinaryOperation *binary_operation_;
-
-  quickstep::ParseFunctionCall *function_call_;
-  quickstep::PtrList<quickstep::ParseExpression> *expression_list_;
-
-  quickstep::ParseSelect *select_query_;
-  quickstep::ParseGroupBy *opt_group_by_clause_;
-  quickstep::ParseHaving *opt_having_clause_;
-  quickstep::ParseOrderBy *opt_order_by_clause_;
-  bool *order_direction_;
-  quickstep::ParseLimit *opt_limit_clause_;
-
-  quickstep::ParseSample *opt_sample_clause_;
-
-  quickstep::PtrList<quickstep::ParseWindow> *opt_window_clause_;
-  quickstep::ParseWindow *window_definition_;
-  quickstep::PtrList<quickstep::ParseExpression> *window_partition_by_list_;
-  quickstep::PtrList<quickstep::ParseOrderByItem> *window_order_by_list_;
-  quickstep::ParseFrameInfo *window_frame_info_;
-
-  quickstep::PtrList<quickstep::ParseOrderByItem> *order_commalist_;
-  quickstep::ParseOrderByItem *order_item_;
-
-  quickstep::PtrVector<quickstep::ParseSubqueryTableReference> *with_list_;
-  quickstep::ParseSubqueryTableReference *with_list_element_;
-
-  quickstep::ParsePriority *opt_priority_clause_;
-
-#line 430 "SqlParser_gen.cpp" /* yacc.c:355  */
-};
-# define YYSTYPE_IS_TRIVIAL 1
-# define YYSTYPE_IS_DECLARED 1
-#endif
-
-/* Location type.  */
-#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
-typedef struct YYLTYPE YYLTYPE;
-struct YYLTYPE
-{
-  int first_line;
-  int first_column;
-  int last_line;
-  int last_column;
-};
-# define YYLTYPE_IS_DECLARED 1
-# define YYLTYPE_IS_TRIVIAL 1
-#endif
-
-
-
-int quickstep_yyparse (yyscan_t yyscanner, quickstep::ParseStatement **parsedStatement);
-
-#endif /* !YY_QUICKSTEP_YY_SQLPARSER_GEN_HPP_INCLUDED  */
-
-/* Copy the second part of user declarations.  */
-#line 220 "../SqlParser.ypp" /* yacc.c:358  */
-
-/* This header needs YYSTYPE, which is defined by the %union directive above */
-#include "SqlLexer_gen.hpp"
-void NotSupported(const YYLTYPE *location, yyscan_t yyscanner, const std::string &feature);
-
-#line 463 "SqlParser_gen.cpp" /* yacc.c:358  */
-
-#ifdef short
-# undef short
-#endif
-
-#ifdef YYTYPE_UINT8
-typedef YYTYPE_UINT8 yytype_uint8;
-#else
-typedef unsigned char yytype_uint8;
-#endif
-
-#ifdef YYTYPE_INT8
-typedef YYTYPE_INT8 yytype_int8;
-#else
-typedef signed char yytype_int8;
-#endif
-
-#ifdef YYTYPE_UINT16
-typedef YYTYPE_UINT16 yytype_uint16;
-#else
-typedef unsigned short int yytype_uint16;
-#endif
-
-#ifdef YYTYPE_INT16
-typedef YYTYPE_INT16 yytype_int16;
-#else
-typedef short int yytype_int16;
-#endif
-
-#ifndef YYSIZE_T
-# ifdef __SIZE_TYPE__
-#  define YYSIZE_T __SIZE_TYPE__
-# elif defined size_t
-#  define YYSIZE_T size_t
-# elif ! defined YYSIZE_T
-#  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
-#  define YYSIZE_T size_t
-# else
-#  define YYSIZE_T unsigned int
-# endif
-#endif
-
-#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
-
-#ifndef YY_
-# if defined YYENABLE_NLS && YYENABLE_NLS
-#  if ENABLE_NLS
-#   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
-#   define YY_(Msgid) dgettext ("bison-runtime", Msgid)
-#  endif
-# endif
-# ifndef YY_
-#  define YY_(Msgid) Msgid
-# endif
-#endif
-
-#ifndef YY_ATTRIBUTE
-# if (defined __GNUC__                                               \
-      && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__)))  \
-     || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
-#  define YY_ATTRIBUTE(Spec) __attribute__(Spec)
-# else
-#  define YY_ATTRIBUTE(Spec) /* empty */
-# endif
-#endif
-
-#ifndef YY_ATTRIBUTE_PURE
-# define YY_ATTRIBUTE_PURE   YY_ATTRIBUTE ((__pure__))
-#endif
-
-#ifndef YY_ATTRIBUTE_UNUSED
-# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
-#endif
-
-#if !defined _Noreturn \
-     && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
-# if defined _MSC_VER && 1200 <= _MSC_VER
-#  define _Noreturn __declspec (noreturn)
-# else
-#  define _Noreturn YY_ATTRIBUTE ((__noreturn__))
-# endif
-#endif
-
-/* Suppress unused-variable warnings by "using" E.  */
-#if ! defined lint || defined __GNUC__
-# define YYUSE(E) ((void) (E))
-#else
-# define YYUSE(E) /* empty */
-#endif
-
-#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
-/* Suppress an incorrect diagnostic about yylval being uninitialized.  */
-# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
-    _Pragma ("GCC diagnostic push") \
-    _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
-    _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
-# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
-    _Pragma ("GCC diagnostic pop")
-#else
-# define YY_INITIAL_VALUE(Value) Value
-#endif
-#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
-# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
-# define YY_IGNORE_MAYBE_UNINITIALIZED_END
-#endif
-#ifndef YY_INITIAL_VALUE
-# define YY_INITIAL_VALUE(Value) /* Nothing. */
-#endif
-
-
-#if ! defined yyoverflow || YYERROR_VERBOSE
-
-/* The parser invokes alloca or malloc; define the necessary symbols.  */
-
-# ifdef YYSTACK_USE_ALLOCA
-#  if YYSTACK_USE_ALLOCA
-#   ifdef __GNUC__
-#    define YYSTACK_ALLOC __builtin_alloca
-#   elif defined __BUILTIN_VA_ARG_INCR
-#    include <alloca.h> /* INFRINGES ON USER NAME SPACE */
-#   elif defined _AIX
-#    define YYSTACK_ALLOC __alloca
-#   elif defined _MSC_VER
-#    include <malloc.h> /* INFRINGES ON USER NAME SPACE */
-#    define alloca _alloca
-#   else
-#    define YYSTACK_ALLOC alloca
-#    if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
-#     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
-      /* Use EXIT_SUCCESS as a witness for stdlib.h.  */
-#     ifndef EXIT_SUCCESS
-#      define EXIT_SUCCESS 0
-#     endif
-#    endif
-#   endif
-#  endif
-# endif
-
-# ifdef YYSTACK_ALLOC
-   /* Pacify GCC's 'empty if-body' warning.  */
-#  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
-#  ifndef YYSTACK_ALLOC_MAXIMUM
-    /* The OS might guarantee only one guard page at the bottom of the stack,
-       and a page size can be as small as 4096 bytes.  So we cannot safely
-       invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number
-       to allow for a few compiler-allocated temporary stack slots.  */
-#   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
-#  endif
-# else
-#  define YYSTACK_ALLOC YYMALLOC
-#  define YYSTACK_FREE YYFREE
-#  ifndef YYSTACK_ALLOC_MAXIMUM
-#   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
-#  endif
-#  if (defined __cplusplus && ! defined EXIT_SUCCESS \
-       && ! ((defined YYMALLOC || defined malloc) \
-             && (defined YYFREE || defined free)))
-#   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
-#   ifndef EXIT_SUCCESS
-#    define EXIT_SUCCESS 0
-#   endif
-#  endif
-#  ifndef YYMALLOC
-#   define YYMALLOC malloc
-#   if ! defined malloc && ! defined EXIT_SUCCESS
-void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
-#   endif
-#  endif
-#  ifndef YYFREE
-#   define YYFREE free
-#   if ! defined free && ! defined EXIT_SUCCESS
-void free (void *); /* INFRINGES ON USER NAME SPACE */
-#   endif
-#  endif
-# endif
-#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
-
-
-#if (! defined yyoverflow \
-     && (! defined __cplusplus \
-         || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \
-             && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
-
-/* A type that is properly aligned for any stack member.  */
-union yyalloc
-{
-  yytype_int16 yyss_alloc;
-  YYSTYPE yyvs_alloc;
-  YYLTYPE yyls_alloc;
-};
-
-/* The size of the maximum gap between one aligned stack and the next.  */
-# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
-
-/* The size of an array large to enough to hold all stacks, each with
-   N elements.  */
-# define YYSTACK_BYTES(N) \
-     ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
-      + 2 * YYSTACK_GAP_MAXIMUM)
-
-# define YYCOPY_NEEDED 1
-
-/* Relocate STACK from its old location to the new one.  The
-   local variables YYSIZE and YYSTACKSIZE give the old and new number of
-   elements in the stack, and YYPTR gives the new location of the
-   stack.  Advance YYPTR to a properly aligned location for the next
-   stack.  */
-# define YYSTACK_RELOCATE(Stack_alloc, Stack)                           \
-    do                                                                  \
-      {                                                                 \
-        YYSIZE_T yynewbytes;                                            \
-        YYCOPY (&yyptr->Stack_alloc, Stack, yysize);                    \
-        Stack = &yyptr->Stack_alloc;                                    \
-        yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
-        yyptr += yynewbytes / sizeof (*yyptr);                          \
-      }                                                                 \
-    while (0)
-
-#endif
-
-#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
-/* Copy COUNT objects from SRC to DST.  The source and destination do
-   not overlap.  */
-# ifndef YYCOPY
-#  if defined __GNUC__ && 1 < __GNUC__
-#   define YYCOPY(Dst, Src, Count) \
-      __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
-#  else
-#   define YYCOPY(Dst, Src, Count)              \
-      do                                        \
-        {                                       \
-          YYSIZE_T yyi;                         \
-          for (yyi = 0; yyi < (Count); yyi++)   \
-            (Dst)[yyi] = (Src)[yyi];            \
-        }                                       \
-      while (0)
-#  endif
-# endif
-#endif /* !YYCOPY_NEEDED */
-
-/* YYFINAL -- State number of the termination state.  */
-#define YYFINAL  47
-/* YYLAST -- Last index in YYTABLE.  */
-#define YYLAST   1346
-
-/* YYNTOKENS -- Number of terminals.  */
-#define YYNTOKENS  145
-/* YYNNTS -- Number of nonterminals.  */
-#define YYNNTS  107
-/* YYNRULES -- Number of rules.  */
-#define YYNRULES  289
-/* YYNSTATES -- Number of states.  */
-#define YYNSTATES  536
-
-/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
-   by yylex, with out-of-bounds checking.  */
-#define YYUNDEFTOK  2
-#define YYMAXUTOK   388
-
-#define YYTRANSLATE(YYX)                                                \
-  ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
-
-/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
-   as returned by yylex, without out-of-bounds checking.  */
-static const yytype_uint8 yytranslate[] =
-{
-       0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-     140,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,   144,     2,     2,
-     141,   142,    23,    21,   143,    22,    27,    24,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,   139,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
-       5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
-      15,    16,    17,    18,    19,    20,    25,    26,    28,    29,
-      30,    31,    32,    33,    34,    35,    36,    37,    38,    39,
-      40,    41,    42,    43,    44,    45,    46,    47,    48,    49,
-      50,    51,    52,    53,    54,    55,    56,    57,    58,    59,
-      60,    61,    62,    63,    64,    65,    66,    67,    68,    69,
-      70,    71,    72,    73,    74,    75,    76,    77,    78,    79,
-      80,    81,    82,    83,    84,    85,    86,    87,    88,    89,
-      90,    91,    92,    93,    94,    95,    96,    97,    98,    99,
-     100,   101,   102,   103,   104,   105,   106,   107,   108,   109,
-     110,   111,   112,   113,   114,   115,   116,   117,   118,   119,
-     120,   121,   122,   123,   124,   125,   126,   127,   128,   129,
-     130,   131,   132,   133,   134,   135,   136,   137,   138
-};
-
-#if YYDEBUG
-  /* YYRLINE[YYN] -- Source line where rule number YYN was defined.  */
-static const yytype_uint16 yyrline[] =
-{
-       0,   629,   629,   633,   637,   641,   645,   648,   655,   658,
-     661,   664,   667,   670,   673,   676,   679,   682,   688,   694,
-     701,   707,   714,   723,   728,   737,   742,   747,   751,   757,
-     762,   765,   768,   773,   776,   779,   782,   785,   788,   791,
-     794,   797,   800,   812,   815,   818,   836,   856,   859,   862,
-     867,   872,   878,   884,   893,   897,   903,   906,   911,   916,
-     921,   928,   935,   939,   945,   948,   953,   956,   961,   964,
-     969,   972,   991,   995,  1001,  1005,  1011,  1014,  1017,  1022,
-    1025,  1032,  1037,  1048,  1053,  1057,  1061,  1067,  1070,  1076,
-    1084,  1087,  1090,  1096,  1101,  1104,  1109,  1113,  1117,  1121,
-    1127,  1132,  1137,  1141,  1147,  1153,  1156,  1161,  1164,  1183,
-    1188,  1192,  1198,  1204,  1210,  1213,  1217,  1223,  1226,  1231,
-    1235,  1241,  1244,  1247,  1252,  1257,  1262,  1265,  1268,  1273,
-    1276,  1279,  1282,  1285,  1288,  1291,  1294,  1299,  1302,  1307,
-    1311,  1315,  1318,  1322,  1325,  1330,  1333,  1338,  1341,  1346,
-    1350,  1356,  1359,  1364,  1367,  1372,  1375,  1380,  1383,  1402,
-    1405,  1410,  1414,  1420,  1426,  1431,  1434,  1439,  1442,  1447,
-    1450,  1455,  1458,  1463,  1464,  1467,  1472,  1473,  1476,  1481,
-    1485,  1491,  1498,  1501,  1504,  1509,  1512,  1515,  1521,  1524,
-    1529,  1534,  1543,  1548,  1557,  1562,  1565,  1570,  1573,  1578,
-    1584,  1590,  1593,  1596,  1599,  1602,  1605,  1611,  1620,  1623,
-    1628,  1631,  1636,  1639,  1644,  1647,  1650,  1653,  1657,  1661,
-    1664,  1667,  1670,  1673,  1678,  1682,  1686,  1689,  1694,  1699,
-    1703,  1709,  1712,  1717,  1721,  1727,  1732,  1736,  1742,  1747,
-    1750,  1755,  1759,  1765,  1768,  1771,  1774,  1786,  1790,  1809,
-    1822,  1837,  1840,  1843,  1846,  1849,  1852,  1857,  1861,  1867,
-    1870,  1875,  1879,  1886,  1889,  1892,  1895,  1898,  1901,  1904,
-    1907,  1910,  1913,  1918,  1929,  1932,  1937,  1940,  1943,  1949,
-    1953,  1959,  1962,  1970,  1973,  1976,  1979,  1985,  1990,  1995
-};
-#endif
-
-#if YYDEBUG || YYERROR_VERBOSE || 0
-/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
-   First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
-static const char *const yytname[] =
-{
-  "$end", "error", "$undefined", "TOKEN_COMMAND", "TOKEN_NAME",
-  "TOKEN_STRING_SINGLE_QUOTED", "TOKEN_STRING_DOUBLE_QUOTED",
-  "TOKEN_UNSIGNED_NUMVAL", "TOKEN_OR", "TOKEN_AND", "TOKEN_NOT",
-  "TOKEN_EQ", "TOKEN_LT", "TOKEN_LEQ", "TOKEN_GT", "TOKEN_GEQ",
-  "TOKEN_NEQ", "TOKEN_LIKE", "TOKEN_REGEXP", "TOKEN_BETWEEN", "TOKEN_IS",
-  "'+'", "'-'", "'*'", "'/'", "UNARY_PLUS", "UNARY_MINUS", "'.'",
-  "TOKEN_ADD", "TOKEN_ALL", "TOKEN_ALTER", "TOKEN_AS", "TOKEN_ASC",
-  "TOKEN_BIGINT", "TOKEN_BIT", "TOKEN_BITWEAVING", "TOKEN_BLOCKPROPERTIES",
-  "TOKEN_BLOCKSAMPLE", "TOKEN_BLOOM_FILTER", "TOKEN_CSB_TREE", "TOKEN_BY",
-  "TOKEN_CASE", "TOKEN_CHARACTER", "TOKEN_CHECK", "TOKEN_COLUMN",
-  "TOKEN_CONSTRAINT", "TOKEN_COPY", "TOKEN_CREATE", "TOKEN_CURRENT",
-  "TOKEN_DATE", "TOKEN_DATETIME", "TOKEN_DAY", "TOKEN_DECIMAL",
-  "TOKEN_DEFAULT", "TOKEN_DELETE", "TOKEN_DELIMITER", "TOKEN_DESC",
-  "TOKEN_DISTINCT", "TOKEN_DOUBLE", "TOKEN_DROP", "TOKEN_ELSE",
-  "TOKEN_END", "TOKEN_ESCAPE_STRINGS", "TOKEN_EXISTS", "TOKEN_EXTRACT",
-  "TOKEN_FALSE", "TOKEN_FIRST", "TOKEN_FLOAT", "TOKEN_FOLLOWING",
-  "TOKEN_FOR", "TOKEN_FOREIGN", "TOKEN_FROM", "TOKEN_FULL", "TOKEN_GROUP",
-  "TOKEN_HASH", "TOKEN_HAVING", "TOKEN_HOUR", "TOKEN_IN", "TOKEN_INDEX",
-  "TOKEN_INNER", "TOKEN_INSERT", "TOKEN_INTEGER", "TOKEN_INTERVAL",
-  "TOKEN_INTO", "TOKEN_JOIN", "TOKEN_KEY", "TOKEN_LAST", "TOKEN_LEFT",
-  "TOKEN_LIMIT", "TOKEN_LONG", "TOKEN_MINUTE", "TOKEN_MONTH", "TOKEN_NULL",
-  "TOKEN_NULLS", "TOKEN_OFF", "TOKEN_ON", "TOKEN_ORDER", "TOKEN_OUTER",
-  "TOKEN_OVER", "TOKEN_PARTITION", "TOKEN_PARTITIONS", "TOKEN_PERCENT",
-  "TOKEN_PRECEDING", "TOKEN_PRIMARY", "TOKEN_PRIORITY", "TOKEN_QUIT",
-  "TOKEN_RANGE", "TOKEN_REAL", "TOKEN_REFERENCES", "TOKEN_RIGHT",
-  "TOKEN_ROW", "TOKEN_ROW_DELIMITER", "TOKEN_ROWS", "TOKEN_SECOND",
-  "TOKEN_SELECT", "TOKEN_SET", "TOKEN_SMA", "TOKEN_SMALLINT",
-  "TOKEN_SUBSTRING", "TOKEN_TABLE", "TOKEN_THEN", "TOKEN_TIME",
-  "TOKEN_TIMESTAMP", "TOKEN_TRUE", "TOKEN_TUPLESAMPLE", "TOKEN_UNBOUNDED",
-  "TOKEN_UNIQUE", "TOKEN_UPDATE", "TOKEN_USING", "TOKEN_VALUES",
-  "TOKEN_VARCHAR", "TOKEN_WHEN", "TOKEN_WHERE", "TOKEN_WINDOW",
-  "TOKEN_WITH", "TOKEN_YEAR", "TOKEN_YEARMONTH", "TOKEN_EOF",
-  "TOKEN_LEX_ERROR", "';'", "'\\n'", "'('", "')'", "','", "'%'", "$accept",
-  "start", "sql_statement", "quit_statement", "alter_table_statement",
-  "create_table_statement", "create_index_statement",
-  "drop_table_statement", "column_def", "column_def_commalist",
-  "data_type", "column_constraint_def", "column_constraint_def_list",
-  "opt_column_constraint_def_list", "table_constraint_def",
-  "table_constraint_def_commalist", "opt_table_constraint_def_commalist",
-  "opt_column_list", "opt_block_properties", "opt_partition_clause",
-  "partition_type", "key_value_list", "key_value", "key_string_value",
-  "key_string_list", "key_integer_value", "index_type",
-  "opt_index_properties", "insert_statement", "copy_from_statement",
-  "opt_copy_from_params", "copy_from_params", "update_statement",
-  "delete_statement", "assignment_list", "assignment_item",
-  "select_statement", "opt_priority_clause", "with_clause", "with_list",
-  "with_list_element", "select_query", "opt_all_distinct", "selection",
-  "selection_item_commalist", "selection_item", "from_clause",
-  "subquery_expression", "opt_sample_clause", "join_type",
-  "joined_table_reference", "table_reference", "table_reference_signature",
-  "table_reference_signature_primary", "joined_table_reference_commalist",
-  "opt_group_by_clause", "opt_having_clause", "opt_order_by_clause",
-  "opt_limit_clause", "opt_window_clause", "window_declaration_list",
-  "window_declaration", "window_definition", "opt_window_partition",
-  "opt_window_order", "opt_window_frame", "frame_mode", "frame_preceding",
-  "frame_following", "order_commalist", "order_item",
-  "opt_order_direction", "opt_nulls_first", "opt_where_clause",
-  "where_clause", "or_expression", "and_expression", "not_expression",
-  "predicate_expression_base", "add_expression", "multiply_expression",
-  "unary_expression", "expression_base", "function_call",
-  "extract_function", "substr_function", "case_expression",
-  "simple_when_clause_list", "simple_when_clause",
-  "searched_when_clause_list", "searched_when_clause", "opt_else_clause",
-  "expression_list", "literal_value", "datetime_unit",
-  "literal_value_commalist", "attribute_ref", "attribute_ref_list",
-  "comparison_operation", "unary_operation", "add_operation",
-  "multiply_operation", "name_commalist", "any_name", "boolean_value",
-  "command", "command_argument_list", YY_NULLPTR
-};
-#endif
-
-# ifdef YYPRINT
-/* YYTOKNUM[NUM] -- (External) token number corresponding to the
-   (internal) symbol number NUM (which must be that of a token).  */
-static const yytype_uint16 yytoknum[] =
-{
-       0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
-     265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
-     275,    43,    45,    42,    47,   276,   277,    46,   278,   279,
-     280,   281,   282,   283,   284,   285,   286,   287,   288,   289,
-     290,   291,   292,   293,   294,   295,   296,   297,   298,   299,
-     300,   301,   302,   303,   304,   305,   306,   307,   308,   309,
-     310,   311,   312,   313,   314,   315,   316,   317,   318,   319,
-     320,   321,   322,   323,   324,   325,   326,   327,   328,   329,
-     330,   331,   332,   333,   334,   335,   336,   337,   338,   339,
-     340,   341,   342,   343,   344,   345,   346,   347,   348,   349,
-     350,   351,   352,   353,   354,   355,   356,   357,   358,   359,
-     360,   361,   362,   363,   364,   365,   366,   367,   368,   369,
-     370,   371,   372,   373,   374,   375,   376,   377,   378,   379,
-     380,   381,   382,   383,   384,   385,   386,   387,   388,    59,
-      10,    40,    41,    44,    37
-};
-# endif
-
-#define YYPACT_NINF -234
-
-#define yypact_value_is_default(Yystate) \
-  (!!((Yystate) == (-234)))
-
-#define YYTABLE_NINF -130
-
-#define yytable_value_is_error(Yytable_value) \
-  0
-
-  /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
-     STATE-NUM.  */
-static const yytype_int16 yypact[] =
-{
-     168,  -234,  -234,   -58,   181,   -19,    40,   -37,    59,  -234,
-     123,   181,   181,  -234,   208,   127,  -234,  -234,  -234,  -234,
-    -234,  -234,  -234,  -234,  -234,  -234,    -2,    95,   -46,   233,
-     181,  -234,  -234,   113,   181,   181,   181,   181,   181,  -234,
-    -234,   667,   139,   114,  -234,   236,   128,  -234,  -234,  -234,
-     189,    95,   183,  -234,  -234,  -234,  -234,    60,   272,   196,
-     138,   191,  -234,    80,  -234,  -234,   296,   299,  -234,  -234,
-    -234,   757,   187,  -234,   242,  -234,  -234,   190,  -234,  -234,
-     310,  -234,  -234,  -234,  -234,   205,  -234,  -234,   214,   277,
-     850,   355,   290,   219,  -234,  -234,   182,    20,  -234,  -234,
-     269,  -234,  -234,  -234,  -234,  -234,  1030,    -9,   181,   181,
-     228,   181,   181,  -234,   366,    89,   174,   241,   181,   181,
-     577,  -234,  -234,   235,   181,  -234,  -234,  -234,   577,    42,
-      17,  -234,   370,  -234,   126,   126,  1120,   371,  -234,   243,
-      30,  -234,    34,   191,  1120,  -234,  -234,   181,  1120,  -234,
-    -234,  -234,  -234,  1120,    35,   299,  -234,   181,   359,   -56,
-    -234,   368,  -234,   270,  -234,   110,  -234,   270,  -234,   181,
-      -1,   181,   181,   247,  -234,   248,  -234,   141,  1158,   940,
-     228,   487,   378,   381,  -234,  -234,   545,   375,  1210,   143,
-       8,  1120,    58,  -234,  1120,  -234,   330,   254,  -234,  -234,
-    -234,  -234,  -234,  -234,   327,  -234,    50,   255,  -234,  -234,
-      16,   245,   153,  -234,   256,   245,   -14,   331,  -234,  -234,
-      20,  -234,   306,  -234,  -234,   264,  1120,  -234,   268,   151,
-     181,  -234,  1120,  -234,   181,  -234,  -234,   271,   325,   328,
-     274,  -234,  -234,  -234,    31,   181,   291,    -1,   181,  -234,
-      14,  -234,  -234,     2,   326,   577,   577,    62,  -234,  -234,
-    -234,  -234,  -234,  -234,  -234,  -234,  1120,   279,  1120,    39,
-    -234,   154,   289,  1120,    25,  -234,   360,   268,  -234,  -234,
-    1120,   415,  -234,   133,   181,  -234,  -234,   332,  -234,   334,
-     335,   340,    34,  -234,   418,   420,   245,   388,   358,   394,
-     293,   342,  -234,   156,  -234,  1120,  -234,   268,  -234,   577,
-     295,   298,   181,   437,     1,   158,  -234,   167,   416,   144,
-    -234,   301,   311,  -234,   357,   309,  1210,  -234,   362,   181,
-    -234,  -234,    14,  -234,  -234,   381,  -234,  -234,  -234,  1120,
-     312,    76,   850,  -234,   268,   363,  -234,  -234,  1210,   313,
-     268,  1120,  -234,    32,   -13,  -234,  -234,  -234,  -234,  -234,
-      34,   153,   351,   356,  -234,  1120,   577,   364,  1120,  -234,
-     419,   159,  -234,   268,     7,   181,   181,   169,  -234,  -234,
-    -234,  -234,  -234,  -234,  -234,   173,  -234,   181,  -234,  -234,
-    -234,  -234,   315,    -1,   422,   365,  -234,   577,  -234,  -234,
-     322,  -234,   237,   850,  -234,  1120,   171,  -234,  -234,  1210,
-     268,  -234,   458,  -234,   372,  -234,  -234,   329,   378,   429,
-     382,   329,  1120,  -234,  -234,  -234,   452,  -234,   175,   177,
-    -234,   469,     1,  -234,   181,  -234,  -234,   337,   435,  -234,
-       9,   181,  1120,   179,   268,  -234,   184,   341,   577,  1120,
-     472,   349,   343,  -234,   178,    22,   376,  -234,  -234,  -234,
-     192,  -234,  -234,  -234,  -234,    21,   181,   -16,  -234,   346,
-     268,  -234,  -234,  -234,   378,   343,  -234,   181,  -234,   349,
-    -234,  1120,  -234,  -234,   403,   396,   389,   400,   494,   181,
-    -234,   181,  -234,  -234,   181,  -234,   207,  -234,  -234,   373,
-    -234,   473,  -234,  -234,   115,  -234,  -234,  -234,  -234,    41,
-     374,  -234,   209,  -234,   181,   383,  -234,  -234,   438,   395,
-     439,  -234,   181,  -234,   211,   306,  -234,  -234,  -234,   215,
-     411,   377,  -234,   505,  -234,  -234
-};
-
-  /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
-     Performed when YYTABLE does not specify something else to do.  Zero
-     means the default is an error.  */
-static const yytype_uint16 yydefact[] =
-{
-       0,     6,   289,     0,     0,     0,     0,     0,     0,    18,
-     114,     0,     0,     7,     0,     0,    15,     8,    10,    11,
-      13,    14,     9,    17,    12,    16,     0,   107,     0,   287,
-       0,   281,   282,     0,     0,     0,     0,     0,     0,   115,
-     116,     0,     0,   109,   110,     0,   147,     1,     3,     2,
-       0,   107,     0,   105,     5,     4,   288,     0,     0,     0,
-       0,   188,    25,     0,   247,   244,     0,   273,   117,    40,
-      29,     0,     0,    30,    31,    34,    36,     0,    37,    39,
-       0,    41,   243,    35,    38,     0,    32,    33,     0,     0,
-       0,     0,     0,   118,   119,   223,   123,   209,   211,   213,
-     216,   219,   220,   221,   215,   214,     0,   259,     0,     0,
-       0,     0,     0,   106,     0,     0,     0,    94,     0,     0,
-       0,   101,   189,     0,     0,    91,   245,   246,     0,     0,
-     239,   236,     0,    43,     0,   248,     0,     0,    44,     0,
-       0,   250,     0,   188,     0,   274,   275,     0,     0,   122,
-     277,   278,   276,     0,     0,     0,   212,     0,     0,   188,
-     103,     0,   111,     0,   112,     0,   279,     0,   108,     0,
-       0,     0,     0,     0,    93,    66,    27,     0,     0,     0,
-       0,     0,   190,   192,   194,   196,     0,   214,     0,     0,
-       0,     0,   239,   233,     0,   237,     0,     0,   253,   254,
-     255,   252,   256,   251,     0,   249,     0,     0,   125,   222,
-       0,     0,   149,   138,   124,   143,   126,   151,   120,   121,
-     208,   210,   165,   217,   260,     0,     0,   224,   241,     0,
-       0,   100,     0,   148,     0,    92,    19,     0,     0,     0,
-       0,    20,    21,    22,     0,     0,     0,    64,     0,    42,
-      56,   195,   203,     0,     0,     0,     0,     0,   263,   265,
-     266,   267,   268,   264,   269,   271,     0,     0,     0,     0,
-     257,     0,     0,     0,     0,   234,     0,   240,   232,    45,
-       0,     0,    46,   129,     0,   139,   145,   135,   130,   131,
-     133,     0,     0,   142,     0,     0,   141,     0,   153,     0,
-       0,   167,   225,     0,   226,     0,   102,   104,   280,     0,
-       0,     0,     0,     0,     0,     0,   261,     0,   259,     0,
-      63,    65,    68,    28,     0,     0,     0,    47,     0,     0,
-      49,    55,    57,    26,   202,   191,   193,   270,   272,     0,
-       0,     0,     0,   204,   201,     0,   200,    90,     0,     0,
-     238,     0,   231,     0,     0,   144,   146,   136,   132,   134,
-       0,   150,     0,     0,   140,     0,     0,   155,     0,   218,
-       0,   169,   227,   242,     0,     0,     0,     0,    96,   285,
-     286,   284,   283,    97,    95,     0,    67,     0,    83,    84,
-      85,    86,    87,     0,     0,    70,    48,     0,    51,    50,
-       0,    54,     0,     0,   206,     0,     0,   199,   258,     0,
-     235,   228,     0,   229,     0,   127,   128,   152,   154,     0,
-     157,   166,     0,   172,   171,   164,     0,    61,     0,     0,
-      58,     0,     0,   262,     0,    24,    62,     0,     0,    23,
-       0,     0,     0,     0,   197,   205,     0,     0,     0,     0,
-       0,   159,   168,   179,   182,     0,     0,    59,    98,    99,
-       0,    74,    76,    77,    78,     0,     0,     0,    52,     0,
-     198,   207,    89,   230,   137,   156,   158,     0,   113,   160,
-     161,     0,   183,   184,   185,     0,     0,     0,     0,     0,
-      88,     0,    82,    80,     0,    79,     0,    72,    73,     0,
-      53,     0,   162,   180,     0,   181,   173,   175,   174,     0,
-       0,    75,     0,    69,     0,     0,   186,   187,     0,     0,
-       0,   170,     0,    81,     0,   165,   176,   178,   177,     0,
-       0,     0,    60,     0,   163,    71
-};
-
-  /* YYPGOTO[NTERM-NUM].  */
-static const yytype_int16 yypgoto[] =
-{
-    -234,  -234,  -234,  -234,  -234,  -234,  -234,  -234,   -94,  -234,
-     338,   185,  -234,  -234,  -233,  -234,  -234,  -234,  -234,  -234,
-    -234,    47,    36,  -234,  -234,  -234,  -234,  -234,  -234,  -234,
-    -234,  -234,  -234,  -234,  -234,   292,  -234,   474,  -234,  -234,
-     414,    11,  -234,  -234,  -234,   386,  -234,   -97,  -234,  -234,
-    -189,   166,  -180,   -10,  -234,  -234,  -234,  -234,  -234,  -234,
-    -234,    52,    10,  -234,  -234,  -234,  -234,  -234,  -234,    83,
-      53,  -234,  -234,   -75,  -234,  -116,   278,   282,   361,   -35,
-     393,   390,   436,  -137,  -234,  -234,  -234,  -234,   352,  -234,
-     417,   354,  -207,  -185,   413,   140,  -119,  -234,  -234,  -234,
-    -234,  -234,  -120,    -4,   120,  -234,  -234
-};
-
-  /* YYDEFGOTO[NTERM-NUM].  */
-static const yytype_int16 yydefgoto[] =
-{
-      -1,    14,    15,    16,    17,    18,    19,    20,   176,   177,
-      91,   331,   332,   333,   241,   321,   322,   246,   395,   439,
-     499,   460,   461,   462,   463,   464,   392,   435,    21,    22,
-     174,   315,    23,    24,   159,   160,    25,    53,    26,    43,
-      44,   139,    41,    92,    93,    94,   143,    95,   296,   291,
-     212,   213,   285,   286,   214,   298,   367,   420,   451,   478,
-     479,   480,   300,   301,   371,   425,   426,   488,   521,   452,
-     453,   484,   505,   121,   122,   182,   183,   184,   185,   186,
-      97,    98,    99,   100,   101,   102,   103,   192,   193,   130,
-     131,   196,   229,   104,   204,   271,   105,   317,   268,   106,
-     148,   153,   165,   107,   383,    28,    29
-};
-
-  /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM.  If
-     positive, shift that token.  If negative, reduce the rule whose
-     number is the opposite.  If YYTABLE_NINF, syntax error.  */
-static const yytype_int16 yytable[] =
-{
-      33,   187,    45,   270,   189,   215,    96,    42,    46,   187,
-     255,    27,   190,   164,   320,   255,   255,   255,   157,   303,
-      31,   283,    32,   294,   324,    31,    57,    32,   492,   485,
-      59,    60,    61,    62,    63,   293,   129,    51,    31,    31,
-      32,    32,   237,   150,   151,   211,   145,   146,   518,   345,
-     493,   145,   146,   145,   146,   140,   412,   325,   497,    34,
-     187,    30,   187,   145,   146,   253,   379,   326,   217,   238,
-     486,   145,   146,   215,   125,   236,   120,   194,    50,   337,
-     338,   339,    37,   252,   231,   405,   313,   230,   115,   519,
-     498,    54,   149,   314,    55,   380,   381,   145,   146,    45,
-      35,   206,   239,   361,   161,    46,   327,   166,   167,    96,
-     295,    36,    10,   211,   175,   178,   364,   328,   194,   116,
-     166,   281,   329,   228,   382,   240,   316,   158,   273,   413,
-      10,   346,   158,   169,   170,   406,   187,   187,   216,   340,
-     330,   398,    38,   219,   334,   351,   254,   487,   128,   427,
-     223,   468,    39,   224,   323,   215,   274,   210,   417,   277,
-     436,   421,   494,   408,   152,   178,   520,   242,   243,     1,
-     343,     2,   209,   191,   411,   210,   222,   198,   235,   388,
-      40,   516,   389,   390,    58,    31,    31,    32,    32,   191,
-     187,   228,   377,   374,    10,   211,   443,   307,     3,   145,
-     146,   517,   199,   145,   146,   287,   216,    46,    47,   123,
-     482,    46,   288,   147,     4,     5,   200,   201,   171,   172,
-     289,   124,     6,   215,   270,   287,   161,     7,   431,    52,
-     308,   341,   288,   344,   483,   432,    56,  -129,   350,   202,
-     289,   318,   290,   404,   178,   353,   442,   187,     8,    31,
-     418,    32,   233,   234,   108,   428,   429,   109,   145,   146,
-     391,   203,   290,   211,    48,   423,    49,   110,   433,   111,
-     373,   424,   112,     9,   356,   355,   284,   117,   187,   119,
-      46,   440,    10,   247,   248,   272,   234,   114,   216,   145,
-     146,   118,    46,   304,   305,    11,   347,   348,   372,   305,
-     384,   385,    12,   126,   402,    13,   127,   228,   166,   386,
-     387,   430,   234,   445,   305,   135,   410,   456,   234,   457,
-     234,   471,   305,   120,   133,   400,   472,   348,   132,   187,
-     228,   134,   474,   228,   490,   491,   257,   258,   259,   260,
-     261,   262,   263,   264,   265,   266,   136,   145,   146,   513,
-     491,   523,   234,   530,   234,   137,   216,   532,   234,   138,
-     141,   142,   144,    31,    64,    32,    65,   154,   228,   163,
-     444,   166,   166,   168,   512,   173,   188,   197,   207,   232,
-      66,    67,   225,   318,    10,   208,   255,   454,   244,   245,
-     256,   278,    69,    70,   524,   269,   279,   282,   280,   292,
-      71,    72,   529,   267,   297,   299,   302,   470,    73,    74,
-     310,    75,   309,   311,   454,   312,   226,    76,   349,   319,
-     342,   352,   354,    77,   360,   362,    78,   363,   365,   357,
-     465,   358,   359,   366,   368,   369,   375,   469,   370,   376,
-      79,    80,   378,   157,   393,   394,   454,   399,    81,   396,
-     397,    82,   415,   403,   409,   407,   434,   416,   437,   422,
-     419,   495,   465,   441,   438,   447,    83,   448,   209,   449,
-     450,   455,   305,   501,   458,   467,    84,    85,   466,   476,
-      86,    87,   477,   473,   489,   510,   481,   465,   500,    88,
-     166,    31,    64,    32,    65,    89,   504,   179,   506,   507,
-      90,   227,   508,   509,   515,   527,   526,   528,    66,    67,
-     166,   533,   535,   496,   514,   522,   250,   401,   166,   534,
-      69,    70,   306,   162,   525,   113,   414,   511,    71,    72,
-     218,   502,   475,   335,   503,   531,    73,    74,   336,    75,
-     251,   220,   156,   221,   275,    76,   276,   195,   205,   446,
-     180,    77,   459,     0,    78,   257,   258,   259,   260,   261,
-     262,   263,   264,   265,   266,     0,   145,   146,    79,    80,
-       0,     0,     0,     0,     0,     0,    81,     0,     0,    82,
-       0,    31,    64,    32,    65,     0,     0,   179,     0,     0,
-       0,     0,     0,     0,    83,     0,     0,     0,    66,    67,
-       0,    10,     0,     0,    84,    85,     0,     0,    86,    87,
-      69,    70,     0,     0,     0,     0,     0,    88,    71,    72,
-       0,     0,   267,    89,     0,     0,    73,    74,   181,    75,
-       0,     0,     0,     0,     0,    76,     0,     0,     0,     0,
-     180,    77,     0,     0,    78,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,     0,     0,    79,    80,
-       0,     0,     0,     0,     0,     0,    81,     0,     0,    82,
-       0,    31,    64,    32,    65,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,    83,     0,     0,     0,    66,    67,
-      68,     0,     0,     0,    84,    85,     0,     0,    86,    87,
-      69,    70,     0,     0,     0,     0,     0,    88,    71,    72,
-       0,     0,     0,    89,     0,     0,    73,    74,   181,    75,
-       0,     0,     0,     0,     0,    76,     0,     0,     0,     0,
-       0,    77,     0,     0,    78,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,     0,     0,    79,    80,
-       0,     0,     0,     0,     0,     0,    81,     0,     0,    82,
-       0,    31,    64,    32,    65,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,    83,     0,     0,     0,    66,    67,
-       0,     0,     0,     0,    84,    85,     0,     0,    86,    87,
-      69,    70,     0,     0,     0,     0,     0,    88,    71,    72,
-       0,     0,     0,    89,     0,     0,    73,    74,    90,    75,
-       0,     0,     0,     0,     0,    76,     0,     0,     0,     0,
-       0,    77,     0,     0,    78,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,     0,     0,    79,    80,
-       0,     0,     0,     0,     0,     0,    81,     0,     0,    82,
-       0,     0,     0,     0,    31,    64,    32,    65,     0,     0,
-       0,     0,     0,     0,    83,     0,     0,     0,     0,     0,
-       0,    66,    67,     0,    84,    85,     0,     0,    86,    87,
-       0,     0,     0,    69,    70,     0,     0,    88,   128,     0,
-       0,    71,    72,    89,     0,     0,     0,     0,    90,    73,
-      74,     0,    75,     0,     0,     0,     0,     0,    76,     0,
-       0,     0,     0,     0,    77,     0,     0,    78,     0,     0,
-       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,    79,    80,     0,     0,     0,     0,     0,     0,    81,
-       0,     0,    82,     0,    31,    64,    32,    65,     0,     0,
-       0,     0,     0,     0,     0,     0,     0,    83,     0,     0,
-       0,    66,    67,     0,    10,     0,     0,    84,    85,     0,
-       0,    86,    87,    69,    70,     0,     0,     0,     0,     0,
-      88,    71,    72,     0,     0,     0,    89,     0,     0,    73,
-      74,    90,    75,     0,     0,     0,     0,     0,    76,     0,
-       0,     0,     0,   180,    77,     0,     0,    78,     0,     0,
-       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,    79,    80,     0,     0,     0,     0,     0,     0,    81,
-       0,     0,    82,     0,    31,    64,    32,    65,     0,     0,
-       0,     0,     0,     0,     0,     0,     0,    83,     0,     0,
-       0,    66,   155,     0,     0,     0,     0,    84,    85,     0,
-       0,    86,    87,    69,    70,     0,     0,     0,     0,     0,
-      88,    71,    72,     0,     0,     0,    89,     0,     0,    73,
-      74,   181,    75,     0,     0,     0,     0,     0,    76,     0,
-       0,     0,     0,     0,    77,     0,     0,    78,     0,     0,
-       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,    79,    80,     0,     0,     0,     0,     0,     0,    81,
-       0,     0,    82,     0,    31,    64,    32,    65,     0,     0,
-       0,     0,     0,     0,     0,     0,     0,    83,     0,     0,
-       0,    66,    67,     0,     0,     0,     0,    84,    85,     0,
-       0,    86,    87,    69,    70,     0,     0,     0,     0,     0,
-      88,    71,    72,     0,     0,     0,    89,     0,     0,    73,
-      74,    90,    75,     0,     0,     0,     0,     0,    76,     0,
-       0,     0,     0,     0,    77,     0,     0,    78,     0,     0,
-       0,    69,    70,     0,     0,     0,     0,     0,     0,     0,
-      72,    79,    80,     0,     0,     0,     0,    73,    74,    81,
-      75,     0,    82,     0,     0,    64,    76,    65,     0,     0,
-       0,     0,     0,     0,     0,    78,     0,    83,     0,     0,
-       0,    66,   155,     0,     0,     0,     0,    84,    85,    79,
-     249,    86,    87,    69,    70,     0,     0,    81,     0,     0,
-      88,     0,    72,     0,     0,     0,    89,     0,     0,    73,
-      74,    90,    75,     0,     0,    83,     0,     0,    76,     0,
-       0,     0,     0,     0,     0,    84,     0,    78,     0,    86,
-      87,     0,     0,     0,     0,     0,     0,     0,    88,     0,
-       0,    79,    80,     0,    89,     0,     0,     0,     0,    81,
-       0,     0,    82,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,     0,    83,     0,     0,
-       0,     0,     0,     0,     0,     0,     0,    84,     0,     0,
-       0,    86,    87,     0,     0,     0,     0,     0,     0,     0,
-      88,     0,     0,     0,     0,     0,    89
-};
-
-static const yytype_int16 yycheck[] =
-{
-       4,   120,    12,   188,   124,   142,    41,    11,    12,   128,
-       8,     0,   128,   110,   247,     8,     8,     8,    27,   226,
-       4,   210,     6,    37,    10,     4,    30,     6,     7,     7,
-      34,    35,    36,    37,    38,   215,    71,    26,     4,     4,
-       6,     6,    43,    23,    24,   142,    21,    22,     7,    10,
-      29,    21,    22,    21,    22,    90,    69,    43,    74,    78,
-     179,   119,   181,    21,    22,   181,    65,    53,   143,    70,
-      48,    21,    22,   210,    63,   169,   132,    60,    80,    17,
-      18,    19,   119,   180,   159,     9,    55,   143,    28,    48,
-     106,   137,    96,    62,   140,    94,    95,    21,    22,   109,
-     119,   136,   103,   292,   108,   109,    92,   111,   112,   144,
-     124,    71,   114,   210,   118,   119,   296,   103,    60,    59,
-     124,    71,   108,   158,   123,   126,   245,   141,   120,   142,
-     114,    92,   141,    44,    45,   342,   255,   256,   142,    77,
-     126,   326,    83,   147,   142,   120,   181,   125,   131,   142,
-     154,   142,    29,   157,   248,   292,   191,   141,   365,   194,
-     393,   368,   141,   348,   144,   169,   125,   171,   172,     1,
-     267,     3,   142,   131,   142,   141,   141,    51,   167,    35,
-      57,    66,    38,    39,    71,     4,     4,     6,     6,   131,
-     309,   226,   312,   309,   114,   292,   403,   232,    30,    21,
-      22,    86,    76,    21,    22,    72,   210,   211,     0,   129,
-      32,   215,    79,    31,    46,    47,    90,    91,    44,    45,
-      87,   141,    54,   360,   409,    72,   230,    59,    55,   134,
-     234,   266,    79,   268,    56,    62,     3,    84,   273,   113,
-      87,   245,   109,   340,   248,   280,     9,   366,    80,     4,
-     366,     6,   142,   143,   115,   375,   376,   143,    21,    22,
-     116,   135,   109,   360,   137,   106,   139,    31,   387,   141,
-     305,   112,    83,   105,   284,   142,    31,     5,   397,   141,
-     284,   397,   114,   142,   143,   142,   143,   104,   292,    21,
-      22,    95,   296,   142,   143,   127,   142,   143,   142,   143,
-     142,   143,   134,     7,   339,   137,     7,   342,   312,   142,
-     143,   142,   143,   142,   143,     5,   351,   142,   143,   142,
-     143,   142,   143,   132,    82,   329,   142,   143,   141,   448,
-     365,   141,   448,   368,   142,   143,    10,    11,    12,    13,
-      14,    15,    16,    17,    18,    19,   141,    21,    22,   142,
-     143,   142,   143,   142,   143,   141,   360,   142,   143,    82,
-       5,    71,   143,     4,     5,     6,     7,    98,   403,   141,
-     405,   375,   376,     7,   494,   134,   141,     7,     7,    11,
-      21,    22,    23,   387,   114,   142,     8,   422,   141,   141,
-       9,    61,    33,    34,   514,    20,   142,   142,    71,   143,
-      41,    42,   522,    77,    73,    99,   142,   442,    49,    50,
-      85,    52,   141,    85,   449,   141,    57,    58,   129,   128,
-     141,    61,     7,    64,    84,     7,    67,     7,    40,    97,
-     434,    97,    97,    75,    40,   142,   141,   441,    96,   141,
-      81,    82,     5,    27,   143,   134,   481,    85,    89,    92,
-     141,    92,   101,   141,   141,    92,   141,   101,    36,    40,
-      96,   465,   466,   141,    99,     7,   107,    95,   142,    40,
-      88,    19,   143,   477,     5,    40,   117,   118,   141,     7,
-     121,   122,   133,   142,   108,   489,   143,   491,   142,   130,
-     494,     4,     5,     6,     7,   136,    93,    10,   102,   110,
-     141,   142,   102,     9,    31,   110,    68,    68,    21,    22,
-     514,   100,     7,   466,   141,   141,   178,   332,   522,   142,
-      33,    34,   230,   109,   141,    51,   360,   491,    41,    42,
-     144,   479,   449,   255,   481,   525,    49,    50,   256,    52,
-     179,   148,   106,   153,   192,    58,   192,   130,   135,   409,
-      63,    64,   432,    -1,    67,    10,    11,    12,    13,    14,
-      15,    16,    17,    18,    19,    -1,    21,    22,    81,    82,
-      -1,    -1,    -1,    -1,    -1,    -1,    89,    -1,    -1,    92,
-      -1,     4,     5,     6,     7,    -1,    -1,    10,    -1,    -1,
-      -1,    -1,    -1,    -1,   107,    -1,    -1,    -1,    21,    22,
-      -1,   114,    -1,    -1,   117,   118,    -1,    -1,   121,   122,
-      33,    34,    -1,    -1,    -1,    -1,    -1,   130,    41,    42,
-      -1,    -1,    77,   136,    -1,    -1,    49,    50,   141,    52,
-      -1,    -1,    -1,    -1,    -1,    58,    -1,    -1,    -1,    -1,
-      63,    64,    -1,    -1,    67,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    81,    82,
-      -1,    -1,    -1,    -1,    -1,    -1,    89,    -1,    -1,    92,
-      -1,     4,     5,     6,     7,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,   107,    -1,    -1,    -1,    21,    22,
-      23,    -1,    -1,    -1,   117,   118,    -1,    -1,   121,   122,
-      33,    34,    -1,    -1,    -1,    -1,    -1,   130,    41,    42,
-      -1,    -1,    -1,   136,    -1,    -1,    49,    50,   141,    52,
-      -1,    -1,    -1,    -1,    -1,    58,    -1,    -1,    -1,    -1,
-      -1,    64,    -1,    -1,    67,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    81,    82,
-      -1,    -1,    -1,    -1,    -1,    -1,    89,    -1,    -1,    92,
-      -1,     4,     5,     6,     7,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,   107,    -1,    -1,    -1,    21,    22,
-      -1,    -1,    -1,    -1,   117,   118,    -1,    -1,   121,   122,
-      33,    34,    -1,    -1,    -1,    -1,    -1,   130,    41,    42,
-      -1,    -1,    -1,   136,    -1,    -1,    49,    50,   141,    52,
-      -1,    -1,    -1,    -1,    -1,    58,    -1,    -1,    -1,    -1,
-      -1,    64,    -1,    -1,    67,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    81,    82,
-      -1,    -1,    -1,    -1,    -1,    -1,    89,    -1,    -1,    92,
-      -1,    -1,    -1,    -1,     4,     5,     6,     7,    -1,    -1,
-      -1,    -1,    -1,    -1,   107,    -1,    -1,    -1,    -1,    -1,
-      -1,    21,    22,    -1,   117,   118,    -1,    -1,   121,   122,
-      -1,    -1,    -1,    33,    34,    -1,    -1,   130,   131,    -1,
-      -1,    41,    42,   136,    -1,    -1,    -1,    -1,   141,    49,
-      50,    -1,    52,    -1,    -1,    -1,    -1,    -1,    58,    -1,
-      -1,    -1,    -1,    -1,    64,    -1,    -1,    67,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    81,    82,    -1,    -1,    -1,    -1,    -1,    -1,    89,
-      -1,    -1,    92,    -1,     4,     5,     6,     7,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,    -1,   107,    -1,    -1,
-      -1,    21,    22,    -1,   114,    -1,    -1,   117,   118,    -1,
-      -1,   121,   122,    33,    34,    -1,    -1,    -1,    -1,    -1,
-     130,    41,    42,    -1,    -1,    -1,   136,    -1,    -1,    49,
-      50,   141,    52,    -1,    -1,    -1,    -1,    -1,    58,    -1,
-      -1,    -1,    -1,    63,    64,    -1,    -1,    67,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    81,    82,    -1,    -1,    -1,    -1,    -1,    -1,    89,
-      -1,    -1,    92,    -1,     4,     5,     6,     7,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,    -1,   107,    -1,    -1,
-      -1,    21,    22,    -1,    -1,    -1,    -1,   117,   118,    -1,
-      -1,   121,   122,    33,    34,    -1,    -1,    -1,    -1,    -1,
-     130,    41,    42,    -1,    -1,    -1,   136,    -1,    -1,    49,
-      50,   141,    52,    -1,    -1,    -1,    -1,    -1,    58,    -1,
-      -1,    -1,    -1,    -1,    64,    -1,    -1,    67,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    81,    82,    -1,    -1,    -1,    -1,    -1,    -1,    89,
-      -1,    -1,    92,    -1,     4,     5,     6,     7,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,    -1,   107,    -1,    -1,
-      -1,    21,    22,    -1,    -1,    -1,    -1,   117,   118,    -1,
-      -1,   121,   122,    33,    34,    -1,    -1,    -1,    -1,    -1,
-     130,    41,    42,    -1,    -1,    -1,   136,    -1,    -1,    49,
-      50,   141,    52,    -1,    -1,    -1,    -1,    -1,    58,    -1,
-      -1,    -1,    -1,    -1,    64,    -1,    -1,    67,    -1,    -1,
-      -1,    33,    34,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      42,    81,    82,    -1,    -1,    -1,    -1,    49,    50,    89,
-      52,    -1,    92,    -1,    -1,     5,    58,     7,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    67,    -1,   107,    -1,    -1,
-      -1,    21,    22,    -1,    -1,    -1,    -1,   117,   118,    81,
-      82,   121,   122,    33,    34,    -1,    -1,    89,    -1,    -1,
-     130,    -1,    42,    -1,    -1,    -1,   136,    -1,    -1,    49,
-      50,   141,    52,    -1,    -1,   107,    -1,    -1,    58,    -1,
-      -1,    -1,    -1,    -1,    -1,   117,    -1,    67,    -1,   121,
-     122,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   130,    -1,
-      -1,    81,    82,    -1,   136,    -1,    -1,    -1,    -1,    89,
-      -1,    -1,    92,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,    -1,   107,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,    -1,   117,    -1,    -1,
-      -1,   121,   122,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-     130,    -1,    -1,    -1,    -1,    -1,   136
-};
-
-  /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
-     symbol of state STATE-NUM.  */
-static const yytype_uint8 yystos[] =
-{
-       0,     1,     3,    30,    46,    47,    54,    59,    80,   105,
-     114,   127,   134,   137,   146,   147,   148,   149,   150,   151,
-     152,   173,   174,   177,   178,   181,   183,   186,   250,   251,
-     119,     4,     6,   248,    78,   119,    71,   119,    83,    29,
-      57,   187,   248,   184,   185,   198,   248,     0,   137,   139,
-      80,   186,   134,   182,   137,   140,     3,   248,    71,   248,
-     248,   248,   248,   248,     5,     7,    21,    22,    23,    33,
-      34,    41,    42,    49,    50,    52,    58,    64,    67,    81,
-      82,    89,    92,   107,   117,   118,   121,   122,   130,   136,
-     141,   155,   188,   189,   190,   192,   224,   225,   226,   227,
-     228,   229,   230,   231,   238,   241,   244,   248,   115,   143,
-      31,   141,    83,   182,   104,    28,    59,     5,    95,   141,
-     132,   218,   219,   129,   141,   186,     7,     7,   131,   224,
-     234,   235,   141,    82,   141,     5,   141,   141,    82,   186,
-     224,     5,    71,   191,   143,    21,    22,    31,   245,   248,
-      23,    24,   144,   246,    98,    22,   227,    27,   141,   179,
-     180,   248,   185,   141,   192,   247,   248,   248,     7,    44,
-      45,    44,    45,   134,   175,   248,   153,   154,   248,    10,
-      63,   141,   220,   221,   222,   223,   224,   241,   141,   247,
-     220,   131,   232,   233,    60,   235,   236,     7,    51,    76,
-      90,    91,   113,   135,   239,   239,   224,     7,   142,   142,
-     141,   192,   195,   196,   199,   228,   248,   218,   190,   248,
-     225,   226,   141,   248,   248,    23,    57,   142,   224,   237,
-     143,   218,    11,   142,   143,   186,   153,    43,    70,   103,
-     126,   159,   248,   248,   141,   141,   162,   142,   143,    82,
-     155,   223,   192,   220,   224,     8,     9,    10,    11,    12,
-      13,    14,    15,    16,    17,    18,    19,    77,   243,    20,
-     238,   240,   142,   120,   224,   233,   236,   224,    61,   142,
-      71,    71,   142,   195,    31,   197,   198,    72,    79,    87,
-     109,   194,   143,   197,    37,   124,   193,    73,   200,    99,
-     207,   208,   142,   237,   142,   143,   180,   224,   248,   141,
-      85,    85,   141,    55,    62,   176,   241,   242,   248,   128,
-     159,   160,   161,   153,    10,    43,    53,    92,   103,   108,
-     126,   156,   157,   158,   142,   221,   222,    17,    18,    19,
-      77,   224,   141,   192,   224,    10,    92,   142,   143,   129,
-     224,   120,    61,   224,     7,   142,   198,    97,    97,    97,
-      84,   195,     7,     7,   197,    40,    75,   201,    40,   142,
-      96,   209,   142,   224,   220,   141,   141,   247,     5,    65,
-      94,    95,   123,   249,   142,   143,   142,   143,    35,    38,
-      39,   116,   171,   143,   134,   163,    92,   141,   238,    85,
-     248,   156,   224,   141,   192,     9,   237,    92,   238,   141,
-     224,   142,    69,   142,   196,   101,   101,   237,   220,    96,
-     202,   237,    40,   106,   112,   210,   211,   142,   247,   247,
-     142,    55,    62,   241,   141,   172,   159,    36,    99,   164,
-     220,   141,     9,   237,   224,   142,   240,     7,    95,    40,
-      88,   203,   214,   215,   224,    19,   142,   142,     5,   249,
-     166,   167,   168,   169,   170,   248,   141,    40,   142,   248,
-     224,   142,   142,   142,   220,   214,     7,   133,   204,   205,
-     206,   143,    32,    56,   216,     7,    48,   125,   212,   108,
-     142,   143,     7,    29,   141,   248,   166,    74,   106,   165,
-     142,   248,   206,   215,    93,   217,   102,   110,   102,     9,
-     248,   167,   247,   142,   141,    31,    66,    86,     7,    48,
-     125,   213,   141,   142,   247,   141,    68,   110,    68,   247,
-     142,   207,   142,   100,   142,     7
-};
-
-  /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
-static const yytype_uint8 yyr1[] =
-{
-       0,   145,   146,   146,   146,   146,   146,   146,   147,   147,
-     147,   147,   147,   147,   147,   147,   147,   147,   148,   149,
-     149,   149,   149,   150,   151,   152,   153,   154,   154,   155,
-     155,   155,   155,   155,   155,   155,   155,   155,   155,   155,
-     155,   155,   155,   155,   155,   155,   155,   156,   156,   156,
-     156,   156,   156,   156,   157,   157,   158,   158,   159,   159,
-     159,   159,   160,   160,   161,   161,   162,   162,   163,   163,
-     164,   164,   165,   165,   166,   166,   167,   167,   167,   168,
-     168,   169,   170,   171,   171,   171,   171,   172,   172,   173,
-     173,   173,   173,   174,   175,   175,   176,   176,   176,   176,
-     177,   178,   179,   179,   180,   181,   181,   182,   182,   183,
-     184,   184,   185,   186,   187,   187,   187,   188,   188,   189,
-     189,   190,   190,   190,   191,   192,   193,   193,   193,   194,
-     194,   194,   194,   194,   194,   194,   194,   195,   195,   196,
-     196,   196,   196,   196,   196,   197,   197,   198,   198,   199,
-     199,   200,   200,   201,   201,   202,   202,   203,   203,   204,
-     204,   205,   205,   206,   207,   208,   208,   209,   209,   210,
-     210,   211,   211,   212,   212,   212,   213,   213,   213,   214,
-     214,   215,   216,   216,   216,   217,   217,   217,   218,   218,
-     219,   220,   220,   221,   221,   222,   222,   223,   223,   223,
-     223,   223,   223,   223,   223,   223,   223,   223,   224,   224,
-     225,   225,   226,   226,   227,   227,   227,   227,   227,   227,
-     227,   227,   227,   227,   228,   228,   228,   228,   229,   230,
-     230,   231,   231,   232,   232,   233,   234,   234,   235,   236,
-     236,   237,   237,   238,   238,   238,   238,   238,   238,   238,
-     238,   239,   239,   239,   239,   239,   239,   240,   240,   241,
-     241,   242,   242,   243,   243,   243,   243,   243,   243,   243,
-     243,   243,   243,   244,   245,   245,   246,   246,   246,   247,
-     247,   248,   248,   249,   249,   249,   249,   250,   251,   251
-};
-
-  /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN.  */
-static const yytype_uint8 yyr2[] =
-{
-       0,     2,     2,     2,     2,     2,     1,     1,     1,     1,
-       1,     1,     1,     1,     1,     1,     1,     1,     1,     6,
-       6,     6,     6,     9,     9,     3,     3,     1,     3,     1,
-       1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
-       1,     1,     1,     2,     2,     4,     4,     1,     2,     1,
-       2,     2,     4,     5,     2,     1,     0,     1,     4,     5,
-      10,     4,     3,     1,     0,     1,     0,     3,     0,     5,
-       0,     8,     1,     1,     1,     3,     1,     1,     1,     2,
-       2,     4,     2,     1,     1,     1,     1,     0,     3,    10,
-       7,     4,     5,     5,     0,     4,     2,     2,     4,     4,
-       5,     4,     3,     1,     3,     2,     3,     0,     3,     2,
-       1,     3,     3,    10,     0,     1,     1,     1,     1,     1,
-       3,     3,     2,     1,     2,     3,     0,     3,     3,     0,
-       1,     1,     2,     1,     2,     1,     2,     6,     1,     2,
-       3,     2,     2,     1,     3,     1,     2,     1,     4,     1,
-       3,     0,     3,     0,     2,     0,     3,     0,     2,     0,
-       1,     1,     2,     6,     3,     0,     3,     0,     3,     0,
-       5,     1,     1,     2,     2,     2,     2,     2,     2,     1,
-       3,     3,     0,     1,     1,     0,     2,     2,     0,     1,
-       2,     3,     1,     3,     1,     2,     1,     5,     6,     4,
-       3,     3,     3,     2,     3,     5,     4,     6,     3,     1,
-       3,     1,     2,     1,     1,     1,     1,     3,     5,     1,
-       1,     1,     3,     1,     3,     4,     4,     5,     6,     6,
-       8,     5,     4,     1,     2,     4,     1,     2,     4,     0,
-       2,     1,     3,     1,     1,     2,     2,     1,     2,     3,
-       2,     1,     1,     1,     1,     1,     1,     1,     3,     1,
-       3,     1,     3,     1,     1,     1,     1,     1,     1,     1,
-       2,     1,     2,     1,     1,     1,     1,     1,     1,     1,
-       3,     1,     1,     1,     1,     1,     1,     2,     2,     0
-};
-
-
-#define yyerrok         (yyerrstatus = 0)
-#define yyclearin       (yychar = YYEMPTY)
-#define YYEMPTY         (-2)
-#define YYEOF           0
-
-#define YYACCEPT        goto yyacceptlab
-#define YYABORT         goto yyabortlab
-#define YYERROR         goto yyerrorlab
-
-
-#define YYRECOVERING()  (!!yyerrstatus)
-
-#define YYBACKUP(Token, Value)                                  \
-do                                                              \
-  if (yychar == YYEMPTY)                                        \
-    {                                                           \
-      yychar = (Token);                                         \
-      yylval = (Value);                                         \
-      YYPOPSTACK (yylen);                                       \
-      yystate = *yyssp;                                         \
-      goto yybackup;                                            \
-    }                                                           \
-  else                                                          \
-    {                                                           \
-      yyerror (&yylloc, yyscanner, parsedStatement, YY_("syntax error: cannot back up")); \
-      YYERROR;                                                  \
-    }                                                           \
-while (0)
-
-/* Error token number */
-#define YYTERROR        1
-#define YYERRCODE       256
-
-
-/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
-   If N is 0, then set CURRENT to the empty location which ends
-   the previous symbol: RHS[0] (always defined).  */
-
-#ifndef YYLLOC_DEFAULT
-# define YYLLOC_DEFAULT(Current, Rhs, N)                                \
-    do                                                                  \
-      if (N)                                                            \
-        {                                                               \
-          (Current).first_line   = YYRHSLOC (Rhs, 1).first_line;        \
-          (Current).first_column = YYRHSLOC (Rhs, 1).first_column;      \
-          (Current).last_line    = YYRHSLOC (Rhs, N).last_line;         \
-          (Current).last_column  = YYRHSLOC (Rhs, N).last_column;       \
-        }                                                               \
-      else                                                              \
-        {                                                               \
-          (Current).first_line   = (Current).last_line   =              \
-            YYRHSLOC (Rhs, 0).last_line;                                \
-          (Current).first_column = (Current).last_column =              \
-            YYRHSLOC (Rhs, 0).last_column;                              \
-        }                                                               \
-    while (0)
-#endif
-
-#define YYRHSLOC(Rhs, K) ((Rhs)[K])
-
-
-/* Enable debugging if requested.  */
-#if YYDEBUG
-
-# ifndef YYFPRINTF
-#  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
-#  define YYFPRINTF fprintf
-# endif
-
-# define YYDPRINTF(Args)                        \
-do {                                            \
-  if (yydebug)                                  \
-    YYFPRINTF Args;                             \
-} while (0)
-
-
-/* YY_LOCATION_PRINT -- Print the location on the stream.
-   This macro was not mandated originally: define only if we know
-   we won't break user code: when these are the locations we know.  */
-
-#ifndef YY_LOCATION_PRINT
-# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
-
-/* Print *YYLOCP on YYO.  Private, do not rely on its existence. */
-
-YY_ATTRIBUTE_UNUSED
-static unsigned
-yy_location_print_ (FILE *yyo, YYLTYPE const * const yylocp)
-{
-  unsigned res = 0;
-  int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0;
-  if (0 <= yylocp->first_line)
-    {
-      res += YYFPRINTF (yyo, "%d", yylocp->first_line);
-      if (0 <= yylocp->first_column)
-        res += YYFPRINTF (yyo, ".%d", yylocp->first_column);
-    }
-  if (0 <= yylocp->last_line)
-    {
-      if (yylocp->first_line < yylocp->last_line)
-        {
-          res += YYFPRINTF (yyo, "-%d", yylocp->last_line);
-          if (0 <= end_col)
-            res += YYFPRINTF (yyo, ".%d", end_col);
-        }
-      else if (0 <= end_col && yylocp->first_column < end_col)
-        res += YYFPRINTF (yyo, "-%d", end_col);
-    }
-  return res;
- }
-
-#  define YY_LOCATION_PRINT(File, Loc)          \
-  yy_location_print_ (File, &(Loc))
-
-# else
-#  define YY_LOCATION_PRINT(File, Loc) ((void) 0)
-# endif
-#endif
-
-
-# define YY_SYMBOL_PRINT(Title, Type, Value, Location)                    \
-do {                                                                      \
-  if (yydebug)                                                            \
-    {                                                                     \
-      YYFPRINTF (stderr, "%s ", Title);                                   \
-      yy_symbol_print (stderr,                                            \
-                  Type, Value, Location, yyscanner, parsedStatement); \
-      YYFPRINTF (stderr, "\n");                                           \
-    }                                                                     \
-} while (0)
-
-
-/*----------------------------------------.
-| Print this symbol's value on YYOUTPUT.  |
-`----------------------------------------*/
-
-static void
-yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, yyscan_t yyscanner, quickstep::ParseStatement **parsedStatement)
-{
-  FILE *yyo = yyoutput;
-  YYUSE (yyo);
-  YYUSE (yylocationp);
-  YYUSE (yyscanner);
-  YYUSE (parsedStatement);
-  if (!yyvaluep)
-    return;
-# ifdef YYPRINT
-  if (yytype < YYNTOKENS)
-    YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
-# endif
-  YYUSE (yytype);
-}
-
-
-/*--------------------------------.
-| Print this symbol on YYOUTPUT.  |
-`--------------------------------*/
-
-static void
-yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, yyscan_t yyscanner, quickstep::ParseStatement **parsedStatement)
-{
-  YYFPRINTF (yyoutput, "%s %s (",
-             yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
-
-  YY_LOCATION_PRINT (yyoutput, *yylocationp);
-  YYFPRINTF (yyoutput, ": ");
-  yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, yyscanner, parsedStatement);
-  YYFPRINTF (yyoutput, ")");
-}
-
-/*------------------------------------------------------------------.
-| yy_stack_print -- Print the state stack from its BOTTOM up to its |
-| TOP (included).                                                   |
-`------------------------------------------------------------------*/
-
-static void
-yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
-{
-  YYFPRINTF (stderr, "Stack now");
-  for (; yybottom <= yytop; yybottom++)
-    {
-      int yybot = *yybottom;
-      YYFPRINTF (stderr, " %d", yybot);
-    }
-  YYFPRINTF (stderr, "\n");
-}
-
-# define YY_STACK_PRINT(Bottom, Top)                            \
-do {                                                            \
-  if (yydebug)                                                  \
-    yy_stack_print ((Bottom), (Top));                           \
-} while (0)
-
-
-/*------------------------------------------------.
-| Report that the YYRULE is going to be reduced.  |
-`------------------------------------------------*/
-
-static void
-yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule, yyscan_t yyscanner, quickstep::ParseStatement **parsedStatement)
-{
-  unsigned long int yylno = yyrline[yyrule];
-  int yynrhs = yyr2[yyrule];
-  int yyi;
-  YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
-             yyrule - 1, yylno);
-  /* The symbols being reduced.  */
-  for (yyi = 0; yyi < yynrhs; yyi++)
-    {
-      YYFPRINTF (stderr, "   $%d = ", yyi + 1);
-      yy_symbol_print (stderr,
-                       yystos[yyssp[yyi + 1 - yynrhs]],
-                       &(yyvsp[(yyi + 1) - (yynrhs)])
-                       , &(yylsp[(yyi + 1) - (yynrhs)])                       , yyscanner, parsedStatement);
-      YYFPRINTF (stderr, "\n");
-    }
-}
-
-# define YY_REDUCE_PRINT(Rule)          \
-do {                                    \
-  if (yydebug)                          \
-    yy_reduce_print (yyssp, yyvsp, yylsp, Rule, yyscanner, parsedStatement); \
-} while (0)
-
-/* Nonzero means print parse trace.  It is left uninitialized so that
-   multiple parsers can coexist.  */
-int yydebug;
-#else /* !YYDEBUG */
-# define YYDPRINTF(Args)
-# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
-# define YY_STACK_PRINT(Bottom, Top)
-# define YY_REDUCE_PRINT(Rule)
-#endif /* !YYDEBUG */
-
-
-/* YYINITDEPTH -- initial size of the parser's stacks.  */
-#ifndef YYINITDEPTH
-# define YYINITDEPTH 200
-#endif
-
-/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
-   if the built-in stack extension method is used).
-
-   Do not make this value too large; the results are undefined if
-   YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
-   evaluated with infinite-precision integer arithmetic.  */
-
-#ifndef YYMAXDEPTH
-# define YYMAXDEPTH 10000
-#endif
-
-
-#if YYERROR_VERBOSE
-
-# ifndef yystrlen
-#  if defined __GLIBC__ && defined _STRING_H
-#   define yystrlen strlen
-#  else
-/* Return the length of YYSTR.  */
-static YYSIZE_T
-yystrlen (const char *yystr)
-{
-  YYSIZE_T yylen;
-  for (yylen = 0; yystr[yylen]; yylen++)
-    continue;
-  return yylen;
-}
-#  endif
-# endif
-
-# ifndef yystpcpy
-#  if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
-#   define yystpcpy stpcpy
-#  else
-/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
-   YYDEST.  */
-static char *
-yystpcpy (char *yydest, const char *yysrc)
-{
-  char *yyd = yydest;
-  const char *yys = yysrc;
-
-  while ((*yyd++ = *yys++) != '\0')
-    continue;
-
-  return yyd - 1;
-}
-#  endif
-# endif
-
-# ifndef yytnamerr
-/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
-   quotes and backslashes, so that it's suitable for yyerror.  The
-   heuristic is that double-quoting is unnecessary unless the string
-   contains an apostrophe, a comma, or backslash (other than
-   backslash-backslash).  YYSTR is taken from yytname.  If YYRES is
-   null, do not copy; instead, return the length of what the result
-   would have been.  */
-static YYSIZE_T
-yytnamerr (char *yyres, const char *yystr)
-{
-  if (*yystr == '"')
-    {
-      YYSIZE_T yyn = 0;
-      char const *yyp = yystr;
-
-      for (;;)
-        switch (*++yyp)
-          {
-          case '\'':
-          case ',':
-            goto do_not_strip_quotes;
-
-          case '\\':
-            if (*++yyp != '\\')
-              goto do_not_strip_quotes;
-            /* Fall through.  */
-          default:
-            if (yyres)
-              yyres[yyn] = *yyp;
-            yyn++;
-            break;
-
-          case '"':
-            if (yyres)
-              yyres[yyn] = '\0';
-            return yyn;
-          }
-    do_not_strip_quotes: ;
-    }
-
-  if (! yyres)
-    return yystrlen (yystr);
-
-  return yystpcpy (yyres, yystr) - yyres;
-}
-# endif
-
-/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
-   about the unexpected token YYTOKEN for the state stack whose top is
-   YYSSP.
-
-   Return 0 if *YYMSG was successfully written.  Return 1 if *YYMSG is
-   not large enough to hold the message.  In that case, also set
-   *YYMSG_ALLOC to the required number of bytes.  Return 2 if the
-   required number of bytes is too large to store.  */
-static int
-yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
-                yytype_int16 *yyssp, int yytoken)
-{
-  YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
-  YYSIZE_T yysize = yysize0;
-  enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
-  /* Internationalized format string. */
-  const char *yyformat = YY_NULLPTR;
-  /* Arguments of yyformat. */
-  char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
-  /* Number of reported tokens (one for the "unexpected", one per
-     "expected"). */
-  int yycount = 0;
-
-  /* There are many possibilities here to consider:
-     - If this state is a consistent state with a default action, then
-       the only way this function was invoked is if the default action
-       is an error action.  In that case, don't check for expected
-       tokens because there are none.
-     - The only way there can be no lookahead present (in yychar) is if
-       this state is a consistent state with a default action.  Thus,
-       detecting the absence of a lookahead is sufficient to determine
-       that there is no unexpected or expected token to report.  In that
-       case, just report a simple "syntax error".
-     - Don't assume there isn't a lookahead just because this state is a
-       consistent state with a default action.  There might have been a
-       previous inconsistent state, consistent state with a non-default
-       action, or user semantic action that manipulated yychar.
-     - Of course, the expected token list depends on states to have
-       correct lookahead information, and it depends on the parser not
-       to perform extra reductions after fetching a lookahead from the
-       scanner and before detecting a syntax error.  Thus, state merging
-       (from LALR or IELR) and default reductions corrupt the expected
-       token list.  However, the list is correct for canonical LR with
-       one exception: it will still contain any token that will not be
-       accepted due to an error action in a later state.
-  */
-  if (yytoken != YYEMPTY)
-    {
-      int yyn = yypact[*yyssp];
-      yyarg[yycount++] = yytname[yytoken];
-      if (!yypact_value_is_default (yyn))
-        {
-          /* Start YYX at -YYN if negative to avoid negative indexes in
-             YYCHECK.  In other words, skip the first -YYN actions for
-             this state because they are default actions.  */
-          int yyxbegin = yyn < 0 ? -yyn : 0;
-          /* Stay within bounds of both yycheck and yytname.  */
-          int yychecklim = YYLAST - yyn + 1;
-          int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
-          int yyx;
-
-          for (yyx = yyxbegin; yyx < yyxend; ++yyx)
-            if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
-                && !yytable_value_is_error (yytable[yyx + yyn]))
-              {
-                if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
-                  {
-                    yycount = 1;
-                    yysize = yysize0;
-                    break;
- 

<TRUNCATED>


[42/51] [abbrv] [partial] incubator-quickstep git commit: remove c++ files

Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/compression/tests/CompressionDictionary_unittest.cpp
----------------------------------------------------------------------
diff --git a/compression/tests/CompressionDictionary_unittest.cpp b/compression/tests/CompressionDictionary_unittest.cpp
deleted file mode 100644
index 92bd361..0000000
--- a/compression/tests/CompressionDictionary_unittest.cpp
+++ /dev/null
@@ -1,2290 +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 <algorithm>
-#include <cstddef>
-#include <cstdint>
-#include <cstring>
-#include <limits>
-#include <memory>
-#include <string>
-#include <utility>
-#include <vector>
-
-#include "compression/CompressionDictionary.hpp"
-#include "compression/CompressionDictionaryBuilder.hpp"
-#include "types/CharType.hpp"
-#include "types/DoubleType.hpp"
-#include "types/IntType.hpp"
-#include "types/Type.hpp"
-#include "types/TypeFactory.hpp"
-#include "types/TypeID.hpp"
-#include "types/TypedValue.hpp"
-#include "types/VarCharType.hpp"
-#include "types/operations/comparisons/Comparison.hpp"
-#include "types/operations/comparisons/ComparisonFactory.hpp"
-#include "types/operations/comparisons/ComparisonID.hpp"
-#include "utility/ScopedBuffer.hpp"
-
-#include "gtest/gtest.h"
-
-using std::numeric_limits;
-using std::pair;
-using std::size_t;
-using std::sort;
-using std::string;
-using std::strlen;
-using std::uint8_t;
-using std::uint32_t;
-using std::vector;
-
-namespace quickstep {
-
-class CompressionDictionaryTest : public ::testing::TestWithParam<bool> {
- protected:
-  static const uint32_t kNumSampleValues = 24;
-  static const int kSampleInts[kNumSampleValues];
-  static const char *kSampleStrings[kNumSampleValues];
-
-  static const size_t kVarCharSizeParameter = 32;
-
-  static uint8_t bitsNeededForCodes(int num_codes) {
-    if (num_codes == 0) {
-      return 0;
-    }
-    for (uint8_t num_bits = 1; num_bits < 32; ++num_bits) {
-      if ((1 << num_bits) >= num_codes) {
-        return num_bits;
-      }
-    }
-
-    return 32;
-  }
-
-  void setupBuilderForType(const Type &type) {
-    dictionary_type_ = &type;
-    builder_.reset(new CompressionDictionaryBuilder(type));
-  }
-
-  void setupSampleIntDictionary() {
-    const IntType &int_type = IntType::Instance(GetParam());
-    setupBuilderForType(int_type);
-
-    for (uint32_t sample_idx = 0; sample_idx < kNumSampleValues; ++sample_idx) {
-      TypedValue current_value = int_type.makeValue(&(kSampleInts[sample_idx]));
-      ASSERT_TRUE(builder_->insertEntry(current_value));
-    }
-    // Also throw in a null value if we are testing a nullable type.
-    if (GetParam()) {
-      ASSERT_TRUE(builder_->insertEntry(TypedValue(kInt)));
-    }
-    ASSERT_EQ(kNumSampleValues + GetParam(), builder_->numberOfEntries());
-
-    // Build the physical dictionary.
-    dictionary_memory_.reset(builder_->dictionarySizeBytes());
-    builder_->buildDictionary(dictionary_memory_.get());
-
-    // Construct the dictionary object.
-    dictionary_.reset(new CompressionDictionary(int_type,
-                                                dictionary_memory_.get(),
-                                                builder_->dictionarySizeBytes()));
-
-    // Delete the builder, we don't need it anymore.
-    builder_.reset();
-  }
-
-  void setupSampleVarCharDictionary() {
-    const VarCharType &varchar_type = VarCharType::Instance(kVarCharSizeParameter, GetParam());
-    setupBuilderForType(varchar_type);
-
-    for (uint32_t sample_idx = 0; sample_idx < kNumSampleValues; ++sample_idx) {
-      TypedValue current_value = varchar_type.makeValue(kSampleStrings[sample_idx],
-                                                        strlen(kSampleStrings[sample_idx]) + 1);
-      ASSERT_TRUE(builder_->insertEntry(current_value));
-    }
-    // Also throw in a null value if we are testing a nullable type.
-    if (GetParam()) {
-      ASSERT_TRUE(builder_->insertEntry(TypedValue(kVarChar)));
-    }
-    ASSERT_EQ(kNumSampleValues + GetParam(), builder_->numberOfEntries());
-
-    // Build the physical dictionary.
-    dictionary_memory_.reset(builder_->dictionarySizeBytes());
-    builder_->buildDictionary(dictionary_memory_.get());
-
-    // Construct the dictionary object.
-    dictionary_.reset(new CompressionDictionary(varchar_type,
-                                                dictionary_memory_.get(),
-                                                builder_->dictionarySizeBytes()));
-
-    // Delete the builder, we don't need it anymore.
-    builder_.reset();
-  }
-
-  const Type *dictionary_type_;
-  std::unique_ptr<CompressionDictionaryBuilder> builder_;
-  std::unique_ptr<CompressionDictionary> dictionary_;
-  ScopedBuffer dictionary_memory_;
-};
-
-const uint32_t CompressionDictionaryTest::kNumSampleValues;
-
-const int CompressionDictionaryTest::kSampleInts[]
-    = { 0, 5, -5, 1, 2, 3, -1000, 1000, -1, -2, -3, 500,
-        42, 55, -12, 85, -1234, 92, 43, 41, -6464, 50, 9999, -10};
-
-const char *CompressionDictionaryTest::kSampleStrings[] = {
-  "Twilight Sparkle",
-  "Rarity",
-  "Pinkie Pie",
-  "Applejack",
-  "Rainbow Dash",
-  "Fluttershy",
-  "Celestia",
-  "Luna",
-  "Cadence",
-  "Applebloom",
-  "Scootaloo",
-  "Sweetie Belle",
-  "Zecora",
-  "Big Macintosh",
-  "Granny Smith",
-  "Shining Armor",
-  "Cheerilee",
-  "Diamond Tiara",
-  "Silver Spoon",
-  "Photo Finish",
-  "DJ Pon-3",
-  "Snips",
-  "Snails",
-  "Derpy Hooves"
-};
-
-const size_t CompressionDictionaryTest::kVarCharSizeParameter;
-
-typedef CompressionDictionaryTest CompressionDictionaryDeathTest;
-
-TEST_P(CompressionDictionaryDeathTest, LimitCodesNotEqualTest) {
-  setupSampleIntDictionary();
-  int value = 0;
-  EXPECT_DEATH(dictionary_->getLimitCodesForComparisonUntyped(ComparisonID::kNotEqual, &value), "");
-}
-
-// Some tests are only run for debug builds, which have assertions turned on.
-#ifdef QUICKSTEP_DEBUG
-
-TEST_P(CompressionDictionaryDeathTest, UndoInsertOnEmptyBuilderTest) {
-  setupBuilderForType(TypeFactory::GetType(kInt));
-  EXPECT_DEATH(builder_->undoLastInsert(), "");
-}
-
-TEST_P(CompressionDictionaryDeathTest, BuilderInsertWrongTypeTest) {
-  setupBuilderForType(TypeFactory::GetType(kInt));
-
-  double double_literal = 12.34;
-  TypedValue value = TypeFactory::GetType(kDouble).makeValue(&double_literal);
-  EXPECT_DEATH(builder_->insertEntry(value), "");
-}
-
-TEST_P(CompressionDictionaryDeathTest, BuilderInsertWrongTypeByReferenceTest) {
-  setupBuilderForType(TypeFactory::GetType(kInt));
-
-  double double_literal = 12.34;
-  TypedValue value = TypeFactory::GetType(kDouble).makeValue(&double_literal);
-  EXPECT_DEATH(builder_->insertEntryByReference(value), "");
-}
-
-TEST_P(CompressionDictionaryDeathTest, BuilderContainsWrongTypeTest) {
-  setupBuilderForType(TypeFactory::GetType(kInt));
-
-  double double_literal = 12.34;
-  TypedValue value = TypeFactory::GetType(kDouble).makeValue(&double_literal);
-  EXPECT_DEATH(builder_->containsValue(value), "");
-}
-
-TEST_P(CompressionDictionaryDeathTest, GetValueForNonexistentCodeTest) {
-  setupSampleIntDictionary();
-
-  EXPECT_DEATH(dictionary_->getUntypedValueForCode(kNumSampleValues + GetParam()), "");
-}
-
-#endif  // QUICKSTEP_DEBUG
-
-TEST_P(CompressionDictionaryTest, IntKeyBuildTest) {
-  const IntType &int_type = IntType::Instance(GetParam());
-  TypedValue current_value;
-
-  // Construct a CompressionDictionaryBuilder and check its initial state.
-  setupBuilderForType(int_type);
-  EXPECT_EQ(0u, builder_->numberOfEntries());
-  EXPECT_EQ(bitsNeededForCodes(0), builder_->codeLengthBits());
-  EXPECT_EQ(2 * sizeof(uint32_t), builder_->dictionarySizeBytes());
-
-  // If the type is nullable, try inserting a null first.
-  if (GetParam()) {
-    current_value = TypedValue(kInt);
-    EXPECT_TRUE(builder_->insertEntry(current_value));
-    EXPECT_TRUE(builder_->containsValue(current_value));
-    EXPECT_EQ(1u, builder_->numberOfEntries());
-    EXPECT_EQ(bitsNeededForCodes(1), builder_->codeLengthBits());
-    EXPECT_EQ(2 * sizeof(uint32_t), builder_->dictionarySizeBytes());
-
-    // Roll back to zero entries.
-    builder_->undoLastInsert();
-    EXPECT_FALSE(builder_->containsValue(current_value));
-    EXPECT_EQ(0u, builder_->numberOfEntries());
-    EXPECT_EQ(bitsNeededForCodes(0), builder_->codeLengthBits());
-    EXPECT_EQ(2 * sizeof(uint32_t), builder_->dictionarySizeBytes());
-  }
-
-  // Add a value.
-  current_value = TypedValue(kSampleInts[0]);
-  EXPECT_TRUE(builder_->insertEntry(current_value));
-  EXPECT_TRUE(builder_->containsValue(current_value));
-  EXPECT_EQ(1u, builder_->numberOfEntries());
-  EXPECT_EQ(bitsNeededForCodes(1), builder_->codeLengthBits());
-  EXPECT_EQ(2 * sizeof(uint32_t) + int_type.maximumByteLength(), builder_->dictionarySizeBytes());
-
-  // Roll back to zero entries.
-  builder_->undoLastInsert();
-  EXPECT_FALSE(builder_->containsValue(current_value));
-  EXPECT_EQ(0u, builder_->numberOfEntries());
-  EXPECT_EQ(bitsNeededForCodes(0), builder_->codeLengthBits());
-  EXPECT_EQ(2 * sizeof(uint32_t), builder_->dictionarySizeBytes());
-
-  // Re-add the value.
-  EXPECT_TRUE(builder_->insertEntry(current_value));
-  EXPECT_TRUE(builder_->containsValue(current_value));
-  EXPECT_EQ(1u, builder_->numberOfEntries());
-  EXPECT_EQ(bitsNeededForCodes(1), builder_->codeLengthBits());
-  EXPECT_EQ(2 * sizeof(uint32_t) + int_type.maximumByteLength(), builder_->dictionarySizeBytes());
-
-  // If the type is nullable, also try inserting a null with a real value
-  // present.
-  if (GetParam()) {
-    current_value = TypedValue(kInt);
-    EXPECT_TRUE(builder_->insertEntry(current_value));
-    EXPECT_TRUE(builder_->containsValue(current_value));
-    EXPECT_EQ(2u, builder_->numberOfEntries());
-    EXPECT_EQ(bitsNeededForCodes(2), builder_->codeLengthBits());
-    EXPECT_EQ(2 * sizeof(uint32_t) + int_type.maximumByteLength(), builder_->dictionarySizeBytes());
-
-    // Roll back insert of null.
-    builder_->undoLastInsert();
-    EXPECT_FALSE(builder_->containsValue(current_value));
-    EXPECT_EQ(1u, builder_->numberOfEntries());
-    EXPECT_EQ(bitsNeededForCodes(1), builder_->codeLengthBits());
-    EXPECT_EQ(2 * sizeof(uint32_t) + int_type.maximumByteLength(), builder_->dictionarySizeBytes());
-
-    // Finally, re-insert the null.
-    EXPECT_TRUE(builder_->insertEntry(current_value));
-    EXPECT_TRUE(builder_->containsValue(current_value));
-    EXPECT_EQ(2u, builder_->numberOfEntries());
-    EXPECT_EQ(bitsNeededForCodes(2), builder_->codeLengthBits());
-    EXPECT_EQ(2 * sizeof(uint32_t) + int_type.maximumByteLength(), builder_->dictionarySizeBytes());
-  }
-
-  // Add a second value.
-  current_value = TypedValue(kSampleInts[1]);
-  EXPECT_TRUE(builder_->insertEntry(current_value));
-  EXPECT_TRUE(builder_->containsValue(current_value));
-  EXPECT_EQ(2u + GetParam(), builder_->numberOfEntries());
-  EXPECT_EQ(bitsNeededForCodes(2 + GetParam()), builder_->codeLengthBits());
-  EXPECT_EQ(2 * sizeof(uint32_t) + 2 * int_type.maximumByteLength(),
-            builder_->dictionarySizeBytes());
-
-  // Add a third value.
-  current_value = TypedValue(kSampleInts[2]);
-  EXPECT_TRUE(builder_->insertEntry(current_value));
-  EXPECT_TRUE(builder_->containsValue(current_value));
-  EXPECT_EQ(3u + GetParam(), builder_->numberOfEntries());
-  EXPECT_EQ(bitsNeededForCodes(3 + GetParam()), builder_->codeLengthBits());
-  EXPECT_EQ(2 * sizeof(uint32_t) + 3 * int_type.maximumByteLength(), builder_->dictionarySizeBytes());
-
-  // Roll it back (this is the last time we will check this, we just need to
-  // cover all the possible paths where the code length may shrink).
-  builder_->undoLastInsert();
-  EXPECT_FALSE(builder_->containsValue(current_value));
-  EXPECT_EQ(2u + GetParam(), builder_->numberOfEntries());
-  EXPECT_EQ(bitsNeededForCodes(2 + GetParam()), builder_->codeLengthBits());
-  EXPECT_EQ(2 * sizeof(uint32_t) + 2 * int_type.maximumByteLength(), builder_->dictionarySizeBytes());
-
-  // Insert the rest of the sample values.
-  for (uint32_t sample_idx = 2; sample_idx < kNumSampleValues; ++sample_idx) {
-    current_value = TypedValue(kSampleInts[sample_idx]);
-    EXPECT_TRUE(builder_->insertEntry(current_value));
-    EXPECT_TRUE(builder_->containsValue(current_value));
-    EXPECT_EQ(sample_idx + 1 + GetParam(), builder_->numberOfEntries());
-    EXPECT_EQ(bitsNeededForCodes(sample_idx + 1 + GetParam()), builder_->codeLengthBits());
-    EXPECT_EQ(2 * sizeof(uint32_t) + (sample_idx + 1) * int_type.maximumByteLength(),
-              builder_->dictionarySizeBytes());
-  }
-
-  // Attempt to insert a duplicate entry.
-  current_value = TypedValue(kSampleInts[kNumSampleValues >> 1]);
-  EXPECT_FALSE(builder_->insertEntry(current_value));
-  EXPECT_TRUE(builder_->containsValue(current_value));
-  EXPECT_EQ(kNumSampleValues + GetParam(), builder_->numberOfEntries());
-  EXPECT_EQ(bitsNeededForCodes(kNumSampleValues + GetParam()), builder_->codeLengthBits());
-  EXPECT_EQ(2 * sizeof(uint32_t) + kNumSampleValues * int_type.maximumByteLength(),
-            builder_->dictionarySizeBytes());
-
-  // If type is nullable, attempt to insert a duplicate null.
-  if (GetParam()) {
-    current_value = TypedValue(kInt);
-    EXPECT_FALSE(builder_->insertEntry(current_value));
-    EXPECT_TRUE(builder_->containsValue(current_value));
-    EXPECT_EQ(kNumSampleValues + GetParam(), builder_->numberOfEntries());
-    EXPECT_EQ(bitsNeededForCodes(kNumSampleValues + GetParam()), builder_->codeLengthBits());
-    EXPECT_EQ(2 * sizeof(uint32_t) + kNumSampleValues * int_type.maximumByteLength(),
-              builder_->dictionarySizeBytes());
-  }
-
-  // Check for the presence of a nonexistent key.
-  current_value = TypedValue(7777);
-  EXPECT_FALSE(builder_->containsValue(current_value));
-
-  // Actually build the physical dictionary.
-  dictionary_memory_.reset(builder_->dictionarySizeBytes());
-  builder_->buildDictionary(dictionary_memory_.get());
-
-  // Check the contents of the physical dictionary.
-  vector<int> sorted_sample_ints(kSampleInts, kSampleInts + kNumSampleValues);
-  sort(sorted_sample_ints.begin(), sorted_sample_ints.end());
-  const int *value_array = reinterpret_cast<const int*>(
-      static_cast<const char*>(dictionary_memory_.get()) + 2 * sizeof(uint32_t));
-
-  EXPECT_EQ(kNumSampleValues, *static_cast<const uint32_t*>(dictionary_memory_.get()));
-  if (GetParam()) {
-    EXPECT_EQ(kNumSampleValues,
-              *(static_cast<const uint32_t*>(dictionary_memory_.get()) + 1));
-  } else {
-    EXPECT_EQ(numeric_limits<uint32_t>::max(),
-              *(static_cast<const uint32_t*>(dictionary_memory_.get()) + 1));
-  }
-  for (uint32_t sample_idx = 0; sample_idx < kNumSampleValues; ++sample_idx) {
-    EXPECT_EQ(sorted_sample_ints[sample_idx], value_array[sample_idx]);
-  }
-}
-
-// Same test as above, but insert values via insertEntryByReference().
-TEST_P(CompressionDictionaryTest, IntKeyBuildInsertByReferenceTest) {
-  const IntType &int_type = IntType::Instance(GetParam());
-  std::vector<TypedValue> values;
-  TypedValue other_value;
-  TypedValue null_value(kInt);
-
-  // Construct a CompressionDictionaryBuilder and check its initial state.
-  setupBuilderForType(int_type);
-  EXPECT_EQ(0u, builder_->numberOfEntries());
-  EXPECT_EQ(bitsNeededForCodes(0), builder_->codeLengthBits());
-  EXPECT_EQ(2 * sizeof(uint32_t), builder_->dictionarySizeBytes());
-
-  // If the type is nullable, try inserting a null first.
-  if (GetParam()) {
-    EXPECT_TRUE(builder_->insertEntryByReference(null_value));
-    EXPECT_TRUE(builder_->containsValue(null_value));
-    EXPECT_EQ(1u, builder_->numberOfEntries());
-    EXPECT_EQ(bitsNeededForCodes(1), builder_->codeLengthBits());
-    EXPECT_EQ(2 * sizeof(uint32_t), builder_->dictionarySizeBytes());
-
-    // Roll back to zero entries.
-    builder_->undoLastInsert();
-    EXPECT_FALSE(builder_->containsValue(null_value));
-    EXPECT_EQ(0u, builder_->numberOfEntries());
-    EXPECT_EQ(bitsNeededForCodes(0), builder_->codeLengthBits());
-    EXPECT_EQ(2 * sizeof(uint32_t), builder_->dictionarySizeBytes());
-  }
-
-  // Add a value.
-  values.push_back(TypedValue(kSampleInts[0]));
-  EXPECT_TRUE(builder_->insertEntryByReference(values.back()));
-  EXPECT_TRUE(builder_->containsValue(values.back()));
-  EXPECT_EQ(1u, builder_->numberOfEntries());
-  EXPECT_EQ(bitsNeededForCodes(1), builder_->codeLengthBits());
-  EXPECT_EQ(2 * sizeof(uint32_t) + int_type.maximumByteLength(), builder_->dictionarySizeBytes());
-
-  // Roll back to zero entries.
-  builder_->undoLastInsert();
-  EXPECT_FALSE(builder_->containsValue(values.back()));
-  EXPECT_EQ(0u, builder_->numberOfEntries());
-  EXPECT_EQ(bitsNeededForCodes(0), builder_->codeLengthBits());
-  EXPECT_EQ(2 * sizeof(uint32_t), builder_->dictionarySizeBytes());
-
-  // Re-add the value.
-  EXPECT_TRUE(builder_->insertEntryByReference(values.back()));
-  EXPECT_TRUE(builder_->containsValue(values.back()));
-  EXPECT_EQ(1u, builder_->numberOfEntries());
-  EXPECT_EQ(bitsNeededForCodes(1), builder_->codeLengthBits());
-  EXPECT_EQ(2 * sizeof(uint32_t) + int_type.maximumByteLength(), builder_->dictionarySizeBytes());
-
-  // If the type is nullable, also try inserting a null with a real value
-  // present.
-  if (GetParam()) {
-    EXPECT_TRUE(builder_->insertEntryByReference(null_value));
-    EXPECT_TRUE(builder_->containsValue(null_value));
-    EXPECT_EQ(2u, builder_->numberOfEntries());
-    EXPECT_EQ(bitsNeededForCodes(2), builder_->codeLengthBits());
-    EXPECT_EQ(2 * sizeof(uint32_t) + int_type.maximumByteLength(), builder_->dictionarySizeBytes());
-
-    // Roll back insert of null.
-    builder_->undoLastInsert();
-    EXPECT_FALSE(builder_->containsValue(null_value));
-    EXPECT_EQ(1u, builder_->numberOfEntries());
-    EXPECT_EQ(bitsNeededForCodes(1), builder_->codeLengthBits());
-    EXPECT_EQ(2 * sizeof(uint32_t) + int_type.maximumByteLength(), builder_->dictionarySizeBytes());
-
-    // Finally, re-insert the null.
-    EXPECT_TRUE(builder_->insertEntryByReference(null_value));
-    EXPECT_TRUE(builder_->containsValue(null_value));
-    EXPECT_EQ(2u, builder_->numberOfEntries());
-    EXPECT_EQ(bitsNeededForCodes(2), builder_->codeLengthBits());
-    EXPECT_EQ(2 * sizeof(uint32_t) + int_type.maximumByteLength(), builder_->dictionarySizeBytes());
-  }
-
-  // Add a second value.
-  values.push_back(TypedValue(kSampleInts[1]));
-  EXPECT_TRUE(builder_->insertEntryByReference(values.back()));
-  // Check against a different but equal value.
-  other_value = TypedValue(kSampleInts[1]);
-  EXPECT_TRUE(builder_->containsValue(other_value));
-  EXPECT_EQ(2u + GetParam(), builder_->numberOfEntries());
-  EXPECT_EQ(bitsNeededForCodes(2 + GetParam()), builder_->codeLengthBits());
-  EXPECT_EQ(2 * sizeof(uint32_t) + 2 * int_type.maximumByteLength(), builder_->dictionarySizeBytes());
-
-  // Add a third value.
-  values.push_back(TypedValue(kSampleInts[2]));
-  EXPECT_TRUE(builder_->insertEntryByReference(values.back()));
-  EXPECT_TRUE(builder_->containsValue(values.back()));
-  EXPECT_EQ(3u + GetParam(), builder_->numberOfEntries());
-  EXPECT_EQ(bitsNeededForCodes(3 + GetParam()), builder_->codeLengthBits());
-  EXPECT_EQ(2 * sizeof(uint32_t) + 3 * int_type.maximumByteLength(), builder_->dictionarySizeBytes());
-
-  // Roll it back (this is the last time we will check this, we just need to
-  // cover all the possible paths where the code length may shrink).
-  builder_->undoLastInsert();
-  EXPECT_FALSE(builder_->containsValue(values.back()));
-  EXPECT_EQ(2u + GetParam(), builder_->numberOfEntries());
-  EXPECT_EQ(bitsNeededForCodes(2 + GetParam()), builder_->codeLengthBits());
-  EXPECT_EQ(2 * sizeof(uint32_t) + 2 * int_type.maximumByteLength(), builder_->dictionarySizeBytes());
-
-  // Insert the rest of the sample values.
-  for (uint32_t sample_idx = 2; sample_idx < kNumSampleValues; ++sample_idx) {
-    values.push_back(TypedValue(kSampleInts[sample_idx]));
-    EXPECT_TRUE(builder_->insertEntryByReference(values.back()));
-    EXPECT_TRUE(builder_->containsValue(values.back()));
-    EXPECT_EQ(sample_idx + 1 + GetParam(), builder_->numberOfEntries());
-    EXPECT_EQ(bitsNeededForCodes(sample_idx + 1 + GetParam()), builder_->codeLengthBits());
-    EXPECT_EQ(2 * sizeof(uint32_t) + (sample_idx + 1) * int_type.maximumByteLength(),
-              builder_->dictionarySizeBytes());
-  }
-
-  // Attempt to insert a duplicate entry.
-  other_value = TypedValue(kSampleInts[kNumSampleValues >> 1]);
-  EXPECT_FALSE(builder_->insertEntryByReference(other_value));
-  EXPECT_TRUE(builder_->containsValue(other_value));
-  EXPECT_EQ(kNumSampleValues + GetParam(), builder_->numberOfEntries());
-  EXPECT_EQ(bitsNeededForCodes(kNumSampleValues + GetParam()), builder_->codeLengthBits());
-  EXPECT_EQ(2 * sizeof(uint32_t) + kNumSampleValues * int_type.maximumByteLength(),
-            builder_->dictionarySizeBytes());
-
-  // If type is nullable, attempt to insert a duplicate null.
-  if (GetParam()) {
-    EXPECT_FALSE(builder_->insertEntryByReference(null_value));
-    EXPECT_TRUE(builder_->containsValue(null_value));
-    EXPECT_EQ(kNumSampleValues + GetParam(), builder_->numberOfEntries());
-    EXPECT_EQ(bitsNeededForCodes(kNumSampleValues + GetParam()), builder_->codeLengthBits());
-    EXPECT_EQ(2 * sizeof(uint32_t) + kNumSampleValues * int_type.maximumByteLength(),
-              builder_->dictionarySizeBytes());
-  }
-
-  // Check for the presence of a nonexistent key.
-  other_value = TypedValue(7777);
-  EXPECT_FALSE(builder_->containsValue(other_value));
-
-  // Actually build the physical dictionary.
-  dictionary_memory_.reset(builder_->dictionarySizeBytes());
-  builder_->buildDictionary(dictionary_memory_.get());
-
-  // Check the contents of the physical dictionary.
-  vector<int> sorted_sample_ints(kSampleInts, kSampleInts + kNumSampleValues);
-  sort(sorted_sample_ints.begin(), sorted_sample_ints.end());
-  const int *value_array = reinterpret_cast<const int*>(
-      static_cast<const char*>(dictionary_memory_.get()) + 2 * sizeof(uint32_t));
-
-  EXPECT_EQ(kNumSampleValues, *static_cast<const uint32_t*>(dictionary_memory_.get()));
-  if (GetParam()) {
-    EXPECT_EQ(kNumSampleValues,
-              *(static_cast<const uint32_t*>(dictionary_memory_.get()) + 1));
-  } else {
-    EXPECT_EQ(numeric_limits<uint32_t>::max(),
-              *(static_cast<const uint32_t*>(dictionary_memory_.get()) + 1));
-  }
-  for (uint32_t sample_idx = 0; sample_idx < kNumSampleValues; ++sample_idx) {
-    EXPECT_EQ(sorted_sample_ints[sample_idx], value_array[sample_idx]);
-  }
-}
-
-TEST_P(CompressionDictionaryTest, IntKeyInfoTest) {
-  setupSampleIntDictionary();
-  EXPECT_EQ(kNumSampleValues + GetParam(), dictionary_->numberOfCodes());
-  EXPECT_EQ(bitsNeededForCodes(kNumSampleValues + GetParam()), dictionary_->codeLengthBits());
-}
-
-TEST_P(CompressionDictionaryTest, IntKeyGetCodeUntypedTest) {
-  setupSampleIntDictionary();
-
-  vector<int> sorted_sample_ints(kSampleInts, kSampleInts + kNumSampleValues);
-  sort(sorted_sample_ints.begin(), sorted_sample_ints.end());
-
-  // Check all the codes in the dictionary.
-  for (uint32_t sample_idx = 0; sample_idx < kNumSampleValues; ++sample_idx) {
-    EXPECT_EQ(sample_idx, dictionary_->getCodeForUntypedValue(&(sorted_sample_ints[sample_idx])));
-  }
-
-  if (GetParam()) {
-    EXPECT_EQ(kNumSampleValues, dictionary_->getCodeForUntypedValue(nullptr));
-  }
-
-  // Check a value that isn't in the dictionary.
-  int other_value = 7777;
-  EXPECT_EQ(kNumSampleValues + GetParam(), dictionary_->getCodeForUntypedValue(&other_value));
-}
-
-TEST_P(CompressionDictionaryTest, IntKeyGetCodeTypedTest) {
-  setupSampleIntDictionary();
-
-  vector<int> sorted_sample_ints(kSampleInts, kSampleInts + kNumSampleValues);
-  sort(sorted_sample_ints.begin(), sorted_sample_ints.end());
-
-  // Check all the codes in the dictionary.
-  for (uint32_t sample_idx = 0; sample_idx < kNumSampleValues; ++sample_idx) {
-    TypedValue value(sorted_sample_ints[sample_idx]);
-    EXPECT_EQ(sample_idx, dictionary_->getCodeForTypedValue(value, *dictionary_type_));
-  }
-
-  if (GetParam()) {
-    EXPECT_EQ(kNumSampleValues,
-              dictionary_->getCodeForTypedValue(TypedValue(kInt), *dictionary_type_));
-  }
-
-  // Check a value that isn't in the dictionary.
-  TypedValue other_value(7777);
-  EXPECT_EQ(kNumSampleValues + GetParam(),
-            dictionary_->getCodeForTypedValue(other_value, *dictionary_type_));
-}
-
-// Same as above, but use DoubleType literals.
-TEST_P(CompressionDictionaryTest, IntKeyGetCodeDifferentTypeTest) {
-  setupSampleIntDictionary();
-
-  vector<int> sorted_sample_ints(kSampleInts, kSampleInts + kNumSampleValues);
-  sort(sorted_sample_ints.begin(), sorted_sample_ints.end());
-
-  // Check all the codes in the dictionary.
-  for (uint32_t sample_idx = 0; sample_idx < kNumSampleValues; ++sample_idx) {
-    TypedValue value(static_cast<double>(sorted_sample_ints[sample_idx]));
-    EXPECT_EQ(sample_idx,
-              dictionary_->getCodeForTypedValue(value, DoubleType::Instance(false)));
-  }
-
-  if (GetParam()) {
-    EXPECT_EQ(kNumSampleValues,
-              dictionary_->getCodeForTypedValue(TypedValue(kDouble), DoubleType::Instance(true)));
-  }
-
-  // Check a value that isn't in the dictionary.
-  TypedValue other_value(static_cast<double>(5.5));
-  EXPECT_EQ(kNumSampleValues + GetParam(),
-            dictionary_->getCodeForTypedValue(other_value, DoubleType::Instance(false)));
-}
-
-TEST_P(CompressionDictionaryTest, IntKeyGetValueUntypedTest) {
-  setupSampleIntDictionary();
-
-  vector<int> sorted_sample_ints(kSampleInts, kSampleInts + kNumSampleValues);
-  sort(sorted_sample_ints.begin(), sorted_sample_ints.end());
-
-  for (uint8_t code = 0; code < kNumSampleValues; ++code) {
-    const int *value_ptr = static_cast<const int*>(dictionary_->getUntypedValueForByteCode(code));
-    EXPECT_EQ(sorted_sample_ints[code], *value_ptr);
-    value_ptr = static_cast<const int*>(dictionary_->getUntypedValueForShortCode(code));
-    EXPECT_EQ(sorted_sample_ints[code], *value_ptr);
-    value_ptr = static_cast<const int*>(dictionary_->getUntypedValueForCode(code));
-    EXPECT_EQ(sorted_sample_ints[code], *value_ptr);
-  }
-
-  if (GetParam()) {
-    const void *value_ptr = dictionary_->getUntypedValueForByteCode(kNumSampleValues);
-    EXPECT_EQ(nullptr, value_ptr);
-    value_ptr = dictionary_->getUntypedValueForShortCode(kNumSampleValues);
-    EXPECT_EQ(nullptr, value_ptr);
-    value_ptr = dictionary_->getUntypedValueForCode(kNumSampleValues);
-    EXPECT_EQ(nullptr, value_ptr);
-  }
-}
-
-TEST_P(CompressionDictionaryTest, IntKeyGetValueTypedTest) {
-  setupSampleIntDictionary();
-
-  vector<int> sorted_sample_ints(kSampleInts, kSampleInts + kNumSampleValues);
-  sort(sorted_sample_ints.begin(), sorted_sample_ints.end());
-
-  const IntType &int_type = IntType::Instance(GetParam());
-  const Comparison &equal_comp = ComparisonFactory::GetComparison(ComparisonID::kEqual);
-  for (uint8_t code = 0; code < kNumSampleValues; ++code) {
-    TypedValue expected_value(sorted_sample_ints[code]);
-
-    TypedValue value = dictionary_->getTypedValueForByteCode(code);
-    EXPECT_TRUE(equal_comp.compareTypedValuesChecked(expected_value, int_type,
-                                                     value, int_type));
-    value = dictionary_->getTypedValueForShortCode(code);
-    EXPECT_TRUE(equal_comp.compareTypedValuesChecked(expected_value, int_type,
-                                                     value, int_type));
-    value = dictionary_->getTypedValueForCode(code);
-    EXPECT_TRUE(equal_comp.compareTypedValuesChecked(expected_value, int_type,
-                                                     value, int_type));
-  }
-
-  if (GetParam()) {
-    TypedValue value = dictionary_->getTypedValueForByteCode(kNumSampleValues);
-    EXPECT_TRUE(value.isNull());
-    EXPECT_EQ(kInt, value.getTypeID());
-    value = dictionary_->getTypedValueForShortCode(kNumSampleValues);
-    EXPECT_TRUE(value.isNull());
-    EXPECT_EQ(kInt, value.getTypeID());
-    value = dictionary_->getTypedValueForCode(kNumSampleValues);
-    EXPECT_TRUE(value.isNull());
-    EXPECT_EQ(kInt, value.getTypeID());
-  }
-}
-
-TEST_P(CompressionDictionaryTest, IntKeyBoundCodesUntypedTest) {
-  setupSampleIntDictionary();
-
-  vector<int> sorted_sample_ints(kSampleInts, kSampleInts + kNumSampleValues);
-  sort(sorted_sample_ints.begin(), sorted_sample_ints.end());
-
-  // Check bounds for all the values which are actually in the dictionary.
-  for (uint32_t sorted_value_idx = 0;
-       sorted_value_idx < kNumSampleValues;
-       ++sorted_value_idx) {
-    EXPECT_EQ(sorted_value_idx,
-              dictionary_->getLowerBoundCodeForUntypedValue(&(sorted_sample_ints[sorted_value_idx])));
-    EXPECT_EQ(sorted_value_idx + 1,
-              dictionary_->getUpperBoundCodeForUntypedValue(&(sorted_sample_ints[sorted_value_idx])));
-  }
-
-  // Check a value less than the least value in the dictionary.
-  int other_value = sorted_sample_ints.front() - 10;
-  EXPECT_EQ(0u, dictionary_->getLowerBoundCodeForUntypedValue(&other_value));
-  EXPECT_EQ(0u, dictionary_->getUpperBoundCodeForUntypedValue(&other_value));
-
-  // Check a value larger than the greatest value in the dictionary.
-  other_value = sorted_sample_ints.back() + 10;
-  EXPECT_EQ(kNumSampleValues + GetParam(), dictionary_->getLowerBoundCodeForUntypedValue(&other_value));
-  // Note: with nulls, the upper bound can actually be less than the lower
-  // bound due to an implementation quirk.
-  EXPECT_EQ(kNumSampleValues, dictionary_->getUpperBoundCodeForUntypedValue(&other_value));
-
-  // Split the difference between the last couple of values.
-  other_value = (sorted_sample_ints.back() + *(sorted_sample_ints.end() - 2)) / 2;
-  EXPECT_EQ(kNumSampleValues - 1, dictionary_->getLowerBoundCodeForUntypedValue(&other_value));
-  EXPECT_EQ(kNumSampleValues - 1, dictionary_->getUpperBoundCodeForUntypedValue(&other_value));
-}
-
-TEST_P(CompressionDictionaryTest, IntKeyBoundCodesTypedTest) {
-  setupSampleIntDictionary();
-
-  vector<int> sorted_sample_ints(kSampleInts, kSampleInts + kNumSampleValues);
-  sort(sorted_sample_ints.begin(), sorted_sample_ints.end());
-
-  TypedValue value;
-  // Check bounds for all the values which are actually in the dictionary.
-  for (uint32_t sorted_value_idx = 0;
-       sorted_value_idx < kNumSampleValues;
-       ++sorted_value_idx) {
-    value = TypedValue(sorted_sample_ints[sorted_value_idx]);
-    EXPECT_EQ(sorted_value_idx,
-              dictionary_->getLowerBoundCodeForTypedValue(value, *dictionary_type_));
-    EXPECT_EQ(sorted_value_idx + 1,
-              dictionary_->getUpperBoundCodeForTypedValue(value, *dictionary_type_));
-  }
-
-  // Check a value less than the least value in the dictionary.
-  value = TypedValue(sorted_sample_ints.front() - 10);
-  EXPECT_EQ(0u, dictionary_->getLowerBoundCodeForTypedValue(value, *dictionary_type_));
-  EXPECT_EQ(0u, dictionary_->getUpperBoundCodeForTypedValue(value, *dictionary_type_));
-
-  // Check a value larger than the greatest value in the dictionary.
-  value = TypedValue(sorted_sample_ints.back() + 10);
-  EXPECT_EQ(kNumSampleValues + GetParam(),
-            dictionary_->getLowerBoundCodeForTypedValue(value, *dictionary_type_));
-  // Note: with nulls, the upper bound can actually be less than the lower
-  // bound due to an implementation quirk.
-  EXPECT_EQ(kNumSampleValues,
-            dictionary_->getUpperBoundCodeForTypedValue(value, *dictionary_type_));
-
-  // Split the difference between the last couple of values.
-  value = TypedValue((sorted_sample_ints.back() + *(sorted_sample_ints.end() - 2)) / 2);
-  EXPECT_EQ(kNumSampleValues - 1,
-            dictionary_->getLowerBoundCodeForTypedValue(value, *dictionary_type_));
-  EXPECT_EQ(kNumSampleValues - 1,
-            dictionary_->getUpperBoundCodeForTypedValue(value, *dictionary_type_));
-}
-
-// Same as a above, but use DoubleType literals.
-TEST_P(CompressionDictionaryTest, IntKeyBoundCodesDifferentTypeTest) {
-  setupSampleIntDictionary();
-
-  const Type &value_type = DoubleType::Instance(GetParam());
-
-  vector<int> sorted_sample_ints(kSampleInts, kSampleInts + kNumSampleValues);
-  sort(sorted_sample_ints.begin(), sorted_sample_ints.end());
-
-  TypedValue value;
-  // Check bounds for all the values which are actually in the dictionary.
-  for (uint32_t sorted_value_idx = 0;
-       sorted_value_idx < kNumSampleValues;
-       ++sorted_value_idx) {
-    value = TypedValue(static_cast<double>(sorted_sample_ints[sorted_value_idx]));
-    EXPECT_EQ(sorted_value_idx,
-              dictionary_->getLowerBoundCodeForTypedValue(value, value_type));
-    EXPECT_EQ(sorted_value_idx + 1,
-              dictionary_->getUpperBoundCodeForTypedValue(value, value_type));
-  }
-
-  // Check a value less than the least value in the dictionary.
-  value = TypedValue(static_cast<double>(sorted_sample_ints.front()) - 0.5);
-  EXPECT_EQ(0u, dictionary_->getLowerBoundCodeForTypedValue(value, value_type));
-  EXPECT_EQ(0u, dictionary_->getUpperBoundCodeForTypedValue(value, value_type));
-
-  // Check a value larger than the greatest value in the dictionary.
-  value = TypedValue(static_cast<double>(sorted_sample_ints.back()) + 0.5);
-  EXPECT_EQ(kNumSampleValues + GetParam(),
-            dictionary_->getLowerBoundCodeForTypedValue(value, value_type));
-  // Note: with nulls, the upper bound can actually be less than the lower
-  // bound due to an implementation quirk.
-  EXPECT_EQ(kNumSampleValues,
-            dictionary_->getUpperBoundCodeForTypedValue(value, value_type));
-
-  // Split the difference between the last couple of values.
-  value = TypedValue(static_cast<double>((sorted_sample_ints.back() + *(sorted_sample_ints.end() - 2)) / 2.0));
-  EXPECT_EQ(kNumSampleValues - 1,
-            dictionary_->getLowerBoundCodeForTypedValue(value, value_type));
-  EXPECT_EQ(kNumSampleValues - 1,
-            dictionary_->getUpperBoundCodeForTypedValue(value, value_type));
-}
-
-TEST_P(CompressionDictionaryTest, IntKeyLimitCodesForComparisonUntypedTest) {
-  setupSampleIntDictionary();
-
-  vector<int> sorted_sample_ints(kSampleInts, kSampleInts + kNumSampleValues);
-  sort(sorted_sample_ints.begin(), sorted_sample_ints.end());
-
-  pair<uint32_t, uint32_t> limits;
-  for (uint32_t sorted_value_idx = 0;
-       sorted_value_idx < kNumSampleValues;
-       ++sorted_value_idx) {
-    limits = dictionary_->getLimitCodesForComparisonUntyped(ComparisonID::kEqual,
-                                                            &(sorted_sample_ints[sorted_value_idx]));
-    EXPECT_EQ(sorted_value_idx, limits.first);
-    EXPECT_EQ(sorted_value_idx + 1, limits.second);
-
-    limits = dictionary_->getLimitCodesForComparisonUntyped(ComparisonID::kLess,
-                                                            &(sorted_sample_ints[sorted_value_idx]));
-    EXPECT_EQ(0u, limits.first);
-    EXPECT_EQ(sorted_value_idx, limits.second);
-
-    limits = dictionary_->getLimitCodesForComparisonUntyped(ComparisonID::kLessOrEqual,
-                                                            &(sorted_sample_ints[sorted_value_idx]));
-    EXPECT_EQ(0u, limits.first);
-    EXPECT_EQ(sorted_value_idx + 1, limits.second);
-
-    limits = dictionary_->getLimitCodesForComparisonUntyped(ComparisonID::kGreater,
-                                                            &(sorted_sample_ints[sorted_value_idx]));
-    EXPECT_EQ(sorted_value_idx + 1, limits.first);
-    EXPECT_EQ(kNumSampleValues, limits.second);
-
-    limits = dictionary_->getLimitCodesForComparisonUntyped(ComparisonID::kGreaterOrEqual,
-                                                            &(sorted_sample_ints[sorted_value_idx]));
-    EXPECT_EQ(sorted_value_idx, limits.first);
-    EXPECT_EQ(kNumSampleValues, limits.second);
-  }
-
-  // Check a value smaller than all the values in the dictionary.
-  int small_int = sorted_sample_ints.front() - 1;
-  limits = dictionary_->getLimitCodesForComparisonUntyped(ComparisonID::kEqual, &small_int);
-  EXPECT_GE(limits.first, limits.second);
-
-  limits = dictionary_->getLimitCodesForComparisonUntyped(ComparisonID::kLess, &small_int);
-  EXPECT_EQ(0u, limits.first);
-  EXPECT_EQ(0u, limits.second);
-
-  limits = dictionary_->getLimitCodesForComparisonUntyped(ComparisonID::kLessOrEqual, &small_int);
-  EXPECT_EQ(0u, limits.first);
-  EXPECT_EQ(0u, limits.second);
-
-  limits = dictionary_->getLimitCodesForComparisonUntyped(ComparisonID::kGreater, &small_int);
-  EXPECT_EQ(0u, limits.first);
-  EXPECT_EQ(kNumSampleValues, limits.second);
-
-  limits = dictionary_->getLimitCodesForComparisonUntyped(ComparisonID::kGreaterOrEqual, &small_int);
-  EXPECT_EQ(0u, limits.first);
-  EXPECT_EQ(kNumSampleValues, limits.second);
-
-  // Check a value larger than all the values in the dictionary.
-  int big_int = sorted_sample_ints.back() + 1;
-  limits = dictionary_->getLimitCodesForComparisonUntyped(ComparisonID::kEqual, &big_int);
-  EXPECT_GE(limits.first, limits.second);
-
-  limits = dictionary_->getLimitCodesForComparisonUntyped(ComparisonID::kLess, &big_int);
-  EXPECT_EQ(0u, limits.first);
-  EXPECT_EQ(kNumSampleValues, limits.second);
-
-  limits = dictionary_->getLimitCodesForComparisonUntyped(ComparisonID::kLessOrEqual, &big_int);
-  EXPECT_EQ(0u, limits.first);
-  EXPECT_EQ(kNumSampleValues, limits.second);
-
-  limits = dictionary_->getLimitCodesForComparisonUntyped(ComparisonID::kGreater, &big_int);
-  EXPECT_GE(limits.first, limits.second);
-
-  limits = dictionary_->getLimitCodesForComparisonUntyped(ComparisonID::kGreaterOrEqual, &big_int);
-  EXPECT_GE(limits.first, limits.second);
-
-  if (GetParam()) {
-    // Any comparison with null has no matches.
-    limits = dictionary_->getLimitCodesForComparisonUntyped(ComparisonID::kEqual, nullptr);
-    EXPECT_EQ(kNumSampleValues + 1, limits.first);
-    EXPECT_EQ(kNumSampleValues + 1, limits.second);
-
-    limits = dictionary_->getLimitCodesForComparisonUntyped(ComparisonID::kLess, nullptr);
-    EXPECT_EQ(kNumSampleValues + 1, limits.first);
-    EXPECT_EQ(kNumSampleValues + 1, limits.second);
-
-    limits = dictionary_->getLimitCodesForComparisonUntyped(ComparisonID::kLessOrEqual, nullptr);
-    EXPECT_EQ(kNumSampleValues + 1, limits.first);
-    EXPECT_EQ(kNumSampleValues + 1, limits.second);
-
-    limits = dictionary_->getLimitCodesForComparisonUntyped(ComparisonID::kGreater, nullptr);
-    EXPECT_EQ(kNumSampleValues + 1, limits.first);
-    EXPECT_EQ(kNumSampleValues + 1, limits.second);
-
-    limits = dictionary_->getLimitCodesForComparisonUntyped(ComparisonID::kGreaterOrEqual, nullptr);
-    EXPECT_EQ(kNumSampleValues + 1, limits.first);
-    EXPECT_EQ(kNumSampleValues + 1, limits.second);
-  }
-
-  // Check kEqual for a nonexistent value.
-  int other_value = 777;
-  limits = dictionary_->getLimitCodesForComparisonUntyped(ComparisonID::kEqual, &other_value);
-  EXPECT_EQ(limits.first, limits.second);
-}
-
-TEST_P(CompressionDictionaryTest, IntKeyLimitCodesForComparisonTypedTest) {
-  setupSampleIntDictionary();
-
-  vector<int> sorted_sample_ints(kSampleInts, kSampleInts + kNumSampleValues);
-  sort(sorted_sample_ints.begin(), sorted_sample_ints.end());
-
-  pair<uint32_t, uint32_t> limits;
-  for (uint32_t sorted_value_idx = 0;
-       sorted_value_idx < kNumSampleValues;
-       ++sorted_value_idx) {
-    TypedValue value(sorted_sample_ints[sorted_value_idx]);
-    limits = dictionary_->getLimitCodesForComparisonTyped(ComparisonID::kEqual,
-                                                          value,
-                                                          *dictionary_type_);
-    EXPECT_EQ(sorted_value_idx, limits.first);
-    EXPECT_EQ(sorted_value_idx + 1, limits.second);
-
-    limits = dictionary_->getLimitCodesForComparisonTyped(ComparisonID::kLess,
-                                                          value,
-                                                          *dictionary_type_);
-    EXPECT_EQ(0u, limits.first);
-    EXPECT_EQ(sorted_value_idx, limits.second);
-
-    limits = dictionary_->getLimitCodesForComparisonTyped(ComparisonID::kLessOrEqual,
-                                                          value,
-                                                          *dictionary_type_);
-    EXPECT_EQ(0u, limits.first);
-    EXPECT_EQ(sorted_value_idx + 1, limits.second);
-
-    limits = dictionary_->getLimitCodesForComparisonTyped(ComparisonID::kGreater,
-                                                          value,
-                                                          *dictionary_type_);
-    EXPECT_EQ(sorted_value_idx + 1, limits.first);
-    EXPECT_EQ(kNumSampleValues, limits.second);
-
-    limits = dictionary_->getLimitCodesForComparisonTyped(ComparisonID::kGreaterOrEqual,
-                                                          value,
-                                                          *dictionary_type_);
-    EXPECT_EQ(sorted_value_idx, limits.first);
-    EXPECT_EQ(kNumSampleValues, limits.second);
-  }
-
-  // Check a value smaller than all the values in the dictionary.
-  TypedValue small_int_value(sorted_sample_ints.front() - 1);
-  limits = dictionary_->getLimitCodesForComparisonTyped(ComparisonID::kEqual,
-                                                        small_int_value,
-                                                        *dictionary_type_);
-  EXPECT_GE(limits.first, limits.second);
-
-  limits = dictionary_->getLimitCodesForComparisonTyped(ComparisonID::kLess,
-                                                        small_int_value,
-                                                        *dictionary_type_);
-  EXPECT_EQ(0u, limits.first);
-  EXPECT_EQ(0u, limits.second);
-
-  limits = dictionary_->getLimitCodesForComparisonTyped(ComparisonID::kLessOrEqual,
-                                                        small_int_value,
-                                                        *dictionary_type_);
-  EXPECT_EQ(0u, limits.first);
-  EXPECT_EQ(0u, limits.second);
-
-  limits = dictionary_->getLimitCodesForComparisonTyped(ComparisonID::kGreater,
-                                                        small_int_value,
-                                                        *dictionary_type_);
-  EXPECT_EQ(0u, limits.first);
-  EXPECT_EQ(kNumSampleValues, limits.second);
-
-  limits = dictionary_->getLimitCodesForComparisonTyped(ComparisonID::kGreaterOrEqual,
-                                                        small_int_value,
-                                                        *dictionary_type_);
-  EXPECT_EQ(0u, limits.first);
-  EXPECT_EQ(kNumSampleValues, limits.second);
-
-  // Check a value larger than all the values in the dictionary.
-  TypedValue big_int_value(sorted_sample_ints.back() + 1);
-  limits = dictionary_->getLimitCodesForComparisonTyped(ComparisonID::kEqual,
-                                                        big_int_value,
-                                                        *dictionary_type_);
-  EXPECT_GE(limits.first, limits.second);
-
-  limits = dictionary_->getLimitCodesForComparisonTyped(ComparisonID::kLess,
-                                                        big_int_value,
-                                                        *dictionary_type_);
-  EXPECT_EQ(0u, limits.first);
-  EXPECT_EQ(kNumSampleValues, limits.second);
-
-  limits = dictionary_->getLimitCodesForComparisonTyped(ComparisonID::kLessOrEqual,
-                                                        big_int_value,
-                                                        *dictionary_type_);
-  EXPECT_EQ(0u, limits.first);
-  EXPECT_EQ(kNumSampleValues, limits.second);
-
-  limits = dictionary_->getLimitCodesForComparisonTyped(ComparisonID::kGreater,
-                                                        big_int_value,
-                                                        *dictionary_type_);
-  EXPECT_GE(limits.first, limits.second);
-
-  limits = dictionary_->getLimitCodesForComparisonTyped(ComparisonID::kGreaterOrEqual,
-                                                        big_int_value,
-                                                        *dictionary_type_);
-  EXPECT_GE(limits.first, limits.second);
-
-  if (GetParam()) {
-    // Any comparison with null has no matches.
-    TypedValue null_value(kInt);
-
-    limits = dictionary_->getLimitCodesForComparisonTyped(ComparisonID::kEqual,
-                                                          null_value,
-                                                          *dictionary_type_);
-    EXPECT_EQ(kNumSampleValues + 1, limits.first);
-    EXPECT_EQ(kNumSampleValues + 1, limits.second);
-
-    limits = dictionary_->getLimitCodesForComparisonTyped(ComparisonID::kLess,
-                                                          null_value,
-                                                          *dictionary_type_);
-    EXPECT_EQ(kNumSampleValues + 1, limits.first);
-    EXPECT_EQ(kNumSampleValues + 1, limits.second);
-
-    limits = dictionary_->getLimitCodesForComparisonTyped(ComparisonID::kLessOrEqual,
-                                                          null_value,
-                                                          *dictionary_type_);
-    EXPECT_EQ(kNumSampleValues + 1, limits.first);
-    EXPECT_EQ(kNumSampleValues + 1, limits.second);
-
-    limits = dictionary_->getLimitCodesForComparisonTyped(ComparisonID::kGreater,
-                                                          null_value,
-                                                          *dictionary_type_);
-    EXPECT_EQ(kNumSampleValues + 1, limits.first);
-    EXPECT_EQ(kNumSampleValues + 1, limits.second);
-
-    limits = dictionary_->getLimitCodesForComparisonTyped(ComparisonID::kGreaterOrEqual,
-                                                          null_value,
-                                                          *dictionary_type_);
-    EXPECT_EQ(kNumSampleValues + 1, limits.first);
-    EXPECT_EQ(kNumSampleValues + 1, limits.second);
-  }
-
-  // Check kEqual for a nonexistent value.
-  TypedValue other_value(777);
-  limits = dictionary_->getLimitCodesForComparisonTyped(ComparisonID::kEqual,
-                                                        other_value,
-                                                        *dictionary_type_);
-  EXPECT_EQ(limits.first, limits.second);
-}
-
-// Same as a above, but use DoubleType literals.
-TEST_P(CompressionDictionaryTest, IntKeyLimitCodesForComparisonDifferentTypeTest) {
-  setupSampleIntDictionary();
-  const Type &literal_type = DoubleType::Instance(GetParam());
-
-  vector<int> sorted_sample_ints(kSampleInts, kSampleInts + kNumSampleValues);
-  sort(sorted_sample_ints.begin(), sorted_sample_ints.end());
-
-  pair<uint32_t, uint32_t> limits;
-  for (uint32_t sorted_value_idx = 0;
-       sorted_value_idx < kNumSampleValues;
-       ++sorted_value_idx) {
-    TypedValue value(static_cast<double>(sorted_sample_ints[sorted_value_idx]));
-    limits = dictionary_->getLimitCodesForComparisonTyped(ComparisonID::kEqual,
-                                                          value,
-                                                          literal_type);
-    EXPECT_EQ(sorted_value_idx, limits.first);
-    EXPECT_EQ(sorted_value_idx + 1, limits.second);
-
-    limits = dictionary_->getLimitCodesForComparisonTyped(ComparisonID::kLess,
-                                                          value,
-                                                          literal_type);
-    EXPECT_EQ(0u, limits.first);
-    EXPECT_EQ(sorted_value_idx, limits.second);
-
-    limits = dictionary_->getLimitCodesForComparisonTyped(ComparisonID::kLessOrEqual,
-                                                          value,
-                                                          literal_type);
-    EXPECT_EQ(0u, limits.first);
-    EXPECT_EQ(sorted_value_idx + 1, limits.second);
-
-    limits = dictionary_->getLimitCodesForComparisonTyped(ComparisonID::kGreater,
-                                                          value,
-                                                          literal_type);
-    EXPECT_EQ(sorted_value_idx + 1, limits.first);
-    EXPECT_EQ(kNumSampleValues, limits.second);
-
-    limits = dictionary_->getLimitCodesForComparisonTyped(ComparisonID::kGreaterOrEqual,
-                                                          value,
-                                                          literal_type);
-    EXPECT_EQ(sorted_value_idx, limits.first);
-    EXPECT_EQ(kNumSampleValues, limits.second);
-  }
-
-  // Check a value smaller than all the values in the dictionary.
-  TypedValue small_double_value(static_cast<double>(sorted_sample_ints.front()) - 0.5);
-  limits = dictionary_->getLimitCodesForComparisonTyped(ComparisonID::kEqual,
-                                                        small_double_value,
-                                                        literal_type);
-  EXPECT_GE(limits.first, limits.second);
-
-  limits = dictionary_->getLimitCodesForComparisonTyped(ComparisonID::kLess,
-                                                        small_double_value,
-                                                        literal_type);
-  EXPECT_EQ(0u, limits.first);
-  EXPECT_EQ(0u, limits.second);
-
-  limits = dictionary_->getLimitCodesForComparisonTyped(ComparisonID::kLessOrEqual,
-                                                        small_double_value,
-                                                        literal_type);
-  EXPECT_EQ(0u, limits.first);
-  EXPECT_EQ(0u, limits.second);
-
-  limits = dictionary_->getLimitCodesForComparisonTyped(ComparisonID::kGreater,
-                                                        small_double_value,
-                                                        literal_type);
-  EXPECT_EQ(0u, limits.first);
-  EXPECT_EQ(kNumSampleValues, limits.second);
-
-  limits = dictionary_->getLimitCodesForComparisonTyped(ComparisonID::kGreaterOrEqual,
-                                                        small_double_value,
-                                                        literal_type);
-  EXPECT_EQ(0u, limits.first);
-  EXPECT_EQ(kNumSampleValues, limits.second);
-
-  // Check a value larger than all the values in the dictionary.
-  TypedValue big_double_value(static_cast<double>(sorted_sample_ints.back()) + 0.5);
-  limits = dictionary_->getLimitCodesForComparisonTyped(ComparisonID::kEqual,
-                                                        big_double_value,
-                                                        literal_type);
-  EXPECT_GE(limits.first, limits.second);
-
-  limits = dictionary_->getLimitCodesForComparisonTyped(ComparisonID::kLess,
-                                                        big_double_value,
-                                                        literal_type);
-  EXPECT_EQ(0u, limits.first);
-  EXPECT_EQ(kNumSampleValues, limits.second);
-
-  limits = dictionary_->getLimitCodesForComparisonTyped(ComparisonID::kLessOrEqual,
-                                                        big_double_value,
-                                                        literal_type);
-  EXPECT_EQ(0u, limits.first);
-  EXPECT_EQ(kNumSampleValues, limits.second);
-
-  limits = dictionary_->getLimitCodesForComparisonTyped(ComparisonID::kGreater,
-                                                        big_double_value,
-                                                        literal_type);
-  EXPECT_GE(limits.first, limits.second);
-
-  limits = dictionary_->getLimitCodesForComparisonTyped(ComparisonID::kGreaterOrEqual,
-                                                        big_double_value,
-                                                        literal_type);
-  EXPECT_GE(limits.first, limits.second);
-
-  if (GetParam()) {
-    // Any comparison with null has no matches.
-    TypedValue null_value(kDouble);
-
-    limits = dictionary_->getLimitCodesForComparisonTyped(ComparisonID::kEqual,
-                                                          null_value,
-                                                          literal_type);
-    EXPECT_EQ(kNumSampleValues + 1, limits.first);
-    EXPECT_EQ(kNumSampleValues + 1, limits.second);
-
-    limits = dictionary_->getLimitCodesForComparisonTyped(ComparisonID::kLess,
-                                                          null_value,
-                                                          literal_type);
-    EXPECT_EQ(kNumSampleValues + 1, limits.first);
-    EXPECT_EQ(kNumSampleValues + 1, limits.second);
-
-    limits = dictionary_->getLimitCodesForComparisonTyped(ComparisonID::kLessOrEqual,
-                                                          null_value,
-                                                          literal_type);
-    EXPECT_EQ(kNumSampleValues + 1, limits.first);
-    EXPECT_EQ(kNumSampleValues + 1, limits.second);
-
-    limits = dictionary_->getLimitCodesForComparisonTyped(ComparisonID::kGreater,
-                                                          null_value,
-                                                          literal_type);
-    EXPECT_EQ(kNumSampleValues + 1, limits.first);
-    EXPECT_EQ(kNumSampleValues + 1, limits.second);
-
-    limits = dictionary_->getLimitCodesForComparisonTyped(ComparisonID::kGreaterOrEqual,
-                                                          null_value,
-                                                          literal_type);
-    EXPECT_EQ(kNumSampleValues + 1, limits.first);
-    EXPECT_EQ(kNumSampleValues + 1, limits.second);
-  }
-
-  // Check kEqual for a nonexistent value.
-  TypedValue other_value(static_cast<double>(5.5));
-  limits = dictionary_->getLimitCodesForComparisonTyped(ComparisonID::kEqual,
-                                                        other_value,
-                                                        literal_type);
-  EXPECT_EQ(limits.first, limits.second);
-}
-
-TEST_P(CompressionDictionaryTest, VarCharKeyBuildTest) {
-  const VarCharType &varchar_type = VarCharType::Instance(kVarCharSizeParameter, GetParam());
-  TypedValue current_value;
-  size_t total_key_length = 0;
-
-  // Construct a CompressionDictionaryBuilder and check its initial state.
-  setupBuilderForType(varchar_type);
-  EXPECT_EQ(0u, builder_->numberOfEntries());
-  EXPECT_EQ(bitsNeededForCodes(0), builder_->codeLengthBits());
-  EXPECT_EQ(sizeof(uint32_t) * 2 + total_key_length, builder_->dictionarySizeBytes());
-
-  // If the type is nullable, try inserting a null first.
-  if (GetParam()) {
-    current_value = TypedValue(kVarChar);
-    EXPECT_TRUE(builder_->insertEntry(current_value));
-    EXPECT_TRUE(builder_->containsValue(current_value));
-    EXPECT_EQ(1u, builder_->numberOfEntries());
-    EXPECT_EQ(bitsNeededForCodes(1), builder_->codeLengthBits());
-    EXPECT_EQ(2 * sizeof(uint32_t) + total_key_length, builder_->dictionarySizeBytes());
-
-    // Roll back to zero entries.
-    builder_->undoLastInsert();
-    EXPECT_FALSE(builder_->containsValue(current_value));
-    EXPECT_EQ(0u, builder_->numberOfEntries());
-    EXPECT_EQ(bitsNeededForCodes(0), builder_->codeLengthBits());
-    EXPECT_EQ(2 * sizeof(uint32_t) + total_key_length, builder_->dictionarySizeBytes());
-  }
-
-  // Add a value.
-  current_value = varchar_type.makeValue(kSampleStrings[0], strlen(kSampleStrings[0]) + 1);
-  current_value.ensureNotReference();
-  total_key_length += current_value.getDataSize();
-  EXPECT_TRUE(builder_->insertEntry(current_value));
-  EXPECT_TRUE(builder_->containsValue(current_value));
-  EXPECT_EQ(1u, builder_->numberOfEntries());
-  EXPECT_EQ(bitsNeededForCodes(1), builder_->codeLengthBits());
-  EXPECT_EQ(sizeof(uint32_t) * 3 + total_key_length, builder_->dictionarySizeBytes());
-
-  // Roll back to zero entries.
-  total_key_length -= current_value.getDataSize();
-  builder_->undoLastInsert();
-  EXPECT_FALSE(builder_->containsValue(current_value));
-  EXPECT_EQ(0u, builder_->numberOfEntries());
-  EXPECT_EQ(bitsNeededForCodes(0), builder_->codeLengthBits());
-  EXPECT_EQ(sizeof(uint32_t) * 2 + total_key_length, builder_->dictionarySizeBytes());
-
-  // Re-add the value.
-  total_key_length += current_value.getDataSize();
-  EXPECT_TRUE(builder_->insertEntry(current_value));
-  EXPECT_TRUE(builder_->containsValue(current_value));
-  EXPECT_EQ(1u, builder_->numberOfEntries());
-  EXPECT_EQ(bitsNeededForCodes(1), builder_->codeLengthBits());
-  EXPECT_EQ(sizeof(uint32_t) * 3 + total_key_length, builder_->dictionarySizeBytes());
-
-  // If the type is nullable, also try inserting a null with a real value
-  // present.
-  if (GetParam()) {
-    current_value = TypedValue(kVarChar);
-    EXPECT_TRUE(builder_->insertEntry(current_value));
-    EXPECT_TRUE(builder_->containsValue(current_value));
-    EXPECT_EQ(2u, builder_->numberOfEntries());
-    EXPECT_EQ(bitsNeededForCodes(2), builder_->codeLengthBits());
-    EXPECT_EQ(3 * sizeof(uint32_t) + total_key_length, builder_->dictionarySizeBytes());
-
-    // Roll back insert of null.
-    builder_->undoLastInsert();
-    EXPECT_FALSE(builder_->containsValue(current_value));
-    EXPECT_EQ(1u, builder_->numberOfEntries());
-    EXPECT_EQ(bitsNeededForCodes(1), builder_->codeLengthBits());
-    EXPECT_EQ(3 * sizeof(uint32_t) + total_key_length, builder_->dictionarySizeBytes());
-
-    // Finally, re-insert the null.
-    EXPECT_TRUE(builder_->insertEntry(current_value));
-    EXPECT_TRUE(builder_->containsValue(current_value));
-    EXPECT_EQ(2u, builder_->numberOfEntries());
-    EXPECT_EQ(bitsNeededForCodes(2), builder_->codeLengthBits());
-    EXPECT_EQ(3 * sizeof(uint32_t) + total_key_length, builder_->dictionarySizeBytes());
-  }
-
-  // Add a reference value.
-  current_value = varchar_type.makeValue(kSampleStrings[1], strlen(kSampleStrings[1]) + 1);
-  EXPECT_FALSE(current_value.ownsOutOfLineData());
-  total_key_length += current_value.getDataSize();
-  EXPECT_TRUE(builder_->insertEntry(current_value));
-  // Check against a different but equal value.
-  current_value = varchar_type.makeValue(kSampleStrings[1], strlen(kSampleStrings[1]) + 1);
-  current_value.ensureNotReference();
-  EXPECT_TRUE(current_value.ownsOutOfLineData());
-  EXPECT_TRUE(builder_->containsValue(current_value));
-  EXPECT_EQ(2u + GetParam(), builder_->numberOfEntries());
-  EXPECT_EQ(bitsNeededForCodes(2 + GetParam()), builder_->codeLengthBits());
-  EXPECT_EQ(sizeof(uint32_t) * 4 + total_key_length, builder_->dictionarySizeBytes());
-
-  // Roll it back.
-  total_key_length -= current_value.getDataSize();
-  builder_->undoLastInsert();
-  EXPECT_FALSE(builder_->containsValue(current_value));
-  EXPECT_EQ(1u + GetParam(), builder_->numberOfEntries());
-  EXPECT_EQ(bitsNeededForCodes(1 + GetParam()), builder_->codeLengthBits());
-  EXPECT_EQ(sizeof(uint32_t) * 3 + total_key_length, builder_->dictionarySizeBytes());
-
-  // Re-add it.
-  current_value = varchar_type.makeValue(kSampleStrings[1], strlen(kSampleStrings[1]) + 1);
-  EXPECT_FALSE(current_value.ownsOutOfLineData());
-  total_key_length += current_value.getDataSize();
-  EXPECT_TRUE(builder_->insertEntry(current_value));
-  EXPECT_TRUE(builder_->containsValue(current_value));
-  EXPECT_EQ(2u + GetParam(), builder_->numberOfEntries());
-  EXPECT_EQ(bitsNeededForCodes(2 + GetParam()), builder_->codeLengthBits());
-  EXPECT_EQ(sizeof(uint32_t) * 4 + total_key_length, builder_->dictionarySizeBytes());
-
-  // Add a third value.
-  current_value = varchar_type.makeValue(kSampleStrings[2], strlen(kSampleStrings[2]) + 1);
-  current_value.ensureNotReference();
-  total_key_length += current_value.getDataSize();
-  EXPECT_TRUE(builder_->insertEntry(current_value));
-  EXPECT_TRUE(builder_->containsValue(current_value));
-  EXPECT_EQ(3u + GetParam(), builder_->numberOfEntries());
-  EXPECT_EQ(bitsNeededForCodes(3 + GetParam()), builder_->codeLengthBits());
-  EXPECT_EQ(sizeof(uint32_t) * 5 + total_key_length, builder_->dictionarySizeBytes());
-
-  // Roll it back (this is the last time we will check this, we just need to
-  // cover all the possible paths where the code length may shrink).
-  builder_->undoLastInsert();
-  total_key_length -= current_value.getDataSize();
-  EXPECT_FALSE(builder_->containsValue(current_value));
-  EXPECT_EQ(2u + GetParam(), builder_->numberOfEntries());
-  EXPECT_EQ(bitsNeededForCodes(2 + GetParam()), builder_->codeLengthBits());
-  EXPECT_EQ(sizeof(uint32_t) * 4 + total_key_length, builder_->dictionarySizeBytes());
-
-  // Insert the rest of the sample values.
-  for (uint32_t sample_idx = 2; sample_idx < kNumSampleValues; ++sample_idx) {
-    current_value = varchar_type.makeValue(kSampleStrings[sample_idx],
-                                           strlen(kSampleStrings[sample_idx]) + 1);
-    total_key_length += current_value.getDataSize();
-    EXPECT_TRUE(builder_->insertEntry(current_value));
-    EXPECT_TRUE(builder_->containsValue(current_value));
-    EXPECT_EQ(sample_idx + 1 + GetParam(), builder_->numberOfEntries());
-    EXPECT_EQ(bitsNeededForCodes(sample_idx + 1 + GetParam()), builder_->codeLengthBits());
-    EXPECT_EQ(sizeof(uint32_t) * (sample_idx + 3) + total_key_length,
-              builder_->dictionarySizeBytes());
-  }
-
-  // Attempt to insert a duplicate entry.
-  current_value = varchar_type.makeValue(kSampleStrings[kNumSampleValues >> 1],
-                                         strlen(kSampleStrings[kNumSampleValues >> 1]) + 1);
-  EXPECT_FALSE(builder_->insertEntry(current_value));
-  EXPECT_TRUE(builder_->containsValue(current_value));
-  EXPECT_EQ(kNumSampleValues + GetParam(), builder_->numberOfEntries());
-  EXPECT_EQ(bitsNeededForCodes(kNumSampleValues + GetParam()), builder_->codeLengthBits());
-  EXPECT_EQ(sizeof(uint32_t) * (kNumSampleValues + 2) + total_key_length,
-            builder_->dictionarySizeBytes());
-
-  // If type is nullable, attempt to insert a duplicate null.
-  if (GetParam()) {
-    current_value = TypedValue(kVarChar);
-    EXPECT_FALSE(builder_->insertEntry(current_value));
-    EXPECT_TRUE(builder_->containsValue(current_value));
-    EXPECT_EQ(kNumSampleValues + GetParam(), builder_->numberOfEntries());
-    EXPECT_EQ(bitsNeededForCodes(kNumSampleValues + GetParam()), builder_->codeLengthBits());
-    EXPECT_EQ(sizeof(uint32_t) * (kNumSampleValues + 2) + total_key_length,
-              builder_->dictionarySizeBytes());
-  }
-
-  // Check for the presence of a nonexistent key.
-  current_value = varchar_type.makeValue("foo", 4);
-  EXPECT_FALSE(builder_->containsValue(current_value));
-
-  // Actually build the physical dictionary.
-  dictionary_memory_.reset(builder_->dictionarySizeBytes());
-  builder_->buildDictionary(dictionary_memory_.get());
-
-  // Check the contents of the physical dictionary.
-  vector<string> sorted_sample_strings(kSampleStrings, kSampleStrings + kNumSampleValues);
-  sort(sorted_sample_strings.begin(), sorted_sample_strings.end());
-
-  const uint32_t *offset_array = static_cast<const uint32_t*>(dictionary_memory_.get()) + 2;
-  const char *value_memory =
-      static_cast<const char*>(dictionary_memory_.get())
-      + (*static_cast<const uint32_t*>(dictionary_memory_.get()) + 2) * sizeof(uint32_t);
-
-  EXPECT_EQ(kNumSampleValues, *static_cast<const uint32_t*>(dictionary_memory_.get()));
-  if (GetParam()) {
-    EXPECT_EQ(kNumSampleValues,
-              *(static_cast<const uint32_t*>(dictionary_memory_.get()) + 1));
-  } else {
-    EXPECT_EQ(numeric_limits<uint32_t>::max(),
-              *(static_cast<const uint32_t*>(dictionary_memory_.get()) + 1));
-  }
-  for (uint32_t sample_idx = 0; sample_idx < kNumSampleValues; ++sample_idx) {
-    EXPECT_STREQ(sorted_sample_strings[sample_idx].c_str(),
-                 value_memory + offset_array[sample_idx]);
-  }
-}
-
-// Same test as above, but insert values via insertEntryByReference().
-TEST_P(CompressionDictionaryTest, VarCharKeyBuildInsertByReferenceTest) {
-  const VarCharType &varchar_type = VarCharType::Instance(kVarCharSizeParameter, GetParam());
-  std::vector<TypedValue> values;
-  TypedValue other_value;
-  size_t total_key_length = 0;
-
-  // Construct a CompressionDictionaryBuilder and check its initial state.
-  setupBuilderForType(varchar_type);
-  EXPECT_EQ(0u, builder_->numberOfEntries());
-  EXPECT_EQ(bitsNeededForCodes(0), builder_->codeLengthBits());
-  EXPECT_EQ(sizeof(uint32_t) * 2 + total_key_length, builder_->dictionarySizeBytes());
-
-  // If the type is nullable, try inserting a null first.
-  if (GetParam()) {
-    TypedValue null_value = TypedValue(kVarChar);
-    EXPECT_TRUE(builder_->insertEntryByReference(null_value));
-    EXPECT_TRUE(builder_->containsValue(null_value));
-    EXPECT_EQ(1u, builder_->numberOfEntries());
-    EXPECT_EQ(bitsNeededForCodes(1), builder_->codeLengthBits());
-    EXPECT_EQ(2 * sizeof(uint32_t) + total_key_length, builder_->dictionarySizeBytes());
-
-    // Roll back to zero entries.
-    builder_->undoLastInsert();
-    EXPECT_FALSE(builder_->containsValue(null_value));
-    EXPECT_EQ(0u, builder_->numberOfEntries());
-    EXPECT_EQ(bitsNeededForCodes(0), builder_->codeLengthBits());
-    EXPECT_EQ(2 * sizeof(uint32_t) + total_key_length, builder_->dictionarySizeBytes());
-  }
-
-  // Add a value.
-  values.push_back(varchar_type.makeValue(kSampleStrings[0], strlen(kSampleStrings[0]) + 1));
-  values.back().ensureNotReference();
-  total_key_length += values.back().getDataSize();
-  EXPECT_TRUE(builder_->insertEntryByReference(values.back()));
-  EXPECT_TRUE(builder_->containsValue(values.back()));
-  EXPECT_EQ(1u, builder_->numberOfEntries());
-  EXPECT_EQ(bitsNeededForCodes(1), builder_->codeLengthBits());
-  EXPECT_EQ(sizeof(uint32_t) * 3 + total_key_length, builder_->dictionarySizeBytes());
-
-  // Roll back to zero entries.
-  total_key_length -= values.back().getDataSize();
-  builder_->undoLastInsert();
-  EXPECT_FALSE(builder_->containsValue(values.back()));
-  EXPECT_EQ(0u, builder_->numberOfEntries());
-  EXPECT_EQ(bitsNeededForCodes(0), builder_->codeLengthBits());
-  EXPECT_EQ(sizeof(uint32_t) * 2 + total_key_length, builder_->dictionarySizeBytes());
-
-  // Re-add the value.
-  total_key_length += values.back().getDataSize();
-  EXPECT_TRUE(builder_->insertEntryByReference(values.back()));
-  EXPECT_TRUE(builder_->containsValue(values.back()));
-  EXPECT_EQ(1u, builder_->numberOfEntries());
-  EXPECT_EQ(bitsNeededForCodes(1), builder_->codeLengthBits());
-  EXPECT_EQ(sizeof(uint32_t) * 3 + total_key_length, builder_->dictionarySizeBytes());
-
-  // If the type is nullable, also try inserting a null with a real value
-  // present.
-  if (GetParam()) {
-    TypedValue null_value = TypedValue(kVarChar);
-    EXPECT_TRUE(builder_->insertEntryByReference(null_value));
-    EXPECT_TRUE(builder_->containsValue(null_value));
-    EXPECT_EQ(2u, builder_->numberOfEntries());
-    EXPECT_EQ(bitsNeededForCodes(2), builder_->codeLengthBits());
-    EXPECT_EQ(3 * sizeof(uint32_t) + total_key_length, builder_->dictionarySizeBytes());
-
-    // Roll back insert of null.
-    builder_->undoLastInsert();
-    EXPECT_FALSE(builder_->containsValue(null_value));
-    EXPECT_EQ(1u, builder_->numberOfEntries());
-    EXPECT_EQ(bitsNeededForCodes(1), builder_->codeLengthBits());
-    EXPECT_EQ(3 * sizeof(uint32_t) + total_key_length, builder_->dictionarySizeBytes());
-
-    // Finally, re-insert the null.
-    EXPECT_TRUE(builder_->insertEntryByReference(null_value));
-    EXPECT_TRUE(builder_->containsValue(null_value));
-    EXPECT_EQ(2u, builder_->numberOfEntries());
-    EXPECT_EQ(bitsNeededForCodes(2), builder_->codeLengthBits());
-    EXPECT_EQ(3 * sizeof(uint32_t) + total_key_length, builder_->dictionarySizeBytes());
-  }
-
-  // Add a reference value.
-  values.push_back(varchar_type.makeValue(kSampleStrings[1], strlen(kSampleStrings[1]) + 1));
-  total_key_length += values.back().getDataSize();
-  EXPECT_TRUE(builder_->insertEntryByReference(values.back()));
-  // Check against a different but equal value.
-  other_value = varchar_type.makeValue(kSampleStrings[1], strlen(kSampleStrings[1]) + 1);
-  other_value.ensureNotReference();
-  EXPECT_TRUE(builder_->containsValue(other_value));
-  EXPECT_EQ(2u + GetParam(), builder_->numberOfEntries());
-  EXPECT_EQ(bitsNeededForCodes(2 + GetParam()), builder_->codeLengthBits());
-  EXPECT_EQ(sizeof(uint32_t) * 4 + total_key_length, builder_->dictionarySizeBytes());
-
-  // Roll it back.
-  total_key_length -= values.back().getDataSize();
-  builder_->undoLastInsert();
-  EXPECT_FALSE(builder_->containsValue(values.back()));
-  EXPECT_EQ(1u + GetParam(), builder_->numberOfEntries());
-  EXPECT_EQ(bitsNeededForCodes(1 + GetParam()), builder_->codeLengthBits());
-  EXPECT_EQ(sizeof(uint32_t) * 3 + total_key_length, builder_->dictionarySizeBytes());
-
-  // Re-add it.
-  total_key_length += values.back().getDataSize();
-  EXPECT_TRUE(builder_->insertEntryByReference(values.back()));
-  EXPECT_TRUE(builder_->containsValue(values.back()));
-  EXPECT_EQ(2u + GetParam(), builder_->numberOfEntries());
-  EXPECT_EQ(bitsNeededForCodes(2 + GetParam()), builder_->codeLengthBits());
-  EXPECT_EQ(sizeof(uint32_t) * 4 + total_key_length, builder_->dictionarySizeBytes());
-
-  // Add a third value.
-  values.push_back(varchar_type.makeValue(kSampleStrings[2], strlen(kSampleStrings[2]) + 1));
-  total_key_length += values.back().getDataSize();
-  EXPECT_TRUE(builder_->insertEntryByReference(values.back()));
-  EXPECT_TRUE(builder_->containsValue(values.back()));
-  EXPECT_EQ(3u + GetParam(), builder_->numberOfEntries());
-  EXPECT_EQ(bitsNeededForCodes(3 + GetParam()), builder_->codeLengthBits());
-  EXPECT_EQ(sizeof(uint32_t) * 5 + total_key_length, builder_->dictionarySizeBytes());
-
-  // Roll it back (this is the last time we will check this, we just need to
-  // cover all the possible paths where the code length may shrink).
-  builder_->undoLastInsert();
-  total_key_length -= values.back().getDataSize();
-  EXPECT_FALSE(builder_->containsValue(values.back()));
-  EXPECT_EQ(2u + GetParam(), builder_->numberOfEntries());
-  EXPECT_EQ(bitsNeededForCodes(2 + GetParam()), builder_->codeLengthBits());
-  EXPECT_EQ(sizeof(uint32_t) * 4 + total_key_length, builder_->dictionarySizeBytes());
-
-  // Insert the rest of the sample values.
-  for (uint32_t sample_idx = 2; sample_idx < kNumSampleValues; ++sample_idx) {
-    values.push_back(varchar_type.makeValue(kSampleStrings[sample_idx],
-                                            strlen(kSampleStrings[sample_idx]) + 1));
-    total_key_length += values.back().getDataSize();
-    EXPECT_TRUE(builder_->insertEntryByReference(values.back()));
-    EXPECT_TRUE(builder_->containsValue(values.back()));
-    EXPECT_EQ(sample_idx + 1 + GetParam(), builder_->numberOfEntries());
-    EXPECT_EQ(bitsNeededForCodes(sample_idx + 1 + GetParam()), builder_->codeLengthBits());
-    EXPECT_EQ(sizeof(uint32_t) * (sample_idx + 3) + total_key_length,
-              builder_->dictionarySizeBytes());
-  }
-
-  // Attempt to insert a duplicate entry.
-  other_value = varchar_type.makeValue(kSampleStrings[kNumSampleValues >> 1],
-                                       strlen(kSampleStrings[kNumSampleValues >> 1]) + 1);
-  EXPECT_FALSE(builder_->insertEntryByReference(other_value));
-  EXPECT_TRUE(builder_->containsValue(other_value));
-  EXPECT_EQ(kNumSampleValues + GetParam(), builder_->numberOfEntries());
-  EXPECT_EQ(bitsNeededForCodes(kNumSampleValues + GetParam()), builder_->codeLengthBits());
-  EXPECT_EQ(sizeof(uint32_t) * (kNumSampleValues + 2) + total_key_length,
-            builder_->dictionarySizeBytes());
-
-  // If type is nullable, attempt to insert a duplicate null.
-  if (GetParam()) {
-    TypedValue null_value = TypedValue(kVarChar);
-    EXPECT_FALSE(builder_->insertEntryByReference(null_value));
-    EXPECT_TRUE(builder_->containsValue(null_value));
-    EXPECT_EQ(kNumSampleValues + GetParam(), builder_->numberOfEntries());
-    EXPECT_EQ(bitsNeededForCodes(kNumSampleValues + GetParam()), builder_->codeLengthBits());
-    EXPECT_EQ(sizeof(uint32_t) * (kNumSampleValues + 2) + total_key_length,
-              builder_->dictionarySizeBytes());
-  }
-
-  // Check for the presence of a nonexistent key.
-  other_value = varchar_type.makeValue("foo", 4);
-  EXPECT_FALSE(builder_->containsValue(other_value));
-
-  // Actually build the physical dictionary.
-  dictionary_memory_.reset(builder_->dictionarySizeBytes());
-  builder_->buildDictionary(dictionary_memory_.get());
-
-  // Check the contents of the physical dictionary.
-  vector<string> sorted_sample_strings(kSampleStrings, kSampleStrings + kNumSampleValues);
-  sort(sorted_sample_strings.begin(), sorted_sample_strings.end());
-
-  const uint32_t *offset_array = static_cast<const uint32_t*>(dictionary_memory_.get()) + 2;
-  const char *value_memory =
-      static_cast<const char*>(dictionary_memory_.get())
-      + (*static_cast<const uint32_t*>(dictionary_memory_.get()) + 2) * sizeof(uint32_t);
-
-  EXPECT_EQ(kNumSampleValues, *static_cast<const uint32_t*>(dictionary_memory_.get()));
-  if (GetParam()) {
-    EXPECT_EQ(kNumSampleValues,
-              *(static_cast<const uint32_t*>(dictionary_memory_.get()) + 1));
-  } else {
-    EXPECT_EQ(numeric_limits<uint32_t>::max(),
-              *(static_cast<const uint32_t*>(dictionary_memory_.get()) + 1));
-  }
-  for (uint32_t sample_idx = 0; sample_idx < kNumSampleValues; ++sample_idx) {
-    EXPECT_STREQ(sorted_sample_strings[sample_idx].c_str(),
-                 value_memory + offset_array[sample_idx]);
-  }
-}
-
-TEST_P(CompressionDictionaryTest, VarCharKeyInfoTest) {
-  setupSampleVarCharDictionary();
-  EXPECT_EQ(kNumSampleValues + GetParam(), dictionary_->numberOfCodes());
-  EXPECT_EQ(bitsNeededForCodes(kNumSampleValues + GetParam()), dictionary_->codeLengthBits());
-}
-
-TEST_P(CompressionDictionaryTest, VarCharKeyGetCodeUntypedTest) {
-  setupSampleVarCharDictionary();
-
-  vector<string> sorted_sample_strings(kSampleStrings, kSampleStrings + kNumSampleValues);
-  sort(sorted_sample_strings.begin(), sorted_sample_strings.end());
-
-  // Check all the codes in the dictionary.
-  for (uint32_t sample_idx = 0; sample_idx < kNumSampleValues; ++sample_idx) {
-    EXPECT_EQ(sample_idx,
-              dictionary_->getCodeForUntypedValue(sorted_sample_strings[sample_idx].c_str()));
-  }
-
-  if (GetParam()) {
-    EXPECT_EQ(kNumSampleValues, dictionary_->getCodeForUntypedValue(nullptr));
-  }
-
-  // Check a value that isn't in the dictionary.
-  EXPECT_EQ(kNumSampleValues + GetParam(), dictionary_->getCodeForUntypedValue("foo"));
-}
-
-TEST_P(CompressionDictionaryTest, VarCharKeyGetCodeTypedTest) {
-  setupSampleVarCharDictionary();
-
-  vector<string> sorted_sample_strings(kSampleStrings, kSampleStrings + kNumSampleValues);
-  sort(sorted_sample_strings.begin(), sorted_sample_strings.end());
-
-  // Check all the codes in the dictionary.
-  const VarCharType &varchar_type = VarCharType::InstanceNonNullable(kVarCharSizeParameter);
-  for (uint32_t sample_idx = 0; sample_idx < kNumSampleValues; ++sample_idx) {
-    TypedValue value = varchar_type.makeValue(sorted_sample_strings[sample_idx].c_str(),
-                                              sorted_sample_strings[sample_idx].size() + 1);
-    EXPECT_EQ(sample_idx, dictionary_->getCodeForTypedValue(value, varchar_type));
-  }
-
-  if (GetParam()) {
-    EXPECT_EQ(kNumSampleValues,
-              dictionary_->getCodeForTypedValue(TypedValue(kVarChar), *dictionary_type_));
-  }
-
-  // Check a value that isn't in the dictionary.
-  TypedValue other_value = varchar_type.makeValue("foo", 4);
-  EXPECT_EQ(kNumSampleValues + GetParam(),
-            dictionary_->getCodeForTypedValue(other_value, varchar_type));
-}
-
-// Same as above, but use CharType literals.
-TEST_P(CompressionDictionaryTest, VarCharKeyGetCodeDifferentTypeTest) {
-  setupSampleVarCharDictionary();
-
-  vector<string> sorted_sample_strings(kSampleStrings, kSampleStrings + kNumSampleValues);
-  sort(sorted_sample_strings.begin(), sorted_sample_strings.end());
-
-  // Check all the codes in the dictionary.
-  const CharType &char_type = CharType::InstanceNonNullable(kVarCharSizeParameter + 10);
-  for (uint32_t sample_idx = 0; sample_idx < kNumSampleValues; ++sample_idx) {
-    TypedValue value = char_type.makeValue(sorted_sample_strings[sample_idx].c_str(),
-                                           sorted_sample_strings[sample_idx].size() + 1);
-    EXPECT_EQ(sample_idx, dictionary_->getCodeForTypedValue(value, char_type));
-  }
-
-  if (GetParam()) {
-    EXPECT_EQ(kNumSampleValues,
-              dictionary_->getCodeForTypedValue(TypedValue(kChar),
-                                                CharType::InstanceNullable(kVarCharSizeParameter)));
-  }
-
-  // Check a value that isn't in the dictionary.
-  TypedValue other_value = char_type.makeValue("foo", 4);
-  EXPECT_EQ(kNumSampleValues + GetParam(),
-            dictionary_->getCodeForTypedValue(other_value, char_type));
-}
-
-TEST_P(CompressionDictionaryTest, VarCharKeyGetValueUntypedTest) {
-  setupSampleVarCharDictionary();
-
-  vector<string> sorted_sample_strings(kSampleStrings, kSampleStrings + kNumSampleValues);
-  sort(sorted_sample_strings.begin(), sorted_sample_strings.end());
-
-  for (uint8_t code = 0; code < kNumSampleValues; ++code) {
-    const char *value_ptr = static_cast<const char*>(dictionary_->getUntypedValueForByteCode(code));
-    EXPECT_STREQ(sorted_sample_strings[code].c_str(), value_ptr);
-    value_ptr = static_cast<const char*>(dictionary_->getUntypedValueForShortCode(code));
-    EXPECT_STREQ(sorted_sample_strings[code].c_str(), value_ptr);
-    value_ptr = static_cast<const char*>(dictionary_->getUntypedValueForCode(code));
-    EXPECT_STREQ(sorted_sample_strings[code].c_str(), value_ptr);
-  }
-
-  if (GetParam()) {
-    const void *value_ptr = dictionary_->getUntypedValueForByteCode(kNumSampleValues);
-    EXPECT_EQ(nullptr, value_ptr);
-    value_ptr = dictionary_->getUntypedValueForShortCode(kNumSampleValues);
-    EXPECT_EQ(nullptr, value_ptr);
-    value_ptr = dictionary_->getUntypedValueForCode(kNumSampleValues);
-    EXPECT_EQ(nullptr, value_ptr);
-  }
-}
-
-TEST_P(CompressionDictionaryTest, VarCharKeyGetValueTypedTest) {
-  setupSampleVarCharDictionary();
-
-  vector<string> sorted_sample_strings(kSampleStrings, kSampleStrings + kNumSampleValues);
-  sort(sorted_sample_strings.begin(), sorted_sample_strings.end());
-
-  const VarCharType &varchar_type = VarCharType::Instance(kVarCharSizeParameter, GetParam());
-  const Comparison &equal_comp = ComparisonFactory::GetComparison(ComparisonID::kEqual);
-  for (uint8_t code = 0; code < kNumSampleValues; ++code) {
-    TypedValue expected_value = varchar_type.makeValue(sorted_sample_strings[code].c_str(),
-                                                       sorted_sample_strings[code].size());
-
-    TypedValue value = dictionary_->getTypedValueForByteCode(code);
-    EXPECT_TRUE(equal_comp.compareTypedValuesChecked(expected_value, varchar_type,
-                                                     value, varchar_type));
-    value = dictionary_->getTypedValueForShortCode(code);
-    EXPECT_TRUE(equal_comp.compareTypedValuesChecked(expected_value, varchar_type,
-                                                     value, varchar_type));
-    value = dictionary_->getTypedValueForCode(code);
-    EXPECT_TRUE(equal_comp.compareTypedValuesChecked(expected_value, varchar_type,
-                                                     value, varchar_type));
-  }
-
-  if (GetParam()) {
-    TypedValue value = dictionary_->getTypedValueForByteCode(kNumSampleValues);
-    EXPECT_TRUE(value.isNull());
-    EXPECT_EQ(kVarChar, value.getTypeID());
-    value = dictionary_->getTypedValueForShortCode(kNumSampleValues);
-    EXPECT_TRUE(value.isNull());
-    EXPECT_EQ(kVarChar, value.getTypeID());
-    value = dictionary_->getTypedValueForCode(kNumSampleValues);
-    EXPECT_TRUE(value.isNull());
-    EXPECT_EQ(kVarChar, value.getTypeID());
-  }
-}
-
-TEST_P(CompressionDictionaryTest, VarCharKeyBoundCodesUntypedTest) {
-  setupSampleVarCharDictionary();
-
-  vector<string> sorted_sample_strings(kSampleStrings, kSampleStrings + kNumSampleValues);
-  sort(sorted_sample_strings.begin(), sorted_sample_strings.end());
-
-  // Check bounds for all the values which are actually in the dictionary.
-  for (uint32_t sorted_value_idx = 0;
-       sorted_value_idx < kNumSampleValues;
-       ++sorted_value_idx) {
-    EXPECT_EQ(sorted_value_idx,
-              dictionary_->getLowerBoundCodeForUntypedValue(sorted_sample_strings[sorted_value_idx].c_str()));
-    EXPECT_EQ(sorted_value_idx + 1,
-              dictionary_->getUpperBoundCodeForUntypedValue(sorted_sample_strings[sorted_value_idx].c_str()));
-  }
-
-  // Check a value less than the least value in the dictionary.
-  string other_value = sorted_sample_strings.front();
-  other_value.resize(other_value.size() - 1);
-  EXPECT_EQ(0u, dictionary_->getLowerBoundCodeForUntypedValue(other_value.c_str()));
-  EXPECT_EQ(0u, dictionary_->getUpperBoundCodeForUntypedValue(other_value.c_str()));
-
-  // Check a value larger than the greatest value in the dictionary.
-  other_value = sorted_sample_strings.back();
-  other_value.push_back('z');
-  EXPECT_EQ(kNumSampleValues + GetParam(),
-            dictionary_->getLowerBoundCodeForUntypedValue(other_value.c_str()));
-  // Note: with nulls, the upper bound can actually be less than the lower
-  // bound due to an implementation quirk.
-  EXPECT_EQ(kNumSampleValues,
-            dictionary_->getUpperBoundCodeForUntypedValue(other_value.c_str()));
-
-  // Check a value between the last two.
-  other_value = *(sorted_sample_strings.end() - 2);
-  other_value.push_back('z');
-  EXPECT_EQ(kNumSampleValues - 1, dictionary_->getLowerBoundCodeForUntypedValue(other_value.c_str()));
-  EXPECT_EQ(kNumSampleValues - 1, dictionary_->getUpperBoundCodeForUntypedValue(other_value.c_str()));
-}
-
-TEST_P(CompressionDictionaryTest, VarCharKeyBoundCodesTypedTest) {
-  setupSampleVarCharDictionary();
-
-  vector<string> sorted_sample_strings(kSampleStrings, kSampleStrings + kNumSampleValues);
-  sort(sorted_sample_strings.begin(), sorted_sample_strings.end());
-
-  const VarCharType &varchar_type = VarCharType::InstanceNonNullable(kVarCharSizeParameter);
-  TypedValue value;
-  // Check bounds for all the values which are actually in the dictionary.
-  for (uint32_t sorted_value_idx = 0;
-       sorted_value_idx < kNumSampleValues;
-       ++sorted_value_idx) {
-    value = varchar_type.makeValue(sorted_sample_strings[sorted_value_idx].c_str(),
-                                   sorted_sample_strings[sorted_value_idx].size() + 1);
-    EXPECT_EQ(sorted_value_idx,
-              dictionary_->getLowerBoundCodeForTypedValue(value, varchar_type));
-    EXPECT_EQ(sorted_value_idx + 1,
-              dictionary_->getUpperBoundCodeForTypedValue(value, varchar_type));
-  }
-
-  // Check a value less than the least value in the dictionary.
-  string other_str = sorted_sample_strings.front();
-  other_str.resize(other_str.size() - 1);
-  value = varchar_type.makeValue(other_str.c_str(), other_str.size() + 1);
-  EXPECT_EQ(0u, dictionary_->getLowerBoundCodeForTypedValue(value, varchar_type));
-  EXPECT_EQ(0u, dictionary_->getUpperBoundCodeForTypedValue(value, varchar_type));
-
-  // Check a value larger than the greatest value in the dictionary.
-  other_str = sorted_sample_strings.back();
-  other_str.push_back('z');
-  value = varchar_type.makeValue(other_str.c_str(), other_str.size() + 1);
-  EXPECT_EQ(kNumSampleValues + GetParam(),
-            dictionary_->getLowerBoundCodeForTypedValue(value, varchar_type));
-  // Note: with nulls, the upper bound can actually be less than the lower
-  // bound due to an implementation quirk.
-  EXPECT_EQ(kNumSampleValues,
-            dictionary_->getUpperBoundCodeForTypedValue(value, varchar_type));
-
-  // Check a value between the last two.
-  other_str = *(sorted_sample_strings.end() - 2);
-  other_str.push_back('z');
-  value = varchar_type.makeValue(other_str.c_str(), other_str.size() + 1);
-  EXPECT_EQ(kNumSampleValues - 1,
-            dictionary_->getLowerBoundCodeForTypedValue(value, varchar_type));
-  EXPECT_EQ(kNumSampleValues - 1,
-            dictionary_->getUpperBoundCodeForTypedValue(value, varchar_type));
-}
-
-// Same as above, but use CharType literals.
-TEST_P(CompressionDictionaryTest, VarCharKeyBoundCodesDifferentTypeTest) {
-  setupSampleVarCharDictionary();
-
-  vector<string> sorted_sample_strings(kSampleStrings, kSampleStrings + kNumSampleValues);
-  sort(sorted_sample_strings.begin(), sorted_sample_strings.end());
-
-  const CharType &char_type = CharType::InstanceNonNullable(kVarCharSizeParameter + 10);
-  TypedValue value;
-  // Check bounds for all the values which are actually in the dictionary.
-  for (uint32_t sorted_value_idx = 0;
-       sorted_value_idx < kNumSampleValues;
-       ++sorted_value_idx) {
-    value = char_type.makeValue(sorted_sample_strings[sorted_value_idx].c_str(),
-                                sorted_sample_strings[sorted_value_idx].size() + 1);
-    EXPECT_EQ(sorted_value_idx,
-              dictionary_->getLowerBoundCodeForTypedValue(value, char_type));
-    EXPECT_EQ(sorted_value_idx + 1,
-              dictionary_->getUpperBoundCodeForTypedValue(value, char_type));
-  }
-
-  // Check a value less than the least value in the dictionary.
-  string other_str = sorted_sample_strings.front();
-  other_str.resize(other_str.size() - 1);
-  value = char_type.makeValue(other_str.c_str(), other_str.size() + 1);
-  EXPECT_EQ(0u, dictionary_->getLowerBoundCodeForTypedValue(value, char_type));
-  EXPECT_EQ(0u, dictionary_->getUpperBoundCodeForTypedValue(value, char_type));
-
-  // Check a value larger than the greatest value in the dictionary.
-  other_str = sorted_sample_strings.back();
-  other_str.push_back('z');
-  value = char_type.makeValue(other_str.c_str(), other_str.size() + 1);
-  EXPECT_EQ(kNumSampleValues + GetParam(),
-            dictionary_->getLowerBoundCodeForTypedValue(value, char_type));
-  // Note: with nulls, the upper bound can actually be less than the lower
-  // bound due to an implementation quirk.
-  EXPECT_EQ(kNumSampleValues,
-            dictionary_->getUpperBoundCodeForTypedValue(value, char_type));
-
-  // Check a value between the last two.
-  other_str = *(sorted_sample_strings.end() - 2);
-  other_str.push_back('z');
-  value = char_type.makeValue(other_str.c_str(), other_str.size() + 1);
-  EXPECT_EQ(kNumSampleValues - 1,
-            dictionary_->getLowerBoundCodeForTypedValue(value, char_type));
-  EXPECT_EQ(kNumSampleValues - 1,
-            dictionary_->getUpperBoundCodeForTypedValue(value, char_type));
-}
-
-TEST_P(CompressionDictionaryTest, VarCharKeyLimitCodesForComparisonUntypedTest) {
-  setupSampleVarCharDictionary();
-
-  vector<string> sorted_sample_strings(kSampleStrings, kSampleStrings + kNumSampleValues);
-  sort(sorted_sample_strings.begin(), sorted_sample_strings.end());
-
-  pair<uint32_t, uint32_t> limits;
-  for (uint32_t sorted_value_idx = 0;
-       sorted_value_idx < kNumSampleValues;
-       ++sorted_value_idx) {
-    limits = dictionary_->getLimitCodesForComparisonUntyped(ComparisonID::kEqual,
-                                                            sorted_sample_strings[sorted_value_idx].c_str());
-    EXPECT_EQ(sorted_value_idx, limits.first);
-    EXPECT_EQ(sorted_value_idx + 1, limits.second);
-
-    limits = dictionary_->getLimitCodesForComparisonUntyped(ComparisonID::kLess,
-                                                            sorted_sample_strings[sorted_value_idx].c_str());
-    EXPECT_EQ(0u, limits.first);
-    EXPECT_EQ(sorted_value_idx, limits.second);
-
-    limits = dictionary_->getLimitCodesForComparisonUntyped(ComparisonID::kLessOrEqual,
-                                                            sorted_sample_strings[sorted_value_idx].c_str());
-    EXPECT_EQ(0u, limits.first);
-    EXPECT_EQ(sorted_value_idx + 1, limits.second);
-
-    limits = dictionary_->getLimitCodesForComparisonUntyped(ComparisonID::kGreater,
-             

<TRUNCATED>


[10/51] [abbrv] [partial] incubator-quickstep git commit: remove c++ files

Posted by sp...@apache.org.
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_ */


[19/51] [abbrv] [partial] incubator-quickstep git commit: remove c++ files

Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_execution/PolicyEnforcerBase.cpp
----------------------------------------------------------------------
diff --git a/query_execution/PolicyEnforcerBase.cpp b/query_execution/PolicyEnforcerBase.cpp
deleted file mode 100644
index b799d5f..0000000
--- a/query_execution/PolicyEnforcerBase.cpp
+++ /dev/null
@@ -1,187 +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_execution/PolicyEnforcerBase.hpp"
-
-#include <cstddef>
-#include <memory>
-#include <queue>
-#include <unordered_map>
-#include <vector>
-
-#include "catalog/CatalogDatabase.hpp"
-#include "catalog/CatalogRelation.hpp"
-#include "catalog/PartitionScheme.hpp"
-#include "query_execution/QueryExecutionMessages.pb.h"
-#include "query_execution/QueryExecutionState.hpp"
-#include "query_execution/QueryExecutionTypedefs.hpp"
-#include "query_execution/QueryManagerBase.hpp"
-#include "relational_operators/WorkOrder.hpp"
-#include "storage/StorageBlockInfo.hpp"
-
-#include "gflags/gflags.h"
-#include "glog/logging.h"
-
-namespace quickstep {
-
-DEFINE_bool(profile_and_report_workorder_perf, false,
-    "If true, Quickstep will record the exceution time of all the individual "
-    "normal work orders and report it at the end of query execution.");
-
-DEFINE_bool(visualize_execution_dag, false,
-            "If true, visualize the execution plan DAG into a graph in DOT "
-            "format (DOT is a plain text graph description language) which is "
-            "then printed via stderr.");
-
-PolicyEnforcerBase::PolicyEnforcerBase(CatalogDatabaseLite *catalog_database)
-    : catalog_database_(catalog_database),
-      profile_individual_workorders_(FLAGS_profile_and_report_workorder_perf || FLAGS_visualize_execution_dag) {
-}
-
-void PolicyEnforcerBase::processMessage(const TaggedMessage &tagged_message) {
-  std::size_t query_id;
-  QueryManagerBase::dag_node_index op_index;
-
-  switch (tagged_message.message_type()) {
-    case kWorkOrderCompleteMessage: {
-      serialization::WorkOrderCompletionMessage proto;
-      // Note: This proto message contains the time it took to execute the
-      // WorkOrder. It can be accessed in this scope.
-      CHECK(proto.ParseFromArray(tagged_message.message(),
-                                 tagged_message.message_bytes()));
-      decrementNumQueuedWorkOrders(proto);
-
-      if (profile_individual_workorders_) {
-        recordTimeForWorkOrder(proto);
-      }
-
-      query_id = proto.query_id();
-      DCHECK(admitted_queries_.find(query_id) != admitted_queries_.end());
-
-      op_index = proto.operator_index();
-      admitted_queries_[query_id]->processWorkOrderCompleteMessage(op_index);
-      break;
-    }
-    case kRebuildWorkOrderCompleteMessage: {
-      serialization::WorkOrderCompletionMessage proto;
-      // Note: This proto message contains the time it took to execute the
-      // rebuild WorkOrder. It can be accessed in this scope.
-      CHECK(proto.ParseFromArray(tagged_message.message(),
-                                 tagged_message.message_bytes()));
-      decrementNumQueuedWorkOrders(proto);
-
-      query_id = proto.query_id();
-      DCHECK(admitted_queries_.find(query_id) != admitted_queries_.end());
-
-      op_index = proto.operator_index();
-      admitted_queries_[query_id]->processRebuildWorkOrderCompleteMessage(op_index);
-      break;
-    }
-    case kCatalogRelationNewBlockMessage: {
-      serialization::CatalogRelationNewBlockMessage proto;
-      CHECK(proto.ParseFromArray(tagged_message.message(),
-                                 tagged_message.message_bytes()));
-
-      const block_id block = proto.block_id();
-
-      CatalogRelation *relation =
-          static_cast<CatalogDatabase*>(catalog_database_)->getRelationByIdMutable(proto.relation_id());
-      relation->addBlock(block);
-
-      if (proto.has_partition_id()) {
-        relation->getPartitionSchemeMutable()->addBlockToPartition(
-            proto.partition_id(), block);
-      }
-      return;
-    }
-    case kDataPipelineMessage: {
-      serialization::DataPipelineMessage proto;
-      CHECK(proto.ParseFromArray(tagged_message.message(),
-                                 tagged_message.message_bytes()));
-      query_id = proto.query_id();
-      DCHECK(admitted_queries_.find(query_id) != admitted_queries_.end());
-
-      op_index = proto.operator_index();
-      admitted_queries_[query_id]->processDataPipelineMessage(
-          op_index, proto.block_id(), proto.relation_id());
-      break;
-    }
-    case kWorkOrderFeedbackMessage: {
-      WorkOrder::FeedbackMessage msg(
-          const_cast<void *>(tagged_message.message()),
-          tagged_message.message_bytes());
-      query_id = msg.header().query_id;
-      DCHECK(admitted_queries_.find(query_id) != admitted_queries_.end());
-
-      op_index = msg.header().rel_op_index;
-      admitted_queries_[query_id]->processFeedbackMessage(op_index, msg);
-      break;
-    }
-    default:
-      LOG(FATAL) << "Unknown message type found in PolicyEnforcer";
-  }
-  if (admitted_queries_[query_id]->queryStatus(op_index) ==
-          QueryManagerBase::QueryStatusCode::kQueryExecuted) {
-    onQueryCompletion(admitted_queries_[query_id].get());
-
-    removeQuery(query_id);
-    if (!waiting_queries_.empty()) {
-      // Admit the earliest waiting query.
-      QueryHandle *new_query = waiting_queries_.front();
-      waiting_queries_.pop();
-      admitQuery(new_query);
-    }
-  }
-}
-
-void PolicyEnforcerBase::removeQuery(const std::size_t query_id) {
-  DCHECK(admitted_queries_.find(query_id) != admitted_queries_.end());
-  if (!admitted_queries_[query_id]->getQueryExecutionState().hasQueryExecutionFinished()) {
-    LOG(WARNING) << "Removing query with ID " << query_id
-                 << " that hasn't finished its execution";
-  }
-  admitted_queries_.erase(query_id);
-
-  removed_query_ids_.insert(query_id);
-}
-
-bool PolicyEnforcerBase::admitQueries(
-    const std::vector<QueryHandle*> &query_handles) {
-  for (QueryHandle *curr_query : query_handles) {
-    if (!admitQuery(curr_query)) {
-      return false;
-    }
-  }
-  return true;
-}
-
-void PolicyEnforcerBase::recordTimeForWorkOrder(
-    const serialization::WorkOrderCompletionMessage &proto) {
-  const std::size_t query_id = proto.query_id();
-  std::vector<WorkOrderTimeEntry> &workorder_time_entries
-      = workorder_time_recorder_[query_id];
-  workorder_time_entries.emplace_back();
-  WorkOrderTimeEntry &entry = workorder_time_entries.back();
-  entry.worker_id = proto.worker_thread_index(),
-  entry.operator_id = proto.operator_index(),
-  entry.start_time = proto.execution_start_time(),
-  entry.end_time = proto.execution_end_time();
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_execution/PolicyEnforcerBase.hpp
----------------------------------------------------------------------
diff --git a/query_execution/PolicyEnforcerBase.hpp b/query_execution/PolicyEnforcerBase.hpp
deleted file mode 100644
index baf9c68..0000000
--- a/query_execution/PolicyEnforcerBase.hpp
+++ /dev/null
@@ -1,208 +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_EXECUTION_POLICY_ENFORCER_BASE_HPP_
-#define QUICKSTEP_QUERY_EXECUTION_POLICY_ENFORCER_BASE_HPP_
-
-#include <cstddef>
-#include <memory>
-#include <queue>
-#include <unordered_map>
-#include <unordered_set>
-#include <vector>
-
-#include "query_execution/QueryExecutionTypedefs.hpp"
-#include "query_execution/QueryManagerBase.hpp"
-#include "utility/Macros.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-class CatalogDatabaseLite;
-class QueryHandle;
-
-namespace serialization { class WorkOrderCompletionMessage; }
-
-/** \addtogroup QueryExecution
- *  @{
- */
-
-/**
- * @brief A base class that ensures that a high level policy is maintained
- *        in sharing resources among concurrent queries.
- **/
-class PolicyEnforcerBase {
- public:
-  /**
-   * @brief Constructor.
-   *
-   * @param catalog_database The CatalogDatabase used.
-   **/
-  explicit PolicyEnforcerBase(CatalogDatabaseLite *catalog_database);
-
-  /**
-   * @brief Virtual Destructor.
-   **/
-  virtual ~PolicyEnforcerBase() {
-    if (hasQueries()) {
-      LOG(WARNING) << "Destructing PolicyEnforcer with some unfinished or "
-                      "waiting queries";
-    }
-  }
-
-  /**
-   * @brief Admit multiple queries in the system.
-   *
-   * @note In the current simple implementation, we only allow one active
-   *       query in the system. Other queries will have to wait.
-   *
-   * @param query_handles A vector of QueryHandles for the queries to be
-   *        admitted.
-   *
-   * @return True if all the queries were admitted, false if at least one query
-   *         was not admitted.
-   **/
-  bool admitQueries(const std::vector<QueryHandle*> &query_handles);
-
-  /**
-   * @brief Remove a given query that is under execution.
-   *
-   * @note This function is made public so that it is possible for a query
-   *       to be killed. Otherwise, it should only be used privately by the
-   *       class.
-   *
-   * TODO(harshad) - Extend this function to support removal of waiting queries.
-   *
-   * @param query_id The ID of the query to be removed.
-   **/
-  void removeQuery(const std::size_t query_id);
-
-  /**
-   * @brief Process a message sent to the Foreman, which gets passed on to the
-   *        policy enforcer.
-   *
-   * @param message The message.
-   **/
-  void processMessage(const TaggedMessage &tagged_message);
-
-  /**
-   * @brief Check if the given query id ever exists.
-   *
-   * @return True if the query ever exists, otherwise false.
-   **/
-  inline bool existQuery(const std::size_t query_id) const {
-    return admitted_queries_.find(query_id) != admitted_queries_.end() ||
-           removed_query_ids_.find(query_id) != removed_query_ids_.end();
-  }
-
-  /**
-   * @brief Check if there are any queries to be executed.
-   *
-   * @return True if there is at least one active or waiting query, false if
-   *         the policy enforcer doesn't have any query.
-   **/
-  inline bool hasQueries() const {
-    return !(admitted_queries_.empty() && waiting_queries_.empty());
-  }
-
-  /**
-   * @brief Get the profiling results for individual work order execution for a
-   *        given query.
-   *
-   * @note This function should only be called if profiling individual work
-   *       orders option is enabled.
-   *
-   * @param query_id The ID of the query for which the profiling results are
-   *        requested.
-   *
-   * @return A vector of records, each being a single profiling entry.
-   **/
-  inline const std::vector<WorkOrderTimeEntry>& getProfilingResults(
-      const std::size_t query_id) const {
-    DCHECK(profile_individual_workorders_);
-    DCHECK(workorder_time_recorder_.find(query_id) !=
-           workorder_time_recorder_.end());
-    return workorder_time_recorder_.at(query_id);
-  }
-
-  /**
-   * @brief Admit a query to the system.
-   *
-   * @param query_handle The QueryHandle for the new query.
-   *
-   * @return Whether the query was admitted to the system.
-   **/
-  virtual bool admitQuery(QueryHandle *query_handle) = 0;
-
- protected:
-  static constexpr std::size_t kMaxConcurrentQueries = 1;
-
-  /**
-   * @brief Add custom actions upon the completion of a query.
-   *
-   * @param query_manager The query manager.
-   **/
-  virtual void onQueryCompletion(QueryManagerBase *query_manager) {}
-
-  /**
-   * @brief Record the execution time for a finished WorkOrder.
-   *
-   * TODO(harshad) - Extend the functionality to rebuild work orders.
-   *
-   * @param proto The completion message proto sent after the WorkOrder
-   *        execution.
-   **/
-  void recordTimeForWorkOrder(
-      const serialization::WorkOrderCompletionMessage &proto);
-
-  CatalogDatabaseLite *catalog_database_;
-
-  const bool profile_individual_workorders_;
-
-  // Key = query ID, value = QueryManagerBase* for the key query.
-  std::unordered_map<std::size_t, std::unique_ptr<QueryManagerBase>> admitted_queries_;
-
-  // TODO(quickstep-team): Delete a 'query_id' after receiving all
-  // 'QueryInitiateResponseMessage's for the 'query_id'.
-  std::unordered_set<std::size_t> removed_query_ids_;
-
-  // The queries which haven't been admitted yet.
-  std::queue<QueryHandle*> waiting_queries_;
-
-  WorkOrderTimeRecorder workorder_time_recorder_;
-
- private:
-  /**
-   * @brief Decrement the number of queued workorders for the given worker by 1.
-   *
-   * @param proto The completion message proto received after the WorkOrder
-   *        execution.
-   **/
-  virtual void decrementNumQueuedWorkOrders(
-      const serialization::WorkOrderCompletionMessage &proto) = 0;
-
-  DISALLOW_COPY_AND_ASSIGN(PolicyEnforcerBase);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_QUERY_EXECUTION_POLICY_ENFORCER_BASE_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_execution/PolicyEnforcerDistributed.cpp
----------------------------------------------------------------------
diff --git a/query_execution/PolicyEnforcerDistributed.cpp b/query_execution/PolicyEnforcerDistributed.cpp
deleted file mode 100644
index c06fd86..0000000
--- a/query_execution/PolicyEnforcerDistributed.cpp
+++ /dev/null
@@ -1,266 +0,0 @@
-/**
- * Licensed 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_execution/PolicyEnforcerDistributed.hpp"
-
-#include <cstddef>
-#include <cstdlib>
-#include <memory>
-#include <queue>
-#include <utility>
-#include <unordered_map>
-#include <vector>
-
-#include "catalog/Catalog.pb.h"
-#include "catalog/CatalogRelation.hpp"
-#include "query_execution/QueryContext.pb.h"
-#include "query_execution/QueryExecutionMessages.pb.h"
-#include "query_execution/QueryExecutionState.hpp"
-#include "query_execution/QueryExecutionTypedefs.hpp"
-#include "query_execution/QueryExecutionUtil.hpp"
-#include "query_execution/QueryManagerBase.hpp"
-#include "query_execution/QueryManagerDistributed.hpp"
-#include "query_optimizer/QueryHandle.hpp"
-#include "storage/StorageBlockInfo.hpp"
-
-#include "gflags/gflags.h"
-#include "glog/logging.h"
-
-#include "tmb/address.h"
-#include "tmb/id_typedefs.h"
-#include "tmb/message_bus.h"
-#include "tmb/tagged_message.h"
-
-using std::free;
-using std::malloc;
-using std::move;
-using std::size_t;
-using std::unique_ptr;
-using std::vector;
-
-using tmb::TaggedMessage;
-
-namespace quickstep {
-
-namespace S = serialization;
-
-DEFINE_uint64(max_msgs_per_dispatch_round, 20, "Maximum number of messages that"
-              " can be allocated in a single round of dispatch of messages to"
-              " the workers.");
-
-void PolicyEnforcerDistributed::getWorkOrderProtoMessages(
-    vector<unique_ptr<S::WorkOrderMessage>> *work_order_proto_messages) {
-  // Iterate over admitted queries until either there are no more
-  // messages available, or the maximum number of messages have
-  // been collected.
-  DCHECK(work_order_proto_messages->empty());
-  // TODO(harshad) - Make this function generic enough so that it
-  // works well when multiple queries are getting executed.
-  if (admitted_queries_.empty()) {
-    LOG(WARNING) << "Requesting WorkOrderProtoMessages when no query is running";
-    return;
-  }
-
-  const std::size_t per_query_share =
-      FLAGS_max_msgs_per_dispatch_round / admitted_queries_.size();
-  DCHECK_GT(per_query_share, 0u);
-
-  vector<std::size_t> finished_queries_ids;
-
-  for (const auto &admitted_query_info : admitted_queries_) {
-    QueryManagerBase *curr_query_manager = admitted_query_info.second.get();
-    DCHECK(curr_query_manager != nullptr);
-    std::size_t messages_collected_curr_query = 0;
-    while (messages_collected_curr_query < per_query_share) {
-      S::WorkOrderMessage *next_work_order_message =
-          static_cast<QueryManagerDistributed*>(curr_query_manager)->getNextWorkOrderMessage(0);
-      if (next_work_order_message != nullptr) {
-        ++messages_collected_curr_query;
-        work_order_proto_messages->push_back(unique_ptr<S::WorkOrderMessage>(next_work_order_message));
-      } else {
-        // No more work ordes from the current query at this time.
-        // Check if the query's execution is over.
-        if (curr_query_manager->getQueryExecutionState().hasQueryExecutionFinished()) {
-          // If the query has been executed, remove it.
-          finished_queries_ids.push_back(admitted_query_info.first);
-        }
-        break;
-      }
-    }
-  }
-  for (const std::size_t finished_qid : finished_queries_ids) {
-    onQueryCompletion(admitted_queries_[finished_qid].get());
-    removeQuery(finished_qid);
-  }
-}
-
-bool PolicyEnforcerDistributed::admitQuery(QueryHandle *query_handle) {
-  if (admitted_queries_.size() < PolicyEnforcerBase::kMaxConcurrentQueries) {
-    // Ok to admit the query.
-    const std::size_t query_id = query_handle->query_id();
-    if (admitted_queries_.find(query_id) == admitted_queries_.end()) {
-      // NOTE(zuyu): Should call before constructing a 'QueryManager'.
-      // Otherwise, an InitiateRebuildMessage may be sent before 'QueryContext'
-      // initializes.
-      initiateQueryInShiftboss(query_handle);
-
-      // Query with the same ID not present, ok to admit.
-      admitted_queries_[query_id].reset(
-          new QueryManagerDistributed(query_handle, shiftboss_directory_, foreman_client_id_, bus_));
-      return true;
-    } else {
-      LOG(ERROR) << "Query with the same ID " << query_id << " exists";
-      return false;
-    }
-  } else {
-    // This query will have to wait.
-    waiting_queries_.push(query_handle);
-    return false;
-  }
-}
-
-void PolicyEnforcerDistributed::processInitiateRebuildResponseMessage(const tmb::TaggedMessage &tagged_message) {
-  S::InitiateRebuildResponseMessage proto;
-  CHECK(proto.ParseFromArray(tagged_message.message(), tagged_message.message_bytes()));
-
-  const std::size_t query_id = proto.query_id();
-  DCHECK(admitted_queries_.find(query_id) != admitted_queries_.end());
-
-  QueryManagerDistributed *query_manager = static_cast<QueryManagerDistributed*>(admitted_queries_[query_id].get());
-
-  const std::size_t num_rebuild_work_orders = proto.num_rebuild_work_orders();
-  query_manager->processInitiateRebuildResponseMessage(proto.operator_index(), num_rebuild_work_orders);
-  shiftboss_directory_->addNumQueuedWorkOrders(proto.shiftboss_index(), num_rebuild_work_orders);
-
-  if (query_manager->getQueryExecutionState().hasQueryExecutionFinished()) {
-    onQueryCompletion(query_manager);
-
-    removeQuery(query_id);
-    if (!waiting_queries_.empty()) {
-      // Admit the earliest waiting query.
-      QueryHandle *new_query = waiting_queries_.front();
-      waiting_queries_.pop();
-      admitQuery(new_query);
-    }
-  }
-}
-
-void PolicyEnforcerDistributed::initiateQueryInShiftboss(QueryHandle *query_handle) {
-  S::QueryInitiateMessage proto;
-  proto.set_query_id(query_handle->query_id());
-  proto.mutable_catalog_database_cache()->MergeFrom(query_handle->getCatalogDatabaseCacheProto());
-  proto.mutable_query_context()->MergeFrom(query_handle->getQueryContextProto());
-
-  const size_t proto_length = proto.ByteSize();
-  char *proto_bytes = static_cast<char*>(malloc(proto_length));
-  CHECK(proto.SerializeToArray(proto_bytes, proto_length));
-
-  TaggedMessage message(static_cast<const void*>(proto_bytes),
-                        proto_length,
-                        kQueryInitiateMessage);
-  free(proto_bytes);
-
-  // TODO(quickstep-team): Dynamically scale-up/down Shiftbosses.
-  tmb::Address shiftboss_addresses;
-  for (std::size_t i = 0; i < shiftboss_directory_->size(); ++i) {
-    shiftboss_addresses.AddRecipient(shiftboss_directory_->getClientId(i));
-  }
-
-  DLOG(INFO) << "PolicyEnforcerDistributed sent QueryInitiateMessage (typed '" << kQueryInitiateMessage
-             << "') to all Shiftbosses";
-  QueryExecutionUtil::BroadcastMessage(foreman_client_id_,
-                                       shiftboss_addresses,
-                                       move(message),
-                                       bus_);
-}
-
-void PolicyEnforcerDistributed::onQueryCompletion(QueryManagerBase *query_manager) {
-  const QueryHandle *query_handle = query_manager->query_handle();
-
-  const CatalogRelation *query_result = query_handle->getQueryResultRelation();
-  const tmb::client_id cli_id = query_handle->getClientId();
-  const std::size_t query_id = query_handle->query_id();
-
-  // TODO(quickstep-team): Dynamically scale-up/down Shiftbosses.
-  tmb::Address shiftboss_addresses;
-  for (std::size_t i = 0; i < shiftboss_directory_->size(); ++i) {
-    shiftboss_addresses.AddRecipient(shiftboss_directory_->getClientId(i));
-  }
-
-  if (query_result == nullptr) {
-    // Clean up query execution states, i.e., QueryContext, in Shiftbosses.
-    serialization::QueryTeardownMessage proto;
-    proto.set_query_id(query_id);
-
-    const size_t proto_length = proto.ByteSize();
-    char *proto_bytes = static_cast<char*>(malloc(proto_length));
-    CHECK(proto.SerializeToArray(proto_bytes, proto_length));
-
-    TaggedMessage message(static_cast<const void*>(proto_bytes),
-                          proto_length,
-                          kQueryTeardownMessage);
-
-    DLOG(INFO) << "PolicyEnforcerDistributed sent QueryTeardownMessage (typed '" << kQueryTeardownMessage
-               << "') to all Shiftbosses";
-    QueryExecutionUtil::BroadcastMessage(foreman_client_id_,
-                                         shiftboss_addresses,
-                                         move(message),
-                                         bus_);
-
-    TaggedMessage cli_message(kQueryExecutionSuccessMessage);
-
-    // Notify the CLI query execution successfully.
-    DLOG(INFO) << "PolicyEnforcerDistributed sent QueryExecutionSuccessMessage (typed '"
-               << kQueryExecutionSuccessMessage
-               << "') to CLI with TMB client id " << cli_id;
-    const tmb::MessageBus::SendStatus send_status =
-        QueryExecutionUtil::SendTMBMessage(bus_,
-                                           foreman_client_id_,
-                                           cli_id,
-                                           move(cli_message));
-    CHECK(send_status == tmb::MessageBus::SendStatus::kOK);
-    return;
-  }
-
-  // NOTE(zuyu): SaveQueryResultMessage implicitly triggers QueryTeardown in Shiftboss.
-  S::SaveQueryResultMessage proto;
-  proto.set_query_id(query_id);
-  proto.set_relation_id(query_result->getID());
-
-  const vector<block_id> blocks(query_result->getBlocksSnapshot());
-  for (const block_id block : blocks) {
-    proto.add_blocks(block);
-  }
-
-  proto.set_cli_id(cli_id);
-
-  const size_t proto_length = proto.ByteSize();
-  char *proto_bytes = static_cast<char*>(malloc(proto_length));
-  CHECK(proto.SerializeToArray(proto_bytes, proto_length));
-
-  TaggedMessage message(static_cast<const void*>(proto_bytes),
-                        proto_length,
-                        kSaveQueryResultMessage);
-  free(proto_bytes);
-
-  // TODO(quickstep-team): Dynamically scale-up/down Shiftbosses.
-  DLOG(INFO) << "PolicyEnforcerDistributed sent SaveQueryResultMessage (typed '" << kSaveQueryResultMessage
-             << "') to all Shiftbosses";
-  QueryExecutionUtil::BroadcastMessage(foreman_client_id_,
-                                       shiftboss_addresses,
-                                       move(message),
-                                       bus_);
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_execution/PolicyEnforcerDistributed.hpp
----------------------------------------------------------------------
diff --git a/query_execution/PolicyEnforcerDistributed.hpp b/query_execution/PolicyEnforcerDistributed.hpp
deleted file mode 100644
index 146e9af..0000000
--- a/query_execution/PolicyEnforcerDistributed.hpp
+++ /dev/null
@@ -1,113 +0,0 @@
-/**
- * Licensed 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_EXECUTION_POLICY_ENFORCER_DISTRIBUTED_HPP_
-#define QUICKSTEP_QUERY_EXECUTION_POLICY_ENFORCER_DISTRIBUTED_HPP_
-
-#include <cstddef>
-#include <memory>
-#include <vector>
-
-#include "query_execution/PolicyEnforcerBase.hpp"
-#include "query_execution/QueryExecutionMessages.pb.h"
-#include "query_execution/ShiftbossDirectory.hpp"
-#include "utility/Macros.hpp"
-
-#include "tmb/id_typedefs.h"
-
-namespace tmb {
-class MessageBus;
-class TaggedMessage;
-}
-
-namespace quickstep {
-
-class CatalogDatabaseLite;
-class QueryHandle;
-class QueryManagerBase;
-
-namespace serialization { class WorkOrderMessage; }
-
-/** \addtogroup QueryExecution
- *  @{
- */
-
-/**
- * @brief A class that ensures that a high level policy is maintained
- *        in sharing resources among concurrent queries.
- **/
-class PolicyEnforcerDistributed final : public PolicyEnforcerBase {
- public:
-  /**
-   * @brief Constructor.
-   *
-   * @param foreman_client_id The TMB client ID of the Foreman.
-   * @param catalog_database The CatalogDatabase used.
-   * @param bus The TMB.
-   **/
-  PolicyEnforcerDistributed(const tmb::client_id foreman_client_id,
-                            CatalogDatabaseLite *catalog_database,
-                            ShiftbossDirectory *shiftboss_directory,
-                            tmb::MessageBus *bus)
-      : PolicyEnforcerBase(catalog_database),
-        foreman_client_id_(foreman_client_id),
-        shiftboss_directory_(shiftboss_directory),
-        bus_(bus) {}
-
-  /**
-   * @brief Destructor.
-   **/
-  ~PolicyEnforcerDistributed() override {}
-
-  bool admitQuery(QueryHandle *query_handle) override;
-
-  /**
-   * @brief Get work order messages to be dispatched. These messages come from
-   *        the active queries.
-   *
-   * @param work_order_proto_messages The work order messages to be dispatched.
-   **/
-  void getWorkOrderProtoMessages(
-      std::vector<std::unique_ptr<serialization::WorkOrderMessage>> *work_order_proto_messages);
-
-  /**
-   * @brief Process the initiate rebuild work order response message.
-   *
-   * @param tagged_message The message.
-   **/
-  void processInitiateRebuildResponseMessage(const tmb::TaggedMessage &tagged_message);
-
- private:
-  void decrementNumQueuedWorkOrders(const serialization::WorkOrderCompletionMessage &proto) override {
-    shiftboss_directory_->decrementNumQueuedWorkOrders(proto.shiftboss_index());
-  }
-
-  void onQueryCompletion(QueryManagerBase *query_manager) override;
-
-  void initiateQueryInShiftboss(QueryHandle *query_handle);
-
-  const tmb::client_id foreman_client_id_;
-
-  ShiftbossDirectory *shiftboss_directory_;
-
-  tmb::MessageBus *bus_;
-
-  DISALLOW_COPY_AND_ASSIGN(PolicyEnforcerDistributed);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_QUERY_EXECUTION_POLICY_ENFORCER_DISTRIBUTED_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_execution/PolicyEnforcerSingleNode.cpp
----------------------------------------------------------------------
diff --git a/query_execution/PolicyEnforcerSingleNode.cpp b/query_execution/PolicyEnforcerSingleNode.cpp
deleted file mode 100644
index 0aa2ca8..0000000
--- a/query_execution/PolicyEnforcerSingleNode.cpp
+++ /dev/null
@@ -1,111 +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_execution/PolicyEnforcerSingleNode.hpp"
-
-#include <cstddef>
-#include <memory>
-#include <queue>
-#include <utility>
-#include <unordered_map>
-#include <vector>
-
-#include "catalog/CatalogTypedefs.hpp"
-#include "query_execution/QueryExecutionState.hpp"
-#include "query_execution/QueryManagerBase.hpp"
-#include "query_execution/QueryManagerSingleNode.hpp"
-#include "query_execution/WorkerDirectory.hpp"
-#include "query_execution/WorkerMessage.hpp"
-#include "query_optimizer/QueryHandle.hpp"
-
-#include "gflags/gflags.h"
-#include "glog/logging.h"
-
-namespace quickstep {
-
-DEFINE_uint64(max_msgs_per_dispatch_round, 20, "Maximum number of messages that"
-              " can be allocated in a single round of dispatch of messages to"
-              " the workers.");
-
-void PolicyEnforcerSingleNode::getWorkerMessages(
-    std::vector<std::unique_ptr<WorkerMessage>> *worker_messages) {
-  // Iterate over admitted queries until either there are no more
-  // messages available, or the maximum number of messages have
-  // been collected.
-  DCHECK(worker_messages->empty());
-  // TODO(harshad) - Make this function generic enough so that it
-  // works well when multiple queries are getting executed.
-  std::size_t per_query_share = 0;
-  if (!admitted_queries_.empty()) {
-    per_query_share = FLAGS_max_msgs_per_dispatch_round / admitted_queries_.size();
-  } else {
-    LOG(WARNING) << "Requesting WorkerMessages when no query is running";
-    return;
-  }
-  DCHECK_GT(per_query_share, 0u);
-  std::vector<std::size_t> finished_queries_ids;
-
-  for (const auto &admitted_query_info : admitted_queries_) {
-    QueryManagerBase *curr_query_manager = admitted_query_info.second.get();
-    DCHECK(curr_query_manager != nullptr);
-    std::size_t messages_collected_curr_query = 0;
-    while (messages_collected_curr_query < per_query_share) {
-      WorkerMessage *next_worker_message =
-          static_cast<QueryManagerSingleNode*>(curr_query_manager)->getNextWorkerMessage(0, kAnyNUMANodeID);
-      if (next_worker_message != nullptr) {
-        ++messages_collected_curr_query;
-        worker_messages->push_back(std::unique_ptr<WorkerMessage>(next_worker_message));
-      } else {
-        // No more work ordes from the current query at this time.
-        // Check if the query's execution is over.
-        if (curr_query_manager->getQueryExecutionState().hasQueryExecutionFinished()) {
-          // If the query has been executed, remove it.
-          finished_queries_ids.push_back(admitted_query_info.first);
-        }
-        break;
-      }
-    }
-  }
-  for (const std::size_t finished_qid : finished_queries_ids) {
-    removeQuery(finished_qid);
-  }
-}
-
-bool PolicyEnforcerSingleNode::admitQuery(QueryHandle *query_handle) {
-  if (admitted_queries_.size() < PolicyEnforcerBase::kMaxConcurrentQueries) {
-    // Ok to admit the query.
-    const std::size_t query_id = query_handle->query_id();
-    if (admitted_queries_.find(query_id) == admitted_queries_.end()) {
-      // Query with the same ID not present, ok to admit.
-      admitted_queries_[query_id].reset(
-          new QueryManagerSingleNode(foreman_client_id_, num_numa_nodes_, query_handle,
-                                     catalog_database_, storage_manager_, bus_));
-      return true;
-    } else {
-      LOG(ERROR) << "Query with the same ID " << query_id << " exists";
-      return false;
-    }
-  } else {
-    // This query will have to wait.
-    waiting_queries_.push(query_handle);
-    return false;
-  }
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_execution/PolicyEnforcerSingleNode.hpp
----------------------------------------------------------------------
diff --git a/query_execution/PolicyEnforcerSingleNode.hpp b/query_execution/PolicyEnforcerSingleNode.hpp
deleted file mode 100644
index f87d670..0000000
--- a/query_execution/PolicyEnforcerSingleNode.hpp
+++ /dev/null
@@ -1,111 +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_EXECUTION_POLICY_ENFORCER_SINGLE_NODE_HPP_
-#define QUICKSTEP_QUERY_EXECUTION_POLICY_ENFORCER_SINGLE_NODE_HPP_
-
-#include <cstddef>
-#include <memory>
-#include <vector>
-
-#include "query_execution/PolicyEnforcerBase.hpp"
-#include "query_execution/QueryExecutionMessages.pb.h"
-#include "query_execution/WorkerDirectory.hpp"
-#include "utility/Macros.hpp"
-
-#include "tmb/id_typedefs.h"
-
-namespace tmb { class MessageBus; }
-
-namespace quickstep {
-
-class CatalogDatabaseLite;
-class QueryHandle;
-class StorageManager;
-class WorkerMessage;
-
-/** \addtogroup QueryExecution
- *  @{
- */
-
-/**
- * @brief A class that ensures that a high level policy is maintained
- *        in sharing resources among concurrent queries.
- **/
-class PolicyEnforcerSingleNode final : public PolicyEnforcerBase {
- public:
-  /**
-   * @brief Constructor.
-   *
-   * @param foreman_client_id The TMB client ID of the Foreman.
-   * @param num_numa_nodes Number of NUMA nodes used by the system.
-   * @param catalog_database The CatalogDatabase used.
-   * @param storage_manager The StorageManager used.
-   * @param bus The TMB.
-   **/
-  PolicyEnforcerSingleNode(const tmb::client_id foreman_client_id,
-                           const std::size_t num_numa_nodes,
-                           CatalogDatabaseLite *catalog_database,
-                           StorageManager *storage_manager,
-                           WorkerDirectory *worker_directory,
-                           tmb::MessageBus *bus)
-      : PolicyEnforcerBase(catalog_database),
-        foreman_client_id_(foreman_client_id),
-        num_numa_nodes_(num_numa_nodes),
-        storage_manager_(storage_manager),
-        worker_directory_(worker_directory),
-        bus_(bus) {}
-
-  /**
-   * @brief Destructor.
-   **/
-  ~PolicyEnforcerSingleNode() override {}
-
-  bool admitQuery(QueryHandle *query_handle) override;
-
-  /**
-   * @brief Get worker messages to be dispatched. These worker messages come
-   *        from the active queries.
-   *
-   * @param worker_messages The worker messages to be dispatched.
-   **/
-  void getWorkerMessages(
-      std::vector<std::unique_ptr<WorkerMessage>> *worker_messages);
-
- private:
-  void decrementNumQueuedWorkOrders(const serialization::WorkOrderCompletionMessage &proto) override {
-    worker_directory_->decrementNumQueuedWorkOrders(proto.worker_thread_index());
-  }
-
-  const tmb::client_id foreman_client_id_;
-  const std::size_t num_numa_nodes_;
-
-  StorageManager *storage_manager_;
-  WorkerDirectory *worker_directory_;
-
-  tmb::MessageBus *bus_;
-
-  DISALLOW_COPY_AND_ASSIGN(PolicyEnforcerSingleNode);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_QUERY_EXECUTION_POLICY_ENFORCER_SINGLE_NODE_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_execution/QueryContext.cpp
----------------------------------------------------------------------
diff --git a/query_execution/QueryContext.cpp b/query_execution/QueryContext.cpp
deleted file mode 100644
index 0e6636d..0000000
--- a/query_execution/QueryContext.cpp
+++ /dev/null
@@ -1,266 +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_execution/QueryContext.hpp"
-
-#include <memory>
-#include <unordered_map>
-#include <utility>
-#include <vector>
-
-#include "catalog/CatalogDatabaseLite.hpp"
-#include "catalog/CatalogRelationSchema.hpp"
-#include "catalog/CatalogTypedefs.hpp"
-#include "expressions/ExpressionFactories.hpp"
-#include "expressions/table_generator/GeneratorFunction.pb.h"
-#include "expressions/table_generator/GeneratorFunctionFactory.hpp"
-#include "expressions/table_generator/GeneratorFunctionHandle.hpp"
-#include "query_execution/QueryContext.pb.h"
-#include "storage/AggregationOperationState.hpp"
-#include "storage/HashTable.hpp"
-#include "storage/HashTableFactory.hpp"
-#include "storage/InsertDestination.hpp"
-#include "storage/InsertDestination.pb.h"
-#include "types/TypedValue.hpp"
-#include "types/containers/Tuple.hpp"
-#include "utility/SortConfiguration.hpp"
-#include "utility/lip_filter/LIPFilter.hpp"
-#include "utility/lip_filter/LIPFilterDeployment.hpp"
-#include "utility/lip_filter/LIPFilterFactory.hpp"
-
-#include "glog/logging.h"
-
-#include "tmb/id_typedefs.h"
-
-using std::move;
-using std::unique_ptr;
-using std::vector;
-
-namespace quickstep {
-
-QueryContext::QueryContext(const serialization::QueryContext &proto,
-                           const CatalogDatabaseLite &database,
-                           StorageManager *storage_manager,
-                           const tmb::client_id scheduler_client_id,
-                           tmb::MessageBus *bus) {
-  DCHECK(ProtoIsValid(proto, database))
-      << "Attempted to create QueryContext from an invalid proto description:\n"
-      << proto.DebugString();
-
-  for (int i = 0; i < proto.aggregation_states_size(); ++i) {
-    aggregation_states_.emplace_back(
-        AggregationOperationState::ReconstructFromProto(proto.aggregation_states(i),
-                                                        database,
-                                                        storage_manager));
-  }
-
-  for (int i = 0; i < proto.generator_functions_size(); ++i) {
-    const GeneratorFunctionHandle *func_handle =
-        GeneratorFunctionFactory::Instance().reconstructFromProto(proto.generator_functions(i));
-    DCHECK(func_handle != nullptr);
-    generator_functions_.emplace_back(
-        std::unique_ptr<const GeneratorFunctionHandle>(func_handle));
-  }
-
-  for (int i = 0; i < proto.join_hash_tables_size(); ++i) {
-    join_hash_tables_.emplace_back(
-        JoinHashTableFactory::CreateResizableFromProto(proto.join_hash_tables(i),
-                                                       storage_manager));
-  }
-
-  for (int i = 0; i < proto.insert_destinations_size(); ++i) {
-    const serialization::InsertDestination &insert_destination_proto = proto.insert_destinations(i);
-    insert_destinations_.emplace_back(InsertDestination::ReconstructFromProto(
-        proto.query_id(),
-        insert_destination_proto,
-        database.getRelationSchemaById(insert_destination_proto.relation_id()),
-        storage_manager,
-        scheduler_client_id,
-        bus));
-  }
-
-  for (int i = 0; i < proto.lip_filters_size(); ++i) {
-    lip_filters_.emplace_back(
-        std::unique_ptr<LIPFilter>(
-            LIPFilterFactory::ReconstructFromProto(proto.lip_filters(i))));
-  }
-
-  for (int i = 0; i < proto.lip_filter_deployments_size(); ++i) {
-    lip_deployments_.emplace_back(
-        std::make_unique<LIPFilterDeployment>(
-            proto.lip_filter_deployments(i), lip_filters_));
-  }
-
-  for (int i = 0; i < proto.predicates_size(); ++i) {
-    predicates_.emplace_back(
-        PredicateFactory::ReconstructFromProto(proto.predicates(i), database));
-  }
-
-  for (int i = 0; i < proto.scalar_groups_size(); ++i) {
-    vector<unique_ptr<const Scalar>> scalar_group;
-
-    const serialization::QueryContext::ScalarGroup &scalar_group_proto = proto.scalar_groups(i);
-    for (int j = 0; j < scalar_group_proto.scalars_size(); ++j) {
-      scalar_group.emplace_back(
-          ScalarFactory::ReconstructFromProto(scalar_group_proto.scalars(j), database));
-    }
-
-    scalar_groups_.push_back(move(scalar_group));
-  }
-
-  for (int i = 0; i < proto.sort_configs_size(); ++i) {
-    sort_configs_.emplace_back(
-        SortConfiguration::ReconstructFromProto(proto.sort_configs(i), database));
-  }
-
-  for (int i = 0; i < proto.tuples_size(); ++i) {
-    tuples_.emplace_back(Tuple::ReconstructFromProto(proto.tuples(i)));
-  }
-
-  for (int i = 0; i < proto.update_groups_size(); ++i) {
-    const serialization::QueryContext::UpdateGroup &update_group_proto = proto.update_groups(i);
-
-    std::unordered_map<attribute_id, std::unique_ptr<const Scalar>> update_group;
-    for (int j = 0; j < update_group_proto.update_assignments_size(); ++j) {
-      const serialization::QueryContext::UpdateGroup::UpdateAssignment &update_assignment_proto =
-          update_group_proto.update_assignments(j);
-
-      unique_ptr<const Scalar> scalar(
-          ScalarFactory::ReconstructFromProto(update_assignment_proto.scalar(), database));
-
-      update_group.emplace(update_assignment_proto.attribute_id(), move(scalar));
-    }
-
-    update_groups_.push_back(move(update_group));
-  }
-
-  for (int i = 0; i < proto.window_aggregation_states_size(); ++i) {
-    window_aggregation_states_.emplace_back(
-        WindowAggregationOperationState::ReconstructFromProto(proto.window_aggregation_states(i),
-                                                              database,
-                                                              storage_manager));
-  }
-}
-
-bool QueryContext::ProtoIsValid(const serialization::QueryContext &proto,
-                                const CatalogDatabaseLite &database) {
-  for (int i = 0; i < proto.aggregation_states_size(); ++i) {
-    if (!AggregationOperationState::ProtoIsValid(proto.aggregation_states(i), database)) {
-      return false;
-    }
-  }
-
-  // Each GeneratorFunctionHandle object is serialized as a function name with
-  // a list of arguments. Here checks that the arguments are valid TypedValue's.
-  for (int i = 0; i < proto.generator_functions_size(); ++i) {
-    const serialization::GeneratorFunctionHandle &func_proto = proto.generator_functions(i);
-    for (int j = 0; j < func_proto.args_size(); ++j) {
-      if (!TypedValue::ProtoIsValid(func_proto.args(j))) {
-        return false;
-      }
-    }
-  }
-
-  for (int i = 0; i < proto.join_hash_tables_size(); ++i) {
-    if (!JoinHashTableFactory::ProtoIsValid(proto.join_hash_tables(i))) {
-      return false;
-    }
-  }
-
-  for (int i = 0; i < proto.insert_destinations_size(); ++i) {
-    const serialization::InsertDestination &insert_destination_proto = proto.insert_destinations(i);
-    const relation_id rel_id = insert_destination_proto.relation_id();
-
-    if (!database.hasRelationWithId(rel_id) ||
-        !InsertDestination::ProtoIsValid(insert_destination_proto,
-                                         database.getRelationSchemaById(rel_id))) {
-      return false;
-    }
-  }
-
-  for (int i = 0; i < proto.lip_filters_size(); ++i) {
-    if (!LIPFilterFactory::ProtoIsValid(proto.lip_filters(i))) {
-      return false;
-    }
-  }
-
-  for (int i = 0; i < proto.lip_filter_deployments_size(); ++i) {
-    if (!LIPFilterDeployment::ProtoIsValid(proto.lip_filter_deployments(i))) {
-      return false;
-    }
-  }
-
-  for (int i = 0; i < proto.predicates_size(); ++i) {
-    if (!PredicateFactory::ProtoIsValid(proto.predicates(i), database)) {
-      return false;
-    }
-  }
-
-  for (int i = 0; i < proto.scalar_groups_size(); ++i) {
-    const serialization::QueryContext::ScalarGroup &scalar_group_proto = proto.scalar_groups(i);
-    for (int j = 0; j < scalar_group_proto.scalars_size(); ++j) {
-      if (!ScalarFactory::ProtoIsValid(scalar_group_proto.scalars(j), database)) {
-        return false;
-      }
-    }
-  }
-
-  for (int i = 0; i < proto.sort_configs_size(); ++i) {
-    if (!SortConfiguration::ProtoIsValid(proto.sort_configs(i), database)) {
-      return false;
-    }
-  }
-
-  for (int i = 0; i < proto.tuples_size(); ++i) {
-    if (!Tuple::ProtoIsValid(proto.tuples(i))) {
-      return false;
-    }
-  }
-
-  for (int i = 0; i < proto.update_groups_size(); ++i) {
-    const serialization::QueryContext::UpdateGroup &update_group_proto = proto.update_groups(i);
-
-    const relation_id rel_id = update_group_proto.relation_id();
-    if (!database.hasRelationWithId(rel_id)) {
-      return false;
-    }
-    const CatalogRelationSchema &rel = database.getRelationSchemaById(rel_id);
-
-    for (int j = 0; j < update_group_proto.update_assignments_size(); ++j) {
-      const serialization::QueryContext::UpdateGroup::UpdateAssignment &update_assignment_proto =
-          update_group_proto.update_assignments(j);
-
-      if (!rel.hasAttributeWithId(update_assignment_proto.attribute_id()) ||
-          !ScalarFactory::ProtoIsValid(update_assignment_proto.scalar(), database)) {
-        return false;
-      }
-    }
-  }
-
-  for (int i = 0; i < proto.window_aggregation_states_size(); ++i) {
-    if (!WindowAggregationOperationState::ProtoIsValid(proto.window_aggregation_states(i),
-                                                       database)) {
-      return false;
-    }
-  }
-
-  return proto.IsInitialized();
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_execution/QueryContext.hpp
----------------------------------------------------------------------
diff --git a/query_execution/QueryContext.hpp b/query_execution/QueryContext.hpp
deleted file mode 100644
index 7ad8fa1..0000000
--- a/query_execution/QueryContext.hpp
+++ /dev/null
@@ -1,585 +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_EXECUTION_QUERY_CONTEXT_HPP_
-#define QUICKSTEP_QUERY_EXECUTION_QUERY_CONTEXT_HPP_
-
-#include <cstddef>
-#include <cstdint>
-#include <memory>
-#include <unordered_map>
-#include <vector>
-
-#include "catalog/CatalogTypedefs.hpp"
-#include "expressions/predicate/Predicate.hpp"
-#include "expressions/scalar/Scalar.hpp"
-#include "expressions/table_generator/GeneratorFunctionHandle.hpp"
-#include "storage/AggregationOperationState.hpp"
-#include "storage/HashTable.hpp"
-#include "storage/InsertDestination.hpp"
-#include "storage/WindowAggregationOperationState.hpp"
-#include "types/containers/Tuple.hpp"
-#include "utility/Macros.hpp"
-#include "utility/SortConfiguration.hpp"
-#include "utility/lip_filter/LIPFilter.hpp"
-#include "utility/lip_filter/LIPFilterDeployment.hpp"
-
-#include "glog/logging.h"
-
-#include "tmb/id_typedefs.h"
-
-namespace tmb { class MessageBus; }
-
-namespace quickstep {
-
-class CatalogDatabaseLite;
-class StorageManager;
-
-namespace serialization { class QueryContext; }
-
-/** \addtogroup QueryExecution
- *  @{
- */
-
-/**
- * @brief The QueryContext stores stateful execution info per query.
- **/
-class QueryContext {
- public:
-  /**
-   * @brief A unique identifier for an AggregationOperationState per query.
-   **/
-  typedef std::uint32_t aggregation_state_id;
-
-  /**
-   * @brief A unique identifier for a GeneratorFunctionHandle per query.
-   **/
-  typedef std::uint32_t generator_function_id;
-
-  /**
-   * @brief A unique identifier for an InsertDestination per query.
-   *
-   * @note A negative value indicates a nonexistent InsertDestination.
-   **/
-  typedef std::int32_t insert_destination_id;
-  static constexpr insert_destination_id kInvalidInsertDestinationId = static_cast<insert_destination_id>(-1);
-
-  /**
-   * @brief A unique identifier for a JoinHashTable per query.
-   **/
-  typedef std::uint32_t join_hash_table_id;
-
-  /**
-   * @brief A unique identifier for a LIPFilterDeployment per query.
-   **/
-  typedef std::int32_t lip_deployment_id;
-  static constexpr lip_deployment_id kInvalidLIPDeploymentId = static_cast<lip_deployment_id>(-1);
-
-  /**
-   * @brief A unique identifier for a LIPFilter per query.
-   **/
-  typedef std::uint32_t lip_filter_id;
-
-  /**
-   * @brief A unique identifier for a Predicate per query.
-   *
-   * @note A negative value indicates a null Predicate.
-   **/
-  typedef std::int32_t predicate_id;
-  static constexpr predicate_id kInvalidPredicateId = static_cast<predicate_id>(-1);
-
-  /**
-   * @brief A unique identifier for a group of Scalars per query.
-   *
-   * @note A negative value indicates a nonexistent ScalarGroup.
-   **/
-  typedef std::int32_t scalar_group_id;
-  static constexpr scalar_group_id kInvalidScalarGroupId = static_cast<scalar_group_id>(-1);
-
-  /**
-   * @brief A unique identifier for a SortConfiguration per query.
-   **/
-  typedef std::uint32_t sort_config_id;
-
-  /**
-   * @brief A unique identifier for a Tuple to be inserted per query.
-   **/
-  typedef std::uint32_t tuple_id;
-
-  /**
-   * @brief A unique identifier for a group of UpdateAssignments per query.
-   **/
-  typedef std::uint32_t update_group_id;
-
-  /**
-   * @brief A unique identifier for a window aggregation state.
-   **/
-  typedef std::uint32_t window_aggregation_state_id;
-
-  /**
-   * @brief Constructor.
-   *
-   * @param proto A serialized Protocol Buffer representation of a
-   *        QueryContext, originally generated by the optimizer.
-   * @param database The Database to resolve relation and attribute references
-   *        in.
-   * @param storage_manager The StorageManager to use.
-   * @param scheduler_client_id The TMB client ID of the scheduler thread.
-   * @param bus A pointer to the TMB.
-   **/
-  QueryContext(const serialization::QueryContext &proto,
-               const CatalogDatabaseLite &database,
-               StorageManager *storage_manager,
-               const tmb::client_id scheduler_client_id,
-               tmb::MessageBus *bus);
-
-  ~QueryContext() {}
-
-  /**
-   * @brief Check whether a serialization::QueryContext is fully-formed and
-   *        all parts are valid.
-   *
-   * @param proto A serialized Protocol Buffer representation of a QueryContext,
-   *        originally generated by the optimizer.
-   * @param database The Database to resolve relation and attribute references
-   *        in.
-   * @return Whether proto is fully-formed and valid.
-   **/
-  static bool ProtoIsValid(const serialization::QueryContext &proto,
-                           const CatalogDatabaseLite &database);
-
-  /**
-   * @brief Whether the given AggregationOperationState id is valid.
-   *
-   * @param id The AggregationOperationState id.
-   *
-   * @return True if valid, otherwise false.
-   **/
-  bool isValidAggregationStateId(const aggregation_state_id id) const {
-    return id < aggregation_states_.size();
-  }
-
-  /**
-   * @brief Get the AggregationOperationState.
-   *
-   * @param id The AggregationOperationState id in the query.
-   *
-   * @return The AggregationOperationState, alreadly created in the constructor.
-   **/
-  inline AggregationOperationState* getAggregationState(const aggregation_state_id id) {
-    DCHECK_LT(id, aggregation_states_.size());
-    DCHECK(aggregation_states_[id]);
-    return aggregation_states_[id].get();
-  }
-
-  /**
-   * @brief Destroy the given aggregation state.
-   *
-   * @param id The ID of the AggregationOperationState to destroy.
-   **/
-  inline void destroyAggregationState(const aggregation_state_id id) {
-    DCHECK_LT(id, aggregation_states_.size());
-    DCHECK(aggregation_states_[id]);
-    aggregation_states_[id].reset(nullptr);
-  }
-
-  /**
-   * @brief Destroy the payloads from the aggregation hash tables.
-   *
-   * @warning After calling these methods, the hash table will be in an invalid
-   *          state. No other operation should be performed on them.
-   *
-   * @param id The ID of the AggregationOperationState.
-   **/
-  inline void destroyAggregationHashTablePayload(const aggregation_state_id id) {
-    DCHECK_LT(id, aggregation_states_.size());
-    DCHECK(aggregation_states_[id]);
-    aggregation_states_[id]->destroyAggregationHashTablePayload();
-  }
-
-  /**
-   * @brief Whether the given GeneratorFunctionHandle id is valid.
-   *
-   * @param id The GeneratorFunctionHandle id.
-   *
-   * @return True if valid, otherwise false.
-   **/
-  bool isValidGeneratorFunctionId(const generator_function_id id) const {
-    return id < generator_functions_.size();
-  }
-
-  /**
-   * @brief Get the GeneratorFunctionHandle.
-   *
-   * @param id The GeneratorFunctionHandle id in the query.
-   *
-   * @return The GeneratorFunctionHandle, alreadly created in the constructor.
-   **/
-  inline const GeneratorFunctionHandle& getGeneratorFunctionHandle(
-      const generator_function_id id) {
-    DCHECK_LT(static_cast<std::size_t>(id), generator_functions_.size());
-    return *generator_functions_[id];
-  }
-
-  /**
-   * @brief Whether the given InsertDestination id is valid.
-   *
-   * @param id The InsertDestination id.
-   *
-   * @return True if valid, otherwise false.
-   **/
-  bool isValidInsertDestinationId(const insert_destination_id id) const {
-    return id != kInvalidInsertDestinationId
-        && id >= 0
-        && static_cast<std::size_t>(id) < insert_destinations_.size();
-  }
-
-  /**
-   * @brief Get the InsertDestination.
-   *
-   * @param id The InsertDestination id in the query.
-   *
-   * @return The InsertDestination, alreadly created in the constructor.
-   **/
-  inline InsertDestination* getInsertDestination(const insert_destination_id id) {
-    DCHECK_GE(id, 0);
-    DCHECK_LT(static_cast<std::size_t>(id), insert_destinations_.size());
-    return insert_destinations_[id].get();
-  }
-
-  /**
-   * @brief Destory the given InsertDestination.
-   *
-   * @param id The id of the InsertDestination to destroy.
-   **/
-  inline void destroyInsertDestination(const insert_destination_id id) {
-    DCHECK_GE(id, 0);
-    DCHECK_LT(static_cast<std::size_t>(id), insert_destinations_.size());
-    insert_destinations_[id].reset();
-  }
-
-  /**
-   * @brief Whether the given JoinHashTable id is valid.
-   *
-   * @param id The JoinHashTable id.
-   *
-   * @return True if valid, otherwise false.
-   **/
-  bool isValidJoinHashTableId(const join_hash_table_id id) const {
-    return id < join_hash_tables_.size();
-  }
-
-  /**
-   * @brief Get the JoinHashTable.
-   *
-   * @param id The JoinHashTable id in the query.
-   *
-   * @return The JoinHashTable, already created in the constructor.
-   **/
-  inline JoinHashTable* getJoinHashTable(const join_hash_table_id id) {
-    DCHECK_LT(id, join_hash_tables_.size());
-    return join_hash_tables_[id].get();
-  }
-
-  /**
-   * @brief Destory the given JoinHashTable.
-   *
-   * @param id The id of the JoinHashTable to destroy.
-   **/
-  inline void destroyJoinHashTable(const join_hash_table_id id) {
-    DCHECK_LT(id, join_hash_tables_.size());
-    join_hash_tables_[id].reset();
-  }
-
-  /**
-   * @brief Whether the given LIPFilterDeployment id is valid.
-   *
-   * @param id The LIPFilterDeployment id.
-   *
-   * @return True if valid, otherwise false.
-   **/
-  bool isValidLIPDeploymentId(const lip_deployment_id id) const {
-    return static_cast<std::size_t>(id) < lip_deployments_.size();
-  }
-
-  /**
-   * @brief Get a constant pointer to the LIPFilterDeployment.
-   *
-   * @param id The LIPFilterDeployment id.
-   *
-   * @return The constant pointer to LIPFilterDeployment that is
-   *         already created in the constructor.
-   **/
-  inline const LIPFilterDeployment* getLIPDeployment(
-      const lip_deployment_id id) const {
-    DCHECK_LT(static_cast<std::size_t>(id), lip_deployments_.size());
-    return lip_deployments_[id].get();
-  }
-
-  /**
-   * @brief Destory the given LIPFilterDeployment.
-   *
-   * @param id The id of the LIPFilterDeployment to destroy.
-   **/
-  inline void destroyLIPDeployment(const lip_deployment_id id) {
-    DCHECK_LT(static_cast<std::size_t>(id), lip_deployments_.size());
-    lip_deployments_[id].reset();
-  }
-
-  /**
-   * @brief Whether the given LIPFilter id is valid.
-   *
-   * @param id The LIPFilter id.
-   *
-   * @return True if valid, otherwise false.
-   **/
-  bool isValidLIPFilterId(const lip_filter_id id) const {
-    return id < lip_filters_.size();
-  }
-
-  /**
-   * @brief Get a mutable reference to the LIPFilter.
-   *
-   * @param id The LIPFilter id.
-   *
-   * @return The LIPFilter, already created in the constructor.
-   **/
-  inline LIPFilter* getLIPFilterMutable(const lip_filter_id id) {
-    DCHECK_LT(id, lip_filters_.size());
-    return lip_filters_[id].get();
-  }
-
-  /**
-   * @brief Get a constant pointer to the LIPFilter.
-   *
-   * @param id The LIPFilter id.
-   *
-   * @return The constant pointer to LIPFilter that is
-   *         already created in the constructor.
-   **/
-  inline const LIPFilter* getLIPFilter(const lip_filter_id id) const {
-    DCHECK_LT(id, lip_filters_.size());
-    return lip_filters_[id].get();
-  }
-
-  /**
-   * @brief Destory the given LIPFilter.
-   *
-   * @param id The id of the LIPFilter to destroy.
-   **/
-  inline void destroyLIPFilter(const lip_filter_id id) {
-    DCHECK_LT(id, lip_filters_.size());
-    lip_filters_[id].reset();
-  }
-
-  /**
-   * @brief Whether the given Predicate id is valid or no predicate.
-   *
-   * @param id The Predicate id.
-   *
-   * @return True if valid or no predicate, otherwise false.
-   **/
-  bool isValidPredicate(const predicate_id id) const {
-    return (id == kInvalidPredicateId)  // No predicate.
-        || (id >= 0 && static_cast<std::size_t>(id) < predicates_.size());
-  }
-
-  /**
-   * @brief Get the const Predicate.
-   *
-   * @param id The Predicate id in the query.
-   *
-   * @return The const Predicate (alreadly created in the constructor), or
-   *         nullptr for the given invalid id.
-   **/
-  inline const Predicate* getPredicate(const predicate_id id) {
-    if (id == kInvalidPredicateId) {
-      return nullptr;
-    }
-
-    DCHECK_GE(id, 0);
-    DCHECK_LT(static_cast<std::size_t>(id), predicates_.size());
-    return predicates_[id].get();
-  }
-
-  /**
-   * @brief Whether the given Scalar group id is valid.
-   *
-   * @param id The Scalar group id.
-   *
-   * @return True if valid, otherwise false.
-   **/
-  bool isValidScalarGroupId(const scalar_group_id id) const {
-    return id != kInvalidScalarGroupId
-        && id >= 0
-        && static_cast<std::size_t>(id) < scalar_groups_.size();
-  }
-
-  /**
-   * @brief Get the group of Scalars.
-   *
-   * @param id The Scalar group id in the query.
-   *
-   * @return The reference to the Scalar group, alreadly created in the
-   *         constructor.
-   **/
-  inline const std::vector<std::unique_ptr<const Scalar>>& getScalarGroup(const scalar_group_id id) {
-    DCHECK_GE(id, 0);
-    DCHECK_LT(static_cast<std::size_t>(id), scalar_groups_.size());
-    return scalar_groups_[id];
-  }
-
- /**
-   * @brief Whether the given SortConfiguration id is valid.
-   *
-   * @param id The SortConfiguration id.
-   *
-   * @return True if valid, otherwise false.
-   **/
-  bool isValidSortConfigId(const sort_config_id id) const {
-    return id < sort_configs_.size();
-  }
-
-  /**
-   * @brief Get the SortConfiguration.
-   *
-   * @param id The SortConfiguration id in the query.
-   *
-   * @return The SortConfiguration, alreadly created in the constructor.
-   **/
-  inline const SortConfiguration& getSortConfig(const sort_config_id id) {
-    DCHECK_LT(id, sort_configs_.size());
-    return *sort_configs_[id];
-  }
-
-  /**
-   * @brief Whether the given Tuple id is valid.
-   *
-   * @param id The Tuple id.
-   *
-   * @return True if valid, otherwise false.
-   **/
-  bool isValidTupleId(const tuple_id id) const {
-    return id < tuples_.size();
-  }
-
-  /**
-   * @brief Release the ownership of the Tuple referenced by the id.
-   *
-   * @note Each id should use only once.
-   *
-   * @param id The Tuple id in the query.
-   *
-   * @return The Tuple, alreadly created in the constructor.
-   **/
-  inline Tuple* releaseTuple(const tuple_id id) {
-    DCHECK_LT(id, tuples_.size());
-    DCHECK(tuples_[id]);
-    return tuples_[id].release();
-  }
-
-  /**
-   * @brief Whether the given update assignments group id is valid.
-   *
-   * @param id The group id of the update assignments.
-   *
-   * @return True if valid, otherwise false.
-   **/
-  bool isValidUpdateGroupId(const update_group_id id) const {
-    return static_cast<std::size_t>(id) < update_groups_.size();
-  }
-
-  /**
-   * @brief Get the group of the update assignments for UpdateWorkOrder.
-   *
-   * @param id The group id of the update assignments in the query.
-   *
-   * @return The reference to the update assignments group, alreadly created in the
-   *         constructor.
-   **/
-  inline const std::unordered_map<attribute_id, std::unique_ptr<const Scalar>>& getUpdateGroup(
-      const update_group_id id) {
-    DCHECK_LT(static_cast<std::size_t>(id), update_groups_.size());
-    DCHECK(!update_groups_[id].empty());
-    return update_groups_[id];
-  }
-
-  /**
-   * @brief Whether the given WindowAggregationOperationState id is valid.
-   *
-   * @param id The WindowAggregationOperationState id.
-   *
-   * @return True if valid, otherwise false.
-   **/
-  bool isValidWindowAggregationStateId(const window_aggregation_state_id id) const {
-    return id < window_aggregation_states_.size();
-  }
-
-  /**
-   * @brief Get the WindowAggregationOperationState.
-   *
-   * @param id The WindowAggregationOperationState id in the query.
-   *
-   * @return The WindowAggregationOperationState, already created in the
-   *         constructor.
-   **/
-  inline WindowAggregationOperationState* getWindowAggregationState(
-      const window_aggregation_state_id id) {
-    DCHECK_LT(id, window_aggregation_states_.size());
-    DCHECK(window_aggregation_states_[id]);
-    return window_aggregation_states_[id].get();
-  }
-
-  /**
-   * @brief Release the given WindowAggregationOperationState.
-   *
-   * @param id The id of the WindowAggregationOperationState to destroy.
-   *
-   * @return The WindowAggregationOperationState, already created in the
-   *         constructor.
-   **/
-  inline WindowAggregationOperationState* releaseWindowAggregationState(
-      const window_aggregation_state_id id) {
-    DCHECK_LT(id, window_aggregation_states_.size());
-    DCHECK(window_aggregation_states_[id]);
-    return window_aggregation_states_[id].release();
-  }
-
- private:
-  std::vector<std::unique_ptr<AggregationOperationState>> aggregation_states_;
-  std::vector<std::unique_ptr<const GeneratorFunctionHandle>> generator_functions_;
-  std::vector<std::unique_ptr<InsertDestination>> insert_destinations_;
-  std::vector<std::unique_ptr<JoinHashTable>> join_hash_tables_;
-  std::vector<std::unique_ptr<LIPFilterDeployment>> lip_deployments_;
-  std::vector<std::unique_ptr<LIPFilter>> lip_filters_;
-  std::vector<std::unique_ptr<const Predicate>> predicates_;
-  std::vector<std::vector<std::unique_ptr<const Scalar>>> scalar_groups_;
-  std::vector<std::unique_ptr<const SortConfiguration>> sort_configs_;
-  std::vector<std::unique_ptr<Tuple>> tuples_;
-  std::vector<std::unordered_map<attribute_id, std::unique_ptr<const Scalar>>> update_groups_;
-  std::vector<std::unique_ptr<WindowAggregationOperationState>> window_aggregation_states_;
-
-  DISALLOW_COPY_AND_ASSIGN(QueryContext);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_QUERY_EXECUTION_QUERY_CONTEXT_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_execution/QueryContext.proto
----------------------------------------------------------------------
diff --git a/query_execution/QueryContext.proto b/query_execution/QueryContext.proto
deleted file mode 100644
index ab0f520..0000000
--- a/query_execution/QueryContext.proto
+++ /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.
-
-syntax = "proto2";
-
-package quickstep.serialization;
-
-import "expressions/Expressions.proto";
-import "expressions/table_generator/GeneratorFunction.proto";
-import "storage/AggregationOperationState.proto";
-import "storage/HashTable.proto";
-import "storage/InsertDestination.proto";
-import "storage/WindowAggregationOperationState.proto";
-import "types/containers/Tuple.proto";
-import "utility/SortConfiguration.proto";
-import "utility/lip_filter/LIPFilter.proto";
-
-message QueryContext {
-  message ScalarGroup {
-    repeated Scalar scalars = 1;
-  }
-
-  message UpdateGroup {
-    message UpdateAssignment {
-      required int32 attribute_id = 1;
-      required Scalar scalar = 2;
-    }
-
-    // NOTE(zuyu): Only used for validating UpdateAssignment's attribute_id.
-    required int32 relation_id = 1;
-    repeated UpdateAssignment update_assignments = 2;
-  }
-
-  repeated AggregationOperationState aggregation_states = 1;
-  repeated GeneratorFunctionHandle generator_functions = 2;
-  repeated HashTable join_hash_tables = 3;
-  repeated InsertDestination insert_destinations = 4;
-  repeated LIPFilter lip_filters = 5;
-  repeated LIPFilterDeployment lip_filter_deployments = 6;
-  repeated Predicate predicates = 7;
-  repeated ScalarGroup scalar_groups = 8;
-  repeated SortConfiguration sort_configs = 9;
-  repeated Tuple tuples = 10;
-
-  // NOTE(zuyu): For UpdateWorkOrder only.
-  repeated UpdateGroup update_groups = 11;
-
-  repeated WindowAggregationOperationState window_aggregation_states = 12;
-
-  required uint64 query_id = 13;
-}

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_execution/QueryExecutionMessages.proto
----------------------------------------------------------------------
diff --git a/query_execution/QueryExecutionMessages.proto b/query_execution/QueryExecutionMessages.proto
deleted file mode 100644
index e6d741a..0000000
--- a/query_execution/QueryExecutionMessages.proto
+++ /dev/null
@@ -1,162 +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.
-
-syntax = "proto2";
-
-package quickstep.serialization;
-
-import "catalog/Catalog.proto";
-import "query_execution/QueryContext.proto";
-import "relational_operators/WorkOrder.proto";
-
-// Note: There are different types of completion messages for normal work orders
-// rebuild work orders. This can be potentially helpful when we want to collect
-// different statistics for executing different types of work orders.
-// e.g. In select normal work order completion message, we could be interested
-// in the selectivity of the block whose work order got execute. In rebuild work
-// order completion message, we may be interested in adding the compression
-// ratio or dictionary size of the rebuilt block.
-
-message WorkOrderCompletionMessage {
-  enum WorkOrderType {
-    NORMAL = 0;
-    REBUILD = 1;
-  }
-
-  required WorkOrderType work_order_type = 1;
-
-  required uint64 operator_index = 2;
-  required uint64 worker_thread_index = 3;
-  required uint64 query_id = 4;
-
-  // Epoch time in microseconds.
-  optional uint64 execution_start_time = 5;
-  optional uint64 execution_end_time = 6;
-
-  // Required in the distributed version.
-  optional uint64 shiftboss_index = 7;
-}
-
-message CatalogRelationNewBlockMessage {
-  required int32 relation_id = 1;
-  required fixed64 block_id = 2;
-
-  // Used by PartitionAwareInsertDestination.
-  optional uint64 partition_id = 3;
-  required uint64 query_id = 4;
-}
-
-message DataPipelineMessage {
-  required uint64 operator_index = 1;
-  required fixed64 block_id = 2;
-  required int32 relation_id = 3;
-  required uint64 query_id = 4;
-}
-
-// Distributed version related messages.
-message ShiftbossRegistrationMessage {
-  // The total Work Order processing capacity in Shiftboss, which equals to the
-  // sum of the capacity of each worker managed by Shiftboss.
-  required uint64 work_order_capacity = 1;
-}
-
-message ShiftbossRegistrationResponseMessage {
-  required uint64 shiftboss_index = 1;
-}
-
-message QueryInitiateMessage {
-  required uint64 query_id = 1;
-  required CatalogDatabase catalog_database_cache = 2;
-  required QueryContext query_context = 3;
-}
-
-message QueryInitiateResponseMessage {
-  required uint64 query_id = 1;
-}
-
-message WorkOrderMessage {
-  required uint64 query_id = 1;
-  required uint64 operator_index = 2;
-  required WorkOrder work_order = 3;
-}
-
-message InitiateRebuildMessage {
-  required uint64 query_id = 1;
-  required uint64 operator_index = 2;
-  required uint64 insert_destination_index = 3;
-  required  int32 relation_id = 4;
-}
-
-message InitiateRebuildResponseMessage {
-  required uint64 query_id = 1;
-  required uint64 operator_index = 2;
-  required uint64 num_rebuild_work_orders = 3;
-  required uint64 shiftboss_index = 4;
-}
-
-message QueryTeardownMessage {
-  required uint64 query_id = 1;
-}
-
-message SaveQueryResultMessage {
-  required uint64 query_id = 1;
-  required int32 relation_id = 2;
-  repeated fixed64 blocks = 3 [packed=true];
-
-  required uint32 cli_id = 4;  // tmb::client_id.
-}
-
-message SaveQueryResultResponseMessage {
-  required uint64 query_id = 1;
-  required int32 relation_id = 2;
-  required uint32 cli_id = 3;  // tmb::client_id.
-  required uint64 shiftboss_index = 4;
-}
-
-message QueryExecutionSuccessMessage {
-  optional CatalogRelationSchema result_relation = 1;
-}
-
-// BlockLocator related messages.
-message BlockDomainRegistrationMessage {
-  // Format IP:Port, i.e., "0.0.0.0:0".
-  required string domain_network_address = 1;
-}
-
-// Used for RegistrationResponse, Unregistration, and FailureReport.
-message BlockDomainMessage {
-  required uint32 block_domain = 1;
-}
-
-// Used when StorageManager loads or evicts a block or a blob from its buffer
-// pool.
-message BlockLocationMessage {
-  required fixed64 block_id = 1;
-  required uint32 block_domain = 2;
-}
-
-message BlockMessage {
-  required fixed64 block_id = 1;
-}
-
-message LocateBlockResponseMessage {
-  repeated uint32 block_domains = 1;
-}
-
-message GetPeerDomainNetworkAddressesResponseMessage {
-  repeated string domain_network_addresses = 1;
-}

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_execution/QueryExecutionModule.hpp
----------------------------------------------------------------------
diff --git a/query_execution/QueryExecutionModule.hpp b/query_execution/QueryExecutionModule.hpp
deleted file mode 100644
index 89979f1..0000000
--- a/query_execution/QueryExecutionModule.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 QueryExecution
- *
- * The components of query execution including Workers, Foreman (co-ordinator),
- * message classes for queues and for inter thread communication.
-**/

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_execution/QueryExecutionState.hpp
----------------------------------------------------------------------
diff --git a/query_execution/QueryExecutionState.hpp b/query_execution/QueryExecutionState.hpp
deleted file mode 100644
index f5281d5..0000000
--- a/query_execution/QueryExecutionState.hpp
+++ /dev/null
@@ -1,329 +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_EXECUTION_QUERY_EXECUTION_STATE_HPP_
-#define QUICKSTEP_QUERY_EXECUTION_QUERY_EXECUTION_STATE_HPP_
-
-#include <cstddef>
-#include <unordered_map>
-#include <utility>
-#include <vector>
-
-#include "utility/Macros.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-/** \addtogroup QueryExecution
- *  @{
- */
-
-/**
- * @brief A class that tracks the state of the execution of a query which
- *        includes status of operators, number of dispatched work orders etc.
- **/
-class QueryExecutionState {
- public:
-  /**
-   * @brief Constructor.
-   *
-   * @param num_operators Number of relational operators in the query.
-   **/
-  explicit QueryExecutionState(const std::size_t num_operators)
-      : num_operators_(num_operators),
-        num_operators_finished_(0),
-        queued_workorders_per_op_(num_operators, 0),
-        rebuild_required_(num_operators, false),
-        done_gen_(num_operators, false),
-        execution_finished_(num_operators, false) {}
-
-  /**
-   * @brief Get the number of operators in the query.
-   **/
-  inline const std::size_t getNumOperators() const {
-    return num_operators_;
-  }
-
-  /**
-   * @brief Get the number of operators who have finished their execution.
-   **/
-  inline const std::size_t getNumOperatorsFinished() const {
-    return num_operators_finished_;
-  }
-
-  /**
-   * @brief Check if the query has finished its execution.
-   *
-   * @return True if the query has finished its execution, false otherwise.
-   **/
-  inline bool hasQueryExecutionFinished() const {
-    return num_operators_finished_ == num_operators_;
-  }
-
-  /**
-   * @brief Set the rebuild status of the given operator that includes the
-   *        flag for whether the rebuild has been initiated and if so, the
-   *        number of pending rebuild work orders.
-   *
-   * @param operator_index The index of the given operator.
-   * @param num_rebuild_workorders The number of rebuild workorders of the given
-   *        operator.
-   * @param rebuild_initiated True if the rebuild has been initiated, false
-   *        otherwise.
-   **/
-  inline void setRebuildStatus(const std::size_t operator_index,
-                               const std::size_t num_rebuild_workorders,
-                               const bool rebuild_initiated) {
-    DCHECK(operator_index < num_operators_);
-    auto search_res = rebuild_status_.find(operator_index);
-    if (search_res != rebuild_status_.end()) {
-      search_res->second.has_initiated = rebuild_initiated;
-      search_res->second.num_pending_workorders = num_rebuild_workorders;
-    } else {
-      RebuildStatus rebuild_status(rebuild_initiated, num_rebuild_workorders);
-
-      rebuild_status_.emplace(operator_index, std::move(rebuild_status));
-    }
-  }
-
-  /**
-   * @brief Check if the rebuild has been initiated for the given operator.
-   *
-   * @param operator_index The index of the given operator.
-   *
-   * @return True if the rebuild has been initiated, false otherwise.
-   **/
-  inline bool hasRebuildInitiated(const std::size_t operator_index) const {
-    DCHECK(operator_index < num_operators_);
-    const auto search_res = rebuild_status_.find(operator_index);
-    if (search_res != rebuild_status_.end()) {
-      return search_res->second.has_initiated;
-    }
-    return false;
-  }
-
-  /**
-   * @brief Get the number of pending rebuild workorders for the given operator.
-   *
-   * @param operator_index The index of the given operator.
-   *
-   * @return The number of pending rebuild workorders for the given operator.
-   **/
-  inline const std::size_t getNumRebuildWorkOrders(
-      const std::size_t operator_index) const {
-    DCHECK(operator_index < num_operators_);
-    const auto search_res = rebuild_status_.find(operator_index);
-    if (search_res != rebuild_status_.end()) {
-      return search_res->second.num_pending_workorders;
-    }
-    LOG(WARNING) << "Called QueryExecutionState::getNumRebuildWorkOrders() "
-                    "for an operator whose rebuild entry doesn't exist.";
-    return 0;
-  }
-
-  /**
-   * @brief Increment the number of rebuild WorkOrders for the given operator.
-   *
-   * @param operator_index The index of the given operator.
-   * @param num_rebuild_workorders The number of rebuild workorders of the given
-   *        operator.
-   **/
-  inline void incrementNumRebuildWorkOrders(const std::size_t operator_index,
-                                            const std::size_t num_rebuild_workorders) {
-    DCHECK_LT(operator_index, num_operators_);
-    auto search_res = rebuild_status_.find(operator_index);
-    DCHECK(search_res != rebuild_status_.end())
-        << "Called for an operator whose rebuild status does not exist.";
-    DCHECK(search_res->second.has_initiated);
-
-    search_res->second.num_pending_workorders += num_rebuild_workorders;
-  }
-
-  /**
-   * @brief Decrement the number of rebuild WorkOrders for the given operator.
-   *
-   * @param operator_index The index of the given operator.
-   **/
-  inline void decrementNumRebuildWorkOrders(const std::size_t operator_index) {
-    DCHECK(operator_index < num_operators_);
-    auto search_res = rebuild_status_.find(operator_index);
-    CHECK(search_res != rebuild_status_.end())
-        << "Called QueryExecutionState::decrementNumRebuildWorkOrders() for an "
-           "operator whose rebuild entry doesn't exist.";
-
-    DCHECK(search_res->second.has_initiated);
-    DCHECK_GE(search_res->second.num_pending_workorders, 1u);
-
-    --(search_res->second.num_pending_workorders);
-  }
-
-  /**
-   * @brief Increment the number of queued (normal) WorkOrders for the given
-   *        operator.
-   *
-   * @param operator_index The index of the given operator.
-   **/
-  inline void incrementNumQueuedWorkOrders(const std::size_t operator_index) {
-    DCHECK(operator_index < num_operators_);
-    ++queued_workorders_per_op_[operator_index];
-  }
-
-  /**
-   * @brief Decrement the number of queued (normal) WorkOrders for the given
-   *        operator.
-   *
-   * @param operator_index The index of the given operator.
-   **/
-  inline void decrementNumQueuedWorkOrders(const std::size_t operator_index) {
-    DCHECK(operator_index < num_operators_);
-    DCHECK_GT(queued_workorders_per_op_[operator_index], 0u);
-    --queued_workorders_per_op_[operator_index];
-  }
-
-  /**
-   * @brief Get the number of queued (normal) WorkOrders for the given operator.
-   *
-   * @note Queued WorkOrders mean those WorkOrders which have been dispatched
-   *       for execution by the Foreman and haven't yet completed. These are
-   *       different from pending WorkOrders which mean the WorkOrders that
-   *       haven't been dispatched for execution yet.
-   *
-   * @param operator_index The index of the given operator.
-   *
-   * @return The number of queued (normal) WorkOrders for the given operators.
-   **/
-  inline const std::size_t getNumQueuedWorkOrders(
-      const std::size_t operator_index) const {
-    DCHECK(operator_index < num_operators_);
-    return queued_workorders_per_op_[operator_index];
-  }
-
-  /**
-   * @brief Set the rebuild required flag as true for the given operator.
-   *
-   * @param operator_index The index of the given operator.
-   **/
-  inline void setRebuildRequired(const std::size_t operator_index) {
-    DCHECK(operator_index < num_operators_);
-    rebuild_required_[operator_index] = true;
-  }
-
-  /**
-   * @brief Get the rebuild required flag for the given operator.
-   *
-   * @param operator_index The index of the given operator.
-   **/
-  inline bool isRebuildRequired(const std::size_t operator_index) const {
-    DCHECK(operator_index < num_operators_);
-    return rebuild_required_[operator_index];
-  }
-
-  /**
-   * @brief Set the execution finished flag for the given operator as true.
-   *
-   * @note By default this flag is false.
-   *
-   * @param operator_index The index of the given operator.
-   **/
-  inline void setExecutionFinished(const std::size_t operator_index) {
-    DCHECK(operator_index < num_operators_);
-    execution_finished_[operator_index] = true;
-    ++num_operators_finished_;
-  }
-
-  /**
-   * @brief Get the execution finished flag for the given operator.
-   *
-   * @param operator_index The index of the given operator.
-   **/
-  inline bool hasExecutionFinished(const std::size_t operator_index) const {
-    DCHECK(operator_index < num_operators_);
-    return execution_finished_[operator_index];
-  }
-
-  /**
-   * @brief Set the "done generation of workorders" flag as true for the given
-   *        operator.
-   *
-   * @note By default this flag is false.
-   *
-   * @param operator_index The index of the given operator.
-   **/
-  inline void setDoneGenerationWorkOrders(const std::size_t operator_index) {
-    DCHECK(operator_index < num_operators_);
-    done_gen_[operator_index] = true;
-  }
-
-  /**
-   * @brief Get the "done generation of workorders" flag for the given operator.
-   *
-   * @param operator_index The index of the given operator.
-   **/
-  inline bool hasDoneGenerationWorkOrders(const std::size_t operator_index)
-      const {
-    DCHECK(operator_index < num_operators_);
-    return done_gen_[operator_index];
-  }
-
- private:
-  // Total number of operators in the query.
-  const std::size_t num_operators_;
-
-  // Number of operators who've finished their execution.
-  std::size_t num_operators_finished_;
-
-  // A vector to track the number of normal WorkOrders in execution.
-  std::vector<std::size_t> queued_workorders_per_op_;
-
-  // The ith bit denotes if the operator with ID = i requires generation of
-  // rebuild WorkOrders.
-  std::vector<bool> rebuild_required_;
-
-  // The ith bit denotes if the operator with ID = i has finished generating
-  // work orders.
-  std::vector<bool> done_gen_;
-
-  // The ith bit denotes if the operator with ID = i has finished its execution.
-  std::vector<bool> execution_finished_;
-
-  struct RebuildStatus {
-    RebuildStatus(const bool initiated,
-                  const std::size_t num_workorders)
-        : has_initiated(initiated),
-          num_pending_workorders(num_workorders) {}
-
-    // Whether rebuild for operator at index i has been initiated.
-    bool has_initiated;
-    // The number of pending rebuild workorders for the operator.
-    // Valid if and only if 'has_initiated' is true.
-    std::size_t num_pending_workorders;
-  };
-
-  // Key is dag_node_index for which rebuild is required.
-  std::unordered_map<std::size_t, RebuildStatus> rebuild_status_;
-
-  DISALLOW_COPY_AND_ASSIGN(QueryExecutionState);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_QUERY_EXECUTION_QUERY_EXECUTION_STATE_HPP_



[41/51] [abbrv] [partial] incubator-quickstep git commit: remove c++ files

Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/cyclic_dependency.py
----------------------------------------------------------------------
diff --git a/cyclic_dependency.py b/cyclic_dependency.py
deleted file mode 100755
index adb5fc7..0000000
--- a/cyclic_dependency.py
+++ /dev/null
@@ -1,230 +0,0 @@
-#!/usr/bin/env python
-
-# Script to do analyze the dependencies in Quickstep particularly cycles in the
-# dependency graph. This script can be used to find:
-#   1. Cycles in the dependency graph.
-#   2. Strongly connected components in the dependency graph.
-#   3. Find shortest path between two targets.
-#
-# Dependency:
-#   pip install networkx
-#
-# Usage:
-#   Find the shortest path between target1 and target2.
-#       cyclic_dependency.py --path [target1] [target2]
-#   Find strongly connected components in the dependency graph.
-#       cyclic_dependency.py --components
-#   Find cycles in the graph.
-#       cyclic_dependency.py --cycles
-#
-
-# 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.
-
-from __future__ import absolute_import
-from __future__ import division
-from __future__ import print_function
-
-import itertools
-import networkx as nx
-from optparse import OptionParser
-import os
-import pprint
-import sys
-
-# Don't scan these directories for quickstep modules.
-EXCLUDED_TOP_LEVEL_DIRS = ["build", "third_party"]
-
-# Explicitly ignored dependencies (special headers with no other quickstep
-# dependencies).
-IGNORED_DEPENDENCIES = frozenset(["quickstep_threading_WinThreadsAPI"])
-
-# States when scanning a CMakeLists.txt file.
-CMAKE_SCANNING_NONE = 0
-CMAKE_SCANNING_TARGET_LINK_LIBRARIES = 1
-
-# Process a CMake target_link_libraries() command with arguments
-# 'target_link_libraries_args', adding all the quickstep libraries specified
-# to the target's set of dependencies in 'deps_in_cmake'.
-def process_target_link_libraries(directory,
-                                  target_link_libraries_args,
-                                  deps_in_cmake):
-    components = target_link_libraries_args.split()
-    if components[0].startswith("quickstep"):
-        deps = set()
-        # Intentionally count the first part for self-includes
-        for component in components:
-            if component.startswith("quickstep"):
-                deps.add(component)
-        if components[0] in deps_in_cmake:
-            deps_in_cmake[components[0]].update(deps)
-        else:
-            deps_in_cmake[components[0]] = deps
-
-# Scan a CMake file, building up the dependency sets for targets from included
-# C++ headers and from target_link_libraries() specified in CMakeLists.txt and
-# comparing the two for discrepancies.
-def process_cmakelists_file(cmakelists_filename, qs_module_dirs):
-    cmakelists_file = open(cmakelists_filename, "r")
-    directory = os.path.dirname(cmakelists_filename)
-    deps_in_cmake = {}
-    scan_state = CMAKE_SCANNING_NONE
-    stitched_string = ""
-    for line in cmakelists_file:
-        if scan_state == CMAKE_SCANNING_NONE:
-            target_link_libraries_pos = line.find("target_link_libraries(")
-            if target_link_libraries_pos != -1:
-                scan_state = CMAKE_SCANNING_TARGET_LINK_LIBRARIES
-                stitched_string = line[target_link_libraries_pos
-                                       + len("target_link_libraries("):]
-                closing_paren_pos = stitched_string.find(")")
-                if closing_paren_pos != -1:
-                    stitched_string = stitched_string[:closing_paren_pos]
-                    process_target_link_libraries(directory,
-                                                  stitched_string,
-                                                  deps_in_cmake)
-                    stitched_string = ""
-                    scan_state = CMAKE_SCANNING_NONE
-        elif scan_state == CMAKE_SCANNING_TARGET_LINK_LIBRARIES:
-            closing_paren_pos = line.find(")")
-            if closing_paren_pos == -1:
-                stitched_string += line
-            else:
-                stitched_string += line[:closing_paren_pos]
-                process_target_link_libraries(directory,
-                                              stitched_string,
-                                              deps_in_cmake)
-                stitched_string = ""
-                scan_state = CMAKE_SCANNING_NONE
-    return deps_in_cmake
-
-# Create dependency graph in networkx, and returns Digraph() object, node to
-# target mapping, and target to node mapping.
-def create_graph(deps_in_cmake):
-    nodes = set()
-    for source, dest_set in iter(deps_in_cmake.items()):
-        nodes.add(source)
-        nodes.update(dest_set)
-
-    nodes_list = list(nodes)
-    nodes_map = {}
-    for i, n in zip(range(len(nodes_list)), nodes_list):
-        nodes_map[n] = i
-
-    G = nx.DiGraph()
-
-    for source, dest_set in iter(deps_in_cmake.items()):
-        source_node = nodes_map[source]
-        for dest in dest_set:
-            if source == dest: continue
-            dest_node = nodes_map[dest]
-            G.add_edge(source_node, dest_node)
-
-    return G, nodes_list, nodes_map
-
-# Lists the strongly connected components in the graph.
-def find_strongly_connected_components(G, nodes_list):
-    components = 0
-    for n in nx.strongly_connected_components(G):
-        if len(n) > 1:
-            components += 1
-            # Only output components bigger than 1.
-            print([nodes_list[i] for i in n])
-    return components
-
-# Lists cycles in the graph truncating to 100 cycles.
-def find_cycles(G, nodes_list, truncate):
-    cycles = 0
-    for n in nx.simple_cycles(G):
-        print([nodes_list[i] for i in n])
-        cycles += 1
-        if cycles >= truncate:
-            print("Many cycles found. Truncating to {0} cycles.".format(truncate))
-            break
-    return cycles
-
-# Find the shortest path from source to target.
-def find_path(G, nodes_list, nodes_map, source, target):
-    source_node = nodes_map[source]
-    target_node = nodes_map[target]
-    if nx.has_path(G, source_node, target_node):
-        print([nodes_list[i] for i in nx.shortest_path(G,
-                source_node,
-                target_node)])
-    else:
-        print('No path.')
-
-def main():
-    if not os.getcwd().endswith("quickstep"):
-        print("WARNING: you don't appear to be running in the root quickstep "
-              "source directory. Don't blame me if something goes wrong.")
-    qs_module_dirs = []
-    for filename in os.listdir("."):
-        if (os.path.isdir(filename)
-            and not filename.startswith(".")
-            and filename not in EXCLUDED_TOP_LEVEL_DIRS):
-            qs_module_dirs.append(filename)
-    cmakelists_to_process = []
-    for (dirpath, dirnames, filenames) in os.walk('.'):
-        skip = False
-        for excluded_dir in EXCLUDED_TOP_LEVEL_DIRS:
-            if dirpath.startswith(excluded_dir):
-                skip = True
-                break
-        if not skip:
-            if "CMakeLists.txt" in filenames:
-                cmakelists_to_process.append(
-                    os.path.join(dirpath, "CMakeLists.txt"))
-    dependencies = {}
-    for cmakelists_filename in cmakelists_to_process:
-        dependencies.update(process_cmakelists_file(cmakelists_filename,
-                                                    qs_module_dirs))
-    parser = OptionParser()
-    parser.add_option("--components", action='store_true',
-            help='List strongly connected components in the dependency graph.')
-    parser.add_option("--cycles", action='store_true',
-            help='List cycles in the dependency graph.')
-    parser.add_option("--path", action='store_true',
-            help='Output the shortest path between two targets.')
-    parser.add_option("--dependency", action='store_true',
-            help='Output the dependencies graph.')
-    parser.add_option("--truncate", type=int, default=100,
-            help='Truncate cycles to this number. Default: 100.')
-    (options, args) = parser.parse_args()
-
-    if options.dependency:
-        pprint.pprint(dependencies)
-
-    G, nodes_list, nodes_map = create_graph(dependencies)
-
-    if options.path:
-        if len(args) != 2:
-            raise ValueError
-        find_path(G, nodes_list, nodes_map, args[0], args[1])
-        return 0
-    elif options.cycles:
-        return find_cycles(G, nodes_list, options.truncate)
-    else:
-        return find_strongly_connected_components(G, nodes_list)
-
-if __name__ == "__main__":
-    return_code = main()
-    if return_code > 0:
-        sys.exit(1)
-    else:
-        sys.exit(0)
-

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/empty_src.cpp
----------------------------------------------------------------------
diff --git a/empty_src.cpp b/empty_src.cpp
deleted file mode 100644
index 54054d0..0000000
--- a/empty_src.cpp
+++ /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.
- **/
-
-// On OSX, ranlib complains if a static library archive contains no symbols,
-// so we export a dummy global variable.
-#ifdef __APPLE__
-namespace quickstep { extern constexpr int kDarwinGlobalDummy = 0; }
-#endif

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/expressions/CMakeLists.txt b/expressions/CMakeLists.txt
deleted file mode 100644
index b1f1fb1..0000000
--- a/expressions/CMakeLists.txt
+++ /dev/null
@@ -1,71 +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.
-
-add_subdirectory(aggregation)
-add_subdirectory(predicate)
-add_subdirectory(scalar)
-add_subdirectory(table_generator)
-add_subdirectory(window_aggregation)
-
-QS_PROTOBUF_GENERATE_CPP(expressions_Expressions_proto_srcs
-                         expressions_Expressions_proto_hdrs
-                         Expressions.proto)
-
-add_library(quickstep_expressions_ExpressionFactories
-            ExpressionFactories.cpp
-            ExpressionFactories.hpp)
-add_library(quickstep_expressions_Expressions_proto
-            ${expressions_Expressions_proto_srcs})
-
-target_link_libraries(quickstep_expressions_ExpressionFactories
-                      glog
-                      quickstep_catalog_CatalogDatabaseLite
-                      quickstep_catalog_CatalogRelationSchema
-                      quickstep_catalog_CatalogTypedefs
-                      quickstep_expressions_Expressions_proto
-                      quickstep_expressions_predicate_ComparisonPredicate
-                      quickstep_expressions_predicate_ConjunctionPredicate
-                      quickstep_expressions_predicate_DisjunctionPredicate
-                      quickstep_expressions_predicate_NegationPredicate
-                      quickstep_expressions_predicate_Predicate
-                      quickstep_expressions_predicate_TrivialPredicates
-                      quickstep_expressions_scalar_Scalar
-                      quickstep_expressions_scalar_ScalarAttribute
-                      quickstep_expressions_scalar_ScalarBinaryExpression
-                      quickstep_expressions_scalar_ScalarCaseExpression
-                      quickstep_expressions_scalar_ScalarLiteral
-                      quickstep_expressions_scalar_ScalarUnaryExpression
-                      quickstep_types_TypeFactory
-                      quickstep_types_TypedValue
-                      quickstep_types_operations_binaryoperations_BinaryOperationFactory
-                      quickstep_types_operations_comparisons_ComparisonFactory
-                      quickstep_types_operations_unaryoperations_UnaryOperationFactory
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_expressions_Expressions_proto
-                      quickstep_types_Type_proto
-                      quickstep_types_TypedValue_proto
-                      quickstep_types_operations_Operation_proto
-                      ${PROTOBUF_LIBRARY})
-
-# Module all-in-one library:
-add_library(quickstep_expressions ../empty_src.cpp ExpressionsModule.hpp)
-target_link_libraries(quickstep_expressions
-                      quickstep_expressions_ExpressionFactories
-                      quickstep_expressions_Expressions_proto
-                      quickstep_expressions_aggregation
-                      quickstep_expressions_predicate
-                      quickstep_expressions_scalar)

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/ExpressionFactories.cpp
----------------------------------------------------------------------
diff --git a/expressions/ExpressionFactories.cpp b/expressions/ExpressionFactories.cpp
deleted file mode 100644
index 01d22a0..0000000
--- a/expressions/ExpressionFactories.cpp
+++ /dev/null
@@ -1,313 +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 "expressions/ExpressionFactories.hpp"
-
-#include <memory>
-#include <string>
-#include <utility>
-#include <vector>
-
-#include "catalog/CatalogDatabaseLite.hpp"
-#include "catalog/CatalogRelationSchema.hpp"
-#include "catalog/CatalogTypedefs.hpp"
-#include "expressions/Expressions.pb.h"
-#include "expressions/predicate/ComparisonPredicate.hpp"
-#include "expressions/predicate/ConjunctionPredicate.hpp"
-#include "expressions/predicate/DisjunctionPredicate.hpp"
-#include "expressions/predicate/NegationPredicate.hpp"
-#include "expressions/predicate/Predicate.hpp"
-#include "expressions/predicate/TrivialPredicates.hpp"
-#include "expressions/scalar/Scalar.hpp"
-#include "expressions/scalar/ScalarAttribute.hpp"
-#include "expressions/scalar/ScalarBinaryExpression.hpp"
-#include "expressions/scalar/ScalarCaseExpression.hpp"
-#include "expressions/scalar/ScalarLiteral.hpp"
-#include "expressions/scalar/ScalarUnaryExpression.hpp"
-#include "types/TypeFactory.hpp"
-#include "types/TypedValue.hpp"
-#include "types/operations/binary_operations/BinaryOperationFactory.hpp"
-#include "types/operations/comparisons/ComparisonFactory.hpp"
-#include "types/operations/unary_operations/UnaryOperationFactory.hpp"
-#include "utility/Macros.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-class Type;
-
-Predicate* PredicateFactory::ReconstructFromProto(const serialization::Predicate &proto,
-                                                  const CatalogDatabaseLite &database) {
-  DCHECK(ProtoIsValid(proto, database))
-      << "Attempted to create Predicate from an invalid proto description:\n"
-      << proto.DebugString();
-
-  switch (proto.predicate_type()) {
-    case serialization::Predicate::TRUE:
-      return new TruePredicate();
-    case serialization::Predicate::FALSE:
-      return new FalsePredicate();
-    case serialization::Predicate::COMPARISON:
-      return new ComparisonPredicate(
-          ComparisonFactory::ReconstructFromProto(proto.GetExtension(serialization::ComparisonPredicate::comparison)),
-          ScalarFactory::ReconstructFromProto(proto.GetExtension(serialization::ComparisonPredicate::left_operand),
-                                              database),
-          ScalarFactory::ReconstructFromProto(proto.GetExtension(serialization::ComparisonPredicate::right_operand),
-                                              database));
-    case serialization::Predicate::NEGATION:
-      return NegationPredicate::NegatePredicate(
-          ReconstructFromProto(proto.GetExtension(serialization::NegationPredicate::operand), database));
-    case serialization::Predicate::CONJUNCTION: {
-      ConjunctionPredicate* predicate = new ConjunctionPredicate();
-      for (int i = 0;
-           i < proto.ExtensionSize(serialization::PredicateWithList::operands);
-           ++i) {
-        predicate->addPredicate(
-            ReconstructFromProto(proto.GetExtension(serialization::PredicateWithList::operands, i), database));
-      }
-      return predicate;
-    }
-    case serialization::Predicate::DISJUNCTION: {
-      DisjunctionPredicate* predicate = new DisjunctionPredicate();
-      for (int i = 0;
-           i < proto.ExtensionSize(serialization::PredicateWithList::operands);
-           ++i) {
-        predicate->addPredicate(
-            ReconstructFromProto(proto.GetExtension(serialization::PredicateWithList::operands, i), database));
-      }
-      return predicate;
-    }
-    default:
-      FATAL_ERROR("Unknown Predicate Type in PredicateFactory::ReconstructFromProto");
-  }
-}
-
-bool PredicateFactory::ProtoIsValid(const serialization::Predicate &proto,
-                                    const CatalogDatabaseLite &database) {
-  // Check that proto is fully initialized.
-  if (!proto.IsInitialized()) {
-    return false;
-  }
-
-  // Check that the predicate_type is valid, and extensions if any.
-  switch (proto.predicate_type()) {
-    case serialization::Predicate::TRUE:  // Fall through.
-    case serialization::Predicate::FALSE:
-      return true;
-    case serialization::Predicate::COMPARISON: {
-      if (proto.HasExtension(serialization::ComparisonPredicate::comparison)
-          && proto.HasExtension(serialization::ComparisonPredicate::left_operand)
-          && proto.HasExtension(serialization::ComparisonPredicate::right_operand)) {
-        return ComparisonFactory::ProtoIsValid(proto.GetExtension(serialization::ComparisonPredicate::comparison))
-               && ScalarFactory::ProtoIsValid(proto.GetExtension(serialization::ComparisonPredicate::left_operand),
-                                              database)
-               && ScalarFactory::ProtoIsValid(proto.GetExtension(serialization::ComparisonPredicate::right_operand),
-                                              database);
-      }
-      break;
-    }
-    case serialization::Predicate::NEGATION: {
-      if (proto.HasExtension(serialization::NegationPredicate::operand)) {
-        return ProtoIsValid(proto.GetExtension(serialization::NegationPredicate::operand), database);
-      }
-      break;
-    }
-    case serialization::Predicate::CONJUNCTION:  // Fall through.
-    case serialization::Predicate::DISJUNCTION: {
-      for (int i = 0;
-           i < proto.ExtensionSize(serialization::PredicateWithList::operands);
-           ++i) {
-        if (!ProtoIsValid(proto.GetExtension(serialization::PredicateWithList::operands, i), database)) {
-          return false;
-        }
-      }
-
-      return true;
-    }
-    default: {
-      break;
-    }
-  }
-  return false;
-}
-
-Scalar* ScalarFactory::ReconstructFromProto(const serialization::Scalar &proto,
-                                            const CatalogDatabaseLite &database) {
-  DCHECK(ProtoIsValid(proto, database))
-      << "Attempted to create Scalar from an invalid proto description:\n"
-      << proto.DebugString();
-
-  switch (proto.data_source()) {
-    case serialization::Scalar::LITERAL:
-      return new ScalarLiteral(
-          TypedValue::ReconstructFromProto(proto.GetExtension(serialization::ScalarLiteral::literal)),
-          TypeFactory::ReconstructFromProto(proto.GetExtension(serialization::ScalarLiteral::literal_type)));
-    case serialization::Scalar::ATTRIBUTE: {
-      const relation_id rel_id = proto.GetExtension(serialization::ScalarAttribute::relation_id);
-
-      DCHECK(database.hasRelationWithId(rel_id));
-      return new ScalarAttribute(*database.getRelationSchemaById(rel_id).getAttributeById(
-          proto.GetExtension(serialization::ScalarAttribute::attribute_id)));
-    }
-    case serialization::Scalar::UNARY_EXPRESSION: {
-      return new ScalarUnaryExpression(
-          UnaryOperationFactory::ReconstructFromProto(
-              proto.GetExtension(serialization::ScalarUnaryExpression::operation)),
-          ReconstructFromProto(proto.GetExtension(serialization::ScalarUnaryExpression::operand), database));
-    }
-    case serialization::Scalar::BINARY_EXPRESSION: {
-      return new ScalarBinaryExpression(
-          BinaryOperationFactory::ReconstructFromProto(
-              proto.GetExtension(serialization::ScalarBinaryExpression::operation)),
-          ReconstructFromProto(proto.GetExtension(serialization::ScalarBinaryExpression::left_operand), database),
-          ReconstructFromProto(proto.GetExtension(serialization::ScalarBinaryExpression::right_operand), database));
-    }
-    case serialization::Scalar::CASE_EXPRESSION: {
-      const Type &result_type = TypeFactory::ReconstructFromProto(
-          proto.GetExtension(serialization::ScalarCaseExpression::result_type));
-
-      std::vector<std::unique_ptr<Predicate>> when_predicates;
-      for (int when_pred_num = 0;
-           when_pred_num < proto.ExtensionSize(serialization::ScalarCaseExpression::when_predicate);
-           ++when_pred_num) {
-        when_predicates.emplace_back(PredicateFactory::ReconstructFromProto(
-            proto.GetExtension(serialization::ScalarCaseExpression::when_predicate, when_pred_num),
-            database));
-      }
-
-      std::vector<std::unique_ptr<Scalar>> result_expressions;
-      for (int result_expr_num = 0;
-           result_expr_num < proto.ExtensionSize(serialization::ScalarCaseExpression::result_expression);
-           ++result_expr_num) {
-        result_expressions.emplace_back(ReconstructFromProto(
-            proto.GetExtension(serialization::ScalarCaseExpression::result_expression, result_expr_num),
-            database));
-      }
-
-      std::unique_ptr<Scalar> else_result_expression(ReconstructFromProto(
-          proto.GetExtension(serialization::ScalarCaseExpression::else_result_expression),
-          database));
-
-      return new ScalarCaseExpression(result_type,
-                                      std::move(when_predicates),
-                                      std::move(result_expressions),
-                                      else_result_expression.release());
-    }
-    default:
-      FATAL_ERROR("Unknown Scalar data source in ScalarFactory::ReconstructFromProto");
-  }
-}
-
-bool ScalarFactory::ProtoIsValid(const serialization::Scalar &proto,
-                                 const CatalogDatabaseLite &database) {
-  // Check that proto is fully initialized.
-  if (!proto.IsInitialized()) {
-    return false;
-  }
-
-  // Check that the data_source is valid, and extensions if any.
-  switch (proto.data_source()) {
-    case serialization::Scalar::LITERAL: {
-      return proto.HasExtension(serialization::ScalarLiteral::literal)
-             && proto.HasExtension(serialization::ScalarLiteral::literal_type)
-             && TypedValue::ProtoIsValid(proto.GetExtension(serialization::ScalarLiteral::literal))
-             && TypeFactory::ProtoIsValid(proto.GetExtension(serialization::ScalarLiteral::literal_type));
-    }
-    case serialization::Scalar::ATTRIBUTE: {
-      if (proto.HasExtension(serialization::ScalarAttribute::relation_id)
-          && proto.HasExtension(serialization::ScalarAttribute::attribute_id)) {
-        const relation_id rel_id = proto.GetExtension(serialization::ScalarAttribute::relation_id);
-        const attribute_id attr_id = proto.GetExtension(serialization::ScalarAttribute::attribute_id);
-
-        return database.hasRelationWithId(rel_id)
-               && database.getRelationSchemaById(rel_id).hasAttributeWithId(attr_id);
-      }
-      break;
-    }
-    case serialization::Scalar::UNARY_EXPRESSION: {
-      if (proto.HasExtension(serialization::ScalarUnaryExpression::operation)
-          && proto.HasExtension(serialization::ScalarUnaryExpression::operand)) {
-        return UnaryOperationFactory::ProtoIsValid(proto.GetExtension(serialization::ScalarUnaryExpression::operation))
-               && ProtoIsValid(proto.GetExtension(serialization::ScalarUnaryExpression::operand), database);
-      }
-      break;
-    }
-    case serialization::Scalar::BINARY_EXPRESSION: {
-      if (proto.HasExtension(serialization::ScalarBinaryExpression::operation)
-          && proto.HasExtension(serialization::ScalarBinaryExpression::left_operand)
-          && proto.HasExtension(serialization::ScalarBinaryExpression::right_operand)) {
-        return BinaryOperationFactory::ProtoIsValid(
-                   proto.GetExtension(serialization::ScalarBinaryExpression::operation))
-               && ProtoIsValid(proto.GetExtension(serialization::ScalarBinaryExpression::left_operand), database)
-               && ProtoIsValid(proto.GetExtension(serialization::ScalarBinaryExpression::right_operand), database);
-      }
-      break;
-    }
-    case serialization::Scalar::CASE_EXPRESSION: {
-      // Check result type.
-      if (!(proto.HasExtension(serialization::ScalarCaseExpression::result_type)
-            && TypeFactory::ProtoIsValid(proto.GetExtension(
-                serialization::ScalarCaseExpression::result_type)))) {
-        return false;
-      }
-
-      // Check when-predicates and result expressions.
-      if (proto.ExtensionSize(serialization::ScalarCaseExpression::when_predicate)
-          == proto.ExtensionSize(serialization::ScalarCaseExpression::result_expression)) {
-        for (int case_num = 0;
-             case_num < proto.ExtensionSize(serialization::ScalarCaseExpression::when_predicate);
-             ++case_num) {
-          if (!PredicateFactory::ProtoIsValid(
-                  proto.GetExtension(
-                      serialization::ScalarCaseExpression::when_predicate,
-                      case_num),
-                  database)) {
-            return false;
-          }
-          if (!ProtoIsValid(
-                  proto.GetExtension(serialization::ScalarCaseExpression::result_expression,
-                                     case_num),
-                  database)) {
-            return false;
-          }
-        }
-      } else {
-        return false;
-      }
-
-      // Check else-result expression.
-      if (!(proto.HasExtension(serialization::ScalarCaseExpression::else_result_expression)
-            && ProtoIsValid(proto.GetExtension(serialization::ScalarCaseExpression::else_result_expression),
-                            database))) {
-        return false;
-      }
-
-      // Everything checks out.
-      return true;
-    }
-    default: {
-      break;
-    }
-  }
-
-  return false;
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/ExpressionFactories.hpp
----------------------------------------------------------------------
diff --git a/expressions/ExpressionFactories.hpp b/expressions/ExpressionFactories.hpp
deleted file mode 100644
index f959dff..0000000
--- a/expressions/ExpressionFactories.hpp
+++ /dev/null
@@ -1,121 +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_EXPRESSIONS_EXPRESSION_FACTORIES_HPP_
-#define QUICKSTEP_EXPRESSIONS_EXPRESSION_FACTORIES_HPP_
-
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-
-class CatalogDatabaseLite;
-class Predicate;
-class Scalar;
-
-namespace serialization {
-class Predicate;
-class Scalar;
-}  // namespace serialization
-
-/** \addtogroup Expressions
- *  @{
- */
-
-/**
- * @brief All-static factory object that provides access to Predicates.
- **/
-class PredicateFactory {
- public:
-  /**
-   * @brief Get a pointer to a Predicate from its serialized Protocol Buffer
-   *        form.
-   *
-   * @param proto The Protocol Buffer representation of a Predicate object,
-   *        originally generated by getProto().
-   * @param database The Database to resolve relation and attribute references
-   *        in.
-   * @return A new Predicate reconstructed from the supplied Protocol Buffer.
-   **/
-  static Predicate* ReconstructFromProto(const serialization::Predicate &proto,
-                                         const CatalogDatabaseLite &database);
-
-  /**
-   * @brief Check whether a serialization::Predicate is fully-formed and
-   *        all parts are valid.
-   *
-   * @param proto A serialized Protocol Buffer representation of a Predicate,
-   *        originally generated by getProto().
-   * @param database The Database to resolve relation and attribute references
-   *        in.
-   * @return Whether proto is fully-formed and valid.
-   **/
-  static bool ProtoIsValid(const serialization::Predicate &proto,
-                           const CatalogDatabaseLite &database);
-
- private:
-  // Undefined default constructor. Class is all-static and should not be
-  // instantiated.
-  PredicateFactory();
-
-  DISALLOW_COPY_AND_ASSIGN(PredicateFactory);
-};
-
-/**
- * @brief All-static factory object that provides access to Scalars.
- **/
-class ScalarFactory {
- public:
-  /**
-   * @brief Get a pointer to a Scalar from its serialized Protocol Buffer form.
-   *
-   * @param proto The Protocol Buffer representation of a Scalar object,
-   *        originally generated by getProto().
-   * @param database The Database to resolve relation and attribute references
-   *        in.
-   * @return A new Scalar reconstructed from the supplied Protocol Buffer.
-   **/
-  static Scalar* ReconstructFromProto(const serialization::Scalar &proto,
-                                      const CatalogDatabaseLite &database);
-
-  /**
-   * @brief Check whether a serialization::Scalar is fully-formed and
-   *        all parts are valid.
-   *
-   * @param proto A serialized Protocol Buffer representation of a Scalar,
-   *        originally generated by getProto().
-   * @param database The Database to resolve relation and attribute references
-   *        in.
-   * @return Whether proto is fully-formed and valid.
-   **/
-  static bool ProtoIsValid(const serialization::Scalar &proto,
-                           const CatalogDatabaseLite &database);
-
- private:
-  // Undefined default constructor. Class is all-static and should not be
-  // instantiated.
-  ScalarFactory();
-
-  DISALLOW_COPY_AND_ASSIGN(ScalarFactory);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_EXPRESSIONS_EXPRESSION_FACTORIES_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/Expressions.proto
----------------------------------------------------------------------
diff --git a/expressions/Expressions.proto b/expressions/Expressions.proto
deleted file mode 100644
index 8d923c5..0000000
--- a/expressions/Expressions.proto
+++ /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.
-
-syntax = "proto2";
-
-package quickstep.serialization;
-
-import "types/Type.proto";
-import "types/TypedValue.proto";
-import "types/operations/Operation.proto";
-
-// ----------------------------------------------------------------------------
-// Base message types.
-
-message Predicate {
-  enum PredicateType {
-    TRUE = 0;
-    FALSE = 1;
-    COMPARISON = 2;
-    NEGATION = 3;
-    CONJUNCTION = 4;
-    DISJUNCTION = 5;
-  }
-
-  required PredicateType predicate_type = 1;
-
-  // The convention for extension numbering is that extensions for a particular
-  // PredicateType should begin from (predicate_type + 1) * 32.
-  extensions 32 to max;
-}
-
-message Scalar {
-  enum ScalarDataSource {
-    LITERAL = 0;
-    ATTRIBUTE = 1;
-    UNARY_EXPRESSION = 2;
-    BINARY_EXPRESSION = 3;
-    CASE_EXPRESSION = 4;
-  }
-
-  required ScalarDataSource data_source = 1;
-
-  // The convention for extension numbering is that extensions for a particular
-  // ScalarDataSource should begin from (data_source + 1) * 32.
-  extensions 32 to max;
-}
-
-// ----------------------------------------------------------------------------
-// Extensions for Predicate.
-
-message ComparisonPredicate {
-  extend Predicate {
-    optional Comparison comparison = 96;
-    optional Scalar left_operand = 97;
-    optional Scalar right_operand = 98;
-  }
-}
-
-message NegationPredicate {
-  extend Predicate {
-    optional Predicate operand = 128;
-  }
-}
-
-// Either ConjunctionPredicate or DisjunctionPredicate.
-message PredicateWithList {
-  extend Predicate {
-    repeated Predicate operands = 160;
-  }
-}
-
-// ----------------------------------------------------------------------------
-// Extensions for Scalar.
-
-message ScalarLiteral {
-  extend Scalar {
-    optional TypedValue literal = 32;
-    optional Type literal_type = 33;
-  }
-}
-
-message ScalarAttribute {
-  extend Scalar {
-    optional int32 relation_id = 64;
-    optional int32 attribute_id = 65;
-  }
-}
-
-message ScalarUnaryExpression {
-  extend Scalar {
-    optional UnaryOperation operation = 96;
-    optional Scalar operand = 97;
-  }
-}
-
-message ScalarBinaryExpression {
-  extend Scalar {
-    optional BinaryOperation operation = 128;
-    optional Scalar left_operand = 129;
-    optional Scalar right_operand = 130;
-  }
-}
-
-message ScalarCaseExpression {
-  extend Scalar {
-    optional Type result_type = 160;
-    repeated Predicate when_predicate = 161;
-    repeated Scalar result_expression = 162;
-    optional Scalar else_result_expression = 163;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/ExpressionsModule.hpp
----------------------------------------------------------------------
diff --git a/expressions/ExpressionsModule.hpp b/expressions/ExpressionsModule.hpp
deleted file mode 100644
index 5302be7..0000000
--- a/expressions/ExpressionsModule.hpp
+++ /dev/null
@@ -1,23 +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 Expressions
- *
- * A system for evaluating expressions and predicates on data.
- **/

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/aggregation/AggregateFunction.cpp
----------------------------------------------------------------------
diff --git a/expressions/aggregation/AggregateFunction.cpp b/expressions/aggregation/AggregateFunction.cpp
deleted file mode 100644
index 63a297e..0000000
--- a/expressions/aggregation/AggregateFunction.cpp
+++ /dev/null
@@ -1,58 +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 "expressions/aggregation/AggregateFunction.hpp"
-
-#include <type_traits>
-
-#include "expressions/aggregation/AggregateFunction.pb.h"
-#include "expressions/aggregation/AggregationID.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-serialization::AggregateFunction AggregateFunction::getProto() const {
-  serialization::AggregateFunction proto;
-  switch (agg_id_) {
-    case AggregationID::kAvg:
-      proto.set_aggregation_id(serialization::AggregateFunction::AVG);
-      break;
-    case AggregationID::kCount:
-      proto.set_aggregation_id(serialization::AggregateFunction::COUNT);
-      break;
-    case AggregationID::kMax:
-      proto.set_aggregation_id(serialization::AggregateFunction::MAX);
-      break;
-    case AggregationID::kMin:
-      proto.set_aggregation_id(serialization::AggregateFunction::MIN);
-      break;
-    case AggregationID::kSum:
-      proto.set_aggregation_id(serialization::AggregateFunction::SUM);
-      break;
-    default: {
-      LOG(FATAL) << "Unrecognized AggregationID: "
-                 << static_cast<std::underlying_type<AggregationID>::type>(agg_id_);
-    }
-  }
-
-  return proto;
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/aggregation/AggregateFunction.hpp
----------------------------------------------------------------------
diff --git a/expressions/aggregation/AggregateFunction.hpp b/expressions/aggregation/AggregateFunction.hpp
deleted file mode 100644
index cccc699..0000000
--- a/expressions/aggregation/AggregateFunction.hpp
+++ /dev/null
@@ -1,148 +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_EXPRESSIONS_AGGREGATION_AGGREGATE_FUNCTION_HPP_
-#define QUICKSTEP_EXPRESSIONS_AGGREGATION_AGGREGATE_FUNCTION_HPP_
-
-#include <string>
-#include <vector>
-
-#include "expressions/aggregation/AggregateFunction.pb.h"
-#include "expressions/aggregation/AggregationID.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-
-class AggregationHandle;
-class Type;
-
-/** \addtogroup Expressions
- *  @{
- */
-
-/**
- * @brief A class representing a particular aggregate function in the abstract
- *        sense. Each distinct, named aggregate function (e.g. AVG, COUNT, MAX,
- *        MIN, SUM) is represented by a singleton subclass of
- *        AggregateFunction.
- *
- * AggregateFunction provides informational methods about the applicability of
- * a particular aggregate function to particular argument Type(s). The actual
- * implementation of the aggregate functions' logic is in the AggregationHandle
- * class hierarchy, and can be different depending on the particular argument
- * Type(s) given to an aggregate. To perform an aggregation, a caller should
- * first call AggregateFunction::createHandle() to instantiate an
- * AggregationHandle object, then use the methods of AggregationHandle to do
- * the actual aggregation, then finally delete the AggregationHandle when
- * finished.
- *
- * See AggregationHandle for more detailed information about how aggregates are
- * actually computed.
- **/
-class AggregateFunction {
- public:
-  /**
-   * @brief Get the ID of this aggregate (i.e. its unique ID amongst all the
-   *        AggregateFunctions).
-   *
-   * @return The AggregationID of this AggregateFunction.
-   **/
-  inline AggregationID getAggregationID() const {
-    return agg_id_;
-  }
-
-  /**
-   * @brief Get the human-readable name of this AggregateFunction.
-   *
-   * @return The human-readable name of this AggregateFunction.
-   **/
-  virtual std::string getName() const = 0;
-
-  /**
-   * @brief Get the serialized protocol buffer representation of this
-   *        AggregateFunction.
-   *
-   * @return A serialized protocol buffer representation of this
-   *         AggregateFunction.
-   **/
-  virtual serialization::AggregateFunction getProto() const;
-
-  /**
-   * @brief Determine if this AggregateFunction can be applied to arguments of
-   *        particular Type(s).
-   *
-   * @note In general, aggregates can have any arity (number of arguments).
-   *       COUNT(*) has 0 arguments. Ordinary COUNT takes 1 arguments, as do
-   *       the other SQL89 aggregates AVG, MAX, MIN, and SUM. Some statistical
-   *       aggregates (not currently implemented in Quickstep) can take 2 or
-   *       more arguments.
-   *
-   * @param argument_types A list of zero or more Types (in order) for
-   *        arguments to this AggregateFunction.
-   * @return Whether this AggregateFunction is applicable to the given
-   *         argument_types.
-   **/
-  virtual bool canApplyToTypes(
-      const std::vector<const Type*> &argument_types) const = 0;
-
-  /**
-   * @brief Determine the result Type for this AggregateFunction given
-   *        arguments of particular Type(s).
-   *
-   * @param argument_types A list of zero or more Types (in order) for
-   *        arguments to this AggregateFunction.
-   * @return The result Type for this AggregateFunction applied to the
-   *         specified argument_types, or NULL if this AggregateFunction is not
-   *         applicable to the specified Type(s).
-   **/
-  virtual const Type* resultTypeForArgumentTypes(
-      const std::vector<const Type*> &argument_types) const = 0;
-
-  /**
-   * @brief Create an AggregationHandle to compute aggregates.
-   *
-   * @warning It is an error to call this method for argument_types which this
-   *          AggregateFunction can not apply to. If in doubt, check
-   *          canApplyToTypes() first.
-   *
-   * @param argument_types A list of zero or more Types (in order) for
-   *        arguments to this AggregateFunction.
-   * @return A new AggregationHandle that can be used to compute this
-   *         AggregateFunction over the specified argument_types. Caller is
-   *         responsible for deleting the returned object.
-   **/
-  virtual AggregationHandle* createHandle(
-      const std::vector<const Type*> &argument_types) const = 0;
-
- protected:
-  explicit AggregateFunction(const AggregationID agg_id)
-      : agg_id_(agg_id) {
-  }
-
- private:
-  const AggregationID agg_id_;
-
-  DISALLOW_COPY_AND_ASSIGN(AggregateFunction);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_EXPRESSIONS_AGGREGATION_AGGREGATE_FUNCTION_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/aggregation/AggregateFunction.proto
----------------------------------------------------------------------
diff --git a/expressions/aggregation/AggregateFunction.proto b/expressions/aggregation/AggregateFunction.proto
deleted file mode 100644
index 07e0e30..0000000
--- a/expressions/aggregation/AggregateFunction.proto
+++ /dev/null
@@ -1,32 +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.
-
-syntax = "proto2";
-
-package quickstep.serialization;
-
-message AggregateFunction {
-  enum AggregationID {
-    AVG = 0;
-    COUNT = 1;
-    MAX = 2;
-    MIN = 3;
-    SUM = 4;
-  }
-
-  required AggregationID aggregation_id = 1;
-}

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/aggregation/AggregateFunctionAvg.cpp
----------------------------------------------------------------------
diff --git a/expressions/aggregation/AggregateFunctionAvg.cpp b/expressions/aggregation/AggregateFunctionAvg.cpp
deleted file mode 100644
index 040d7d9..0000000
--- a/expressions/aggregation/AggregateFunctionAvg.cpp
+++ /dev/null
@@ -1,83 +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 "expressions/aggregation/AggregateFunctionAvg.hpp"
-
-#include <vector>
-
-#include "expressions/aggregation/AggregationHandleAvg.hpp"
-#include "types/Type.hpp"
-#include "types/TypeFactory.hpp"
-#include "types/TypeID.hpp"
-#include "types/operations/binary_operations/BinaryOperation.hpp"
-#include "types/operations/binary_operations/BinaryOperationFactory.hpp"
-#include "types/operations/binary_operations/BinaryOperationID.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-bool AggregateFunctionAvg::canApplyToTypes(
-    const std::vector<const Type*> &argument_types) const {
-  // AVG is unary.
-  if (argument_types.size() != 1) {
-    return false;
-  }
-
-  // Argument must be addable and divisible.
-  return BinaryOperationFactory::GetBinaryOperation(BinaryOperationID::kAdd)
-             .canApplyToTypes(*argument_types.front(), *argument_types.front())
-         && BinaryOperationFactory::GetBinaryOperation(BinaryOperationID::kDivide)
-             .canApplyToTypes(*argument_types.front(), TypeFactory::GetType(kDouble));
-}
-
-const Type* AggregateFunctionAvg::resultTypeForArgumentTypes(
-    const std::vector<const Type*> &argument_types) const {
-  if (!canApplyToTypes(argument_types)) {
-    return nullptr;
-  }
-
-  // The type used to sum values is nullable, and we automatically widen int to
-  // long and float to double to have more headroom when adding up many values.
-  const Type *sum_type = &(argument_types.front()->getNullableVersion());
-  switch (sum_type->getTypeID()) {
-    case kInt:
-      sum_type = &TypeFactory::GetType(kLong, true);
-      break;
-    case kFloat:
-      sum_type = &TypeFactory::GetType(kDouble, true);
-      break;
-    default:
-      break;
-  }
-
-  return BinaryOperationFactory::GetBinaryOperation(BinaryOperationID::kDivide)
-             .resultTypeForArgumentTypes(*sum_type, TypeFactory::GetType(kDouble));
-}
-
-AggregationHandle* AggregateFunctionAvg::createHandle(
-    const std::vector<const Type*> &argument_types) const {
-  DCHECK(canApplyToTypes(argument_types))
-      << "Attempted to create an AggregationHandleAvg for argument Type(s) "
-      << "that AVG can not be applied to.";
-
-  return new AggregationHandleAvg(*argument_types.front());
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/aggregation/AggregateFunctionAvg.hpp
----------------------------------------------------------------------
diff --git a/expressions/aggregation/AggregateFunctionAvg.hpp b/expressions/aggregation/AggregateFunctionAvg.hpp
deleted file mode 100644
index 9d08d1c..0000000
--- a/expressions/aggregation/AggregateFunctionAvg.hpp
+++ /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.
- **/
-
-#ifndef QUICKSTEP_EXPRESSIONS_AGGREGATION_AGGREGATE_FUNCTION_AVG_HPP_
-#define QUICKSTEP_EXPRESSIONS_AGGREGATION_AGGREGATE_FUNCTION_AVG_HPP_
-
-#include <string>
-#include <vector>
-
-#include "expressions/aggregation/AggregateFunction.hpp"
-#include "expressions/aggregation/AggregationID.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-
-class AggregationHandle;
-class Type;
-
-/** \addtogroup Expressions
- *  @{
- */
-
-/**
- * @brief AggregateFunction representing SQL AVG.
- **/
-class AggregateFunctionAvg : public AggregateFunction {
- public:
-  static const AggregateFunctionAvg& Instance() {
-    static AggregateFunctionAvg instance;
-    return instance;
-  }
-
-  std::string getName() const override {
-    return "AVG";
-  }
-
-  bool canApplyToTypes(
-      const std::vector<const Type*> &argument_types) const override;
-
-  const Type* resultTypeForArgumentTypes(
-      const std::vector<const Type*> &argument_types) const override;
-
-  AggregationHandle* createHandle(
-      const std::vector<const Type*> &argument_types) const override;
-
- private:
-  AggregateFunctionAvg()
-      : AggregateFunction(AggregationID::kAvg) {
-  }
-
-  DISALLOW_COPY_AND_ASSIGN(AggregateFunctionAvg);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_EXPRESSIONS_AGGREGATION_AGGREGATE_FUNCTION_AVG_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/aggregation/AggregateFunctionCount.cpp
----------------------------------------------------------------------
diff --git a/expressions/aggregation/AggregateFunctionCount.cpp b/expressions/aggregation/AggregateFunctionCount.cpp
deleted file mode 100644
index 466ff2f..0000000
--- a/expressions/aggregation/AggregateFunctionCount.cpp
+++ /dev/null
@@ -1,69 +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 "expressions/aggregation/AggregateFunctionCount.hpp"
-
-#include <vector>
-
-#include "expressions/aggregation/AggregationHandleCount.hpp"
-#include "types/Type.hpp"
-#include "types/TypeFactory.hpp"
-#include "types/TypeID.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-bool AggregateFunctionCount::canApplyToTypes(
-    const std::vector<const Type*> &argument_types) const {
-  // COUNT may be nullary (i.e. COUNT(*)) or unary.
-  return argument_types.size() <= 1;
-}
-
-const Type* AggregateFunctionCount::resultTypeForArgumentTypes(
-    const std::vector<const Type*> &argument_types) const {
-  if (!canApplyToTypes(argument_types)) {
-    return nullptr;
-  }
-
-  return &TypeFactory::GetType(kLong);
-}
-
-AggregationHandle* AggregateFunctionCount::createHandle(
-    const std::vector<const Type*> &argument_types) const {
-  DCHECK(canApplyToTypes(argument_types))
-      << "Attempted to create an AggregationHandleCount for argument Types "
-      << "that COUNT can not be applied to (> 1 argument).";
-
-  if (argument_types.empty()) {
-    // COUNT(*)
-    return new AggregationHandleCount<true, false>();
-  } else if (argument_types.front()->isNullable()) {
-    // COUNT(some_nullable_argument)
-    return new AggregationHandleCount<false, true>();
-  } else {
-    // COUNT(non_nullable_argument)
-    //
-    // TODO(chasseur): Modify query optimizer to optimize-away COUNT with a
-    // non-nullable argument and convert it to COUNT(*).
-    return new AggregationHandleCount<false, false>();
-  }
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/aggregation/AggregateFunctionCount.hpp
----------------------------------------------------------------------
diff --git a/expressions/aggregation/AggregateFunctionCount.hpp b/expressions/aggregation/AggregateFunctionCount.hpp
deleted file mode 100644
index ee34de4..0000000
--- a/expressions/aggregation/AggregateFunctionCount.hpp
+++ /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.
- **/
-
-#ifndef QUICKSTEP_EXPRESSIONS_AGGREGATION_AGGREGATE_FUNCTION_COUNT_HPP_
-#define QUICKSTEP_EXPRESSIONS_AGGREGATION_AGGREGATE_FUNCTION_COUNT_HPP_
-
-#include <string>
-#include <vector>
-
-#include "expressions/aggregation/AggregateFunction.hpp"
-#include "expressions/aggregation/AggregationID.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-
-class AggregationHandle;
-class Type;
-
-/** \addtogroup Expressions
- *  @{
- */
-
-/**
- * @brief AggregateFunction representing SQL COUNT.
- **/
-class AggregateFunctionCount : public AggregateFunction {
- public:
-  static const AggregateFunctionCount& Instance() {
-    static AggregateFunctionCount instance;
-    return instance;
-  }
-
-  std::string getName() const override {
-    return "COUNT";
-  }
-
-  bool canApplyToTypes(
-      const std::vector<const Type*> &argument_types) const override;
-
-  const Type* resultTypeForArgumentTypes(
-      const std::vector<const Type*> &argument_types) const override;
-
-  AggregationHandle* createHandle(
-      const std::vector<const Type*> &argument_types) const override;
-
- private:
-  AggregateFunctionCount()
-      : AggregateFunction(AggregationID::kCount) {
-  }
-
-  DISALLOW_COPY_AND_ASSIGN(AggregateFunctionCount);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_EXPRESSIONS_AGGREGATION_AGGREGATE_FUNCTION_COUNT_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/aggregation/AggregateFunctionFactory.cpp
----------------------------------------------------------------------
diff --git a/expressions/aggregation/AggregateFunctionFactory.cpp b/expressions/aggregation/AggregateFunctionFactory.cpp
deleted file mode 100644
index faedac3..0000000
--- a/expressions/aggregation/AggregateFunctionFactory.cpp
+++ /dev/null
@@ -1,105 +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 "expressions/aggregation/AggregateFunctionFactory.hpp"
-
-#include <string>
-#include <type_traits>
-
-#include "expressions/aggregation/AggregateFunction.pb.h"
-#include "expressions/aggregation/AggregateFunctionAvg.hpp"
-#include "expressions/aggregation/AggregateFunctionCount.hpp"
-#include "expressions/aggregation/AggregateFunctionMax.hpp"
-#include "expressions/aggregation/AggregateFunctionMin.hpp"
-#include "expressions/aggregation/AggregateFunctionSum.hpp"
-#include "expressions/aggregation/AggregationID.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-const AggregateFunction& AggregateFunctionFactory::Get(
-    const AggregationID agg_id) {
-  switch (agg_id) {
-    case AggregationID::kAvg:
-      return AggregateFunctionAvg::Instance();
-    case AggregationID::kCount:
-      return AggregateFunctionCount::Instance();
-    case AggregationID::kMax:
-      return AggregateFunctionMax::Instance();
-    case AggregationID::kMin:
-      return AggregateFunctionMin::Instance();
-    case AggregationID::kSum:
-      return AggregateFunctionSum::Instance();
-    default: {
-      LOG(FATAL) << "Unrecognized AggregationID: "
-                 << static_cast<std::underlying_type<AggregationID>::type>(agg_id);
-    }
-  }
-}
-
-const AggregateFunction* AggregateFunctionFactory::GetByName(const std::string &name) {
-  if (name == "avg") {
-    return &AggregateFunctionAvg::Instance();
-  } else if (name == "count") {
-    return &AggregateFunctionCount::Instance();
-  } else if (name == "max") {
-    return &AggregateFunctionMax::Instance();
-  } else if (name == "min") {
-    return &AggregateFunctionMin::Instance();
-  } else if (name == "sum") {
-    return &AggregateFunctionSum::Instance();
-  } else {
-    return nullptr;
-  }
-}
-
-bool AggregateFunctionFactory::ProtoIsValid(
-    const serialization::AggregateFunction &proto) {
-  return proto.IsInitialized()
-         && serialization::AggregateFunction::AggregationID_IsValid(proto.aggregation_id());
-}
-
-const AggregateFunction& AggregateFunctionFactory::ReconstructFromProto(
-    const serialization::AggregateFunction &proto) {
-  DCHECK(ProtoIsValid(proto))
-      << "Attempted to reconstruct an AggregateFunction from an invalid proto:\n"
-      << proto.DebugString();
-
-  switch (proto.aggregation_id()) {
-    case serialization::AggregateFunction::AVG:
-      return AggregateFunctionAvg::Instance();
-    case serialization::AggregateFunction::COUNT:
-      return AggregateFunctionCount::Instance();
-    case serialization::AggregateFunction::MAX:
-      return AggregateFunctionMax::Instance();
-    case serialization::AggregateFunction::MIN:
-      return AggregateFunctionMin::Instance();
-    case serialization::AggregateFunction::SUM:
-      return AggregateFunctionSum::Instance();
-    default: {
-      LOG(FATAL) << "Unrecognized serialization::AggregateFunction::AggregationID: "
-                 << proto.aggregation_id()
-                 << "\nFull proto debug string:\n"
-                 << proto.DebugString();
-    }
-  }
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/aggregation/AggregateFunctionFactory.hpp
----------------------------------------------------------------------
diff --git a/expressions/aggregation/AggregateFunctionFactory.hpp b/expressions/aggregation/AggregateFunctionFactory.hpp
deleted file mode 100644
index 89d3540..0000000
--- a/expressions/aggregation/AggregateFunctionFactory.hpp
+++ /dev/null
@@ -1,101 +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_EXPRESSIONS_AGGREGATION_AGGREGATE_FUNCTION_FACTORY_HPP_
-#define QUICKSTEP_EXPRESSIONS_AGGREGATION_AGGREGATE_FUNCTION_FACTORY_HPP_
-
-#include <string>
-
-#include "expressions/aggregation/AggregationID.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-
-class AggregateFunction;
-namespace serialization { class AggregateFunction; }
-
-/** \addtogroup Expressions
- *  @{
- */
-
-/**
- * @brief All-static factory class that provides access to the various concrete
- *        implementations of AggregateFunction.
- *
- * AggregateFunctionFactory allows client code to use any AggregateFunction in
- * Quickstep in a generic way without having to know about all the specific
- * subclasses of AggregateFunction. In particular, it is used to deserialize
- * AggregateFunctions used in AggregationOperationState from their protobuf
- * representations (originally created by the optimizer) when deserializing a
- * QueryContext.
- **/
-class AggregateFunctionFactory {
- public:
-  /**
-   * @brief Get a particular AggregateFunction by its ID.
-   *
-   * @param agg_id The ID of the desired AggregateFunction.
-   * @return A reference to the singleton instance of the AggregateFunction
-   *         specified by agg_id.
-   **/
-  static const AggregateFunction& Get(const AggregationID agg_id);
-
-  /**
-   * @brief Get a particular AggregateFunction by its name in SQL syntax.
-   *
-   * @param name The name of the desired AggregateFunction in lower case.
-   * @return A pointer to the AggregateFunction specified by name, or NULL if
-   *         name does not match any known AggregateFunction.
-   **/
-  static const AggregateFunction* GetByName(const std::string &name);
-
-  /**
-   * @brief Determine if a serialized protobuf representation of an
-   *        AggregateFunction is fully-formed and valid.
-   *
-   * @param proto A serialized protobuf representation of an AggregateFunction
-   *        to check for validity.
-   * @return Whether proto is fully-formed and valid.
-   **/
-  static bool ProtoIsValid(const serialization::AggregateFunction &proto);
-
-  /**
-   * @brief Get the AggregateFunction represented by a proto.
-   *
-   * @warning It is an error to call this method with an invalid proto.
-   *          ProtoIsValid() should be called first to check.
-   *
-   * @param proto A serialized protobuf representation of an AggregateFunction.
-   * @return The AggregateFunction represented by proto.
-   **/
-  static const AggregateFunction& ReconstructFromProto(
-      const serialization::AggregateFunction &proto);
-
- private:
-  // Class is all-static and can not be instantiated.
-  AggregateFunctionFactory();
-
-  DISALLOW_COPY_AND_ASSIGN(AggregateFunctionFactory);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_EXPRESSIONS_AGGREGATION_AGGREGATE_FUNCTION_FACTORY_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/aggregation/AggregateFunctionMax.cpp
----------------------------------------------------------------------
diff --git a/expressions/aggregation/AggregateFunctionMax.cpp b/expressions/aggregation/AggregateFunctionMax.cpp
deleted file mode 100644
index cc04bf4..0000000
--- a/expressions/aggregation/AggregateFunctionMax.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 "expressions/aggregation/AggregateFunctionMax.hpp"
-
-#include <vector>
-
-#include "expressions/aggregation/AggregationHandleMax.hpp"
-#include "types/Type.hpp"
-#include "types/operations/comparisons/Comparison.hpp"
-#include "types/operations/comparisons/ComparisonFactory.hpp"
-#include "types/operations/comparisons/ComparisonID.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-bool AggregateFunctionMax::canApplyToTypes(
-    const std::vector<const Type*> &argument_types) const {
-  // MAX is unary.
-  if (argument_types.size() != 1) {
-    return false;
-  }
-
-  // Argument must be comparable by '>'.
-  return ComparisonFactory::GetComparison(ComparisonID::kGreater).canCompareTypes(
-      *argument_types.front(),
-      *argument_types.front());
-}
-
-const Type* AggregateFunctionMax::resultTypeForArgumentTypes(
-    const std::vector<const Type*> &argument_types) const {
-  if (!canApplyToTypes(argument_types)) {
-    return nullptr;
-  }
-
-  return &(argument_types.front()->getNullableVersion());
-}
-
-AggregationHandle* AggregateFunctionMax::createHandle(
-    const std::vector<const Type*> &argument_types) const {
-  DCHECK(canApplyToTypes(argument_types))
-      << "Attempted to create an AggregationHandleMax for argument Type(s) "
-      << "that MAX can not be applied to.";
-
-  return new AggregationHandleMax(*argument_types.front());
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/aggregation/AggregateFunctionMax.hpp
----------------------------------------------------------------------
diff --git a/expressions/aggregation/AggregateFunctionMax.hpp b/expressions/aggregation/AggregateFunctionMax.hpp
deleted file mode 100644
index 4eadaa2..0000000
--- a/expressions/aggregation/AggregateFunctionMax.hpp
+++ /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.
- **/
-
-#ifndef QUICKSTEP_EXPRESSIONS_AGGREGATION_AGGREGATE_FUNCTION_MAX_HPP_
-#define QUICKSTEP_EXPRESSIONS_AGGREGATION_AGGREGATE_FUNCTION_MAX_HPP_
-
-#include <string>
-#include <vector>
-
-#include "expressions/aggregation/AggregateFunction.hpp"
-#include "expressions/aggregation/AggregationID.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-
-class AggregationHandle;
-class Type;
-
-/** \addtogroup Expressions
- *  @{
- */
-
-/**
- * @brief AggregateFunction representing SQL MAX.
- **/
-class AggregateFunctionMax : public AggregateFunction {
- public:
-  static const AggregateFunctionMax& Instance() {
-    static AggregateFunctionMax instance;
-    return instance;
-  }
-
-  std::string getName() const override {
-    return "MAX";
-  }
-
-  bool canApplyToTypes(
-      const std::vector<const Type*> &argument_types) const override;
-
-  const Type* resultTypeForArgumentTypes(
-      const std::vector<const Type*> &argument_types) const override;
-
-  AggregationHandle* createHandle(
-      const std::vector<const Type*> &argument_types) const override;
-
- private:
-  AggregateFunctionMax()
-      : AggregateFunction(AggregationID::kMax) {
-  }
-
-  DISALLOW_COPY_AND_ASSIGN(AggregateFunctionMax);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_EXPRESSIONS_AGGREGATION_AGGREGATE_FUNCTION_MAX_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/aggregation/AggregateFunctionMin.cpp
----------------------------------------------------------------------
diff --git a/expressions/aggregation/AggregateFunctionMin.cpp b/expressions/aggregation/AggregateFunctionMin.cpp
deleted file mode 100644
index 9fa93de..0000000
--- a/expressions/aggregation/AggregateFunctionMin.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 "expressions/aggregation/AggregateFunctionMin.hpp"
-
-#include <vector>
-
-#include "expressions/aggregation/AggregationHandleMin.hpp"
-#include "types/Type.hpp"
-#include "types/operations/comparisons/Comparison.hpp"
-#include "types/operations/comparisons/ComparisonFactory.hpp"
-#include "types/operations/comparisons/ComparisonID.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-bool AggregateFunctionMin::canApplyToTypes(
-    const std::vector<const Type*> &argument_types) const {
-  // MIN is unary.
-  if (argument_types.size() != 1) {
-    return false;
-  }
-
-  // Argument must be comparable by '<'.
-  return ComparisonFactory::GetComparison(ComparisonID::kLess).canCompareTypes(
-      *argument_types.front(),
-      *argument_types.front());
-}
-
-const Type* AggregateFunctionMin::resultTypeForArgumentTypes(
-    const std::vector<const Type*> &argument_types) const {
-  if (!canApplyToTypes(argument_types)) {
-    return nullptr;
-  }
-
-  return &(argument_types.front()->getNullableVersion());
-}
-
-AggregationHandle* AggregateFunctionMin::createHandle(
-    const std::vector<const Type*> &argument_types) const {
-  DCHECK(canApplyToTypes(argument_types))
-      << "Attempted to create an AggregationHandleMin for argument Type(s) "
-      << "that MIN can not be applied to.";
-
-  return new AggregationHandleMin(*argument_types.front());
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/aggregation/AggregateFunctionMin.hpp
----------------------------------------------------------------------
diff --git a/expressions/aggregation/AggregateFunctionMin.hpp b/expressions/aggregation/AggregateFunctionMin.hpp
deleted file mode 100644
index 90d1762..0000000
--- a/expressions/aggregation/AggregateFunctionMin.hpp
+++ /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.
- **/
-
-#ifndef QUICKSTEP_EXPRESSIONS_AGGREGATION_AGGREGATE_FUNCTION_MIN_HPP_
-#define QUICKSTEP_EXPRESSIONS_AGGREGATION_AGGREGATE_FUNCTION_MIN_HPP_
-
-#include <string>
-#include <vector>
-
-#include "expressions/aggregation/AggregateFunction.hpp"
-#include "expressions/aggregation/AggregationID.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-
-class AggregationHandle;
-class Type;
-
-/** \addtogroup Expressions
- *  @{
- */
-
-/**
- * @brief AggregateFunction representing SQL MIN.
- **/
-class AggregateFunctionMin : public AggregateFunction {
- public:
-  static const AggregateFunctionMin& Instance() {
-    static AggregateFunctionMin instance;
-    return instance;
-  }
-
-  std::string getName() const override {
-    return "MIN";
-  }
-
-  bool canApplyToTypes(
-      const std::vector<const Type*> &argument_types) const override;
-
-  const Type* resultTypeForArgumentTypes(
-      const std::vector<const Type*> &argument_types) const override;
-
-  AggregationHandle* createHandle(
-      const std::vector<const Type*> &argument_types) const override;
-
- private:
-  AggregateFunctionMin()
-      : AggregateFunction(AggregationID::kMin) {
-  }
-
-  DISALLOW_COPY_AND_ASSIGN(AggregateFunctionMin);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_EXPRESSIONS_AGGREGATION_AGGREGATE_FUNCTION_MIN_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/aggregation/AggregateFunctionSum.cpp
----------------------------------------------------------------------
diff --git a/expressions/aggregation/AggregateFunctionSum.cpp b/expressions/aggregation/AggregateFunctionSum.cpp
deleted file mode 100644
index b62660f..0000000
--- a/expressions/aggregation/AggregateFunctionSum.cpp
+++ /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.
- **/
-
-#include "expressions/aggregation/AggregateFunctionSum.hpp"
-
-#include <vector>
-
-#include "expressions/aggregation/AggregationHandleSum.hpp"
-#include "types/Type.hpp"
-#include "types/TypeFactory.hpp"
-#include "types/TypeID.hpp"
-#include "types/operations/binary_operations/BinaryOperation.hpp"
-#include "types/operations/binary_operations/BinaryOperationFactory.hpp"
-#include "types/operations/binary_operations/BinaryOperationID.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-bool AggregateFunctionSum::canApplyToTypes(
-    const std::vector<const Type*> &argument_types) const {
-  // SUM is unary.
-  if (argument_types.size() != 1) {
-    return false;
-  }
-
-  // Argument must be addable.
-  return BinaryOperationFactory::GetBinaryOperation(BinaryOperationID::kAdd)
-             .canApplyToTypes(*argument_types.front(), *argument_types.front());
-}
-
-const Type* AggregateFunctionSum::resultTypeForArgumentTypes(
-    const std::vector<const Type*> &argument_types) const {
-  if (!canApplyToTypes(argument_types)) {
-    return nullptr;
-  }
-
-  // SUM may return NULL if there are no input rows, and we automatically widen
-  // int to long and float to double to have more headroom when adding up many
-  // values.
-  const Type *sum_type = &(argument_types.front()->getNullableVersion());
-  switch (sum_type->getTypeID()) {
-    case kInt:
-      sum_type = &TypeFactory::GetType(kLong, true);
-      break;
-    case kFloat:
-      sum_type = &TypeFactory::GetType(kDouble, true);
-      break;
-    default:
-      break;
-  }
-
-  return sum_type;
-}
-
-AggregationHandle* AggregateFunctionSum::createHandle(
-    const std::vector<const Type*> &argument_types) const {
-  DCHECK(canApplyToTypes(argument_types))
-      << "Attempted to create an AggregationHandleSum for argument Type(s) "
-      << "that SUM can not be applied to.";
-
-  return new AggregationHandleSum(*argument_types.front());
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/aggregation/AggregateFunctionSum.hpp
----------------------------------------------------------------------
diff --git a/expressions/aggregation/AggregateFunctionSum.hpp b/expressions/aggregation/AggregateFunctionSum.hpp
deleted file mode 100644
index a4086c3..0000000
--- a/expressions/aggregation/AggregateFunctionSum.hpp
+++ /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.
- **/
-
-#ifndef QUICKSTEP_EXPRESSIONS_AGGREGATION_AGGREGATE_FUNCTION_SUM_HPP_
-#define QUICKSTEP_EXPRESSIONS_AGGREGATION_AGGREGATE_FUNCTION_SUM_HPP_
-
-#include <string>
-#include <vector>
-
-#include "expressions/aggregation/AggregateFunction.hpp"
-#include "expressions/aggregation/AggregationID.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-
-class AggregationHandle;
-class Type;
-
-/** \addtogroup Expressions
- *  @{
- */
-
-/**
- * @brief AggregateFunction representing SQL SUM.
- **/
-class AggregateFunctionSum : public AggregateFunction {
- public:
-  static const AggregateFunctionSum& Instance() {
-    static AggregateFunctionSum instance;
-    return instance;
-  }
-
-  std::string getName() const override {
-    return "SUM";
-  }
-
-  bool canApplyToTypes(
-      const std::vector<const Type*> &argument_types) const override;
-
-  const Type* resultTypeForArgumentTypes(
-      const std::vector<const Type*> &argument_types) const override;
-
-  AggregationHandle* createHandle(
-      const std::vector<const Type*> &argument_types) const override;
-
- private:
-  AggregateFunctionSum()
-      : AggregateFunction(AggregationID::kSum) {
-  }
-
-  DISALLOW_COPY_AND_ASSIGN(AggregateFunctionSum);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_EXPRESSIONS_AGGREGATION_AGGREGATE_FUNCTION_SUM_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/aggregation/AggregationConcreteHandle.cpp
----------------------------------------------------------------------
diff --git a/expressions/aggregation/AggregationConcreteHandle.cpp b/expressions/aggregation/AggregationConcreteHandle.cpp
deleted file mode 100644
index e3fb520..0000000
--- a/expressions/aggregation/AggregationConcreteHandle.cpp
+++ /dev/null
@@ -1,68 +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 "expressions/aggregation/AggregationConcreteHandle.hpp"
-
-#include <cstddef>
-#include <vector>
-
-#include "catalog/CatalogTypedefs.hpp"
-#include "storage/FastHashTable.hpp"
-#include "storage/HashTable.hpp"
-#include "storage/HashTableFactory.hpp"
-
-namespace quickstep {
-
-class StorageManager;
-class Type;
-class ValueAccessor;
-
-AggregationStateHashTableBase* AggregationConcreteHandle::createDistinctifyHashTable(
-    const HashTableImplType hash_table_impl,
-    const std::vector<const Type*> &key_types,
-    const std::size_t estimated_num_distinct_keys,
-    StorageManager *storage_manager) const {
-  // Create a hash table with key types as key_types and value type as bool.
-  return AggregationStateHashTableFactory<bool>::CreateResizable(
-      hash_table_impl,
-      key_types,
-      estimated_num_distinct_keys,
-      storage_manager);
-}
-
-void AggregationConcreteHandle::insertValueAccessorIntoDistinctifyHashTable(
-    ValueAccessor *accessor,
-    const std::vector<attribute_id> &key_ids,
-    AggregationStateHashTableBase *distinctify_hash_table) const {
-  // If the key-value pair is already there, we don't need to update the value,
-  // which should always be "true". I.e. the value is just a placeholder.
-
-  AggregationStateFastHashTable *hash_table =
-      static_cast<AggregationStateFastHashTable *>(distinctify_hash_table);
-  if (key_ids.size() == 1) {
-    hash_table->upsertValueAccessorFast(
-        key_ids, accessor, key_ids[0], true /* check_for_null_keys */);
-  } else {
-    std::vector<attribute_id> empty_args {kInvalidAttributeID};
-    hash_table->upsertValueAccessorCompositeKeyFast(
-        empty_args, accessor, key_ids, true /* check_for_null_keys */);
-  }
-}
-
-}  // namespace quickstep



[07/51] [abbrv] [partial] incubator-quickstep git commit: remove c++ files

Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/logical/OptimizerLogicalModule.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/logical/OptimizerLogicalModule.hpp b/query_optimizer/logical/OptimizerLogicalModule.hpp
deleted file mode 100644
index fe05718..0000000
--- a/query_optimizer/logical/OptimizerLogicalModule.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 OptimizerLogical
- *  @ingroup QueryOptimizer
- *
- * Logical operators used in the query optimizer.
- **/

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/logical/PatternMatcher.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/logical/PatternMatcher.hpp b/query_optimizer/logical/PatternMatcher.hpp
deleted file mode 100644
index b931ace..0000000
--- a/query_optimizer/logical/PatternMatcher.hpp
+++ /dev/null
@@ -1,144 +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_LOGICAL_PATTERN_MATCHER_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_LOGICAL_PATTERN_MATCHER_HPP_
-
-#include <memory>
-#include <type_traits>
-
-#include "query_optimizer/logical/LogicalType.hpp"
-
-namespace quickstep {
-namespace optimizer {
-namespace logical {
-
-class Aggregate;
-class BinaryJoin;
-class CopyFrom;
-class CreateTable;
-class DeleteTuples;
-class DropTable;
-class Filter;
-class HashJoin;
-class InsertTuple;
-class Join;
-class MultiwayCartesianJoin;
-class NestedLoopsJoin;
-class Project;
-class SharedSubplanReference;
-class Sort;
-class TableReference;
-class TopLevelPlan;
-class UpdateTable;
-class WindowAggregate;
-
-/** \addtogroup OptimizerLogical
- *  @{
- */
-
-/**
- * @brief Templated matcher for each Logical node class.
- *
- * @param LogicalClass The logical class for the logical node to be matched with.
- * @param logical_types All the logical types of the logical class.
- */
-template <class LogicalClass, LogicalType... logical_types>
-class SomeLogicalNode {
- public:
-  /**
-   * @brief Checks whether the object managed in \p logical is an instance
-   *        of the template argument LogicalClass by checking whether
-   *        it is one of types in the given template arguments logical_types.
-   *
-   * @param logical The logical node to be checked.
-   * @return True for a match; otherwise false.
-   */
-  template <class OtherLogicalClass>
-  static bool Matches(const std::shared_ptr<const OtherLogicalClass> &logical) {
-    for (const LogicalType logical_type : kLogicalTypes) {
-      if (logical->getLogicalType() == logical_type) {
-        return true;
-      }
-    }
-    return false;
-  }
-
-  /**
-   * @brief Checks whether the object managed in \p logical is an instance
-   *        of the template argument LogicalClass by checking whether
-   *        it is one of types in the given template arguments logical_types,
-   *        If true, it additionally casts \p logical to a std::shared_ptr
-   *        \p cast_logical of the template argument LogicalClass.
-   *
-   * @param logical The logical node to be checked.
-   * @param cast_logical The cast logical node.
-   * @return True if the object managed in \p logical is an instance of LogicalClass.
-   */
-  template <class OtherLogicalClass>
-  static bool MatchesWithConditionalCast(const std::shared_ptr<const OtherLogicalClass> &logical,
-                                         std::shared_ptr<const LogicalClass> *cast_logical) {
-    bool is_match = Matches(logical);
-    if (is_match) {
-      *cast_logical = std::static_pointer_cast<const LogicalClass>(logical);
-    }
-    return is_match;
-  }
-
- private:
-  constexpr static LogicalType kLogicalTypes[] = {logical_types...};
-};
-
-template <class LogicalClass, LogicalType... logical_types>
-constexpr LogicalType SomeLogicalNode<LogicalClass, logical_types...>::kLogicalTypes[];
-
-// Specializations for all Logical classes.
-
-using SomeAggregate = SomeLogicalNode<Aggregate, LogicalType::kAggregate>;
-using SomeBinaryJoin = SomeLogicalNode<BinaryJoin,
-                                       LogicalType::kHashJoin,
-                                       LogicalType::kNestedLoopsJoin>;
-using SomeCopyFrom = SomeLogicalNode<CopyFrom, LogicalType::kCopyFrom>;
-using SomeCreateTable = SomeLogicalNode<CreateTable, LogicalType::kCreateTable>;
-using SomeDeleteTuples = SomeLogicalNode<DeleteTuples, LogicalType::kDeleteTuples>;
-using SomeDropTable = SomeLogicalNode<DropTable, LogicalType::kDropTable>;
-using SomeFilter = SomeLogicalNode<Filter, LogicalType::kFilter>;
-using SomeHashJoin = SomeLogicalNode<HashJoin, LogicalType::kHashJoin>;
-using SomeInsertTuple = SomeLogicalNode<InsertTuple, LogicalType::kInsertTuple>;
-using SomeJoin = SomeLogicalNode<Join,
-                                 LogicalType::kHashJoin,
-                                 LogicalType::kMultiwayCartesianJoin,
-                                 LogicalType::kNestedLoopsJoin>;
-using SomeMultiwayCartesianJoin = SomeLogicalNode<MultiwayCartesianJoin, LogicalType::kMultiwayCartesianJoin>;
-using SomeNestedLoopsJoin = SomeLogicalNode<NestedLoopsJoin, LogicalType::kNestedLoopsJoin>;
-using SomeProject = SomeLogicalNode<Project, LogicalType::kProject>;
-using SomeSharedSubplanReference = SomeLogicalNode<SharedSubplanReference, LogicalType::kSharedSubplanReference>;
-using SomeSort = SomeLogicalNode<Sort, LogicalType::kSort>;
-using SomeTableReference = SomeLogicalNode<TableReference, LogicalType::kTableReference>;
-using SomeTopLevelPlan = SomeLogicalNode<TopLevelPlan, LogicalType::kTopLevelPlan>;
-using SomeUpdateTable = SomeLogicalNode<UpdateTable, LogicalType::kUpdateTable>;
-using SomeWindowAggregate = SomeLogicalNode<WindowAggregate, LogicalType::kWindowAggregate>;
-
-/** @} */
-
-}  // namespace logical
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif /* QUERY_PLANNER_LOGICAL_PATTERN_MATCHER_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/logical/Project.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/logical/Project.cpp b/query_optimizer/logical/Project.cpp
deleted file mode 100644
index 18c8fe9..0000000
--- a/query_optimizer/logical/Project.cpp
+++ /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.
- **/
-
-#include "query_optimizer/logical/Project.hpp"
-
-#include <string>
-#include <vector>
-
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/ExpressionUtil.hpp"
-#include "query_optimizer/expressions/NamedExpression.hpp"
-#include "query_optimizer/expressions/PatternMatcher.hpp"
-#include "utility/Cast.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-namespace optimizer {
-namespace logical {
-
-namespace E = ::quickstep::optimizer::expressions;
-
-LogicalPtr Project::copyWithNewChildren(
-    const std::vector<LogicalPtr> &new_children) const {
-  DCHECK_EQ(children().size(), new_children.size());
-  return Project::Create(new_children[0], project_expressions_);
-}
-
-std::vector<E::AttributeReferencePtr> Project::getOutputAttributes() const {
-  return ToRefVector(project_expressions_);
-}
-
-std::vector<E::AttributeReferencePtr> Project::getReferencedAttributes() const {
-  std::vector<E::AttributeReferencePtr> referenced_attributes;
-  for (const E::NamedExpressionPtr &project_expression : project_expressions_) {
-    const std::vector<E::AttributeReferencePtr> referenced_attributes_in_expression =
-        project_expression->getReferencedAttributes();
-    referenced_attributes.insert(referenced_attributes.end(),
-                                 referenced_attributes_in_expression.begin(),
-                                 referenced_attributes_in_expression.end());
-  }
-  return referenced_attributes;
-}
-
-LogicalPtr Project::copyWithNewInputExpressions(
-    const std::vector<E::ExpressionPtr> &input_expressions) const {
-  DCHECK_EQ(project_expressions_.size(), input_expressions.size());
-  std::vector<E::NamedExpressionPtr> new_project_expressions;
-  for (const E::ExpressionPtr &input_expression : input_expressions) {
-    E::NamedExpressionPtr project_expression;
-    E::SomeNamedExpression::MatchesWithConditionalCast(input_expression, &project_expression);
-    DCHECK(project_expression != nullptr);
-    new_project_expressions.emplace_back(project_expression);
-  }
-  return Create(input_, new_project_expressions);
-}
-
-void Project::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("input");
-  non_container_child_fields->push_back(input_);
-
-  container_child_field_names->push_back("project_list");
-  container_child_fields->push_back(
-      CastSharedPtrVector<OptimizerTreeBase>(project_expressions_));
-}
-
-}  // namespace logical
-}  // namespace optimizer
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/logical/Project.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/logical/Project.hpp b/query_optimizer/logical/Project.hpp
deleted file mode 100644
index 83b352c..0000000
--- a/query_optimizer/logical/Project.hpp
+++ /dev/null
@@ -1,122 +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_LOGICAL_PROJECT_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_LOGICAL_PROJECT_HPP_
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "query_optimizer/expressions/Expression.hpp"
-#include "query_optimizer/expressions/NamedExpression.hpp"
-#include "query_optimizer/logical/Logical.hpp"
-#include "query_optimizer/logical/LogicalType.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-namespace optimizer {
-namespace logical {
-
-/** \addtogroup OptimizerLogical
- *  @{
- */
-
-class Project;
-typedef std::shared_ptr<const Project> ProjectPtr;
-
-/**
- * @brief Project operator that computes the values of a list of expressions for
- *        each input tuple and outputs them as a new relation.
- */
-class Project : public Logical {
- public:
-  LogicalType getLogicalType() const override { return LogicalType::kProject; }
-
-  std::string getName() const override { return "Project"; }
-
-  /**
-   * @return The expressions to be evaluated by the Project.
-   */
-  const std::vector<expressions::NamedExpressionPtr>& project_expressions() const {
-    return project_expressions_;
-  }
-
-  /**
-   * @return The input operator.
-   */
-  const LogicalPtr& input() const { return input_; }
-
-  LogicalPtr copyWithNewChildren(
-      const std::vector<LogicalPtr> &new_children) const override;
-
-  LogicalPtr copyWithNewInputExpressions(
-      const std::vector<expressions::ExpressionPtr> &input_expressions) const override;
-
-  std::vector<expressions::AttributeReferencePtr> getOutputAttributes() const override;
-
-  std::vector<expressions::AttributeReferencePtr> getReferencedAttributes() const override;
-
-  /**
-   * @brief Creates a Project that computes \p project_expressions on the
-   *        relation produced by \p input.
-   *
-   * @param input The input operator to this Project.
-   * @param project_expressions The project expressions.
-   * @return An immutable Project.
-   */
-  static ProjectPtr Create(
-      const LogicalPtr &input,
-      const std::vector<expressions::NamedExpressionPtr> &project_expressions) {
-    return ProjectPtr(new Project(input, project_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:
-  Project(
-      const LogicalPtr &input,
-      const std::vector<expressions::NamedExpressionPtr> &project_expressions)
-      : input_(input), project_expressions_(project_expressions) {
-    addChild(input);
-    addInputExpressions(project_expressions_);
-  }
-
-  LogicalPtr input_;
-  std::vector<expressions::NamedExpressionPtr> project_expressions_;
-
-  DISALLOW_COPY_AND_ASSIGN(Project);
-};
-
-/** @} */
-
-}  // namespace logical
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_QUERY_OPTIMIZER_LOGICAL_PROJECT_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/logical/Sample.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/logical/Sample.cpp b/query_optimizer/logical/Sample.cpp
deleted file mode 100644
index 577292c..0000000
--- a/query_optimizer/logical/Sample.cpp
+++ /dev/null
@@ -1,63 +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/logical/Sample.hpp"
-
-#include <string>
-#include <vector>
-
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/ExpressionUtil.hpp"
-#include "query_optimizer/expressions/NamedExpression.hpp"
-#include "utility/Cast.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-namespace optimizer {
-namespace logical {
-
-namespace E = ::quickstep::optimizer::expressions;
-
-LogicalPtr Sample::copyWithNewChildren(
-    const std::vector<LogicalPtr> &new_children) const {
-  DCHECK_EQ(children().size(), new_children.size());
-  return Sample::Create(new_children[0], is_block_sample_, percentage_);
-}
-
-void Sample::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("input");
-  non_container_child_fields->push_back(input_);
-
-  inline_field_names->push_back("percentage");
-  inline_field_values->push_back(std::to_string(percentage_));
-
-  inline_field_names->push_back("is_block_sample");
-  inline_field_values->push_back(std::to_string(is_block_sample_));
-}
-
-}  // namespace logical
-}  // namespace optimizer
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/logical/Sample.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/logical/Sample.hpp b/query_optimizer/logical/Sample.hpp
deleted file mode 100644
index e2403c5..0000000
--- a/query_optimizer/logical/Sample.hpp
+++ /dev/null
@@ -1,135 +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_LOGICAL_SAMPLE_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_LOGICAL_SAMPLE_HPP_
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "query_optimizer/expressions/NamedExpression.hpp"
-#include "query_optimizer/logical/Logical.hpp"
-#include "query_optimizer/logical/LogicalType.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-namespace optimizer {
-namespace logical {
-
-/** \addtogroup OptimizerLogical
- *  @{
- */
-
-class Sample;
-typedef std::shared_ptr<const Sample> SamplePtr;
-
-/**
- * @brief Sample operator that samples the data at a block level or
- *        at the tuple level and outputs them as a new relation.
- */
-class Sample : public Logical {
- public:
-  LogicalType getLogicalType() const override { return LogicalType::kSample; }
-
-  std::string getName() const override { return "SAMPLE"; }
-
-  LogicalPtr copyWithNewChildren(
-      const std::vector<LogicalPtr> &new_children) const override;
-
-  std::vector<expressions::AttributeReferencePtr>
-      getOutputAttributes() const override {
-    return input_->getOutputAttributes();
-  }
-
-  std::vector<expressions::AttributeReferencePtr>
-      getReferencedAttributes() const override {
-    return input_->getReferencedAttributes();
-  }
-
-  /**
-   * @return The percentage of data to be sampled.
-   */
-  int percentage() const {
-    return percentage_;
-  }
-
-  /**
-   * @return Flag indicating the sample type.
-   */
-  bool is_block_sample() const {
-    return is_block_sample_;
-  }
-
-  /**
-   * @return The input operator.
-   */
-  const LogicalPtr& input() const { return input_; }
-
-  /**
-   * @brief Creates a Sample operator that samples the data from the
-   *        relation produced by \p input.
-   * @param input The input operator to this Sample.
-   * @param is_block_sample Flag indicating if the sampling is either a block or
-   *                        tuple level sampling
-   * @param percentage The percentage of tuples/blocks to be sampled
-   *
-   * @return An immutable Sample.
-   */
-  static SamplePtr Create(const LogicalPtr &input, const bool is_block_sample,
-                          const int percentage) {
-    return SamplePtr(new Sample(input, is_block_sample, percentage));
-  }
-
- 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:
-  Sample(const LogicalPtr &input,
-         const bool is_block_sample,
-         const int percentage)
-      : input_(input),
-        is_block_sample_(is_block_sample),
-        percentage_(percentage) {
-     addChild(input);
-  }
-
-  LogicalPtr input_;
-  const bool is_block_sample_;
-  const int percentage_;
-
-  DISALLOW_COPY_AND_ASSIGN(Sample);
-};
-
-/** @} */
-
-}  // namespace logical
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_QUERY_OPTIMIZER_LOGICAL_SAMPLE_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/logical/SharedSubplanReference.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/logical/SharedSubplanReference.cpp b/query_optimizer/logical/SharedSubplanReference.cpp
deleted file mode 100644
index 3a0fcb3..0000000
--- a/query_optimizer/logical/SharedSubplanReference.cpp
+++ /dev/null
@@ -1,60 +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/logical/SharedSubplanReference.hpp"
-
-#include <string>
-#include <vector>
-
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "query_optimizer/logical/Logical.hpp"
-#include "utility/Cast.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-namespace optimizer {
-namespace logical {
-
-void SharedSubplanReference::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("subplan_id");
-  inline_field_values->push_back(std::to_string(subplan_id_));
-
-  container_child_field_names->push_back("referenced_attributes");
-  container_child_fields->push_back(CastSharedPtrVector<OptimizerTreeBase>(referenced_attributes_));
-
-  container_child_field_names->push_back("output_attributes");
-  container_child_fields->push_back(CastSharedPtrVector<OptimizerTreeBase>(output_attributes_));
-}
-
-LogicalPtr SharedSubplanReference::copyWithNewChildren(const std::vector<LogicalPtr> &new_children) const {
-  DCHECK(new_children.empty());
-  return Create(subplan_id_, referenced_attributes_, output_attributes_);
-}
-
-}  // namespace logical
-}  // namespace optimizer
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/logical/SharedSubplanReference.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/logical/SharedSubplanReference.hpp b/query_optimizer/logical/SharedSubplanReference.hpp
deleted file mode 100644
index 79ef4ad..0000000
--- a/query_optimizer/logical/SharedSubplanReference.hpp
+++ /dev/null
@@ -1,138 +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_LOGICAL_SHARED_SUBPLAN_REFERENCE_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_LOGICAL_SHARED_SUBPLAN_REFERENCE_HPP_
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "query_optimizer/logical/Logical.hpp"
-#include "query_optimizer/logical/LogicalType.hpp"
-#include "utility/Macros.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-namespace optimizer {
-namespace logical {
-
-/** \addtogroup OptimizerLogical
- *  @{
- */
-
-class SharedSubplanReference;
-typedef std::shared_ptr<const SharedSubplanReference> SharedSubplanReferencePtr;
-
-/**
- * @brief A reference to a shared subplan stored in the TopLevelPlan node.
- */
-class SharedSubplanReference : public Logical {
- public:
-  LogicalType getLogicalType() const override {
-    return LogicalType::kSharedSubplanReference;
-  }
-
-  std::string getName() const override {
-    return "SharedSubplanReference";
-  }
-
-  /**
-   * @return The ID of the shared subplan.
-   */
-  int subplan_id() const {
-    return subplan_id_;
-  }
-
-  /**
-   * @return The attributes from the referenced shared subplan.
-   */
-  const std::vector<expressions::AttributeReferencePtr>& referenced_attributes() const {
-    return referenced_attributes_;
-  }
-
-  /**
-   * @return The output attributes of this shared subplan reference.
-   */
-  const std::vector<expressions::AttributeReferencePtr>& output_attributes() const {
-    return output_attributes_;
-  }
-
-  std::vector<expressions::AttributeReferencePtr> getOutputAttributes() const override {
-    return output_attributes_;
-  }
-
-  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;
-
-  LogicalPtr copyWithNewChildren(const std::vector<LogicalPtr> &new_children) const override;
-
-  std::vector<expressions::AttributeReferencePtr> getReferencedAttributes() const override {
-    return referenced_attributes_;
-  }
-
-  /**
-   * @brief Creates a SharedSubplanReference.
-   *
-   * @param subplan_id The ID of the shared subplan, which is the index of the referenced
-   *        shared subplan in <shared_subplans_> of the TopLevelPlan.
-   * @param referenced_attributes The attributes from the referenced shared subplan.
-   * @param output_attributes The output attributes of this shared subplan reference.
-   * @return An immutable SharedSubplanReference.
-   */
-  static SharedSubplanReferencePtr Create(
-      int subplan_id,
-      const std::vector<expressions::AttributeReferencePtr> &referenced_attributes,
-      const std::vector<expressions::AttributeReferencePtr> &output_attributes) {
-    return SharedSubplanReferencePtr(
-        new SharedSubplanReference(subplan_id, referenced_attributes, output_attributes));
-  }
-
- private:
-  SharedSubplanReference(int subplan_id,
-                         const std::vector<expressions::AttributeReferencePtr> &referenced_attributes,
-                         const std::vector<expressions::AttributeReferencePtr> &output_attributes)
-    : subplan_id_(subplan_id),
-      referenced_attributes_(referenced_attributes),
-      output_attributes_(output_attributes) {
-    DCHECK_EQ(output_attributes_.size(), referenced_attributes_.size());
-  }
-
-  int subplan_id_;
-  std::vector<expressions::AttributeReferencePtr> referenced_attributes_;
-  std::vector<expressions::AttributeReferencePtr> output_attributes_;
-
-  DISALLOW_COPY_AND_ASSIGN(SharedSubplanReference);
-};
-
-/** @} */
-
-}  // namespace logical
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_QUERY_OPTIMIZER_LOGICAL_SHARED_SUBPLAN_REFERENCE_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/logical/Sort.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/logical/Sort.cpp b/query_optimizer/logical/Sort.cpp
deleted file mode 100644
index 3667f64..0000000
--- a/query_optimizer/logical/Sort.cpp
+++ /dev/null
@@ -1,87 +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/logical/Sort.hpp"
-
-#include <string>
-#include <vector>
-
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "query_optimizer/expressions/ExpressionUtil.hpp"
-#include "query_optimizer/expressions/NamedExpression.hpp"
-#include "query_optimizer/logical/Logical.hpp"
-#include "utility/Cast.hpp"
-
-namespace quickstep {
-namespace optimizer {
-namespace logical {
-
-namespace E = ::quickstep::optimizer::expressions;
-
-LogicalPtr Sort::copyWithNewChildren(
-    const std::vector<LogicalPtr> &new_children) const {
-  DCHECK_EQ(getNumChildren(), new_children.size());
-  return Create(new_children[0], sort_attributes_, sort_ascending_, nulls_first_flags_, limit_);
-}
-
-void Sort::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("input");
-  non_container_child_fields->push_back(input_);
-
-  inline_field_names->push_back("is_ascending");
-  std::string ascending_list("[");
-  for (bool is_ascending : sort_ascending_) {
-    if (is_ascending) {
-      ascending_list.append("true,");
-    } else {
-      ascending_list.append("false,");
-    }
-  }
-  ascending_list.pop_back();
-  ascending_list.append("]");
-  inline_field_values->push_back(ascending_list);
-
-  inline_field_names->push_back("nulls_first");
-  std::string nulls_first_flags("[");
-  for (bool nulls_first_flag : nulls_first_flags_) {
-    if (nulls_first_flag) {
-      nulls_first_flags.append("true,");
-    } else {
-      nulls_first_flags.append("false,");
-    }
-  }
-  nulls_first_flags.pop_back();
-  nulls_first_flags.append("]");
-  inline_field_values->push_back(nulls_first_flags);
-
-  container_child_field_names->push_back("sort_expressions");
-  container_child_fields->push_back(
-      CastSharedPtrVector<OptimizerTreeBase>(sort_attributes_));
-}
-
-}  // namespace logical
-}  // namespace optimizer
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/logical/Sort.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/logical/Sort.hpp b/query_optimizer/logical/Sort.hpp
deleted file mode 100644
index 894970b..0000000
--- a/query_optimizer/logical/Sort.hpp
+++ /dev/null
@@ -1,184 +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_LOGICAL_SORT_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_LOGICAL_SORT_HPP_
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "query_optimizer/logical/Logical.hpp"
-#include "query_optimizer/logical/LogicalType.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-namespace optimizer {
-namespace logical {
-
-/** \addtogroup OptimizerLogical
- *  @{
- */
-
-class Sort;
-typedef std::shared_ptr<const Sort> SortPtr;
-
-/**
- * @brief Sort operator that sorts the input tuples by a subset of attributes.
- */
-class Sort : public Logical {
- public:
-  LogicalType getLogicalType() const override { return LogicalType::kSort; }
-
-  std::string getName() const override { return "Sort"; }
-
-  /**
-   * @return The input logical node.
-   */
-  const LogicalPtr& input() const { return input_; }
-
-  /**
-   * @return The sorting attributes.
-   */
-  const std::vector<expressions::AttributeReferencePtr>& sort_attributes() const {
-    return sort_attributes_;
-  }
-
-  /**
-   * @return The sorting directions.
-   */
-  const std::vector<bool>& sort_ascending() const { return sort_ascending_; }
-
-  /**
-   * @brief The order directions for null values.
-   */
-  const std::vector<bool>& nulls_first_flags() const {
-    return nulls_first_flags_;
-  }
-
-  /**
-   * @return The number of output sorted rows. -1 for a full table sort.
-   */
-  int limit() const {
-    return limit_;
-  }
-
-  LogicalPtr copyWithNewChildren(
-      const std::vector<LogicalPtr> &new_children) const override;
-
-  std::vector<expressions::AttributeReferencePtr> getOutputAttributes() const override {
-    return input_->getOutputAttributes();
-  }
-
-  std::vector<expressions::AttributeReferencePtr> getReferencedAttributes() const override {
-    return sort_attributes_;
-  }
-  /**
-   * @brief Creates a Sort logical node.
-   *
-   * @param input The input to the Sort.
-   * @param sort_attributes The sorting attributes.
-   * @param sort_ascending The vector of ordering directions.
-   * @param nulls_first_flags The vector of ordering directions for null values.
-   * @param limit The number of output rows. -1 for a full table sort.
-   *
-   * @return An immutable Sort.
-   */
-  static SortPtr Create(
-      const LogicalPtr &input,
-      const std::vector<expressions::AttributeReferencePtr> &sort_attributes,
-      const std::vector<bool> &sort_ascending,
-      const std::vector<bool> &nulls_first_flags,
-      const int limit) {
-    return SortPtr(new Sort(input,
-                            sort_attributes,
-                            sort_ascending,
-                            nulls_first_flags,
-                            limit));
-  }
-
-  static SortPtr Create(
-      const LogicalPtr &input,
-      std::vector<expressions::AttributeReferencePtr> &&sort_attributes,
-      std::vector<bool> &&sort_ascending,
-      std::vector<bool> &&nulls_first_flags,
-      const int limit) {
-    return SortPtr(new Sort(input,
-                            std::move(sort_attributes),
-                            std::move(sort_ascending),
-                            std::move(nulls_first_flags),
-                            limit));
-  }
-
- 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:
-  Sort(const LogicalPtr &input,
-       const std::vector<expressions::AttributeReferencePtr> &sort_attributes,
-       const std::vector<bool> &sort_ascending,
-       const std::vector<bool> &nulls_first_flags,
-       const int limit)
-      : input_(input),
-        sort_attributes_(sort_attributes),
-        sort_ascending_(sort_ascending),
-        nulls_first_flags_(nulls_first_flags),
-        limit_(limit) {
-    addChild(input_);
-  }
-
-  Sort(const LogicalPtr &input,
-       std::vector<expressions::AttributeReferencePtr> &&sort_attributes,
-       std::vector<bool> &&sort_ascending,
-       std::vector<bool> &&nulls_first_flags,
-       const int limit)
-      : input_(input),
-        sort_attributes_(std::move(sort_attributes)),
-        sort_ascending_(std::move(sort_ascending)),
-        nulls_first_flags_(std::move(nulls_first_flags)),
-        limit_(limit) {
-    addChild(input_);
-  }
-
-  LogicalPtr input_;
-  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_;
-
-  DISALLOW_COPY_AND_ASSIGN(Sort);
-};
-
-/** @} */
-
-}  // namespace logical
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_QUERY_OPTIMIZER_LOGICAL_SORT_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/logical/TableGenerator.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/logical/TableGenerator.hpp b/query_optimizer/logical/TableGenerator.hpp
deleted file mode 100644
index 15ca985..0000000
--- a/query_optimizer/logical/TableGenerator.hpp
+++ /dev/null
@@ -1,183 +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_LOGICAL_TABLE_GENERATOR_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_LOGICAL_TABLE_GENERATOR_HPP_
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "expressions/table_generator/GeneratorFunctionHandle.hpp"
-#include "query_optimizer/OptimizerContext.hpp"
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "query_optimizer/expressions/ExprId.hpp"
-#include "query_optimizer/logical/Logical.hpp"
-#include "query_optimizer/logical/LogicalType.hpp"
-#include "utility/Cast.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-namespace optimizer {
-namespace logical {
-
-namespace E = ::quickstep::optimizer::expressions;
-
-using quickstep::GeneratorFunctionHandle;
-
-/** \addtogroup OptimizerLogical
- *  @{
- */
-
-class TableGenerator;
-typedef std::shared_ptr<const TableGenerator> TableGeneratorPtr;
-
-/**
- * @brief Leaf logical node that represents a table that will be populated
- *        by a generator function.
- *
- * @note For how to add a new generator function, see the documentation of
- *       GeneratorFunction and GeneratorFunctionHandle.
- */
-class TableGenerator : public Logical {
- public:
-  LogicalType getLogicalType() const override { return LogicalType::kTableGenerator; }
-
-  std::string getName() const override { return "TableGenerator"; }
-
-  LogicalPtr copyWithNewChildren(
-      const std::vector<LogicalPtr> &new_children) const override {
-    return TableGeneratorPtr(
-        new TableGenerator(generator_function_handle_,
-                           table_alias_,
-                           attribute_list_));
-  }
-
-  /**
-   * @return The reference to the generator function handle.
-   */
-  const GeneratorFunctionHandlePtr& generator_function_handle() const {
-    return generator_function_handle_;
-  }
-
-  /**
-   * @return The alias name of this table.
-   */
-  const std::string& table_alias() const {
-    return table_alias_;
-  }
-
-  /**
-   * @return The reference to the output attributes of this table.
-   */
-  const std::vector<expressions::AttributeReferencePtr>& attribute_list() const {
-    return attribute_list_;
-  }
-
-  std::vector<E::AttributeReferencePtr> getOutputAttributes() const override {
-    return attribute_list_;
-  }
-
-  std::vector<E::AttributeReferencePtr> getReferencedAttributes() const override {
-    return {};
-  }
-
-  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 {
-    inline_field_names->push_back("function_name");
-    inline_field_values->push_back(generator_function_handle_->getName());
-
-    if (table_alias_ != generator_function_handle_->getName()) {
-      inline_field_names->push_back("table_alias");
-      inline_field_values->push_back(table_alias_);
-    }
-
-    container_child_field_names->push_back("");
-    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 std::string &table_name = generator_function_handle->getName();
-
-    for (int i = 0; i < num_attrs; ++i) {
-      attribute_list_.emplace_back(
-        E::AttributeReference::Create(
-            optimizer_context->nextExprId(),
-            generator_function_handle->getOutputColumnName(i),
-            table_alias,
-            table_name,
-            generator_function_handle->getOutputColumnType(i),
-            E::AttributeReferenceScope::kLocal));
-    }
-  }
-
-  TableGenerator(const GeneratorFunctionHandlePtr &generator_function_handle,
-                 const std::string &table_alias,
-                 const std::vector<E::AttributeReferencePtr> &attribute_list)
-      : generator_function_handle_(generator_function_handle),
-        table_alias_(table_alias),
-        attribute_list_(attribute_list) {
-  }
-
-  GeneratorFunctionHandlePtr generator_function_handle_;
-  std::string table_alias_;
-  std::vector<E::AttributeReferencePtr> attribute_list_;
-
-  DISALLOW_COPY_AND_ASSIGN(TableGenerator);
-};
-
-/** @} */
-
-}  // namespace logical
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_QUERY_OPTIMIZER_LOGICAL_TABLE_GENERATOR_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/logical/TableReference.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/logical/TableReference.cpp b/query_optimizer/logical/TableReference.cpp
deleted file mode 100644
index 6d94665..0000000
--- a/query_optimizer/logical/TableReference.cpp
+++ /dev/null
@@ -1,86 +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/logical/TableReference.hpp"
-
-#include <string>
-#include <vector>
-
-#include "catalog/CatalogRelation.hpp"
-#include "query_optimizer/OptimizerContext.hpp"
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "utility/Cast.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-namespace optimizer {
-namespace logical {
-
-namespace E = ::quickstep::optimizer::expressions;
-
-TableReference::TableReference(const CatalogRelation *catalog_relation,
-                               const std::string &relation_alias,
-                               OptimizerContext *optimizer_context)
-    : catalog_relation_(catalog_relation),
-      relation_alias_(relation_alias) {
-  for (CatalogRelation::const_iterator attribute_it = catalog_relation_->begin();
-       attribute_it < catalog_relation_->end();
-       ++attribute_it) {
-    attribute_list_.emplace_back(
-        E::AttributeReference::Create(
-            optimizer_context->nextExprId(),
-            attribute_it->getName(),
-            attribute_it->getDisplayName(),
-            relation_alias,
-            attribute_it->getType(),
-            E::AttributeReferenceScope::kLocal));
-  }
-}
-
-LogicalPtr TableReference::copyWithNewChildren(
-    const std::vector<LogicalPtr> &new_children) const {
-  DCHECK_EQ(new_children.size(), children().size());
-  return TableReferencePtr(
-      new TableReference(catalog_relation_, relation_alias_, attribute_list_));
-}
-
-void TableReference::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("relation_name");
-  inline_field_values->push_back(catalog_relation_->getName());
-
-  if (relation_alias_ != catalog_relation_->getName()) {
-    inline_field_names->push_back("relation_alias");
-    inline_field_values->push_back(relation_alias_);
-  }
-
-  container_child_field_names->push_back("");
-  container_child_fields->push_back(CastSharedPtrVector<OptimizerTreeBase>(attribute_list_));
-}
-
-}  // namespace logical
-}  // namespace optimizer
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/logical/TableReference.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/logical/TableReference.hpp b/query_optimizer/logical/TableReference.hpp
deleted file mode 100644
index 6788c82..0000000
--- a/query_optimizer/logical/TableReference.hpp
+++ /dev/null
@@ -1,143 +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_TABLE_REFERENCE_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_EXPRESSIONS_LOGICAL_TABLE_REFERENCE_HPP_
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "query_optimizer/logical/Logical.hpp"
-#include "query_optimizer/logical/LogicalType.hpp"
-#include "utility/Macros.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-class CatalogRelation;
-
-namespace optimizer {
-
-class OptimizerContext;
-
-namespace logical {
-
-/** \addtogroup OptimizerLogical
- *  @{
- */
-
-class TableReference;
-typedef std::shared_ptr<const TableReference> TableReferencePtr;
-
-/**
- * @brief Leaf logical operator that represents a reference to
- *        a catalog relation.
- */
-class TableReference : public Logical {
- public:
-  LogicalType getLogicalType() const override { return LogicalType::kTableReference; }
-
-  std::string getName() const override { return "TableReference"; }
-
-  /**
-   * @return The catalog relation which the operator scans.
-   */
-  const CatalogRelation* catalog_relation() const { return catalog_relation_; }
-
-  /**
-   * @return The relation alias.
-   */
-  const std::string& relation_alias() const { return relation_alias_; }
-
-  /**
-   * @return The references to the attributes in the relation.
-   */
-  const std::vector<expressions::AttributeReferencePtr>& attribute_list() const {
-    return attribute_list_;
-  }
-
-  LogicalPtr copyWithNewChildren(
-      const std::vector<LogicalPtr> &new_children) const override;
-
-  std::vector<expressions::AttributeReferencePtr> getOutputAttributes() const override {
-    return attribute_list_;
-  }
-
-  std::vector<expressions::AttributeReferencePtr> getReferencedAttributes() const override {
-    return getOutputAttributes();
-  }
-
-  /**
-   * @brief Generates a AttributeRerference for each CatalogAttribute in the \p
-   *        catalog_relation and creates a TableReference on it.
-   *
-   * @param catalog_relation The catalog relation to be scanned.
-   * @param relation_alias The relation alias. This is stored here for the printing purpose only.
-   * @param optimizer_context The OptimizerContext for the query.
-   * @return An immutable TableReference.
-   */
-  static TableReferencePtr Create(const CatalogRelation *catalog_relation,
-                                  const std::string &relation_alias,
-                                  OptimizerContext *optimizer_context) {
-    DCHECK(!relation_alias.empty());
-    return TableReferencePtr(
-        new TableReference(catalog_relation, relation_alias, optimizer_context));
-  }
-
- 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:
-  TableReference(const CatalogRelation *catalog_relation,
-                 const std::string &relation_alias,
-                 OptimizerContext *optimizer_context);
-
-  // Constructor where the attribute list is explicitly given.
-  TableReference(
-      const CatalogRelation *catalog_relation,
-      const std::string &relation_alias,
-      const std::vector<expressions::AttributeReferencePtr> &attribute_list)
-      : catalog_relation_(catalog_relation),
-        relation_alias_(relation_alias),
-        attribute_list_(attribute_list) {}
-
-  const CatalogRelation *catalog_relation_;
-  std::string relation_alias_;
-  std::vector<expressions::AttributeReferencePtr> attribute_list_;
-
-  DISALLOW_COPY_AND_ASSIGN(TableReference);
-};
-
-/** @} */
-
-}  // namespace logical
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_QUERY_OPTIMIZER_EXPRESSIONS_LOGICAL_TABLE_REFERENCE_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/logical/TopLevelPlan.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/logical/TopLevelPlan.cpp b/query_optimizer/logical/TopLevelPlan.cpp
deleted file mode 100644
index 3a6eb44..0000000
--- a/query_optimizer/logical/TopLevelPlan.cpp
+++ /dev/null
@@ -1,58 +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/logical/TopLevelPlan.hpp"
-
-#include <string>
-#include <vector>
-
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "utility/Cast.hpp"
-
-namespace quickstep {
-namespace optimizer {
-namespace logical {
-
-namespace E = ::quickstep::optimizer::expressions;
-
-void TopLevelPlan::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("plan");
-  non_container_child_fields->push_back(plan_);
-
-  if (!shared_subplans_.empty()) {
-    container_child_field_names->push_back("shared_subplans");
-    container_child_fields->push_back(
-        CastSharedPtrVector<OptimizerTreeBase>(shared_subplans_));
-  }
-
-  container_child_field_names->push_back("output_attributes");
-  container_child_fields->push_back(
-      CastSharedPtrVector<OptimizerTreeBase>(plan_->getOutputAttributes()));
-}
-
-}  // namespace logical
-}  // namespace optimizer
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/logical/TopLevelPlan.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/logical/TopLevelPlan.hpp b/query_optimizer/logical/TopLevelPlan.hpp
deleted file mode 100644
index 0b8f1a4..0000000
--- a/query_optimizer/logical/TopLevelPlan.hpp
+++ /dev/null
@@ -1,155 +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_LOGICAL_TOP_LEVEL_PLAN_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_LOGICAL_TOP_LEVEL_PLAN_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/logical/Logical.hpp"
-#include "query_optimizer/logical/LogicalType.hpp"
-#include "utility/Macros.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-namespace optimizer {
-namespace logical {
-
-/** \addtogroup OptimizerLogical
- *  @{
- */
-
-class TopLevelPlan;
-typedef std::shared_ptr<const TopLevelPlan> TopLevelPlanPtr;
-
-/**
- * @brief The root of a logical plan tree that contains the entire logical plan
- *        and shared subplans.
- */
-class TopLevelPlan : public Logical {
- public:
-  /**
-   * @brief Destructor.
-   */
-  ~TopLevelPlan() override {}
-
-  LogicalType getLogicalType() const override { return LogicalType::kTopLevelPlan; }
-
-  std::string getName() const override { return "TopLevelPlan"; }
-
-  /**
-   * @return The input plan.
-   */
-  const LogicalPtr& plan() const { return plan_; }
-
-  /**
-   * @return The vector of the shared subplans.
-   */
-  const std::vector<LogicalPtr>& shared_subplans() const { return shared_subplans_; }
-
-  LogicalPtr copyWithNewChildren(
-      const std::vector<LogicalPtr> &new_children) const override {
-    DCHECK_EQ(getNumChildren(), new_children.size());
-    // The first is the main plan, and the remaining
-    // children are shared subplans referenced in the main plan.
-    std::vector<LogicalPtr> new_shared_subplans;
-    if (new_children.size() > 1u) {
-      new_shared_subplans.insert(new_shared_subplans.end(),
-                                 ++new_children.begin(),
-                                 new_children.end());
-    }
-    return Create(new_children[0], new_shared_subplans, uncorrelated_subquery_map_);
-  }
-
-  /**
-   * @return Map from the expression ID of an attribute reference to the
-   *         uncorrelated subquery that produces the attribute.
-   */
-  const std::unordered_map<expressions::ExprId, int>& uncorrelated_subquery_map() const {
-    return uncorrelated_subquery_map_;
-  }
-
-  std::vector<expressions::AttributeReferencePtr> getOutputAttributes() const override {
-    return plan()->getOutputAttributes();
-  }
-
-  std::vector<expressions::AttributeReferencePtr> getReferencedAttributes() const override {
-    return {};
-  }
-
-  /**
-   * @brief Creates a TopLevelPlan.
-   *
-   * @param plan The input plan.
-   * @param shared_subplans The subplans referenced in the main input plan.
-   * @param uncorrelated_subquery_map Map from expression IDs to uncorrelated scalar subqueries.
-   * @return An immutable TopLevelPlan.
-   */
-  static TopLevelPlanPtr Create(const LogicalPtr &plan,
-                                const std::vector<LogicalPtr> &shared_subplans = std::vector<LogicalPtr>(),
-                                const std::unordered_map<expressions::ExprId, int> &uncorrelated_subquery_map =
-                                    std::unordered_map<expressions::ExprId, int>()) {
-    return TopLevelPlanPtr(new TopLevelPlan(plan, shared_subplans, uncorrelated_subquery_map));
-  }
-
- 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:
-  TopLevelPlan(const LogicalPtr &plan,
-               const std::vector<LogicalPtr> &shared_subplans,
-               const std::unordered_map<expressions::ExprId, int> &uncorrelated_subquery_map)
-      : plan_(plan),
-        shared_subplans_(shared_subplans),
-        uncorrelated_subquery_map_(uncorrelated_subquery_map) {
-    addChild(plan);
-    for (const LogicalPtr &shared_subplan : shared_subplans) {
-      addChild(shared_subplan);
-    }
-  }
-
-  LogicalPtr plan_;
-  // Stored in the topological ordering based on dependencies.
-  std::vector<LogicalPtr> shared_subplans_;
-
-  std::unordered_map<expressions::ExprId, int> uncorrelated_subquery_map_;
-
-  DISALLOW_COPY_AND_ASSIGN(TopLevelPlan);
-};
-
-/** @} */
-
-}  // namespace logical
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_QUERY_OPTIMIZER_LOGICAL_TOP_LEVEL_PLAN_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/logical/UpdateTable.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/logical/UpdateTable.cpp b/query_optimizer/logical/UpdateTable.cpp
deleted file mode 100644
index 8f02f5d..0000000
--- a/query_optimizer/logical/UpdateTable.cpp
+++ /dev/null
@@ -1,86 +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/logical/UpdateTable.hpp"
-
-#include <string>
-#include <vector>
-
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "query_optimizer/expressions/Predicate.hpp"
-#include "query_optimizer/expressions/Scalar.hpp"
-#include "utility/Cast.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-namespace optimizer {
-namespace logical {
-
-LogicalPtr UpdateTable::copyWithNewChildren(
-    const std::vector<LogicalPtr> &new_children) const {
-  DCHECK_EQ(getNumChildren(), new_children.size());
-  return Create(new_children[0], assignees_, assignment_expressions_,
-                predicate_);
-}
-
-std::vector<expressions::AttributeReferencePtr> UpdateTable::getReferencedAttributes() const {
-  std::vector<expressions::AttributeReferencePtr> referenced_attributes = assignees_;
-  for (const expressions::ScalarPtr& assignment_expression : assignment_expressions_) {
-    std::vector<expressions::AttributeReferencePtr> attrs_referenced_in_expression =
-        assignment_expression->getReferencedAttributes();
-    referenced_attributes.insert(referenced_attributes.end(),
-                                 attrs_referenced_in_expression.begin(),
-                                 attrs_referenced_in_expression.end());
-  }
-  if (predicate_ != nullptr) {
-    std::vector<expressions::AttributeReferencePtr> attrs_referenced_in_predicate =
-        predicate_->getReferencedAttributes();
-    referenced_attributes.insert(referenced_attributes.end(),
-                                 attrs_referenced_in_predicate.begin(),
-                                 attrs_referenced_in_predicate.end());
-  }
-  return referenced_attributes;
-}
-
-void UpdateTable::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("input");
-  non_container_child_fields->push_back(input_);
-  if (predicate_ != nullptr) {
-    non_container_child_field_names->push_back("predicate");
-    non_container_child_fields->push_back(predicate_);
-  }
-
-  container_child_field_names->push_back("attributes");
-  container_child_fields->push_back(CastSharedPtrVector<OptimizerTreeBase>(assignees_));
-  container_child_field_names->push_back("assigned_values");
-  container_child_fields->push_back(
-      CastSharedPtrVector<OptimizerTreeBase>(assignment_expressions_));
-}
-
-}  // namespace logical
-}  // namespace optimizer
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/logical/UpdateTable.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/logical/UpdateTable.hpp b/query_optimizer/logical/UpdateTable.hpp
deleted file mode 100644
index ec0d50f..0000000
--- a/query_optimizer/logical/UpdateTable.hpp
+++ /dev/null
@@ -1,145 +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_LOGICAL_UPDATETABLE_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_LOGICAL_UPDATETABLE_HPP_
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "query_optimizer/expressions/Predicate.hpp"
-#include "query_optimizer/expressions/Scalar.hpp"
-#include "query_optimizer/logical/Logical.hpp"
-#include "query_optimizer/logical/LogicalType.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-namespace optimizer {
-namespace logical {
-
-/** \addtogroup OptimizerLogical
- *  @{
- */
-
-class UpdateTable;
-typedef std::shared_ptr<const UpdateTable> UpdateTablePtr;
-
-/**
- * @brief Updates a relation with new assignments to some tuples.
- */
-class UpdateTable : public Logical {
- public:
-  LogicalType getLogicalType() const override { return LogicalType::kUpdateTable; }
-
-  std::string getName() const override { return "UpdateTable"; }
-
-  /**
-   * @return The logical node that creates the table to be updated.
-   */
-  const LogicalPtr& input() const { return input_; }
-
-  /**
-   * @return The attributes to be assigned values to.
-   */
-  const std::vector<expressions::AttributeReferencePtr>& assignees() const {
-    return assignees_;
-  }
-
-  /**
-   * @return The expressions for which the values are assigned.
-   */
-  const std::vector<expressions::ScalarPtr>& assignment_expressions() const {
-    return assignment_expressions_;
-  }
-
-  /**
-   * @return The predicate to select tuples to be updated.
-   */
-  const expressions::PredicatePtr& predicate() const { return predicate_; }
-
-  LogicalPtr copyWithNewChildren(
-      const std::vector<LogicalPtr> &new_children) const override;
-
-  std::vector<expressions::AttributeReferencePtr> getOutputAttributes() const override {
-    return std::vector<expressions::AttributeReferencePtr>();
-  }
-
-  std::vector<expressions::AttributeReferencePtr> getReferencedAttributes() const override;
-
-  /**
-   * @brief Creates an UpdateTable logical node that represents an operation to
-   *        update a table with given assignments.
-   *
-   * @param input The input gives the table to be updated.
-   * @param assignees The attribute list to assign values to.
-   * @param assignment_expressions The expressions that gives the values to be
-   *                               assigned.
-   * @param predicate The predicate to select tuples to be updated.
-   * @return An immutable UpdateTable node.
-   */
-  static UpdateTablePtr Create(
-      const LogicalPtr &input,
-      const std::vector<expressions::AttributeReferencePtr> &assignees,
-      const std::vector<expressions::ScalarPtr> &assignment_expressions,
-      const expressions::PredicatePtr &predicate) {
-    return UpdateTablePtr(
-        new UpdateTable(input, assignees, assignment_expressions, predicate));
-  }
-
-  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:
-  UpdateTable(const LogicalPtr &input,
-              const std::vector<expressions::AttributeReferencePtr> &assignees,
-              const std::vector<expressions::ScalarPtr> &assignment_expressions,
-              const expressions::PredicatePtr &predicate)
-      : input_(input),
-        assignees_(assignees),
-        assignment_expressions_(assignment_expressions),
-        predicate_(predicate) {
-    addChild(input);
-  }
-
-  LogicalPtr input_;
-  // The attributes to be assigned values to.
-  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_;
-
-  DISALLOW_COPY_AND_ASSIGN(UpdateTable);
-};
-
-/** @} */
-
-}  // namespace logical
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_QUERY_OPTIMIZER_LOGICAL_UPDATETABLE_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/logical/WindowAggregate.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/logical/WindowAggregate.cpp b/query_optimizer/logical/WindowAggregate.cpp
deleted file mode 100644
index cc09d97..0000000
--- a/query_optimizer/logical/WindowAggregate.cpp
+++ /dev/null
@@ -1,85 +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/logical/WindowAggregate.hpp"
-
-#include <string>
-#include <vector>
-
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/Alias.hpp"
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "query_optimizer/expressions/ExpressionUtil.hpp"
-#include "query_optimizer/expressions/NamedExpression.hpp"
-#include "query_optimizer/expressions/PatternMatcher.hpp"
-#include "utility/Cast.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-namespace optimizer {
-namespace logical {
-
-namespace E = ::quickstep::optimizer::expressions;
-
-LogicalPtr WindowAggregate::copyWithNewChildren(
-    const std::vector<LogicalPtr> &new_children) const {
-  DCHECK_EQ(getNumChildren(), new_children.size());
-  return Create(new_children[0], window_aggregate_expression_);
-}
-
-std::vector<E::AttributeReferencePtr> WindowAggregate::getOutputAttributes() const {
-  std::vector<E::AttributeReferencePtr> output_attributes(input_->getOutputAttributes());
-  output_attributes.push_back(E::ToRef(window_aggregate_expression_));
-  return output_attributes;
-}
-
-std::vector<E::AttributeReferencePtr> WindowAggregate::getReferencedAttributes() const {
-  return window_aggregate_expression_->getReferencedAttributes();
-}
-
-LogicalPtr WindowAggregate::copyWithNewInputExpressions(
-    const std::vector<E::ExpressionPtr> &input_expressions) const {
-  // Only one expression needed
-  DCHECK_EQ(1u, input_expressions.size());
-
-  E::AliasPtr window_aggregate_expression;
-  E::SomeAlias::MatchesWithConditionalCast(input_expressions[0],
-                                           &window_aggregate_expression);
-
-  return Create(input_, window_aggregate_expression);
-}
-
-void WindowAggregate::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("input");
-  non_container_child_fields->push_back(input_);
-
-  non_container_child_field_names->push_back("window_aggregate_expression");
-  non_container_child_fields->push_back(window_aggregate_expression_);
-}
-
-}  // namespace logical
-}  // namespace optimizer
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/logical/WindowAggregate.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/logical/WindowAggregate.hpp b/query_optimizer/logical/WindowAggregate.hpp
deleted file mode 100644
index b156938..0000000
--- a/query_optimizer/logical/WindowAggregate.hpp
+++ /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.
- **/
-
-#ifndef QUICKSTEP_QUERY_OPTIMIZER_LOGICAL_WINDOW_AGGREGATE_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_LOGICAL_WINDOW_AGGREGATE_HPP_
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/Alias.hpp"
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "query_optimizer/expressions/Expression.hpp"
-#include "query_optimizer/expressions/NamedExpression.hpp"
-#include "query_optimizer/logical/Logical.hpp"
-#include "query_optimizer/logical/LogicalType.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-namespace optimizer {
-namespace logical {
-
-/** \addtogroup OptimizerLogical
- *  @{
- */
-
-class WindowAggregate;
-typedef std::shared_ptr<const WindowAggregate> WindowAggregatePtr;
-
-/**
- * @brief Window aggregate operator that computes window aggregate expressions.
- */
-class WindowAggregate : public Logical {
- public:
-  LogicalType getLogicalType() const override {
-    return LogicalType::kWindowAggregate;
-  }
-
-  std::string getName() const override { return "WindowAggregate"; }
-
-  /**
-   * @return The input logical node.
-   */
-  const LogicalPtr& input() const { return input_; }
-
-  /**
-   * @return PARTITION BY expressions.
-   */
-  const expressions::AliasPtr window_aggregate_expression() const {
-    return window_aggregate_expression_;
-  }
-
-  LogicalPtr copyWithNewChildren(
-      const std::vector<LogicalPtr> &new_children) const override;
-
-  LogicalPtr copyWithNewInputExpressions(
-      const std::vector<expressions::ExpressionPtr> &input_expressions) const override;
-
-  std::vector<expressions::AttributeReferencePtr> getOutputAttributes() const override;
-
-  std::vector<expressions::AttributeReferencePtr> getReferencedAttributes() const override;
-
-  /**
-   * @brief Creates an Aggregate logical node.
-   *
-   * @param input The input node.
-   * @param window_aggregate_expression The window aggregate expression.
-   * @return An immutable WindowAggregate node.
-   */
-  static WindowAggregatePtr Create(
-      const LogicalPtr &input,
-      const expressions::AliasPtr &window_aggregate_expression) {
-    return WindowAggregatePtr(new WindowAggregate(input, window_aggregate_expression));
-  }
-
- 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:
-  WindowAggregate(const LogicalPtr &input,
-                  const expressions::AliasPtr &window_aggregate_expression)
-      : input_(input),
-        window_aggregate_expression_(window_aggregate_expression) {
-    addChild(input_);
-    addInputExpression(window_aggregate_expression_);
-  }
-
-  const LogicalPtr input_;
-  const expressions::AliasPtr window_aggregate_expression_;
-
-  DISALLOW_COPY_AND_ASSIGN(WindowAggregate);
-};
-
-/** @} */
-
-}  // namespace logical
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_QUERY_OPTIMIZER_LOGICAL_WINDOW_AGGREGATE_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/physical/Aggregate.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/physical/Aggregate.cpp b/query_optimizer/physical/Aggregate.cpp
deleted file mode 100644
index 35476af..0000000
--- a/query_optimizer/physical/Aggregate.cpp
+++ /dev/null
@@ -1,115 +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/physical/Aggregate.hpp"
-
-#include <string>
-#include <vector>
-
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "query_optimizer/expressions/ExpressionUtil.hpp"
-#include "query_optimizer/expressions/NamedExpression.hpp"
-#include "query_optimizer/expressions/Predicate.hpp"
-#include "utility/Cast.hpp"
-
-namespace quickstep {
-namespace optimizer {
-namespace physical {
-
-namespace E = ::quickstep::optimizer::expressions;
-
-std::vector<E::AttributeReferencePtr> Aggregate::getOutputAttributes() const {
-  std::vector<E::AttributeReferencePtr> output_attributes(
-      E::ToRefVector(grouping_expressions_));
-  const std::vector<E::AttributeReferencePtr> aggregate_output_attributes =
-      E::ToRefVector(aggregate_expressions_);
-  output_attributes.insert(output_attributes.end(),
-                           aggregate_output_attributes.begin(),
-                           aggregate_output_attributes.end());
-  return output_attributes;
-}
-
-std::vector<E::AttributeReferencePtr> Aggregate::getReferencedAttributes()
-    const {
-  std::vector<E::AttributeReferencePtr> referenced_attributes;
-  for (const E::NamedExpressionPtr &grouping_expression :
-       grouping_expressions_) {
-    const std::vector<E::AttributeReferencePtr> referenced_attributes_in_expression =
-        grouping_expression->getReferencedAttributes();
-    referenced_attributes.insert(referenced_attributes.end(),
-                                 referenced_attributes_in_expression.begin(),
-                                 referenced_attributes_in_expression.end());
-  }
-  for (const E::AliasPtr &aggregate_expression :
-       aggregate_expressions_) {
-    const std::vector<E::AttributeReferencePtr> referenced_attributes_in_expression =
-        aggregate_expression->getReferencedAttributes();
-    referenced_attributes.insert(referenced_attributes.end(),
-                                 referenced_attributes_in_expression.begin(),
-                                 referenced_attributes_in_expression.end());
-  }
-  if (filter_predicate_ != nullptr) {
-    const std::vector<E::AttributeReferencePtr> referenced_attributes_in_predicate =
-        filter_predicate_->getReferencedAttributes();
-    referenced_attributes.insert(referenced_attributes.end(),
-                                 referenced_attributes_in_predicate.begin(),
-                                 referenced_attributes_in_predicate.end());
-  }
-
-  // TODO(jianqiao): This is a quick fix to the COUNT(*) problem that we retain
-  // at least one column from the child plan to survive the PruneColumns physical
-  // optimization. The comprehensive approach should also try to optimize the
-  // child plan with regard to the knowledge that the aggregation actually don't
-  // care about the values of the child plan's output but needs only the number
-  // of rows of the output.
-  if (referenced_attributes.size() == 0) {
-    DCHECK_GT(input_->getOutputAttributes().size(), static_cast<std::size_t>(0));
-    referenced_attributes.emplace_back(input_->getOutputAttributes()[0]);
-  }
-
-  return referenced_attributes;
-}
-
-void Aggregate::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("input");
-  non_container_child_fields->push_back(input_);
-
-  container_child_field_names->push_back("grouping_expressions");
-  container_child_fields->push_back(
-      CastSharedPtrVector<OptimizerTreeBase>(grouping_expressions_));
-  container_child_field_names->push_back("aggregate_expressions");
-  container_child_fields->push_back(
-      CastSharedPtrVector<OptimizerTreeBase>(aggregate_expressions_));
-
-  if (filter_predicate_ != nullptr) {
-    non_container_child_field_names->push_back("filter_predicate");
-    non_container_child_fields->push_back(filter_predicate_);
-  }
-}
-
-}  // namespace physical
-}  // namespace optimizer
-}  // namespace quickstep



[09/51] [abbrv] [partial] incubator-quickstep git commit: remove c++ files

Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/expressions/SimpleCase.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/SimpleCase.cpp b/query_optimizer/expressions/SimpleCase.cpp
deleted file mode 100644
index 454d7b9..0000000
--- a/query_optimizer/expressions/SimpleCase.cpp
+++ /dev/null
@@ -1,188 +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/SimpleCase.hpp"
-
-#include <cstddef>
-#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/ComparisonExpression.hpp"
-#include "query_optimizer/expressions/Expression.hpp"
-#include "query_optimizer/expressions/Predicate.hpp"
-#include "query_optimizer/expressions/Scalar.hpp"
-#include "types/Type.hpp"
-#include "types/operations/comparisons/ComparisonID.hpp"
-#include "types/operations/comparisons/ComparisonFactory.hpp"
-#include "utility/Cast.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-namespace optimizer {
-namespace expressions {
-
-// We treat a SimpleCase as constant only if all operands are constant.
-bool SimpleCase::isConstant() const {
-  if (!case_operand_->isConstant()) {
-    return false;
-  }
-  for (const ScalarPtr &condition_operand : condition_operands_) {
-    if (!condition_operand->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> SimpleCase::getReferencedAttributes() const {
-  std::vector<AttributeReferencePtr> referenced_attributes;
-
-  const std::vector<AttributeReferencePtr> referenced_attributes_in_case_operand =
-      case_operand_->getReferencedAttributes();
-  referenced_attributes.insert(referenced_attributes.end(),
-                               referenced_attributes_in_case_operand.begin(),
-                               referenced_attributes_in_case_operand.end());
-
-  for (const ScalarPtr &condition_operand : condition_operands_) {
-    const std::vector<AttributeReferencePtr> referenced_attributes_in_condition_operand =
-        condition_operand->getReferencedAttributes();
-    referenced_attributes.insert(referenced_attributes.end(),
-                                 referenced_attributes_in_condition_operand.begin(),
-                                 referenced_attributes_in_condition_operand.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 SimpleCase::copyWithNewChildren(const std::vector<ExpressionPtr> &new_children) const {
-  DCHECK_EQ(getNumChildren(), new_children.size());
-
-  ScalarPtr new_case_operand;
-  std::vector<ScalarPtr> new_condition_operands;
-  std::vector<ScalarPtr> new_conditional_result_expressions;
-  ScalarPtr new_else_result_expression;
-
-  new_condition_operands.reserve(condition_operands_.size());
-  new_conditional_result_expressions.reserve(condition_operands_.size());
-
-  new_case_operand = std::static_pointer_cast<const Scalar>(new_children[0]);
-  std::size_t num_when_clauses = condition_operands_.size();
-  for (std::size_t index = 1; index <= num_when_clauses; ++index) {
-    new_condition_operands.push_back(
-        std::static_pointer_cast<const Scalar>(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_case_operand,
-                new_condition_operands,
-                new_conditional_result_expressions,
-                new_else_result_expression,
-                value_type_);
-}
-
-::quickstep::Scalar* SimpleCase::concretize(
-    const std::unordered_map<ExprId, const CatalogAttribute*> &substitution_map) const {
-  std::vector<std::unique_ptr<quickstep::Predicate>> when_predicates;
-  for (const ScalarPtr &condition_operand : condition_operands_) {
-    const PredicatePtr predicate =
-        ComparisonExpression::Create(
-            quickstep::ComparisonFactory::GetComparison(quickstep::ComparisonID::kEqual),
-            case_operand_,
-            condition_operand);
-    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.release());
-}
-
-void SimpleCase::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("case_operand");
-  non_container_child_fields->push_back(case_operand_);
-
-  container_child_field_names->push_back("condition_operands");
-  container_child_fields->push_back(CastSharedPtrVector<OptimizerTreeBase>(condition_operands_));
-
-  container_child_field_names->push_back("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/SimpleCase.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/SimpleCase.hpp b/query_optimizer/expressions/SimpleCase.hpp
deleted file mode 100644
index 897d87f..0000000
--- a/query_optimizer/expressions/SimpleCase.hpp
+++ /dev/null
@@ -1,187 +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_SIMPLE_CASE_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_EXPRESSIONS_SIMPLE_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/Scalar.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-
-class CatalogAttribute;
-class Type;
-
-namespace optimizer {
-namespace expressions {
-
-/** \addtogroup OptimizerExpressions
- *  @{
- */
-
-class SimpleCase;
-typedef std::shared_ptr<const SimpleCase> SimpleCasePtr;
-
-/**
- * @brief A simple CASE expression. It searches the first expression in
- *        <condition_operands_> with a value equal to <case_operand_>, and
- *        returns the value of the expression in <conditional_result_expressions_>
- *        at the same position; if none of <condition_operands_> meet the
- *        condition, returns the value of <else_result_expression_> when
- *        <else_result_expression_> is not NULL, otherwise returns NULL.
- */
-class SimpleCase : public Scalar {
- public:
-  ExpressionType getExpressionType() const override {
-    return ExpressionType::kSimpleCase;
-  }
-
-  std::string getName() const override {
-    return "SimpleCase";
-  }
-
-  const Type& getValueType() const override {
-    return value_type_;
-  }
-
-  /**
-   * @return The CASE operand.
-   */
-  const ScalarPtr& case_operand() const {
-    return case_operand_;
-  }
-
-  /**
-   * @return The vector of condition operands.
-   */
-  const std::vector<ScalarPtr>& condition_operands() const {
-    return condition_operands_;
-  }
-
-  /**
-   * @return The vector of conditional result expressions, one for each
-   *         condition operand.
-   */
-  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 SimpleCase.
-   *
-   * @param case_operand The CASE operand.
-   * @param condition_operands A vector of expressions to be compared with
-   *        the \p case_operand.
-   * @param conditional_result_expressions A vector of result expressions, one
-   *        per expression of \p condition_operands.
-   * @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 SimpleCasePtr Create(const ScalarPtr &case_operand,
-                              const std::vector<ScalarPtr> &condition_operands,
-                              const std::vector<ScalarPtr> &conditional_result_expressions,
-                              const ScalarPtr &else_result_expression,
-                              const Type &value_type) {
-    return SimpleCasePtr(new SimpleCase(case_operand,
-                                        condition_operands,
-                                        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:
-  SimpleCase(const ScalarPtr &case_operand,
-             const std::vector<ScalarPtr> &condition_operands,
-             const std::vector<ScalarPtr> &conditional_result_expressions,
-             const ScalarPtr &else_result_expression,
-             const Type &value_type)
-      : case_operand_(case_operand),
-        condition_operands_(condition_operands),
-        conditional_result_expressions_(conditional_result_expressions),
-        else_result_expression_(else_result_expression),
-        value_type_(value_type) {
-    addChild(case_operand_);
-    for (const ScalarPtr &condition_operand : condition_operands_) {
-      addChild(condition_operand);
-    }
-    for (const ScalarPtr &conditional_result_expression : conditional_result_expressions_) {
-      addChild(conditional_result_expression);
-    }
-    if (else_result_expression_ != nullptr) {
-      addChild(else_result_expression);
-    }
-  }
-
-  ScalarPtr case_operand_;
-  std::vector<ScalarPtr> condition_operands_;
-  std::vector<ScalarPtr> conditional_result_expressions_;
-
-  // May be NULL.
-  ScalarPtr else_result_expression_;
-
-  const Type &value_type_;
-
-  DISALLOW_COPY_AND_ASSIGN(SimpleCase);
-};
-
-/** @} */
-
-}  // namespace expressions
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_QUERY_OPTIMIZER_EXPRESSIONS_SIMPLE_CASE_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/expressions/SubqueryExpression.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/SubqueryExpression.cpp b/query_optimizer/expressions/SubqueryExpression.cpp
deleted file mode 100644
index dbcb6d6..0000000
--- a/query_optimizer/expressions/SubqueryExpression.cpp
+++ /dev/null
@@ -1,68 +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/SubqueryExpression.hpp"
-
-#include <string>
-#include <vector>
-
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "query_optimizer/expressions/ExprId.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-class CatalogAttribute;
-class Scalar;
-
-namespace optimizer {
-namespace expressions {
-
-::quickstep::Scalar* SubqueryExpression::concretize(
-    const std::unordered_map<ExprId, const CatalogAttribute*> &substitution_map) const {
-  LOG(FATAL) << "SubqueryExpression should not be concretized";
-}
-
-std::vector<AttributeReferencePtr> SubqueryExpression::getReferencedAttributes() const {
-  // Note(jianqiao): Here simply return an empty set so that we skip the validation
-  // for this expression at the end of the resolving phase (otherwise we need to
-  // revise the Validate() function to deal with OUTER scoped attributes). Note
-  // that SubqueryExpression will always be eliminated by UnnestSubqueries as the
-  // first logical optimization pass in LogicalGenerator. So any dangling attribute
-  // will still be detected by Validate() at the end of the logical optimization
-  // phase.
-  return {};
-}
-
-void SubqueryExpression::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("subquery");
-  non_container_child_fields->push_back(subquery_);
-}
-
-}  // namespace expressions
-}  // namespace optimizer
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/expressions/SubqueryExpression.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/SubqueryExpression.hpp b/query_optimizer/expressions/SubqueryExpression.hpp
deleted file mode 100644
index a128e7f..0000000
--- a/query_optimizer/expressions/SubqueryExpression.hpp
+++ /dev/null
@@ -1,132 +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_SUBQUERY_EXPRESSION_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_EXPRESSIONS_SUBQUERY_EXPRESSION_HPP_
-
-#include <memory>
-#include <string>
-#include <unordered_map>
-#include <vector>
-
-#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 "query_optimizer/logical/Logical.hpp"
-#include "query_optimizer/OptimizerTree.hpp"
-#include "utility/Macros.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-class CatalogAttribute;
-class Scalar;
-class Type;
-
-namespace optimizer {
-namespace expressions {
-
-/** \addtogroup OptimizerExpressions
- *  @{
- */
-
-class SubqueryExpression;
-typedef std::shared_ptr<const SubqueryExpression> SubqueryExpressionPtr;
-
-/**
- * @brief A subquery used in an expression.
- */
-class SubqueryExpression : public Scalar {
- public:
-  ExpressionType getExpressionType() const override {
-    return ExpressionType::kSubqueryExpression;
-  }
-
-  std::string getName() const override { return "SubqueryExpression"; }
-
-  const Type& getValueType() const override {
-    return output_attribute_->getValueType();
-  }
-
-  bool isConstant() const override {
-    return output_attribute_->isConstant();
-  }
-
-  /**
-   * @return The referenced logical subquery node.
-   */
-  const logical::LogicalPtr& subquery() const {
-    return subquery_;
-  }
-
-  std::vector<AttributeReferencePtr> getReferencedAttributes() const override;
-
-  ExpressionPtr copyWithNewChildren(
-      const std::vector<ExpressionPtr> &new_children) const override {
-    DCHECK(new_children.empty());
-    return Create(subquery_);
-  }
-
-  ::quickstep::Scalar* concretize(
-      const std::unordered_map<ExprId, const CatalogAttribute*> &substitution_map) const override;
-
-  /**
-   * @brief Creates a subquery expression.
-   * @note This expression can only be used in a logical plan.
-   *
-   * @param subquery The logical subquery node.
-   * @return An immutable SubqueryExpression.
-   */
-  static SubqueryExpressionPtr Create(const logical::LogicalPtr &subquery) {
-    return SubqueryExpressionPtr(new SubqueryExpression(subquery));
-  }
-
- 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 SubqueryExpression(const logical::LogicalPtr &subquery)
-      : subquery_(subquery),
-        output_attribute_(subquery->getOutputAttributes()[0]) {
-    DCHECK(!subquery->getOutputAttributes().empty());
-  }
-
-  logical::LogicalPtr subquery_;
-  // Set to the first output attribute if the subquery is a multi-column table query.
-  const AttributeReferencePtr output_attribute_;
-
-  DISALLOW_COPY_AND_ASSIGN(SubqueryExpression);
-};
-
-/** @} */
-
-}  // namespace expressions
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_QUERY_OPTIMIZER_EXPRESSIONS_SUBQUERY_EXPRESSION_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/expressions/UnaryExpression.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/UnaryExpression.cpp b/query_optimizer/expressions/UnaryExpression.cpp
deleted file mode 100644
index b0fff62..0000000
--- a/query_optimizer/expressions/UnaryExpression.cpp
+++ /dev/null
@@ -1,72 +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/UnaryExpression.hpp"
-
-#include <string>
-#include <unordered_map>
-#include <vector>
-
-#include "expressions/scalar/ScalarUnaryExpression.hpp"
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/ExprId.hpp"
-#include "query_optimizer/expressions/Expression.hpp"
-#include "query_optimizer/expressions/PatternMatcher.hpp"
-#include "query_optimizer/expressions/Scalar.hpp"
-#include "types/operations/unary_operations/UnaryOperation.hpp"
-#include "types/operations/unary_operations/UnaryOperationID.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-namespace optimizer {
-namespace expressions {
-
-std::string UnaryExpression::getName() const {
-  return operation_.getName();
-}
-
-ExpressionPtr UnaryExpression::copyWithNewChildren(
-    const std::vector<ExpressionPtr> &new_children) const {
-  DCHECK_EQ(new_children.size(), children().size());
-  DCHECK(SomeScalar::Matches(new_children[0]));
-  return UnaryExpression::Create(
-      operation_, std::static_pointer_cast<const Scalar>(new_children[0]));
-}
-
-::quickstep::Scalar* UnaryExpression::concretize(
-    const std::unordered_map<ExprId, const CatalogAttribute*> &substitution_map) const {
-  return new ::quickstep::ScalarUnaryExpression(
-      operation_, operand_->concretize(substitution_map));
-}
-
-void UnaryExpression::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("Operand");
-  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/UnaryExpression.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/UnaryExpression.hpp b/query_optimizer/expressions/UnaryExpression.hpp
deleted file mode 100644
index c4542d0..0000000
--- a/query_optimizer/expressions/UnaryExpression.hpp
+++ /dev/null
@@ -1,130 +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_UNARY_EXPRESSION_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_EXPRESSIONS_UNARY_EXPRESSION_HPP_
-
-#include <memory>
-#include <string>
-#include <unordered_map>
-#include <vector>
-
-#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/operations/unary_operations/UnaryOperation.hpp"
-#include "utility/Macros.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-class CatalogAttribute;
-class Scalar;
-class Type;
-
-namespace optimizer {
-namespace expressions {
-
-/** \addtogroup OptimizerExpressions
- *  @{
- */
-
-class UnaryExpression;
-typedef std::shared_ptr<const UnaryExpression> UnaryExpressionPtr;
-
-class UnaryExpression : public Scalar {
- public:
-  ExpressionType getExpressionType() const override {
-    return ExpressionType::kUnaryExpression;
-  }
-
-  std::string getName() const override;
-
-  bool isConstant() const override { return operand_->isConstant(); }
-
-  /**
-   * @return The unary operator.
-   */
-  const UnaryOperation& operation() const { return operation_; }
-
-  /**
-   * @return The operand of the unary operator.
-   */
-  const ScalarPtr& operand() const { return operand_; }
-
-  const Type& getValueType() const override {
-    return *(operation_.resultTypeForArgumentType(operand_->getValueType()));
-  }
-
-  ExpressionPtr copyWithNewChildren(
-      const std::vector<ExpressionPtr> &new_children) const override;
-
-  std::vector<AttributeReferencePtr> getReferencedAttributes() const override {
-    return operand_->getReferencedAttributes();
-  }
-
-  ::quickstep::Scalar* concretize(
-      const std::unordered_map<ExprId, const CatalogAttribute*> &substitution_map) const override;
-
-  /**
-   * @brief Creates an immutable UnaryExpression.
-   *
-   * @param operation The unary operation.
-   * @param operand The operand.
-   * @return An immutable UnaryExpression that applies the operation to the
-   *         operand.
-   */
-  static UnaryExpressionPtr Create(const UnaryOperation &operation,
-                                   const ScalarPtr &operand) {
-    return UnaryExpressionPtr(new UnaryExpression(operation, 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:
-  UnaryExpression(const UnaryOperation &operation,
-                  const ScalarPtr &operand)
-      : operation_(operation), operand_(operand) {
-    DCHECK(operation_.canApplyToType(operand_->getValueType())) << toString();
-    addChild(operand);
-  }
-
-  const UnaryOperation &operation_;
-  ScalarPtr operand_;
-
-  DISALLOW_COPY_AND_ASSIGN(UnaryExpression);
-};
-
-/** @} */
-
-}  // namespace expressions
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_QUERY_OPTIMIZER_EXPRESSIONS_UNARY_EXPRESSION_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/expressions/WindowAggregateFunction.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/WindowAggregateFunction.cpp b/query_optimizer/expressions/WindowAggregateFunction.cpp
deleted file mode 100644
index bba7c0e..0000000
--- a/query_optimizer/expressions/WindowAggregateFunction.cpp
+++ /dev/null
@@ -1,194 +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/WindowAggregateFunction.hpp"
-
-#include <string>
-#include <utility>
-#include <vector>
-
-#include "expressions/window_aggregation/WindowAggregateFunction.hpp"
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "query_optimizer/expressions/Expression.hpp"
-#include "query_optimizer/expressions/PatternMatcher.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 WindowAggregateFunction::isNullable() const {
-  std::vector<const Type*> argument_types;
-  for (const ScalarPtr &argument : arguments_) {
-    argument_types.emplace_back(&argument->getValueType());
-  }
-
-  const Type *return_type = window_aggregate_.resultTypeForArgumentTypes(argument_types);
-  DCHECK(return_type != nullptr);
-  return return_type->isNullable();
-}
-
-const Type& WindowAggregateFunction::getValueType() const {
-  std::vector<const Type*> argument_types;
-  for (const ScalarPtr &argument : arguments_) {
-    argument_types.emplace_back(&argument->getValueType());
-  }
-
-  const Type *return_type = window_aggregate_.resultTypeForArgumentTypes(argument_types);
-  DCHECK(return_type != nullptr);
-  return *return_type;
-}
-
-WindowAggregateFunctionPtr WindowAggregateFunction::Create(
-    const ::quickstep::WindowAggregateFunction &window_aggregate,
-    const std::vector<ScalarPtr> &arguments,
-    const WindowInfo &window_info,
-    const std::string &window_name,
-    const bool is_distinct) {
-#ifdef QUICKSTEP_DEBUG
-  std::vector<const Type*> argument_types;
-  for (const ScalarPtr &argument : arguments) {
-    argument_types.emplace_back(&argument->getValueType());
-  }
-  DCHECK(window_aggregate.canApplyToTypes(argument_types));
-#endif  // QUICKSTEP_DEBUG
-
-  return WindowAggregateFunctionPtr(
-      new WindowAggregateFunction(window_aggregate, arguments, window_info, window_name, is_distinct));
-}
-
-ExpressionPtr WindowAggregateFunction::copyWithNewChildren(
-    const std::vector<ExpressionPtr> &new_children) const {
-  std::vector<ScalarPtr> new_arguments;
-  for (const ExpressionPtr &expression_ptr : new_children) {
-    ScalarPtr expr_as_scalar;
-    CHECK(SomeScalar::MatchesWithConditionalCast(expression_ptr, &expr_as_scalar))
-        << expression_ptr->toString();
-    new_arguments.emplace_back(std::move(expr_as_scalar));
-  }
-
-  return WindowAggregateFunctionPtr(
-      new WindowAggregateFunction(window_aggregate_,
-                                  new_arguments,
-                                  window_info_,
-                                  window_name_,
-                                  is_distinct_));
-}
-
-std::vector<AttributeReferencePtr> WindowAggregateFunction::getReferencedAttributes() const {
-  std::vector<AttributeReferencePtr> referenced_attributes;
-  for (const ScalarPtr &argument : arguments_) {
-    const std::vector<AttributeReferencePtr> referenced_attributes_in_argument =
-        argument->getReferencedAttributes();
-    referenced_attributes.insert(referenced_attributes.end(),
-                                 referenced_attributes_in_argument.begin(),
-                                 referenced_attributes_in_argument.end());
-  }
-
-  referenced_attributes.insert(referenced_attributes.end(),
-                               window_info_.partition_by_attributes.begin(),
-                               window_info_.partition_by_attributes.end());
-
-  referenced_attributes.insert(referenced_attributes.end(),
-                               window_info_.order_by_attributes.begin(),
-                               window_info_.order_by_attributes.end());
-
-  return referenced_attributes;
-}
-
-void WindowAggregateFunction::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("function");
-  inline_field_values->push_back(window_aggregate_.getName());
-
-  container_child_field_names->push_back("arguments");
-  container_child_fields->emplace_back(CastSharedPtrVector<OptimizerTreeBase>(arguments_));
-
-  inline_field_names->push_back("window_name");
-  inline_field_values->push_back(window_name_);
-
-  container_child_field_names->push_back("partition_by");
-  container_child_fields->emplace_back(
-      CastSharedPtrVector<OptimizerTreeBase>(window_info_.partition_by_attributes));
-
-  container_child_field_names->push_back("order_by");
-  container_child_fields->emplace_back(
-      CastSharedPtrVector<OptimizerTreeBase>(window_info_.order_by_attributes));
-
-  inline_field_names->push_back("is_ascending");
-  std::string ascending_list("[");
-  for (const bool is_ascending : window_info_.order_by_directions) {
-    if (is_ascending) {
-      ascending_list.append("true,");
-    } else {
-      ascending_list.append("false,");
-    }
-  }
-  if (!window_info_.order_by_directions.empty()) {
-    ascending_list.pop_back();
-  }
-  ascending_list.append("]");
-  inline_field_values->push_back(ascending_list);
-
-  inline_field_names->push_back("nulls_first");
-  std::string nulls_first_flags("[");
-  for (const bool nulls_first_flag : window_info_.nulls_first) {
-    if (nulls_first_flag) {
-      nulls_first_flags.append("true,");
-    } else {
-      nulls_first_flags.append("false,");
-    }
-  }
-  if (!window_info_.nulls_first.empty()) {
-    nulls_first_flags.pop_back();
-  }
-  nulls_first_flags.append("]");
-  inline_field_values->push_back(nulls_first_flags);
-
-  if (window_info_.frame_info != nullptr) {
-    const WindowFrameInfo *frame_info = window_info_.frame_info;
-
-    inline_field_names->push_back("frame_mode");
-    inline_field_values->push_back(frame_info->is_row ? "row" : "range");
-
-    inline_field_names->push_back("num_preceding");
-    inline_field_values->push_back(std::to_string(frame_info->num_preceding));
-
-    inline_field_names->push_back("num_following");
-    inline_field_values->push_back(std::to_string(frame_info->num_following));
-  }
-
-  if (is_distinct_) {
-    inline_field_names->push_back("is_distinct");
-    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/WindowAggregateFunction.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/WindowAggregateFunction.hpp b/query_optimizer/expressions/WindowAggregateFunction.hpp
deleted file mode 100644
index 04b4b51..0000000
--- a/query_optimizer/expressions/WindowAggregateFunction.hpp
+++ /dev/null
@@ -1,246 +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_WINDOW_AGGREGATE_FUNCTION_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_EXPRESSIONS_WINDOW_AGGREGATE_FUNCTION_HPP_
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "query_optimizer/expressions/Expression.hpp"
-#include "query_optimizer/expressions/ExpressionType.hpp"
-#include "query_optimizer/expressions/Scalar.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-
-class Type;
-class WindowAggregateFunction;
-
-namespace optimizer {
-namespace expressions {
-
-/** \addtogroup OptimizerExpressions
- *  @{
- */
-
-struct WindowFrameInfo {
-  /**
-   * @brief Cosntructor.
-   *
-   * @param is_row_in True if this window frame is defined by ROWS, false if
-   *                  defined by RANGE.
-   * @param num_preceding_in The number of preceding tuples the window frame
-   *                         will cover, -1 means UNBOUNDED.
-   * @param num_following_in The number of following tuples the window frame
-   *                         will cover, -1 means UNBOUNDED.
-   **/
-  WindowFrameInfo(const bool is_row_in,
-                  const int num_preceding_in,
-                  const int num_following_in)
-      : is_row(is_row_in),
-        num_preceding(num_preceding_in),
-        num_following(num_following_in) {}
-
-  const bool is_row;
-  const int num_preceding;
-  const int num_following;
-};
-
-struct WindowInfo {
-  /**
-   * @brief Constructor.
-   *
-   * @param partition_by_attributes_in The partition keys for the window.
-   * @param order_by_attributes_in The order keys for the window.
-   * @param order_by_directions_in The order direction for order key.
-   * @param nulls_first_in The nulls' position for order key.
-   * @param frame_info_in The window frame information for the window. Null
-   *        means there is no explicit window frame definition.
-   **/
-  WindowInfo(const std::vector<AttributeReferencePtr> &partition_by_attributes_in,
-             const std::vector<AttributeReferencePtr> &order_by_attributes_in,
-             const std::vector<bool> &order_by_directions_in,
-             const std::vector<bool> &nulls_first_in,
-             const WindowFrameInfo *frame_info_in)
-      : partition_by_attributes(partition_by_attributes_in),
-        order_by_attributes(order_by_attributes_in),
-        order_by_directions(order_by_directions_in),
-        nulls_first(nulls_first_in),
-        frame_info(frame_info_in) {}
-
-  const std::vector<AttributeReferencePtr> partition_by_attributes;
-  const std::vector<AttributeReferencePtr> order_by_attributes;
-  const std::vector<bool> order_by_directions;
-  const std::vector<bool> nulls_first;
-  const WindowFrameInfo *frame_info;
-};
-
-class WindowAggregateFunction;
-typedef std::shared_ptr<const WindowAggregateFunction> WindowAggregateFunctionPtr;
-
-/**
- * @brief Represents a window aggregate function and its arguments in the
- *        optimizer. This class wraps some of the functionality from
- *        quickstep::AggregateFunction and represents a particular instance
- *        of an aggregate during query optimization.
- **/
-class WindowAggregateFunction : public Expression {
- public:
-  /**
-   * @brief Destructor.
-   */
-  ~WindowAggregateFunction() override {}
-
-  ExpressionType getExpressionType() const override {
-    return ExpressionType::kWindowAggregateFunction;
-  }
-
-  std::string getName() const override {
-    return "WindowAggregateFunction";
-  }
-
-  const Type& getValueType() const override;
-
-  bool isConstant() const override {
-    // Window aggregate function is never considered as a constant expression.
-    return false;
-  }
-
-  ExpressionPtr copyWithNewChildren(
-      const std::vector<ExpressionPtr> &new_children) const override;
-
-  std::vector<AttributeReferencePtr> getReferencedAttributes() const override;
-
-  /**
-   * @return Whether the type of the return value is nullable.
-   **/
-  bool isNullable() const;
-
-  /**
-   * @return The WindowAggregateFunction singleton (from the expression system)
-   *         for this node.
-   **/
-  inline const ::quickstep::WindowAggregateFunction& window_aggregate() const {
-    return window_aggregate_;
-  }
-
-  /**
-   * @return The list of scalar arguments to this aggregate.
-   **/
-  inline const std::vector<ScalarPtr>& arguments() const {
-    return arguments_;
-  }
-
-  /**
-   * @return The window info of this window aggregate function.
-   **/
-  inline const WindowInfo window_info() const {
-    return window_info_;
-  }
-
-  /**
-   * @return The name of the window.
-   **/
-  inline const std::string window_name() const {
-    return window_name_;
-  }
-
-  /**
-   * @return Whether this is a DISTINCT aggregation.
-   **/
-  inline bool is_distinct() const {
-    return is_distinct_;
-  }
-
-  /**
-   * @brief Create a new WindowAggregateFunction by directly defined window.
-   *
-   * @warning It is an error to call this with arguments that the given
-   *          aggregate can not apply to.
-   *
-   * @param aggregate The underlying WindowAggregateFunction from the expression
-   *        system.
-   * @param arguments A list of arguments to the window aggregate function.
-   * @param window_info The window info of the window aggregate function.
-   * @param is_distinct Whether this is a DISTINCT aggregation.
-   * @return A new AggregateFunctionPtr.
-   **/
-  static WindowAggregateFunctionPtr Create(const ::quickstep::WindowAggregateFunction &window_aggregate,
-                                           const std::vector<ScalarPtr> &arguments,
-                                           const WindowInfo &window_info,
-                                           const std::string &window_name,
-                                           const bool is_distinct);
-
- 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:
-  /**
-   * @brief Constructor.
-   *
-   * @param window_aggregate The actual AggregateFunction to use.
-   * @param arguments A list of arguments to the window aggregate function.
-   * @param window_info The window info of the window aggregate function.
-   * @param is_distinct Indicates whether this is a DISTINCT aggregation.
-   */
-  WindowAggregateFunction(const ::quickstep::WindowAggregateFunction &window_aggregate,
-                          const std::vector<ScalarPtr> &arguments,
-                          const WindowInfo &window_info,
-                          const std::string &window_name,
-                          const bool is_distinct)
-      : window_aggregate_(window_aggregate),
-        arguments_(arguments),
-        window_info_(window_info),
-        window_name_(window_name),
-        is_distinct_(is_distinct) {
-    for (const ScalarPtr &child : arguments_) {
-      addChild(child);
-    }
-  }
-
-  // TODO(Shixuan): Currently this class uses AggregationFunction as
-  // window_aggregate_. If it really needs to be seperated from the
-  // AggregationFunction, a new class for WindowAggregationFunction should be
-  // created as quickstep::WindowAggregateFunction.
-  const ::quickstep::WindowAggregateFunction &window_aggregate_;
-  std::vector<ScalarPtr> arguments_;
-  const WindowInfo window_info_;
-  const std::string window_name_;
-  const bool is_distinct_;
-
-  DISALLOW_COPY_AND_ASSIGN(WindowAggregateFunction);
-};
-
-/** @} */
-
-}  // namespace expressions
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_QUERY_OPTIMIZER_EXPRESSIONS_WINDOW_AGGREGATE_FUNCTION_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/logical/Aggregate.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/logical/Aggregate.cpp b/query_optimizer/logical/Aggregate.cpp
deleted file mode 100644
index 6559aca..0000000
--- a/query_optimizer/logical/Aggregate.cpp
+++ /dev/null
@@ -1,127 +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/logical/Aggregate.hpp"
-
-#include <string>
-#include <vector>
-
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "query_optimizer/expressions/ExpressionUtil.hpp"
-#include "query_optimizer/expressions/NamedExpression.hpp"
-#include "query_optimizer/expressions/PatternMatcher.hpp"
-#include "utility/Cast.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-namespace optimizer {
-namespace logical {
-
-namespace E = ::quickstep::optimizer::expressions;
-
-LogicalPtr Aggregate::copyWithNewChildren(
-    const std::vector<LogicalPtr> &new_children) const {
-  DCHECK_EQ(getNumChildren(), new_children.size());
-  return Create(new_children[0], grouping_expressions_, aggregate_expressions_);
-}
-
-std::vector<E::AttributeReferencePtr> Aggregate::getOutputAttributes() const {
-  std::vector<E::AttributeReferencePtr> output_attributes(
-      E::ToRefVector(grouping_expressions_));
-  const std::vector<E::AttributeReferencePtr> aggregate_output_attributes =
-      E::ToRefVector(aggregate_expressions_);
-  output_attributes.insert(output_attributes.end(),
-                           aggregate_output_attributes.begin(),
-                           aggregate_output_attributes.end());
-  return output_attributes;
-}
-
-std::vector<E::AttributeReferencePtr> Aggregate::getReferencedAttributes() const {
-  std::vector<E::AttributeReferencePtr> referenced_attributes;
-  for (const E::NamedExpressionPtr &grouping_expression :
-       grouping_expressions_) {
-    const std::vector<E::AttributeReferencePtr> referenced_attributes_in_expression =
-        grouping_expression->getReferencedAttributes();
-    referenced_attributes.insert(referenced_attributes.end(),
-                                 referenced_attributes_in_expression.begin(),
-                                 referenced_attributes_in_expression.end());
-  }
-  for (const E::AliasPtr &aggregate_expression :
-       aggregate_expressions_) {
-    const std::vector<E::AttributeReferencePtr> referenced_attributes_in_expression =
-        aggregate_expression->getReferencedAttributes();
-    referenced_attributes.insert(referenced_attributes.end(),
-                                 referenced_attributes_in_expression.begin(),
-                                 referenced_attributes_in_expression.end());
-  }
-  return referenced_attributes;
-}
-
-LogicalPtr Aggregate::copyWithNewInputExpressions(
-    const std::vector<E::ExpressionPtr> &input_expressions) const {
-  DCHECK_EQ(grouping_expressions_.size() + aggregate_expressions_.size(),
-            input_expressions.size());
-
-  std::vector<E::NamedExpressionPtr> new_grouping_expressions;
-  for (std::vector<E::ExpressionPtr>::size_type index = 0;
-       index < grouping_expressions_.size();
-       ++index) {
-    E::NamedExpressionPtr grouping_expression;
-    E::SomeNamedExpression::MatchesWithConditionalCast(input_expressions[index],
-                                                       &grouping_expression);
-    DCHECK(grouping_expression != nullptr);
-    new_grouping_expressions.emplace_back(grouping_expression);
-  }
-
-  std::vector<E::AliasPtr> new_aggregate_expressions;
-  for (std::vector<E::ExpressionPtr>::size_type index = grouping_expressions_.size();
-       index < input_expressions.size();
-       ++index) {
-    E::AliasPtr aggregate_expression;
-    E::SomeAlias::MatchesWithConditionalCast(input_expressions[index], &aggregate_expression);
-    DCHECK(aggregate_expression != nullptr);
-    new_aggregate_expressions.emplace_back(aggregate_expression);
-  }
-
-  return Create(input_, new_grouping_expressions, new_aggregate_expressions);
-}
-
-void Aggregate::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("input");
-  non_container_child_fields->push_back(input_);
-
-  container_child_field_names->push_back("grouping_expressions");
-  container_child_fields->push_back(
-      CastSharedPtrVector<OptimizerTreeBase>(grouping_expressions_));
-  container_child_field_names->push_back("aggregate_expressions");
-  container_child_fields->push_back(
-      CastSharedPtrVector<OptimizerTreeBase>(aggregate_expressions_));
-}
-
-}  // namespace logical
-}  // namespace optimizer
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/logical/Aggregate.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/logical/Aggregate.hpp b/query_optimizer/logical/Aggregate.hpp
deleted file mode 100644
index d8c02ba..0000000
--- a/query_optimizer/logical/Aggregate.hpp
+++ /dev/null
@@ -1,136 +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_LOGICAL_AGGREGATE_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_LOGICAL_AGGREGATE_HPP_
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "query_optimizer/expressions/Expression.hpp"
-#include "query_optimizer/expressions/NamedExpression.hpp"
-#include "query_optimizer/expressions/Alias.hpp"
-#include "query_optimizer/logical/Logical.hpp"
-#include "query_optimizer/logical/LogicalType.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-namespace optimizer {
-namespace logical {
-
-/** \addtogroup OptimizerLogical
- *  @{
- */
-
-class Aggregate;
-typedef std::shared_ptr<const Aggregate> AggregatePtr;
-
-/**
- * @brief Aggregate operator that computes aggregate expressions for each combination
- *        of the values of grouping expressions.
- */
-class Aggregate : public Logical {
- public:
-  LogicalType getLogicalType() const override { return LogicalType::kAggregate; }
-
-  std::string getName() const override { return "Aggregate"; }
-
-  /**
-   * @return The input logical node.
-   */
-  const LogicalPtr& input() const { return input_; }
-
-  /**
-   * @return Grouping expressions.
-   */
-  const std::vector<expressions::NamedExpressionPtr>& grouping_expressions() const {
-    return grouping_expressions_;
-  }
-
-  /**
-   * @return Aggregate expressions.
-   */
-  const std::vector<expressions::AliasPtr>& aggregate_expressions() const {
-    return aggregate_expressions_;
-  }
-
-  LogicalPtr copyWithNewChildren(
-      const std::vector<LogicalPtr> &new_children) const override;
-
-  LogicalPtr copyWithNewInputExpressions(
-      const std::vector<expressions::ExpressionPtr> &input_expressions) const override;
-
-  std::vector<expressions::AttributeReferencePtr> getOutputAttributes() const override;
-
-  std::vector<expressions::AttributeReferencePtr> getReferencedAttributes() const override;
-
-  /**
-   * @brief Creates an Aggregate logical node.
-   *
-   * @param input The input node.
-   * @param aggregate_expressions The aggregate expressions.
-   * @param grouping_expressions The grouping expressions.
-   * @return An immutable Aggregate node.
-   */
-  static AggregatePtr Create(
-      LogicalPtr input,
-      const std::vector<expressions::NamedExpressionPtr> &grouping_expressions,
-      const std::vector<expressions::AliasPtr> &aggregate_expressions) {
-    return AggregatePtr(
-        new Aggregate(input, grouping_expressions, aggregate_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:
-  Aggregate(LogicalPtr input,
-            const std::vector<expressions::NamedExpressionPtr> &grouping_expressions,
-            const std::vector<expressions::AliasPtr> &aggregate_expressions)
-      : input_(input),
-        grouping_expressions_(grouping_expressions),
-        aggregate_expressions_(aggregate_expressions) {
-    addChild(input_);
-    addInputExpressions(grouping_expressions_);
-    addInputExpressions(aggregate_expressions_);
-  }
-
-  LogicalPtr input_;
-  std::vector<expressions::NamedExpressionPtr> grouping_expressions_;
-  std::vector<expressions::AliasPtr> aggregate_expressions_;
-
-  DISALLOW_COPY_AND_ASSIGN(Aggregate);
-};
-
-/** @} */
-
-}  // namespace logical
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_QUERY_OPTIMIZER_LOGICAL_AGGREGATE_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/logical/BinaryJoin.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/logical/BinaryJoin.cpp b/query_optimizer/logical/BinaryJoin.cpp
deleted file mode 100644
index 5d859b6..0000000
--- a/query_optimizer/logical/BinaryJoin.cpp
+++ /dev/null
@@ -1,61 +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/logical/BinaryJoin.hpp"
-
-#include <string>
-#include <vector>
-
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/AttributeReference.hpp"
-
-namespace quickstep {
-namespace optimizer {
-namespace logical {
-
-namespace E = ::quickstep::optimizer::expressions;
-
-std::vector<E::AttributeReferencePtr> BinaryJoin::getOutputAttributes() const {
-  std::vector<E::AttributeReferencePtr> output_attributes =
-      left_->getOutputAttributes();
-  const std::vector<E::AttributeReferencePtr> output_attributes_by_right_operand =
-      right_->getOutputAttributes();
-  output_attributes.insert(output_attributes.end(),
-                           output_attributes_by_right_operand.begin(),
-                           output_attributes_by_right_operand.end());
-  return output_attributes;
-}
-
-void BinaryJoin::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("left");
-  non_container_child_field_names->push_back("right");
-
-  non_container_child_fields->push_back(left_);
-  non_container_child_fields->push_back(right_);
-}
-
-}  // namespace logical
-}  // namespace optimizer
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/logical/BinaryJoin.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/logical/BinaryJoin.hpp b/query_optimizer/logical/BinaryJoin.hpp
deleted file mode 100644
index ca68ced..0000000
--- a/query_optimizer/logical/BinaryJoin.hpp
+++ /dev/null
@@ -1,104 +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_LOGICAL_BINARY_JOIN_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_LOGICAL_BINARY_JOIN_HPP_
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "query_optimizer/logical/Join.hpp"
-#include "query_optimizer/logical/Logical.hpp"
-#include "utility/Macros.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-namespace optimizer {
-namespace logical {
-
-/** \addtogroup OptimizerLogical
- *  @{
- */
-
-class BinaryJoin;
-typedef std::shared_ptr<const BinaryJoin> BinaryJoinPtr;
-
-/**
- * @brief Base class for binary join operators that take exactly two operators
- *        as input.
- */
-class BinaryJoin : public Join {
- public:
-  /**
-   * @return Destructor.
-   */
-  ~BinaryJoin() override {}
-
-  /**
-   * @return The left logical join operator.
-   */
-  const LogicalPtr& left() const { return left_; }
-
-  /**
-   * @return The right logical join operator.
-   */
-  const LogicalPtr& right() const { return right_; }
-
-  std::vector<expressions::AttributeReferencePtr> getOutputAttributes() const override;
-
- protected:
-  /**
-   * @brief Constructor.
-   *
-   * @param left The left join operator.
-   * @param right The right join operator.
-   */
-  BinaryJoin(const LogicalPtr &left,
-             const LogicalPtr &right)
-      : left_(left), right_(right) {
-    addChild(left_);
-    addChild(right_);
-  }
-
-  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:
-  LogicalPtr left_;
-  LogicalPtr right_;
-
-  DISALLOW_COPY_AND_ASSIGN(BinaryJoin);
-};
-
-/** @} */
-
-}  // namespace logical
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_QUERY_OPTIMIZER_LOGICAL_BINARY_JOIN_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/logical/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/query_optimizer/logical/CMakeLists.txt b/query_optimizer/logical/CMakeLists.txt
deleted file mode 100644
index c67f96f..0000000
--- a/query_optimizer/logical/CMakeLists.txt
+++ /dev/null
@@ -1,306 +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.
-
-# Declare micro-libs:
-add_library(quickstep_queryoptimizer_logical_Aggregate Aggregate.cpp Aggregate.hpp)
-add_library(quickstep_queryoptimizer_logical_BinaryJoin BinaryJoin.cpp BinaryJoin.hpp)
-add_library(quickstep_queryoptimizer_logical_CopyFrom CopyFrom.cpp CopyFrom.hpp)
-add_library(quickstep_queryoptimizer_logical_CreateIndex CreateIndex.cpp CreateIndex.hpp)
-add_library(quickstep_queryoptimizer_logical_CreateTable CreateTable.cpp CreateTable.hpp)
-add_library(quickstep_queryoptimizer_logical_DeleteTuples DeleteTuples.cpp DeleteTuples.hpp)
-add_library(quickstep_queryoptimizer_logical_DropTable DropTable.cpp DropTable.hpp)
-add_library(quickstep_queryoptimizer_logical_Filter Filter.cpp Filter.hpp)
-add_library(quickstep_queryoptimizer_logical_HashJoin ../../empty_src.cpp HashJoin.hpp)
-add_library(quickstep_queryoptimizer_logical_InsertSelection InsertSelection.cpp InsertSelection.hpp)
-add_library(quickstep_queryoptimizer_logical_InsertTuple InsertTuple.cpp InsertTuple.hpp)
-add_library(quickstep_queryoptimizer_logical_Join ../../empty_src.cpp Join.hpp)
-add_library(quickstep_queryoptimizer_logical_Logical ../../empty_src.cpp Logical.hpp)
-add_library(quickstep_queryoptimizer_logical_LogicalType ../../empty_src.cpp LogicalType.hpp)
-add_library(quickstep_queryoptimizer_logical_MultiwayCartesianJoin MultiwayCartesianJoin.cpp MultiwayCartesianJoin.hpp)
-add_library(quickstep_queryoptimizer_logical_NestedLoopsJoin ../../empty_src.cpp NestedLoopsJoin.hpp)
-add_library(quickstep_queryoptimizer_logical_PatternMatcher ../../empty_src.cpp PatternMatcher.hpp)
-add_library(quickstep_queryoptimizer_logical_Project Project.cpp Project.hpp)
-add_library(quickstep_queryoptimizer_logical_Sample Sample.cpp Sample.hpp)
-add_library(quickstep_queryoptimizer_logical_SharedSubplanReference
-            SharedSubplanReference.cpp
-            SharedSubplanReference.hpp)
-add_library(quickstep_queryoptimizer_logical_Sort Sort.cpp Sort.hpp)
-add_library(quickstep_queryoptimizer_logical_TableReference TableReference.cpp TableReference.hpp)
-add_library(quickstep_queryoptimizer_logical_TableGenerator ../../empty_src.cpp TableGenerator.hpp)
-add_library(quickstep_queryoptimizer_logical_TopLevelPlan TopLevelPlan.cpp TopLevelPlan.hpp)
-add_library(quickstep_queryoptimizer_logical_UpdateTable UpdateTable.cpp UpdateTable.hpp)
-add_library(quickstep_queryoptimizer_logical_WindowAggregate WindowAggregate.cpp WindowAggregate.hpp)
-
-# Link dependencies:
-target_link_libraries(quickstep_queryoptimizer_logical_Aggregate
-                      glog
-                      quickstep_queryoptimizer_OptimizerTree
-                      quickstep_queryoptimizer_expressions_Alias
-                      quickstep_queryoptimizer_expressions_AttributeReference
-                      quickstep_queryoptimizer_expressions_Expression
-                      quickstep_queryoptimizer_expressions_ExpressionUtil
-                      quickstep_queryoptimizer_expressions_NamedExpression
-                      quickstep_queryoptimizer_expressions_PatternMatcher
-                      quickstep_queryoptimizer_logical_Logical
-                      quickstep_queryoptimizer_logical_LogicalType
-                      quickstep_utility_Cast
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_logical_BinaryJoin
-                      glog
-                      quickstep_queryoptimizer_OptimizerTree
-                      quickstep_queryoptimizer_expressions_AttributeReference
-                      quickstep_queryoptimizer_logical_Join
-                      quickstep_queryoptimizer_logical_Logical
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_logical_CopyFrom
-                      glog
-                      quickstep_catalog_CatalogRelation
-                      quickstep_queryoptimizer_OptimizerTree
-                      quickstep_queryoptimizer_expressions_AttributeReference
-                      quickstep_queryoptimizer_logical_Logical
-                      quickstep_queryoptimizer_logical_LogicalType
-                      quickstep_utility_Macros
-                      quickstep_utility_StringUtil)
-target_link_libraries(quickstep_queryoptimizer_logical_CreateIndex
-                      glog
-                      quickstep_queryoptimizer_expressions_AttributeReference
-                      quickstep_queryoptimizer_OptimizerTree
-                      quickstep_queryoptimizer_logical_Logical
-                      quickstep_queryoptimizer_logical_LogicalType
-                      quickstep_storage_StorageBlockLayout_proto
-                      quickstep_utility_Cast
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_logical_CreateTable
-                      glog
-                      quickstep_queryoptimizer_OptimizerTree
-                      quickstep_queryoptimizer_expressions_AttributeReference
-                      quickstep_queryoptimizer_logical_Logical
-                      quickstep_queryoptimizer_logical_LogicalType
-                      quickstep_storage_StorageBlockLayout_proto
-                      quickstep_utility_Cast
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_logical_DeleteTuples
-                      glog
-                      quickstep_catalog_CatalogRelation
-                      quickstep_queryoptimizer_OptimizerTree
-                      quickstep_queryoptimizer_expressions_AttributeReference
-                      quickstep_queryoptimizer_expressions_Predicate
-                      quickstep_queryoptimizer_logical_Logical
-                      quickstep_queryoptimizer_logical_LogicalType
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_logical_DropTable
-                      glog
-                      quickstep_catalog_CatalogRelation
-                      quickstep_queryoptimizer_OptimizerTree
-                      quickstep_queryoptimizer_expressions_AttributeReference
-                      quickstep_queryoptimizer_logical_Logical
-                      quickstep_queryoptimizer_logical_LogicalType
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_logical_Filter
-                      glog
-                      quickstep_queryoptimizer_OptimizerTree
-                      quickstep_queryoptimizer_expressions_AttributeReference
-                      quickstep_queryoptimizer_expressions_Expression
-                      quickstep_queryoptimizer_expressions_LogicalAnd
-                      quickstep_queryoptimizer_expressions_PatternMatcher
-                      quickstep_queryoptimizer_expressions_Predicate
-                      quickstep_queryoptimizer_logical_Logical
-                      quickstep_queryoptimizer_logical_LogicalType
-                      quickstep_queryoptimizer_logical_PatternMatcher
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_logical_HashJoin
-                      glog
-                      quickstep_queryoptimizer_OptimizerTree
-                      quickstep_queryoptimizer_expressions_AttributeReference
-                      quickstep_queryoptimizer_expressions_ExpressionUtil
-                      quickstep_queryoptimizer_expressions_Predicate
-                      quickstep_queryoptimizer_logical_BinaryJoin
-                      quickstep_queryoptimizer_logical_Logical
-                      quickstep_queryoptimizer_logical_LogicalType
-                      quickstep_utility_Cast
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_logical_InsertSelection
-                      glog
-                      quickstep_queryoptimizer_OptimizerTree
-                      quickstep_queryoptimizer_expressions_AttributeReference
-                      quickstep_queryoptimizer_logical_Logical
-                      quickstep_queryoptimizer_logical_LogicalType
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_logical_InsertTuple
-                      glog
-                      quickstep_queryoptimizer_OptimizerTree
-                      quickstep_queryoptimizer_expressions_AttributeReference
-                      quickstep_queryoptimizer_expressions_ScalarLiteral
-                      quickstep_queryoptimizer_logical_Logical
-                      quickstep_queryoptimizer_logical_LogicalType
-                      quickstep_utility_Cast
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_logical_Join
-                      quickstep_queryoptimizer_logical_Logical
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_logical_Logical
-                      quickstep_queryoptimizer_OptimizerTree
-                      quickstep_queryoptimizer_expressions_AttributeReference
-                      quickstep_queryoptimizer_expressions_Expression
-                      quickstep_queryoptimizer_logical_LogicalType
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_logical_MultiwayCartesianJoin
-                      glog
-                      quickstep_queryoptimizer_OptimizerTree
-                      quickstep_queryoptimizer_expressions_AttributeReference
-                      quickstep_queryoptimizer_logical_Join
-                      quickstep_queryoptimizer_logical_Logical
-                      quickstep_queryoptimizer_logical_LogicalType
-                      quickstep_utility_Cast
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_logical_NestedLoopsJoin
-                      glog
-                      quickstep_queryoptimizer_OptimizerTree
-                      quickstep_queryoptimizer_expressions_AttributeReference
-                      quickstep_queryoptimizer_expressions_Expression
-                      quickstep_queryoptimizer_expressions_PatternMatcher
-                      quickstep_queryoptimizer_expressions_Predicate
-                      quickstep_queryoptimizer_expressions_PredicateLiteral
-                      quickstep_queryoptimizer_logical_BinaryJoin
-                      quickstep_queryoptimizer_logical_Logical
-                      quickstep_queryoptimizer_logical_LogicalType
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_logical_PatternMatcher
-                      quickstep_queryoptimizer_logical_LogicalType)
-target_link_libraries(quickstep_queryoptimizer_logical_Project
-                      glog
-                      quickstep_queryoptimizer_OptimizerTree
-                      quickstep_queryoptimizer_expressions_AttributeReference
-                      quickstep_queryoptimizer_expressions_Expression
-                      quickstep_queryoptimizer_expressions_ExpressionUtil
-                      quickstep_queryoptimizer_expressions_NamedExpression
-                      quickstep_queryoptimizer_expressions_PatternMatcher
-                      quickstep_queryoptimizer_logical_Logical
-                      quickstep_queryoptimizer_logical_LogicalType
-                      quickstep_utility_Cast
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_logical_Sample
-                      glog
-                      quickstep_queryoptimizer_OptimizerTree
-                      quickstep_queryoptimizer_expressions_AttributeReference
-                      quickstep_queryoptimizer_expressions_ExpressionUtil
-                      quickstep_queryoptimizer_expressions_NamedExpression
-                      quickstep_queryoptimizer_logical_Logical
-                      quickstep_queryoptimizer_logical_LogicalType
-                      quickstep_utility_Cast
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_logical_SharedSubplanReference
-                      glog
-                      quickstep_queryoptimizer_OptimizerTree
-                      quickstep_queryoptimizer_expressions_AttributeReference
-                      quickstep_queryoptimizer_logical_Logical
-                      quickstep_queryoptimizer_logical_LogicalType
-                      quickstep_utility_Cast
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_logical_Sort
-                      glog
-                      quickstep_queryoptimizer_OptimizerTree
-                      quickstep_queryoptimizer_expressions_AttributeReference
-                      quickstep_queryoptimizer_expressions_ExpressionUtil
-                      quickstep_queryoptimizer_expressions_NamedExpression
-                      quickstep_queryoptimizer_logical_Logical
-                      quickstep_queryoptimizer_logical_LogicalType
-                      quickstep_utility_Cast
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_logical_TableGenerator
-                      quickstep_expressions_tablegenerator_GeneratorFunctionHandle
-                      quickstep_queryoptimizer_OptimizerContext
-                      quickstep_queryoptimizer_OptimizerTree
-                      quickstep_queryoptimizer_expressions_AttributeReference
-                      quickstep_queryoptimizer_expressions_ExprId
-                      quickstep_queryoptimizer_logical_Logical
-                      quickstep_queryoptimizer_logical_LogicalType
-                      quickstep_utility_Cast
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_logical_TableReference
-                      glog
-                      quickstep_queryoptimizer_OptimizerContext
-                      quickstep_queryoptimizer_OptimizerTree
-                      quickstep_catalog_CatalogRelation
-                      quickstep_queryoptimizer_expressions_AttributeReference
-                      quickstep_queryoptimizer_logical_Logical
-                      quickstep_queryoptimizer_logical_LogicalType
-                      quickstep_utility_Cast
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_logical_TopLevelPlan
-                      glog
-                      quickstep_queryoptimizer_OptimizerTree
-                      quickstep_queryoptimizer_expressions_AttributeReference
-                      quickstep_queryoptimizer_expressions_ExprId
-                      quickstep_queryoptimizer_logical_Logical
-                      quickstep_queryoptimizer_logical_LogicalType
-                      quickstep_utility_Cast
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_logical_UpdateTable
-                      glog
-                      quickstep_queryoptimizer_OptimizerTree
-                      quickstep_queryoptimizer_expressions_AttributeReference
-                      quickstep_queryoptimizer_expressions_Predicate
-                      quickstep_queryoptimizer_expressions_Scalar
-                      quickstep_queryoptimizer_logical_Logical
-                      quickstep_queryoptimizer_logical_LogicalType
-                      quickstep_utility_Cast
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_logical_WindowAggregate
-                      glog
-                      quickstep_queryoptimizer_expressions_Alias
-                      quickstep_queryoptimizer_expressions_AttributeReference
-                      quickstep_queryoptimizer_expressions_Expression
-                      quickstep_queryoptimizer_expressions_ExpressionUtil
-                      quickstep_queryoptimizer_expressions_NamedExpression
-                      quickstep_queryoptimizer_expressions_PatternMatcher
-                      quickstep_queryoptimizer_logical_Logical
-                      quickstep_queryoptimizer_logical_LogicalType
-                      quickstep_queryoptimizer_OptimizerTree
-                      quickstep_utility_Cast
-                      quickstep_utility_Macros)
-
-
-# Module all-in-one library:
-add_library(quickstep_queryoptimizer_logical ../../empty_src.cpp OptimizerLogicalModule.hpp)
-target_link_libraries(quickstep_queryoptimizer_logical
-                      quickstep_queryoptimizer_logical_Aggregate
-                      quickstep_queryoptimizer_logical_BinaryJoin
-                      quickstep_queryoptimizer_logical_CopyFrom
-                      quickstep_queryoptimizer_logical_CreateIndex
-                      quickstep_queryoptimizer_logical_CreateTable
-                      quickstep_queryoptimizer_logical_DeleteTuples
-                      quickstep_queryoptimizer_logical_DropTable
-                      quickstep_queryoptimizer_logical_Filter
-                      quickstep_queryoptimizer_logical_HashJoin
-                      quickstep_queryoptimizer_logical_InsertSelection
-                      quickstep_queryoptimizer_logical_InsertTuple
-                      quickstep_queryoptimizer_logical_Join
-                      quickstep_queryoptimizer_logical_Logical
-                      quickstep_queryoptimizer_logical_LogicalType
-                      quickstep_queryoptimizer_logical_MultiwayCartesianJoin
-                      quickstep_queryoptimizer_logical_NestedLoopsJoin
-                      quickstep_queryoptimizer_logical_PatternMatcher
-                      quickstep_queryoptimizer_logical_Project
-                      quickstep_queryoptimizer_logical_Sample
-                      quickstep_queryoptimizer_logical_SharedSubplanReference
-                      quickstep_queryoptimizer_logical_Sort
-                      quickstep_queryoptimizer_logical_TableGenerator
-                      quickstep_queryoptimizer_logical_TableReference
-                      quickstep_queryoptimizer_logical_TopLevelPlan
-                      quickstep_queryoptimizer_logical_UpdateTable
-                      quickstep_queryoptimizer_logical_WindowAggregate)

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/logical/CopyFrom.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/logical/CopyFrom.cpp b/query_optimizer/logical/CopyFrom.cpp
deleted file mode 100644
index b0a1423..0000000
--- a/query_optimizer/logical/CopyFrom.cpp
+++ /dev/null
@@ -1,56 +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/logical/CopyFrom.hpp"
-
-#include <string>
-#include <vector>
-
-#include "query_optimizer/OptimizerTree.hpp"
-#include "catalog/CatalogRelation.hpp"
-#include "utility/StringUtil.hpp"
-
-namespace quickstep {
-namespace optimizer {
-namespace logical {
-
-void CopyFrom::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("relation");
-  inline_field_values->push_back(catalog_relation_->getName());
-
-  inline_field_names->push_back("file_name");
-  inline_field_values->push_back(file_name_);
-
-  inline_field_names->push_back("column_delimiter");
-  inline_field_values->push_back("\"" + EscapeSpecialChars(std::string(1, column_delimiter_)) +
-                                 "\"");
-
-  inline_field_names->push_back("escape_strings");
-  inline_field_values->push_back(escape_strings_ ? "true" : "false");
-}
-
-}  // namespace logical
-}  // namespace optimizer
-}  // namespace quickstep


[40/51] [abbrv] [partial] incubator-quickstep git commit: remove c++ files

Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/aggregation/AggregationConcreteHandle.hpp
----------------------------------------------------------------------
diff --git a/expressions/aggregation/AggregationConcreteHandle.hpp b/expressions/aggregation/AggregationConcreteHandle.hpp
deleted file mode 100644
index 398a032..0000000
--- a/expressions/aggregation/AggregationConcreteHandle.hpp
+++ /dev/null
@@ -1,325 +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_EXPRESSIONS_AGGREGATION_AGGREGATION_CONCRETE_HANDLE_HPP_
-#define QUICKSTEP_EXPRESSIONS_AGGREGATION_AGGREGATION_CONCRETE_HANDLE_HPP_
-
-#include <cstddef>
-#include <utility>
-#include <vector>
-
-#include "catalog/CatalogTypedefs.hpp"
-#include "expressions/aggregation/AggregationHandle.hpp"
-#include "storage/FastHashTable.hpp"
-#include "storage/HashTable.hpp"
-#include "storage/HashTableBase.hpp"
-#include "threading/SpinMutex.hpp"
-#include "types/TypedValue.hpp"
-#include "types/containers/ColumnVector.hpp"
-#include "utility/Macros.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-class StorageManager;
-class Type;
-class ValueAccessor;
-
-/** \addtogroup Expressions
- *  @{
- */
-
-/**
- * @brief An upserter class for modifying the destination hash table while
- *        merging two group by hash tables.
- **/
-template <typename HandleT>
-class HashTableStateUpserterFast {
- public:
-  /**
-   * @brief Constructor.
-   *
-   * @param handle The aggregation handle being used.
-   * @param source_state The aggregation state in the source aggregation hash
-   *        table. The corresponding state (for the same key) in the destination
-   *        hash table will be upserted.
-   **/
-  HashTableStateUpserterFast(const HandleT &handle,
-                             const std::uint8_t *source_state)
-      : handle_(handle), source_state_(source_state) {}
-
-  /**
-   * @brief The operator for the functor required for the upsert.
-   *
-   * @param destination_state The aggregation state in the aggregation hash
-   *        table that is being upserted.
-   **/
-  void operator()(std::uint8_t *destination_state) {
-    handle_.mergeStatesFast(source_state_, destination_state);
-  }
-
- private:
-  const HandleT &handle_;
-  const std::uint8_t *source_state_;
-
-  DISALLOW_COPY_AND_ASSIGN(HashTableStateUpserterFast);
-};
-
-/**
- * @brief The helper intermediate subclass of AggregationHandle that provides
- *        virtual method implementations as well as helper methods that are
- *        shared among all its subclasses.
- *
- * @note The reason that we have this intermediate class instead of putting
- *       everything inside AggregationHandle is to avoid cyclic dependency, e.g.
- *       when HashTable has to be used.
- **/
-class AggregationConcreteHandle : public AggregationHandle {
- public:
-  /**
-   * @brief Default implementaion for AggregationHandle::accumulateNullary().
-   */
-  AggregationState* accumulateNullary(
-      const std::size_t num_tuples) const override {
-    LOG(FATAL) << "Called accumulateNullary on an AggregationHandle that "
-               << "takes at least one argument.";
-  }
-
-  /**
-   * @brief Implementaion for AggregationHandle::createDistinctifyHashTable()
-   *        that creates a new HashTable for the distinctify step for
-   *        DISTINCT aggregation.
-   */
-  AggregationStateHashTableBase* createDistinctifyHashTable(
-      const HashTableImplType hash_table_impl,
-      const std::vector<const Type *> &key_types,
-      const std::size_t estimated_num_distinct_keys,
-      StorageManager *storage_manager) const override;
-
-  /**
-   * @brief Implementaion for
-   * AggregationHandle::insertValueAccessorIntoDistinctifyHashTable()
-   * that inserts the GROUP BY expressions and aggregation arguments together
-   * as keys into the distinctify hash table.
-   */
-  void insertValueAccessorIntoDistinctifyHashTable(
-      ValueAccessor *accessor,
-      const std::vector<attribute_id> &key_ids,
-      AggregationStateHashTableBase *distinctify_hash_table) const override;
-
- protected:
-  AggregationConcreteHandle() {}
-
-  template <typename HandleT, typename StateT>
-  StateT* aggregateOnDistinctifyHashTableForSingleUnaryHelperFast(
-      const AggregationStateHashTableBase &distinctify_hash_table) const;
-
-  template <typename HandleT, typename HashTableT>
-  void aggregateOnDistinctifyHashTableForGroupByUnaryHelperFast(
-      const AggregationStateHashTableBase &distinctify_hash_table,
-      AggregationStateHashTableBase *hash_table,
-      std::size_t index) const;
-
-  template <typename HandleT, typename HashTableT>
-  ColumnVector* finalizeHashTableHelperFast(
-      const Type &result_type,
-      const AggregationStateHashTableBase &hash_table,
-      std::vector<std::vector<TypedValue>> *group_by_keys,
-      int index) const;
-
-  template <typename HandleT, typename HashTableT>
-  inline TypedValue finalizeGroupInHashTableFast(
-      const AggregationStateHashTableBase &hash_table,
-      const std::vector<TypedValue> &group_key,
-      int index) const {
-    const std::uint8_t *group_state =
-        static_cast<const HashTableT &>(hash_table).getSingleCompositeKey(group_key, index);
-    DCHECK(group_state != nullptr)
-        << "Could not find entry for specified group_key in HashTable";
-    return static_cast<const HandleT *>(this)->finalizeHashTableEntryFast(
-        group_state);
-  }
-
-  template <typename HandleT, typename HashTableT>
-  void mergeGroupByHashTablesHelperFast(
-      const AggregationStateHashTableBase &source_hash_table,
-      AggregationStateHashTableBase *destination_hash_table) const;
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(AggregationConcreteHandle);
-};
-
-/**
- * @brief Templated helper class used to implement
- *        AggregationHandle::finalizeHashTable() by visiting each entry (i.e.
- *        GROUP) in a HashTable, finalizing the aggregation for the GROUP, and
- *        collecting the GROUP BY key values and the final aggregate values in
- *        a ColumnVector.
- **/
-template <typename HandleT, typename ColumnVectorT>
-class HashTableAggregateFinalizer {
- public:
-  HashTableAggregateFinalizer(
-      const HandleT &handle,
-      std::vector<std::vector<TypedValue>> *group_by_keys,
-      ColumnVectorT *output_column_vector)
-      : handle_(handle),
-        group_by_keys_(group_by_keys),
-        output_column_vector_(output_column_vector) {}
-
-  inline void operator()(const std::vector<TypedValue> &group_by_key,
-                         const AggregationState &group_state) {
-    group_by_keys_->emplace_back(group_by_key);
-    output_column_vector_->appendTypedValue(
-        handle_.finalizeHashTableEntry(group_state));
-  }
-
-  inline void operator()(const std::vector<TypedValue> &group_by_key,
-                         const unsigned char *byte_ptr) {
-    group_by_keys_->emplace_back(group_by_key);
-    output_column_vector_->appendTypedValue(
-        handle_.finalizeHashTableEntryFast(byte_ptr));
-  }
-
- private:
-  const HandleT &handle_;
-  std::vector<std::vector<TypedValue>> *group_by_keys_;
-  ColumnVectorT *output_column_vector_;
-};
-
-/** @} */
-
-// ----------------------------------------------------------------------------
-// Implementations of templated methods follow:
-
-template <typename HandleT, typename StateT>
-StateT* AggregationConcreteHandle::
-    aggregateOnDistinctifyHashTableForSingleUnaryHelperFast(
-        const AggregationStateHashTableBase &distinctify_hash_table) const {
-  const HandleT &handle = static_cast<const HandleT &>(*this);
-  StateT *state = static_cast<StateT *>(createInitialState());
-
-  // A lambda function which will be called on each key from the distinctify
-  // hash table.
-  const auto aggregate_functor = [&handle, &state](
-      const TypedValue &key, const std::uint8_t &dumb_placeholder) {
-    // For each (unary) key in the distinctify hash table, aggregate the key
-    // into "state".
-    handle.iterateUnaryInl(state, key);
-  };
-
-  const AggregationStateFastHashTable &hash_table =
-      static_cast<const AggregationStateFastHashTable &>(
-          distinctify_hash_table);
-  // Invoke the lambda function "aggregate_functor" on each key from the
-  // distinctify hash table.
-  hash_table.forEach(&aggregate_functor);
-
-  return state;
-}
-
-template <typename HandleT, typename HashTableT>
-void AggregationConcreteHandle::
-    aggregateOnDistinctifyHashTableForGroupByUnaryHelperFast(
-        const AggregationStateHashTableBase &distinctify_hash_table,
-        AggregationStateHashTableBase *aggregation_hash_table,
-        std::size_t index) const {
-  const HandleT &handle = static_cast<const HandleT &>(*this);
-  HashTableT *target_hash_table =
-      static_cast<HashTableT *>(aggregation_hash_table);
-
-  // A lambda function which will be called on each key-value pair from the
-  // distinctify hash table.
-  const auto aggregate_functor = [&handle, &target_hash_table, &index](
-      std::vector<TypedValue> &key, const bool &dumb_placeholder) {
-    // For each (composite) key vector in the distinctify hash table with size N.
-    // The first N-1 entries are GROUP BY columns and the last entry is the
-    // argument to be aggregated on.
-    const TypedValue argument(std::move(key.back()));
-    key.pop_back();
-
-    // An upserter as lambda function for aggregating the argument into its
-    // GROUP BY group's entry inside aggregation_hash_table.
-    const auto upserter = [&handle, &argument](std::uint8_t *state) {
-      handle.iterateUnaryInlFast(argument, state);
-    };
-
-    target_hash_table->upsertCompositeKeyFast(key, nullptr, &upserter, index);
-  };
-
-  const HashTableT &source_hash_table =
-      static_cast<const HashTableT &>(distinctify_hash_table);
-  // Invoke the lambda function "aggregate_functor" on each composite key vector
-  // from the distinctify hash table.
-  source_hash_table.forEachCompositeKeyFast(&aggregate_functor);
-}
-
-template <typename HandleT, typename HashTableT>
-ColumnVector* AggregationConcreteHandle::finalizeHashTableHelperFast(
-    const Type &result_type,
-    const AggregationStateHashTableBase &hash_table,
-    std::vector<std::vector<TypedValue>> *group_by_keys,
-    int index) const {
-  const HandleT &handle = static_cast<const HandleT &>(*this);
-  const HashTableT &hash_table_concrete =
-      static_cast<const HashTableT &>(hash_table);
-
-  if (group_by_keys->empty()) {
-    if (NativeColumnVector::UsableForType(result_type)) {
-      NativeColumnVector *result =
-          new NativeColumnVector(result_type, hash_table_concrete.numEntries());
-      HashTableAggregateFinalizer<HandleT, NativeColumnVector> finalizer(
-          handle, group_by_keys, result);
-      hash_table_concrete.forEachCompositeKeyFast(&finalizer, index);
-      return result;
-    } else {
-      IndirectColumnVector *result = new IndirectColumnVector(
-          result_type, hash_table_concrete.numEntries());
-      HashTableAggregateFinalizer<HandleT, IndirectColumnVector> finalizer(
-          handle, group_by_keys, result);
-      hash_table_concrete.forEachCompositeKeyFast(&finalizer, index);
-      return result;
-    }
-  } else {
-    if (NativeColumnVector::UsableForType(result_type)) {
-      NativeColumnVector *result =
-          new NativeColumnVector(result_type, group_by_keys->size());
-      for (const std::vector<TypedValue> &group_by_key : *group_by_keys) {
-        result->appendTypedValue(
-            finalizeGroupInHashTableFast<HandleT, HashTableT>(
-                hash_table, group_by_key, index));
-      }
-      return result;
-    } else {
-      IndirectColumnVector *result = new IndirectColumnVector(
-          result_type, hash_table_concrete.numEntries());
-      for (const std::vector<TypedValue> &group_by_key : *group_by_keys) {
-        result->appendTypedValue(
-            finalizeGroupInHashTableFast<HandleT, HashTableT>(
-                hash_table, group_by_key, index));
-      }
-      return result;
-    }
-  }
-}
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_EXPRESSIONS_AGGREGATION_AGGREGATION_CONCRETE_HANDLE_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/aggregation/AggregationHandle.hpp
----------------------------------------------------------------------
diff --git a/expressions/aggregation/AggregationHandle.hpp b/expressions/aggregation/AggregationHandle.hpp
deleted file mode 100644
index 4b51179..0000000
--- a/expressions/aggregation/AggregationHandle.hpp
+++ /dev/null
@@ -1,437 +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_EXPRESSIONS_AGGREGATION_AGGREGATION_HANDLE_HPP_
-#define QUICKSTEP_EXPRESSIONS_AGGREGATION_AGGREGATION_HANDLE_HPP_
-
-#include <cstddef>
-#include <memory>
-#include <vector>
-
-#include "catalog/CatalogTypedefs.hpp"
-#include "storage/HashTableBase.hpp"
-#include "types/TypedValue.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-
-class ColumnVector;
-class StorageManager;
-class Type;
-class ValueAccessor;
-
-/** \addtogroup Expressions
- *  @{
- */
-
-/**
- * @brief Abstract base class for aggregation state.
- **/
-class AggregationState {
- public:
-  /**
-   * @brief Default constructor.
-   **/
-  AggregationState() {}
-
-  /**
-   * @brief Pure virtual destructor.
-   **/
-  virtual ~AggregationState() = 0;
-};
-
-// Destructor should be defined. This will be called when derived class
-// destructor is called.
-inline AggregationState::~AggregationState() {}
-
-/**
- * @brief AggregationHandle encapsulates logic for actually computing
- *        aggregates with particular argument(s).
- * @note See also AggregateFunction, which represents a SQL aggregate function
- *       in the abstract sense.
- *
- * An AggregationHandle is created by calling
- * AggregateFunction::createHandle(). The AggregationHandle object provides
- * methods that are used to actually compute the aggregate, storing
- * intermediate results in AggregationState objects.
- *
- * I. The work-flow for computing an aggregate without GROUP BY is as follows:
- *     1. Create a global state for the aggregate with createInitialState().
- *     2. For each block in a relation (parallelizable):
- *        a. Call StorageBlock::aggregate() to accumulate results from the
- *           block (under the covers, this calls either
- *           accumulateColumnVectors() or accumulateValueAccessor() to do the
- *           actual per-block aggregation in a vectorized fashion).
- *        b. Merge the per-block results back with the global state by calling
- *           mergeStates() (this is threadsafe).
- *     3. Generate the final result by calling finalize() on the global state.
- *
- * II. The work-flow for computing an aggregate with GROUP BY is as follows:
- *     1. Create a HashTable to hold per-group states by calling
- *        createGroupByHashTable().
- *     2. For each block in a relation (parallelizable):
- *        a. Call StorageBlock::aggregateGroupBy() to update the states in the
- *           HashTable according to the values in the block (under the covers,
- *           this calls aggregateValueAccessorIntoHashTable() to aggregate over
- *           all the values/groups in a block in one shot; this is threadsafe).
- *     3. Generate the final set of groups and their corresponding results by
- *        calling finalizeHashTable().
- *
- * See also AggregationOperationState, which holds 1 or more global states or
- * HashTables for an aggregate query, and has some logic to re-use common
- * information across multiple aggregates being computed on the same block
- * (e.g. the set of matches for a predicate, or the values of computed GROUP BY
- * expressions). AggregationOperationState also has a method to write out
- * finalized aggregate values to an InsertDestination.
- **/
-class AggregationHandle {
- public:
-  /**
-   * @brief Virtual destructor.
-   *
-   **/
-  virtual ~AggregationHandle() {}
-
-  /**
-   * @brief Create an initial "blank" state for this aggregation.
-   *
-   * @return An initial "blank" state for this particular aggregation.
-   **/
-  virtual AggregationState* createInitialState() const = 0;
-
-  /**
-   * @brief Create a new HashTable for aggregation with GROUP BY.
-   *
-   * @param hash_table_impl The choice of which concrete HashTable
-   *        implementation to use.
-   * @param group_by_types The types of the GROUP BY columns/expressions. These
-   *        correspond to the (composite) key type for the HashTable.
-   * @param estimated_num_groups The estimated number of distinct groups for
-   *        the GROUP BY aggregation. This is used to size the initial
-   *        HashTable. This is an estimate only, and the HashTable will be
-   *        resized if it becomes over-full.
-   * @param storage_manager The StorageManager to use to create the HashTable.
-   *        A StorageBlob will be allocated to serve as the HashTable's
-   *        in-memory storage.
-   * @return A new HashTable instance with the appropriate state type for this
-   *         aggregate.
-   **/
-  virtual AggregationStateHashTableBase* createGroupByHashTable(
-      const HashTableImplType hash_table_impl,
-      const std::vector<const Type *> &group_by_types,
-      const std::size_t estimated_num_groups,
-      StorageManager *storage_manager) const = 0;
-
-  /**
-   * @brief Accumulate over tuples for a nullary aggregate function (one that
-   *        has zero arguments, i.e. COUNT(*)).
-   *
-   * @param num_tuples The number of tuples to "accumulate". No actual tuple
-   *        data is accessed, the only thing that a nullary aggeregate can know
-   *        about input is its cardinality.
-   * @return A new AggregationState which contains the accumulated results from
-   *         applying the (nullary) aggregate to the specified number of
-   *         tuples.
-   **/
-  virtual AggregationState* accumulateNullary(
-      const std::size_t num_tuples) const = 0;
-
-  /**
-   * @brief Accumulate (iterate over) all values in one or more ColumnVectors
-   *        and return a new AggregationState which can be merged with other
-   *        states or finalized.
-   *
-   * @param column_vectors One or more ColumnVectors that the aggregate will be
-   *        applied to. These correspond to the aggregate function's arguments,
-   *        in order.
-   * @return A new AggregationState which contains the accumulated results from
-   *         applying the aggregate to column_vectors. Caller is responsible
-   *         for deleting the returned AggregationState.
-   **/
-  virtual AggregationState* accumulateColumnVectors(
-      const std::vector<std::unique_ptr<ColumnVector>> &column_vectors) const = 0;
-
-#ifdef QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_SELECTION
-  /**
-   * @brief Accumulate (iterate over) all values in columns accessible through
-   *        a ValueAccessor and return a new AggregationState which can be
-   *        merged with other states or finalized.
-   *
-   * @param accessor A ValueAccessor that the columns to be aggregated can be
-   *        accessed through.
-   * @param accessor_ids The attribute_ids that correspond to the columns in
-   *        accessor to aggeregate. These correspond to the aggregate
-   *        function's arguments, in order.
-   * @return A new AggregationState which contains the accumulated results from
-   *         applying the aggregate to the specified columns in accessor.
-   *         Caller is responsible for deleting the returned AggregationState.
-   **/
-  virtual AggregationState* accumulateValueAccessor(
-      ValueAccessor *accessor,
-      const std::vector<attribute_id> &accessor_ids) const = 0;
-#endif
-
-  /**
-   * @brief Perform an aggregation with GROUP BY over all the tuples accessible
-   *        through a ValueAccessor, upserting states in a HashTable.
-   *
-   * @note Implementations of this method are threadsafe with respect to
-   *       hash_table, and can be called concurrently from multiple threads
-   *       with the same HashTable object.
-   *
-   * @param accessor The ValueAccessor that will be iterated over to read
-   *        tuples.
-   * @param argument_ids The attribute_ids of the arguments to this aggregate
-   *        in accessor, in order.
-   * @param group_by_key_ids The attribute_ids of the group-by
-   *        columns/expressions in accessor.
-   * @param hash_table The HashTable to upsert AggregationStates in. This
-   *        should have been created by calling createGroupByHashTable() on
-   *        this same AggregationHandle.
-   **/
-  virtual void aggregateValueAccessorIntoHashTable(
-      ValueAccessor *accessor,
-      const std::vector<attribute_id> &argument_ids,
-      const std::vector<attribute_id> &group_by_key_ids,
-      AggregationStateHashTableBase *hash_table) const = 0;
-
-  /**
-   * @brief Merge two AggregationStates, updating one in-place. This computes a
-   *        new intermediate result and stores it in the destination
-   *        AggregationState.
-   *
-   * @note The order of arguments (i.e. which AggregationState is source and
-   *       which is destination) is not important for the result of the merging
-   *       process, but it does determine which of the two states is
-   *       overwritten (destination) and which remains unchanged (source).
-   * @note Implementations of this method are threadsafe with respect to the
-   *       destination state, and can be called concurrently from multiple
-   *       threads with the same state object.
-   *
-   * @param source The AggregationState to merge "from".
-   * @param destination The AggregationState to merge "to". The internal state
-   *        will be overwritten with the merged result.
-   **/
-  virtual void mergeStates(const AggregationState &source,
-                           AggregationState *destination) const = 0;
-
-  /**
-   * @brief Computes and returns the resulting aggregate by using intermediate
-   *        result saved in this handle.
-   *
-   * @note Except for count, SQL89 aggeregates return NULL when no rows are
-   *       selected.
-   * @warning It is dangerous to assume that calling mergeStates() or some
-   *          iterate method after previous finalize call will work correctly
-   *          when the aggregate function is not one of SQL89 aggregates (SUM,
-   *          COUNT, MIN, MAX, AVG).
-   *
-   * @return The result of this aggregation.
-   **/
-  virtual TypedValue finalize(const AggregationState &state) const = 0;
-
-  /**
-   * @brief Compute and return finalized aggregates for all groups in a
-   *        HashTable.
-   *
-   * @param hash_table The HashTable to finalize states from. This should have
-   *        have been created by calling createGroupByHashTable() on this same
-   *        AggregationHandle.
-   * @param group_by_keys A pointer to a vector of vectors of GROUP BY keys. If
-   *        this is initially empty, it will be filled in with the GROUP BY
-   *        keys visited by this method in the same order as the finalized
-   *        values returned in the ColumnVector. If this is already filled in,
-   *        then this method will visit the GROUP BY keys in the exact order
-   *        specified.
-   * @param index The index of the AggregationHandle to be finalized.
-   *
-   * @return A ColumnVector containing each group's finalized aggregate value.
-   **/
-  virtual ColumnVector* finalizeHashTable(
-      const AggregationStateHashTableBase &hash_table,
-      std::vector<std::vector<TypedValue>> *group_by_keys,
-      int index) const = 0;
-
-  /**
-   * @brief Create a new HashTable for the distinctify step for DISTINCT
-   * aggregation.
-   *
-   * Distinctify is the first step for DISTINCT aggregation. This step inserts
-   * the GROUP BY expression values and aggregation arguments together as keys
-   * into the distinctify hash table, so that arguments are distinctified within
-   * each GROUP BY group. Later, a second-round aggregation on the distinctify
-   * hash table will be performed to actually compute the aggregated result for
-   * each GROUP BY group.
-   *
-   * In the case of single aggregation where there is no GROUP BY expressions,
-   * we simply treat it as a special GROUP BY case that the GROUP BY expression
-   * vector is empty.
-   *
-   * @param hash_table_impl The choice of which concrete HashTable
-   *        implementation to use.
-   * @param key_types The types of the GROUP BY expressions together with the
-   *        types of the aggregation arguments.
-   * @param estimated_num_distinct_keys The estimated number of distinct keys
-   *        (i.e. GROUP BY expressions together with aggregation arguments) for
-   *        the distinctify step. This is used to size the initial HashTable.
-   *        This is an estimate only, and the HashTable will be resized if it
-   *        becomes over-full.
-   * @param storage_manager The StorageManager to use to create the HashTable.
-   *        A StorageBlob will be allocated to serve as the HashTable's
-   *        in-memory storage.
-   *
-   * @return A new HashTable instance with the appropriate state type for this
-   *         aggregate.
-   */
-  virtual AggregationStateHashTableBase* createDistinctifyHashTable(
-      const HashTableImplType hash_table_impl,
-      const std::vector<const Type *> &key_types,
-      const std::size_t estimated_num_distinct_keys,
-      StorageManager *storage_manager) const = 0;
-
-  /**
-   * @brief Inserts the GROUP BY expressions and aggregation arguments together
-   * as keys into the distinctify hash table.
-   *
-   * @param accessor The ValueAccessor that will be iterated over to read
-   *        tuples.
-   * @param key_ids The attribute_ids of the GROUP BY expressions in accessor
-   *        together with the attribute_ids of the arguments to this aggregate
-   *        in accessor, in order.
-   * @param distinctify_hash_table The HashTable to store the GROUP BY
-   *        expressions and the aggregation arguments together as hash table
-   *        keys and a bool constant \c true as hash table value (So the hash
-   *        table actually serves as a hash set). This should have been created
-   *        by calling createDistinctifyHashTable();
-   */
-  virtual void insertValueAccessorIntoDistinctifyHashTable(
-      ValueAccessor *accessor,
-      const std::vector<attribute_id> &key_ids,
-      AggregationStateHashTableBase *distinctify_hash_table) const = 0;
-
-  /**
-   * @brief Perform single (i.e. without GROUP BY) aggregation on the keys from
-   * the distinctify hash table to actually compute the aggregated results.
-   *
-   * @param distinctify_hash_table Hash table which stores the distinctified
-   *        aggregation arguments as hash table keys. This should have been
-   *        created by calling createDistinctifyHashTable();
-   * @return A new AggregationState which contains the aggregated results from
-   *         applying the aggregate to the distinctify hash table.
-   *         Caller is responsible for deleting the returned AggregationState.
-   */
-  virtual AggregationState* aggregateOnDistinctifyHashTableForSingle(
-      const AggregationStateHashTableBase &distinctify_hash_table) const = 0;
-
-  /**
-   * @brief Perform GROUP BY aggregation on the keys from the distinctify hash
-   * table and upserts states into the aggregation hash table.
-   *
-   * @param distinctify_hash_table Hash table which stores the GROUP BY
-   *        expression values and aggregation arguments together as hash table
-   *        keys.
-   * @param aggregation_hash_table The HashTable to upsert AggregationStates in.
-   *        This should have been created by calling createGroupByHashTable() on
-   *        this same AggregationHandle.
-   * @param index The index of the distinctify hash table for which we perform
-   *        the DISTINCT aggregation.
-   */
-  virtual void aggregateOnDistinctifyHashTableForGroupBy(
-      const AggregationStateHashTableBase &distinctify_hash_table,
-      AggregationStateHashTableBase *aggregation_hash_table,
-      std::size_t index) const = 0;
-
-  /**
-   * @brief Get the number of bytes needed to store the aggregation handle's
-   *        state.
-   **/
-  virtual std::size_t getPayloadSize() const { return 1; }
-
-  /**
-   * @brief Update the aggregation state for nullary aggregation function e.g.
-   *        COUNT(*).
-   *
-   * @note This function should be overloaded by those aggregation function
-   *       which can perform nullary operations, e.g. COUNT.
-   *
-   * @param byte_ptr The pointer where the aggregation state is stored.
-   **/
-  virtual void updateStateNullary(std::uint8_t *byte_ptr) const {}
-
-  /**
-   * @brief Update the aggregation state for unary aggregation function e.g.
-   *        SUM(a).
-   *
-   * @param argument The argument which will be used to update the state of the
-   *        aggregation function.
-   * @param byte_ptr The pointer where the aggregation state is stored.
-   **/
-  virtual void updateStateUnary(const TypedValue &argument,
-                                std::uint8_t *byte_ptr) const {}
-
-  /**
-   * @brief Merge two aggregation states for this aggregation handle.
-   *
-   * @note This function should be used with the hash table specifically meant
-   *       for aggregations only.
-   *
-   * @param src A pointer to the source aggregation state.
-   * @param dst A pointer to the destination aggregation state.
-   **/
-  virtual void mergeStatesFast(const std::uint8_t *src,
-                               std::uint8_t *dst) const {}
-
-  /**
-   * @brief Initialize the payload (in the aggregation hash table) for the given
-   *        aggregation handle.
-   *
-   * @param byte_ptr The pointer to the aggregation state in the hash table.
-   **/
-  virtual void initPayload(std::uint8_t *byte_ptr) const {}
-
-  /**
-   * @brief Destroy the payload (in the aggregation hash table) for the given
-   *        aggregation handle.
-   *
-   * @param byte_ptr The pointer to the aggregation state in the hash table.
-   **/
-  virtual void destroyPayload(std::uint8_t *byte_ptr) const {}
-
-  /**
-   * @brief Inform the aggregation handle to block (prohibit) updates on the
-   *        aggregation state.
-   **/
-  virtual void blockUpdate() {}
-
-  /**
-   * @brief Inform the aggregation handle to allow updates on the
-   *        aggregation state.
-   **/
-  virtual void allowUpdate() {}
-
- protected:
-  AggregationHandle() {}
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(AggregationHandle);
-};
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_EXPRESSIONS_AGGREGATION_AGGREGATION_HANDLE_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/aggregation/AggregationHandleAvg.cpp
----------------------------------------------------------------------
diff --git a/expressions/aggregation/AggregationHandleAvg.cpp b/expressions/aggregation/AggregationHandleAvg.cpp
deleted file mode 100644
index 2481092..0000000
--- a/expressions/aggregation/AggregationHandleAvg.cpp
+++ /dev/null
@@ -1,205 +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 "expressions/aggregation/AggregationHandleAvg.hpp"
-
-#include <cstddef>
-#include <memory>
-#include <vector>
-
-#include "catalog/CatalogTypedefs.hpp"
-#include "storage/HashTable.hpp"
-#include "storage/HashTableFactory.hpp"
-#include "threading/SpinMutex.hpp"
-#include "types/Type.hpp"
-#include "types/TypeFactory.hpp"
-#include "types/TypeID.hpp"
-#include "types/TypedValue.hpp"
-#include "types/operations/binary_operations/BinaryOperation.hpp"
-#include "types/operations/binary_operations/BinaryOperationFactory.hpp"
-#include "types/operations/binary_operations/BinaryOperationID.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-class StorageManager;
-
-AggregationHandleAvg::AggregationHandleAvg(const Type &type)
-    : argument_type_(type), block_update_(false) {
-  // We sum Int as Long and Float as Double so that we have more headroom when
-  // adding many values.
-  TypeID type_precision_id;
-  switch (type.getTypeID()) {
-    case kInt:
-    case kLong:
-      type_precision_id = kLong;
-      break;
-    case kFloat:
-    case kDouble:
-      type_precision_id = kDouble;
-      break;
-    default:
-      type_precision_id = type.getTypeID();
-      break;
-  }
-
-  const Type &sum_type = TypeFactory::GetType(type_precision_id);
-  blank_state_.sum_ = sum_type.makeZeroValue();
-  blank_state_.count_ = 0;
-
-  // Make operators to do arithmetic:
-  // Add operator for summing argument values.
-  fast_add_operator_.reset(
-      BinaryOperationFactory::GetBinaryOperation(BinaryOperationID::kAdd)
-          .makeUncheckedBinaryOperatorForTypes(sum_type, argument_type_));
-  // Add operator for merging states.
-  merge_add_operator_.reset(
-      BinaryOperationFactory::GetBinaryOperation(BinaryOperationID::kAdd)
-          .makeUncheckedBinaryOperatorForTypes(sum_type, sum_type));
-  // Divide operator for dividing sum by count to get final average.
-  divide_operator_.reset(
-      BinaryOperationFactory::GetBinaryOperation(BinaryOperationID::kDivide)
-          .makeUncheckedBinaryOperatorForTypes(sum_type,
-                                               TypeFactory::GetType(kDouble)));
-
-  // Result is nullable, because AVG() over 0 values (or all NULL values) is
-  // NULL.
-  result_type_ =
-      &(BinaryOperationFactory::GetBinaryOperation(BinaryOperationID::kDivide)
-            .resultTypeForArgumentTypes(sum_type, TypeFactory::GetType(kDouble))
-            ->getNullableVersion());
-}
-
-AggregationStateHashTableBase* AggregationHandleAvg::createGroupByHashTable(
-    const HashTableImplType hash_table_impl,
-    const std::vector<const Type *> &group_by_types,
-    const std::size_t estimated_num_groups,
-    StorageManager *storage_manager) const {
-  return AggregationStateHashTableFactory<AggregationStateAvg>::CreateResizable(
-      hash_table_impl, group_by_types, estimated_num_groups, storage_manager);
-}
-
-AggregationState* AggregationHandleAvg::accumulateColumnVectors(
-    const std::vector<std::unique_ptr<ColumnVector>> &column_vectors) const {
-  DCHECK_EQ(1u, column_vectors.size())
-      << "Got wrong number of ColumnVectors for AVG: " << column_vectors.size();
-
-  AggregationStateAvg *state = new AggregationStateAvg(blank_state_);
-  std::size_t count = 0;
-  state->sum_ = fast_add_operator_->accumulateColumnVector(
-      state->sum_, *column_vectors.front(), &count);
-  state->count_ = count;
-  return state;
-}
-
-#ifdef QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_SELECTION
-AggregationState* AggregationHandleAvg::accumulateValueAccessor(
-    ValueAccessor *accessor,
-    const std::vector<attribute_id> &accessor_ids) const {
-  DCHECK_EQ(1u, accessor_ids.size())
-      << "Got wrong number of attributes for AVG: " << accessor_ids.size();
-
-  AggregationStateAvg *state = new AggregationStateAvg(blank_state_);
-  std::size_t count = 0;
-  state->sum_ = fast_add_operator_->accumulateValueAccessor(
-      state->sum_, accessor, accessor_ids.front(), &count);
-  state->count_ = count;
-  return state;
-}
-#endif
-
-void AggregationHandleAvg::aggregateValueAccessorIntoHashTable(
-    ValueAccessor *accessor,
-    const std::vector<attribute_id> &argument_ids,
-    const std::vector<attribute_id> &group_by_key_ids,
-    AggregationStateHashTableBase *hash_table) const {
-  DCHECK_EQ(1u, argument_ids.size())
-      << "Got wrong number of arguments for AVG: " << argument_ids.size();
-}
-
-void AggregationHandleAvg::mergeStates(const AggregationState &source,
-                                       AggregationState *destination) const {
-  const AggregationStateAvg &avg_source =
-      static_cast<const AggregationStateAvg &>(source);
-  AggregationStateAvg *avg_destination =
-      static_cast<AggregationStateAvg *>(destination);
-
-  SpinMutexLock lock(avg_destination->mutex_);
-  avg_destination->count_ += avg_source.count_;
-  avg_destination->sum_ = merge_add_operator_->applyToTypedValues(
-      avg_destination->sum_, avg_source.sum_);
-}
-
-void AggregationHandleAvg::mergeStatesFast(const std::uint8_t *source,
-                                           std::uint8_t *destination) const {
-  const TypedValue *src_sum_ptr =
-      reinterpret_cast<const TypedValue *>(source + blank_state_.sum_offset_);
-  const std::int64_t *src_count_ptr = reinterpret_cast<const std::int64_t *>(
-      source + blank_state_.count_offset_);
-  TypedValue *dst_sum_ptr =
-      reinterpret_cast<TypedValue *>(destination + blank_state_.sum_offset_);
-  std::int64_t *dst_count_ptr = reinterpret_cast<std::int64_t *>(
-      destination + blank_state_.count_offset_);
-  (*dst_count_ptr) += (*src_count_ptr);
-  *dst_sum_ptr =
-      merge_add_operator_->applyToTypedValues(*dst_sum_ptr, *src_sum_ptr);
-}
-
-TypedValue AggregationHandleAvg::finalize(const AggregationState &state) const {
-  const AggregationStateAvg &agg_state =
-      static_cast<const AggregationStateAvg &>(state);
-  if (agg_state.count_ == 0) {
-    // AVG() over no values is NULL.
-    return result_type_->makeNullValue();
-  } else {
-    // Divide sum by count to get final average.
-    return divide_operator_->applyToTypedValues(
-        agg_state.sum_, TypedValue(static_cast<double>(agg_state.count_)));
-  }
-}
-
-ColumnVector* AggregationHandleAvg::finalizeHashTable(
-    const AggregationStateHashTableBase &hash_table,
-    std::vector<std::vector<TypedValue>> *group_by_keys,
-    int index) const {
-  return finalizeHashTableHelperFast<AggregationHandleAvg,
-                                     AggregationStateFastHashTable>(
-      *result_type_, hash_table, group_by_keys, index);
-}
-
-AggregationState*
-AggregationHandleAvg::aggregateOnDistinctifyHashTableForSingle(
-    const AggregationStateHashTableBase &distinctify_hash_table) const {
-  return aggregateOnDistinctifyHashTableForSingleUnaryHelperFast<
-      AggregationHandleAvg,
-      AggregationStateAvg>(distinctify_hash_table);
-}
-
-void AggregationHandleAvg::aggregateOnDistinctifyHashTableForGroupBy(
-    const AggregationStateHashTableBase &distinctify_hash_table,
-    AggregationStateHashTableBase *aggregation_hash_table,
-    std::size_t index) const {
-  aggregateOnDistinctifyHashTableForGroupByUnaryHelperFast<
-      AggregationHandleAvg,
-      AggregationStateFastHashTable>(
-      distinctify_hash_table, aggregation_hash_table, index);
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/aggregation/AggregationHandleAvg.hpp
----------------------------------------------------------------------
diff --git a/expressions/aggregation/AggregationHandleAvg.hpp b/expressions/aggregation/AggregationHandleAvg.hpp
deleted file mode 100644
index 47132c6..0000000
--- a/expressions/aggregation/AggregationHandleAvg.hpp
+++ /dev/null
@@ -1,273 +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_EXPRESSIONS_AGGREGATION_AGGREGATION_HANDLE_AVG_HPP_
-#define QUICKSTEP_EXPRESSIONS_AGGREGATION_AGGREGATION_HANDLE_AVG_HPP_
-
-#include <cstddef>
-#include <cstdint>
-#include <memory>
-#include <vector>
-
-#include "catalog/CatalogTypedefs.hpp"
-#include "expressions/aggregation/AggregationConcreteHandle.hpp"
-#include "expressions/aggregation/AggregationHandle.hpp"
-#include "storage/FastHashTable.hpp"
-#include "storage/HashTableBase.hpp"
-#include "threading/SpinMutex.hpp"
-#include "types/Type.hpp"
-#include "types/TypedValue.hpp"
-#include "types/operations/binary_operations/BinaryOperation.hpp"
-#include "utility/Macros.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-class ColumnVector;
-class StorageManager;
-class ValueAccessor;
-
-/** \addtogroup Expressions
- *  @{
- */
-
-/**
- * @brief Aggregation state for average.
- */
-class AggregationStateAvg : public AggregationState {
- public:
-  /**
-   * @brief Copy constructor (ignores mutex).
-   */
-  AggregationStateAvg(const AggregationStateAvg &orig)
-      : sum_(orig.sum_),
-        count_(orig.count_),
-        sum_offset_(orig.sum_offset_),
-        count_offset_(orig.count_offset_),
-        mutex_offset_(orig.mutex_offset_) {}
-
-  /**
-   * @brief Destructor.
-   */
-  ~AggregationStateAvg() override {}
-
-  std::size_t getPayloadSize() const {
-    std::size_t p1 = reinterpret_cast<std::size_t>(&sum_);
-    std::size_t p2 = reinterpret_cast<std::size_t>(&mutex_);
-    return (p2 - p1);
-  }
-
-  const std::uint8_t *getPayloadAddress() const {
-    return reinterpret_cast<const uint8_t *>(&sum_);
-  }
-
- private:
-  friend class AggregationHandleAvg;
-
-  AggregationStateAvg()
-      : sum_(0),
-        count_(0),
-        sum_offset_(0),
-        count_offset_(reinterpret_cast<std::uint8_t *>(&count_) -
-                      reinterpret_cast<std::uint8_t *>(&sum_)),
-        mutex_offset_(reinterpret_cast<std::uint8_t *>(&mutex_) -
-                      reinterpret_cast<std::uint8_t *>(&sum_)) {}
-
-  // TODO(shoban): We might want to specialize sum_ and count_ to use atomics
-  // for int types similar to in AggregationStateCount.
-  TypedValue sum_;
-  std::int64_t count_;
-  SpinMutex mutex_;
-
-  int sum_offset_, count_offset_, mutex_offset_;
-};
-
-/**
- * @brief An aggregationhandle for avg.
- **/
-class AggregationHandleAvg : public AggregationConcreteHandle {
- public:
-  ~AggregationHandleAvg() override {}
-
-  AggregationState* createInitialState() const override {
-    return new AggregationStateAvg(blank_state_);
-  }
-
-  AggregationStateHashTableBase* createGroupByHashTable(
-      const HashTableImplType hash_table_impl,
-      const std::vector<const Type *> &group_by_types,
-      const std::size_t estimated_num_groups,
-      StorageManager *storage_manager) const override;
-
-  /**
-   * @brief Iterate method with average aggregation state.
-   **/
-  inline void iterateUnaryInl(AggregationStateAvg *state,
-                              const TypedValue &value) const {
-    DCHECK(value.isPlausibleInstanceOf(argument_type_.getSignature()));
-    if (value.isNull()) return;
-
-    SpinMutexLock lock(state->mutex_);
-    state->sum_ = fast_add_operator_->applyToTypedValues(state->sum_, value);
-    ++state->count_;
-  }
-
-  inline void iterateUnaryInlFast(const TypedValue &value,
-                                  std::uint8_t *byte_ptr) const {
-    DCHECK(value.isPlausibleInstanceOf(argument_type_.getSignature()));
-    if (value.isNull()) return;
-    TypedValue *sum_ptr =
-        reinterpret_cast<TypedValue *>(byte_ptr + blank_state_.sum_offset_);
-    std::int64_t *count_ptr =
-        reinterpret_cast<std::int64_t *>(byte_ptr + blank_state_.count_offset_);
-    *sum_ptr = fast_add_operator_->applyToTypedValues(*sum_ptr, value);
-    ++(*count_ptr);
-  }
-
-  inline void updateStateUnary(const TypedValue &argument,
-                               std::uint8_t *byte_ptr) const override {
-    if (!block_update_) {
-      iterateUnaryInlFast(argument, byte_ptr);
-    }
-  }
-
-  void blockUpdate() override { block_update_ = true; }
-
-  void allowUpdate() override { block_update_ = false; }
-
-  void initPayload(std::uint8_t *byte_ptr) const override {
-    TypedValue *sum_ptr =
-        reinterpret_cast<TypedValue *>(byte_ptr + blank_state_.sum_offset_);
-    std::int64_t *count_ptr =
-        reinterpret_cast<std::int64_t *>(byte_ptr + blank_state_.count_offset_);
-    *sum_ptr = blank_state_.sum_;
-    *count_ptr = blank_state_.count_;
-  }
-
-  void destroyPayload(std::uint8_t *byte_ptr) const override {
-    TypedValue *sum_ptr =
-        reinterpret_cast<TypedValue *>(byte_ptr + blank_state_.sum_offset_);
-    if (sum_ptr != nullptr) {
-      sum_ptr->~TypedValue();
-    }
-  }
-
-  AggregationState* accumulateColumnVectors(
-      const std::vector<std::unique_ptr<ColumnVector>> &column_vectors)
-      const override;
-
-#ifdef QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_SELECTION
-  AggregationState* accumulateValueAccessor(
-      ValueAccessor *accessor,
-      const std::vector<attribute_id> &accessor_id) const override;
-#endif
-
-  void aggregateValueAccessorIntoHashTable(
-      ValueAccessor *accessor,
-      const std::vector<attribute_id> &argument_ids,
-      const std::vector<attribute_id> &group_by_key_ids,
-      AggregationStateHashTableBase *hash_table) const override;
-
-  void mergeStates(const AggregationState &source,
-                   AggregationState *destination) const override;
-
-  void mergeStatesFast(const std::uint8_t *source,
-                       std::uint8_t *destination) const override;
-
-  TypedValue finalize(const AggregationState &state) const override;
-
-  inline TypedValue finalizeHashTableEntry(
-      const AggregationState &state) const {
-    const AggregationStateAvg &agg_state =
-        static_cast<const AggregationStateAvg &>(state);
-    // TODO(chasseur): Could improve performance further if we made a special
-    // version of finalizeHashTable() that collects all the sums into one
-    // ColumnVector and all the counts into another and then applies
-    // '*divide_operator_' to them in bulk.
-    return divide_operator_->applyToTypedValues(
-        agg_state.sum_, TypedValue(static_cast<double>(agg_state.count_)));
-  }
-
-  inline TypedValue finalizeHashTableEntryFast(
-      const std::uint8_t *byte_ptr) const {
-    std::uint8_t *value_ptr = const_cast<std::uint8_t *>(byte_ptr);
-    TypedValue *sum_ptr =
-        reinterpret_cast<TypedValue *>(value_ptr + blank_state_.sum_offset_);
-    std::int64_t *count_ptr = reinterpret_cast<std::int64_t *>(
-        value_ptr + blank_state_.count_offset_);
-    return divide_operator_->applyToTypedValues(
-        *sum_ptr, TypedValue(static_cast<double>(*count_ptr)));
-  }
-
-  ColumnVector* finalizeHashTable(
-      const AggregationStateHashTableBase &hash_table,
-      std::vector<std::vector<TypedValue>> *group_by_keys,
-      int index) const override;
-
-  /**
-   * @brief Implementation of
-   *        AggregationHandle::aggregateOnDistinctifyHashTableForSingle()
-   *        for AVG aggregation.
-   */
-  AggregationState* aggregateOnDistinctifyHashTableForSingle(
-      const AggregationStateHashTableBase &distinctify_hash_table)
-      const override;
-
-  /**
-   * @brief Implementation of
-   *        AggregationHandle::aggregateOnDistinctifyHashTableForGroupBy()
-   *        for AVG aggregation.
-   */
-  void aggregateOnDistinctifyHashTableForGroupBy(
-      const AggregationStateHashTableBase &distinctify_hash_table,
-      AggregationStateHashTableBase *aggregation_hash_table,
-      std::size_t index) const override;
-
-  std::size_t getPayloadSize() const override {
-    return blank_state_.getPayloadSize();
-  }
-
- private:
-  friend class AggregateFunctionAvg;
-
-  /**
-   * @brief Constructor.
-   *
-   * @param type Type of the avg value.
-   **/
-  explicit AggregationHandleAvg(const Type &type);
-
-  const Type &argument_type_;
-  const Type *result_type_;
-  AggregationStateAvg blank_state_;
-  std::unique_ptr<UncheckedBinaryOperator> fast_add_operator_;
-  std::unique_ptr<UncheckedBinaryOperator> merge_add_operator_;
-  std::unique_ptr<UncheckedBinaryOperator> divide_operator_;
-
-  bool block_update_;
-
-  DISALLOW_COPY_AND_ASSIGN(AggregationHandleAvg);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_EXPRESSIONS_AGGREGATION_AGGREGATION_HANDLE_AVG_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/aggregation/AggregationHandleCount.cpp
----------------------------------------------------------------------
diff --git a/expressions/aggregation/AggregationHandleCount.cpp b/expressions/aggregation/AggregationHandleCount.cpp
deleted file mode 100644
index 034c942..0000000
--- a/expressions/aggregation/AggregationHandleCount.cpp
+++ /dev/null
@@ -1,210 +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 "expressions/aggregation/AggregationHandleCount.hpp"
-
-#include <atomic>
-#include <cstddef>
-#include <memory>
-#include <vector>
-
-#include "catalog/CatalogTypedefs.hpp"
-#include "storage/HashTable.hpp"
-#include "storage/HashTableFactory.hpp"
-
-#ifdef QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_SELECTION
-#include "storage/ValueAccessor.hpp"
-#include "storage/ValueAccessorUtil.hpp"
-#endif
-
-#include "types/TypeFactory.hpp"
-#include "types/TypeID.hpp"
-#include "types/TypedValue.hpp"
-#include "types/containers/ColumnVector.hpp"
-#include "types/containers/ColumnVectorUtil.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-class StorageManager;
-class Type;
-class ValueAccessor;
-
-template <bool count_star, bool nullable_type>
-AggregationStateHashTableBase*
-AggregationHandleCount<count_star, nullable_type>::createGroupByHashTable(
-    const HashTableImplType hash_table_impl,
-    const std::vector<const Type *> &group_by_types,
-    const std::size_t estimated_num_groups,
-    StorageManager *storage_manager) const {
-  return AggregationStateHashTableFactory<
-      AggregationStateCount>::CreateResizable(hash_table_impl,
-                                              group_by_types,
-                                              estimated_num_groups,
-                                              storage_manager);
-}
-
-template <bool count_star, bool nullable_type>
-AggregationState*
-AggregationHandleCount<count_star, nullable_type>::accumulateColumnVectors(
-    const std::vector<std::unique_ptr<ColumnVector>> &column_vectors) const {
-  DCHECK(!count_star)
-      << "Called non-nullary accumulation method on an AggregationHandleCount "
-      << "set up for nullary COUNT(*)";
-
-  DCHECK_EQ(1u, column_vectors.size())
-      << "Got wrong number of ColumnVectors for COUNT: "
-      << column_vectors.size();
-
-  std::size_t count = 0;
-  InvokeOnColumnVector(
-      *column_vectors.front(),
-      [&](const auto &column_vector) -> void {  // NOLINT(build/c++11)
-        if (nullable_type) {
-          // TODO(shoban): Iterating over the ColumnVector is a rather slow way
-          // to do this. We should look at extending the ColumnVector interface
-          // to do a quick count of the non-null values (i.e. the length minus
-          // the population count of the null bitmap). We should do something
-          // similar for ValueAccessor too.
-          for (std::size_t pos = 0; pos < column_vector.size(); ++pos) {
-            count += !column_vector.getTypedValue(pos).isNull();
-          }
-        } else {
-          count = column_vector.size();
-        }
-      });
-
-  return new AggregationStateCount(count);
-}
-
-#ifdef QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_SELECTION
-template <bool count_star, bool nullable_type>
-AggregationState*
-AggregationHandleCount<count_star, nullable_type>::accumulateValueAccessor(
-    ValueAccessor *accessor,
-    const std::vector<attribute_id> &accessor_ids) const {
-  DCHECK(!count_star)
-      << "Called non-nullary accumulation method on an AggregationHandleCount "
-      << "set up for nullary COUNT(*)";
-
-  DCHECK_EQ(1u, accessor_ids.size())
-      << "Got wrong number of attributes for COUNT: " << accessor_ids.size();
-
-  const attribute_id accessor_id = accessor_ids.front();
-  std::size_t count = 0;
-  InvokeOnValueAccessorMaybeTupleIdSequenceAdapter(
-      accessor,
-      [&accessor_id, &count](auto *accessor) -> void {  // NOLINT(build/c++11)
-        if (nullable_type) {
-          while (accessor->next()) {
-            count += !accessor->getTypedValue(accessor_id).isNull();
-          }
-        } else {
-          count = accessor->getNumTuples();
-        }
-      });
-
-  return new AggregationStateCount(count);
-}
-#endif
-
-template <bool count_star, bool nullable_type>
-void AggregationHandleCount<count_star, nullable_type>::
-    aggregateValueAccessorIntoHashTable(
-        ValueAccessor *accessor,
-        const std::vector<attribute_id> &argument_ids,
-        const std::vector<attribute_id> &group_by_key_ids,
-        AggregationStateHashTableBase *hash_table) const {
-  if (count_star) {
-    DCHECK_EQ(0u, argument_ids.size())
-        << "Got wrong number of arguments for COUNT(*): "
-        << argument_ids.size();
-  } else {
-    DCHECK_EQ(1u, argument_ids.size())
-        << "Got wrong number of arguments for COUNT: " << argument_ids.size();
-  }
-}
-
-template <bool count_star, bool nullable_type>
-void AggregationHandleCount<count_star, nullable_type>::mergeStates(
-    const AggregationState &source, AggregationState *destination) const {
-  const AggregationStateCount &count_source =
-      static_cast<const AggregationStateCount &>(source);
-  AggregationStateCount *count_destination =
-      static_cast<AggregationStateCount *>(destination);
-
-  count_destination->count_.fetch_add(
-      count_source.count_.load(std::memory_order_relaxed),
-      std::memory_order_relaxed);
-}
-
-template <bool count_star, bool nullable_type>
-void AggregationHandleCount<count_star, nullable_type>::mergeStatesFast(
-    const std::uint8_t *source, std::uint8_t *destination) const {
-  const std::int64_t *src_count_ptr =
-      reinterpret_cast<const std::int64_t *>(source);
-  std::int64_t *dst_count_ptr = reinterpret_cast<std::int64_t *>(destination);
-  (*dst_count_ptr) += (*src_count_ptr);
-}
-
-template <bool count_star, bool nullable_type>
-ColumnVector*
-AggregationHandleCount<count_star, nullable_type>::finalizeHashTable(
-    const AggregationStateHashTableBase &hash_table,
-    std::vector<std::vector<TypedValue>> *group_by_keys,
-    int index) const {
-  return finalizeHashTableHelperFast<
-      AggregationHandleCount<count_star, nullable_type>,
-      AggregationStateFastHashTable>(
-      TypeFactory::GetType(kLong), hash_table, group_by_keys, index);
-}
-
-template <bool count_star, bool nullable_type>
-AggregationState* AggregationHandleCount<count_star, nullable_type>::
-    aggregateOnDistinctifyHashTableForSingle(
-        const AggregationStateHashTableBase &distinctify_hash_table) const {
-  DCHECK_EQ(count_star, false);
-  return aggregateOnDistinctifyHashTableForSingleUnaryHelperFast<
-      AggregationHandleCount<count_star, nullable_type>,
-      AggregationStateCount>(distinctify_hash_table);
-}
-
-template <bool count_star, bool nullable_type>
-void AggregationHandleCount<count_star, nullable_type>::
-    aggregateOnDistinctifyHashTableForGroupBy(
-        const AggregationStateHashTableBase &distinctify_hash_table,
-        AggregationStateHashTableBase *aggregation_hash_table,
-        std::size_t index) const {
-  DCHECK_EQ(count_star, false);
-  aggregateOnDistinctifyHashTableForGroupByUnaryHelperFast<
-      AggregationHandleCount<count_star, nullable_type>,
-      AggregationStateFastHashTable>(
-      distinctify_hash_table, aggregation_hash_table, index);
-}
-
-// Explicitly instantiate and compile in the different versions of
-// AggregationHandleCount we need. Note that we do not compile a version with
-// 'count_star == true' and 'nullable_type == true', as that combination is
-// semantically impossible.
-template class AggregationHandleCount<false, false>;
-template class AggregationHandleCount<false, true>;
-template class AggregationHandleCount<true, false>;
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/aggregation/AggregationHandleCount.hpp
----------------------------------------------------------------------
diff --git a/expressions/aggregation/AggregationHandleCount.hpp b/expressions/aggregation/AggregationHandleCount.hpp
deleted file mode 100644
index 6aab0cd..0000000
--- a/expressions/aggregation/AggregationHandleCount.hpp
+++ /dev/null
@@ -1,250 +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_EXPRESSIONS_AGGREGATION_AGGREGATION_HANDLE_COUNT_HPP_
-#define QUICKSTEP_EXPRESSIONS_AGGREGATION_AGGREGATION_HANDLE_COUNT_HPP_
-
-#include <atomic>
-#include <cstddef>
-#include <cstdint>
-#include <memory>
-#include <vector>
-
-#include "catalog/CatalogTypedefs.hpp"
-#include "expressions/aggregation/AggregationConcreteHandle.hpp"
-#include "expressions/aggregation/AggregationHandle.hpp"
-#include "storage/FastHashTable.hpp"
-#include "storage/HashTableBase.hpp"
-#include "types/TypedValue.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-
-class ColumnVector;
-class StorageManager;
-class Type;
-class ValueAccessor;
-
-template <bool, bool>
-class AggregationHandleCount;
-
-/** \addtogroup Expressions
- *  @{
- */
-
-/**
- * @brief Aggregation state of count.
- */
-class AggregationStateCount : public AggregationState {
- public:
-  /**
-   * @brief Copy constructor.
-   */
-  AggregationStateCount(const AggregationStateCount &state)
-      : count_(state.count_.load(std::memory_order_relaxed)) {}
-
-  /**
-   * @brief Destructor.
-   */
-  ~AggregationStateCount() override {}
-
-  std::size_t getPayloadSize() const { return sizeof(count_); }
-
-  const std::uint8_t* getPayloadAddress() const {
-    return reinterpret_cast<const uint8_t *>(&count_);
-  }
-
- private:
-  friend class AggregationHandleCount<false, false>;
-  friend class AggregationHandleCount<false, true>;
-  friend class AggregationHandleCount<true, false>;
-  friend class AggregationHandleCount<true, true>;
-
-  AggregationStateCount() : count_(0) {}
-
-  explicit AggregationStateCount(const std::int64_t initial_count)
-      : count_(initial_count) {}
-
-  std::atomic<std::int64_t> count_;
-};
-
-/**
- * @brief An aggregationhandle for count.
- *
- * @param count_star If true, this AggregationHandleCount is for nullary
- *        COUNT(*). If false, it is a COUNT over some scalar expression.
- * @param nullable_type If true, the argument to COUNT() is nullable, and NULL
- *        values should not be included in the count. If false, the argument is
- *        not nullable and NULL-checks can safely be skipped.
- **/
-template <bool count_star, bool nullable_type>
-class AggregationHandleCount : public AggregationConcreteHandle {
- public:
-  ~AggregationHandleCount() override {}
-
-  AggregationState* createInitialState() const override {
-    return new AggregationStateCount();
-  }
-
-  AggregationStateHashTableBase* createGroupByHashTable(
-      const HashTableImplType hash_table_impl,
-      const std::vector<const Type *> &group_by_types,
-      const std::size_t estimated_num_groups,
-      StorageManager *storage_manager) const override;
-
-  inline void iterateNullaryInl(AggregationStateCount *state) const {
-    state->count_.fetch_add(1, std::memory_order_relaxed);
-  }
-
-  inline void iterateNullaryInlFast(std::uint8_t *byte_ptr) const {
-    std::int64_t *count_ptr = reinterpret_cast<std::int64_t *>(byte_ptr);
-    (*count_ptr)++;
-  }
-
-  /**
-   * @brief Iterate with count aggregation state.
-   */
-  inline void iterateUnaryInl(AggregationStateCount *state,
-                              const TypedValue &value) const {
-    if ((!nullable_type) || (!value.isNull())) {
-      state->count_.fetch_add(1, std::memory_order_relaxed);
-    }
-  }
-
-  inline void iterateUnaryInlFast(const TypedValue &value,
-                                  std::uint8_t *byte_ptr) const {
-    if ((!nullable_type) || (!value.isNull())) {
-      std::int64_t *count_ptr = reinterpret_cast<std::int64_t *>(byte_ptr);
-      (*count_ptr)++;
-    }
-  }
-
-  inline void updateStateUnary(const TypedValue &argument,
-                               std::uint8_t *byte_ptr) const override {
-    if (!block_update_) {
-      iterateUnaryInlFast(argument, byte_ptr);
-    }
-  }
-
-  inline void updateStateNullary(std::uint8_t *byte_ptr) const override {
-    if (!block_update_) {
-      iterateNullaryInlFast(byte_ptr);
-    }
-  }
-
-  void blockUpdate() override { block_update_ = true; }
-
-  void allowUpdate() override { block_update_ = false; }
-
-  void initPayload(std::uint8_t *byte_ptr) const override {
-    std::int64_t *count_ptr = reinterpret_cast<std::int64_t *>(byte_ptr);
-    *count_ptr = 0;
-  }
-
-  AggregationState* accumulateNullary(
-      const std::size_t num_tuples) const override {
-    return new AggregationStateCount(num_tuples);
-  }
-
-  AggregationState* accumulateColumnVectors(
-      const std::vector<std::unique_ptr<ColumnVector>> &column_vectors)
-      const override;
-
-#ifdef QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_SELECTION
-  AggregationState* accumulateValueAccessor(
-      ValueAccessor *accessor,
-      const std::vector<attribute_id> &accessor_id) const override;
-#endif
-
-  void aggregateValueAccessorIntoHashTable(
-      ValueAccessor *accessor,
-      const std::vector<attribute_id> &argument_ids,
-      const std::vector<attribute_id> &group_by_key_ids,
-      AggregationStateHashTableBase *hash_table) const override;
-
-  void mergeStates(const AggregationState &source,
-                   AggregationState *destination) const override;
-
-  void mergeStatesFast(const std::uint8_t *source,
-                       std::uint8_t *destination) const override;
-
-  TypedValue finalize(const AggregationState &state) const override {
-    return TypedValue(
-        static_cast<const AggregationStateCount &>(state).count_.load(
-            std::memory_order_relaxed));
-  }
-
-  inline TypedValue finalizeHashTableEntry(
-      const AggregationState &state) const {
-    return TypedValue(
-        static_cast<const AggregationStateCount &>(state).count_.load(
-            std::memory_order_relaxed));
-  }
-
-  inline TypedValue finalizeHashTableEntryFast(
-      const std::uint8_t *byte_ptr) const {
-    const std::int64_t *count_ptr =
-        reinterpret_cast<const std::int64_t *>(byte_ptr);
-    return TypedValue(*count_ptr);
-  }
-
-  ColumnVector* finalizeHashTable(
-      const AggregationStateHashTableBase &hash_table,
-      std::vector<std::vector<TypedValue>> *group_by_keys,
-      int index) const override;
-
-  /**
-   * @brief Implementation of
-   *        AggregationHandle::aggregateOnDistinctifyHashTableForSingle()
-   *        for SUM aggregation.
-   */
-  AggregationState* aggregateOnDistinctifyHashTableForSingle(
-      const AggregationStateHashTableBase &distinctify_hash_table)
-      const override;
-
-  /**
-   * @brief Implementation of
-   *        AggregationHandle::aggregateOnDistinctifyHashTableForGroupBy()
-   *        for SUM aggregation.
-   */
-  void aggregateOnDistinctifyHashTableForGroupBy(
-      const AggregationStateHashTableBase &distinctify_hash_table,
-      AggregationStateHashTableBase *aggregation_hash_table,
-      std::size_t index) const override;
-
-  std::size_t getPayloadSize() const override { return sizeof(std::int64_t); }
-
- private:
-  friend class AggregateFunctionCount;
-
-  /**
-   * @brief Constructor.
-   **/
-  AggregationHandleCount() : block_update_(false) {}
-
-  bool block_update_;
-
-  DISALLOW_COPY_AND_ASSIGN(AggregationHandleCount);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_EXPRESSIONS_AGGREGATION_AGGREGATION_HANDLE_COUNT__

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/aggregation/AggregationHandleDistinct.cpp
----------------------------------------------------------------------
diff --git a/expressions/aggregation/AggregationHandleDistinct.cpp b/expressions/aggregation/AggregationHandleDistinct.cpp
deleted file mode 100644
index 0dc8b56..0000000
--- a/expressions/aggregation/AggregationHandleDistinct.cpp
+++ /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.
- **/
-
-#include "expressions/aggregation/AggregationHandleDistinct.hpp"
-
-#include <cstddef>
-#include <memory>
-#include <vector>
-#include <utility>
-
-#include "catalog/CatalogTypedefs.hpp"
-#include "storage/HashTable.hpp"
-
-#include "types/TypedValue.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-class ColumnVector;
-class StorageManager;
-class Type;
-class ValueAccessor;
-
-AggregationStateHashTableBase* AggregationHandleDistinct::createGroupByHashTable(
-    const HashTableImplType hash_table_impl,
-    const std::vector<const Type*> &group_by_types,
-    const std::size_t estimated_num_groups,
-    StorageManager *storage_manager) const {
-  return createDistinctifyHashTable(
-      hash_table_impl,
-      group_by_types,
-      estimated_num_groups,
-      storage_manager);
-}
-
-void AggregationHandleDistinct::aggregateValueAccessorIntoHashTable(
-    ValueAccessor *accessor,
-    const std::vector<attribute_id> &argument_ids,
-    const std::vector<attribute_id> &group_by_key_ids,
-    AggregationStateHashTableBase *hash_table) const {
-  DCHECK_EQ(argument_ids.size(), 0u);
-
-  insertValueAccessorIntoDistinctifyHashTable(
-      accessor,
-      group_by_key_ids,
-      hash_table);
-}
-
-ColumnVector* AggregationHandleDistinct::finalizeHashTable(
-    const AggregationStateHashTableBase &hash_table,
-    std::vector<std::vector<TypedValue>> *group_by_keys,
-    int index) const {
-  DCHECK(group_by_keys->empty());
-
-  const auto keys_retriever = [&group_by_keys](std::vector<TypedValue> &group_by_key,
-                                               const bool &dumb_placeholder) -> void {
-    group_by_keys->emplace_back(std::move(group_by_key));
-  };
-  static_cast<const AggregationStateFastHashTable&>(hash_table).forEachCompositeKeyFast(&keys_retriever);
-
-  return nullptr;
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/aggregation/AggregationHandleDistinct.hpp
----------------------------------------------------------------------
diff --git a/expressions/aggregation/AggregationHandleDistinct.hpp b/expressions/aggregation/AggregationHandleDistinct.hpp
deleted file mode 100644
index 838bfdd..0000000
--- a/expressions/aggregation/AggregationHandleDistinct.hpp
+++ /dev/null
@@ -1,130 +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_EXPRESSIONS_AGGREGATION_AGGREGATION_HANDLE_DISTINCT_HPP_
-#define QUICKSTEP_EXPRESSIONS_AGGREGATION_AGGREGATION_HANDLE_DISTINCT_HPP_
-
-#include <cstddef>
-#include <memory>
-#include <vector>
-
-#include "catalog/CatalogTypedefs.hpp"
-#include "expressions/aggregation/AggregationConcreteHandle.hpp"
-#include "storage/HashTableBase.hpp"
-#include "types/TypedValue.hpp"
-#include "utility/Macros.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-class AggregationState;
-class ColumnVector;
-class StorageManager;
-class Type;
-class ValueAccessor;
-
-/** \addtogroup Expressions
- *  @{
- */
-
-class AggregationHandleDistinct : public AggregationConcreteHandle {
- public:
-  /**
-   * @brief Constructor.
-   **/
-  AggregationHandleDistinct() {}
-
-  AggregationState* createInitialState() const override {
-    LOG(FATAL)
-        << "AggregationHandleDistinct does not support createInitialState().";
-  }
-
-  AggregationState* accumulateNullary(
-      const std::size_t num_tuples) const override {
-    LOG(FATAL)
-        << "AggregationHandleDistinct does not support accumulateNullary().";
-  }
-
-  AggregationState* accumulateColumnVectors(
-      const std::vector<std::unique_ptr<ColumnVector>> &column_vectors)
-      const override {
-    LOG(FATAL) << "AggregationHandleDistinct does not support "
-                  "accumulateColumnVectors().";
-  }
-
-#ifdef QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_SELECTION
-  AggregationState* accumulateValueAccessor(
-      ValueAccessor *accessor,
-      const std::vector<attribute_id> &accessor_ids) const override {
-    LOG(FATAL) << "AggregationHandleDistinct does not support "
-                  "accumulateValueAccessor().";
-  }
-#endif
-
-  void mergeStates(const AggregationState &source,
-                   AggregationState *destination) const override {
-    LOG(FATAL) << "AggregationHandleDistinct does not support mergeStates().";
-  }
-
-  TypedValue finalize(const AggregationState &state) const override {
-    LOG(FATAL) << "AggregationHandleDistinct does not support finalize().";
-  }
-
-  AggregationState* aggregateOnDistinctifyHashTableForSingle(
-      const AggregationStateHashTableBase &distinctify_hash_table)
-      const override {
-    LOG(FATAL) << "AggregationHandleDistinct does not support "
-               << "aggregateOnDistinctifyHashTableForSingle().";
-  }
-
-  void aggregateOnDistinctifyHashTableForGroupBy(
-      const AggregationStateHashTableBase &distinctify_hash_table,
-      AggregationStateHashTableBase *groupby_hash_table,
-      std::size_t index) const override {
-    LOG(FATAL) << "AggregationHandleDistinct does not support "
-               << "aggregateOnDistinctifyHashTableForGroupBy().";
-  }
-
-  AggregationStateHashTableBase* createGroupByHashTable(
-      const HashTableImplType hash_table_impl,
-      const std::vector<const Type *> &group_by_types,
-      const std::size_t estimated_num_groups,
-      StorageManager *storage_manager) const override;
-
-  void aggregateValueAccessorIntoHashTable(
-      ValueAccessor *accessor,
-      const std::vector<attribute_id> &argument_ids,
-      const std::vector<attribute_id> &group_by_key_ids,
-      AggregationStateHashTableBase *hash_table) const override;
-
-  ColumnVector* finalizeHashTable(
-      const AggregationStateHashTableBase &hash_table,
-      std::vector<std::vector<TypedValue>> *group_by_keys,
-      int index) const override;
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(AggregationHandleDistinct);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_EXPRESSIONS_AGGREGATION_AGGREGATION_HANDLE_DISTINCT_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/aggregation/AggregationHandleMax.cpp
----------------------------------------------------------------------
diff --git a/expressions/aggregation/AggregationHandleMax.cpp b/expressions/aggregation/AggregationHandleMax.cpp
deleted file mode 100644
index c2d571b..0000000
--- a/expressions/aggregation/AggregationHandleMax.cpp
+++ /dev/null
@@ -1,137 +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 "expressions/aggregation/AggregationHandleMax.hpp"
-
-#include <memory>
-#include <vector>
-
-#include "catalog/CatalogTypedefs.hpp"
-#include "storage/HashTable.hpp"
-#include "storage/HashTableFactory.hpp"
-#include "types/Type.hpp"
-#include "types/TypedValue.hpp"
-#include "types/containers/ColumnVector.hpp"
-#include "types/operations/comparisons/Comparison.hpp"
-#include "types/operations/comparisons/ComparisonFactory.hpp"
-#include "types/operations/comparisons/ComparisonID.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-class StorageManager;
-
-AggregationHandleMax::AggregationHandleMax(const Type &type)
-    : type_(type), block_update_(false) {
-  fast_comparator_.reset(
-      ComparisonFactory::GetComparison(ComparisonID::kGreater)
-          .makeUncheckedComparatorForTypes(type, type.getNonNullableVersion()));
-}
-
-AggregationStateHashTableBase* AggregationHandleMax::createGroupByHashTable(
-    const HashTableImplType hash_table_impl,
-    const std::vector<const Type *> &group_by_types,
-    const std::size_t estimated_num_groups,
-    StorageManager *storage_manager) const {
-  return AggregationStateHashTableFactory<AggregationStateMax>::CreateResizable(
-      hash_table_impl, group_by_types, estimated_num_groups, storage_manager);
-}
-
-AggregationState* AggregationHandleMax::accumulateColumnVectors(
-    const std::vector<std::unique_ptr<ColumnVector>> &column_vectors) const {
-  DCHECK_EQ(1u, column_vectors.size())
-      << "Got wrong number of ColumnVectors for MAX: " << column_vectors.size();
-
-  return new AggregationStateMax(fast_comparator_->accumulateColumnVector(
-      type_.getNullableVersion().makeNullValue(), *column_vectors.front()));
-}
-
-#ifdef QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_SELECTION
-AggregationState* AggregationHandleMax::accumulateValueAccessor(
-    ValueAccessor *accessor,
-    const std::vector<attribute_id> &accessor_ids) const {
-  DCHECK_EQ(1u, accessor_ids.size())
-      << "Got wrong number of attributes for MAX: " << accessor_ids.size();
-
-  return new AggregationStateMax(fast_comparator_->accumulateValueAccessor(
-      type_.getNullableVersion().makeNullValue(),
-      accessor,
-      accessor_ids.front()));
-}
-#endif  // QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_SELECTION
-
-void AggregationHandleMax::aggregateValueAccessorIntoHashTable(
-    ValueAccessor *accessor,
-    const std::vector<attribute_id> &argument_ids,
-    const std::vector<attribute_id> &group_by_key_ids,
-    AggregationStateHashTableBase *hash_table) const {
-  DCHECK_EQ(1u, argument_ids.size())
-      << "Got wrong number of arguments for MAX: " << argument_ids.size();
-}
-
-void AggregationHandleMax::mergeStates(const AggregationState &source,
-                                       AggregationState *destination) const {
-  const AggregationStateMax &max_source =
-      static_cast<const AggregationStateMax &>(source);
-  AggregationStateMax *max_destination =
-      static_cast<AggregationStateMax *>(destination);
-
-  if (!max_source.max_.isNull()) {
-    compareAndUpdate(max_destination, max_source.max_);
-  }
-}
-
-void AggregationHandleMax::mergeStatesFast(const std::uint8_t *source,
-                                           std::uint8_t *destination) const {
-  const TypedValue *src_max_ptr = reinterpret_cast<const TypedValue *>(source);
-  TypedValue *dst_max_ptr = reinterpret_cast<TypedValue *>(destination);
-  if (!(src_max_ptr->isNull())) {
-    compareAndUpdateFast(dst_max_ptr, *src_max_ptr);
-  }
-}
-
-ColumnVector* AggregationHandleMax::finalizeHashTable(
-    const AggregationStateHashTableBase &hash_table,
-    std::vector<std::vector<TypedValue>> *group_by_keys,
-    int index) const {
-  return finalizeHashTableHelperFast<AggregationHandleMax,
-                                     AggregationStateFastHashTable>(
-      type_.getNullableVersion(), hash_table, group_by_keys, index);
-}
-
-AggregationState*
-AggregationHandleMax::aggregateOnDistinctifyHashTableForSingle(
-    const AggregationStateHashTableBase &distinctify_hash_table) const {
-  return aggregateOnDistinctifyHashTableForSingleUnaryHelperFast<
-      AggregationHandleMax,
-      AggregationStateMax>(distinctify_hash_table);
-}
-
-void AggregationHandleMax::aggregateOnDistinctifyHashTableForGroupBy(
-    const AggregationStateHashTableBase &distinctify_hash_table,
-    AggregationStateHashTableBase *aggregation_hash_table,
-    std::size_t index) const {
-  aggregateOnDistinctifyHashTableForGroupByUnaryHelperFast<
-      AggregationHandleMax,
-      AggregationStateFastHashTable>(
-      distinctify_hash_table, aggregation_hash_table, index);
-}
-
-}  // namespace quickstep


[05/51] [abbrv] [partial] incubator-quickstep git commit: remove c++ files

Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/physical/InsertSelection.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/physical/InsertSelection.hpp b/query_optimizer/physical/InsertSelection.hpp
deleted file mode 100644
index 4e22a6e..0000000
--- a/query_optimizer/physical/InsertSelection.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_PHYSICAL_INSERT_SELECTION_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_PHYSICAL_INSERT_SELECTION_HPP_
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "query_optimizer/expressions/ExpressionUtil.hpp"
-#include "query_optimizer/physical/Physical.hpp"
-#include "query_optimizer/physical/PhysicalType.hpp"
-#include "utility/Macros.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-namespace optimizer {
-namespace physical {
-
-/** \addtogroup OptimizerPhysical
- *  @{
- */
-
-class InsertSelection;
-typedef std::shared_ptr<const InsertSelection> InsertSelectionPtr;
-
-/**
- * @brief Inserts the results from a SELECT query into a relation.
- */
-class InsertSelection : public Physical {
- public:
-  PhysicalType getPhysicalType() const override {
-    return PhysicalType::kInsertSelection;
-  }
-
-  std::string getName() const override { return "InsertSelection"; }
-
-  /**
-   * @return The destination relation to insert the selection to.
-   */
-  const PhysicalPtr& destination() const { return destination_; }
-
-  /**
-   * @return The selection to be inserted.
-   */
-  const PhysicalPtr& selection() const { return selection_; }
-
-  PhysicalPtr copyWithNewChildren(
-      const std::vector<PhysicalPtr> &new_children) const override {
-    DCHECK_EQ(getNumChildren(), new_children.size());
-    return Create(new_children[0], new_children[1]);
-  }
-
-  std::vector<expressions::AttributeReferencePtr> getOutputAttributes() const override {
-    return {};
-  }
-
-  std::vector<expressions::AttributeReferencePtr> getReferencedAttributes() const override {
-    return selection_->getOutputAttributes();
-  }
-
-  bool maybeCopyWithPrunedExpressions(
-      const expressions::UnorderedNamedExpressionSet &referenced_expressions,
-      PhysicalPtr *output) const override {
-    return false;
-  }
-
-  /**
-   * @brief Creates an InsertSelection physical node.
-   *
-   * @param destination The destination relation to insert the selection to.
-   * @param selection The selection to be inserted.
-   * @return An immutable InsertSelection node.
-   */
-  static InsertSelectionPtr Create(
-      const PhysicalPtr &destination,
-      const PhysicalPtr &selection) {
-    return InsertSelectionPtr(new InsertSelection(destination, selection));
-  }
-
- 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:
-  InsertSelection(const PhysicalPtr &destination,
-                  const PhysicalPtr &selection)
-      : destination_(destination),
-        selection_(selection) {
-    addChild(destination_);
-    addChild(selection_);
-  }
-
-  PhysicalPtr destination_;
-  PhysicalPtr selection_;
-
-  DISALLOW_COPY_AND_ASSIGN(InsertSelection);
-};
-
-/** @} */
-
-}  // namespace physical
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_QUERY_OPTIMIZER_PHYSICAL_INSERT_SELECTION_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/physical/InsertTuple.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/physical/InsertTuple.cpp b/query_optimizer/physical/InsertTuple.cpp
deleted file mode 100644
index 3085389..0000000
--- a/query_optimizer/physical/InsertTuple.cpp
+++ /dev/null
@@ -1,49 +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/physical/InsertTuple.hpp"
-
-#include <string>
-#include <vector>
-
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/ScalarLiteral.hpp"
-#include "utility/Cast.hpp"
-
-namespace quickstep {
-namespace optimizer {
-namespace physical {
-
-void InsertTuple::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("input");
-  non_container_child_fields->push_back(input_);
-
-  container_child_field_names->push_back("column_values");
-  container_child_fields->push_back(CastSharedPtrVector<OptimizerTreeBase>(column_values_));
-}
-
-}  // namespace physical
-}  // namespace optimizer
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/physical/InsertTuple.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/physical/InsertTuple.hpp b/query_optimizer/physical/InsertTuple.hpp
deleted file mode 100644
index 40f2582..0000000
--- a/query_optimizer/physical/InsertTuple.hpp
+++ /dev/null
@@ -1,138 +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_PHYSICAL_INSERT_TUPLE_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_PHYSICAL_INSERT_TUPLE_HPP_
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "query_optimizer/expressions/ExpressionUtil.hpp"
-#include "query_optimizer/expressions/NamedExpression.hpp"
-#include "query_optimizer/expressions/ScalarLiteral.hpp"
-#include "query_optimizer/physical/Physical.hpp"
-#include "query_optimizer/physical/PhysicalType.hpp"
-#include "utility/Macros.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-class CatalogRelation;
-
-namespace optimizer {
-namespace physical {
-
-/** \addtogroup OptimizerPhysical
- *  @{
- */
-
-class InsertTuple;
-typedef std::shared_ptr<const InsertTuple> InsertTuplePtr;
-
-/**
- * @brief Inserts a tuple with <column_values_> into a relation
- *        <catalog_relation>.
- */
-class InsertTuple : public Physical {
- public:
-  PhysicalType getPhysicalType() const override {
-    return PhysicalType::kInsertTuple;
-  }
-
-  std::string getName() const override { return "InsertTuple"; }
-
-  /**
-   * @return The input that produces the relation to insert the tuple to.
-   */
-  const PhysicalPtr& input() const { return input_; }
-
-  /**
-   * @return Column values to be used to compose a new tuple.
-   */
-  const std::vector<expressions::ScalarLiteralPtr>& column_values() const {
-    return column_values_;
-  }
-
-  PhysicalPtr copyWithNewChildren(
-      const std::vector<PhysicalPtr> &new_children) const override {
-    DCHECK_EQ(getNumChildren(), new_children.size());
-    return Create(new_children[0], column_values_);
-  }
-
-  std::vector<expressions::AttributeReferencePtr> getOutputAttributes() const override {
-    return {};
-  }
-
-  std::vector<expressions::AttributeReferencePtr> getReferencedAttributes() const override {
-    return {};
-  }
-
-  bool maybeCopyWithPrunedExpressions(
-      const expressions::UnorderedNamedExpressionSet &referenced_expressions,
-      PhysicalPtr *output) const override {
-    return false;
-  }
-
-  /**
-   * @brief Creates an InsertTuple physical node.
-   *
-   * @param input The input produces the relation to insert the tuple to.
-   * @param column_values The column values of the tuple to be inserted.
-   *                      The type checking is done in the Resolver.
-   * @return An immutable InsertTuple node.
-   */
-  static InsertTuplePtr Create(
-      const PhysicalPtr &input,
-      const std::vector<expressions::ScalarLiteralPtr> &column_values) {
-    return InsertTuplePtr(new InsertTuple(input, column_values));
-  }
-
- 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:
-  InsertTuple(const PhysicalPtr &input,
-              const std::vector<expressions::ScalarLiteralPtr> &column_values)
-      : input_(input), column_values_(column_values) {
-    addChild(input_);
-  }
-
-  PhysicalPtr input_;
-  std::vector<expressions::ScalarLiteralPtr> column_values_;
-
-  DISALLOW_COPY_AND_ASSIGN(InsertTuple);
-};
-
-/** @} */
-
-}  // namespace physical
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_QUERY_OPTIMIZER_PHYSICAL_INSERT_TUPLE_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/physical/Join.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/physical/Join.hpp b/query_optimizer/physical/Join.hpp
deleted file mode 100644
index 305aa52..0000000
--- a/query_optimizer/physical/Join.hpp
+++ /dev/null
@@ -1,88 +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_PHYSICAL_JOIN_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_PHYSICAL_JOIN_HPP_
-
-#include <memory>
-#include <vector>
-
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "query_optimizer/expressions/ExpressionUtil.hpp"
-#include "query_optimizer/expressions/NamedExpression.hpp"
-#include "query_optimizer/physical/Physical.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-namespace optimizer {
-namespace physical {
-
-/** \addtogroup OptimizerPhysical
- *  @{
- */
-
-class Join;
-typedef std::shared_ptr<const Join> JoinPtr;
-
-/**
- * @brief Base class for physical join nodes.
- */
-class Join : public Physical {
- public:
-  /**
-   * @brief Destructor.
-   */
-  ~Join() override {}
-
-  /**
-   * @brief Gets the project expressions.
-   *
-   * @return The list of project expressions.
-   */
-  const std::vector<expressions::NamedExpressionPtr>& project_expressions() const {
-    return project_expressions_;
-  }
-
-  std::vector<expressions::AttributeReferencePtr> getOutputAttributes() const override {
-    return expressions::ToRefVector(project_expressions_);
-  }
-
- protected:
-  /**
-   * @brief Constructor.
-   *
-   * @param project_expressions The project expressions.
-   */
-  explicit Join(
-      const std::vector<expressions::NamedExpressionPtr>& project_expressions)
-      : project_expressions_(project_expressions) {}
-
- private:
-  std::vector<expressions::NamedExpressionPtr> project_expressions_;
-
-  DISALLOW_COPY_AND_ASSIGN(Join);
-};
-
-/** @} */
-
-}  // namespace physical
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_QUERY_OPTIMIZER_PHYSICAL_JOIN_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/physical/LIPFilterConfiguration.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/physical/LIPFilterConfiguration.hpp b/query_optimizer/physical/LIPFilterConfiguration.hpp
deleted file mode 100644
index 62a6149..0000000
--- a/query_optimizer/physical/LIPFilterConfiguration.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_PHYSICAL_LIP_FILTER_CONFIGURATION_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_PHYSICAL_LIP_FILTER_CONFIGURATION_HPP_
-
-#include <cstddef>
-#include <map>
-#include <memory>
-#include <vector>
-
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "utility/Macros.hpp"
-#include "utility/lip_filter/LIPFilter.hpp"
-
-namespace quickstep {
-namespace optimizer {
-namespace physical {
-
-/** \addtogroup OptimizerPhysical
- *  @{
- */
-
-class Physical;
-typedef std::shared_ptr<const Physical> PhysicalPtr;
-
-/**
- * @brief Optimizer information for a LIP filter builder.
- */
-struct LIPFilterBuildInfo {
-  /**
-   * @brief Constructor.
-   *
-   * @param build_attribute_in The attribute to build the LIP filter with.
-   * @param filter_cardinality_in The LIP filter's cardinality.
-   * @param filter_type_in The LIP filter's type.
-   */
-  LIPFilterBuildInfo(const expressions::AttributeReferencePtr &build_attribute_in,
-                     const std::size_t filter_cardinality_in,
-                     const LIPFilterType &filter_type_in)
-      : build_attribute(build_attribute_in),
-        filter_cardinality(filter_cardinality_in),
-        filter_type(filter_type_in) {
-  }
-  const expressions::AttributeReferencePtr build_attribute;
-  const std::size_t filter_cardinality;
-  const LIPFilterType filter_type;
-};
-
-/**
- * @brief Optimizer information for a LIP filter prober.
- */
-struct LIPFilterProbeInfo {
-  /**
-   * @brief Constructor.
-   *
-   * @param probe_attribute_in The attribute to probe the LIP filter with.
-   * @param build_attribute_in The attribute that the LIP filter is built with.
-   * @param builder_in The physical node that the LIP filter's builder is attached to.
-   */
-  LIPFilterProbeInfo(const expressions::AttributeReferencePtr &probe_attribute_in,
-                     const expressions::AttributeReferencePtr &build_attribute_in,
-                     const PhysicalPtr &builder_in)
-      : probe_attribute(probe_attribute_in),
-        build_attribute(build_attribute_in),
-        builder(builder_in) {
-  }
-  const expressions::AttributeReferencePtr probe_attribute;
-  const expressions::AttributeReferencePtr build_attribute;
-  const PhysicalPtr builder;
-};
-
-
-class LIPFilterConfiguration;
-typedef std::shared_ptr<const LIPFilterConfiguration> LIPFilterConfigurationPtr;
-
-/**
- * @brief Configuration information of all the LIP filters in a query plan.
- */
-class LIPFilterConfiguration {
- public:
-  /**
-   * @brief Constructor.
-   */
-  LIPFilterConfiguration() {
-  }
-
-  /**
-   * @brief Add information for a LIP filter builder.
-   *
-   * @param build_attribute The attribute to build the LIP filter with.
-   * @param builder The physical node to attach the LIP filter builder to.
-   * @param filter_size The LIP filter's cardinality.
-   * @param filter_type The LIP filter's type.
-   */
-  void addBuildInfo(const expressions::AttributeReferencePtr &build_attribute,
-                    const PhysicalPtr &builder,
-                    const std::size_t filter_size,
-                    const LIPFilterType &filter_type) {
-    build_info_map_[builder].emplace_back(
-        build_attribute, filter_size, filter_type);
-  }
-
-  /**
-   * @brief Add information for a LIP filter prober.
-   *
-   * @param probe_attribute The attribute to probe the LIP filter with.
-   * @param prober The physical node to attach the LIP filter prober to.
-   * @param build_attribute The attribute that the LIP filter is built with.
-   * @param builder The physical node that the LIP filter's builder is attached to.
-   */
-  void addProbeInfo(const expressions::AttributeReferencePtr &probe_attribute,
-                    const PhysicalPtr &prober,
-                    const expressions::AttributeReferencePtr &build_attribute,
-                    const PhysicalPtr &builder) {
-    probe_info_map_[prober].emplace_back(
-        probe_attribute, build_attribute, builder);
-  }
-
-  /**
-   * @brief Get all the LIP filter builders.
-   *
-   * @return A map where each key is a physical node and each mapped value is
-   *         a vector of all the LIP filter builders that are attached to the
-   *         physical node.
-   */
-  const std::map<PhysicalPtr, std::vector<LIPFilterBuildInfo>>& getBuildInfoMap() const {
-    return build_info_map_;
-  }
-
-  /**
-   * @brief Get all the LIP filter probers.
-   *
-   * @return A map where each key is a physical node and each mapped value is
-   *         a vector of all the LIP filter probers that are attached to the
-   *         physical node.
-   */
-  const std::map<PhysicalPtr, std::vector<LIPFilterProbeInfo>>& getProbeInfoMap() const {
-    return probe_info_map_;
-  }
-
- private:
-  std::map<PhysicalPtr, std::vector<LIPFilterBuildInfo>> build_info_map_;
-  std::map<PhysicalPtr, std::vector<LIPFilterProbeInfo>> probe_info_map_;
-
-  DISALLOW_COPY_AND_ASSIGN(LIPFilterConfiguration);
-};
-
-/** @} */
-
-}  // namespace physical
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_QUERY_OPTIMIZER_PHYSICAL_LIP_FILTER_CONFIGURATION_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/physical/NestedLoopsJoin.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/physical/NestedLoopsJoin.cpp b/query_optimizer/physical/NestedLoopsJoin.cpp
deleted file mode 100644
index ba3d223..0000000
--- a/query_optimizer/physical/NestedLoopsJoin.cpp
+++ /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.
- **/
-
-#include "query_optimizer/physical/NestedLoopsJoin.hpp"
-
-#include <string>
-#include <vector>
-
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "query_optimizer/expressions/ExpressionUtil.hpp"
-#include "query_optimizer/expressions/NamedExpression.hpp"
-
-namespace quickstep {
-namespace optimizer {
-namespace physical {
-
-std::vector<expressions::AttributeReferencePtr> NestedLoopsJoin::getReferencedAttributes() const {
-  std::vector<expressions::AttributeReferencePtr> referenced_attributes;
-  for (const expressions::NamedExpressionPtr &project_expression :
-       project_expressions()) {
-    const std::vector<expressions::AttributeReferencePtr> referenced_attributes_in_expression =
-        project_expression->getReferencedAttributes();
-    referenced_attributes.insert(referenced_attributes.end(),
-                                 referenced_attributes_in_expression.begin(),
-                                 referenced_attributes_in_expression.end());
-  }
-  const std::vector<expressions::AttributeReferencePtr> referenced_attributes_in_predicate =
-      join_predicate_->getReferencedAttributes();
-  referenced_attributes.insert(referenced_attributes.end(),
-                               referenced_attributes_in_predicate.begin(),
-                               referenced_attributes_in_predicate.end());
-  return referenced_attributes;
-}
-
-bool NestedLoopsJoin::maybeCopyWithPrunedExpressions(
-    const expressions::UnorderedNamedExpressionSet &referenced_expressions,
-    PhysicalPtr *output) const {
-  std::vector<expressions::NamedExpressionPtr> new_project_expressions;
-  const std::vector<expressions::NamedExpressionPtr> &current_project_expressions =
-      project_expressions();
-  for (const expressions::NamedExpressionPtr &project_expression :
-       current_project_expressions) {
-    if (referenced_expressions.find(project_expression) !=
-        referenced_expressions.end()) {
-      new_project_expressions.emplace_back(project_expression);
-    }
-  }
-  if (new_project_expressions.size() != current_project_expressions.size()) {
-    *output = Create(left(), right(), join_predicate_, new_project_expressions);
-    return true;
-  }
-  return false;
-}
-
-void NestedLoopsJoin::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 {
-  BinaryJoin::getFieldStringItems(inline_field_names,
-                                  inline_field_values,
-                                  non_container_child_field_names,
-                                  non_container_child_fields,
-                                  container_child_field_names,
-                                  container_child_fields);
-  non_container_child_field_names->push_back("join_predicate");
-  non_container_child_fields->push_back(join_predicate_);
-}
-
-}  // namespace physical
-}  // namespace optimizer
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/physical/NestedLoopsJoin.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/physical/NestedLoopsJoin.hpp b/query_optimizer/physical/NestedLoopsJoin.hpp
deleted file mode 100644
index c547ae8..0000000
--- a/query_optimizer/physical/NestedLoopsJoin.hpp
+++ /dev/null
@@ -1,133 +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_PHYSICAL_NESTED_LOOPS_JOIN_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_PHYSICAL_NESTED_LOOPS_JOIN_HPP_
-
-#include <memory>
-#include <set>
-#include <string>
-#include <vector>
-
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "query_optimizer/expressions/ExpressionUtil.hpp"
-#include "query_optimizer/expressions/NamedExpression.hpp"
-#include "query_optimizer/expressions/Predicate.hpp"
-#include "query_optimizer/physical/BinaryJoin.hpp"
-#include "query_optimizer/physical/Physical.hpp"
-#include "query_optimizer/physical/PhysicalType.hpp"
-#include "utility/Macros.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-namespace optimizer {
-namespace physical {
-
-/** \addtogroup OptimizerPhysical
- *  @{
- */
-
-class NestedLoopsJoin;
-typedef std::shared_ptr<const NestedLoopsJoin> NestedLoopsJoinPtr;
-
-/**
- * @brief Physical nested loops join node.
- */
-class NestedLoopsJoin : public BinaryJoin {
- public:
-  PhysicalType getPhysicalType() const override {
-    return PhysicalType::kNestedLoopsJoin;
-  }
-
-  std::string getName() const override { return "NestedLoopsJoin"; }
-
-  /**
-   * @return The join predicate.
-   */
-  const expressions::PredicatePtr& join_predicate() const {
-    return join_predicate_;
-  }
-
-  PhysicalPtr copyWithNewChildren(
-      const std::vector<PhysicalPtr> &new_children) const override {
-    DCHECK_EQ(children().size(), new_children.size());
-    return Create(new_children[0],
-                  new_children[1],
-                  join_predicate_,
-                  project_expressions());
-  }
-
-  std::vector<expressions::AttributeReferencePtr> getReferencedAttributes() const override;
-
-  bool maybeCopyWithPrunedExpressions(
-      const expressions::UnorderedNamedExpressionSet &referenced_expressions,
-      PhysicalPtr *output) const override;
-
-  /**
-   * @brief Creates a NestedLoopsJoin.
-   *
-   * @param left The left operand.
-   * @param right The right operand.
-   * @param join_predicate The join predicate.
-   * @param project_expressions The project expressions.
-   * @return An immutable NestedLoopsJoin.
-   */
-  static NestedLoopsJoinPtr Create(
-      const PhysicalPtr &left,
-      const PhysicalPtr &right,
-      const expressions::PredicatePtr &join_predicate,
-      const std::vector<expressions::NamedExpressionPtr> &project_expressions) {
-    return NestedLoopsJoinPtr(
-        new NestedLoopsJoin(left, right, join_predicate, project_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:
-  NestedLoopsJoin(
-      const PhysicalPtr &left,
-      const PhysicalPtr &right,
-      const expressions::PredicatePtr &join_predicate,
-      const std::vector<expressions::NamedExpressionPtr> &project_expressions)
-      : BinaryJoin(left, right, project_expressions),
-        join_predicate_(join_predicate) {
-    DCHECK(join_predicate_ != nullptr);
-  }
-
-  expressions::PredicatePtr join_predicate_;
-
-  DISALLOW_COPY_AND_ASSIGN(NestedLoopsJoin);
-};
-
-/** @} */
-
-}  // namespace physical
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_QUERY_OPTIMIZER_PHYSICAL_NESTED_LOOPS_JOIN_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/physical/OptimizerPhysicalModule.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/physical/OptimizerPhysicalModule.hpp b/query_optimizer/physical/OptimizerPhysicalModule.hpp
deleted file mode 100644
index fd2cc02..0000000
--- a/query_optimizer/physical/OptimizerPhysicalModule.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 OptimizerPhysical
- *  @ingroup QueryOptimizer
- *
- * Physical operators used in the query optimizer.
- **/

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/physical/PatternMatcher.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/physical/PatternMatcher.hpp b/query_optimizer/physical/PatternMatcher.hpp
deleted file mode 100644
index 5cd6fd3..0000000
--- a/query_optimizer/physical/PatternMatcher.hpp
+++ /dev/null
@@ -1,133 +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_PHYSICAL_PATTERN_MATCHER_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_PHYSICAL_PATTERN_MATCHER_HPP_
-
-#include <memory>
-#include <type_traits>
-
-#include "query_optimizer/physical/PhysicalType.hpp"
-
-namespace quickstep {
-namespace optimizer {
-namespace physical {
-
-class Aggregate;
-class BinaryJoin;
-class CopyFrom;
-class CreateTable;
-class DeleteTuples;
-class DropTable;
-class HashJoin;
-class InsertTuple;
-class Join;
-class NestedLoopsJoin;
-class Selection;
-class SharedSubplanReference;
-class Sort;
-class TableReference;
-class TopLevelPlan;
-class UpdateTable;
-
-/** \addtogroup OptimizerPhysical
- *  @{
- */
-
-/**
- * @brief Templated matcher for each Physical node class.
- *
- * @param PhysicalClass The Physical class for the physical node to be matched with.
- * @param physical_types All the physical types of the Physical class.
- */
-template <class PhysicalClass, PhysicalType... physical_types>
-class SomePhysicalNode {
- public:
-  /**
-   * @brief Checks whether the object managed in \p physical is an instance
-   *        of the template argument PhysicalClass by checking whether
-   *        it is one of types in the given template arguments physical_types.
-   *
-   * @param physical The physical node to be checked.
-   * @return True for a match; otherwise false.
-   */
-  template <class OtherPhysicalClass>
-  static bool Matches(const std::shared_ptr<const OtherPhysicalClass> &physical) {
-    for (const PhysicalType physical_type : kPhysicalTypes) {
-      if (physical->getPhysicalType() == physical_type) {
-        return true;
-      }
-    }
-    return false;
-  }
-
-  /**
-   * @brief Checks whether the object managed in \p physical is an instance
-   *        of the template argument PhysicalClass by checking whether
-   *        it is one of types in the given template arguments physical_types,
-   *        If true, it additionally casts \p physical to a std::shared_ptr
-   *        \p cast_physical of the template argument PhysicalClass.
-   *
-   * @param physical The physical node to be checked.
-   * @param cast_physical The cast physical node.
-   * @return True if the object managed in \p physical is an instance of PhysicalClass.
-   */
-  template <class OtherPhysicalClass>
-  static bool MatchesWithConditionalCast(const std::shared_ptr<const OtherPhysicalClass> &physical,
-                                         std::shared_ptr<const PhysicalClass> *cast_physical) {
-    bool is_match = Matches(physical);
-    if (is_match) {
-      *cast_physical = std::static_pointer_cast<const PhysicalClass>(physical);
-    }
-    return is_match;
-  }
-
- private:
-  constexpr static PhysicalType kPhysicalTypes[] = {physical_types...};
-};
-
-template <class PhysicalClass, PhysicalType... physical_types>
-constexpr PhysicalType SomePhysicalNode<PhysicalClass, physical_types...>::kPhysicalTypes[];
-
-// Specializations for all Physical classes.
-
-using SomeAggregate = SomePhysicalNode<Aggregate, PhysicalType::kAggregate>;
-using SomeBinaryJoin = SomePhysicalNode<BinaryJoin, PhysicalType::kHashJoin, PhysicalType::kNestedLoopsJoin>;
-using SomeCopyFrom = SomePhysicalNode<CopyFrom, PhysicalType::kCopyFrom>;
-using SomeCreateTable = SomePhysicalNode<CreateTable, PhysicalType::kCreateTable>;
-using SomeDeleteTuples = SomePhysicalNode<DeleteTuples, PhysicalType::kDeleteTuples>;
-using SomeDropTable = SomePhysicalNode<DropTable, PhysicalType::kDropTable>;
-using SomeHashJoin = SomePhysicalNode<HashJoin, PhysicalType::kHashJoin>;
-using SomeInsertTuple = SomePhysicalNode<InsertTuple, PhysicalType::kInsertTuple>;
-using SomeJoin = SomePhysicalNode<Join, PhysicalType::kHashJoin, PhysicalType::kNestedLoopsJoin>;
-using SomeNestedLoopsJoin = SomePhysicalNode<NestedLoopsJoin, PhysicalType::kNestedLoopsJoin>;
-using SomeSelection = SomePhysicalNode<Selection, PhysicalType::kSelection>;
-using SomeSharedSubplanReference = SomePhysicalNode<SharedSubplanReference, PhysicalType::kSharedSubplanReference>;
-using SomeSort = SomePhysicalNode<Sort, PhysicalType::kSort>;
-using SomeTableReference = SomePhysicalNode<TableReference, PhysicalType::kTableReference>;
-using SomeTopLevelPlan = SomePhysicalNode<TopLevelPlan, PhysicalType::kTopLevelPlan>;
-using SomeUpdateTable = SomePhysicalNode<UpdateTable, PhysicalType::kUpdateTable>;
-
-/** @} */
-
-}  // namespace physical
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_QUERY_OPTIMIZER_PHYSICAL_PATTERN_MATCHER_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/physical/Physical.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/physical/Physical.hpp b/query_optimizer/physical/Physical.hpp
deleted file mode 100644
index 4bed593..0000000
--- a/query_optimizer/physical/Physical.hpp
+++ /dev/null
@@ -1,105 +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_PHYSICAL_PHYSICAL_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_PHYSICAL_PHYSICAL_HPP_
-
-#include <memory>
-#include <vector>
-
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "query_optimizer/expressions/ExpressionUtil.hpp"
-#include "query_optimizer/physical/PhysicalType.hpp"
-
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-namespace optimizer {
-namespace physical {
-
-/** \addtogroup OptimizerPhysical
- *  @{
- */
-
-class Physical;
-typedef std::shared_ptr<const Physical> PhysicalPtr;
-
-/**
- * @brief Base class for physical plan nodes.
- */
-class Physical : public OptimizerTree<Physical> {
- public:
-  /**
-   * @brief Destructor.
-   */
-  ~Physical() override {}
-
-  /**
-   * @return The physical node type.
-   */
-  virtual PhysicalType getPhysicalType() const = 0;
-
-  /**
-   * @brief Gets the output attributes of this node.
-   *
-   * @return The output AttributeReferences by this node.
-   */
-  virtual std::vector<expressions::AttributeReferencePtr> getOutputAttributes() const = 0;
-
-  /**
-   * @brief Returns AttributeReferences referenced by the input expressions of
-   *        this physical node.
-   *
-   * @return A vector of AttributeReference referenced by the input expressions
-   *         of this physical node.
-   */
-  virtual std::vector<expressions::AttributeReferencePtr> getReferencedAttributes() const = 0;
-
-  /**
-   * @brief Creates a new copy in \p output if there are some project
-   *        expressions that are not in \p referenced_expressions.
-   *        Otherwise, keeps \p output unchanged.
-   *
-   * @param referenced_attributes The attributes to be kept in the project
-   *                              expression list.
-   * @param output A new copy if some project expressions should be removed.
-   * @return True if a new copy is generated (i.e. \p output is changed).
-   */
-  virtual bool maybeCopyWithPrunedExpressions(
-      const expressions::UnorderedNamedExpressionSet &referenced_expressions,
-      PhysicalPtr *output) const = 0;
-
- protected:
-  /**
-   * @brief Constructor.
-   */
-  Physical() {}
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(Physical);
-};
-
-/** @} */
-
-}  // namespace physical
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_QUERY_OPTIMIZER_PHYSICAL_PHYSICAL_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/physical/PhysicalType.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/physical/PhysicalType.hpp b/query_optimizer/physical/PhysicalType.hpp
deleted file mode 100644
index f5f35a1..0000000
--- a/query_optimizer/physical/PhysicalType.hpp
+++ /dev/null
@@ -1,62 +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_PHYSICAL_PHYSICAL_TYPE_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_PHYSICAL_PHYSICAL_TYPE_HPP_
-
-namespace quickstep {
-namespace optimizer {
-namespace physical {
-
-/** \addtogroup OptimizerPhysical
- *  @{
- */
-
-/**
- * @brief Optimizer physical node types.
- **/
-enum class PhysicalType {
-  kAggregate,
-  kCopyFrom,
-  kCreateIndex,
-  kCreateTable,
-  kDeleteTuples,
-  kDropTable,
-  kHashJoin,
-  kInsertSelection,
-  kInsertTuple,
-  kNestedLoopsJoin,
-  kSample,
-  kSelection,
-  kSharedSubplanReference,
-  kSort,
-  kTableGenerator,
-  kTableReference,
-  kTopLevelPlan,
-  kUpdateTable,
-  kWindowAggregate
-};
-
-/** @} */
-
-}  // namespace physical
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_QUERY_OPTIMIZER_PHYSICAL_PHYSICAL_TYPE_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/physical/Sample.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/physical/Sample.cpp b/query_optimizer/physical/Sample.cpp
deleted file mode 100644
index 689c3cc..0000000
--- a/query_optimizer/physical/Sample.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/physical/Sample.hpp"
-
-#include <string>
-#include <vector>
-
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "query_optimizer/expressions/ExpressionUtil.hpp"
-#include "query_optimizer/expressions/NamedExpression.hpp"
-#include "utility/Cast.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-namespace optimizer {
-namespace physical {
-
-namespace E = ::quickstep::optimizer::expressions;
-
-PhysicalPtr Sample::copyWithNewChildren(
-    const std::vector<PhysicalPtr> &new_children) const {
-  DCHECK_EQ(children().size(), new_children.size());
-  return Create(new_children[0], is_block_sample_, percentage_);
-}
-
-void Sample::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->emplace_back("input");
-  non_container_child_fields->emplace_back(input());
-
-  inline_field_names->emplace_back("percentage");
-  inline_field_values->emplace_back(std::to_string(percentage_));
-
-  inline_field_names->emplace_back("is_block_sample");
-  inline_field_values->emplace_back(std::to_string(is_block_sample_));
-}
-
-}  // namespace physical
-}  // namespace optimizer
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/physical/Sample.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/physical/Sample.hpp b/query_optimizer/physical/Sample.hpp
deleted file mode 100644
index e3e8f17..0000000
--- a/query_optimizer/physical/Sample.hpp
+++ /dev/null
@@ -1,138 +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_PHYSICAL_SAMPLE_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_PHYSICAL_SAMPLE_HPP_
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "query_optimizer/expressions/ExpressionUtil.hpp"
-#include "query_optimizer/expressions/NamedExpression.hpp"
-#include "query_optimizer/physical/Physical.hpp"
-#include "query_optimizer/physical/PhysicalType.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-namespace optimizer {
-namespace physical {
-
-/** \addtogroup OptimizerPhysical
- *  @{
- */
-
-class Sample;
-typedef std::shared_ptr<const Sample> SamplePtr;
-
-/**
- * @brief Sample operator that samples the data at a block level or
- *        at the tuple level and outputs them as a new relation.
- */
-class Sample : public Physical {
- public:
-  PhysicalType getPhysicalType() const override { return PhysicalType::kSample; }
-
-  std::string getName() const override { return " SAMPLE"; }
-
-  std::vector<expressions::AttributeReferencePtr> getOutputAttributes() const override {
-    return input_->getOutputAttributes();
-  }
-
-  std::vector<expressions::AttributeReferencePtr> getReferencedAttributes() const override {
-    return input_->getReferencedAttributes();
-  }
-
-  PhysicalPtr copyWithNewChildren(
-    const std::vector<PhysicalPtr> &new_children) const override;
-
-  bool maybeCopyWithPrunedExpressions(
-      const expressions::UnorderedNamedExpressionSet &referenced_expressions,
-      PhysicalPtr *output) const override {
-    return false;
-  }
-
-  /**
-   * @return the sample percentage.
-   */
-  int percentage() const {
-    return percentage_;
-  }
-
-  /**
-   * @return flag indicating if the sampling is block or tuple.
-   */
-  const bool is_block_sample() const {
-    return is_block_sample_;
-  }
-
-  /**
-   * @return Input physical node.
-   */
-  const PhysicalPtr& input() const { return children()[0]; }
-
-  /**
-   * @brief Creates a SamplePtr.
-   * @param input The input node.
-   * @param is_block_sample Flag indicating if the sample is block or tuple level
-   * @param percentage The percentage of rows or blocks to be sampled
-   * @return An immutable Sample.
-   */
-  static SamplePtr Create(const PhysicalPtr &input,
-                          const bool is_block_sample,
-                          const int percentage) {
-    return SamplePtr(new Sample(input, is_block_sample, percentage));
-  }
-
- 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:
-  Sample(
-      const PhysicalPtr &input,
-      const bool is_block_sample,
-      const int percentage)
-      : percentage_(percentage),
-        is_block_sample_(is_block_sample),
-        input_(input) {
-    addChild(input);
-  }
-
-  const int percentage_;
-  const bool is_block_sample_;
-  const PhysicalPtr input_;
-
-  DISALLOW_COPY_AND_ASSIGN(Sample);
-};
-
-/** @} */
-
-}  // namespace physical
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_QUERY_OPTIMIZER_SAMPLE_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/physical/Selection.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/physical/Selection.cpp b/query_optimizer/physical/Selection.cpp
deleted file mode 100644
index 36ade04..0000000
--- a/query_optimizer/physical/Selection.cpp
+++ /dev/null
@@ -1,107 +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/physical/Selection.hpp"
-
-#include <string>
-#include <vector>
-
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "query_optimizer/expressions/ExpressionUtil.hpp"
-#include "query_optimizer/expressions/NamedExpression.hpp"
-#include "utility/Cast.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-namespace optimizer {
-namespace physical {
-
-namespace E = ::quickstep::optimizer::expressions;
-
-PhysicalPtr Selection::copyWithNewChildren(
-    const std::vector<PhysicalPtr> &new_children) const {
-  DCHECK_EQ(children().size(), new_children.size());
-  return Create(new_children[0], project_expressions_, filter_predicate_);
-}
-
-std::vector<E::AttributeReferencePtr> Selection::getOutputAttributes() const {
-  return ToRefVector(project_expressions_);
-}
-
-std::vector<E::AttributeReferencePtr> Selection::getReferencedAttributes() const {
-  std::vector<E::AttributeReferencePtr> referenced_attributes;
-  for (const E::NamedExpressionPtr &project_expression : project_expressions_) {
-    const std::vector<E::AttributeReferencePtr> referenced_attributes_in_expression =
-        project_expression->getReferencedAttributes();
-    referenced_attributes.insert(referenced_attributes.end(),
-                                 referenced_attributes_in_expression.begin(),
-                                 referenced_attributes_in_expression.end());
-  }
-  if (filter_predicate_ != nullptr) {
-    const std::vector<E::AttributeReferencePtr> referenced_attributes_in_predicate =
-        filter_predicate_->getReferencedAttributes();
-    referenced_attributes.insert(referenced_attributes.end(),
-                                 referenced_attributes_in_predicate.begin(),
-                                 referenced_attributes_in_predicate.end());
-  }
-  return referenced_attributes;
-}
-
-bool Selection::maybeCopyWithPrunedExpressions(
-    const E::UnorderedNamedExpressionSet &referenced_attributes,
-    PhysicalPtr *output) const {
-  std::vector<E::NamedExpressionPtr> new_project_expressions;
-  for (const E::NamedExpressionPtr &project_expression : project_expressions_) {
-    if (referenced_attributes.find(project_expression) !=
-        referenced_attributes.end()) {
-      new_project_expressions.emplace_back(project_expression);
-    }
-  }
-  if (new_project_expressions.size() != project_expressions_.size()) {
-    *output = Create(input(), new_project_expressions, filter_predicate_);
-    return true;
-  }
-  return false;
-}
-
-void Selection::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->emplace_back("input");
-  non_container_child_fields->emplace_back(input());
-
-  if (filter_predicate_ != nullptr) {
-    non_container_child_field_names->emplace_back("filter_predicate");
-    non_container_child_fields->emplace_back(filter_predicate_);
-  }
-
-  container_child_field_names->emplace_back("project_expressions");
-  container_child_fields->emplace_back(
-      CastSharedPtrVector<OptimizerTreeBase>(project_expressions_));
-}
-
-}  // namespace physical
-}  // namespace optimizer
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/physical/Selection.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/physical/Selection.hpp b/query_optimizer/physical/Selection.hpp
deleted file mode 100644
index b6874a1..0000000
--- a/query_optimizer/physical/Selection.hpp
+++ /dev/null
@@ -1,162 +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_PHYSICAL_SELECTION_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_PHYSICAL_SELECTION_HPP_
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "query_optimizer/expressions/ExpressionUtil.hpp"
-#include "query_optimizer/expressions/NamedExpression.hpp"
-#include "query_optimizer/expressions/LogicalAnd.hpp"
-#include "query_optimizer/expressions/Predicate.hpp"
-#include "query_optimizer/physical/Physical.hpp"
-#include "query_optimizer/physical/PhysicalType.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-namespace optimizer {
-namespace physical {
-
-/** \addtogroup OptimizerPhysical
- *  @{
- */
-
-class Selection;
-typedef std::shared_ptr<const Selection> SelectionPtr;
-
-/**
- * @brief Physical node that evaluates a predicate for each input tuple,
- *        computes and outputs the values of project expressions if the
- *        predicate evaluates to true.
- */
-class Selection : public Physical {
- public:
-  PhysicalType getPhysicalType() const override { return PhysicalType::kSelection; }
-
-  std::string getName() const override { return "Selection"; }
-
-  /**
-   * @return Filter predicate to evaluate during scanning the input.
-   */
-  inline const expressions::PredicatePtr& filter_predicate() const {
-    return filter_predicate_;
-  }
-
-  /**
-   * @return Project expressions to compute.
-   */
-  inline const std::vector<expressions::NamedExpressionPtr>& project_expressions() const {
-    return project_expressions_;
-  }
-
-  /**
-   * @return Input physical node.
-   */
-  inline const PhysicalPtr& input() const { return children()[0]; }
-
-  PhysicalPtr copyWithNewChildren(
-      const std::vector<PhysicalPtr> &new_children) const override;
-
-  std::vector<expressions::AttributeReferencePtr> getOutputAttributes() const override;
-
-  std::vector<expressions::AttributeReferencePtr> getReferencedAttributes() const override;
-
-  bool maybeCopyWithPrunedExpressions(
-      const expressions::UnorderedNamedExpressionSet &referenced_attributes,
-      PhysicalPtr *output) const override;
-
-  /**
-   * @brief Creates a Selection.
-   *
-   * @param input The input node.
-   * @param project_expressions The project expressions.
-   * @param filter_predicate The filter predicate. Can be NULL.
-   * @return An immutable Selection.
-   */
-  static SelectionPtr Create(
-      const PhysicalPtr &input,
-      const std::vector<expressions::NamedExpressionPtr> &project_expressions,
-      const expressions::PredicatePtr &filter_predicate) {
-    return SelectionPtr(
-        new Selection(input, project_expressions, filter_predicate));
-  }
-
-  /**
-   * @brief Creates a conjunctive predicate with \p filter_predicates
-   *        as operands, and creates a Selection with the predicate.
-   *
-   * @param input The input node.
-   * @param project_expressions The project expressions.
-   * @param filter_predicates A list of filter predicates.
-   *                          The predicate in the created Selection is
-   *                          a conjunction of them.
-   * @return An immutable Selection.
-   */
-  static SelectionPtr CreateWithConjuction(
-      const PhysicalPtr &input,
-      const std::vector<expressions::NamedExpressionPtr> &project_expressions,
-      const std::vector<expressions::PredicatePtr> &filter_predicates) {
-    if (filter_predicates.size() > 1u) {
-      return Create(input, project_expressions,
-                    expressions::LogicalAnd::Create(filter_predicates));
-    } else if (filter_predicates.size() == 1u) {
-      return Create(input, project_expressions, filter_predicates[0]);
-    } else {
-      return Create(input, project_expressions, expressions::PredicatePtr());
-    }
-  }
-
- 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:
-  Selection(
-      const PhysicalPtr &input,
-      const std::vector<expressions::NamedExpressionPtr> &project_expressions,
-      const expressions::PredicatePtr &filter_predicate)
-      : project_expressions_(project_expressions),
-        filter_predicate_(filter_predicate) {
-    addChild(input);
-  }
-
-  std::vector<expressions::NamedExpressionPtr> project_expressions_;
-  // Can be NULL. If NULL, the filter predicate is treated as the literal true.
-  expressions::PredicatePtr filter_predicate_;
-
-  DISALLOW_COPY_AND_ASSIGN(Selection);
-};
-
-/** @} */
-
-}  // namespace physical
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_QUERY_OPTIMIZER_PHYSICAL_SELECTION_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/physical/SharedSubplanReference.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/physical/SharedSubplanReference.cpp b/query_optimizer/physical/SharedSubplanReference.cpp
deleted file mode 100644
index 1ba9b16..0000000
--- a/query_optimizer/physical/SharedSubplanReference.cpp
+++ /dev/null
@@ -1,54 +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/physical/SharedSubplanReference.hpp"
-
-#include <string>
-#include <vector>
-
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/physical/Physical.hpp"
-#include "utility/Cast.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-namespace optimizer {
-namespace physical {
-
-void SharedSubplanReference::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("subplan_id");
-  inline_field_values->push_back(std::to_string(subplan_id_));
-
-  container_child_field_names->push_back("referenced_attributes");
-  container_child_fields->push_back(CastSharedPtrVector<OptimizerTreeBase>(referenced_attributes_));
-
-  container_child_field_names->push_back("output_attributes");
-  container_child_fields->push_back(CastSharedPtrVector<OptimizerTreeBase>(output_attributes_));
-}
-
-}  // namespace physical
-}  // namespace optimizer
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/physical/SharedSubplanReference.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/physical/SharedSubplanReference.hpp b/query_optimizer/physical/SharedSubplanReference.hpp
deleted file mode 100644
index 60a2866..0000000
--- a/query_optimizer/physical/SharedSubplanReference.hpp
+++ /dev/null
@@ -1,148 +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_PHYSICAL_SHARED_SUBPLAN_REFERENCE_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_PHYSICAL_SHARED_SUBPLAN_REFERENCE_HPP_
-
-#include <string>
-#include <vector>
-
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "query_optimizer/expressions/ExpressionUtil.hpp"
-#include "query_optimizer/expressions/NamedExpression.hpp"
-#include "query_optimizer/physical/Physical.hpp"
-#include "query_optimizer/physical/PhysicalType.hpp"
-#include "utility/Macros.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-namespace optimizer {
-namespace physical {
-
-/** \addtogroup OptimizerPhysical
- *  @{
- */
-
-class SharedSubplanReference;
-typedef std::shared_ptr<const SharedSubplanReference> SharedSubplanReferencePtr;
-
-/**
- * @breif A reference to a shared subplan stored in the TopLevelPlan node.
- */
-class SharedSubplanReference : public physical::Physical {
- public:
-  PhysicalType getPhysicalType() const override {
-    return PhysicalType::kSharedSubplanReference;
-  }
-
-  std::string getName() const override {
-    return "SharedSubplanReference";
-  }
-
-  /**
-   * @return The ID of the shared subplan.
-   */
-  int subplan_id() const {
-    return subplan_id_;
-  }
-
-  /**
-   * @return The attributes from the referenced shared subplan.
-   */
-  const std::vector<expressions::AttributeReferencePtr>& referenced_attributes() const {
-    return referenced_attributes_;
-  }
-
-  /**
-   * @return The output attributes of this shared subplan reference.
-   */
-  const std::vector<expressions::AttributeReferencePtr>& output_attributes() const {
-    return output_attributes_;
-  }
-
-  std::vector<expressions::AttributeReferencePtr> getOutputAttributes() const override {
-    return output_attributes_;
-  }
-
-  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;
-
-  PhysicalPtr copyWithNewChildren(const std::vector<PhysicalPtr> &new_children) const override {
-    DCHECK(new_children.empty());
-    return Create(subplan_id_, referenced_attributes_, output_attributes_);
-  }
-
-  std::vector<expressions::AttributeReferencePtr> getReferencedAttributes() const override {
-    return referenced_attributes_;
-  }
-
-  bool maybeCopyWithPrunedExpressions(
-      const expressions::UnorderedNamedExpressionSet &referenced_expressions,
-      PhysicalPtr *output) const override {
-    return false;
-  }
-
-  /**
-   * @brief Creates a SharedSubplanReference.
-   *
-   * @param subplan_id The ID of the shared subplan, which is the index of
-   *        the referenced shared subplan in <shared_subplans_> of the TopLevelPlan.
-   * @param referenced_attributes The attributes from the referenced shared subplan.
-   * @param output_attributes The output attributes of this shared subplan reference.
-   * @return An immutable SharedSubplanReference.
-   */
-  static SharedSubplanReferencePtr Create(
-      int subplan_id,
-      const std::vector<expressions::AttributeReferencePtr> &referenced_attributes,
-      const std::vector<expressions::AttributeReferencePtr> &output_attributes) {
-    return SharedSubplanReferencePtr(
-        new SharedSubplanReference(subplan_id, referenced_attributes, output_attributes));
-  }
-
- private:
-  SharedSubplanReference(int subplan_id,
-                         const std::vector<expressions::AttributeReferencePtr> &referenced_attributes,
-                         const std::vector<expressions::AttributeReferencePtr> &output_attributes)
-    : subplan_id_(subplan_id),
-      referenced_attributes_(referenced_attributes),
-      output_attributes_(output_attributes) {
-    DCHECK_EQ(output_attributes_.size(), referenced_attributes_.size());
-  }
-
-  int subplan_id_;
-  std::vector<expressions::AttributeReferencePtr> referenced_attributes_;
-  std::vector<expressions::AttributeReferencePtr> output_attributes_;
-
-  DISALLOW_COPY_AND_ASSIGN(SharedSubplanReference);
-};
-
-/** @} */
-
-}  // namespace physical
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_QUERY_OPTIMIZER_PHYSICAL_SHARED_SUBPLAN_REFERENCE_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/physical/Sort.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/physical/Sort.cpp b/query_optimizer/physical/Sort.cpp
deleted file mode 100644
index b8bbbd4..0000000
--- a/query_optimizer/physical/Sort.cpp
+++ /dev/null
@@ -1,101 +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/physical/Sort.hpp"
-
-#include <string>
-#include <vector>
-
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/ExpressionUtil.hpp"
-#include "query_optimizer/physical/Physical.hpp"
-#include "utility/Cast.hpp"
-
-namespace quickstep {
-namespace optimizer {
-namespace physical {
-
-bool Sort::maybeCopyWithPrunedExpressions(
-    const expressions::UnorderedNamedExpressionSet &referenced_attributes,
-    PhysicalPtr *output) const {
-  std::vector<expressions::AttributeReferencePtr> new_non_sort_attributes;
-  for (const expressions::AttributeReferencePtr &non_sort_attribute : non_sort_attributes_) {
-    if (referenced_attributes.find(non_sort_attribute) != referenced_attributes.end()) {
-      new_non_sort_attributes.emplace_back(non_sort_attribute);
-    }
-  }
-  if (new_non_sort_attributes.size() != non_sort_attributes_.size()) {
-    *output = Create(input_,
-                     sort_attributes_,
-                     new_non_sort_attributes,
-                     sort_ascending_,
-                     nulls_first_flags_,
-                     limit_);
-    return true;
-  }
-  return false;
-}
-
-void Sort::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("input");
-  non_container_child_fields->push_back(input_);
-
-  inline_field_names->push_back("is_ascending");
-  std::string ascending_list("[");
-  for (bool is_ascending : sort_ascending_) {
-    if (is_ascending) {
-      ascending_list.append("true,");
-    } else {
-      ascending_list.append("false,");
-    }
-  }
-  ascending_list.pop_back();
-  ascending_list.append("]");
-  inline_field_values->push_back(ascending_list);
-
-  inline_field_names->push_back("nulls_first");
-  std::string nulls_first_flags("[");
-  for (bool nulls_first_flag : nulls_first_flags_) {
-    if (nulls_first_flag) {
-      nulls_first_flags.append("true,");
-    } else {
-      nulls_first_flags.append("false,");
-    }
-  }
-  nulls_first_flags.pop_back();
-  nulls_first_flags.append("]");
-  inline_field_values->push_back(nulls_first_flags);
-
-  if (limit_ != -1) {
-    inline_field_names->push_back("limit");
-    inline_field_values->push_back(std::to_string(limit_));
-  }
-
-  container_child_field_names->push_back("sort_attributes");
-  container_child_fields->push_back(CastSharedPtrVector<OptimizerTreeBase>(sort_attributes_));
-}
-
-}  // namespace physical
-}  // namespace optimizer
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/physical/Sort.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/physical/Sort.hpp b/query_optimizer/physical/Sort.hpp
deleted file mode 100644
index d0c6fe8..0000000
--- a/query_optimizer/physical/Sort.hpp
+++ /dev/null
@@ -1,192 +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_PHYSICAL_SORT_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_PHYSICAL_SORT_HPP_
-
-#include <string>
-#include <vector>
-
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "query_optimizer/expressions/ExpressionUtil.hpp"
-#include "query_optimizer/physical/Physical.hpp"
-#include "query_optimizer/physical/PhysicalType.hpp"
-#include "utility/Macros.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-namespace optimizer {
-namespace physical {
-
-/** \addtogroup OptimizerPhysical
- *  @{
- */
-
-class Sort;
-typedef std::shared_ptr<const Sort> SortPtr;
-
-/**
- * @brief Sort operator.
- */
-class Sort : public Physical {
- public:
-  PhysicalType getPhysicalType() const override {
-    return PhysicalType::kSort;
-  }
-
-  std::string getName() const override {
-    return "Sort";
-  }
-
-  const PhysicalPtr& input() const {
-    return input_;
-  }
-
-  /**
-   * @return The sorting attributes.
-   */
-  const std::vector<expressions::AttributeReferencePtr>& sort_attributes() const {
-    return sort_attributes_;
-  }
-
-  /**
-   * @brief The order direction for every sorting attributes.
-   */
-  const std::vector<bool>& sort_ascending() const {
-    return sort_ascending_;
-  }
-
-  /**
-   * @brief The order directions for null values.
-   */
-  const std::vector<bool>& nulls_first_flags() const {
-    return nulls_first_flags_;
-  }
-
-  /**
-   * @return The number of output sorted rows. -1 for a full table sort.
-   */
-  int limit() const {
-    return limit_;
-  }
-
-  std::vector<expressions::AttributeReferencePtr> getOutputAttributes() const override {
-    return input_->getOutputAttributes();
-  }
-
-  std::vector<expressions::AttributeReferencePtr> getReferencedAttributes() const override {
-    std::vector<expressions::AttributeReferencePtr> referenced_attributes =
-        sort_attributes_;
-    referenced_attributes.insert(referenced_attributes.end(),
-                                 non_sort_attributes_.begin(),
-                                 non_sort_attributes_.end());
-    return referenced_attributes;
-  }
-
-  PhysicalPtr copyWithNewChildren(const std::vector<PhysicalPtr> &new_children) const override {
-    DCHECK_EQ(getNumChildren(), new_children.size());
-    return Create(new_children[0],
-                  sort_attributes_,
-                  non_sort_attributes_,
-                  sort_ascending_,
-                  nulls_first_flags_,
-                  limit_);
-  }
-
-  bool maybeCopyWithPrunedExpressions(
-      const expressions::UnorderedNamedExpressionSet &referenced_attributes,
-      PhysicalPtr *output) const override;
-
-  /**
-   * @brief Creates a physical Sort operator.
-   *
-   * @param input The input to the Sort.
-   * @param sort_attributes The attributes as the ordering keys.
-   * @param non_sort_attributes The output attributes other than sort_attributes.
-   * @param sort_ascending The vector of ordering directions.
-   * @param nulls_first_flags The vector of ordering directions for null values.
-   * @param limit The number of output rows. -1 for a full table sort.
-   *
-   * @return An immutable physical Sort.
-   */
-  static SortPtr Create(const PhysicalPtr &input,
-                        const std::vector<expressions::AttributeReferencePtr> &sort_attributes,
-                        const std::vector<expressions::AttributeReferencePtr> &non_sort_attributes,
-                        const std::vector<bool> &sort_ascending,
-                        const std::vector<bool> &nulls_first_flags,
-                        const int limit) {
-    DCHECK_EQ(sort_attributes.size(), sort_ascending.size());
-    DCHECK_EQ(sort_attributes.size(), nulls_first_flags.size());
-
-    return SortPtr(new Sort(input,
-                            sort_attributes,
-                            non_sort_attributes,
-                            sort_ascending,
-                            nulls_first_flags,
-                            limit));
-  }
-
- 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:
-  Sort(const PhysicalPtr &input,
-       const std::vector<expressions::AttributeReferencePtr> &sort_attributes,
-       const std::vector<expressions::AttributeReferencePtr> &non_sort_attributes,
-       const std::vector<bool> &sort_ascending,
-       const std::vector<bool> &nulls_first_flags,
-       const int limit)
-      : input_(input),
-        sort_attributes_(sort_attributes),
-        non_sort_attributes_(non_sort_attributes),
-        sort_ascending_(sort_ascending),
-        nulls_first_flags_(nulls_first_flags),
-        limit_(limit) {
-    addChild(input);
-  }
-
-  PhysicalPtr input_;
-  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_;
-
-  DISALLOW_COPY_AND_ASSIGN(Sort);
-};
-
-/** @} */
-
-}  // namespace physical
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_QUERY_OPTIMIZER_PHYSICAL_SORT_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/physical/TableGenerator.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/physical/TableGenerator.hpp b/query_optimizer/physical/TableGenerator.hpp
deleted file mode 100644
index c9ff8a8..0000000
--- a/query_optimizer/physical/TableGenerator.hpp
+++ /dev/null
@@ -1,161 +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_PHYSICAL_TABLE_GENERATOR_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_PHYSICAL_TABLE_GENERATOR_HPP_
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "expressions/table_generator/GeneratorFunctionHandle.hpp"
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "query_optimizer/expressions/ExprId.hpp"
-#include "query_optimizer/expressions/ExpressionUtil.hpp"
-#include "query_optimizer/physical/Physical.hpp"
-#include "query_optimizer/physical/PhysicalType.hpp"
-#include "utility/Cast.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-namespace optimizer {
-namespace physical {
-
-namespace E = ::quickstep::optimizer::expressions;
-
-/** \addtogroup OptimizerPhysical
- *  @{
- */
-
-class TableGenerator;
-typedef std::shared_ptr<const TableGenerator> TableGeneratorPtr;
-
-/**
- * @brief Leaf physical node that represents a table that will be populated
- *        by a generator function.
- */
-class TableGenerator : public Physical {
- public:
-  PhysicalType getPhysicalType() const override {
-    return PhysicalType::kTableGenerator;
-  }
-
-  std::string getName() const override { return "TableGenerator"; }
-
-  PhysicalPtr copyWithNewChildren(
-      const std::vector<PhysicalPtr> &new_children) const override {
-    return TableGeneratorPtr(
-        new TableGenerator(generator_function_handle_,
-                           table_alias_,
-                           attribute_list_));
-  }
-
-  bool maybeCopyWithPrunedExpressions(
-      const expressions::UnorderedNamedExpressionSet &referenced_expressions,
-      PhysicalPtr *output) const override {
-    // The number of output columns is fixed for generator functions.
-    return false;
-  }
-
-  /**
-   * @return The reference to the generator function handle.
-   */
-  const GeneratorFunctionHandlePtr& generator_function_handle() const {
-    return generator_function_handle_;
-  }
-
-  /**
-   * @return The alias name of this table.
-   */
-  const std::string& table_alias() const {
-    return table_alias_;
-  }
-
-  const std::vector<expressions::AttributeReferencePtr>& attribute_list() const {
-    return attribute_list_;
-  }
-
-  std::vector<E::AttributeReferencePtr> getOutputAttributes() const override {
-    return attribute_list_;
-  }
-
-  std::vector<E::AttributeReferencePtr> getReferencedAttributes() const override {
-    return {};
-  }
-
-  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 {
-    inline_field_names->push_back("function_name");
-    inline_field_values->push_back(generator_function_handle_->getName());
-
-    if (table_alias_ != generator_function_handle_->getName()) {
-      inline_field_names->push_back("table_alias");
-      inline_field_values->push_back(table_alias_);
-    }
-
-    container_child_field_names->push_back("");
-    container_child_fields->push_back(CastSharedPtrVector<OptimizerTreeBase>(attribute_list_));
-  }
-
-  /**
-   * @brief Creates a table generator that generates a table.
-   *
-   * @param A generator function handle.
-   * @return An immutable TableGenerator.
-   */
-  static TableGeneratorPtr Create(
-      const GeneratorFunctionHandlePtr &generator_function_handle,
-      const std::string &table_alias,
-      const std::vector<E::AttributeReferencePtr> &attribute_list) {
-    return TableGeneratorPtr(
-        new TableGenerator(generator_function_handle,
-                           table_alias,
-                           attribute_list));
-  }
-
- private:
-  TableGenerator(const GeneratorFunctionHandlePtr &generator_function_handle,
-                 const std::string &table_alias,
-                 const std::vector<E::AttributeReferencePtr> &attribute_list)
-      : generator_function_handle_(generator_function_handle),
-        table_alias_(table_alias),
-        attribute_list_(attribute_list) {
-  }
-
-  GeneratorFunctionHandlePtr generator_function_handle_;
-  std::string table_alias_;
-  std::vector<E::AttributeReferencePtr> attribute_list_;
-
-  DISALLOW_COPY_AND_ASSIGN(TableGenerator);
-};
-
-/** @} */
-
-}  // namespace physical
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_QUERY_OPTIMIZER_PHYSICAL_TABLE_GENERATOR_HPP_ */


[02/51] [abbrv] [partial] incubator-quickstep git commit: remove c++ files

Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/resolver/Resolver.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/resolver/Resolver.hpp b/query_optimizer/resolver/Resolver.hpp
deleted file mode 100644
index 855e6ba..0000000
--- a/query_optimizer/resolver/Resolver.hpp
+++ /dev/null
@@ -1,694 +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_RESOLVER_RESOLVER_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_RESOLVER_RESOLVER_HPP_
-
-#include <string>
-#include <unordered_map>
-#include <unordered_set>
-#include <vector>
-
-#include "query_optimizer/expressions/Alias.hpp"
-#include "query_optimizer/expressions/ExprId.hpp"
-#include "query_optimizer/expressions/NamedExpression.hpp"
-#include "query_optimizer/expressions/Predicate.hpp"
-#include "query_optimizer/expressions/SubqueryExpression.hpp"
-#include "query_optimizer/expressions/Scalar.hpp"
-#include "query_optimizer/expressions/WindowAggregateFunction.hpp"
-#include "query_optimizer/logical/Logical.hpp"
-#include "utility/Macros.hpp"
-#include "utility/PtrVector.hpp"
-
-namespace quickstep {
-
-class CatalogDatabase;
-class CatalogRelation;
-class Comparison;
-class ParseExpression;
-class ParseFunctionCall;
-class ParseGeneratorTableReference;
-class ParseJoinedTableReference;
-class ParseOrderBy;
-class ParsePredicate;
-class ParseSearchedCaseExpression;
-class ParseSelect;
-class ParseSelectionClause;
-class ParseSimpleCaseExpression;
-class ParseSimpleTableReference;
-class ParseSubqueryTableReference;
-class ParseStatement;
-class ParseStatementCopyFrom;
-class ParseStatementCreateTable;
-class ParseStatementCreateIndex;
-class ParseStatementDelete;
-class ParseStatementDropTable;
-class ParseStatementInsertSelection;
-class ParseStatementInsertTuple;
-class ParseStatementSelect;
-class ParseStatementUpdate;
-class ParseString;
-class ParseSubqueryExpression;
-class ParseTableReference;
-class ParseTableReferenceSignature;
-class ParseTreeNode;
-class ParseWindow;
-template <class T>
-class PtrList;
-class StorageBlockLayoutDescription;
-class Type;
-
-}  // namespace quickstep
-
-namespace quickstep {
-namespace optimizer {
-
-class OptimizerContext;
-
-namespace resolver {
-
-class NameResolver;
-
-/** \addtogroup QueryResolver
- *  @{
- */
-
-/**
- * @brief Performs semantic analysis and validation on a parse tree for a SELECT
- *        statement and outputs an initial logical plan.
- */
-class Resolver {
- public:
-  /**
-   * @brief Constructor. Does not take ownership of \p context.
-   *
-   * @param catalog_database The database that the query is executed on.
-   * @param context The context of this query.
-   */
-  Resolver(const CatalogDatabase &catalog_database, OptimizerContext *context)
-      : catalog_database_(catalog_database),
-        context_(context) {}
-
-  /**
-   * @brief Validates the query is semantically correct and converts the parse
-   *        tree to an initial logical plan.
-   *
-   * @param parse_query
-   * @return The converted logical node.
-   */
-  logical::LogicalPtr resolve(const ParseStatement &parse_query);
-
- private:
-  /**
-   * @brief Expression-scoped info that contains both constant and non-constant
-   *        info (e.g. the name resolver, whether an aggregate is allowed)
-   *        during resolving an expression.
-   */
-  struct ExpressionResolutionInfo;
-
-  /**
-   * @brief Query-scoped info that contains the aggregate expressions in a query
-   *        block.
-   */
-  struct QueryAggregationInfo;
-
-  /**
-   * @brief Query-scoped info that contains window aggregate expressions and a
-   *        window map.
-   **/
-  struct WindowAggregationInfo;
-
-  /**
-   * @brief A wrapper for resolved window and the corresponding sorted plan.
-   **/
-  struct WindowPlan;
-
-  /**
-   * @brief Query-scoped info that contains select-list expressions
-   *        and whether an expression is referenced by an
-   *        ordinal or alias reference.
-   */
-  struct SelectListInfo;
-
-  /**
-   * @brief Contains resolution info for subqueries in the WITH clause.
-   */
-  struct WithQueriesInfo {
-    /**
-     * @brief The plans for WITH queries.
-     */
-    std::vector<logical::LogicalPtr> with_query_plans;
-
-    /**
-     * @brief The query name (the name of the table derived by the query) to
-     *        the position of the plan in <with_query_plans>.
-     */
-    std::unordered_map<std::string, int> with_query_name_to_vector_position;
-
-    /**
-     * @brief Indexes of WITH queries that are not used.
-     */
-    std::unordered_set<int> unreferenced_query_indexes;
-  };
-
-  /**
-   * @brief Resolves a SELECT (sub)query and returns a logical plan.
-   *
-   * @param select_statement The SELECT parse tree.
-   * @param select_name The name for the SELECT query.
-   * @param type_hints Type hints for the expressions in the SELECT clause. Can
-   *                   be NULL if there is no expectation.
-   * @param parent_resolver The name resolver of the outer query if exists.
-   * @return A logical plan for the SELECT query.
-   */
-  logical::LogicalPtr resolveSelect(
-      const ParseSelect &select_statement,
-      const std::string &select_name,
-      const std::vector<const Type*> *type_hints,
-      const NameResolver *parent_resolver);
-
-  /**
-   * @brief Resolves a CREATE TABLE query and returns a logical plan.
-   *
-   * @param create_table_statement The CREATE TABLE parse tree.
-   * @return A logical plan for the CREATE TABLE query.
-   */
-  logical::LogicalPtr resolveCreateTable(
-      const ParseStatementCreateTable &create_table_statement);
-
-  /**
-   * @brief Resolves a CREATE INDEX query and returns a logical plan.
-   *
-   * @param create_index_statement THE CREATE INDEX parse tree.
-   * @return A logical plan for the CREATE INDEX query.
-   */
-  logical::LogicalPtr resolveCreateIndex(
-      const ParseStatementCreateIndex &create_index_statement);
-
-  /**
-   * @brief Resolves the BLOCK PROPERTIES of a CREATE TABLE statement to a
-   *        proto message describing the user input.
-   *
-   * @param create_table_statement The create table statement.
-   * @return A pointer to a user-owned Proto message describing the block. Note
-   *         that this message may be invalid.
-   */
-  StorageBlockLayoutDescription* resolveBlockProperties(
-      const ParseStatementCreateTable &create_table_statement);
-
-  /**
-   * @brief Resolves a DELETE query and returns a logical plan.
-   *
-   * @param delete_statement The DELETE parse tree.
-   * @return A logical plan for the DELETE query.
-   */
-  logical::LogicalPtr resolveDelete(
-      const ParseStatementDelete &delete_statement);
-
-  /**
-   * @brief Resolves a DROP TABLE query and returns a logical plan.
-   *
-   * @param drop_table_statement The DROP TABLE parse tree.
-   * @return A logical plan for the DROP TABLE query.
-   */
-  logical::LogicalPtr resolveDropTable(
-      const ParseStatementDropTable &drop_table_statement);
-
-  /**
-   * @brief Resolves an INSERT VALUES query and returns a logical plan.
-   *
-   * @param insert_statement The INSERT parse tree.
-   * @return A logical plan for the INSERT query.
-   */
-  logical::LogicalPtr resolveInsertTuple(
-      const ParseStatementInsertTuple &insert_statement);
-
-  /**
-   * @brief Resolves an INSERT SELECT query and returns a logical plan.
-   *
-   * @param insert_statement The INSERT parse tree.
-   * @return A logical plan for the INSERT query.
-   */
-  logical::LogicalPtr resolveInsertSelection(
-      const ParseStatementInsertSelection &insert_statement);
-
-  /**
-   * @brief Resolves a COPY FROM query and returns a logical plan.
-   *
-   * @param copy_from_statement The COPY FROM parse tree.
-   * @return A logical plan for the COPY FROM query.
-   */
-  logical::LogicalPtr resolveCopyFrom(
-      const ParseStatementCopyFrom &copy_from_statement);
-
-  /**
-   * @brief Resolves a UPDATE query and returns a logical plan.
-   *
-   * @param update_statement The UPDATE parse tree.
-   * @return A logical plan for the UPDATE query.
-   */
-  logical::LogicalPtr resolveUpdate(
-      const ParseStatementUpdate &update_statement);
-
-  /**
-   * @brief Resolves WITH clause and stores the resolved information into
-   * the member object with_query_info_ of this class.
-   *
-   * @param with_list The list of subqueries in WITH clause.
-   */
-  void resolveWithClause(
-      const PtrVector<ParseSubqueryTableReference> &with_list);
-
-  /**
-   * @brief Resolves SELECT-list expressions and returns the resolved
-   *        expressions in \p project_expressions.
-   * @warning \p project_expressions will be cleared first.
-   *
-   * @param parse_selection The SELECT parse tree.
-   * @param select_name The name of the SELECT query. It is used to populate the
-   *                    relation name in the expressions.
-   * @param type_hints Type hints for the expressions in the SELECT clause. Can
-   *                   be NULL if there is no expectation.
-   * @param name_resolver NameResolver to resolve the relation/attribute names.
-   * @param query_aggregation_info Passed down to each expression to collects
-   *                               aggregate expressions.
-   * @param window_aggregate_expressions Passed down to each expressions to
-   *                                     collects window aggregate expressions.
-   * @param project_expressions Converted SELECT-list expressions.
-   * @param has_aggregate_per_expression For each SELECT-list expression,
-   *                                     indicates whether it contains
-   *                                     an aggregate.
-   */
-  void resolveSelectClause(
-      const ParseSelectionClause &parse_selection,
-      const std::string &select_name,
-      const std::vector<const Type*> *type_hints,
-      const NameResolver &name_resolver,
-      QueryAggregationInfo *query_aggregation_info,
-      WindowAggregationInfo *window_aggregation_info,
-      std::vector<expressions::NamedExpressionPtr> *project_expressions,
-      std::vector<bool> *has_aggregate_per_expression);
-
-  /**
-   * @brief Resolves FROM clause and converts it to a logical plan. If the FROM
-   *        clause has multiple items, the returned plan is a MultiwayCartisianJoin
-   *        on all logical subplans for FROM-list items.
-   *
-   * @param from_list The FROM-list items.
-   * @param name_resolver The resolver to resolve names.
-   * @return A logical plan for the FROM clause.
-   */
-  logical::LogicalPtr resolveFromClause(
-      const PtrList<ParseTableReference> &from_list,
-      NameResolver *name_resolver);
-
-  /**
-   * @brief Resolves a table reference item, which can be a base table,
-   *        a generator table, a subquery table, or a joined table defined by
-   *        a join chain.
-   *
-   * @param table_reference The parse table reference to be resolved.
-   * @param name_resolver The name resolver to be updated with new tables
-   *                      visible from this table reference item.
-   * @return The logical plan to derive the table.
-   */
-  logical::LogicalPtr resolveTableReference(const ParseTableReference &table_reference,
-                                            NameResolver *name_resolver);
-
-  /**
-   * @brief Resolves a table reference by name, and converts it to a logical
-   *        plan. The table is not added into the NameResolver.
-   *
-   * @param table_name The parse node for the table name string.
-   * @param reference_alias The alias of the table reference.
-   * @return A logical plan for the table reference.
-   */
-  logical::LogicalPtr resolveSimpleTableReference(
-      const ParseString &table_name, const ParseString *reference_alias);
-
-  /**
-   * @brief Resolves a generator table reference and links the corresponding
-   *        generator function. The table is not added into the NameResolver.
-   *
-   * @param table_reference The parse table reference to be resolved.
-   * @return The logical plan for the generator table reference.
-   */
-  logical::LogicalPtr resolveGeneratorTableReference(
-      const ParseGeneratorTableReference &table_reference,
-      const ParseString *reference_alias);
-
-  /**
-   * @brief Resolves a joined table resulting from a join between two table
-   *        references.
-   *
-   * @param joined_table_reference The parse joined table reference to be resolved.
-   * @param name_resolver The name resolver to be updated with the left and the
-   *        right tables.
-   * @return A logical plan for the joined table reference.
-   */
-  logical::LogicalPtr resolveJoinedTableReference(
-      const ParseJoinedTableReference &joined_table_reference,
-      NameResolver *name_resolver);
-
-  /**
-   * @brief Renames the output columns from \p logical_plan based on the table signature
-   *        by wrapping it with a Project.
-   *
-   * @param logical The logical node whose output columns are
-   * @param table_signature A table reference signature that specifies column names.
-   * @return A logical plan with a wrapper Project.
-   */
-  logical::LogicalPtr RenameOutputColumns(
-      const logical::LogicalPtr &logical_plan,
-      const ParseTableReferenceSignature &table_signature);
-
-  /**
-   * @brief Sort the input table in (p_key, o_key) order specified by the window.
-   *
-   * @param logical_plan The input logical node.
-   * @param window_info The window that the input table has to be sorted accordingly.
-   * @return A logical plan that sorts the table according to window_info.
-   **/
-  logical::LogicalPtr resolveSortInWindow(
-      const logical::LogicalPtr &logical_plan,
-      const expressions::WindowInfo &window_info);
-
-  /**
-   * @brief Resolves a parse expression and converts it to a scalar expression
-   *        in the query optimizer. A non-scalar parse expression is resolved
-   *        to an AttributeReference to another optimizer expression.
-   *
-   * @param parse_expression The parse expression to be resolved.
-   * @param type_hint A hint about what Type the expression is expected to be
-   *        (e.g. an attribute's type in an INSERT or UPDATE query). May be
-   *        NULL if there is no expectation, or the expectation is ambiguous.
-   *        This is passed through to ParseLiteralValue::concretize().
-   * @param expression_resolution_info Resolution info that contains the name
-   *                                   resolver and info to be updated after
-   *                                   resolution.
-   * @return An expression in the query optimizer.
-   */
-  expressions::ScalarPtr resolveExpression(
-      const ParseExpression &parse_expression,
-      const Type *type_hint,
-      ExpressionResolutionInfo *expression_resolution_info);
-
-  /**
-   * @brief Resolves a searched CASE expression.
-   *
-   * @param type_hint The expected result type of this expression.
-   * @param parse_searched_case_expression The parsed searched CASE expression
-   *        to be resolved.
-   * @param expresssion_resolution_info Resolution info that contains the name
-   *        resolver and info to be updated after resolution.
-   * @return An optimizer expression for the CASE expression.
-   */
-  expressions::ScalarPtr resolveSearchedCaseExpression(
-      const ParseSearchedCaseExpression &parse_searched_case_expression,
-      const Type *type_hint,
-      ExpressionResolutionInfo *expression_resolution_info);
-
-  /**
-   * @brief Resolves a simple CASE expression.
-   *
-   * @param type_hint The expected result type of this expression.
-   * @param parse_simple_case_expression The parsed simple CASE expression
-   *        to be resolved.
-   * @param expresssion_resolution_info Resolution info that contains the name
-   *        resolver and info to be updated after resolution.
-   * @return An optimizer expression for the CASE expression.
-   */
-  expressions::ScalarPtr resolveSimpleCaseExpression(
-      const ParseSimpleCaseExpression &parse_simple_case_expression,
-      const Type *type_hint,
-      ExpressionResolutionInfo *expression_resolution_info);
-
-  /**
-   * @brief Resolves a function call. For a non-scalar function, the returned
-   *        expression is an AttributeReference to the actual resolved expression.
-   *
-   * @note This currently only handles resolving aggregate functions and window
-   *       aggregate functions.
-   *
-   * @param parse_function_call The function call to be resolved.
-   * @param expression_resolution_info Resolution info that contains the name
-   *                                   resolver and info to be updated after
-   *                                   resolution.
-   * @return An expression in the query optimizer.
-   */
-  expressions::ScalarPtr resolveFunctionCall(
-      const ParseFunctionCall &parse_function_call,
-      ExpressionResolutionInfo *expression_resolution_info);
-
-  /**
-   * @brief Resolves a window aggregate function.
-   *
-   * @param parse_function_call The function call to be resolved.
-   * @param expression_resolution_info Resolution info that contains the name
-   *                                   resolver and info to be updated after
-   *                                   resolution.
-   * @param aggregate The window aggregate function.
-   * @param resolved_arguments The resolved arguments.
-   * @return An expression in the query optimizer.
-   */
-  expressions::ScalarPtr resolveWindowAggregateFunction(
-      const ParseFunctionCall &parse_function_call,
-      ExpressionResolutionInfo *expression_resolution_info,
-      const ::quickstep::WindowAggregateFunction *aggregate,
-      const std::vector<expressions::ScalarPtr> &resolved_arguments);
-
-  /**
-   * @brief Resolves a parse Predicate and converts it to a predicate in the
-   *        query optimizer.
-   *
-   * @param parse_predicate The parse predicate to be resolved.
-   * @param expression_resolution_info Resolution info that contains the name
-   *                                   resolver and info to be updated after
-   *                                   resolution.
-   * @return A predicate in the query optimizer
-   */
-  expressions::PredicatePtr resolvePredicate(
-      const ParsePredicate &parse_predicate,
-      ExpressionResolutionInfo *expression_resolution_info);
-
-  /**
-   * @brief Convenient method to resolve a list of predicates that uses
-   *        resolvePredicate as a subroutine.
-   *
-   * @param parse_predicates Parse predicates to be resolved.
-   * @param expression_resolution_info Resolution info that contains the name
-   *                                   resolver and info to be updated after
-   *                                   resolution.
-   * @return Resolved predicates in the query optimizer
-   */
-  std::vector<expressions::PredicatePtr> resolvePredicates(
-      const PtrList<ParsePredicate> &parse_predicates,
-      ExpressionResolutionInfo *expression_resolution_info);
-
-  /**
-   * @brief Resolves a table/scalar subquery expression.
-   *
-   * @param parse_subquery_expression The parsed subquery expression.
-   * @param type_hints The type hints for output columns by the subquery.
-   * @param expression_resolution_info Resolution info that contains the name
-   *        resolver and info to be updated after resolution.
-   * @param has_single_column True if the subquery is expected to return only
-   *        one column in the result.
-   */
-  expressions::SubqueryExpressionPtr resolveSubqueryExpression(
-      const ParseSubqueryExpression &parse_subquery_expression,
-      const std::vector<const Type*> *type_hints,
-      ExpressionResolutionInfo *expression_resolution_info,
-      const bool has_single_column);
-
-  /**
-   * @brief Resolves a window definition.
-   *
-   * @param parse_window The parsed window definition.
-   * @param name_resolver The resolver to resolve names.
-   **/
-  expressions::WindowInfo resolveWindow(const ParseWindow &parse_window,
-                                        const NameResolver &name_resolver);
-
-  /**
-   * @brief Resolves a relation name to a pointer to the corresponding
-   *        CatalogRelation with the name.
-   *
-   * @param relation_name The parser node of the relation name.
-   * @return The CatalogRelation.
-   */
-  const CatalogRelation *resolveRelationName(const ParseString *relation_name);
-
-  /**
-   * @brief Determines whether \p op can apply to \p left_operand and \p
-   *        right_operand.
-   *
-   * @param location The location for the error message.
-   * @param op The comparison operator.
-   * @param left_operand The left operand.
-   * @param right_operand The right operand.
-   */
-  void checkComparisonCanApplyTo(const ParseTreeNode *location,
-                                 const Comparison &op,
-                                 const expressions::ScalarPtr &left_operand,
-                                 const expressions::ScalarPtr &right_operand) const;
-
-  /**
-   * @brief Generates an internal alias for an aggregate attribute.
-   *
-   * @param index The index of the aggregate attribute used for generating the
-   *              name.
-   * @return A string for the name.
-   */
-  static std::string GenerateAggregateAttributeAlias(int index);
-
-  /**
-   * @brief Generates an internal alias for a window aggregate attribute.
-   *
-   * @param index The index of the window aggregate attribute used for
-   *              generating the name.
-   * @return A string for the name.
-   */
-  static std::string GenerateWindowAggregateAttributeAlias(int index);
-
-  /**
-   * @brief Generates an internal alias for a grouping attribute.
-   *
-   * @param index The index of the grouping attribute used for generating the
-   *              name.
-   * @return A string for the name.
-   */
-  static std::string GenerateGroupingAttributeAlias(int index);
-
-  /**
-   * @brief Generates an internal alias for an ordering attribute.
-   *
-   * @param index The index of an ordering attribute used for generating
-   *              the name.
-   * @return A string for the name.
-   */
-  static std::string GenerateOrderingAttributeAlias(int index);
-
-  /**
-   * @brief Validates each SELECT-list expression to ensure that it does not
-   *        reference a named expression with an ID not in \p valid_expr_id_set.
-   *
-   * @param parse_select The parse tree for SELECT.
-   * @param select_list_expressions The resolved SELECT-list expressions.
-   * @param visible_expr_id_set A set of IDs of expressions visible to the
-   *                            SELECT list.
-   */
-  void validateSelectExpressionsForAggregation(
-      const ParseSelectionClause &parse_selection,
-      const std::vector<expressions::NamedExpressionPtr> &
-          select_list_expressions,
-      const std::unordered_set<expressions::ExprId> &visible_expr_id_set) const;
-
-  /**
-   * @brief Validates each ordering expression to ensure that it does not
-   *        reference a named expression with an ID not in \p valid_expr_id_set.
-   *
-   * @param parse_order_by The parse tree for ORDER BY.
-   * @param order_by_expressions The resolved order by expressions.
-   * @param visible_expr_id_set A set of IDs of expressions visible to ORDER BY.
-   */
-  void validateOrderingExpressionsForAggregation(
-      const ParseOrderBy &parse_order_by,
-      const std::vector<expressions::ScalarPtr> &order_by_expressions,
-      const std::unordered_set<expressions::ExprId> &visible_expr_id_set) const;
-
-  /**
-   * @brief Validates \p expression does not reference a name expression with an
-   *        ID not in \p valid_expr_id_set.
-   *
-   * @param location The location where to report an error at.
-   * @param expression The expression to be checked.
-   * @param visible_expr_id_set A set of IDs of expressions visible to the
-   *                            expression.
-   */
-  void validateExpressionForAggregation(
-      const ParseTreeNode *location,
-      const expressions::ExpressionPtr &expression,
-      const std::unordered_set<expressions::ExprId> &visible_expr_id_set) const;
-
-  /**
-   * @brief Rewrites \p expression if it is an integer literal that can be used
-   *        as an ordinal reference to a SELECT-list expression.
-   *
-   * @param location The location where to report an error at.
-   * @param expr_resolution_info Used to know aggregate functions are allowed.
-   * @param select_list_info The SELECT-list expressions info.
-   * @param expression The expression to be checked and rewritten.
-   */
-  void rewriteIfOrdinalReference(
-      const ParseTreeNode *location,
-      const ExpressionResolutionInfo &expr_resolution_info,
-      SelectListInfo *select_list_info, expressions::ScalarPtr *expression);
-
-  /**
-   * @brief Wraps \p project_plan with a Project if \p select_list_info
-   *        indicates that there are SELECT-list expressions
-   *        that do not contain aggregates and need to be precomputed (those
-   *        that are referenced by aliases), updates those precomputed
-   *        expressions in \p select_list_expressions with the references.
-   *
-   * @param select_list_info Select list info to determine precomputed
-   *                         expressions.
-   * @param select_list_expressions Select list expressions.
-   * @param logical_plan The logical plan to be updated.
-   */
-  void appendProjectIfNeedPrecomputationBeforeAggregation(
-      const SelectListInfo &select_list_info,
-      std::vector<expressions::NamedExpressionPtr> *select_list_expressions,
-      logical::LogicalPtr *logical_plan);
-
-  /**
-   * @brief Wraps \p project_plan with a Project if \p select_list_info
-   *        indicates that there are SELECT-list expressions
-   *        that contain aggregates and need to be precomputed (those that are
-   *        referenced by aliases), updates those precomputed expressions in
-   *        \p select_list_expressions with the references.
-   *
-   * @param select_list_info Select list info to determine precomputed
-   *                         expressions.
-   * @param select_list_expressions Select list expressions.
-   * @param logical_plan The logical plan to be updated.
-   */
-  void appendProjectIfNeedPrecomputationAfterAggregation(
-      const SelectListInfo &select_list_info,
-      std::vector<expressions::NamedExpressionPtr> *select_list_expressions,
-      logical::LogicalPtr *logical_plan);
-
-  const CatalogDatabase &catalog_database_;
-
-  OptimizerContext *context_;
-  WithQueriesInfo with_queries_info_;
-
-  logical::LogicalPtr logical_plan_;
-
-  DISALLOW_COPY_AND_ASSIGN(Resolver);
-};
-
-/** @} */
-
-}  // namespace resolver
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_QUERY_OPTIMIZER_RESOLVER_RESOLVER_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/rules/AttachLIPFilters.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/rules/AttachLIPFilters.cpp b/query_optimizer/rules/AttachLIPFilters.cpp
deleted file mode 100644
index b3c57ab..0000000
--- a/query_optimizer/rules/AttachLIPFilters.cpp
+++ /dev/null
@@ -1,253 +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/rules/AttachLIPFilters.hpp"
-
-#include <map>
-#include <set>
-#include <unordered_set>
-#include <unordered_map>
-#include <vector>
-#include <utility>
-
-#include "query_optimizer/cost_model/StarSchemaSimpleCostModel.hpp"
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "query_optimizer/physical/LIPFilterConfiguration.hpp"
-#include "query_optimizer/physical/Aggregate.hpp"
-#include "query_optimizer/physical/HashJoin.hpp"
-#include "query_optimizer/physical/PatternMatcher.hpp"
-#include "query_optimizer/physical/Physical.hpp"
-#include "query_optimizer/physical/PhysicalType.hpp"
-#include "query_optimizer/physical/Selection.hpp"
-#include "query_optimizer/physical/TopLevelPlan.hpp"
-#include "types/TypedValue.hpp"
-#include "utility/lip_filter/LIPFilter.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-namespace optimizer {
-
-namespace E = ::quickstep::optimizer::expressions;
-namespace P = ::quickstep::optimizer::physical;
-
-P::PhysicalPtr AttachLIPFilters::apply(const P::PhysicalPtr &input) {
-  DCHECK(input->getPhysicalType() == P::PhysicalType::kTopLevelPlan);
-
-  const P::TopLevelPlanPtr top_level_plan =
-     std::static_pointer_cast<const P::TopLevelPlan>(input);
-  cost_model_.reset(
-      new cost::StarSchemaSimpleCostModel(
-          top_level_plan->shared_subplans()));
-  lip_filter_configuration_.reset(new P::LIPFilterConfiguration());
-
-  std::set<E::ExprId> already_filtered_attributes;
-  attachLIPFilters(NodeList(input), &already_filtered_attributes);
-
-  P::PhysicalPtr output;
-  if (!lip_filter_configuration_->getBuildInfoMap().empty() ||
-      !lip_filter_configuration_->getProbeInfoMap().empty()) {
-    output = top_level_plan->copyWithLIPFilterConfiguration(
-        P::LIPFilterConfigurationPtr(lip_filter_configuration_.release()));
-  } else {
-    output = input;
-  }
-  return output;
-}
-
-void AttachLIPFilters::attachLIPFilters(
-    const NodeList &path,
-    std::set<expressions::ExprId> *already_filtered_attributes) {
-  const P::PhysicalPtr &node = path.node;
-
-  // First process child nodes
-  for (const auto &child : node->children()) {
-    std::set<E::ExprId> child_filtered_attributes;
-    attachLIPFilters(path.cons(child), &child_filtered_attributes);
-    already_filtered_attributes->insert(child_filtered_attributes.begin(),
-                                        child_filtered_attributes.end());
-  }
-
-  // Attach LIP filters to HashJoin/Selection/Aggregate nodes
-  P::PhysicalPtr probe_child = nullptr;
-  switch (node->getPhysicalType()) {
-    case P::PhysicalType::kHashJoin:
-      probe_child = std::static_pointer_cast<const P::HashJoin>(node)->left();
-      break;
-    case P::PhysicalType::kSelection:
-      probe_child = std::static_pointer_cast<const P::Selection>(node)->input();
-      break;
-    case P::PhysicalType::kAggregate:
-      probe_child = std::static_pointer_cast<const P::Aggregate>(node)->input();
-      break;
-    default:
-      break;
-  }
-
-  if (probe_child != nullptr &&
-      cost_model_->estimateCardinality(probe_child) > 10000000) {
-    const auto &candidate_lip_filters = getProbeSideInfo(path.cons(probe_child));
-    if (!candidate_lip_filters.empty()) {
-      std::map<E::AttributeReferencePtr, LIPFilterInfoPtr> selected_filters;
-      for (const auto &info : candidate_lip_filters) {
-        auto it = selected_filters.find(info->attribute);
-        if (it == selected_filters.end()) {
-          selected_filters.emplace(info->attribute, info);
-        } else if (LIPFilterInfo::isBetterThan(*info, *it->second)) {
-          it->second = info;
-        }
-      }
-
-      for (const auto &pair : selected_filters) {
-        const E::ExprId source_attr_id = pair.second->source_attribute->id();
-        if (already_filtered_attributes->find(source_attr_id)
-                == already_filtered_attributes->end()) {
-          lip_filter_configuration_->addBuildInfo(
-              pair.second->source_attribute,
-              pair.second->source,
-              pair.second->estimated_cardinality * 8,
-              LIPFilterType::kSingleIdentityHashFilter);
-          lip_filter_configuration_->addProbeInfo(
-              pair.first,
-              node,
-              pair.second->source_attribute,
-              pair.second->source);
-          already_filtered_attributes->emplace(source_attr_id);
-        }
-      }
-    }
-  }
-}
-
-const std::vector<AttachLIPFilters::LIPFilterInfoPtr>& AttachLIPFilters
-    ::getBuildSideInfo(const NodeList &path) {
-  const P::PhysicalPtr &node = path.node;
-  if (build_side_info_.find(node) == build_side_info_.end()) {
-    std::vector<LIPFilterInfoPtr> lip_filters;
-
-    // 1. Gather candidate LIP filters propagated from descendant nodes.
-    std::unordered_set<E::ExprId> output_attribute_ids;
-    for (const auto &attr : node->getOutputAttributes()) {
-      output_attribute_ids.emplace(attr->id());
-    }
-    switch (node->getPhysicalType()) {
-      case P::PhysicalType::kAggregate:
-      case P::PhysicalType::kSelection:
-      case P::PhysicalType::kHashJoin: {
-        for (const P::PhysicalPtr &child : node->children()) {
-          for (const LIPFilterInfoPtr &info : getBuildSideInfo(path.cons(child))) {
-            lip_filters.emplace_back(info);
-          }
-        }
-        break;
-      }
-      default:
-        break;
-    }
-
-    // 2. Consider the parent physical node. If it is a HashJoin,
-    // then each build-side join attribute is a candidate LIP filter
-    // which can be built by the BuildHashOperator that corresponds
-    // to the parent HashJoin node.
-    P::HashJoinPtr hash_join;
-    if (path.cdr() != nullptr &&
-        P::SomeHashJoin::MatchesWithConditionalCast(path.cdr()->node, &hash_join)) {
-      const P::PhysicalPtr &build_node = hash_join->right();
-      // TODO(jianqiao): consider probe-side info to allow cascading propagation.
-      double selectivity = cost_model_->estimateSelectivity(build_node);
-      // Only consider attributes that are selective.
-      if (selectivity < 1.0) {
-        std::size_t cardinality = cost_model_->estimateCardinality(build_node);
-        for (const auto &attr : hash_join->right_join_attributes()) {
-          // NOTE(jianqiao): currently we only consider attributes of primitive
-          // fixed-length types.
-          if (TypedValue::HashIsReversible(attr->getValueType().getTypeID())) {
-            lip_filters.emplace_back(
-                std::make_shared<LIPFilterInfo>(attr,
-                                                path.cdr()->node,
-                                                path.depth,
-                                                selectivity,
-                                                cardinality));
-          }
-        }
-      }
-    }
-    build_side_info_.emplace(node, std::move(lip_filters));
-  }
-  return build_side_info_.at(node);
-}
-
-const std::vector<AttachLIPFilters::LIPFilterInfoPtr>& AttachLIPFilters
-    ::getProbeSideInfo(const NodeList &path) {
-  const P::PhysicalPtr &node = path.node;
-  if (probe_side_info_.find(node) == probe_side_info_.end()) {
-    std::vector<LIPFilterInfoPtr> lip_filters;
-    if (path.cdr() != nullptr) {
-      // 1. Gather candidate LIP filters propagated from ancestor nodes.
-      const auto &parent_lip_filters = getProbeSideInfo(*path.cdr());
-      if (!parent_lip_filters.empty()) {
-        std::unordered_set<E::ExprId> output_attribute_ids;
-        for (const auto &attr : node->getOutputAttributes()) {
-          output_attribute_ids.emplace(attr->id());
-        }
-        for (const auto &info : parent_lip_filters) {
-          if (output_attribute_ids.find(info->attribute->id()) != output_attribute_ids.end()) {
-            lip_filters.emplace_back(info);
-          }
-        }
-      }
-
-      // 2. Consider the parent physical node. If it is an InnerHashJoin or
-      // LeftSemiHashJoin, then we can propagate the build-side LIP filters
-      // to the probe-side.
-      P::HashJoinPtr hash_join;
-      if (P::SomeHashJoin::MatchesWithConditionalCast(path.cdr()->node, &hash_join) &&
-          (hash_join->join_type() == P::HashJoin::JoinType::kInnerJoin ||
-           hash_join->join_type() == P::HashJoin::JoinType::kLeftSemiJoin)) {
-        const P::PhysicalPtr &build_side_child = hash_join->right();
-        std::unordered_map<E::ExprId, E::AttributeReferencePtr> join_attribute_pairs;
-        for (std::size_t i = 0; i < hash_join->left_join_attributes().size(); ++i) {
-          const E::AttributeReferencePtr probe_side_join_attribute =
-              hash_join->left_join_attributes()[i];
-          const E::AttributeReferencePtr build_side_join_attribute =
-              hash_join->right_join_attributes()[i];
-          join_attribute_pairs.emplace(build_side_join_attribute->id(),
-                                       probe_side_join_attribute);
-        }
-        for (const auto &info : getBuildSideInfo(path.cdr()->cons(build_side_child))) {
-          const auto pair_it = join_attribute_pairs.find(info->attribute->id());
-          if (pair_it != join_attribute_pairs.end()) {
-            lip_filters.emplace_back(
-                std::make_shared<LIPFilterInfo>(pair_it->second,
-                                                info->source,
-                                                info->depth,
-                                                info->estimated_selectivity,
-                                                info->estimated_cardinality,
-                                                info->attribute));
-          }
-        }
-      }
-    }
-    probe_side_info_.emplace(node, std::move(lip_filters));
-  }
-  return probe_side_info_.at(node);
-}
-
-}  // namespace optimizer
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/rules/AttachLIPFilters.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/rules/AttachLIPFilters.hpp b/query_optimizer/rules/AttachLIPFilters.hpp
deleted file mode 100644
index b8cfc39..0000000
--- a/query_optimizer/rules/AttachLIPFilters.hpp
+++ /dev/null
@@ -1,151 +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_RULES_ATTACH_LIP_FILTERS_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_RULES_ATTACH_LIP_FILTERS_HPP_
-
-#include <cstddef>
-#include <map>
-#include <memory>
-#include <set>
-#include <string>
-#include <vector>
-
-#include "query_optimizer/cost_model/StarSchemaSimpleCostModel.hpp"
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "query_optimizer/expressions/ExprId.hpp"
-#include "query_optimizer/physical/LIPFilterConfiguration.hpp"
-#include "query_optimizer/physical/Physical.hpp"
-#include "query_optimizer/rules/Rule.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-namespace optimizer {
-
-/** \addtogroup OptimizerRules
- *  @{
- */
-
-/**
- * @brief Rule that applies to a physical plan to attach LIPFilters.
- */
-class AttachLIPFilters : public Rule<physical::Physical> {
- public:
-  /**
-   * @brief Constructor.
-   */
-  AttachLIPFilters() {}
-
-  ~AttachLIPFilters() override {}
-
-  std::string getName() const override {
-    return "AttachLIPFilters";
-  }
-
-  physical::PhysicalPtr apply(const physical::PhysicalPtr &input) override;
-
- private:
-  /**
-   * @brief Internal data structure for passing around LIPFilter information.
-   */
-  struct LIPFilterInfo {
-    LIPFilterInfo(const expressions::AttributeReferencePtr &attribute_in,
-                  const physical::PhysicalPtr &source_in,
-                  const int depth_in,
-                  const double estimated_selectivity_in,
-                  const std::size_t estimated_cardinality_in,
-                  const expressions::AttributeReferencePtr &source_attribute_in = nullptr)
-        : attribute(attribute_in),
-          source(source_in),
-          depth(depth_in),
-          estimated_selectivity(estimated_selectivity_in),
-          estimated_cardinality(estimated_cardinality_in),
-          source_attribute(
-              source_attribute_in == nullptr
-                  ? attribute_in
-                  : source_attribute_in) {}
-
-    static bool isBetterThan(const LIPFilterInfo &a, const LIPFilterInfo &b) {
-      if (a.estimated_selectivity == b.estimated_selectivity) {
-        return a.depth > b.depth;
-      } else {
-        return a.estimated_selectivity < b.estimated_selectivity;
-      }
-    }
-
-    expressions::AttributeReferencePtr attribute;
-    physical::PhysicalPtr source;
-    int depth;
-    double estimated_selectivity;
-    std::size_t estimated_cardinality;
-    expressions::AttributeReferencePtr source_attribute;
-  };
-
-  typedef std::shared_ptr<const LIPFilterInfo> LIPFilterInfoPtr;
-
-  /**
-   * @brief Functional list data structure for internal use.
-   */
-  struct NodeList {
-    explicit NodeList(const physical::PhysicalPtr &node_in)
-        : node(node_in),
-          next(nullptr),
-          depth(0) {}
-
-    NodeList(const physical::PhysicalPtr &node_in,
-             const NodeList *next_in,
-             const int depth_in)
-        : node(node_in),
-          next(next_in),
-          depth(depth_in) {}
-
-    inline const NodeList *cdr() const {
-      return next;
-    }
-
-    inline const NodeList cons(const physical::PhysicalPtr &new_node) const {
-      return NodeList(new_node, this, depth+1);
-    }
-
-    const physical::PhysicalPtr node;
-    const NodeList *next;
-    const int depth;
-  };
-
-  void attachLIPFilters(const NodeList &path,
-                        std::set<expressions::ExprId> *already_filtered_attributes);
-
-  const std::vector<LIPFilterInfoPtr>& getBuildSideInfo(const NodeList &path);
-
-  const std::vector<LIPFilterInfoPtr>& getProbeSideInfo(const NodeList &path);
-
-  std::unique_ptr<cost::StarSchemaSimpleCostModel> cost_model_;
-  std::map<physical::PhysicalPtr, std::vector<LIPFilterInfoPtr>> build_side_info_;
-  std::map<physical::PhysicalPtr, std::vector<LIPFilterInfoPtr>> probe_side_info_;
-  std::unique_ptr<physical::LIPFilterConfiguration> lip_filter_configuration_;
-
-  DISALLOW_COPY_AND_ASSIGN(AttachLIPFilters);
-};
-
-/** @} */
-
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_QUERY_OPTIMIZER_RULES_ATTACH_LIP_FILTERS_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/rules/BottomUpRule.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/rules/BottomUpRule.hpp b/query_optimizer/rules/BottomUpRule.hpp
deleted file mode 100644
index 53dff0d..0000000
--- a/query_optimizer/rules/BottomUpRule.hpp
+++ /dev/null
@@ -1,104 +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_RULES_BOTTOM_UP_RULE_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_RULES_BOTTOM_UP_RULE_HPP_
-
-#include <memory>
-#include <vector>
-
-#include "query_optimizer/rules/Rule.hpp"
-#include "utility/Macros.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-namespace optimizer {
-
-/** \addtogroup OptimizerRules
- *  @{
- */
-
-/**
- * @brief Base class for a rule that performs a bottom-up traverse on a tree.
- */
-template <class TreeType>
-class BottomUpRule : public Rule<TreeType> {
- public:
-  typedef std::shared_ptr<const TreeType> TreeNodePtr;
-
-  /**
-   * @brief Constructor.
-   */
-  BottomUpRule() {}
-
-  /**
-   * @brief Destructor.
-   */
-  ~BottomUpRule() override {}
-
-  TreeNodePtr apply(const TreeNodePtr &tree) override {
-    DCHECK(tree != nullptr);
-
-    init(tree);
-    std::vector<std::shared_ptr<const TreeType>> new_children;
-    bool has_changed_children = false;
-    for (const std::shared_ptr<const TreeType> &child : tree->children()) {
-      std::shared_ptr<const TreeType> new_child = apply(child);
-      if (child != new_child && !has_changed_children) {
-        has_changed_children = true;
-      }
-      new_children.push_back(new_child);
-    }
-
-    if (has_changed_children) {
-      return applyToNode(tree->copyWithNewChildren(new_children));
-    } else {
-      return applyToNode(tree);
-    }
-  }
-
- protected:
-  /**
-   * @brief Applies the rule to a single node, not the entire tree.
-   *
-   * @param node The node to apply the rule to.
-   * @param The updated node by the rule.
-   */
-  virtual TreeNodePtr applyToNode(const TreeNodePtr &node) = 0;
-
-  /**
-   * @brief Override this method to implement the initialization code
-   *        for the rule.
-   *
-   * @param input The input tree.
-   */
-  virtual void init(const TreeNodePtr &input) {
-  }
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(BottomUpRule);
-};
-
-/** @} */
-
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_QUERY_OPTIMIZER_RULES_BOTTOM_UP_RULE_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/rules/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/query_optimizer/rules/CMakeLists.txt b/query_optimizer/rules/CMakeLists.txt
deleted file mode 100644
index 7fffadc..0000000
--- a/query_optimizer/rules/CMakeLists.txt
+++ /dev/null
@@ -1,222 +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.
-
-add_subdirectory(tests)
-
-# Declare micro-libs:
-add_library(quickstep_queryoptimizer_rules_AttachLIPFilters AttachLIPFilters.cpp AttachLIPFilters.hpp)
-add_library(quickstep_queryoptimizer_rules_BottomUpRule ../../empty_src.cpp BottomUpRule.hpp)
-add_library(quickstep_queryoptimizer_rules_CollapseProject CollapseProject.cpp CollapseProject.hpp)
-add_library(quickstep_queryoptimizer_rules_GenerateJoins GenerateJoins.cpp GenerateJoins.hpp)
-add_library(quickstep_queryoptimizer_rules_PruneColumns PruneColumns.cpp PruneColumns.hpp)
-add_library(quickstep_queryoptimizer_rules_PushDownFilter PushDownFilter.cpp PushDownFilter.hpp)
-add_library(quickstep_queryoptimizer_rules_PushDownSemiAntiJoin PushDownSemiAntiJoin.cpp PushDownSemiAntiJoin.hpp)
-add_library(quickstep_queryoptimizer_rules_Rule ../../empty_src.cpp Rule.hpp)
-add_library(quickstep_queryoptimizer_rules_RuleHelper RuleHelper.cpp RuleHelper.hpp)
-add_library(quickstep_queryoptimizer_rules_StarSchemaHashJoinOrderOptimization
-            StarSchemaHashJoinOrderOptimization.cpp
-            StarSchemaHashJoinOrderOptimization.hpp)
-add_library(quickstep_queryoptimizer_rules_SwapProbeBuild SwapProbeBuild.cpp SwapProbeBuild.hpp)
-add_library(quickstep_queryoptimizer_rules_TopDownRule ../../empty_src.cpp TopDownRule.hpp)
-add_library(quickstep_queryoptimizer_rules_UpdateExpression UpdateExpression.cpp UpdateExpression.hpp)
-add_library(quickstep_queryoptimizer_rules_UnnestSubqueries UnnestSubqueries.cpp UnnestSubqueries.hpp)
-
-
-# Link dependencies:
-target_link_libraries(quickstep_queryoptimizer_rules_AttachLIPFilters
-                      quickstep_queryoptimizer_costmodel_StarSchemaSimpleCostModel
-                      quickstep_queryoptimizer_expressions_AttributeReference
-                      quickstep_queryoptimizer_expressions_ExprId
-                      quickstep_queryoptimizer_physical_Aggregate
-                      quickstep_queryoptimizer_physical_HashJoin
-                      quickstep_queryoptimizer_physical_LIPFilterConfiguration
-                      quickstep_queryoptimizer_physical_PatternMatcher
-                      quickstep_queryoptimizer_physical_Physical
-                      quickstep_queryoptimizer_physical_PhysicalType
-                      quickstep_queryoptimizer_physical_Selection
-                      quickstep_queryoptimizer_physical_TopLevelPlan
-                      quickstep_queryoptimizer_rules_Rule
-                      quickstep_types_TypedValue
-                      quickstep_utility_Macros
-                      quickstep_utility_lipfilter_LIPFilter)
-target_link_libraries(quickstep_queryoptimizer_rules_BottomUpRule
-                      glog
-                      quickstep_queryoptimizer_rules_Rule
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_rules_CollapseProject
-                      glog
-                      quickstep_queryoptimizer_expressions_NamedExpression
-                      quickstep_queryoptimizer_logical_Logical
-                      quickstep_queryoptimizer_logical_PatternMatcher
-                      quickstep_queryoptimizer_logical_Project
-                      quickstep_queryoptimizer_rules_BottomUpRule
-                      quickstep_queryoptimizer_rules_Rule
-                      quickstep_queryoptimizer_rules_RuleHelper
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_rules_GenerateJoins
-                      glog
-                      quickstep_queryoptimizer_expressions_AttributeReference
-                      quickstep_queryoptimizer_expressions_ComparisonExpression
-                      quickstep_queryoptimizer_expressions_ExpressionUtil
-                      quickstep_queryoptimizer_expressions_LogicalAnd
-                      quickstep_queryoptimizer_expressions_PatternMatcher
-                      quickstep_queryoptimizer_expressions_Predicate
-                      quickstep_queryoptimizer_logical_Filter
-                      quickstep_queryoptimizer_logical_HashJoin
-                      quickstep_queryoptimizer_logical_Logical
-                      quickstep_queryoptimizer_logical_MultiwayCartesianJoin
-                      quickstep_queryoptimizer_logical_NestedLoopsJoin
-                      quickstep_queryoptimizer_logical_PatternMatcher
-                      quickstep_queryoptimizer_rules_Rule
-                      quickstep_queryoptimizer_rules_RuleHelper
-                      quickstep_queryoptimizer_rules_TopDownRule
-                      quickstep_types_operations_comparisons_ComparisonFactory
-                      quickstep_types_operations_comparisons_ComparisonID
-                      quickstep_utility_Macros
-                      quickstep_utility_SqlError
-                      quickstep_utility_VectorUtil)
-target_link_libraries(quickstep_queryoptimizer_rules_PruneColumns
-                      quickstep_queryoptimizer_expressions_AttributeReference
-                      quickstep_queryoptimizer_expressions_ExpressionUtil
-                      quickstep_queryoptimizer_expressions_NamedExpression
-                      quickstep_queryoptimizer_physical_PatternMatcher
-                      quickstep_queryoptimizer_physical_Physical
-                      quickstep_queryoptimizer_rules_Rule
-                      quickstep_queryoptimizer_rules_TopDownRule
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_rules_PushDownFilter
-                      glog
-                      quickstep_queryoptimizer_expressions_AttributeReference
-                      quickstep_queryoptimizer_expressions_ExpressionUtil
-                      quickstep_queryoptimizer_logical_Filter
-                      quickstep_queryoptimizer_logical_HashJoin
-                      quickstep_queryoptimizer_logical_Logical
-                      quickstep_queryoptimizer_logical_PatternMatcher
-                      quickstep_queryoptimizer_rules_Rule
-                      quickstep_queryoptimizer_rules_RuleHelper
-                      quickstep_queryoptimizer_rules_TopDownRule
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_rules_PushDownSemiAntiJoin
-                      quickstep_queryoptimizer_expressions_AttributeReference
-                      quickstep_queryoptimizer_expressions_ExpressionUtil
-                      quickstep_queryoptimizer_logical_HashJoin
-                      quickstep_queryoptimizer_logical_Logical
-                      quickstep_queryoptimizer_logical_PatternMatcher
-                      quickstep_queryoptimizer_rules_TopDownRule
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_rules_Rule
-                      glog
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_rules_RuleHelper
-                      quickstep_queryoptimizer_expressions_Alias
-                      quickstep_queryoptimizer_expressions_AttributeReference
-                      quickstep_queryoptimizer_expressions_ExprId
-                      quickstep_queryoptimizer_expressions_Expression
-                      quickstep_queryoptimizer_expressions_LogicalAnd
-                      quickstep_queryoptimizer_expressions_NamedExpression
-                      quickstep_queryoptimizer_expressions_PatternMatcher
-                      quickstep_queryoptimizer_expressions_Predicate
-                      quickstep_queryoptimizer_rules_UpdateExpression)
-target_link_libraries(quickstep_queryoptimizer_rules_StarSchemaHashJoinOrderOptimization
-                      quickstep_queryoptimizer_costmodel_StarSchemaSimpleCostModel
-                      quickstep_queryoptimizer_expressions_AttributeReference
-                      quickstep_queryoptimizer_expressions_ExprId
-                      quickstep_queryoptimizer_expressions_NamedExpression
-                      quickstep_queryoptimizer_expressions_PatternMatcher
-                      quickstep_queryoptimizer_expressions_Predicate
-                      quickstep_queryoptimizer_physical_Aggregate
-                      quickstep_queryoptimizer_physical_HashJoin
-                      quickstep_queryoptimizer_physical_PatternMatcher
-                      quickstep_queryoptimizer_physical_Physical
-                      quickstep_queryoptimizer_physical_PhysicalType
-                      quickstep_queryoptimizer_physical_TopLevelPlan
-                      quickstep_queryoptimizer_rules_Rule
-                      quickstep_utility_DisjointTreeForest
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_rules_SwapProbeBuild
-                      quickstep_queryoptimizer_costmodel_SimpleCostModel
-                      quickstep_queryoptimizer_expressions_AttributeReference
-                      quickstep_queryoptimizer_physical_HashJoin
-                      quickstep_queryoptimizer_physical_PatternMatcher
-                      quickstep_queryoptimizer_physical_Physical
-                      quickstep_queryoptimizer_physical_TopLevelPlan
-                      quickstep_queryoptimizer_rules_BottomUpRule
-                      quickstep_queryoptimizer_rules_Rule
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_rules_TopDownRule
-                      quickstep_queryoptimizer_rules_Rule
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_rules_UnnestSubqueries
-                      quickstep_queryoptimizer_OptimizerContext
-                      quickstep_queryoptimizer_expressions_AttributeReference
-                      quickstep_queryoptimizer_expressions_ComparisonExpression
-                      quickstep_queryoptimizer_expressions_Exists
-                      quickstep_queryoptimizer_expressions_ExprId
-                      quickstep_queryoptimizer_expressions_Expression
-                      quickstep_queryoptimizer_expressions_ExpressionType
-                      quickstep_queryoptimizer_expressions_ExpressionUtil
-                      quickstep_queryoptimizer_expressions_InTableQuery
-                      quickstep_queryoptimizer_expressions_LogicalAnd
-                      quickstep_queryoptimizer_expressions_LogicalNot
-                      quickstep_queryoptimizer_expressions_LogicalOr
-                      quickstep_queryoptimizer_expressions_NamedExpression
-                      quickstep_queryoptimizer_expressions_PatternMatcher
-                      quickstep_queryoptimizer_expressions_Predicate
-                      quickstep_queryoptimizer_expressions_SubqueryExpression
-                      quickstep_queryoptimizer_logical_Aggregate
-                      quickstep_queryoptimizer_logical_Filter
-                      quickstep_queryoptimizer_logical_HashJoin
-                      quickstep_queryoptimizer_logical_Logical
-                      quickstep_queryoptimizer_logical_LogicalType
-                      quickstep_queryoptimizer_logical_MultiwayCartesianJoin
-                      quickstep_queryoptimizer_logical_PatternMatcher
-                      quickstep_queryoptimizer_logical_Project
-                      quickstep_queryoptimizer_logical_TopLevelPlan
-                      quickstep_queryoptimizer_rules_BottomUpRule
-                      quickstep_queryoptimizer_rules_Rule
-                      quickstep_types_operations_comparisons_Comparison
-                      quickstep_types_operations_comparisons_ComparisonFactory
-                      quickstep_types_operations_comparisons_ComparisonID
-                      quickstep_utility_Macros
-                      quickstep_utility_SqlError)
-target_link_libraries(quickstep_queryoptimizer_rules_UpdateExpression
-                      glog
-                      quickstep_queryoptimizer_expressions_ExprId
-                      quickstep_queryoptimizer_expressions_Expression
-                      quickstep_queryoptimizer_expressions_NamedExpression
-                      quickstep_queryoptimizer_expressions_PatternMatcher
-                      quickstep_queryoptimizer_rules_BottomUpRule
-                      quickstep_queryoptimizer_rules_Rule
-                      quickstep_utility_Macros)
-
-# Module all-in-one library:
-add_library(quickstep_queryoptimizer_rules ../../empty_src.cpp OptimizerRulesModule.hpp)
-target_link_libraries(quickstep_queryoptimizer_rules
-                      quickstep_queryoptimizer_rules_AttachLIPFilters
-                      quickstep_queryoptimizer_rules_BottomUpRule
-                      quickstep_queryoptimizer_rules_CollapseProject
-                      quickstep_queryoptimizer_rules_GenerateJoins
-                      quickstep_queryoptimizer_rules_PruneColumns
-                      quickstep_queryoptimizer_rules_PushDownFilter
-                      quickstep_queryoptimizer_rules_PushDownSemiAntiJoin
-                      quickstep_queryoptimizer_rules_Rule
-                      quickstep_queryoptimizer_rules_RuleHelper
-                      quickstep_queryoptimizer_rules_StarSchemaHashJoinOrderOptimization
-                      quickstep_queryoptimizer_rules_SwapProbeBuild
-                      quickstep_queryoptimizer_rules_TopDownRule
-                      quickstep_queryoptimizer_rules_UpdateExpression
-                      quickstep_queryoptimizer_rules_UnnestSubqueries)

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/rules/CollapseProject.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/rules/CollapseProject.cpp b/query_optimizer/rules/CollapseProject.cpp
deleted file mode 100644
index 31aba17..0000000
--- a/query_optimizer/rules/CollapseProject.cpp
+++ /dev/null
@@ -1,60 +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/rules/CollapseProject.hpp"
-
-#include <vector>
-
-#include "query_optimizer/expressions/NamedExpression.hpp"
-#include "query_optimizer/logical/Logical.hpp"
-#include "query_optimizer/logical/PatternMatcher.hpp"
-#include "query_optimizer/logical/Project.hpp"
-#include "query_optimizer/rules/Rule.hpp"
-#include "query_optimizer/rules/RuleHelper.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-namespace optimizer {
-
-namespace E = ::quickstep::optimizer::expressions;
-namespace L = ::quickstep::optimizer::logical;
-
-L::LogicalPtr CollapseProject::applyToNode(const L::LogicalPtr &input) {
-  L::ProjectPtr project;
-  L::ProjectPtr child_project;
-
-  if (L::SomeProject::MatchesWithConditionalCast(input, &project) &&
-      L::SomeProject::MatchesWithConditionalCast(project->input(), &child_project)) {
-    std::vector<E::NamedExpressionPtr> project_expressions =
-        project->project_expressions();
-    PullUpProjectExpressions(child_project->project_expressions(),
-                             {} /* non_project_expression_lists */,
-                             {&project_expressions} /* project_expression_lists */);
-    L::LogicalPtr output = L::Project::Create(child_project->input(), project_expressions);
-    LOG_APPLYING_RULE(input, output);
-    return output;
-  }
-
-  LOG_IGNORING_RULE(input);
-  return input;
-}
-
-}  // namespace optimizer
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/rules/CollapseProject.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/rules/CollapseProject.hpp b/query_optimizer/rules/CollapseProject.hpp
deleted file mode 100644
index bd1a991..0000000
--- a/query_optimizer/rules/CollapseProject.hpp
+++ /dev/null
@@ -1,58 +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_RULES_COLLAPSE_PROJECT_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_RULES_COLLAPSE_PROJECT_HPP_
-
-#include <string>
-#include <vector>
-
-#include "query_optimizer/logical/Logical.hpp"
-#include "query_optimizer/rules/BottomUpRule.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-namespace optimizer {
-
-/** \addtogroup OptimizerRules
- *  @{
- */
-
-/**
- * @brief Merges nested Projects into one single Project.
- */
-class CollapseProject : public BottomUpRule<logical::Logical> {
- public:
-  CollapseProject() {}
-
-  std::string getName() const override { return "CollapseProject"; }
-
- protected:
-  logical::LogicalPtr applyToNode(const logical::LogicalPtr &input) override;
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(CollapseProject);
-};
-
-/** @} */
-
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_QUERY_OPTIMIZER_RULES_COLLAPSE_PROJECT_HPP_ */


[16/51] [abbrv] [partial] incubator-quickstep git commit: remove c++ files

Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_execution/tests/QueryManagerSingleNode_unittest.cpp
----------------------------------------------------------------------
diff --git a/query_execution/tests/QueryManagerSingleNode_unittest.cpp b/query_execution/tests/QueryManagerSingleNode_unittest.cpp
deleted file mode 100644
index f65ec53..0000000
--- a/query_execution/tests/QueryManagerSingleNode_unittest.cpp
+++ /dev/null
@@ -1,890 +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 <climits>
-#include <memory>
-#include <string>
-#include <utility>
-#include <vector>
-
-#include "catalog/CatalogDatabase.hpp"
-#include "catalog/CatalogRelation.hpp"
-#include "catalog/CatalogTypedefs.hpp"
-#include "query_execution/QueryContext.hpp"
-#include "query_execution/QueryContext.pb.h"
-#include "query_execution/QueryExecutionState.hpp"
-#include "query_execution/QueryExecutionTypedefs.hpp"
-#include "query_execution/QueryManagerSingleNode.hpp"
-#include "query_execution/WorkOrdersContainer.hpp"
-#include "query_execution/WorkerDirectory.hpp"
-#include "query_execution/WorkerMessage.hpp"
-#include "query_optimizer/QueryHandle.hpp"
-#include "query_optimizer/QueryPlan.hpp"
-#include "relational_operators/RelationalOperator.hpp"
-#include "relational_operators/WorkOrder.hpp"
-#include "storage/InsertDestination.hpp"
-#include "storage/InsertDestination.pb.h"
-#include "storage/StorageBlock.hpp"
-#include "storage/StorageBlockInfo.hpp"
-#include "storage/StorageManager.hpp"
-#include "utility/DAG.hpp"
-#include "utility/Macros.hpp"
-
-#include "glog/logging.h"
-#include "gtest/gtest.h"
-
-#include "tmb/id_typedefs.h"
-
-namespace tmb { class MessageBus; }
-
-using std::move;
-using std::unique_ptr;
-using std::vector;
-
-using tmb::client_id;
-
-namespace quickstep {
-
-class WorkOrderProtosContainer;
-
-class MockWorkOrder : public WorkOrder {
- public:
-  explicit MockWorkOrder(const int op_index)
-      : WorkOrder(0), op_index_(op_index) {}
-
-  void execute() override {
-    VLOG(3) << "WorkOrder[" << op_index_ << "] executing.";
-  }
-
-  inline QueryPlan::DAGNodeIndex getOpIndex() const {
-    return op_index_;
-  }
-
- private:
-  const QueryPlan::DAGNodeIndex op_index_;
-
-  DISALLOW_COPY_AND_ASSIGN(MockWorkOrder);
-};
-
-class MockOperator: public RelationalOperator {
- public:
-  enum function_name {
-    kFeedInputBlock = 0,
-    kFeedInputBlocks,
-    kDoneFeedingInputBlocks,
-    kGetAllWorkOrders
-  };
-
-  MockOperator(const bool produce_workorders,
-               const bool has_streaming_input,
-               const int max_getworkorder_iters = 1,
-               const int max_workorders = INT_MAX)
-      : RelationalOperator(0 /* Query Id */),
-        produce_workorders_(produce_workorders),
-        has_streaming_input_(has_streaming_input),
-        max_workorders_(max_workorders),
-        max_getworkorder_iters_(max_getworkorder_iters),
-        num_calls_get_workorders_(0),
-        num_workorders_generated_(0),
-        num_calls_feedblock_(0),
-        num_calls_feedblocks_(0),
-        num_calls_donefeedingblocks_(0) {
-  }
-
-  std::string getName() const override {
-    return "MockOperator";
-  }
-
-#define MOCK_OP_LOG(x) VLOG(x) << "Op[" << op_index_ << "]: " << __func__ << ": "
-
-  // The methods below are used to check whether QueryManager calls the Relational
-  // operator, how many times it calls a particular method etc.
-  inline int getNumWorkOrders() const {
-    return num_workorders_generated_;
-  }
-
-  inline int getNumCalls(const function_name fname) const {
-    switch (fname) {
-      case kFeedInputBlock:
-        return num_calls_feedblock_;
-      case kFeedInputBlocks:
-        return num_calls_feedblocks_;
-      case kDoneFeedingInputBlocks:
-        return num_calls_donefeedingblocks_;
-      case kGetAllWorkOrders:
-        return num_calls_get_workorders_;
-      default:
-        return -1;
-    }
-  }
-
-  inline bool getBlockingDependenciesMet() const {
-    MOCK_OP_LOG(3) << "met.";
-    return blocking_dependencies_met_;
-  }
-
-  void setInsertDestinationID(const QueryContext::insert_destination_id insert_destination_index) {
-    insert_destination_index_ = insert_destination_index;
-  }
-
-  // Mock to trigger doneFeedingInputBlocks for the dependent operators
-  // in QueryManager::markOperatorFinished.
-  void setOutputRelationID(const relation_id rel_id) {
-    output_relation_id_ = rel_id;
-  }
-
-  // Override methods from the base class.
-  bool getAllWorkOrders(
-      WorkOrdersContainer *container,
-      QueryContext *query_context,
-      StorageManager *storage_manager,
-      const tmb::client_id foreman_client_id,
-      tmb::MessageBus *bus) override {
-    ++num_calls_get_workorders_;
-    if (produce_workorders_) {
-      if (has_streaming_input_) {
-        if ((num_calls_feedblock_ > 0 || num_calls_feedblocks_ > 0) && (num_workorders_generated_ < max_workorders_)) {
-          MOCK_OP_LOG(3) << "[stream] generate WorkOrder";
-          container->addNormalWorkOrder(new MockWorkOrder(op_index_), op_index_);
-          ++num_workorders_generated_;
-        }
-      } else {
-        if (blocking_dependencies_met_ && (num_workorders_generated_ < max_workorders_)) {
-          MOCK_OP_LOG(3) << "[static] generate WorkOrder";
-          container->addNormalWorkOrder(new MockWorkOrder(op_index_), op_index_);
-          ++num_workorders_generated_;
-        }
-      }
-    }
-    MOCK_OP_LOG(3) << "count(" << num_calls_get_workorders_ << ") "
-                   << "return(" << (num_calls_get_workorders_ == max_getworkorder_iters_) << ")";
-    return num_calls_get_workorders_ == max_getworkorder_iters_;
-  }
-
-  bool getAllWorkOrderProtos(WorkOrderProtosContainer *container) override {
-    return true;
-  }
-
-  void feedInputBlock(const block_id input_block_id,
-                      const relation_id input_relation_id) override {
-    ++num_calls_feedblock_;
-    MOCK_OP_LOG(3) << "count(" << num_calls_feedblock_ << ")";
-  }
-
-  void feedInputBlocks(const relation_id rel_id,
-                       std::vector<block_id> *partially_filled_blocks) override {
-    ++num_calls_feedblocks_;
-    MOCK_OP_LOG(3) << "count(" << num_calls_feedblocks_ << ")";
-  }
-
-  void doneFeedingInputBlocks(const relation_id rel_id) override {
-    ++num_calls_donefeedingblocks_;
-    MOCK_OP_LOG(3) << "count(" << num_calls_donefeedingblocks_ << ")";
-  }
-
-  QueryContext::insert_destination_id getInsertDestinationID() const override {
-    return insert_destination_index_;
-  }
-
-  const relation_id getOutputRelationID() const override {
-    return output_relation_id_;
-  }
-
- private:
-  const bool produce_workorders_;
-  const bool has_streaming_input_;
-  const int max_workorders_;
-  const int max_getworkorder_iters_;
-
-  int num_calls_get_workorders_;
-  int num_workorders_generated_;
-  int num_calls_feedblock_;
-  int num_calls_feedblocks_;
-  int num_calls_donefeedingblocks_;
-
-  QueryContext::insert_destination_id insert_destination_index_ = QueryContext::kInvalidInsertDestinationId;
-
-  relation_id output_relation_id_ = -1;
-
-#undef MOCK_OP_LOG
-
-  DISALLOW_COPY_AND_ASSIGN(MockOperator);
-};
-
-
-class QueryManagerTest : public ::testing::Test {
- protected:
-  virtual void SetUp() {
-    db_.reset(new CatalogDatabase(nullptr /* catalog */, "database"));
-    storage_manager_.reset(new StorageManager("./"));
-    bus_.Initialize();
-    query_handle_.reset(new QueryHandle(0 /* dummy query ID */, tmb::kClientIdNone /* cli_id */));
-    query_plan_ = query_handle_->getQueryPlanMutable();
-    query_handle_->getQueryContextProtoMutable()->set_query_id(query_handle_->query_id());
-  }
-
-  inline void constructQueryManager() {
-    query_manager_.reset(new QueryManagerSingleNode(
-        0, 1, query_handle_.get(), db_.get(), storage_manager_.get(), &bus_));
-  }
-
-  inline const int getNumWorkOrdersInExecution(const QueryPlan::DAGNodeIndex index) const {
-    return query_manager_->getQueryExecutionState().getNumQueuedWorkOrders(index);
-  }
-
-  inline const int getNumOperatorsFinished() const {
-    return query_manager_->getQueryExecutionState().getNumOperatorsFinished();
-  }
-
-  inline bool getOperatorFinishedStatus(const QueryPlan::DAGNodeIndex index) const {
-    return query_manager_->getQueryExecutionState().hasExecutionFinished(index);
-  }
-
-  inline bool placeDataPipelineMessage(const QueryPlan::DAGNodeIndex source_operator_index) {
-    VLOG(3) << "Place DataPipeline message for Op[" << source_operator_index << "]";
-
-    query_manager_->processDataPipelineMessage(source_operator_index,
-                                               0 /* dummy block ID */,
-                                               0 /* dummy relation ID */);
-    return query_manager_->getQueryExecutionState().hasQueryExecutionFinished();
-  }
-
-  inline bool placeWorkOrderCompleteMessage(const QueryPlan::DAGNodeIndex index) {
-    VLOG(3) << "Place WorkOrderComplete message for Op[" << index << "]";
-
-    query_manager_->processWorkOrderCompleteMessage(index);
-    return query_manager_->getQueryExecutionState().hasQueryExecutionFinished();
-  }
-
-  inline bool placeRebuildWorkOrderCompleteMessage(const QueryPlan::DAGNodeIndex index) {
-    VLOG(3) << "Place RebuildWorkOrderComplete message for Op[" << index << "]";
-
-    query_manager_->processRebuildWorkOrderCompleteMessage(index);
-    return query_manager_->getQueryExecutionState().hasQueryExecutionFinished();
-  }
-
-  inline bool placeOutputBlockMessage(const QueryPlan::DAGNodeIndex index) {
-    VLOG(3) << "Place OutputBlock message for Op[" << index << "]";
-
-    query_manager_->processDataPipelineMessage(index,
-                                               0 /* dummy block ID */,
-                                               0 /* dummy relation ID */);
-    return query_manager_->getQueryExecutionState().hasQueryExecutionFinished();
-  }
-
-  unique_ptr<CatalogDatabase> db_;
-  unique_ptr<StorageManager> storage_manager_;
-
-  QueryPlan *query_plan_;
-  unique_ptr<QueryHandle> query_handle_;
-  unique_ptr<QueryManagerSingleNode> query_manager_;
-
-  MessageBusImpl bus_;
-
-  client_id worker_client_id_;
-
-  unique_ptr<WorkerDirectory> workers_;
-};
-
-TEST_F(QueryManagerTest, SingleNodeDAGNoWorkOrdersTest) {
-  // This test creates a DAG of a single node. No workorders are generated.
-  query_plan_->addRelationalOperator(new MockOperator(false, false));
-
-  const MockOperator &op = static_cast<const MockOperator &>(
-      query_plan_->getQueryPlanDAG().getNodePayload(0));
-
-  constructQueryManager();
-
-  // op doesn't have any dependencies.
-  EXPECT_TRUE(op.getBlockingDependenciesMet());
-
-  // We expect one call for op's getAllWorkOrders().
-  EXPECT_EQ(1, op.getNumCalls(MockOperator::kGetAllWorkOrders));
-  EXPECT_EQ(0, op.getNumCalls(MockOperator::kFeedInputBlock));
-  EXPECT_EQ(0, op.getNumCalls(MockOperator::kFeedInputBlocks));
-}
-
-TEST_F(QueryManagerTest, SingleNodeDAGStaticWorkOrdersTest) {
-  // This test creates a DAG of a single node. Static workorders are generated.
-  const QueryPlan::DAGNodeIndex id =
-      query_plan_->addRelationalOperator(new MockOperator(true, false, 1));
-
-  const MockOperator &op = static_cast<const MockOperator &>(
-      query_plan_->getQueryPlanDAG().getNodePayload(id));
-
-  constructQueryManager();
-
-  // op doesn't have any dependencies.
-  EXPECT_TRUE(op.getBlockingDependenciesMet());
-
-  // We expect one call for op's getAllWorkOrders().
-  EXPECT_EQ(1, op.getNumCalls(MockOperator::kGetAllWorkOrders));
-  EXPECT_EQ(0, op.getNumCalls(MockOperator::kFeedInputBlock));
-  EXPECT_EQ(0, op.getNumCalls(MockOperator::kFeedInputBlocks));
-
-  // One workorder is generated.
-  EXPECT_EQ(1, op.getNumWorkOrders());
-
-  unique_ptr<WorkerMessage> worker_message;
-  worker_message.reset(query_manager_->getNextWorkerMessage(0, -1));
-  EXPECT_TRUE(worker_message != nullptr);
-
-  EXPECT_EQ(WorkerMessage::WorkerMessageType::kWorkOrder,
-            worker_message->getType());
-  EXPECT_EQ(0u, worker_message->getRelationalOpIndex());
-
-  delete worker_message->getWorkOrder();
-
-  EXPECT_EQ(1, getNumWorkOrdersInExecution(id));
-  EXPECT_EQ(0, getNumOperatorsFinished());
-
-  // Send a message to QueryManager upon workorder completion.
-  // Last event processed by QueryManager.
-  EXPECT_TRUE(placeWorkOrderCompleteMessage(id));
-
-  EXPECT_EQ(0, getNumWorkOrdersInExecution(id));
-  EXPECT_EQ(1, getNumOperatorsFinished());
-  EXPECT_TRUE(getOperatorFinishedStatus(id));
-}
-
-TEST_F(QueryManagerTest, SingleNodeDAGDynamicWorkOrdersTest) {
-  // This test creates a DAG of a single node. WorkOrders are generated
-  // dynamically as pending work orders complete execution, i.e.,
-  // getAllWorkOrders() is called multiple times.  getAllWorkOrders() will be
-  // called 5 times and 3 work orders will be returned, i.e., 1st 3 calls to
-  // getAllWorkOrders() insert 1 WorkOrder and return false, and the next will
-  // insert no WorkOrder and return true.
-
-  // TODO(shoban): This test can not be more robust than this because of fixed
-  // scaffolding of mocking. If we use gMock, we can do much better.
-  const QueryPlan::DAGNodeIndex id =
-      query_plan_->addRelationalOperator(new MockOperator(true, false, 4, 3));
-
-  const MockOperator &op = static_cast<const MockOperator &>(
-      query_plan_->getQueryPlanDAG().getNodePayload(id));
-
-  constructQueryManager();
-
-  // op doesn't have any dependencies.
-  EXPECT_TRUE(op.getBlockingDependenciesMet());
-
-  for (int i = 0; i < 3; ++i) {
-    // We expect one call for op's getAllWorkOrders().
-    EXPECT_EQ(i + 1, op.getNumCalls(MockOperator::kGetAllWorkOrders));
-
-    // One workorder is generated.
-    // EXPECT_EQ(1, getWorkerInputQueueSize());
-    EXPECT_EQ(i + 1, op.getNumWorkOrders());
-
-    unique_ptr<WorkerMessage> worker_message;
-    worker_message.reset(query_manager_->getNextWorkerMessage(id, -1));
-
-    EXPECT_TRUE(worker_message != nullptr);
-    EXPECT_EQ(WorkerMessage::WorkerMessageType::kWorkOrder,
-              worker_message->getType());
-    EXPECT_EQ(id, worker_message->getRelationalOpIndex());
-
-    delete worker_message->getWorkOrder();
-
-    EXPECT_EQ(1, getNumWorkOrdersInExecution(id));
-    EXPECT_EQ(0, getNumOperatorsFinished());
-
-    if (i < 2) {
-      // Send a message to QueryManager upon workorder completion.
-      EXPECT_FALSE(placeWorkOrderCompleteMessage(id));
-    } else {
-      // Send a message to QueryManager upon workorder completion.
-      // Last event.
-      EXPECT_TRUE(placeWorkOrderCompleteMessage(id));
-    }
-  }
-
-  EXPECT_EQ(0, getNumWorkOrdersInExecution(id));
-
-  EXPECT_EQ(1, getNumOperatorsFinished());
-  EXPECT_TRUE(getOperatorFinishedStatus(id));
-
-  // We place this check in the end, since it's true throughout the test.
-  EXPECT_EQ(0, op.getNumCalls(MockOperator::kFeedInputBlock));
-  EXPECT_EQ(0, op.getNumCalls(MockOperator::kFeedInputBlocks));
-}
-
-TEST_F(QueryManagerTest, TwoNodesDAGBlockingLinkTest) {
-  // We use two nodes in the DAG with a blocking link between them.
-  // There is no streaming of data involved in this test.
-  const QueryPlan::DAGNodeIndex id1 =
-      query_plan_->addRelationalOperator(new MockOperator(true, false));
-  const QueryPlan::DAGNodeIndex id2 =
-      query_plan_->addRelationalOperator(new MockOperator(true, false));
-
-  // Create a blocking link.
-  query_plan_->addDirectDependency(id2, id1, true);
-
-  static_cast<MockOperator *>(
-      query_plan_->getQueryPlanDAGMutable()->getNodePayloadMutable(id1))
-          ->setOutputRelationID(0xdead);
-
-  const MockOperator &op1 = static_cast<const MockOperator &>(
-      query_plan_->getQueryPlanDAG().getNodePayload(id1));
-  const MockOperator &op2 = static_cast<const MockOperator &>(
-      query_plan_->getQueryPlanDAG().getNodePayload(id2));
-
-  constructQueryManager();
-
-  // op1 doesn't have any dependencies
-  EXPECT_TRUE(op1.getBlockingDependenciesMet());
-
-  // Only op1 should receive a call to getAllWorkOrders initially.
-  EXPECT_EQ(1, op1.getNumCalls(MockOperator::kGetAllWorkOrders));
-  EXPECT_EQ(0, op1.getNumCalls(MockOperator::kFeedInputBlock));
-  EXPECT_EQ(0, op1.getNumCalls(MockOperator::kFeedInputBlocks));
-
-  EXPECT_EQ(0, op2.getNumCalls(MockOperator::kGetAllWorkOrders));
-  EXPECT_EQ(0, op2.getNumCalls(MockOperator::kFeedInputBlock));
-  EXPECT_EQ(0, op2.getNumCalls(MockOperator::kFeedInputBlocks));
-
-  // Only op1 should produce a workorder.
-  EXPECT_EQ(1, op1.getNumWorkOrders());
-  EXPECT_EQ(0, op2.getNumWorkOrders());
-
-  // Foreman hasn't yet got workorder completion response for the workorder.
-  unique_ptr<WorkerMessage> worker_message;
-  worker_message.reset(query_manager_->getNextWorkerMessage(id1, -1));
-
-  EXPECT_TRUE(worker_message != nullptr);
-  EXPECT_EQ(WorkerMessage::WorkerMessageType::kWorkOrder,
-            worker_message->getType());
-  EXPECT_EQ(id1, worker_message->getRelationalOpIndex());
-
-  delete worker_message->getWorkOrder();
-
-  EXPECT_EQ(1, getNumWorkOrdersInExecution(id1));
-  EXPECT_EQ(0, getNumWorkOrdersInExecution(id2));
-  EXPECT_EQ(0, getNumOperatorsFinished());
-
-  // Send a message to Foreman upon workorder (generated by op1) completion.
-  EXPECT_FALSE(placeWorkOrderCompleteMessage(id1));
-
-  EXPECT_EQ(0, getNumWorkOrdersInExecution(id1));
-  // op1 is over now, op2 still to go.
-  EXPECT_EQ(1, op2.getNumCalls(MockOperator::kDoneFeedingInputBlocks));
-  EXPECT_EQ(1, getNumOperatorsFinished());
-
-  EXPECT_TRUE(getOperatorFinishedStatus(id1));
-  EXPECT_EQ(1, op2.getNumCalls(MockOperator::kDoneFeedingInputBlocks));
-  EXPECT_FALSE(getOperatorFinishedStatus(id2));
-
-  worker_message.reset(query_manager_->getNextWorkerMessage(id2, -1));
-  EXPECT_TRUE(worker_message != nullptr);
-  EXPECT_EQ(WorkerMessage::WorkerMessageType::kWorkOrder,
-            worker_message->getType());
-  EXPECT_EQ(id2, worker_message->getRelationalOpIndex());
-
-  delete worker_message->getWorkOrder();
-
-  EXPECT_EQ(1, getNumWorkOrdersInExecution(id2));
-
-  // op1 is op2's blocking dependency.
-  EXPECT_TRUE(op2.getBlockingDependenciesMet());
-
-  EXPECT_EQ(1, op1.getNumCalls(MockOperator::kGetAllWorkOrders));
-  // op2 should get first call of getAllWorkOrders() when op1 is over.
-  EXPECT_EQ(1, op2.getNumCalls(MockOperator::kGetAllWorkOrders));
-
-  EXPECT_EQ(1, op2.getNumWorkOrders());
-
-  // Send a message to QueryManager upon workorder (generated by op2) completion.
-  // Note that the worker hasn't yet popped the workorder. Usually this won't
-  // happen as workers pop workorders first, execute and then send the response.
-  EXPECT_TRUE(placeWorkOrderCompleteMessage(id2));
-
-  EXPECT_EQ(1, op2.getNumCalls(MockOperator::kGetAllWorkOrders));
-
-  EXPECT_EQ(0, getNumWorkOrdersInExecution(id1));
-  EXPECT_EQ(0, getNumWorkOrdersInExecution(id2));
-
-  EXPECT_EQ(2, getNumOperatorsFinished());
-  EXPECT_TRUE(getOperatorFinishedStatus(id1));
-  EXPECT_TRUE(getOperatorFinishedStatus(id2));
-
-  // Expect no additional calls to getAllWorkOrders.
-  EXPECT_EQ(1, op1.getNumCalls(MockOperator::kGetAllWorkOrders));
-  EXPECT_EQ(1, op2.getNumCalls(MockOperator::kGetAllWorkOrders));
-}
-
-TEST_F(QueryManagerTest, TwoNodesDAGPipeLinkTest) {
-  // We use two nodes in the DAG with a non-blocking link between them.
-  // We stream output of op1 to op2. Sequeuce of events is as follows:
-  // 1. op1 creates a workorder.
-  // 2. We send a "block full" (from op1) to QueryManager.
-  // 3. op2 creates a workorder because of step 2.
-  const QueryPlan::DAGNodeIndex id1 =
-      query_plan_->addRelationalOperator(new MockOperator(true, false, 1));
-  const QueryPlan::DAGNodeIndex id2 =
-      query_plan_->addRelationalOperator(new MockOperator(true, true, 3));
-
-  // Create a non-blocking link.
-  query_plan_->addDirectDependency(id2, id1, false);
-
-  static_cast<MockOperator *>(
-      query_plan_->getQueryPlanDAGMutable()->getNodePayloadMutable(id1))
-      ->setOutputRelationID(0xdead);
-
-  const MockOperator &op1 = static_cast<const MockOperator &>(
-      query_plan_->getQueryPlanDAG().getNodePayload(id1));
-  const MockOperator &op2 = static_cast<const MockOperator &>(
-      query_plan_->getQueryPlanDAG().getNodePayload(id2));
-
-  constructQueryManager();
-
-  // As none of the operators have a blocking link, blocking dependencies should
-  // be met.
-  EXPECT_TRUE(op1.getBlockingDependenciesMet());
-  EXPECT_TRUE(op2.getBlockingDependenciesMet());
-
-  EXPECT_EQ(1, op1.getNumCalls(MockOperator::kGetAllWorkOrders));
-  EXPECT_EQ(1, op1.getNumWorkOrders());
-  EXPECT_EQ(0, op1.getNumCalls(MockOperator::kFeedInputBlock));
-  EXPECT_EQ(0, op1.getNumCalls(MockOperator::kFeedInputBlocks));
-
-  EXPECT_EQ(1, op2.getNumCalls(MockOperator::kGetAllWorkOrders));
-  // op2 will generate workorder only after receiving a streaming input.
-  EXPECT_EQ(0, op2.getNumWorkOrders());
-  EXPECT_EQ(0, op2.getNumCalls(MockOperator::kFeedInputBlock));
-  EXPECT_EQ(0, op2.getNumCalls(MockOperator::kFeedInputBlocks));
-
-  unique_ptr<WorkerMessage> worker_message;
-  worker_message.reset(query_manager_->getNextWorkerMessage(id1, -1));
-
-  EXPECT_TRUE(worker_message != nullptr);
-  EXPECT_EQ(WorkerMessage::WorkerMessageType::kWorkOrder,
-            worker_message->getType());
-  EXPECT_EQ(id1, worker_message->getRelationalOpIndex());
-
-  delete worker_message->getWorkOrder();
-
-  // Send a message to QueryManager upon block getting full (output of op1).
-  EXPECT_FALSE(placeOutputBlockMessage(id1));
-
-  // op1 is not finished yet because the response of workorder completion hasn't
-  // been received yet by the QueryManager.
-  EXPECT_FALSE(getOperatorFinishedStatus(id1));
-  EXPECT_FALSE(getOperatorFinishedStatus(id2));
-
-  // No additional call to op1's getAllWorkOrders.
-  EXPECT_EQ(1, op1.getNumCalls(MockOperator::kGetAllWorkOrders));
-  EXPECT_EQ(0, op1.getNumCalls(MockOperator::kFeedInputBlock));
-  EXPECT_EQ(0, op1.getNumCalls(MockOperator::kFeedInputBlocks));
-
-  // Output from op1 should be fed to op2.
-  EXPECT_EQ(1, op2.getNumCalls(MockOperator::kFeedInputBlock));
-  EXPECT_EQ(0, op2.getNumCalls(MockOperator::kFeedInputBlocks));
-
-  // A call to op2's getAllWorkOrders because of the streamed input.
-  EXPECT_EQ(2, op2.getNumCalls(MockOperator::kGetAllWorkOrders));
-  EXPECT_EQ(1, op2.getNumWorkOrders());
-
-  // Place a message of a workorder completion of op1 on Foreman's input queue.
-  EXPECT_FALSE(placeWorkOrderCompleteMessage(id1));
-
-  EXPECT_EQ(0, getNumWorkOrdersInExecution(id1));
-  EXPECT_TRUE(getOperatorFinishedStatus(id1));
-  EXPECT_EQ(1, op2.getNumCalls(MockOperator::kDoneFeedingInputBlocks));
-
-  // An additional call to op2's getAllWorkOrders because of completion of op1.
-  EXPECT_EQ(3, op2.getNumCalls(MockOperator::kGetAllWorkOrders));
-  EXPECT_EQ(2, op2.getNumWorkOrders());
-
-  worker_message.reset(query_manager_->getNextWorkerMessage(id2, -1));
-
-  EXPECT_TRUE(worker_message != nullptr);
-  EXPECT_EQ(WorkerMessage::WorkerMessageType::kWorkOrder,
-            worker_message->getType());
-  EXPECT_EQ(id2, worker_message->getRelationalOpIndex());
-
-  delete worker_message->getWorkOrder();
-
-  // Place a message of a workorder completion of op2 on Foreman's input queue.
-  EXPECT_FALSE(placeWorkOrderCompleteMessage(id2));
-
-  EXPECT_TRUE(getOperatorFinishedStatus(id1));
-
-  worker_message.reset(query_manager_->getNextWorkerMessage(id2, -1));
-
-  EXPECT_TRUE(worker_message != nullptr);
-  EXPECT_EQ(WorkerMessage::WorkerMessageType::kWorkOrder,
-            worker_message->getType());
-  EXPECT_EQ(id2, worker_message->getRelationalOpIndex());
-
-  delete worker_message->getWorkOrder();
-
-  EXPECT_EQ(1, getNumWorkOrdersInExecution(id2));
-  EXPECT_FALSE(getOperatorFinishedStatus(id2));
-
-  // Send a message to Foreman upon workorder (generated by op2) completion.
-  EXPECT_TRUE(placeWorkOrderCompleteMessage(id2));
-
-  EXPECT_TRUE(getOperatorFinishedStatus(id1));
-  EXPECT_EQ(1, op2.getNumCalls(MockOperator::kDoneFeedingInputBlocks));
-
-  EXPECT_EQ(0, getNumWorkOrdersInExecution(id2));
-  EXPECT_TRUE(getOperatorFinishedStatus(id2));
-}
-
-TEST_F(QueryManagerTest, TwoNodesDAGPartiallyFilledBlocksTest) {
-  // In this test, we create a 2-node DAG with a non-blocking link between them.
-  // There is no streaming of data from op1 to op2 during the execution of op1.
-  // op1 produces a partially filled block at the end of its execution which is
-  // rebuilt and then fed to op2.
-  const QueryPlan::DAGNodeIndex id1 =
-      query_plan_->addRelationalOperator(new MockOperator(true, false, 1));
-  const QueryPlan::DAGNodeIndex id2 =
-      query_plan_->addRelationalOperator(new MockOperator(true, true, 3, 1));
-
-  // Create a non-blocking link.
-  query_plan_->addDirectDependency(id2, id1, false);
-
-  // Create a relation, owned by db_.*/
-  CatalogRelation *relation =
-      new CatalogRelation(nullptr /* catalog_database */, "test_relation");
-  const relation_id output_relation_id = db_->addRelation(relation);
-
-  // Setup the InsertDestination proto in the query context proto.
-  serialization::QueryContext *query_context_proto =
-      query_handle_->getQueryContextProtoMutable();
-
-  const QueryContext::insert_destination_id insert_destination_index =
-      query_context_proto->insert_destinations_size();
-  serialization::InsertDestination *insert_destination_proto =
-      query_context_proto->add_insert_destinations();
-
-  insert_destination_proto->set_insert_destination_type(
-      serialization::InsertDestinationType::BLOCK_POOL);
-  insert_destination_proto->set_relation_id(output_relation_id);
-  insert_destination_proto->set_relational_op_index(id1);
-
-  MockOperator *op1_mutable = static_cast<MockOperator *>(
-      query_plan_->getQueryPlanDAGMutable()->getNodePayloadMutable(id1));
-  op1_mutable->setInsertDestinationID(insert_destination_index);
-  op1_mutable->setOutputRelationID(output_relation_id);
-
-  const MockOperator &op1 = static_cast<const MockOperator &>(
-      query_plan_->getQueryPlanDAG().getNodePayload(id1));
-  const MockOperator &op2 = static_cast<const MockOperator &>(
-      query_plan_->getQueryPlanDAG().getNodePayload(id2));
-
-  constructQueryManager();
-
-  // NOTE(zuyu): An operator generally has no ideas about partially filled
-  // blocks, but InsertDestination in QueryContext does.
-  // Mock to add partially filled blocks in the InsertDestination.
-  InsertDestination *insert_destination =
-      query_manager_->getQueryContextMutable()->getInsertDestination(
-          insert_destination_index);
-  DCHECK(insert_destination != nullptr);
-  MutableBlockReference block_ref;
-  static_cast<BlockPoolInsertDestination *>(insert_destination)
-      ->available_block_refs_.push_back(move(block_ref));
-
-  // There's no blocking dependency in the DAG.
-  EXPECT_TRUE(op1.getBlockingDependenciesMet());
-  EXPECT_TRUE(op2.getBlockingDependenciesMet());
-
-  EXPECT_EQ(1, op1.getNumCalls(MockOperator::kGetAllWorkOrders));
-  EXPECT_EQ(1, op1.getNumWorkOrders());
-
-  EXPECT_EQ(1, op2.getNumCalls(MockOperator::kGetAllWorkOrders));
-  EXPECT_EQ(0, op2.getNumWorkOrders());
-
-  unique_ptr<WorkerMessage> worker_message;
-  worker_message.reset(query_manager_->getNextWorkerMessage(id1, -1));
-
-  EXPECT_TRUE(worker_message != nullptr);
-  EXPECT_EQ(WorkerMessage::WorkerMessageType::kWorkOrder,
-            worker_message->getType());
-  EXPECT_EQ(id1, worker_message->getRelationalOpIndex());
-
-  delete worker_message->getWorkOrder();
-
-  // Send a message to QueryManager upon workorder (generated by op1) completion.
-  EXPECT_FALSE(placeWorkOrderCompleteMessage(id1));
-
-  EXPECT_EQ(0, getNumWorkOrdersInExecution(id1));
-
-  worker_message.reset(query_manager_->getNextWorkerMessage(id1, -1));
-  EXPECT_TRUE(worker_message != nullptr);
-  EXPECT_EQ(WorkerMessage::WorkerMessageType::kRebuildWorkOrder,
-            worker_message->getType());
-
-  EXPECT_EQ(id1, worker_message->getRelationalOpIndex());
-
-  delete worker_message->getWorkOrder();
-
-  // op1 generates a rebuild workorder. The block is rebuilt and streamed
-  // to Foreman.
-  EXPECT_FALSE(placeDataPipelineMessage(id1));
-
-  EXPECT_FALSE(placeRebuildWorkOrderCompleteMessage(id1));
-  // Based on the streamed input, op2's getAllWorkOrders should produce a
-  // workorder.
-  EXPECT_EQ(3, op2.getNumCalls(MockOperator::kGetAllWorkOrders));
-  EXPECT_EQ(1, op2.getNumWorkOrders());
-
-  worker_message.reset(query_manager_->getNextWorkerMessage(id2, -1));
-
-  EXPECT_TRUE(worker_message != nullptr);
-  EXPECT_EQ(WorkerMessage::WorkerMessageType::kWorkOrder,
-            worker_message->getType());
-
-  EXPECT_EQ(id2, worker_message->getRelationalOpIndex());
-
-  delete worker_message->getWorkOrder();
-
-  EXPECT_TRUE(getOperatorFinishedStatus(id1));
-  EXPECT_EQ(1, op2.getNumCalls(MockOperator::kDoneFeedingInputBlocks));
-  EXPECT_FALSE(getOperatorFinishedStatus(id2));
-  EXPECT_EQ(1, getNumWorkOrdersInExecution(id2));
-
-  // Send a message to QueryManager upon workorder (generated by op2) completion.
-  EXPECT_TRUE(placeWorkOrderCompleteMessage(id2));
-
-  EXPECT_EQ(0, getNumWorkOrdersInExecution(id2));
-
-  EXPECT_TRUE(getOperatorFinishedStatus(id2));
-}
-
-TEST_F(QueryManagerTest, MultipleNodesNoOutputTest) {
-  // When an operator produces workorders but no output, the QueryManager should
-  // check the dependents of this operator to make progress.
-  const QueryPlan::DAGNodeIndex kNumNodes = 5;
-  std::vector<QueryPlan::DAGNodeIndex> ids;
-  ids.reserve(kNumNodes);
-
-  for (QueryPlan::DAGNodeIndex i = 0; i < kNumNodes; ++i) {
-    if (i == 0) {
-      ids[i] = query_plan_->addRelationalOperator(new MockOperator(true, false));
-    } else {
-      ids[i] = query_plan_->addRelationalOperator(new MockOperator(true, true));
-    }
-    VLOG(3) << ids[i];
-  }
-
-  /**
-   * The DAG looks like this:
-   *
-   * op1 -> op2 -> op3 -> op4 -> op5
-   *
-   **/
-  for (QueryPlan::DAGNodeIndex i = 0; i < kNumNodes - 1; ++i) {
-    query_plan_->addDirectDependency(ids[i + 1], ids[i], false);
-    static_cast<MockOperator*>(query_plan_->getQueryPlanDAGMutable()->getNodePayloadMutable(ids[i]))
-        ->setOutputRelationID(0xdead);
-  }
-
-  std::vector<const MockOperator*> operators;
-  for (QueryPlan::DAGNodeIndex i = 0; i < kNumNodes; ++i) {
-    operators.push_back(static_cast<const MockOperator*>(&query_plan_->getQueryPlanDAG().getNodePayload(ids[i])));
-  }
-
-  constructQueryManager();
-
-  // operators[0] should have produced a workorder by now.
-  EXPECT_EQ(1, operators[0]->getNumWorkOrders());
-
-  unique_ptr<WorkerMessage> worker_message;
-  worker_message.reset(query_manager_->getNextWorkerMessage(ids[0], -1));
-
-  EXPECT_TRUE(worker_message != nullptr);
-  EXPECT_EQ(WorkerMessage::WorkerMessageType::kWorkOrder,
-            worker_message->getType());
-
-  EXPECT_EQ(ids[0], worker_message->getRelationalOpIndex());
-
-  delete worker_message->getWorkOrder();
-
-  EXPECT_EQ(1, getNumWorkOrdersInExecution(ids[0]));
-  EXPECT_FALSE(getOperatorFinishedStatus(ids[0]));
-
-  for (QueryPlan::DAGNodeIndex i = 0; i < kNumNodes; ++i) {
-    EXPECT_EQ(1, operators[ids[i]]->getNumCalls(MockOperator::kGetAllWorkOrders));
-  }
-
-  // Send a message to QueryManager upon workorder (generated by operators[0])
-  // completion.
-  EXPECT_TRUE(placeWorkOrderCompleteMessage(ids[0]));
-
-  for (QueryPlan::DAGNodeIndex i = 0; i < kNumNodes; ++i) {
-    EXPECT_EQ(0, getNumWorkOrdersInExecution(ids[i]));
-    EXPECT_TRUE(getOperatorFinishedStatus(ids[i]));
-    if (i < kNumNodes - 1) {
-      EXPECT_EQ(1, operators[i + 1]->getNumCalls(MockOperator::kDoneFeedingInputBlocks));
-    }
-  }
-}
-
-TEST_F(QueryManagerTest, OutOfOrderWorkOrderCompletionTest) {
-  // Consider two operators, both generate one workorder each. The dependent's
-  // workorder finishes before dependency's workorder.
-  const QueryPlan::DAGNodeIndex id1 = query_plan_->addRelationalOperator(new MockOperator(true, false, 1));
-  const QueryPlan::DAGNodeIndex id2 = query_plan_->addRelationalOperator(new MockOperator(true, true, 2, 1));
-
-  // Create a non-blocking link.
-  query_plan_->addDirectDependency(id2, id1, false);
-
-  constructQueryManager();
-
-  unique_ptr<WorkerMessage> worker_message;
-  worker_message.reset(query_manager_->getNextWorkerMessage(id1, -1));
-
-  EXPECT_TRUE(worker_message != nullptr);
-  EXPECT_EQ(WorkerMessage::WorkerMessageType::kWorkOrder,
-            worker_message->getType());
-
-  EXPECT_EQ(id1, worker_message->getRelationalOpIndex());
-
-  delete worker_message->getWorkOrder();
-
-  // Send a message to QueryManager upon a block (output of op1) getting full.
-  EXPECT_FALSE(placeOutputBlockMessage(id1));
-
-  // op1 is not finished yet because the response of workorder completion hasn't
-  // been received yet.
-  EXPECT_FALSE(getOperatorFinishedStatus(id1));
-  EXPECT_FALSE(getOperatorFinishedStatus(id2));
-
-  worker_message.reset(query_manager_->getNextWorkerMessage(id2, -1));
-  EXPECT_TRUE(worker_message != nullptr);
-  EXPECT_EQ(WorkerMessage::WorkerMessageType::kWorkOrder,
-            worker_message->getType());
-
-  EXPECT_EQ(id2, worker_message->getRelationalOpIndex());
-
-  delete worker_message->getWorkOrder();
-
-  // As mentioned earlier, op2 finishes before op1.
-  EXPECT_FALSE(placeWorkOrderCompleteMessage(id2));
-
-  // op1's workorder execution is over.
-  EXPECT_TRUE(placeWorkOrderCompleteMessage(id1));
-
-  EXPECT_TRUE(getOperatorFinishedStatus(id1));
-  EXPECT_TRUE(getOperatorFinishedStatus(id2));
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_execution/tests/WorkOrdersContainer_unittest.cpp
----------------------------------------------------------------------
diff --git a/query_execution/tests/WorkOrdersContainer_unittest.cpp b/query_execution/tests/WorkOrdersContainer_unittest.cpp
deleted file mode 100644
index a3b9ba1..0000000
--- a/query_execution/tests/WorkOrdersContainer_unittest.cpp
+++ /dev/null
@@ -1,870 +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 <algorithm>
-#include <cstddef>
-#include <vector>
-
-#include "gtest/gtest.h"
-
-#include "query_execution/WorkOrdersContainer.hpp"
-#include "relational_operators/WorkOrder.hpp"
-#include "utility/PtrVector.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-
-class MockNUMAWorkOrder : public WorkOrder {
- public:
-  MockNUMAWorkOrder(const int id, const std::vector<int> &numa_nodes)
-      : WorkOrder(0), id_(id) {
-    for (int numa_node : numa_nodes) {
-      preferred_numa_nodes_.push_back(numa_node);
-    }
-  }
-
-  const int getID() const {
-    return id_;
-  }
-
-  void execute() override {}
-
- private:
-  const int id_;
-
-  DISALLOW_COPY_AND_ASSIGN(MockNUMAWorkOrder);
-};
-
-// Note: In the tests, we create a local WorkOrder object (on stack) and use its
-// address as a pointer while inserting to the container.
-// The real usage of the API works as follows - we create a WorkOrder using "new"
-// (on heap) and pass the pointer to the container. When a WorkOrder is
-// retrieved from the container, its pointer is removed from the container and
-// the caller is responsible to delete the actual WorkOrder object.
-
-TEST(WorkOrdersContainerTest, ZeroNUMANodesTest) {
-  // A container for one operator and no NUMA nodes.
-  WorkOrdersContainer w(1, 0);
-
-  EXPECT_EQ(0u, w.getNumNormalWorkOrders(0));
-  EXPECT_EQ(0u, w.getNumRebuildWorkOrders(0));
-  EXPECT_FALSE(w.hasNormalWorkOrder(0));
-  EXPECT_FALSE(w.hasRebuildWorkOrder(0));
-  EXPECT_EQ(nullptr, w.getNormalWorkOrder(0));
-  EXPECT_EQ(nullptr, w.getRebuildWorkOrder(0));
-}
-
-TEST(WorkOrdersContainerTest, ZeroNUMANodesAddWorkOrderTest) {
-  // Add one normal and rebuild workorder each for one operator DAG. Test if
-  // they get inserted and retrieved correctly.
-  std::vector<int> numa_node_ids;
-  // A container for one operator and no NUMA nodes.
-  const std::size_t query_id = 0;
-  WorkOrdersContainer w(1, 0);
-
-  EXPECT_EQ(0u, w.getNumNormalWorkOrders(0));
-  EXPECT_EQ(0u, w.getNumRebuildWorkOrders(0));
-  EXPECT_FALSE(w.hasNormalWorkOrder(0));
-  EXPECT_FALSE(w.hasRebuildWorkOrder(0));
-
-  // Create a NUMA agnostic normal WorkOrder.
-  MockNUMAWorkOrder work_order(0, numa_node_ids);
-  w.addNormalWorkOrder(&work_order, 0);
-
-  // Expect the normal WorkOrder count to be 1.
-  EXPECT_EQ(1u, w.getNumNormalWorkOrders(0));
-  EXPECT_EQ(0u, w.getNumRebuildWorkOrders(0));
-  EXPECT_TRUE(w.hasNormalWorkOrder(0));
-  EXPECT_FALSE(w.hasRebuildWorkOrder(0));
-
-  // Create a NUMA agnostic rebuild WorkOrder.
-  MockNUMAWorkOrder work_order1(1, numa_node_ids);
-  w.addRebuildWorkOrder(&work_order1, 0);
-
-  // Expect the normal WorkOrder count to be 1.
-  EXPECT_EQ(1u, w.getNumNormalWorkOrders(0));
-  EXPECT_EQ(1u, w.getNumRebuildWorkOrders(0));
-  EXPECT_TRUE(w.hasNormalWorkOrder(0));
-  EXPECT_TRUE(w.hasRebuildWorkOrder(0));
-
-  // Check if we retrieve the same WorkOrders.
-  WorkOrder *returned_work_order = w.getNormalWorkOrder(0);
-  ASSERT_TRUE(returned_work_order != nullptr);
-  EXPECT_EQ(work_order.getID(), static_cast<MockNUMAWorkOrder*>(returned_work_order)->getID());
-
-  EXPECT_EQ(query_id, returned_work_order->getQueryID());
-
-  WorkOrder *returned_rebuild_work_order = w.getRebuildWorkOrder(0);
-  ASSERT_TRUE(returned_rebuild_work_order != nullptr);
-  EXPECT_EQ(work_order1.getID(),
-            static_cast<MockNUMAWorkOrder *>(returned_rebuild_work_order)->getID());
-
-  EXPECT_EQ(query_id, returned_rebuild_work_order->getQueryID());
-
-  // Container should be empty now.
-  EXPECT_EQ(0u, w.getNumNormalWorkOrders(0));
-  EXPECT_EQ(0u, w.getNumRebuildWorkOrders(0));
-  EXPECT_FALSE(w.hasNormalWorkOrder(0));
-  EXPECT_FALSE(w.hasRebuildWorkOrder(0));
-  EXPECT_EQ(nullptr, w.getNormalWorkOrder(0));
-  EXPECT_EQ(nullptr, w.getRebuildWorkOrder(0));
-}
-
-TEST(WorkOrdersContainerTest, ZeroNUMANodesMultipleWorkOrdersTest) {
-  // Add multiple normal and rebuild workorders each for one operator DAG. Test
-  // if they get inserted and retrieved correctly and the order of retrieval.
-  // A container for one operator and no NUMA nodes.
-  std::vector<int> numa_node_ids;
-  const std::size_t query_id = 0;
-  WorkOrdersContainer w(1, 0);
-
-  EXPECT_EQ(0u, w.getNumNormalWorkOrders(0));
-  EXPECT_EQ(0u, w.getNumRebuildWorkOrders(0));
-  EXPECT_FALSE(w.hasNormalWorkOrder(0));
-  EXPECT_FALSE(w.hasRebuildWorkOrder(0));
-
-  PtrVector<MockNUMAWorkOrder> normal_workorders;
-  PtrVector<MockNUMAWorkOrder> rebuild_workorders;
-  const std::size_t kNumWorkOrders = 100;
-
-  // Push the mock WorkOrders in the vectors and the container.
-  for (std::size_t i = 0; i < kNumWorkOrders; ++i) {
-    EXPECT_EQ(i, w.getNumNormalWorkOrders(0));
-    EXPECT_EQ(i, w.getNumRebuildWorkOrders(0));
-
-    normal_workorders.push_back(new MockNUMAWorkOrder(i, numa_node_ids));
-    rebuild_workorders.push_back(
-        new MockNUMAWorkOrder(kNumWorkOrders + i, numa_node_ids));
-
-    w.addNormalWorkOrder(&(normal_workorders.back()), 0);
-    w.addRebuildWorkOrder(&(rebuild_workorders.back()), 0);
-  }
-
-  // Expect the normal WorkOrder count to be kNumWorkOrders.
-  EXPECT_EQ(kNumWorkOrders, w.getNumNormalWorkOrders(0));
-  EXPECT_EQ(kNumWorkOrders, w.getNumRebuildWorkOrders(0));
-  EXPECT_TRUE(w.hasNormalWorkOrder(0));
-  EXPECT_TRUE(w.hasRebuildWorkOrder(0));
-
-  // Retrieve the WorkOrders and check the order of retrieval.
-  for (std::size_t i = 0; i < kNumWorkOrders; ++i) {
-    EXPECT_EQ(kNumWorkOrders - i, w.getNumNormalWorkOrders(0));
-    EXPECT_EQ(kNumWorkOrders - i, w.getNumRebuildWorkOrders(0));
-    WorkOrder *returned_work_order = w.getNormalWorkOrder(0);
-    ASSERT_TRUE(returned_work_order != nullptr);
-    EXPECT_EQ(static_cast<int>(i), static_cast<MockNUMAWorkOrder *>(returned_work_order)->getID());
-    WorkOrder *returned_rebuild_work_order = w.getRebuildWorkOrder(0);
-    ASSERT_TRUE(returned_work_order != nullptr);
-    EXPECT_EQ(static_cast<int>(kNumWorkOrders + i),
-              static_cast<MockNUMAWorkOrder *>(returned_rebuild_work_order)->getID());
-    EXPECT_EQ(query_id, returned_work_order->getQueryID());
-    EXPECT_EQ(query_id, returned_rebuild_work_order->getQueryID());
-  }
-
-  // Container should be empty now.
-  EXPECT_EQ(0u, w.getNumNormalWorkOrders(0));
-  EXPECT_EQ(0u, w.getNumRebuildWorkOrders(0));
-  EXPECT_FALSE(w.hasNormalWorkOrder(0));
-  EXPECT_FALSE(w.hasRebuildWorkOrder(0));
-  EXPECT_EQ(nullptr, w.getNormalWorkOrder(0));
-  EXPECT_EQ(nullptr, w.getRebuildWorkOrder(0));
-}
-
-TEST(WorkOrdersContainerTest, MultipleNUMANodesTest) {
-  // Create WorkOrders belonging to different NUMA nodes and test if they get
-  // inserted and retrieved correctly.
-  std::vector<int> numa_node_ids;
-  // The sequence of NUMA nodes isn't contiguous.
-  numa_node_ids.push_back(4);
-  numa_node_ids.push_back(7);
-  numa_node_ids.push_back(0);
-  const std::size_t kNUMANodes =
-      1 +
-      *std::max_element(numa_node_ids.begin(), numa_node_ids.end());
-
-  const std::size_t kNUMANodesUsed = numa_node_ids.size();
-
-  // A container for one operator and kNUMANodes.
-  const std::size_t query_id = 0;
-  WorkOrdersContainer w(1, kNUMANodes);
-
-  for (std::size_t i = 0; i < kNUMANodesUsed; ++i) {
-    std::vector<int> curr_numa_node;
-    curr_numa_node.push_back(numa_node_ids[i]);
-  }
-
-  PtrVector<MockNUMAWorkOrder> normal_workorders;
-  PtrVector<MockNUMAWorkOrder> rebuild_workorders;
-
-  for (std::size_t i = 0; i < kNUMANodesUsed; ++i) {
-    // Create a vector consisting of the current NUMA node as its element.
-    std::vector<int> curr_numa_node;
-    curr_numa_node.push_back(numa_node_ids[i]);
-
-    // Create normal and rebuild WorkOrders belonging to exactly one NUMA node.
-    normal_workorders.push_back(new MockNUMAWorkOrder(i, curr_numa_node));
-    rebuild_workorders.push_back(
-        new MockNUMAWorkOrder(kNUMANodes + i, curr_numa_node));
-
-    w.addNormalWorkOrder(&(normal_workorders.back()), 0);
-    w.addRebuildWorkOrder(&(rebuild_workorders.back()), 0);
-
-    // For each NUMA node, check the count of WorkOrders.
-    for (std::size_t j = 0; j < i; ++j) {
-      EXPECT_EQ(1u, w.getNumNormalWorkOrdersForNUMANode(0, numa_node_ids[j]));
-      EXPECT_EQ(1u, w.getNumRebuildWorkOrdersForNUMANode(0, numa_node_ids[j]));
-    }
-  }
-
-  // Retrieve the WorkOrders.
-  for (std::size_t i = 0; i < kNUMANodesUsed; ++i) {
-    // For each NUMA node, check the count of WorkOrders.
-    for (std::size_t j = 0; j < kNUMANodesUsed; ++j) {
-      if (j >= i) {
-        // We haven't retrieved the workorders for this NUMA node yet.
-        EXPECT_EQ(1u, w.getNumNormalWorkOrdersForNUMANode(0, numa_node_ids[j]));
-        EXPECT_EQ(1u, w.getNumRebuildWorkOrdersForNUMANode(0, numa_node_ids[j]));
-      } else {
-        // We already retrieved the workorders for this NUMA node.
-        EXPECT_EQ(0u, w.getNumNormalWorkOrdersForNUMANode(0, numa_node_ids[j]));
-        EXPECT_EQ(0u, w.getNumRebuildWorkOrdersForNUMANode(0, numa_node_ids[j]));
-      }
-    }
-
-    // Retrieve the workorders for this NUMA node.
-    WorkOrder *returned_work_order = w.getNormalWorkOrderForNUMANode(0, numa_node_ids[i]);
-    ASSERT_TRUE(returned_work_order != nullptr);
-    EXPECT_EQ(normal_workorders[i].getID(),
-              static_cast<MockNUMAWorkOrder *>(returned_work_order)->getID());
-
-    WorkOrder *returned_rebuild_work_order =
-        w.getRebuildWorkOrderForNUMANode(0, numa_node_ids[i]);
-    ASSERT_TRUE(returned_rebuild_work_order != nullptr);
-    EXPECT_EQ(rebuild_workorders[i].getID(),
-              static_cast<MockNUMAWorkOrder *>(returned_rebuild_work_order)->getID());
-
-    EXPECT_EQ(query_id, returned_work_order->getQueryID());
-    EXPECT_EQ(query_id, returned_rebuild_work_order->getQueryID());
-  }
-
-  // No workorder should be left for this operator on any NUMA node.
-  for (const int numa_node : numa_node_ids) {
-    EXPECT_FALSE(w.hasNormalWorkOrderForNUMANode(0, numa_node));
-    EXPECT_FALSE(w.hasRebuildWorkOrderForNUMANode(0, numa_node));
-  }
-
-  // No workorder should be left for this operator.
-  EXPECT_FALSE(w.hasNormalWorkOrder(0));
-  EXPECT_FALSE(w.hasRebuildWorkOrder(0));
-}
-
-TEST(WorkOrdersContainerTest, AllTypesWorkOrdersTest) {
-  // For a given operator create three types of WorkOrders
-  // 1. NUMA agnostic.
-  // 2. WorkOrder with single NUMA node.
-  // 3. WorkOrder with multiple NUMA nodes.
-  std::vector<int> numa_nodes;
-
-  // Create a WorkOrder with no NUMA node.
-  MockNUMAWorkOrder no_numa_work_order(0, numa_nodes);
-  EXPECT_TRUE(no_numa_work_order.getPreferredNUMANodes().empty());
-
-  // Add one NUMA node.
-  numa_nodes.push_back(0);
-
-  // Create a WorkOrder with exactly one NUMA node.
-  MockNUMAWorkOrder one_numa_work_order(1, numa_nodes);
-  EXPECT_EQ(0, one_numa_work_order.getPreferredNUMANodes().front());
-
-  // Add another NUMA node.
-  numa_nodes.push_back(3);
-
-  // Create a WorkOrder with more than one NUMA node.
-  MockNUMAWorkOrder multiple_numa_work_order(2, numa_nodes);
-  for (std::size_t i = 0; i < numa_nodes.size(); ++i) {
-    EXPECT_EQ(numa_nodes[i], multiple_numa_work_order.getPreferredNUMANodes().at(i));
-  }
-
-  const std::size_t kNUMANodes =
-      1 + *std::max_element(numa_nodes.begin(), numa_nodes.end());
-  const std::size_t kNUMANodesUsed = numa_nodes.size();
-
-  // Create the container.
-  const std::size_t query_id = 0;
-  WorkOrdersContainer w(1, kNUMANodes);
-
-  w.addNormalWorkOrder(&multiple_numa_work_order, 0);
-
-  for (std::size_t i = 0; i < kNUMANodesUsed; ++i) {
-    // Check the count of per NUMA node workorders.
-    EXPECT_EQ(1u, w.getNumNormalWorkOrdersForNUMANode(0, numa_nodes[i]));
-  }
-
-  // Expect 1 normal workorder in total for this operator.
-  EXPECT_EQ(1u, w.getNumNormalWorkOrders(0));
-  EXPECT_EQ(0u, w.getNumRebuildWorkOrders(0));
-
-  // Add the WorkOrder with no NUMA node.
-  w.addNormalWorkOrder(&no_numa_work_order, 0);
-
-  for (std::size_t i = 0; i < kNUMANodesUsed; ++i) {
-    // Check the count of per NUMA node workorders.
-    EXPECT_EQ(1u, w.getNumNormalWorkOrdersForNUMANode(0, numa_nodes[i]));
-  }
-
-  // Expect 2 normal workorders in total for this operator.
-  EXPECT_EQ(2u, w.getNumNormalWorkOrders(0));
-  EXPECT_EQ(0u, w.getNumRebuildWorkOrders(0));
-
-  // Add the WorkOrder with exactly one NUMA node.
-  w.addNormalWorkOrder(&one_numa_work_order, 0);
-
-  EXPECT_EQ(2u, w.getNumNormalWorkOrdersForNUMANode(0, numa_nodes[0]));
-  EXPECT_EQ(1u, w.getNumNormalWorkOrdersForNUMANode(0, numa_nodes[1]));
-
-  // Expect 3 normal workorders in total for this operator.
-  EXPECT_EQ(3u, w.getNumNormalWorkOrders(0));
-  EXPECT_EQ(0u, w.getNumRebuildWorkOrders(0));
-
-  // Retrieve the workorders for NUMA node = numa_nodes[0]
-  MockNUMAWorkOrder *observed_work_order = static_cast<MockNUMAWorkOrder *>(
-      w.getNormalWorkOrderForNUMANode(0, numa_nodes[0]));
-  ASSERT_TRUE(observed_work_order != nullptr);
-
-  EXPECT_EQ(query_id, observed_work_order->getQueryID());
-  EXPECT_EQ(one_numa_work_order.getPreferredNUMANodes().front(),
-            observed_work_order->getPreferredNUMANodes().front());
-  EXPECT_EQ(one_numa_work_order.getID(), observed_work_order->getID());
-
-  EXPECT_EQ(1u, w.getNumNormalWorkOrdersForNUMANode(0, numa_nodes[0]));
-  EXPECT_EQ(1u, w.getNumNormalWorkOrdersForNUMANode(0, numa_nodes[1]));
-
-  // Expect 2 normal workorders in total for this operator.
-  EXPECT_EQ(2u, w.getNumNormalWorkOrders(0));
-  EXPECT_EQ(0u, w.getNumRebuildWorkOrders(0));
-
-  // Retrieve the non NUMA workorder.
-  WorkOrder *observed_non_numa_work_order = w.getNormalWorkOrder(0);
-  ASSERT_TRUE(observed_non_numa_work_order != nullptr);
-  EXPECT_EQ(no_numa_work_order.getID(),
-            static_cast<MockNUMAWorkOrder *>(observed_non_numa_work_order)->getID());
-
-  EXPECT_EQ(query_id, observed_non_numa_work_order->getQueryID());
-  EXPECT_EQ(1u, w.getNumNormalWorkOrdersForNUMANode(0, numa_nodes[0]));
-  EXPECT_EQ(1u, w.getNumNormalWorkOrdersForNUMANode(0, numa_nodes[1]));
-
-  // Expect 1 normal workorders in total for this operator.
-  EXPECT_EQ(1u, w.getNumNormalWorkOrders(0));
-  EXPECT_EQ(0u, w.getNumRebuildWorkOrders(0));
-
-  // Retrieve the workorder with multiple NUMA nodes.
-  MockNUMAWorkOrder *observed_work_order_multiple_numa_nodes =
-      static_cast<MockNUMAWorkOrder *>(w.getNormalWorkOrder(0));
-  ASSERT_TRUE(observed_work_order_multiple_numa_nodes != nullptr);
-  EXPECT_EQ(multiple_numa_work_order.getID(), observed_work_order_multiple_numa_nodes->getID());
-
-  EXPECT_EQ(query_id, observed_work_order_multiple_numa_nodes->getQueryID());
-  std::vector<int> observed_numa_nodes(
-      observed_work_order_multiple_numa_nodes->getPreferredNUMANodes());
-  // Look up the expected numa nodes in the observed_numa_nodes vector.
-  EXPECT_TRUE(std::find(observed_numa_nodes.begin(), observed_numa_nodes.end(),
-                        numa_nodes[0]) != observed_numa_nodes.end());
-  EXPECT_TRUE(std::find(observed_numa_nodes.begin(), observed_numa_nodes.end(),
-                        numa_nodes[1]) != observed_numa_nodes.end());
-
-  EXPECT_EQ(0u, w.getNumNormalWorkOrdersForNUMANode(0, numa_nodes[0]));
-  EXPECT_EQ(0u, w.getNumNormalWorkOrdersForNUMANode(0, numa_nodes[1]));
-
-  // Expect no normal workorders in total for this operator.
-  EXPECT_EQ(0u, w.getNumNormalWorkOrders(0));
-  EXPECT_EQ(0u, w.getNumRebuildWorkOrders(0));
-}
-
-TEST(WorkOrdersContainerTest, MultipleOperatorsNormalWorkOrderTest) {
-  // Generate workorders for multiple operators and test their insertion and
-  // retrieval. Use the IDs of the WorkOrders to verify the correctness.
-
-  // Create the NUMA node vectors.
-  std::vector<int> numa_node_ids;
-
-  const std::size_t kNumOperators = 100;
-
-  // For each operator create normal workorders with no NUMA node.
-  PtrVector<MockNUMAWorkOrder> normal_workorders_no_numa;
-  std::vector<int> normal_workorders_no_numa_ids;
-  // Set of workorder IDs = {0, ... kNumOperators - 1}
-  for (std::size_t i = 0; i < kNumOperators; ++i) {
-    normal_workorders_no_numa_ids.push_back(i);
-    normal_workorders_no_numa.push_back(new MockNUMAWorkOrder(
-        normal_workorders_no_numa_ids.back(), numa_node_ids));
-  }
-
-  // Insert one NUMA node.
-  numa_node_ids.push_back(0);
-
-  // For each operator create normal workorders with one NUMA node.
-  PtrVector<MockNUMAWorkOrder> normal_workorders_one_numa;
-  std::vector<int> normal_workorders_one_numa_ids;
-  // Set of workorder IDs = {kNumOperators, .. , 2*kNumOperators - 1}
-  for (std::size_t i = 0; i < kNumOperators; ++i) {
-    normal_workorders_one_numa_ids.push_back(kNumOperators + i);
-    normal_workorders_one_numa.push_back(new MockNUMAWorkOrder(
-        normal_workorders_one_numa_ids.back(), numa_node_ids));
-  }
-
-  // Insert another NUMA node.
-  numa_node_ids.push_back(1);
-
-  // For each operator create normal workorders with more than one NUMA node.
-  PtrVector<MockNUMAWorkOrder> normal_workorders_multiple_numa;
-  std::vector<int> normal_workorders_multiple_numa_ids;
-  // Set of workorder IDs = {2*kNumOperators, .. , 3*kNumOperators - 1}
-  for (std::size_t i = 0; i < kNumOperators; ++i) {
-    normal_workorders_multiple_numa_ids.push_back(2*kNumOperators + i);
-    normal_workorders_multiple_numa.push_back(new MockNUMAWorkOrder(
-        normal_workorders_multiple_numa_ids.back(), numa_node_ids));
-  }
-
-  // TODO(harshad) : Design a test in which the number of NUMA nodes is
-  // configurable.
-  const std::size_t kNUMANodes = numa_node_ids.size();
-
-  // Create the container.
-  const std::size_t query_id = 0;
-  WorkOrdersContainer w(kNumOperators, kNUMANodes);
-
-  std::vector<std::size_t> operator_ids;
-  for (std::size_t i = 0; i < kNumOperators; ++i) {
-    operator_ids.push_back(i);
-  }
-
-  // Randomize the operator IDs.
-  std::random_shuffle(operator_ids.begin(), operator_ids.end());
-
-  // Insert the workorders.
-  for (std::size_t outer_op = 0; outer_op < kNumOperators; ++outer_op) {
-    const std::size_t curr_operator_id = operator_ids[outer_op];
-    // Check the count of WorkOrders per operator.
-    for (std::size_t inner_op = 0; inner_op < kNumOperators; ++inner_op) {
-      if (inner_op < outer_op) {
-        // WorkOrders inserted already.
-        EXPECT_EQ(3u, w.getNumNormalWorkOrders(operator_ids[inner_op]));
-        EXPECT_TRUE(w.hasNormalWorkOrder(operator_ids[inner_op]));
-        EXPECT_EQ(0u, w.getNumRebuildWorkOrders(operator_ids[inner_op]));
-        EXPECT_FALSE(w.hasRebuildWorkOrder(operator_ids[inner_op]));
-        // Number of WorkOrders : NUMA Node
-        // 2 : 0
-        // 1 : 1
-        for (int numa_node_used = kNUMANodes - 1; numa_node_used >= 0;
-             --numa_node_used) {
-          EXPECT_EQ(kNUMANodes - numa_node_used,
-                    w.getNumNormalWorkOrdersForNUMANode(
-                        operator_ids[inner_op], numa_node_ids[numa_node_used]));
-          EXPECT_TRUE(w.hasNormalWorkOrderForNUMANode(
-              operator_ids[inner_op], numa_node_ids[numa_node_used]));
-        }
-      } else {
-        // WorkOrders yet to be inserted.
-        EXPECT_EQ(0u, w.getNumNormalWorkOrders(operator_ids[inner_op]));
-        EXPECT_FALSE(w.hasNormalWorkOrder(operator_ids[inner_op]));
-        EXPECT_EQ(0u, w.getNumRebuildWorkOrders(operator_ids[inner_op]));
-        EXPECT_FALSE(w.hasRebuildWorkOrder(operator_ids[inner_op]));
-        for (int numa_node_used = kNUMANodes - 1; numa_node_used >= 0;
-             --numa_node_used) {
-          EXPECT_EQ(
-              0u, w.getNumNormalWorkOrdersForNUMANode(
-                     operator_ids[inner_op], numa_node_ids[numa_node_used]));
-          EXPECT_FALSE(w.hasNormalWorkOrderForNUMANode(
-              operator_ids[inner_op], numa_node_ids[numa_node_used]));
-        }
-      }
-    }
-    // Insert the workorder with multiple NUMA nodes.
-    w.addNormalWorkOrder(&(normal_workorders_multiple_numa[curr_operator_id]),
-                        curr_operator_id);
-    // Insert the workorder with no NUMA node.
-    w.addNormalWorkOrder(&(normal_workorders_no_numa[curr_operator_id]),
-                        curr_operator_id);
-    // Insert the workorder with one NUMA node.
-    w.addNormalWorkOrder(&(normal_workorders_one_numa[curr_operator_id]),
-                        curr_operator_id);
-  }
-
-  // Randomize the operator IDs again and retrieve the WorkOrders.
-  std::random_shuffle(operator_ids.begin(), operator_ids.end());
-  for (std::size_t outer_op = 0; outer_op < kNumOperators; ++outer_op) {
-    const std::size_t curr_operator_id = operator_ids[outer_op];
-    // Check if the existing WorkOrder counts are correct.
-    for (std::size_t inner_op = 0; inner_op < kNumOperators; ++inner_op) {
-      if (inner_op >= outer_op) {
-        // WorkOrders not yet retrieved.
-        EXPECT_EQ(3u, w.getNumNormalWorkOrders(operator_ids[inner_op]));
-        EXPECT_TRUE(w.hasNormalWorkOrder(operator_ids[inner_op]));
-        EXPECT_EQ(0u, w.getNumRebuildWorkOrders(operator_ids[inner_op]));
-        EXPECT_FALSE(w.hasRebuildWorkOrder(operator_ids[inner_op]));
-        // Number of WorkOrders : NUMA Node
-        // 2 : 0
-        // 1 : 1
-        for (int numa_node_used = kNUMANodes - 1; numa_node_used >= 0;
-             --numa_node_used) {
-          EXPECT_EQ(
-              kNUMANodes - numa_node_used,
-              w.getNumNormalWorkOrdersForNUMANode(
-                  operator_ids[inner_op], numa_node_ids[numa_node_used]));
-          EXPECT_TRUE(w.hasNormalWorkOrderForNUMANode(
-              operator_ids[inner_op], numa_node_ids[numa_node_used]));
-        }
-      } else {
-        // WorkOrders already retrieved.
-        EXPECT_EQ(0u, w.getNumNormalWorkOrders(operator_ids[inner_op]));
-        EXPECT_FALSE(w.hasNormalWorkOrder(operator_ids[inner_op]));
-        EXPECT_EQ(0u, w.getNumRebuildWorkOrders(operator_ids[inner_op]));
-        EXPECT_FALSE(w.hasRebuildWorkOrder(operator_ids[inner_op]));
-        for (int numa_node_used = kNUMANodes - 1; numa_node_used >= 0;
-             --numa_node_used) {
-          EXPECT_EQ(
-              0u, w.getNumNormalWorkOrdersForNUMANode(
-                     operator_ids[inner_op], numa_node_ids[numa_node_used]));
-          EXPECT_FALSE(w.hasNormalWorkOrderForNUMANode(
-              operator_ids[inner_op], numa_node_ids[numa_node_used]));
-        }
-      }
-    }
-    // There is a workorder with exactly one NUMA node, get that node id.
-    const std::size_t single_numa_node_id = numa_node_ids.front();
-    // There is a workorder with more than one NUMA node, get that node id
-    // (which is different than the node id above).
-    const std::size_t multiple_numa_node_id = numa_node_ids.back();
-
-    // Retrieve a single NUMA node workorder.
-    MockNUMAWorkOrder *observed_work_order_single_numa =
-        static_cast<MockNUMAWorkOrder *>(w.getNormalWorkOrderForNUMANode(
-            curr_operator_id, single_numa_node_id));
-    ASSERT_TRUE(observed_work_order_single_numa != nullptr);
-
-    EXPECT_EQ(query_id, observed_work_order_single_numa->getQueryID());
-    // Verify if the workorder ID is correct.
-    const int expected_workorder_id_single_numa =
-        normal_workorders_one_numa_ids[curr_operator_id];
-    EXPECT_EQ(expected_workorder_id_single_numa,
-              observed_work_order_single_numa->getID());
-
-    // Retrieve a multiple NUMA node workorder.
-    MockNUMAWorkOrder *observed_work_order_multiple_numa =
-        static_cast<MockNUMAWorkOrder *>(w.getNormalWorkOrderForNUMANode(
-            curr_operator_id, multiple_numa_node_id));
-    ASSERT_TRUE(observed_work_order_multiple_numa != nullptr);
-
-    EXPECT_EQ(query_id, observed_work_order_multiple_numa->getQueryID());
-    // Verify if the workorder ID is correct.
-    const int expected_workorder_id_multiple_numa =
-        normal_workorders_multiple_numa_ids[curr_operator_id];
-
-    EXPECT_EQ(expected_workorder_id_multiple_numa,
-              observed_work_order_multiple_numa->getID());
-
-    // Retrieve a no NUMA node workorder.
-    MockNUMAWorkOrder *observed_work_order_no_numa =
-        static_cast<MockNUMAWorkOrder *>(w.getNormalWorkOrder(curr_operator_id));
-    ASSERT_TRUE(observed_work_order_no_numa != nullptr);
-
-    EXPECT_EQ(query_id, observed_work_order_no_numa->getQueryID());
-    // Verify if the workorder ID is correct.
-    const int expected_workorder_id_no_numa =
-        normal_workorders_no_numa_ids[curr_operator_id];
-
-    EXPECT_EQ(expected_workorder_id_no_numa, observed_work_order_no_numa->getID());
-  }
-}
-
-TEST(WorkOrdersContainerTest, MultipleOperatorsRebuildWorkOrderTest) {
-  // This test is exactly similar to previous one, except that this test checks
-  // rebuild workorders related interface.
-
-  // Create the NUMA node vectors.
-  std::vector<int> numa_node_ids;
-
-  const std::size_t kNumOperators = 100;
-
-  // For each operator create rebuild workorders with no NUMA node.
-  PtrVector<MockNUMAWorkOrder> rebuild_workorders_no_numa;
-  std::vector<int> rebuild_workorders_no_numa_ids;
-  // Set of workorder IDs = {0, ... kNumOperators - 1}
-  for (std::size_t i = 0; i < kNumOperators; ++i) {
-    rebuild_workorders_no_numa_ids.push_back(i);
-    rebuild_workorders_no_numa.push_back(new MockNUMAWorkOrder(
-        rebuild_workorders_no_numa_ids.back(), numa_node_ids));
-  }
-
-  // Insert one NUMA node.
-  numa_node_ids.push_back(0);
-
-  // For each operator create rebuild workorders with one NUMA node.
-  PtrVector<MockNUMAWorkOrder> rebuild_workorders_one_numa;
-  std::vector<int> rebuild_workorders_one_numa_ids;
-  // Set of workorder IDs = {kNumOperators, .. , 2*kNumOperators - 1}
-  for (std::size_t i = 0; i < kNumOperators; ++i) {
-    rebuild_workorders_one_numa_ids.push_back(kNumOperators + i);
-    rebuild_workorders_one_numa.push_back(new MockNUMAWorkOrder(
-        rebuild_workorders_one_numa_ids.back(), numa_node_ids));
-  }
-
-  // Insert another NUMA node.
-  numa_node_ids.push_back(1);
-
-  // For each operator create rebuild workorders with more than one NUMA node.
-  PtrVector<MockNUMAWorkOrder> rebuild_workorders_multiple_numa;
-  std::vector<int> rebuild_workorders_multiple_numa_ids;
-  // Set of workorder IDs = {2*kNumOperators, .. , 3*kNumOperators - 1}
-  for (std::size_t i = 0; i < kNumOperators; ++i) {
-    rebuild_workorders_multiple_numa_ids.push_back(2*kNumOperators + i);
-    rebuild_workorders_multiple_numa.push_back(new MockNUMAWorkOrder(
-        rebuild_workorders_multiple_numa_ids.back(), numa_node_ids));
-  }
-
-  // TODO(harshad) : Design a test in which the number of NUMA nodes is
-  // configurable.
-  const std::size_t kNUMANodes = numa_node_ids.size();
-
-  // Create the container.
-  const std::size_t query_id = 0;
-  WorkOrdersContainer w(kNumOperators, kNUMANodes);
-
-  std::vector<std::size_t> operator_ids;
-  for (std::size_t i = 0; i < kNumOperators; ++i) {
-    operator_ids.push_back(i);
-  }
-
-  // Randomize the operator IDs.
-  std::random_shuffle(operator_ids.begin(), operator_ids.end());
-
-  // Insert the workorders.
-  for (std::size_t outer_op = 0; outer_op < kNumOperators; ++outer_op) {
-    const std::size_t curr_operator_id = operator_ids[outer_op];
-    // Check the count of WorkOrders per operator.
-    for (std::size_t inner_op = 0; inner_op < kNumOperators; ++inner_op) {
-      if (inner_op < outer_op) {
-        // WorkOrders inserted already.
-        EXPECT_EQ(3u, w.getNumRebuildWorkOrders(operator_ids[inner_op]));
-        EXPECT_TRUE(w.hasRebuildWorkOrder(operator_ids[inner_op]));
-        EXPECT_EQ(0u, w.getNumNormalWorkOrders(operator_ids[inner_op]));
-        EXPECT_FALSE(w.hasNormalWorkOrder(operator_ids[inner_op]));
-        // Number of WorkOrders : NUMA Node
-        // 2 : 0
-        // 1 : 1
-        for (int numa_node_used = kNUMANodes - 1; numa_node_used >= 0;
-             --numa_node_used) {
-          EXPECT_EQ(
-              kNUMANodes - numa_node_used,
-              w.getNumRebuildWorkOrdersForNUMANode(
-                  operator_ids[inner_op], numa_node_ids[numa_node_used]));
-          EXPECT_TRUE(w.hasRebuildWorkOrderForNUMANode(
-              operator_ids[inner_op], numa_node_ids[numa_node_used]));
-        }
-      } else {
-        // WorkOrders yet to be inserted.
-        EXPECT_EQ(0u, w.getNumRebuildWorkOrders(operator_ids[inner_op]));
-        EXPECT_FALSE(w.hasRebuildWorkOrder(operator_ids[inner_op]));
-        EXPECT_EQ(0u, w.getNumNormalWorkOrders(operator_ids[inner_op]));
-        EXPECT_FALSE(w.hasNormalWorkOrder(operator_ids[inner_op]));
-        for (int numa_node_used = kNUMANodes - 1; numa_node_used >= 0;
-             --numa_node_used) {
-          EXPECT_EQ(
-              0u, w.getNumRebuildWorkOrdersForNUMANode(
-                     operator_ids[inner_op], numa_node_ids[numa_node_used]));
-          EXPECT_FALSE(w.hasRebuildWorkOrderForNUMANode(
-              operator_ids[inner_op], numa_node_ids[numa_node_used]));
-        }
-      }
-    }
-    // Insert the workorder with multiple NUMA nodes.
-    w.addRebuildWorkOrder(&(rebuild_workorders_multiple_numa[curr_operator_id]),
-                         curr_operator_id);
-    // Insert the workorder with no NUMA node.
-    w.addRebuildWorkOrder(&(rebuild_workorders_no_numa[curr_operator_id]),
-                         curr_operator_id);
-    // Insert the workorder with one NUMA node.
-    w.addRebuildWorkOrder(&(rebuild_workorders_one_numa[curr_operator_id]),
-                         curr_operator_id);
-  }
-
-  // Randomize the operator IDs again and retrieve the WorkOrders.
-  std::random_shuffle(operator_ids.begin(), operator_ids.end());
-  for (std::size_t outer_op = 0; outer_op < kNumOperators; ++outer_op) {
-    const std::size_t curr_operator_id = operator_ids[outer_op];
-    // Check if the existing WorkOrder counts are correct.
-    for (std::size_t inner_op = 0; inner_op < kNumOperators; ++inner_op) {
-      if (inner_op >= outer_op) {
-        // WorkOrders not yet retrieved.
-        EXPECT_EQ(3u, w.getNumRebuildWorkOrders(operator_ids[inner_op]));
-        EXPECT_TRUE(w.hasRebuildWorkOrder(operator_ids[inner_op]));
-        EXPECT_EQ(0u, w.getNumNormalWorkOrders(operator_ids[inner_op]));
-        EXPECT_FALSE(w.hasNormalWorkOrder(operator_ids[inner_op]));
-        // Number of WorkOrders : NUMA Node
-        // 2 : 0
-        // 1 : 1
-        for (int numa_node_used = kNUMANodes - 1; numa_node_used >= 0;
-             --numa_node_used) {
-          EXPECT_EQ(
-              kNUMANodes - numa_node_used,
-              w.getNumRebuildWorkOrdersForNUMANode(
-                  operator_ids[inner_op], numa_node_ids[numa_node_used]));
-          EXPECT_TRUE(w.hasRebuildWorkOrderForNUMANode(
-              operator_ids[inner_op], numa_node_ids[numa_node_used]));
-        }
-      } else {
-        // WorkOrders already retrieved.
-        EXPECT_EQ(0u, w.getNumRebuildWorkOrders(operator_ids[inner_op]));
-        EXPECT_FALSE(w.hasRebuildWorkOrder(operator_ids[inner_op]));
-        EXPECT_EQ(0u, w.getNumNormalWorkOrders(operator_ids[inner_op]));
-        EXPECT_FALSE(w.hasNormalWorkOrder(operator_ids[inner_op]));
-        for (int numa_node_used = kNUMANodes - 1; numa_node_used >= 0;
-             --numa_node_used) {
-          EXPECT_EQ(
-              0u, w.getNumRebuildWorkOrdersForNUMANode(
-                     operator_ids[inner_op], numa_node_ids[numa_node_used]));
-          EXPECT_FALSE(w.hasRebuildWorkOrderForNUMANode(
-              operator_ids[inner_op], numa_node_ids[numa_node_used]));
-        }
-      }
-    }
-    // There is a workorder with exactly one NUMA node, get that node id.
-    const std::size_t single_numa_node_id = numa_node_ids.front();
-    // There is a workorder with more than one NUMA node, get that node id
-    // (which is different than the node id above).
-    const std::size_t multiple_numa_node_id = numa_node_ids.back();
-
-    // Retrieve a single NUMA node workorder.
-    MockNUMAWorkOrder *observed_work_order_single_numa =
-        static_cast<MockNUMAWorkOrder *>(w.getRebuildWorkOrderForNUMANode(
-            curr_operator_id, single_numa_node_id));
-    ASSERT_TRUE(observed_work_order_single_numa != nullptr);
-
-    EXPECT_EQ(query_id, observed_work_order_single_numa->getQueryID());
-    // Verify if the workorder ID is correct.
-    const int expected_workorder_id_single_numa =
-        rebuild_workorders_one_numa_ids[curr_operator_id];
-    EXPECT_EQ(expected_workorder_id_single_numa,
-              observed_work_order_single_numa->getID());
-
-    // Retrieve a multiple NUMA node workorder.
-    MockNUMAWorkOrder *observed_work_order_multiple_numa =
-        static_cast<MockNUMAWorkOrder *>(w.getRebuildWorkOrderForNUMANode(
-            curr_operator_id, multiple_numa_node_id));
-    ASSERT_TRUE(observed_work_order_multiple_numa != nullptr);
-
-    EXPECT_EQ(query_id, observed_work_order_multiple_numa->getQueryID());
-    // Verify if the workorder ID is correct.
-    const int expected_workorder_id_multiple_numa =
-        rebuild_workorders_multiple_numa_ids[curr_operator_id];
-
-    EXPECT_EQ(expected_workorder_id_multiple_numa,
-              observed_work_order_multiple_numa->getID());
-
-    // Retrieve a no NUMA node workorder.
-    MockNUMAWorkOrder *observed_work_order_no_numa =
-        static_cast<MockNUMAWorkOrder *>(w.getRebuildWorkOrder(curr_operator_id));
-
-    EXPECT_EQ(query_id, observed_work_order_no_numa->getQueryID());
-    // Verify if the workorder ID is correct.
-    const int expected_workorder_id_no_numa =
-        rebuild_workorders_no_numa_ids[curr_operator_id];
-
-    EXPECT_EQ(expected_workorder_id_no_numa, observed_work_order_no_numa->getID());
-  }
-}
-
-TEST(WorkOrdersContainerTest, RetrievalOrderTest) {
-  // Create only two kinds of workorders -
-  // 1. WorkOrder with exactly one NUMA node as input.
-  // 2. WorkOrder with more than one NUMA node as input.
-  // Vary the parameter prefer_single_NUMA_node and verify the behavior.
-  std::vector<int> numa_node_ids;
-  numa_node_ids.push_back(0);
-  const std::size_t kNumWorkOrdersPerType = 100;
-
-  const std::size_t query_id = 0;
-  WorkOrdersContainer w(1, 2);
-
-  std::vector<int> single_numa_node_workorder_ids;
-  std::vector<int> multiple_numa_node_workorder_ids;
-
-  PtrVector<MockNUMAWorkOrder> single_numa_node_workorders;
-  PtrVector<MockNUMAWorkOrder> multiple_numa_node_workorders;
-
-  // Insert WorkOrders with exactly one NUMA node and store the WorkOrder IDs.
-  for (std::size_t work_order_num = 0;
-       work_order_num < kNumWorkOrdersPerType;
-       ++work_order_num) {
-    w.addNormalWorkOrder(new MockNUMAWorkOrder(work_order_num, numa_node_ids), 0);
-    single_numa_node_workorder_ids.push_back(work_order_num);
-  }
-
-  numa_node_ids.push_back(1);
-
-  // Insert WorkOrders with more than one NUMA node and store the WorkOrder IDs.
-  for (std::size_t work_order_num = 0;
-       work_order_num < kNumWorkOrdersPerType;
-       ++work_order_num) {
-    w.addNormalWorkOrder(
-        new MockNUMAWorkOrder(work_order_num + kNumWorkOrdersPerType, numa_node_ids),
-        0);
-    multiple_numa_node_workorder_ids.push_back(kNumWorkOrdersPerType + work_order_num);
-  }
-
-  // Create a vector of booleans of size kNumWorkOrdersPerType * 2
-  std::vector<bool> retrieval_order;
-  for (std::size_t i = 0; i < kNumWorkOrdersPerType; ++i) {
-    retrieval_order.push_back(true);
-    retrieval_order.push_back(false);
-  }
-
-  // Randomize the order of retrieval.
-  std::random_shuffle(retrieval_order.begin(), retrieval_order.end());
-
-  std::vector<int>::iterator single_numa_it =
-      single_numa_node_workorder_ids.begin();
-  std::vector<int>::iterator multiple_numa_it =
-      multiple_numa_node_workorder_ids.begin();
-
-  for (bool prefer_single_NUMA_node : retrieval_order) {
-    // Retrieve the WorkOrder.
-    MockNUMAWorkOrder *observed_work_order = static_cast<MockNUMAWorkOrder *>(
-        w.getNormalWorkOrder(0, prefer_single_NUMA_node));
-    ASSERT_TRUE(observed_work_order != nullptr);
-    EXPECT_EQ(query_id, observed_work_order->getQueryID());
-    if (prefer_single_NUMA_node) {
-      EXPECT_EQ(*single_numa_it, observed_work_order->getID());
-      EXPECT_EQ(1u, observed_work_order->getPreferredNUMANodes().size());
-      ++single_numa_it;
-    } else {
-      EXPECT_EQ(*multiple_numa_it, observed_work_order->getID());
-      EXPECT_EQ(2u, observed_work_order->getPreferredNUMANodes().size());
-      ++multiple_numa_it;
-    }
-  }
-  DEBUG_ASSERT(single_numa_it == single_numa_node_workorder_ids.end());
-  DEBUG_ASSERT(multiple_numa_it == multiple_numa_node_workorder_ids.end());
-
-  // Expect no more workorders.
-  EXPECT_EQ(nullptr, w.getNormalWorkOrder(0, true));
-  EXPECT_EQ(nullptr, w.getNormalWorkOrder(0, false));
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_execution/tests/WorkerDirectory_unittest.cpp
----------------------------------------------------------------------
diff --git a/query_execution/tests/WorkerDirectory_unittest.cpp b/query_execution/tests/WorkerDirectory_unittest.cpp
deleted file mode 100644
index 2eab75d..0000000
--- a/query_execution/tests/WorkerDirectory_unittest.cpp
+++ /dev/null
@@ -1,296 +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 <algorithm>
-#include <cstddef>
-#include <iterator>
-#include <memory>
-#include <random>
-#include <stack>
-#include <unordered_map>
-#include <utility>
-#include <vector>
-
-#include "gtest/gtest.h"
-
-#include "query_execution/QueryExecutionTypedefs.hpp"
-#include "query_execution/WorkerDirectory.hpp"
-
-namespace quickstep {
-
-class WorkerDirectoryTest : public ::testing::Test {
- protected:
-  // First element is the index of the min element, second element is the
-  // value of the min element.
-  static std::pair<std::size_t, std::size_t> getMinElement(
-      const std::vector<std::size_t> &input_vector) {
-    std::vector<std::size_t>::const_iterator min_element_iter =
-            std::min_element(std::begin(input_vector), std::end(input_vector));
-    const std::size_t min_element_id =
-        std::distance(input_vector.begin(), min_element_iter);
-    return std::make_pair(min_element_id, *min_element_iter);
-  }
-
-  // First element is the index of the max element, second element is the
-  // value of the max element.
-  static std::pair<std::size_t, std::size_t> getMaxElement(
-      const std::vector<std::size_t> &input_vector) {
-    std::vector<std::size_t>::const_iterator max_element_iter =
-            std::max_element(std::begin(input_vector), std::end(input_vector));
-    const std::size_t max_element_id =
-        std::distance(input_vector.begin(), max_element_iter);
-    return std::make_pair(max_element_id, *max_element_iter);
-  }
-
-  void SetUp() {
-    std::vector<int> numa_nodes;
-    std::vector<client_id> client_ids;
-
-    numa_nodes.reserve(kNumWorkers);
-    client_ids.reserve(kNumWorkers);
-
-    for (std::size_t worker_thread_index = 0; worker_thread_index < kNumWorkers; ++worker_thread_index) {
-      // NUMA node id = worker_thread_index % 4
-      // Client ID = worker_thread_index * 2 + 1
-      const client_id cid = worker_thread_index * 2 + 1;
-      const int numa_node_id = worker_thread_index % 4;
-
-      numa_nodes.push_back(numa_node_id);
-      client_ids.push_back(cid);
-
-      worker_thread_indexs_.push_back(worker_thread_index);
-      actual_workers_[worker_thread_index] = std::make_pair(numa_node_id, cid);
-    }
-    wd_.reset(new WorkerDirectory(kNumWorkers, client_ids, numa_nodes));
-
-    // Randomize the order of worker IDs.
-    std::random_shuffle(worker_thread_indexs_.begin(), worker_thread_indexs_.end());
-  }
-
-  // First element is NUMA Node. Second element is client ID.
-  // Input is the logical worker ID.
-  std::pair<int, client_id> getNUMANodeAndClientIDForWorker(
-      const std::size_t worker_thread_index) {
-    return actual_workers_[worker_thread_index];
-  }
-
-  WorkerDirectory* getWorkerDirectory() {
-    return wd_.get();
-  }
-
-  std::size_t getActualNumWorkers() const {
-    return kNumWorkers;
-  }
-
-  std::vector<size_t>& getRandomizedWorkerIDs() {
-    std::random_shuffle(worker_thread_indexs_.begin(), worker_thread_indexs_.end());
-    return worker_thread_indexs_;
-  }
-
- private:
-  std::unique_ptr<WorkerDirectory> wd_;
-
-  // Key = Worker's logical ID
-  // Value = pair <NUMA node ID, client ID> for the worker.
-  std::unordered_map<std::size_t, std::pair<int, client_id>> actual_workers_;
-
-  std::vector<std::size_t> worker_thread_indexs_;
-
-  const std::size_t kNumWorkers = 100;
-};
-
-TEST_F(WorkerDirectoryTest, NUMANodeAndClientIDTest) {
-  // Check if the NUMA node ID and client IDs are set correctly and the number
-  // of queued workorders is initialized correctly.
-  WorkerDirectory *wd = getWorkerDirectory();
-
-  EXPECT_EQ(getActualNumWorkers(), wd->getNumWorkers());
-
-  for (std::size_t worker_thread_index : getRandomizedWorkerIDs()) {
-    const std::pair<int, client_id> observed_ids =
-        getNUMANodeAndClientIDForWorker(worker_thread_index);
-    EXPECT_EQ(observed_ids.first, wd->getNUMANode(worker_thread_index));
-    EXPECT_EQ(observed_ids.second, wd->getClientID(worker_thread_index));
-    EXPECT_EQ(0u, wd->getNumQueuedWorkOrders(worker_thread_index));
-  }
-}
-
-TEST_F(WorkerDirectoryTest, IncrementAndDecrementWorkOrdersTest) {
-  // Increment and decrement the workorders for workers.
-  // Check if the NUMA node ID and client IDs are set correctly and the number
-  WorkerDirectory *wd = getWorkerDirectory();
-  EXPECT_EQ(getActualNumWorkers(), wd->getNumWorkers());
-
-  std::vector<std::size_t> actual_num_workorders;
-  actual_num_workorders.resize(getActualNumWorkers(), 0);
-
-  // We perform the increment and decrement in workorders as determined by a
-  // pre-initialized sequence.
-  // true = increment and false = decrement in number of workorders.
-  std::vector<bool> increment_decrement_mini_sequence(
-      {true, true, false, true, false, false, true, false});
-
-  std::vector<bool> increment_decrement_sequence;
-
-  // Insert the mini sequence into sequence kNumWorkers number of times.
-  for (std::size_t i = 0; i < getActualNumWorkers(); ++i) {
-    increment_decrement_sequence.insert(
-        increment_decrement_sequence.end(),
-        increment_decrement_mini_sequence.cbegin(),
-        increment_decrement_mini_sequence.cend());
-  }
-
-  std::random_device rd;
-  std::mt19937 mt(rd());
-  std::uniform_int_distribution<std::size_t> dist(0, getActualNumWorkers() - 1);
-
-  // Perform the increment or decrement operation as determined by the sequence
-  // and check the correctness.
-  std::stack<std::size_t> worker_thread_indexs_used;
-  for (bool to_increment : increment_decrement_sequence) {
-    if (to_increment) {
-      // Pick a random worker ID and increment its number of workorders.
-      const std::size_t chosen_worker_thread_index = dist(mt);
-      worker_thread_indexs_used.push(chosen_worker_thread_index);
-      EXPECT_EQ(actual_num_workorders[chosen_worker_thread_index],
-                wd->getNumQueuedWorkOrders(chosen_worker_thread_index));
-      wd->incrementNumQueuedWorkOrders(chosen_worker_thread_index);
-      ++actual_num_workorders[chosen_worker_thread_index];
-      EXPECT_EQ(actual_num_workorders[chosen_worker_thread_index],
-                wd->getNumQueuedWorkOrders(chosen_worker_thread_index));
-    } else {
-      // For the worker with ID = top of stack, decrement a workorder.
-      const std::size_t chosen_worker_thread_index = worker_thread_indexs_used.top();
-      worker_thread_indexs_used.pop();
-      EXPECT_EQ(actual_num_workorders[chosen_worker_thread_index],
-                wd->getNumQueuedWorkOrders(chosen_worker_thread_index));
-      wd->decrementNumQueuedWorkOrders(chosen_worker_thread_index);
-      --actual_num_workorders[chosen_worker_thread_index];
-      EXPECT_EQ(actual_num_workorders[chosen_worker_thread_index],
-                wd->getNumQueuedWorkOrders(chosen_worker_thread_index));
-    }
-  }
-
-  // Stack should be empty.
-  EXPECT_TRUE(worker_thread_indexs_used.empty());
-  // Expect no queued up workorders for any worker.
-  for (const std::size_t random_worker_thread_index : getRandomizedWorkerIDs()) {
-    EXPECT_EQ(0u, wd->getNumQueuedWorkOrders(random_worker_thread_index));
-    EXPECT_EQ(actual_num_workorders[random_worker_thread_index],
-              wd->getNumQueuedWorkOrders(random_worker_thread_index));
-  }
-}
-
-TEST_F(WorkerDirectoryTest, AddWorkerTest) {
-  // Add a worker to the worker directory after constructor call.
-  WorkerDirectory *wd = getWorkerDirectory();
-  EXPECT_EQ(getActualNumWorkers(), wd->getNumWorkers());
-
-  const client_id new_worker_client_id = getActualNumWorkers() * 2 + 1;
-  const int new_worker_numa_node = 4;
-  wd->addWorker(new_worker_client_id, new_worker_numa_node);
-
-  // The logical ID of the new worker.
-  const std::size_t new_worker_thread_index = getActualNumWorkers();
-
-  EXPECT_EQ(getActualNumWorkers() + 1, wd->getNumWorkers());
-  // Check if the client ID is set correctly.
-  EXPECT_EQ(new_worker_client_id, wd->getClientID(new_worker_thread_index));
-  // Check if the NUMA node ID is set correctly.
-  EXPECT_EQ(new_worker_numa_node, wd->getNUMANode(new_worker_thread_index));
-  // Check if the new worker has no queued up workorders.
-  EXPECT_EQ(0u, wd->getNumQueuedWorkOrders(new_worker_thread_index));
-  // Increment a workorder for the new worker, check if the increment is
-  // successful, then perform a decrement and check the correctness.
-  wd->incrementNumQueuedWorkOrders(new_worker_thread_index);
-  EXPECT_EQ(1u, wd->getNumQueuedWorkOrders(new_worker_thread_index));
-  wd->decrementNumQueuedWorkOrders(new_worker_thread_index);
-  EXPECT_EQ(0u, wd->getNumQueuedWorkOrders(new_worker_thread_index));
-}
-
-TEST_F(WorkerDirectoryTest, WorkerLoadTest) {
-  // Assign load (in terms of number of workorders) to the workers and check if
-  // the least and most loaded worker is retrieved correctly.
-  WorkerDirectory *wd = getWorkerDirectory();
-  EXPECT_EQ(getActualNumWorkers(), wd->getNumWorkers());
-
-  std::vector<std::size_t> actual_num_workorders;
-  actual_num_workorders.resize(getActualNumWorkers(), 0);
-
-  // Loop over workers sequentially and increment workorder of all the workers.
-  for (std::size_t worker_thread_index = 0; worker_thread_index < getActualNumWorkers();
-       ++worker_thread_index) {
-    const std::pair<std::size_t, std::size_t> &actual_min_loaded_worker =
-        getMinElement(actual_num_workorders);
-    const std::pair<std::size_t, std::size_t> &actual_max_loaded_worker =
-        getMaxElement(actual_num_workorders);
-
-    EXPECT_EQ(actual_min_loaded_worker, wd->getLeastLoadedWorker());
-    EXPECT_EQ(actual_max_loaded_worker, wd->getMostLoadedWorker());
-
-    wd->incrementNumQueuedWorkOrders(worker_thread_index);
-    ++actual_num_workorders[worker_thread_index];
-    EXPECT_EQ(actual_num_workorders[worker_thread_index],
-              wd->getNumQueuedWorkOrders(worker_thread_index));
-  }
-
-  // At this time, every worker has exactly one workorder assigned to it.
-  // Now increment workorders in a random order.
-  for (const std::size_t random_worker_thread_index : getRandomizedWorkerIDs()) {
-    const std::pair<std::size_t, std::size_t> actual_min_loaded_worker =
-        getMinElement(actual_num_workorders);
-    const std::pair<std::size_t, std::size_t> actual_max_loaded_worker =
-        getMaxElement(actual_num_workorders);
-
-    EXPECT_EQ(actual_min_loaded_worker, wd->getLeastLoadedWorker());
-    EXPECT_EQ(actual_max_loaded_worker, wd->getMostLoadedWorker());
-
-    wd->incrementNumQueuedWorkOrders(random_worker_thread_index);
-    ++actual_num_workorders[random_worker_thread_index];
-    EXPECT_EQ(actual_num_workorders[random_worker_thread_index],
-              wd->getNumQueuedWorkOrders(random_worker_thread_index));
-  }
-
-  // At this time, every worker has two workorders assigned to it.
-  // Now decrement workorders in a random order twice.
-  for (std::size_t iteration = 0; iteration < 2; ++iteration) {
-    for (const std::size_t random_worker_thread_index : getRandomizedWorkerIDs()) {
-      const std::pair<std::size_t, std::size_t> actual_min_loaded_worker =
-          getMinElement(actual_num_workorders);
-      const std::pair<std::size_t, std::size_t> actual_max_loaded_worker =
-          getMaxElement(actual_num_workorders);
-
-      EXPECT_EQ(actual_min_loaded_worker, wd->getLeastLoadedWorker());
-      EXPECT_EQ(actual_max_loaded_worker, wd->getMostLoadedWorker());
-
-      wd->decrementNumQueuedWorkOrders(random_worker_thread_index);
-      --actual_num_workorders[random_worker_thread_index];
-      EXPECT_EQ(actual_num_workorders[random_worker_thread_index],
-                wd->getNumQueuedWorkOrders(random_worker_thread_index));
-    }
-  }
-  const std::pair<std::size_t, std::size_t> actual_min_loaded_worker =
-      getMinElement(actual_num_workorders);
-  const std::pair<std::size_t, std::size_t> actual_max_loaded_worker =
-      getMaxElement(actual_num_workorders);
-
-  EXPECT_EQ(actual_min_loaded_worker, wd->getLeastLoadedWorker());
-  EXPECT_EQ(actual_max_loaded_worker, wd->getMostLoadedWorker());
-}
-}  // namespace quickstep


[48/51] [abbrv] [partial] incubator-quickstep git commit: remove c++ files

Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/GENERATOR_FUNCTIONS.md
----------------------------------------------------------------------
diff --git a/GENERATOR_FUNCTIONS.md b/GENERATOR_FUNCTIONS.md
deleted file mode 100644
index 78b4079..0000000
--- a/GENERATOR_FUNCTIONS.md
+++ /dev/null
@@ -1,89 +0,0 @@
-#Generator functions
-
-##What are generator functions?
-Generator functions are functions that can return a sequence of values rather than a single value. In [many programming languages](https://en.wikipedia.org/wiki/Generator_%28computer_programming%29), they look like functions but behave like iterators.
-
-In Quickstep, a generator function takes a list of constant arguments at query compile time, and populates a relation at query run time. One example is the `generate_series` function, which in the simplest case takes two integer arguments `(start, end)` and generates a single-column table with values `start, start+1, ..., end`.
-
-##Use generator functions
-Usage of a generator function is similar to that of a normal function except that it is placed inside a SQL query's `FROM` clause.
-
-For example:
-```
-SELECT *
-FROM generate_series(1, 5);
-```
-And the output will be:
-```
-+---------------+
-|generate_series|
-+---------------+
-|              1|
-|              2|
-|              3|
-|              4|
-|              5|
-+---------------+
-```
-Here `generate_series(1, 5)` stands for a relation with 5 rows.
-
-A more complex example is:
-```
-SELECT i, j, i*j
-FROM generate_series(1, 3) AS gs1(i),
-     generate_series(1, 3) AS gs2(j)
-WHERE i <= j;
-```
-It is a theta-join between two generated relations. The output will be:
-```
-+-----------+-----------+-----------+
-|i          |j          |(i*j)      |
-+-----------+-----------+-----------+
-|          1|          1|          1|
-|          1|          2|          2|
-|          1|          3|          3|
-|          2|          2|          4|
-|          2|          3|          6|
-|          3|          3|          9|
-+-----------+-----------+-----------+
-```
-
-##Overview of the design that supports the feature
-1. Given a SQL query, at first each generator function call is parsed as an abstract syntax tree node carrying the function's name and arguments information.
-
- - *See `ParseGeneratorTableReference` as the abstract syntax tree node for generator functions.*
-
-2. Then, in `Resolver`, the generator function is resolved and its arguments are validated. If this process is successful, we obtain a function handle that contains the actual implementation of this function. A logic plan node is then created to hold the function handle and to represent the relation that this function will generate.
-
- - *See `GeneratorFunctionFactory` as the factory class that resolves a function from its name.*
- - *See `GeneratorFunction` as the abstract function class that checks the validity of arguments and creates the function handle.*
- - *See `GeneratorFunctionHandle` as the function handle class that provides the actual implementation of a particular generator function.*
- - *See `logical::TableGenerator` as the logical plan node class that represents the relation that a generator function will create.*
-
-3. The logical plan node `logical::TableGenerator` is then transformed into a physical plan node `physical::TableGenerator`.
- - *See `physical::TableGenerator` as the physical plan node class that represents the relation that a generator function will create.*
-
-4. At the final stage of query planning, the physical plan node is transformed into a relational operator.
- - *See `TableGeneratorOperator` as the relational operator class that represents a operator that will produce run-time work orders.*
-
-5. At the time of query execution, the function handle's `populateColumns()` method is invoked to actually generate a relation.
- - *See `TableGeneratorWorkOrder` as the work order class that actually invokes the generator function to populate a relation at run time.*
-
-##Implement a new generator function
-There are just three steps to implement a new generator function.
-
-1. Subclass **`GeneratorFunctionHandle`** and implement all virtual methods.
- - *See `GenerateSeriesHandle` as an example.*
-
-2. Subclass **`GeneratorFunction`** and implement all virtual methods. Also define a static `Instance()` method in the subclass to return a singleton instance reference.
- - *See `GenerateSeries` as an example.*
-
-3. Register the **`GeneratorFunction`** subclass into **`GeneratorFunctionFactory`** by adding into `GeneratorFunctionFactory`'s constructor a new line:
-```
-GeneratorFunctionFactory::GeneratorFunctionFactory() {
-  ...
-  // Register all generator functions here.
-  REGISTER_GENERATOR_FUNCTION_(YourGeneratorFunctionSubclass);
-  ...
-}
-```

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/LICENSE
----------------------------------------------------------------------
diff --git a/LICENSE b/LICENSE
deleted file mode 100644
index d645695..0000000
--- a/LICENSE
+++ /dev/null
@@ -1,202 +0,0 @@
-
-                                 Apache License
-                           Version 2.0, January 2004
-                        http://www.apache.org/licenses/
-
-   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-   1. Definitions.
-
-      "License" shall mean the terms and conditions for use, reproduction,
-      and distribution as defined by Sections 1 through 9 of this document.
-
-      "Licensor" shall mean the copyright owner or entity authorized by
-      the copyright owner that is granting the License.
-
-      "Legal Entity" shall mean the union of the acting entity and all
-      other entities that control, are controlled by, or are under common
-      control with that entity. For the purposes of this definition,
-      "control" means (i) the power, direct or indirect, to cause the
-      direction or management of such entity, whether by contract or
-      otherwise, or (ii) ownership of fifty percent (50%) or more of the
-      outstanding shares, or (iii) beneficial ownership of such entity.
-
-      "You" (or "Your") shall mean an individual or Legal Entity
-      exercising permissions granted by this License.
-
-      "Source" form shall mean the preferred form for making modifications,
-      including but not limited to software source code, documentation
-      source, and configuration files.
-
-      "Object" form shall mean any form resulting from mechanical
-      transformation or translation of a Source form, including but
-      not limited to compiled object code, generated documentation,
-      and conversions to other media types.
-
-      "Work" shall mean the work of authorship, whether in Source or
-      Object form, made available under the License, as indicated by a
-      copyright notice that is included in or attached to the work
-      (an example is provided in the Appendix below).
-
-      "Derivative Works" shall mean any work, whether in Source or Object
-      form, that is based on (or derived from) the Work and for which the
-      editorial revisions, annotations, elaborations, or other modifications
-      represent, as a whole, an original work of authorship. For the purposes
-      of this License, Derivative Works shall not include works that remain
-      separable from, or merely link (or bind by name) to the interfaces of,
-      the Work and Derivative Works thereof.
-
-      "Contribution" shall mean any work of authorship, including
-      the original version of the Work and any modifications or additions
-      to that Work or Derivative Works thereof, that is intentionally
-      submitted to Licensor for inclusion in the Work by the copyright owner
-      or by an individual or Legal Entity authorized to submit on behalf of
-      the copyright owner. For the purposes of this definition, "submitted"
-      means any form of electronic, verbal, or written communication sent
-      to the Licensor or its representatives, including but not limited to
-      communication on electronic mailing lists, source code control systems,
-      and issue tracking systems that are managed by, or on behalf of, the
-      Licensor for the purpose of discussing and improving the Work, but
-      excluding communication that is conspicuously marked or otherwise
-      designated in writing by the copyright owner as "Not a Contribution."
-
-      "Contributor" shall mean Licensor and any individual or Legal Entity
-      on behalf of whom a Contribution has been received by Licensor and
-      subsequently incorporated within the Work.
-
-   2. Grant of Copyright License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      copyright license to reproduce, prepare Derivative Works of,
-      publicly display, publicly perform, sublicense, and distribute the
-      Work and such Derivative Works in Source or Object form.
-
-   3. Grant of Patent License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      (except as stated in this section) patent license to make, have made,
-      use, offer to sell, sell, import, and otherwise transfer the Work,
-      where such license applies only to those patent claims licensable
-      by such Contributor that are necessarily infringed by their
-      Contribution(s) alone or by combination of their Contribution(s)
-      with the Work to which such Contribution(s) was submitted. If You
-      institute patent litigation against any entity (including a
-      cross-claim or counterclaim in a lawsuit) alleging that the Work
-      or a Contribution incorporated within the Work constitutes direct
-      or contributory patent infringement, then any patent licenses
-      granted to You under this License for that Work shall terminate
-      as of the date such litigation is filed.
-
-   4. Redistribution. You may reproduce and distribute copies of the
-      Work or Derivative Works thereof in any medium, with or without
-      modifications, and in Source or Object form, provided that You
-      meet the following conditions:
-
-      (a) You must give any other recipients of the Work or
-          Derivative Works a copy of this License; and
-
-      (b) You must cause any modified files to carry prominent notices
-          stating that You changed the files; and
-
-      (c) You must retain, in the Source form of any Derivative Works
-          that You distribute, all copyright, patent, trademark, and
-          attribution notices from the Source form of the Work,
-          excluding those notices that do not pertain to any part of
-          the Derivative Works; and
-
-      (d) If the Work includes a "NOTICE" text file as part of its
-          distribution, then any Derivative Works that You distribute must
-          include a readable copy of the attribution notices contained
-          within such NOTICE file, excluding those notices that do not
-          pertain to any part of the Derivative Works, in at least one
-          of the following places: within a NOTICE text file distributed
-          as part of the Derivative Works; within the Source form or
-          documentation, if provided along with the Derivative Works; or,
-          within a display generated by the Derivative Works, if and
-          wherever such third-party notices normally appear. The contents
-          of the NOTICE file are for informational purposes only and
-          do not modify the License. You may add Your own attribution
-          notices within Derivative Works that You distribute, alongside
-          or as an addendum to the NOTICE text from the Work, provided
-          that such additional attribution notices cannot be construed
-          as modifying the License.
-
-      You may add Your own copyright statement to Your modifications and
-      may provide additional or different license terms and conditions
-      for use, reproduction, or distribution of Your modifications, or
-      for any such Derivative Works as a whole, provided Your use,
-      reproduction, and distribution of the Work otherwise complies with
-      the conditions stated in this License.
-
-   5. Submission of Contributions. Unless You explicitly state otherwise,
-      any Contribution intentionally submitted for inclusion in the Work
-      by You to the Licensor shall be under the terms and conditions of
-      this License, without any additional terms or conditions.
-      Notwithstanding the above, nothing herein shall supersede or modify
-      the terms of any separate license agreement you may have executed
-      with Licensor regarding such Contributions.
-
-   6. Trademarks. This License does not grant permission to use the trade
-      names, trademarks, service marks, or product names of the Licensor,
-      except as required for reasonable and customary use in describing the
-      origin of the Work and reproducing the content of the NOTICE file.
-
-   7. Disclaimer of Warranty. Unless required by applicable law or
-      agreed to in writing, Licensor provides the Work (and each
-      Contributor provides its Contributions) on an "AS IS" BASIS,
-      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-      implied, including, without limitation, any warranties or conditions
-      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
-      PARTICULAR PURPOSE. You are solely responsible for determining the
-      appropriateness of using or redistributing the Work and assume any
-      risks associated with Your exercise of permissions under this License.
-
-   8. Limitation of Liability. In no event and under no legal theory,
-      whether in tort (including negligence), contract, or otherwise,
-      unless required by applicable law (such as deliberate and grossly
-      negligent acts) or agreed to in writing, shall any Contributor be
-      liable to You for damages, including any direct, indirect, special,
-      incidental, or consequential damages of any character arising as a
-      result of this License or out of the use or inability to use the
-      Work (including but not limited to damages for loss of goodwill,
-      work stoppage, computer failure or malfunction, or any and all
-      other commercial damages or losses), even if such Contributor
-      has been advised of the possibility of such damages.
-
-   9. Accepting Warranty or Additional Liability. While redistributing
-      the Work or Derivative Works thereof, You may choose to offer,
-      and charge a fee for, acceptance of support, warranty, indemnity,
-      or other liability obligations and/or rights consistent with this
-      License. However, in accepting such obligations, You may act only
-      on Your own behalf and on Your sole responsibility, not on behalf
-      of any other Contributor, and only if You agree to indemnify,
-      defend, and hold each Contributor harmless for any liability
-      incurred by, or claims asserted against, such Contributor by reason
-      of your accepting any such warranty or additional liability.
-
-   END OF TERMS AND CONDITIONS
-
-   APPENDIX: How to apply the Apache License to your work.
-
-      To apply the Apache License to your work, attach the following
-      boilerplate notice, with the fields enclosed by brackets "[]"
-      replaced with your own identifying information. (Don't include
-      the brackets!)  The text should be enclosed in the appropriate
-      comment syntax for the file format. We also recommend that a
-      file or class name and description of purpose be included on the
-      same "printed page" as the copyright notice for easier
-      identification within third-party archives.
-
-   Copyright [yyyy] [name of copyright owner]
-
-   Licensed 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.

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/NOTICE
----------------------------------------------------------------------
diff --git a/NOTICE b/NOTICE
deleted file mode 100644
index 3ead237..0000000
--- a/NOTICE
+++ /dev/null
@@ -1,44 +0,0 @@
-Apache Quickstep (incubating)
-Copyright 2016 The Apache Software Foundation.
-
-This product includes software developed at
-The Apache Software Foundation (http://www.apache.org/).
-
-Portions Copyright (c) 2011-2015, Quickstep Technologies, LLC.
-Portions Copyright (c) 2015-2016, Pivotal Software, Inc.
-
-[Copyright for third_party/benchmark]
-Portions Copyright (c) Arne Beer <ar...@twobeer.de>
-Portions Copyright (c) Christopher Seymour <ch...@hotmail.com>
-Portions Copyright (c) David Coeurjolly <da...@liris.cnrs.fr>
-Portions Copyright (c) Dominic Hamon <dm...@stripysock.com>
-Portions Copyright (c) Eugene Zhuk <eu...@gmail.com>
-Portions Copyright (c) Evgeny Safronov <di...@gmail.com>
-Portions Copyright (c) Felix Homann <li...@showlabor.de>
-Portions Copyright (c) Google Inc.
-Portions Copyright (c) JianXiong Zhou <zh...@gmail.com>
-Portions Copyright (c) Lei Xu <ed...@gmail.com>
-Portions Copyright (c) Matt Clarkson <ma...@gmail.com>
-Portions Copyright (c) Oleksandr Sochka <sa...@gmail.com>
-Portions Copyright (c) Paul Redmond <pa...@gmail.com>
-Portions Copyright (c) Shuo Chen <ch...@chenshuo.com>
-Portions Copyright (c) Yusuke Suzuki <ut...@gmail.com>
-
-[Copyright for third_party/cpplint]
-Portions Copyright (c) 2009 Google Inc
-
-[Copyright for third_party/farmhash]
-Copyright (c) 2014 Google, Inc.
-
-[Copyright for third_party/gflags]
-Copyright (c) 2006, Google Inc.
-
-[Copyright for third_party/glog]
-Copyright (c) 2008, Google Inc.
-
-[Copyright for third_party/gpertools]
-Copyright (c) 2005, Google Inc.
-
-[Copyright for third_party/linenoise]
-Copyright (c) 2010-2014, Salvatore Sanfilippo <antirez at gmail dot com>
-Copyright (c) 2010-2013, Pieter Noordhuis <pcnoordhuis at gmail dot com>

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/WORKING_WITH_AN_IDE.md
----------------------------------------------------------------------
diff --git a/WORKING_WITH_AN_IDE.md b/WORKING_WITH_AN_IDE.md
deleted file mode 100644
index 017a174..0000000
--- a/WORKING_WITH_AN_IDE.md
+++ /dev/null
@@ -1,178 +0,0 @@
-#Developing Quickstep with IDEs
-
-##Who should read this document?
-Any developer who prefers to work with IDEs instead of a terminal and
-vi, emacs, or the like. In other words, this document aims to make it easier
-for developers of Quickstep to work with IDEs. Over time, there will be
-information about working with other IDEs, but to start out, here are
-instructions for working with XCode on OSX.
-
-##Developing Quickstep with Xcode on OSX
-The instructions here were first written and verified on OSX El Capitan,
-v.10.11.2, using Xcode v.7.2.
-
-###1: Install Xcode and command line tools
-First, you will need to download and install Xcode and the associated command
-line tools. There are multiple ways to do this, including going to
-https://developer.apple.com/xcode/ and downloading both Xcode and the command
-line tools from there. Another way that works well if you do not have Xcode
-already installed is to simply open up the Terminal app and enter:
-
-```
-cc
-```
-
-This command should trigger a sequence of downloads to get you both Xcode
-and the assocaited command line tools.
-
-###2: Install cmake
-Unfortunately, the command line tools do not package `cmake`, which is needed
-to build Quickstep. You can install cmake using brew as follows:
-
-Visit http://brew.sh to determine the instructions to install brew. It will look
-something like:
-
-```
-ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
-```
-
-Once you have brew installed, simply use brew to install cmake from the
-Terminal app by typing:
-
-```
-brew install cmake
-```
-
-###3: Build Quicktep
-Checkout the Quickstep code from git, and also checkout the associated submodules.
-If you have not read it already, this would be good time to read the file
-[BUILDING.md](BUILDING.md), but do not run the cmake command mentioned there. Instead, go
-into the build directory of the Quickstep code that you checked out
-(i.e. the directory `quickstep/build`) and run the following command
-in your Terminal app:
-
-
-```
-cmake -D CMAKE_BUILD_TYPE=Debug -D USE_LINENOISE=0 -G "Xcode" ..
-```
-
-This will take a minute but will build the Xcode project file. You can start
-Xcode by typing in:
-
-```
-open QUICKSTEP.xcodeproj
-```
-
-Xcode should start and the first thing you should see is a pop-up box that asks
-if you want to `Manually Manage Schemes` or `Automatically Create Schemes`.
-Pick the latter and let Xcode genreate the schemes, which will essentially
-generate a build target for each target in the cmake files. There are a lot of
-these, but that is ok -- you can pick just the target you want to build easily.
-
-Xcode will take a while to index the files. When it is done, you should see at
-the top of your screen a button with the text: `ALL_BUILD > My Mac`
-
-Click on that button, and a long list of targets will show up. Pick
-`quickstep_cli_shell` as the target -- this creates the main quickstep program.
-(Above, you can also pick other targets if you are working on a different more
-focused part of the code).
-
-To build the source, select from the top menu bar `Product -> Build` or simply
-hit Command-B. Xcode should spin into action and build the sources. It will take
-a while, but the nice thing is that Xcode automatically will try to parallelize
-the build. So, you should be done with building in few minutes.
-
-You should end up with a directory `quickstep/build/Debug`, where the binary is
-created. You will need to go into this directory and issue the command:
-
-```
-cp -R ../qsstor .
-```
-
-The above command ensures that you now have the appropriate directory structure
-and a starting catalog file to start Quickstep. The default database is called
-simply "default" and no relations in it upfront.
-
-There are other ways of specifying where Quickstep stores the data and catalog.
-In particular there is a  `-storage_path` option that could be an alternative
-way of specifying the storage path and avoiding the copy above. You can find
-these and other command line options by typing:
-
-```
-./quickstep_cli_shell -help
-```
-
-
-###4: Debug Quickstep
-Now you can debug as you would any normal process in Xcode. Note the
-linenoise option in the cmake command above is important if you are going
-to run quickstep from Xcode (by hitting the "play" button). If you are
-curious why we have that option, see
-https://github.com/antirez/linenoise/issues/85. Quickstep uses the linenoise
-package, and Xcode's embedded terminal has limited functionality. With the
-cmake option above, we turn off using linenoise.
-
-Sometimes you may want to run quickstep from the command line and still
-debug with Xcode. For that scenario, you do the following:
-a) In Xcode, go to `Debug -> Attach to Processs` and type in
-`quickstep_cli_shell`. If you want to set a breakpoint, you can do
-that here. Open the file in which you want to insert a breakpoint,
-go to the line in the code where you want to set a breakpoint,
-and hit `Debug -> Breakpoints -> Add Breakpoint at Current Line` or
-simply press `Command-\`.
-
-b) Then go to the Terminal app, and go to the Debug directory using:
-
-```
-cd quickstep/build/Debug
-```
-
-c) Start quickstep using something like `./quickstep_cli.shell` or
-`./quickstep_cli_shell < query.sql` where `query.sql` contains the SQL commands
-you want to run/debug. Xcode will automatically attach the quickstep process
-when it starts up. It you had set a breakpoint and the program executes that
-code, then Xcode (lldb) will stop at the breakpoint. Or, if there is a crash,
-you can examine the stack in Xcode.
-
-###5: Unit Tests
-Individual unit tests show up as target schemas, so you can simply select them
-and run the unit test of interest.
-
-Running all the unit tests is complicated, and simply picking the `RUN_TESTS`
-does not work. So, this is a known limitation at this point. You can, however,
-follow the instructions for a [BUILDING.md](command-line build) with cmake and
-then run `ctest` to run the full suite of unit tests.
-
-###6: Other known issues
-
-####Modifying CMake Files
-If you change any of the cmake files (such as any of the CMakeLists.txt
-files), then you will have to [redo step 3](#3-build-quicktep) above to
-create a new Xcode project file.
-
-####Running Python Validation Scripts
-Quickstep developers have a few python scripts that are used to mechanically
-check code. These scripts are written in Python 2 and are not compatible with
-Python 3, so they use `python2` as the interpreter in their shebangs. While
-OSX does include some version of Python 2, it does not have a symlink for
-`python2`, so the scripts will fail to run out of the box. An easy fix is just
-to create a symlink yourself:
-
-```
-sudo ln -s /usr/bin/python2.7 /usr/local/bin/python2
-```
-
-(Note that if you have an older version of Mac OS X, you may need to replace
-`python2.7` in the above command with `python2.6`, or whatever the most recent
-2.X version is on your machine.)
-
-After putting the symlink in place, you should be able to run
-`./third_party/cpplint/lint_everything.py` (which applies a modified version of
-Google cpplint to all C++ sources) and `./validate_cmakelists.py` (which checks
-that dependencies in CMakeLists.txt files exactly match included headers in C++
-sources) from the root quickstep source directory to check your code. There is
-a third validation script `./cyclic_dependency.py` that checks that there are
-no cyclic linking dependencies, but this script also requires that the python
-networkx package is installed
-([https://networkx.github.io/documentation/latest/install.html](see
-instructions here)).

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/build/profile_build.sh
----------------------------------------------------------------------
diff --git a/build/profile_build.sh b/build/profile_build.sh
deleted file mode 100755
index 7d56265..0000000
--- a/build/profile_build.sh
+++ /dev/null
@@ -1,109 +0,0 @@
-#!/bin/bash
-# This script may be useful for developers to profile the build process itself.
-#
-# This shell script runs CMake and make, dumping all output into a log file.
-# It also logs the CPU usage and memory information during the build.
-# All log messages are timestamped to enable profiling.
-#
-# Dependencies:
-# - ts
-# sudo apt-get install -y libtime-duration-perl moreutils
-# - vmstat and mpstat
-# sudo apt-get install -y sysstat
-#
-# Usage: ./profile_build.sh
-# Set the CMake and make command you want to use below.
-# If CMakeLists.txt is detected, the script exits because in-source-tree build
-# is not supported.
-# If CMakeCache.txt is detected, the script skips cmake and runs make only.
-
-# 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.
-
-set -e
-
-CMAKE_COMMAND="cmake \
--D BUILD_SHARED_LIBS=On \
--D USE_TCMALLOC=0 \
--D CMAKE_BUILD_TYPE=Debug \
-.. "
-MAKE_COMMAND="make VERBOSE=1"
-LOG_FILENAME=build.log
-
-# Continuously dump memory usage and cpu load info to files for later analysis
-function start_stat_collectors {
-  rm -f stats_*.txt
-  vmstat -SM 3 | ts "%.s (%H:%M:%S)" > stats_mem.txt 3>&1 &
-  PID_vmstat=$!
-  mpstat 3 | ts "%.s (%H:%M:%S)" > stats_cpu.txt 2>&1  &
-  PID_mpstat=$!
-}
-
-function kill_stat_collectors {
-  kill $PID_vmstat
-  kill $PID_mpstat
-  exit
-}
-
-function check_directory {
-  if [[ -f CMakeLists.txt ]]; then
-    echo "Running the build in the source tree is not supported."
-    exit 1
-  fi
-}
-
-function log_repo_version_info {
-  git log master... >> $LOG_FILENAME
-  git diff master >> $LOG_FILENAME
-}
-
-function run_cmake {
-  if [[ ! -f CMakeCache.txt ]]; then
-    echo "$CMAKE_COMMAND" | tee -a $LOG_FILENAME
-    $CMAKE_COMMAND 2>&1 | ts "%.s (%H:%M:%S)" | tee -a $LOG_FILENAME
-  else
-    echo "CMakeCache.txt detected. Not running CMake again."
-  fi
-}
-
-function run_make {
-  echo "$MAKE_COMMAND" | tee -a $LOG_FILENAME
-  $MAKE_COMMAND 2>&1 | ts "%.s (%H:%M:%S)" | tee -a $LOG_FILENAME
-}
-
-function print_stats {
-  avg_mem=`grep -v r stats_mem.txt | tr -s ' ' | awk -F " " '{s+= $6; c++} END {print s/c/1024}'`
-  echo -e "\n\n"
-  echo "Average memory used was $avg_mem GB"  | tee -a $LOG_FILENAME
-
-  time_taken=`expr $END_TIME - $START_TIME`
-  mins=`expr $time_taken / 60`
-  secs=`expr $time_taken % 60`
-  echo "Time taken was ${mins}m ${secs}s" | tee -a $LOG_FILENAME
-}
-
-check_directory
-echo "Starting build in " `pwd`  >> $LOG_FILENAME
-start_stat_collectors
-trap kill_stat_collectors SIGHUP SIGINT SIGTERM
-
-START_TIME=`date +"%s"`
-run_cmake
-run_make
-END_TIME=`date +"%s"`
-kill_stat_collectors
-print_stats

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/build/vagrant/README.md
----------------------------------------------------------------------
diff --git a/build/vagrant/README.md b/build/vagrant/README.md
deleted file mode 100644
index c962dda..0000000
--- a/build/vagrant/README.md
+++ /dev/null
@@ -1,97 +0,0 @@
-Vagrant Development Environments for Quickstep
-==============================================
-
-Vagrant is a tool for setting up development environments in a VM. It
-automatically takes care of fetching a base OS image, installing additional
-software, and setting it up so you can easily ssh into a VM and get to work.
-It also handles sharing directories (like source repos) between the host and
-the VM so that you can, for instance, edit code using your preferred editor on
-your machine as usual, and compile inside the Vagrant-managed VM without having
-to do any additional steps to sync code. Cool!
-
-The main reason to use Vagrant on a project like Quickstep is to have
-well-known OS environments to build and test code in during development. For
-instance, if you are developing on a Mac but are working on features related to
-libnuma on Linux, you can use the Debian Vagrant box which gives you a full
-Linux OS and toolchain with libnuma included.
-
-Getting Started
----------------
-
-1.   Download and install VirtualBox: https://www.virtualbox.org/wiki/Downloads
-     VirtualBox is used as the hypervisor for Vagrant VMs (technically, Vagrant
-     can use several different providers, but it's easiest to get up and
-     running with VirtualBox).
-2.   Download and install Vagrant: https://www.vagrantup.com/downloads.html
-     Just install the Vagrant software itself. You do not need to go through
-     any of the guides to set up a Vagrant box (we already have several
-     pre-made for you, see "Quickstep Boxes" below).
-3.   Bring up a Vagrant box. Just cd into the directory for the box and type
-     `vagrant up`. Several boxes are provided for Quickstep development (see
-     "Quickstep Boxes" below). The `debian-jessie-amd64` box is a good default
-     choice. Running `vagrant up` may take a few minutes the first time you
-     bring up a box, because vagrant has to first download a base OS image,
-     then run scripts to install additional software in it. You can expect the
-     boot process to go much faster after the first time.
-4.   Type `vagrant ssh` to ssh into your VM. The Vagrant boxes for quickstep
-     should have all the dev tools you need (compilers, cmake, protobufs, flex,
-     bison, and debuggers). The quickstep source repo will be shared and
-     mounted at /quickstep in the VM.
-5.   When you are finished using the VM, exit from your ssh session and type
-     `vagrant halt` to shut it down. This will gracefully shut down the VM and
-     keep the full VM image around so that you can boot back into it quickly
-     the next time you run `vagrant up`. If you want to completely eliminate
-     the VM from your host and clean up everything, you can type
-     `vagrant destroy`. You can still recreate the box by doing `vagrant up`,
-     but it will start from scratch and take a few minutes.
-
-Configuring VMs
----------------
-
-The Vagrantfiles for our boxes are set up to give 4 CPU cores and 8 GB of RAM
-to the VM. If your host machine is under or over-powered relative to that (and
-keep in mind that your host OS needs some RAM, too), you can edit the
-Vagrantfile to change the resources given to the VM. Look for a code section
-like the following:
-
-    config.vm.provider "virtualbox" do |vb|
-      vb.memory = 8192
-      vb.cpus = 4
-    end
-
-`vb.memory` indicates the VM RAM in megabytes, `vb.cpus` indicates the number
-of CPU cores. Adjust to your liking.
-
-Quickstep Boxes
----------------
-
-### Debian Jessie
-
-The debian-jessie-amd64 directory contains a vagrant box for Debian GNU/Linux 8
-"Jessie". It has GCC 4.9, Clang 3.5, GDB, LLDB, CMake, protobufs, flex, bison,
-and git installed.
-
-### FreeBSD 10.2
-
-The freebsd-10.2-amd64 directory contains a vagrant box for FreeBSD
-10.2-STABLE. It has Clang 3.4 (the default system compiler) and Clang 3.7
-(installed under `/usr/local/bin/clang37`), as well as LLDB, CMake, protobufs,
-flex, bison, and git installed.
-
-The FreeBSD box uses NFS to share files with the host. This means you need
-administrator (i.e. sudoer) permissions on the host to export the shared
-directories. Vagrant will automate setting this up for you, but it may ask
-for a password at some point when you run `vagrant up`.
-
-Note that the FreeBSD image auto-updates itself on boot before the SSH server
-comes up, so do not be alarmed if you get a bunch of "remote connection
-disconnect" warnings when you run `vagrant up`, it should eventually succeed.
-
-### Ubuntu Precise
-
-The ubuntu-precise-amd64 directory contains a vagrant box for Ubuntu 12.04 LTS
-"Precise". This is the same distro as is used in Travis Linux workers for our
-continuous integration setup, and the installed development packages should be
-the same as on Travis. This box is intended mainly for debugging problems with
-Travis. For regular Linux development, it's recommended to use the Debian
-Jessie box instead, as it has a more recent and complete set of tools.

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/build/vagrant/debian-jessie-amd64/Vagrantfile
----------------------------------------------------------------------
diff --git a/build/vagrant/debian-jessie-amd64/Vagrantfile b/build/vagrant/debian-jessie-amd64/Vagrantfile
deleted file mode 100644
index 255fbff..0000000
--- a/build/vagrant/debian-jessie-amd64/Vagrantfile
+++ /dev/null
@@ -1,39 +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.
-
-# Basic Vagrant config (API version 2)
-Vagrant.configure(2) do |config|
-  # Base box: Debian 8 "Jessie" for x86-64
-  config.vm.box = "debian/jessie64"
-
-  # Give a reasonable amount of cpu and memory to the VM
-  config.vm.provider "virtualbox" do |vb|
-    vb.memory = 8192
-    vb.cpus = 4
-  end
-
-  # Share the project source dir with the VM
-  config.vm.synced_folder "../../..", "/quickstep"
-
-  # Install necessary development packages
-  config.vm.provision "shell", inline: <<-SHELL
-    sudo apt-get update
-    sudo apt-get install -y \
-        build-essential g++ clang libc++-dev gdb lldb cmake git \
-        protobuf-compiler libprotobuf-dev flex bison libnuma-dev iwyu
-  SHELL
-end

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/build/vagrant/freebsd-10.2-amd64/Vagrantfile
----------------------------------------------------------------------
diff --git a/build/vagrant/freebsd-10.2-amd64/Vagrantfile b/build/vagrant/freebsd-10.2-amd64/Vagrantfile
deleted file mode 100644
index cce52ab..0000000
--- a/build/vagrant/freebsd-10.2-amd64/Vagrantfile
+++ /dev/null
@@ -1,45 +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.
-
-# Basic Vagrant config (API version 2)
-Vagrant.configure(2) do |config|
-  # Base box: FreeBSD 10.2 for x86-64
-  config.vm.guest = :freebsd
-  config.vm.box = "freebsd/FreeBSD-10.2-STABLE"
-
-  # Need some extra config to play nice with FreeBSD as guest OS.
-  config.vm.synced_folder ".", "/vagrant", id: "vagrant-root", disabled: true
-  config.ssh.shell = "sh"
-  config.vm.base_mac = "080027D14C66"
-
-  # Give a reasonable amount of cpu and memory to the VM
-  config.vm.provider "virtualbox" do |vb|
-    vb.memory = 8192
-    vb.cpus = 4
-  end
-
-  # Share the project source dir with the VM. We need to use NFS to mount a
-  # shared directory in a FreeBSD guest.
-  config.vm.network "private_network", ip: "10.0.1.10"
-  config.vm.synced_folder "../../..", "/quickstep", type: "nfs"
-
-  # Install necessary development packages
-  config.vm.provision "shell", inline: <<-SHELL
-    pkg upgrade -y
-    pkg install -y clang37 lldb37 cmake git protobuf flex bison
-  SHELL
-end

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/build/vagrant/ubuntu-precise-amd64/Vagrantfile
----------------------------------------------------------------------
diff --git a/build/vagrant/ubuntu-precise-amd64/Vagrantfile b/build/vagrant/ubuntu-precise-amd64/Vagrantfile
deleted file mode 100644
index 863c9db..0000000
--- a/build/vagrant/ubuntu-precise-amd64/Vagrantfile
+++ /dev/null
@@ -1,48 +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.
-
-# Basic Vagrant config (API version 2)
-Vagrant.configure(2) do |config|
-  # Base box: Ubuntu 12.04 LTS "Precise" for x86-64
-  config.vm.box = "hashicorp/precise64"
-
-  # Give a reasonable amount of cpu and memory to the VM
-  config.vm.provider "virtualbox" do |vb|
-    vb.memory = 8192
-    vb.cpus = 4
-  end
-
-  # Share the project source dir with the VM
-  config.vm.synced_folder "../../..", "/quickstep"
-
-  # Install development packages just like in our Travis config.
-  config.vm.provision "shell", inline: <<-SHELL
-    sudo apt-get update
-    sudo apt-get install -y python-software-properties
-    sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
-    wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key|sudo apt-key add -
-    sudo add-apt-repository -y 'deb http://llvm.org/apt/jessie/ llvm-toolchain-jessie-3.7 main'
-    sudo apt-get update
-    sudo apt-get install -y \
-        build-essential gcc-4.9 g++-4.9 clang-3.7 gdb cmake git \
-        protobuf-compiler libprotobuf-dev flex bison libnuma-dev
-    sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 20
-    sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.9 20
-    sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-3.7 20
-    sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-3.7 20
-  SHELL
-end

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/catalog/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/catalog/CMakeLists.txt b/catalog/CMakeLists.txt
deleted file mode 100644
index dd4ef99..0000000
--- a/catalog/CMakeLists.txt
+++ /dev/null
@@ -1,249 +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.
-
-if(LIBNUMA_FOUND)
-  set(QUICKSTEP_HAVE_LIBNUMA TRUE)
-endif()
-
-configure_file (
-  "${CMAKE_CURRENT_SOURCE_DIR}/CatalogConfig.h.in"
-  "${CMAKE_CURRENT_BINARY_DIR}/CatalogConfig.h"
-)
-
-QS_PROTOBUF_GENERATE_CPP(catalog_Catalog_proto_srcs catalog_Catalog_proto_hdrs Catalog.proto)
-
-# Declare micro-libs:
-add_library(quickstep_catalog_Catalog Catalog.cpp Catalog.hpp)
-add_library(quickstep_catalog_Catalog_proto ${catalog_Catalog_proto_srcs})
-add_library(quickstep_catalog_CatalogAttribute CatalogAttribute.cpp CatalogAttribute.hpp)
-add_library(quickstep_catalog_CatalogDatabase CatalogDatabase.cpp CatalogDatabase.hpp)
-add_library(quickstep_catalog_CatalogDatabaseCache CatalogDatabaseCache.cpp CatalogDatabaseCache.hpp)
-add_library(quickstep_catalog_CatalogDatabaseLite ../empty_src.cpp CatalogDatabaseLite.hpp)
-add_library(quickstep_catalog_CatalogErrors ../empty_src.cpp CatalogErrors.hpp)
-add_library(quickstep_catalog_CatalogRelation CatalogRelation.cpp CatalogRelation.hpp)
-add_library(quickstep_catalog_CatalogRelationSchema
-            CatalogRelationSchema.cpp
-            CatalogRelationSchema.hpp)
-add_library(quickstep_catalog_CatalogRelationStatistics
-            CatalogRelationStatistics.cpp
-            CatalogRelationStatistics.hpp)
-add_library(quickstep_catalog_CatalogTypedefs ../empty_src.cpp CatalogTypedefs.hpp)
-add_library(quickstep_catalog_IndexScheme IndexScheme.cpp IndexScheme.hpp)
-if(QUICKSTEP_HAVE_LIBNUMA)
-  add_library(quickstep_catalog_NUMAPlacementScheme NUMAPlacementScheme.cpp NUMAPlacementScheme.hpp)
-endif()
-add_library(quickstep_catalog_PartitionScheme PartitionScheme.cpp PartitionScheme.hpp)
-add_library(quickstep_catalog_PartitionSchemeHeader PartitionSchemeHeader.cpp PartitionSchemeHeader.hpp)
-
-# Link dependencies:
-target_link_libraries(quickstep_catalog_Catalog
-                      glog
-                      quickstep_catalog_CatalogDatabase
-                      quickstep_catalog_CatalogErrors
-                      quickstep_catalog_CatalogTypedefs
-                      quickstep_catalog_Catalog_proto
-                      quickstep_utility_Macros
-                      quickstep_utility_PtrVector)
-target_link_libraries(quickstep_catalog_Catalog_proto
-                      quickstep_storage_StorageBlockLayout_proto
-                      quickstep_types_Type_proto
-                      quickstep_types_TypedValue_proto
-                      ${PROTOBUF_LIBRARY})
-target_link_libraries(quickstep_catalog_CatalogAttribute
-                      glog
-                      quickstep_catalog_CatalogTypedefs
-                      quickstep_catalog_Catalog_proto
-                      quickstep_types_Type
-                      quickstep_types_TypeFactory
-                      quickstep_types_Type_proto
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_catalog_CatalogDatabase
-                      glog
-                      quickstep_catalog_CatalogDatabaseLite
-                      quickstep_catalog_CatalogErrors
-                      quickstep_catalog_CatalogRelation
-                      quickstep_catalog_CatalogTypedefs
-                      quickstep_catalog_Catalog_proto
-                      quickstep_storage_StorageConstants
-                      quickstep_threading_Mutex
-                      quickstep_threading_SharedMutex
-                      quickstep_threading_SpinSharedMutex
-                      quickstep_utility_Macros
-                      quickstep_utility_PtrVector
-                      quickstep_utility_StringUtil)
-target_link_libraries(quickstep_catalog_CatalogDatabaseCache
-                      glog
-                      quickstep_catalog_CatalogDatabaseLite
-                      quickstep_catalog_CatalogRelationSchema
-                      quickstep_catalog_CatalogTypedefs
-                      quickstep_catalog_Catalog_proto
-                      quickstep_storage_StorageConstants
-                      quickstep_threading_Mutex
-                      quickstep_threading_SharedMutex
-                      quickstep_threading_SpinSharedMutex
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_catalog_CatalogDatabaseLite
-                      quickstep_catalog_CatalogTypedefs
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_catalog_CatalogRelation
-                      glog
-                      quickstep_catalog_CatalogAttribute
-                      quickstep_catalog_CatalogRelationSchema
-                      quickstep_catalog_CatalogRelationStatistics
-                      quickstep_catalog_CatalogTypedefs
-                      quickstep_catalog_Catalog_proto
-                      quickstep_catalog_IndexScheme
-                      quickstep_catalog_PartitionScheme
-                      quickstep_storage_StorageBlockInfo
-                      quickstep_storage_StorageBlockLayout
-                      quickstep_storage_StorageBlockLayout_proto
-                      quickstep_storage_StorageConstants
-                      quickstep_threading_Mutex
-                      quickstep_threading_SharedMutex
-                      quickstep_threading_SpinSharedMutex
-                      quickstep_utility_Macros
-                      quickstep_utility_PtrVector)
-target_link_libraries(quickstep_catalog_CatalogRelationStatistics
-                      quickstep_catalog_CatalogTypedefs
-                      quickstep_catalog_Catalog_proto
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_catalog_IndexScheme
-                      glog
-                      quickstep_catalog_Catalog_proto
-                      quickstep_storage_IndexSubBlockDescriptionFactory
-                      quickstep_storage_StorageBlockLayout_proto
-                      quickstep_utility_Macros)
-
-if(QUICKSTEP_HAVE_LIBNUMA)
-target_link_libraries(quickstep_catalog_CatalogRelation
-                      quickstep_catalog_NUMAPlacementScheme)
-endif()
-target_link_libraries(quickstep_catalog_CatalogRelationSchema
-                      glog
-                      quickstep_catalog_CatalogAttribute
-                      quickstep_catalog_CatalogErrors
-                      quickstep_catalog_CatalogTypedefs
-                      quickstep_catalog_Catalog_proto
-                      quickstep_types_Type
-                      quickstep_utility_Macros
-                      quickstep_utility_PtrVector
-                      quickstep_utility_StringUtil)
-if(QUICKSTEP_HAVE_LIBNUMA)
-target_link_libraries(quickstep_catalog_NUMAPlacementScheme
-                      glog
-                      quickstep_catalog_CatalogTypedefs
-                      quickstep_catalog_Catalog_proto
-                      quickstep_storage_StorageBlockInfo
-                      quickstep_utility_Macros
-                      ${LIBNUMA_LIBRARY})
-endif()
-target_link_libraries(quickstep_catalog_PartitionScheme
-                      glog
-                      quickstep_catalog_CatalogTypedefs
-                      quickstep_catalog_Catalog_proto
-                      quickstep_catalog_PartitionSchemeHeader
-                      quickstep_storage_StorageBlockInfo
-                      quickstep_threading_Mutex
-                      quickstep_threading_SharedMutex
-                      quickstep_threading_SpinSharedMutex
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_catalog_PartitionSchemeHeader
-                      glog
-                      quickstep_catalog_CatalogTypedefs
-                      quickstep_catalog_Catalog_proto
-                      quickstep_types_TypedValue
-                      quickstep_types_TypedValue_proto
-                      quickstep_types_operations_comparisons_Comparison
-                      quickstep_types_operations_comparisons_LessComparison
-                      quickstep_utility_Macros)
-
-# Module all-in-one library:
-add_library(quickstep_catalog ../empty_src.cpp CatalogModule.hpp)
-target_link_libraries(quickstep_catalog
-                      quickstep_catalog_Catalog
-                      quickstep_catalog_Catalog_proto
-                      quickstep_catalog_CatalogAttribute
-                      quickstep_catalog_CatalogDatabase
-                      quickstep_catalog_CatalogDatabaseCache
-                      quickstep_catalog_CatalogDatabaseLite
-                      quickstep_catalog_CatalogErrors
-                      quickstep_catalog_CatalogRelation
-                      quickstep_catalog_CatalogRelationSchema
-                      quickstep_catalog_CatalogRelationStatistics
-                      quickstep_catalog_CatalogTypedefs
-                      quickstep_catalog_IndexScheme
-                      quickstep_catalog_PartitionScheme
-                      quickstep_catalog_PartitionSchemeHeader)
-if(QUICKSTEP_HAVE_LIBNUMA)
-target_link_libraries(quickstep_catalog
-                      quickstep_catalog_NUMAPlacementScheme)
-endif()
-
-# Tests:
-add_executable(Catalog_unittest "${CMAKE_CURRENT_SOURCE_DIR}/tests/Catalog_unittest.cpp")
-target_link_libraries(Catalog_unittest
-                      gtest
-                      gtest_main
-                      quickstep_catalog_Catalog
-                      quickstep_catalog_CatalogAttribute
-                      quickstep_catalog_CatalogDatabase
-                      quickstep_catalog_CatalogDatabaseCache
-                      quickstep_catalog_CatalogRelation
-                      quickstep_catalog_CatalogRelationSchema
-                      quickstep_catalog_CatalogTypedefs
-                      quickstep_catalog_Catalog_proto
-                      quickstep_catalog_IndexScheme
-                      quickstep_storage_StorageBlock
-                      quickstep_storage_StorageBlockInfo
-                      quickstep_storage_StorageBlockLayout
-                      quickstep_storage_StorageBlockLayout_proto
-                      quickstep_storage_SubBlockTypeRegistryMacros
-                      quickstep_types_Type
-                      quickstep_types_TypeFactory
-                      quickstep_types_TypeID
-                      quickstep_utility_Macros
-                      quickstep_utility_PtrVector)
-add_test(Catalog_unittest Catalog_unittest)
-
-if(QUICKSTEP_HAVE_LIBNUMA)
-add_executable(NUMAPlacementScheme_unittest
-               "${CMAKE_CURRENT_SOURCE_DIR}/tests/NUMAPlacementScheme_unittest.cpp")
-target_link_libraries(NUMAPlacementScheme_unittest
-                      gtest
-                      gtest_main
-                      quickstep_catalog_NUMAPlacementScheme
-                      quickstep_catalog_PartitionSchemeHeader
-                      quickstep_storage_StorageBlockInfo
-                      ${LIBS})
-add_test(NUMAPlacementScheme_unittest NUMAPlacementScheme_unittest)
-endif()
-
-add_executable(PartitionScheme_unittest
-               "${CMAKE_CURRENT_SOURCE_DIR}/tests/PartitionScheme_unittest.cpp")
-target_link_libraries(PartitionScheme_unittest
-                      gtest
-                      gtest_main
-                      quickstep_catalog_CatalogTypedefs
-                      quickstep_catalog_PartitionScheme
-                      quickstep_catalog_PartitionSchemeHeader
-                      quickstep_storage_StorageBlockInfo
-                      quickstep_types_TypeFactory
-                      quickstep_types_TypeID
-                      quickstep_types_TypedValue
-                      quickstep_types_operations_comparisons_Comparison
-                      quickstep_types_operations_comparisons_EqualComparison)
-add_test(PartitionScheme_unittest PartitionScheme_unittest)

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/catalog/Catalog.cpp
----------------------------------------------------------------------
diff --git a/catalog/Catalog.cpp b/catalog/Catalog.cpp
deleted file mode 100644
index 369d529..0000000
--- a/catalog/Catalog.cpp
+++ /dev/null
@@ -1,111 +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 "catalog/Catalog.hpp"
-
-#include <cstddef>
-#include <cstring>
-#include <string>
-#include <unordered_map>
-
-#include "catalog/Catalog.pb.h"
-#include "catalog/CatalogDatabase.hpp"
-#include "catalog/CatalogErrors.hpp"
-#include "utility/PtrVector.hpp"
-
-#include "glog/logging.h"
-
-using std::size_t;
-using std::strcmp;
-using std::string;
-
-namespace quickstep {
-
-bool Catalog::ProtoIsValid(const serialization::Catalog &proto) {
-  for (int i = 0; i < proto.databases_size(); ++i) {
-    if (!CatalogDatabase::ProtoIsValid(proto.databases(i))) {
-      return false;
-    }
-  }
-  return true;
-}
-
-Catalog::Catalog(const serialization::Catalog &proto) {
-  DCHECK(ProtoIsValid(proto))
-      << "Attempted to create Catalog from an invalid proto description:\n"
-      << proto.DebugString();
-
-  for (int i = 0; i < proto.databases_size(); ++i) {
-    if (proto.databases(i).IsInitialized()) {
-      addDatabase(new CatalogDatabase(proto.databases(i)));
-    } else {
-      db_vec_.push_back(NULL);
-    }
-  }
-}
-
-const CatalogDatabase& Catalog::getDatabaseByName(const string &db_name) const {
-  std::unordered_map<std::string, CatalogDatabase*>::const_iterator it = db_map_.find(db_name);
-  if (it == db_map_.end()) {
-    throw DatabaseNameNotFound(db_name);
-  } else {
-    return *(it->second);
-  }
-}
-
-CatalogDatabase* Catalog::getDatabaseByNameMutable(const string &db_name) {
-  std::unordered_map<std::string, CatalogDatabase*>::const_iterator it = db_map_.find(db_name);
-  if (it == db_map_.end()) {
-    throw DatabaseNameNotFound(db_name);
-  } else {
-    return it->second;
-  }
-}
-
-database_id Catalog::addDatabase(CatalogDatabase *new_db) {
-  const string &db_name = new_db->getName();
-  if (hasDatabaseWithName(db_name)) {
-    throw DatabaseNameCollision(db_name);
-  } else if (db_vec_.size() > static_cast<size_t>(kCatalogMaxID)) {
-    throw CatalogIDOverflow("database");
-  } else {
-    db_map_[db_name] = new_db;
-    db_vec_.push_back(new_db);
-    new_db->setParent(this);
-    new_db->setID(static_cast<database_id>(db_vec_.size() - 1));
-    return (new_db->getID());
-  }
-}
-
-serialization::Catalog Catalog::getProto() const {
-  serialization::Catalog proto;
-
-  for (PtrVector<CatalogDatabase, true>::const_iterator it = db_vec_.begin();
-       it != db_vec_.end();
-       ++it) {
-    if (it.isNull()) {
-      proto.add_databases();
-    } else {
-      proto.add_databases()->CopyFrom(it->getProto());
-    }
-  }
-
-  return proto;
-}
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/catalog/Catalog.hpp
----------------------------------------------------------------------
diff --git a/catalog/Catalog.hpp b/catalog/Catalog.hpp
deleted file mode 100644
index daaec8c..0000000
--- a/catalog/Catalog.hpp
+++ /dev/null
@@ -1,299 +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_CATALOG_CATALOG_HPP_
-#define QUICKSTEP_CATALOG_CATALOG_HPP_
-
-#include <exception>
-#include <string>
-#include <unordered_map>
-
-#include "catalog/Catalog.pb.h"
-#include "catalog/CatalogDatabase.hpp"
-#include "catalog/CatalogTypedefs.hpp"
-#include "utility/Macros.hpp"
-#include "utility/PtrVector.hpp"
-
-namespace quickstep {
-
-/** \addtogroup Catalog
- *  @{
- */
-
-/**
- * @brief Exception thrown for a database name collision.
- **/
-class DatabaseNameCollision : public std::exception {
- public:
-  /**
-   * @brief Constructor.
-   *
-   * @param db_name The name of the database for which there was a collision.
-   **/
-  explicit DatabaseNameCollision(const std::string &db_name)
-      : message_("DatabaseNameCollision: catalog already has a database ") {
-    message_.append(db_name);
-  }
-
-  ~DatabaseNameCollision() throw() {
-  }
-
-  virtual const char* what() const throw() {
-    return message_.c_str();
-  }
-
- private:
-  std::string message_;
-};
-
-
-/**
- * @brief Exception thrown when a database with the specified name can't be
- *        found.
- **/
-class DatabaseNameNotFound : public std::exception {
- public:
-  /**
-   * @brief Constructor.
-   *
-   * @param dbName The database name which could not be found.
-   **/
-  explicit DatabaseNameNotFound(const std::string &db_name)
-      : message_("DatabaseNameNotFound: catalog has no database named ") {
-    message_.append(db_name);
-  }
-
-  ~DatabaseNameNotFound() throw() {
-  }
-
-  virtual const char* what() const throw() {
-    return message_.c_str();
-  }
-
- private:
-  std::string message_;
-};
-
-
-/**
- * @brief Exception thrown when a database with the specified ID can't be
- *        found.
- **/
-class DatabaseIdNotFound : public std::exception {
- public:
-  /**
-   * @brief Constructor.
-   *
-   * @param id The id which could not be found.
-   **/
-  explicit DatabaseIdNotFound(const database_id id)
-      : message_("DatabaseIdNotFound: catalog has no database with ID ") {
-    message_.append(std::to_string(id));
-  }
-
-  ~DatabaseIdNotFound() throw() {
-  }
-
-  virtual const char* what() const throw() {
-    return message_.c_str();
-  }
-
- private:
-  std::string message_;
-};
-
-
-/**
- * @brief The entire database catalog.
- **/
-class Catalog {
- public:
-  typedef std::unordered_map<std::string, CatalogDatabase*>::size_type size_type;
-  typedef PtrVector<CatalogDatabase, true>::const_skip_iterator const_iterator;
-
-  /**
-   * @brief Construct an empty catalog.
-   **/
-  Catalog() {
-  }
-
-  /**
-   * @brief Reconstruct a catalog from its serialized Protocol Buffer form.
-   *
-   * @param proto The Protocol Buffer serialization of a catalog,
-   *        previously produced by getProto().
-   **/
-  explicit Catalog(const serialization::Catalog &proto);
-
-  /**
-   * @brief Destructor which recursively destroys children.
-   **/
-  ~Catalog() {
-  }
-
-  /**
-   * @brief Check whether a database with the given name exists.
-   *
-   * @param db_name The name to check for.
-   * @return Whether the database exists.
-   **/
-  bool hasDatabaseWithName(const std::string &db_name) const {
-    return (db_map_.find(db_name) != db_map_.end());
-  }
-
-  /**
-   * @brief Check whether a database with the given id exists.
-   *
-   * @param id The id to check for.
-   * @return Whether the database exists.
-   **/
-  bool hasDatabaseWithId(const database_id id) const {
-    return (idInRange(id) && !db_vec_.elementIsNull(id));
-  }
-
-  /**
-   * @brief Get a database by name.
-   *
-   * @param db_name The name to search for.
-   * @exception DatabaseNameNotFound No database with the given name exists.
-   * @return The database with the given name.
-   **/
-  const CatalogDatabase& getDatabaseByName(const std::string &db_name) const;
-
-  /**
-   * @brief Get a mutable pointer to a database by name.
-   *
-   * @param db_name The name to search for.
-   * @exception DatabaseNameNotFound No database with the given name exists.
-   * @return The database with the given name.
-   **/
-  CatalogDatabase* getDatabaseByNameMutable(const std::string &db_name);
-
-  /**
-   * @brief Get a database by ID.
-   *
-   * @param id The id to search for.
-   * @exception DatabaseIdNotFound No database with the given ID exists.
-   * @return The database with the given ID.
-   **/
-  const CatalogDatabase& getDatabaseById(const database_id id) const {
-    if (hasDatabaseWithId(id)) {
-      return db_vec_[id];
-    } else {
-      throw DatabaseIdNotFound(id);
-    }
-  }
-
-  /**
-   * @brief Get a mutable pointer to a database by ID.
-   *
-   * @param id The id to search for.
-   * @exception DatabaseIdNotFound No database with the given ID exists.
-   * @return The database with the given ID.
-   **/
-  CatalogDatabase* getDatabaseByIdMutable(const database_id id) {
-    if (hasDatabaseWithId(id)) {
-      return &(db_vec_[id]);
-    } else {
-      throw DatabaseIdNotFound(id);
-    }
-  }
-
-  /**
-   * @brief Add a new database to the catalog. If the database already has an
-   *        ID and/or parent, it will be overwritten.
-   *
-   * @param new_db The database to be added.
-   * @exception DatabaseNameCollision A database with the same name as new_db
-   *            is already present in the catalog.
-   * @return The id assigned to the database.
-   **/
-  database_id addDatabase(CatalogDatabase *new_db);
-
-  /**
-   * @brief Serialize the catalog as Protocol Buffer.
-   *
-   * @return The Protocol Buffer representation of the catalog.
-   **/
-  serialization::Catalog getProto() const;
-
-  /**
-   * @brief Get the number of child databases.
-   *
-   * @return The number of child databases.
-   **/
-  size_type size() const {
-    return db_map_.size();
-  }
-
-  /**
-   * @brief Get an iterator at the beginning of the child databases.
-   *
-   * @return An iterator on the first child database.
-   **/
-  const_iterator begin() const {
-    return db_vec_.begin_skip();
-  }
-
-  /**
-   * @brief Get an iterator at one-past-the-end of the child databases.
-   *
-   * @return An iterator one-past-the-end of the child databases.
-   **/
-  const_iterator end() const {
-    return db_vec_.end_skip();
-  }
-
- private:
-  /**
-   * @brief Check whether a database_id is within the range of IDs contained
-   *        in this Catalog.
-   *
-   * @param id The id to check.
-   * @return true if id is in range, false otherwise.
-   **/
-  bool idInRange(const database_id id) const {
-    return ((id >= 0)
-            && (static_cast<PtrVector<CatalogDatabase>::size_type>(id) < db_vec_.size()));
-  }
-
-  /**
-   * @brief Check whether a serialization::Catalog is fully-formed and
-   *        all parts are valid.
-   *
-   * @param proto A serialized Protocol Buffer representation of a Catalog,
-   *        originally generated by getProto().
-   * @return Whether proto is fully-formed and valid.
-   **/
-  static bool ProtoIsValid(const serialization::Catalog &proto);
-
-  // A vector of databases, and NULL if it has dropped from the catalog.
-  PtrVector<CatalogDatabase, true> db_vec_;
-
-  // A map from a database name to a pointer to the database.
-  std::unordered_map<std::string, CatalogDatabase*> db_map_;
-
-  DISALLOW_COPY_AND_ASSIGN(Catalog);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_CATALOG_CATALOG_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/catalog/Catalog.proto
----------------------------------------------------------------------
diff --git a/catalog/Catalog.proto b/catalog/Catalog.proto
deleted file mode 100644
index 90ce37e..0000000
--- a/catalog/Catalog.proto
+++ /dev/null
@@ -1,124 +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.
-
-syntax = "proto2";
-
-package quickstep.serialization;
-
-import "storage/StorageBlockLayout.proto";
-import "types/Type.proto";
-import "types/TypedValue.proto";
-
-message CatalogAttribute {
-  required string name = 1;
-  required Type type = 2;
-  optional string display_name = 3;
-}
-
-// TODO(zuyu): Move PartitionScheme to a dedicate proto file.
-message PartitionSchemeHeader {
-  enum PartitionType {
-    HASH = 0;
-    RANGE = 1;
-  }
-
-  required PartitionType partition_type = 1;
-
-  required uint64 num_partitions = 2;
-  required uint32 partition_attribute_id = 3;
-
-  // The convention for extension numbering is that extensions for a particular
-  // PartitionType should begin from (partition_type + 1) * 16.
-  extensions 16 to max;
-}
-
-message RangePartitionSchemeHeader {
-  extend PartitionSchemeHeader {
-    // All required.
-    repeated TypedValue partition_range_boundaries = 32;
-  }
-}
-
-message Partition {
-  repeated fixed64 blocks = 1 [packed=true];
-}
-
-message PartitionScheme {
-  required PartitionSchemeHeader header = 1;
-  repeated Partition partitions = 2;
-}
-
-message NUMAPlacementScheme {
-  required uint32 num_numa_nodes = 1;
-
-  message BlockToNUMANodeEntry {
-    required fixed64 block_id = 1;
-    required int32 numa_node = 2;
-  }
-  repeated BlockToNUMANodeEntry block_to_numa_node_map = 2;
-}
-
-message IndexScheme {
-  message IndexEntry {
-    required string index_name = 1;
-    required IndexSubBlockDescription index_description = 2;
-  }
-  repeated IndexEntry index_entries = 1;
-}
-
-message CatalogRelationStatistics {
-  optional fixed64 num_tuples = 1;
-
-  message NumDistinctValuesEntry {
-    required int32 attr_id = 1;
-    required fixed64 num_distinct_values = 2;
-  }
-  repeated NumDistinctValuesEntry num_distinct_values_map = 2;
-}
-
-message CatalogRelationSchema {
-  required int32 relation_id = 1;
-  required string name = 2;
-  required bool temporary = 3;
-
-  repeated CatalogAttribute attributes = 4;
-
-  extensions 16 to max;
-}
-
-message CatalogRelation {
-  extend CatalogRelationSchema {
-    // Required.
-    optional StorageBlockLayoutDescription default_layout = 16;
-
-    repeated fixed64 blocks = 17 [packed=true];
-    optional IndexScheme index_scheme = 18;
-    optional PartitionScheme partition_scheme = 19;
-    optional NUMAPlacementScheme placement_scheme = 20;
-    optional CatalogRelationStatistics statistics = 21;
-  }
-}
-
-message CatalogDatabase {
-  required string name = 1;
-  repeated CatalogRelationSchema relations = 2;
-  repeated int32 null_relations = 3;
-}
-
-message Catalog {
-  repeated CatalogDatabase databases = 1;
-}

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/catalog/CatalogAttribute.cpp
----------------------------------------------------------------------
diff --git a/catalog/CatalogAttribute.cpp b/catalog/CatalogAttribute.cpp
deleted file mode 100644
index e9630d6..0000000
--- a/catalog/CatalogAttribute.cpp
+++ /dev/null
@@ -1,69 +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 "catalog/CatalogAttribute.hpp"
-
-#include <cstring>
-#include <string>
-
-#include "catalog/Catalog.pb.h"
-#include "types/Type.hpp"
-#include "types/Type.pb.h"
-#include "types/TypeFactory.hpp"
-
-#include "glog/logging.h"
-
-using std::strcmp;
-using std::string;
-
-namespace quickstep {
-
-bool CatalogAttribute::ProtoIsValid(const serialization::CatalogAttribute &proto) {
-  // Check that proto is fully initialized and the type is a valid type.
-  return proto.IsInitialized() && TypeFactory::ProtoIsValid(proto.type());
-}
-
-CatalogAttribute::CatalogAttribute(const serialization::CatalogAttribute &proto)
-    : parent_(nullptr),
-      id_(-1),
-      name_(proto.name()),
-      type_(&(TypeFactory::ReconstructFromProto(proto.type()))) {
-  DCHECK(ProtoIsValid(proto))
-      << "Attempted to create CatalogAttribute from an invalid proto description:\n"
-      << proto.DebugString();
-
-  if (proto.has_display_name()) {
-    display_name_ = proto.display_name();
-  }
-}
-
-serialization::CatalogAttribute CatalogAttribute::getProto() const {
-  serialization::CatalogAttribute proto;
-
-  proto.set_name(name_);
-  proto.mutable_type()->CopyFrom(type_->getProto());
-
-  if (!display_name_.empty()) {
-    proto.set_display_name(display_name_);
-  }
-
-  return proto;
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/catalog/CatalogAttribute.hpp
----------------------------------------------------------------------
diff --git a/catalog/CatalogAttribute.hpp b/catalog/CatalogAttribute.hpp
deleted file mode 100644
index 7f7fafb..0000000
--- a/catalog/CatalogAttribute.hpp
+++ /dev/null
@@ -1,198 +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_CATALOG_CATALOG_ATTRIBUTE_HPP_
-#define QUICKSTEP_CATALOG_CATALOG_ATTRIBUTE_HPP_
-
-#include <string>
-
-#include "catalog/Catalog.pb.h"
-#include "catalog/CatalogTypedefs.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-
-class CatalogRelationSchema;
-class Type;
-
-/** \addtogroup Catalog
- *  @{
- */
-
-/**
- * @brief An attribute in a relation.
- **/
-class CatalogAttribute {
- public:
-  /**
-   * @brief Create a new attribute.
-   *
-   * @param parent The relation this attribute belongs to.
-   * @param name This attribute's name.
-   * @param type This attribute's complete data type.
-   * @param id This attribute's ID (defaults to -1, which means invalid/unset).
-   * @param display_name A different name to display when printing values of
-   *        this attribute out. Defaults to name.
-   **/
-  CatalogAttribute(CatalogRelationSchema *parent,
-                   const std::string &name,
-                   const Type &type,
-                   const attribute_id id = -1,
-                   const std::string &display_name = "")
-      : parent_(parent), id_(id), name_(name), display_name_(display_name), type_(&type) {
-  }
-
-  /**
-   * @brief Reconstruct an attribute from its serialized Protocol Buffer form.
-   *
-   * @param proto The Protocol Buffer serialization of an attribute,
-   *        previously produced by getProto().
-   **/
-  explicit CatalogAttribute(const serialization::CatalogAttribute &proto);
-
-  /**
-   * @brief Get the parent relation.
-   *
-   * @return Parent relation.
-   **/
-  const CatalogRelationSchema& getParent() const {
-    return *parent_;
-  }
-
-  /**
-   * @brief Get a mutable pointer to the parent relation.
-   *
-   * @return Parent relation.
-   **/
-  CatalogRelationSchema* getParentMutable() {
-    return parent_;
-  }
-
-  /**
-   * @brief Get this attribute's ID.
-   *
-   * @return This attribute's ID.
-   **/
-  attribute_id getID() const {
-    return id_;
-  }
-
-  /**
-   * @brief Get this attribute's name.
-   *
-   * @return This attribute's name.
-   **/
-  const std::string& getName() const {
-    return name_;
-  }
-
-  /**
-   * @brief Get this attribute's display name (the name which would be printed
-   *        to the screen).
-   *
-   * @return This attribute's display name.
-   **/
-  const std::string& getDisplayName() const {
-    if (display_name_.empty()) {
-      return name_;
-    } else {
-      return display_name_;
-    }
-  }
-
-  /**
-   * @brief Set this attribute's display name (the name which would be printed
-   *        to the screen).
-   */
-  void setDisplayName(const std::string &new_display_name) {
-    display_name_ = new_display_name;
-  }
-
-  /**
-   * @brief Get this attribute's type.
-   *
-   * @return This attribute's type.
-   **/
-  const Type& getType() const {
-    return *type_;
-  }
-
-  /**
-   * @brief Serialize the attribute as Protocol Buffer.
-   *
-   * @return The Protocol Buffer representation of the attribute.
-   **/
-  serialization::CatalogAttribute getProto() const;
-
-  /**
-   * @brief Check whether a serialization::CatalogAttribute is fully-formed and
-   *        all parts are valid.
-   *
-   * @param proto A serialized Protocol Buffer representation of a CatalogAttribute,
-   *        originally generated by getProto().
-   * @return Whether proto is fully-formed and valid.
-   **/
-  static bool ProtoIsValid(const serialization::CatalogAttribute &proto);
-
- private:
-    /**
-   * @brief Set the parent CatalogRelationSchema for this attribute. Used by
-   *        CatalogRelationSchema (a friend of this class) when adding a new
-   *        attribute.
-   *
-   * @param parent The new parent for this CatalogAttribute.
-   **/
-  void setParent(CatalogRelationSchema *parent) {
-    parent_ = parent;
-  }
-
-  /**
-   * @brief Set the ID of this attribute. Used by CatalogRelationSchema (a
-   *        friend of this class) when adding a new attribute.
-   *
-   * @param id The new ID for this CatalogAttribute.
-   **/
-  void setID(const attribute_id id) {
-    id_ = id;
-  }
-
-  CatalogRelationSchema *parent_;
-
-  // The attribute id in CatalogRelationSchema.
-  attribute_id id_;
-
-  // The internal attribute name.
-  const std::string name_;
-
-  // The external attribute name used to print on screen, if non-empty.
-  std::string display_name_;
-
-  // The attribute's underlying type.
-  const Type *type_;
-
-  friend class CatalogRelationSchema;
-
-  DISALLOW_COPY_AND_ASSIGN(CatalogAttribute);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_CATALOG_CATALOG_ATTRIBUTE_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/catalog/CatalogConfig.h.in
----------------------------------------------------------------------
diff --git a/catalog/CatalogConfig.h.in b/catalog/CatalogConfig.h.in
deleted file mode 100644
index dd68577..0000000
--- a/catalog/CatalogConfig.h.in
+++ /dev/null
@@ -1,21 +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.
- **/
-
-#cmakedefine QUICKSTEP_HAVE_LIBNUMA
-

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/catalog/CatalogDatabase.cpp
----------------------------------------------------------------------
diff --git a/catalog/CatalogDatabase.cpp b/catalog/CatalogDatabase.cpp
deleted file mode 100644
index c95196c..0000000
--- a/catalog/CatalogDatabase.cpp
+++ /dev/null
@@ -1,154 +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 "catalog/CatalogDatabase.hpp"
-
-#include <cstddef>
-#include <cstring>
-#include <string>
-#include <unordered_map>
-#include <utility>
-
-#include "catalog/Catalog.pb.h"
-#include "catalog/CatalogErrors.hpp"
-#include "catalog/CatalogRelation.hpp"
-#include "threading/Mutex.hpp"
-#include "threading/SpinSharedMutex.hpp"
-#include "utility/PtrVector.hpp"
-#include "utility/StringUtil.hpp"
-
-#include "glog/logging.h"
-
-using std::size_t;
-using std::strcmp;
-using std::string;
-
-namespace quickstep {
-
-bool CatalogDatabase::ProtoIsValid(const serialization::CatalogDatabase &proto) {
-  // Check that proto is fully initialized.
-  if (!proto.IsInitialized()) {
-    return false;
-  }
-
-  for (int i = 0; i < proto.relations_size(); ++i) {
-    if (!CatalogRelation::ProtoIsValid(proto.relations(i))) {
-      return false;
-    }
-  }
-
-  return true;
-}
-
-CatalogDatabase::CatalogDatabase(const serialization::CatalogDatabase &proto)
-    : parent_(nullptr),
-      name_(proto.name()),
-      status_(Status::kConsistent) {
-  DCHECK(ProtoIsValid(proto))
-      << "Attempted to create CatalogDatabase from an invalid proto description:\n"
-      << proto.DebugString();
-
-  for (int index_relations = 0, index_null_relations = 0;
-       index_relations < proto.null_relations_size() + proto.relations_size();
-       ++index_relations) {
-    if (index_null_relations < proto.null_relations_size() &&
-        index_relations == proto.null_relations(index_null_relations)) {
-      rel_vec_.push_back(NULL);
-      ++index_null_relations;
-    } else {
-      addRelation(new CatalogRelation(proto.relations(index_relations - index_null_relations)));
-    }
-  }
-}
-
-const CatalogRelation* CatalogDatabase::getRelationByName(const string &rel_name) const {
-  SpinSharedMutexSharedLock<false> lock(relations_mutex_);
-  std::unordered_map<string, CatalogRelation*>::const_iterator it = rel_map_.find(ToLower(rel_name));
-  if (it == rel_map_.end()) {
-    return nullptr;
-  } else {
-    return it->second;
-  }
-}
-
-CatalogRelation* CatalogDatabase::getRelationByNameMutable(const string &rel_name) {
-  SpinSharedMutexSharedLock<false> lock(relations_mutex_);
-  std::unordered_map<string, CatalogRelation*>::iterator it = rel_map_.find(ToLower(rel_name));
-  if (it == rel_map_.end()) {
-    return nullptr;
-  } else {
-    return it->second;
-  }
-}
-
-relation_id CatalogDatabase::addRelation(CatalogRelation *new_rel) {
-  const string lower_rel_name = ToLower(new_rel->getName());
-  {
-    SpinSharedMutexExclusiveLock<false> lock(relations_mutex_);
-    if (hasRelationWithNameUnsafe(lower_rel_name)) {
-      throw RelationNameCollision(name_, new_rel->getName());
-    } else if (rel_vec_.size() > static_cast<size_t>(kCatalogMaxID)) {
-      throw CatalogIDOverflow("relation");
-    } else {
-      rel_map_[lower_rel_name] = new_rel;
-      rel_vec_.push_back(new_rel);
-      new_rel->setParent(this);
-      new_rel->setID(static_cast<relation_id>(rel_vec_.size() - 1));
-      return (new_rel->getID());
-    }
-  }
-}
-
-void CatalogDatabase::dropRelationByName(const std::string &rel_name) {
-  SpinSharedMutexExclusiveLock<false> lock(relations_mutex_);
-  std::unordered_map<string, CatalogRelation*>::iterator it = rel_map_.find(ToLower(rel_name));
-  if (it == rel_map_.end()) {
-    throw RelationNameNotFound(name_, rel_name);
-  } else {
-    rel_vec_.deleteElement(it->second->getID());
-    rel_map_.erase(it);
-  }
-}
-
-void CatalogDatabase::dropRelationById(const relation_id id) {
-  SpinSharedMutexExclusiveLock<false> lock(relations_mutex_);
-  if (hasRelationWithIdUnsafe(id)) {
-    rel_map_.erase(ToLower(rel_vec_[id].getName()));
-    rel_vec_.deleteElement(id);
-  } else {
-    throw RelationIdNotFound(name_, id);
-  }
-}
-
-serialization::CatalogDatabase CatalogDatabase::getProto() const {
-  serialization::CatalogDatabase proto;
-  proto.set_name(name_);
-
-  int i = 0;
-  for (PtrVector<CatalogRelation, true>::const_iterator it = rel_vec_.begin(); it != rel_vec_.end(); ++it, ++i) {
-    if (it.isNull()) {
-      proto.add_null_relations(i);
-    } else {
-      proto.add_relations()->CopyFrom(it->getProto());
-    }
-  }
-  return proto;
-}
-
-}  // namespace quickstep


[25/51] [abbrv] [partial] incubator-quickstep git commit: remove c++ files

Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/parser/preprocessed/SqlLexer_gen.hpp
----------------------------------------------------------------------
diff --git a/parser/preprocessed/SqlLexer_gen.hpp b/parser/preprocessed/SqlLexer_gen.hpp
deleted file mode 100644
index 0dd70e4..0000000
--- a/parser/preprocessed/SqlLexer_gen.hpp
+++ /dev/null
@@ -1,368 +0,0 @@
-#ifndef quickstep_yyHEADER_H
-#define quickstep_yyHEADER_H 1
-#define quickstep_yyIN_HEADER 1
-
-#line 6 "SqlLexer_gen.hpp"
-
-#line 8 "SqlLexer_gen.hpp"
-
-#define  YY_INT_ALIGNED short int
-
-/* A lexical scanner generated by flex */
-
-#define FLEX_SCANNER
-#define YY_FLEX_MAJOR_VERSION 2
-#define YY_FLEX_MINOR_VERSION 6
-#define YY_FLEX_SUBMINOR_VERSION 0
-#if YY_FLEX_SUBMINOR_VERSION > 0
-#define FLEX_BETA
-#endif
-
-/* First, we deal with  platform-specific or compiler-specific issues. */
-
-/* begin standard C headers. */
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-#include <stdlib.h>
-
-/* end standard C headers. */
-
-/* flex integer type definitions */
-
-#ifndef FLEXINT_H
-#define FLEXINT_H
-
-/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
-
-#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
-
-/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
- * if you want the limit (max/min) macros for int types. 
- */
-#ifndef __STDC_LIMIT_MACROS
-#define __STDC_LIMIT_MACROS 1
-#endif
-
-#include <inttypes.h>
-typedef int8_t flex_int8_t;
-typedef uint8_t flex_uint8_t;
-typedef int16_t flex_int16_t;
-typedef uint16_t flex_uint16_t;
-typedef int32_t flex_int32_t;
-typedef uint32_t flex_uint32_t;
-#else
-typedef signed char flex_int8_t;
-typedef short int flex_int16_t;
-typedef int flex_int32_t;
-typedef unsigned char flex_uint8_t; 
-typedef unsigned short int flex_uint16_t;
-typedef unsigned int flex_uint32_t;
-
-/* Limits of integral types. */
-#ifndef INT8_MIN
-#define INT8_MIN               (-128)
-#endif
-#ifndef INT16_MIN
-#define INT16_MIN              (-32767-1)
-#endif
-#ifndef INT32_MIN
-#define INT32_MIN              (-2147483647-1)
-#endif
-#ifndef INT8_MAX
-#define INT8_MAX               (127)
-#endif
-#ifndef INT16_MAX
-#define INT16_MAX              (32767)
-#endif
-#ifndef INT32_MAX
-#define INT32_MAX              (2147483647)
-#endif
-#ifndef UINT8_MAX
-#define UINT8_MAX              (255U)
-#endif
-#ifndef UINT16_MAX
-#define UINT16_MAX             (65535U)
-#endif
-#ifndef UINT32_MAX
-#define UINT32_MAX             (4294967295U)
-#endif
-
-#endif /* ! C99 */
-
-#endif /* ! FLEXINT_H */
-
-#ifdef __cplusplus
-
-/* The "const" storage-class-modifier is valid. */
-#define YY_USE_CONST
-
-#else	/* ! __cplusplus */
-
-/* C99 requires __STDC__ to be defined as 1. */
-#if defined (__STDC__)
-
-#define YY_USE_CONST
-
-#endif	/* defined (__STDC__) */
-#endif	/* ! __cplusplus */
-
-#ifdef YY_USE_CONST
-#define yyconst const
-#else
-#define yyconst
-#endif
-
-/* An opaque pointer. */
-#ifndef YY_TYPEDEF_YY_SCANNER_T
-#define YY_TYPEDEF_YY_SCANNER_T
-typedef void* yyscan_t;
-#endif
-
-/* For convenience, these vars (plus the bison vars far below)
-   are macros in the reentrant scanner. */
-#define yyin yyg->yyin_r
-#define yyout yyg->yyout_r
-#define yyextra yyg->yyextra_r
-#define yyleng yyg->yyleng_r
-#define yytext yyg->yytext_r
-#define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno)
-#define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column)
-#define yy_flex_debug yyg->yy_flex_debug_r
-
-/* Size of default input buffer. */
-#ifndef YY_BUF_SIZE
-#ifdef __ia64__
-/* On IA-64, the buffer size is 16k, not 8k.
- * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
- * Ditto for the __ia64__ case accordingly.
- */
-#define YY_BUF_SIZE 32768
-#else
-#define YY_BUF_SIZE 16384
-#endif /* __ia64__ */
-#endif
-
-#ifndef YY_TYPEDEF_YY_BUFFER_STATE
-#define YY_TYPEDEF_YY_BUFFER_STATE
-typedef struct yy_buffer_state *YY_BUFFER_STATE;
-#endif
-
-#ifndef YY_TYPEDEF_YY_SIZE_T
-#define YY_TYPEDEF_YY_SIZE_T
-typedef size_t yy_size_t;
-#endif
-
-#ifndef YY_STRUCT_YY_BUFFER_STATE
-#define YY_STRUCT_YY_BUFFER_STATE
-struct yy_buffer_state
-	{
-	FILE *yy_input_file;
-
-	char *yy_ch_buf;		/* input buffer */
-	char *yy_buf_pos;		/* current position in input buffer */
-
-	/* Size of input buffer in bytes, not including room for EOB
-	 * characters.
-	 */
-	yy_size_t yy_buf_size;
-
-	/* Number of characters read into yy_ch_buf, not including EOB
-	 * characters.
-	 */
-	yy_size_t yy_n_chars;
-
-	/* Whether we "own" the buffer - i.e., we know we created it,
-	 * and can realloc() it to grow it, and should free() it to
-	 * delete it.
-	 */
-	int yy_is_our_buffer;
-
-	/* Whether this is an "interactive" input source; if so, and
-	 * if we're using stdio for input, then we want to use getc()
-	 * instead of fread(), to make sure we stop fetching input after
-	 * each newline.
-	 */
-	int yy_is_interactive;
-
-	/* Whether we're considered to be at the beginning of a line.
-	 * If so, '^' rules will be active on the next match, otherwise
-	 * not.
-	 */
-	int yy_at_bol;
-
-    int yy_bs_lineno; /**< The line count. */
-    int yy_bs_column; /**< The column count. */
-    
-	/* Whether to try to fill the input buffer when we reach the
-	 * end of it.
-	 */
-	int yy_fill_buffer;
-
-	int yy_buffer_status;
-
-	};
-#endif /* !YY_STRUCT_YY_BUFFER_STATE */
-
-void quickstep_yyrestart (FILE *input_file ,yyscan_t yyscanner );
-void quickstep_yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
-YY_BUFFER_STATE quickstep_yy_create_buffer (FILE *file,int size ,yyscan_t yyscanner );
-void quickstep_yy_delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
-void quickstep_yy_flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
-void quickstep_yypush_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
-void quickstep_yypop_buffer_state (yyscan_t yyscanner );
-
-YY_BUFFER_STATE quickstep_yy_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner );
-YY_BUFFER_STATE quickstep_yy_scan_string (yyconst char *yy_str ,yyscan_t yyscanner );
-YY_BUFFER_STATE quickstep_yy_scan_bytes (yyconst char *bytes,yy_size_t len ,yyscan_t yyscanner );
-
-void *quickstep_yyalloc (yy_size_t ,yyscan_t yyscanner );
-void *quickstep_yyrealloc (void *,yy_size_t ,yyscan_t yyscanner );
-void quickstep_yyfree (void * ,yyscan_t yyscanner );
-
-/* Begin user sect3 */
-
-#define quickstep_yywrap(yyscanner) (/*CONSTCOND*/1)
-#define YY_SKIP_YYWRAP
-
-#define yytext_ptr yytext_r
-
-#ifdef YY_HEADER_EXPORT_START_CONDITIONS
-#define INITIAL 0
-#define CONDITION_SQL 1
-#define CONDITION_COMMAND 2
-#define CONDITION_STRING_SINGLE_QUOTED 3
-#define CONDITION_STRING_SINGLE_QUOTED_ESCAPED 4
-#define CONDITION_STRING_DOUBLE_QUOTED 5
-
-#endif
-
-#ifndef YY_NO_UNISTD_H
-/* Special case for "unistd.h", since it is non-ANSI. We include it way
- * down here because we want the user's section 1 to have been scanned first.
- * The user has a chance to override it with an option.
- */
-#include <unistd.h>
-#endif
-
-#ifndef YY_EXTRA_TYPE
-#define YY_EXTRA_TYPE void *
-#endif
-
-int quickstep_yylex_init (yyscan_t* scanner);
-
-int quickstep_yylex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner);
-
-/* Accessor methods to globals.
-   These are made visible to non-reentrant scanners for convenience. */
-
-int quickstep_yylex_destroy (yyscan_t yyscanner );
-
-int quickstep_yyget_debug (yyscan_t yyscanner );
-
-void quickstep_yyset_debug (int debug_flag ,yyscan_t yyscanner );
-
-YY_EXTRA_TYPE quickstep_yyget_extra (yyscan_t yyscanner );
-
-void quickstep_yyset_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner );
-
-FILE *quickstep_yyget_in (yyscan_t yyscanner );
-
-void quickstep_yyset_in  (FILE * _in_str ,yyscan_t yyscanner );
-
-FILE *quickstep_yyget_out (yyscan_t yyscanner );
-
-void quickstep_yyset_out  (FILE * _out_str ,yyscan_t yyscanner );
-
-yy_size_t quickstep_yyget_leng (yyscan_t yyscanner );
-
-char *quickstep_yyget_text (yyscan_t yyscanner );
-
-int quickstep_yyget_lineno (yyscan_t yyscanner );
-
-void quickstep_yyset_lineno (int _line_number ,yyscan_t yyscanner );
-
-int quickstep_yyget_column  (yyscan_t yyscanner );
-
-void quickstep_yyset_column (int _column_no ,yyscan_t yyscanner );
-
-YYSTYPE * quickstep_yyget_lval (yyscan_t yyscanner );
-
-void quickstep_yyset_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner );
-
-       YYLTYPE *quickstep_yyget_lloc (yyscan_t yyscanner );
-    
-        void quickstep_yyset_lloc (YYLTYPE * yylloc_param ,yyscan_t yyscanner );
-    
-/* Macros after this point can all be overridden by user definitions in
- * section 1.
- */
-
-#ifndef YY_SKIP_YYWRAP
-#ifdef __cplusplus
-extern "C" int quickstep_yywrap (yyscan_t yyscanner );
-#else
-extern int quickstep_yywrap (yyscan_t yyscanner );
-#endif
-#endif
-
-#ifndef yytext_ptr
-static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner);
-#endif
-
-#ifdef YY_NEED_STRLEN
-static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner);
-#endif
-
-#ifndef YY_NO_INPUT
-
-#endif
-
-/* Amount of stuff to slurp up with each read. */
-#ifndef YY_READ_BUF_SIZE
-#ifdef __ia64__
-/* On IA-64, the buffer size is 16k, not 8k */
-#define YY_READ_BUF_SIZE 16384
-#else
-#define YY_READ_BUF_SIZE 8192
-#endif /* __ia64__ */
-#endif
-
-/* Number of entries by which start-condition stack grows. */
-#ifndef YY_START_STACK_INCR
-#define YY_START_STACK_INCR 25
-#endif
-
-/* Default declaration of generated scanner - a define so the user can
- * easily add parameters.
- */
-#ifndef YY_DECL
-#define YY_DECL_IS_OURS 1
-
-extern int quickstep_yylex \
-               (YYSTYPE * yylval_param,YYLTYPE * yylloc_param ,yyscan_t yyscanner);
-
-#define YY_DECL int quickstep_yylex \
-               (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner)
-#endif /* !YY_DECL */
-
-/* yy_get_previous_state - get the state just before the EOB char was reached */
-
-#undef YY_NEW_FILE
-#undef YY_FLUSH_BUFFER
-#undef yy_set_bol
-#undef yy_new_buffer
-#undef yy_set_interactive
-#undef YY_DO_BEFORE_ACTION
-
-#ifdef YY_DECL_IS_OURS
-#undef YY_DECL_IS_OURS
-#undef YY_DECL
-#endif
-
-#line 466 "../SqlLexer.lpp"
-
-
-#line 367 "SqlLexer_gen.hpp"
-#undef quickstep_yyIN_HEADER
-#endif /* quickstep_yyHEADER_H */


[29/51] [abbrv] [partial] incubator-quickstep git commit: remove c++ files

Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/parser/ParsePredicate.hpp
----------------------------------------------------------------------
diff --git a/parser/ParsePredicate.hpp b/parser/ParsePredicate.hpp
deleted file mode 100644
index cc3e66d..0000000
--- a/parser/ParsePredicate.hpp
+++ /dev/null
@@ -1,453 +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_PARSER_PARSE_PREDICATE_HPP_
-#define QUICKSTEP_PARSER_PARSE_PREDICATE_HPP_
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "parser/ParseExpression.hpp"
-#include "parser/ParseTreeNode.hpp"
-#include "utility/Macros.hpp"
-#include "utility/PtrList.hpp"
-
-namespace quickstep {
-
-class Comparison;
-
-/** \addtogroup Parser
- *  @{
- */
-
-/**
- * @brief The parsed representation of a predicate.
- **/
-class ParsePredicate : public ParseTreeNode {
- public:
-  /**
-   * @brief The possible types of ParsePredicates.
-   **/
-  enum ParsePredicateType {
-    kBetween,
-    kComparison,
-    kNegation,
-    kConjunction,
-    kDisjunction,
-    kExists,
-    kInTableQuery,
-    kInValueList
-  };
-
-  /**
-   * @brief Virtual destructor.
-   **/
-  ~ParsePredicate() override {}
-
-  /**
-   * @brief Identify the type of this ParsePredicate.
-   *
-   * @return The type of this ParsePredicate.
-   **/
-  virtual ParsePredicateType getParsePredicateType() const = 0;
-
- protected:
-  ParsePredicate(const int line_number, const int column_number)
-      : ParseTreeNode(line_number, column_number) {
-  }
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(ParsePredicate);
-};
-
-/**
- * @brief The parsed representation of a simple comparison predicate.
- **/
-class ParsePredicateComparison : public ParsePredicate {
- public:
-  /**
-   * @brief Constructor.
-   *
-   * @param line_number Line number of the comparison operator token in the SQL statement.
-   * @param column_number Column number of the comparison operator token in the SQL statement.
-   * @param op The comparison (from the quickstep type system).
-   * @param left_operand The left operand of the comparison, which becomes
-   *        owned by this ParsePredicateComparison.
-   * @param right_operand The right operand of the comparison, which becomes
-   *        owned by this ParsePredicateComparison.
-   **/
-  ParsePredicateComparison(const int line_number,
-                           const int column_number,
-                           const Comparison &op,
-                           ParseExpression *left_operand,
-                           ParseExpression *right_operand)
-      : ParsePredicate(line_number, column_number),
-        op_(op),
-        left_operand_(left_operand),
-        right_operand_(right_operand) {
-  }
-
-  /**
-   * @brief Destructor.
-   */
-  ~ParsePredicateComparison() override {}
-
-  /**
-   * @return The comparison operator.
-   */
-  const Comparison& op() const {
-    return op_;
-  }
-
-  /**
-   * @return The left operand.
-   */
-  const ParseExpression* left_operand() const {
-    return left_operand_.get();
-  }
-
-  /**
-   * @return The right operand.
-   */
-  const ParseExpression* right_operand() const {
-    return right_operand_.get();
-  }
-
-  std::string getName() const override;
-
-  ParsePredicateType getParsePredicateType() const override {
-    return kComparison;
-  }
-
- 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<const ParseTreeNode*> *non_container_child_fields,
-      std::vector<std::string> *container_child_field_names,
-      std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const override;
-
- private:
-  const Comparison &op_;
-  std::unique_ptr<ParseExpression> left_operand_;
-  std::unique_ptr<ParseExpression> right_operand_;
-
-  DISALLOW_COPY_AND_ASSIGN(ParsePredicateComparison);
-};
-
-/**
- * @brief The parsed representation of a NOT predicate.
- **/
-class ParsePredicateNegation : public ParsePredicate {
- public:
-  /**
-   * @brief Constructor.
-   *
-   * @param line_number Line number of the first token of this node in the SQL statement.
-   * @param column_number Column number of the first token of this node in the SQL statement.
-   * @param operand The inner predicate to be negated, becomes owned by this
-   *        ParsePredicateNegation.
-   **/
-  ParsePredicateNegation(const int line_number, const int column_number, ParsePredicate *operand)
-      : ParsePredicate(line_number, column_number), operand_(operand) {
-  }
-
-  /**
-   * @brief Destructor.
-   */
-  ~ParsePredicateNegation() override {}
-
-  /**
-   * @return The operand.
-   */
-  const ParsePredicate* operand() const {
-    return operand_.get();
-  }
-
-  ParsePredicateType getParsePredicateType() const override {
-    return kNegation;
-  }
-
-  std::string getName() const override {
-    return "Not";
-  }
-
- 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<const ParseTreeNode*> *non_container_child_fields,
-      std::vector<std::string> *container_child_field_names,
-      std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const override;
-
- private:
-  std::unique_ptr<ParsePredicate> operand_;
-
-  DISALLOW_COPY_AND_ASSIGN(ParsePredicateNegation);
-};
-
-/**
- * @brief The parsed representation of a BETWEEN predicate.
- *        The parser does not convert it to two comparison
- *        predicates to avoid cloning and evaluating \p middle_operand_
- *        twice for complex expressions (subqueries or
- *        aggregations). The query optimizer is responsible for the conversion.
- **/
-class ParsePredicateBetween : public ParsePredicate {
- public:
-  /**
-   * @brief Construction.
-   *
-   * @param line_number The line number of 'BETWEEN' in the SQL statement.
-   * @param column_number The column number of 'BETWEEN' in the SQL statement.
-   * @param lower_bound_operand The operand on the left side of BETWEEN.
-   * @param check_operand The operand in between BETWEEN and AND.
-   * @param upper_bound_operand The operand after AND.
-   */
-  ParsePredicateBetween(const int line_number,
-                        const int column_number,
-                        ParseExpression *check_operand,
-                        ParseExpression *lower_bound_operand,
-                        ParseExpression *upper_bound_operand)
-      : ParsePredicate(line_number, column_number),
-        check_operand_(check_operand),
-        lower_bound_operand_(lower_bound_operand),
-        upper_bound_operand_(upper_bound_operand) {
-  }
-
-  /**
-   * @brief Destructor.
-   */
-  ~ParsePredicateBetween() override {}
-
-  /**
-   * @return The operand to be compared with the lower bound and
-   *         the upper bound.
-   */
-  const ParseExpression* check_operand() const {
-    return check_operand_.get();
-  }
-
-  /**
-   * @return Lower bound operand.
-   */
-  const ParseExpression* lower_bound_operand() const {
-    return lower_bound_operand_.get();
-  }
-
-  /**
-   * @return Upper bound operand.
-   */
-  const ParseExpression* upper_bound_operand() const {
-    return upper_bound_operand_.get();
-  }
-
-  ParsePredicateType getParsePredicateType() const override {
-    return kBetween;
-  }
-
-  std::string getName() const override {
-    return "Between";
-  }
-
- 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<const ParseTreeNode*> *non_container_child_fields,
-      std::vector<std::string> *container_child_field_names,
-      std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const override;
-
- private:
-  std::unique_ptr<ParseExpression> check_operand_;
-  std::unique_ptr<ParseExpression> lower_bound_operand_;
-  std::unique_ptr<ParseExpression> upper_bound_operand_;
-
-  DISALLOW_COPY_AND_ASSIGN(ParsePredicateBetween);
-};
-
-/**
- * @brief Abstract base class of conjunction and disjunction predicates.
- **/
-class ParsePredicateWithList : public ParsePredicate {
- public:
-  ~ParsePredicateWithList() override {}
-
-  const PtrList<ParsePredicate>& operands() const {
-    return operands_;
-  }
-
-  /**
-   * @brief Add a child predicate to this conjunction or disjunction.
-   *
-   * @param operand The child predicate to add to this one, which becomes
-   *        owned by this predicate.
-   **/
-  void addPredicate(ParsePredicate *operand) {
-    operands_.push_back(operand);
-  }
-
- protected:
-  /**
-   * @brief Constructor.
-   *
-   * @param line_number Line number of the first token of this node in the SQL statement.
-   * @param column_number Column number of the first token of this node in the SQL statement.
-   **/
-  ParsePredicateWithList(const int line_number, const int column_number)
-      : ParsePredicate(line_number, column_number) {
-  }
-
-  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<const ParseTreeNode*> *non_container_child_fields,
-      std::vector<std::string> *container_child_field_names,
-      std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const override;
-
-  PtrList<ParsePredicate> operands_;
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(ParsePredicateWithList);
-};
-
-/**
- * @brief An AND over other predicates.
- **/
-class ParsePredicateConjunction : public ParsePredicateWithList {
- public:
-  /**
-   * @brief Constructor.
-   *
-   * @param line_number Line number of the first token of this node in the SQL statement.
-   * @param column_number Column number of the first token of this node in the SQL statement.
-   **/
-  ParsePredicateConjunction(const int line_number, const int column_number)
-      : ParsePredicateWithList(line_number, column_number) {
-  }
-
-  ParsePredicateType getParsePredicateType() const override {
-    return kConjunction;
-  }
-
-  std::string getName() const override {
-    return "And";
-  }
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(ParsePredicateConjunction);
-};
-
-/**
- * @brief An OR over other predicates.
- **/
-class ParsePredicateDisjunction : public ParsePredicateWithList {
- public:
-  /**
-   * @brief Constructor.
-   *
-   * @param line_number Line number of the first token of this node in the SQL statement.
-   * @param column_number Column number of the first token of this node in the SQL statement.
-   **/
-  ParsePredicateDisjunction(const int line_number, const int column_number)
-      : ParsePredicateWithList(line_number, column_number) {
-  }
-
-  ParsePredicateType getParsePredicateType() const override {
-    return kDisjunction;
-  }
-
-  std::string getName() const override {
-    return "Or";
-  }
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(ParsePredicateDisjunction);
-};
-
-
-/**
- * @brief Parsed representation of IN with a value list.
- */
-class ParsePredicateInValueList : public ParsePredicate {
- public:
-  /**
-   * @brief Constructor.
-   *
-   * @param line_number The line number of the token "IN" in the statement.
-   * @param column_number The column number of the token "IN" in the statement.
-   * @param test_expression The expression to be compared with a value list.
-   * @param value_list The list of values to match with test_expression.
-   */
-  ParsePredicateInValueList(const int line_number,
-                            const int column_number,
-                            ParseExpression *test_expression,
-                            PtrList<ParseExpression> *value_list)
-      : ParsePredicate(line_number, column_number),
-        test_expression_(test_expression),
-        value_list_(value_list) {}
-
-  ParsePredicateType getParsePredicateType() const override {
-    return kInValueList;
-  }
-
-  std::string getName() const override {
-    return "InValueList";
-  }
-
-  /**
-   * @return  The expression to be compared with a value list.
-   */
-  const ParseExpression* test_expression() const {
-    return test_expression_.get();
-  }
-
-  /**
-   * @return The list of values to match with test_expression.
-   */
-  const PtrList<ParseExpression>* value_list() const {
-    return value_list_.get();
-  }
-
- 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<const ParseTreeNode*> *non_container_child_fields,
-      std::vector<std::string> *container_child_field_names,
-      std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const override;
-
- private:
-  std::unique_ptr<ParseExpression> test_expression_;
-  std::unique_ptr<PtrList<ParseExpression>> value_list_;
-
-  DISALLOW_COPY_AND_ASSIGN(ParsePredicateInValueList);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_PARSER_PARSE_PREDICATE_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/parser/ParsePredicateExists.hpp
----------------------------------------------------------------------
diff --git a/parser/ParsePredicateExists.hpp b/parser/ParsePredicateExists.hpp
deleted file mode 100644
index 1738964..0000000
--- a/parser/ParsePredicateExists.hpp
+++ /dev/null
@@ -1,95 +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_PARSER_PARSE_PREDICATE_EXISTS_HPP_
-#define QUICKSTEP_PARSER_PARSE_PREDICATE_EXISTS_HPP_
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "parser/ParsePredicate.hpp"
-#include "parser/ParseSubqueryExpression.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-
-class ParseTreeNode;
-
-/** \addtogroup Parser
- *  @{
- */
-
-/**
- * @brief The parsed representation of an EXISTS predicate.
- */
-class ParsePredicateExists : public ParsePredicate {
- public:
-  /**
-   * @brief Constructor.
-   *
-   * @param line_number The line number of the EXISTS token in the statement.
-   * @param column_number The column number of the EXISTS token in the statement.
-   * @param subquery The subquery expression for this EXISTS predicate.
-   */
-  ParsePredicateExists(const int line_number,
-                       const int column_number,
-                       ParseSubqueryExpression *subquery)
-      : ParsePredicate(line_number, column_number),
-        subquery_(subquery) {
-  }
-
-  ParsePredicateType getParsePredicateType() const override {
-    return kExists;
-  }
-
-  std::string getName() const override {
-    return "Exists";
-  }
-
-  /**
-   * @return The subquery expression for this EXISTS predicate.
-   */
-  const ParseSubqueryExpression* subquery() const {
-    return subquery_.get();
-  }
-
- 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<const ParseTreeNode*> *non_container_child_fields,
-      std::vector<std::string> *container_child_field_names,
-      std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const override {
-    non_container_child_field_names->push_back("subquery");
-    non_container_child_fields->push_back(subquery_.get());
-  }
-
- private:
-  std::unique_ptr<ParseSubqueryExpression> subquery_;
-
-  DISALLOW_COPY_AND_ASSIGN(ParsePredicateExists);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_PARSER_PARSE_PREDICATE_EXISTS_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/parser/ParsePredicateInTableQuery.hpp
----------------------------------------------------------------------
diff --git a/parser/ParsePredicateInTableQuery.hpp b/parser/ParsePredicateInTableQuery.hpp
deleted file mode 100644
index d669522..0000000
--- a/parser/ParsePredicateInTableQuery.hpp
+++ /dev/null
@@ -1,112 +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_PARSER_PARSE_PREDICATE_IN_TABLE_QUERY_HPP_
-#define QUICKSTEP_PARSER_PARSE_PREDICATE_IN_TABLE_QUERY_HPP_
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "parser/ParseExpression.hpp"
-#include "parser/ParsePredicate.hpp"
-#include "parser/ParseSubqueryExpression.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-
-class ParseTreeNode;
-
-/** \addtogroup Parser
- *  @{
- */
-
-/**
- * @brief Parsed representation of IN with a table subquery expression.
- *
- * @note Putting the class here instead of in ParsePredicate.hpp is to avoid
- *       circular dependencies with ParseSelect.
- */
-class ParsePredicateInTableQuery : public ParsePredicate {
- public:
-  /**
-   * @brief Constructor.
-   *
-   * @param line_number The line number of the token "IN" in the statement.
-   * @param column_number The column number of the token "IN" in the statement.
-   * @param test_expression The expression to test with a subquery expression.
-   * @param table_query The table subquery expression to search for test_expression.
-   */
-  ParsePredicateInTableQuery(const int line_number,
-                             const int column_number,
-                             ParseExpression *test_expression,
-                             ParseSubqueryExpression *table_query)
-      : ParsePredicate(line_number, column_number),
-        test_expression_(test_expression),
-        table_query_(table_query) {}
-
-  ParsePredicateType getParsePredicateType() const override {
-    return kInTableQuery;
-  }
-
-  std::string getName() const override {
-    return "InTableQuery";
-  }
-
-  /**
-   * @return The expression to test with a subquery expression.
-   */
-  const ParseExpression* test_expression() const {
-    return test_expression_.get();
-  }
-
-  /**
-   * @return The table subquery expression to search for test_expression.
-   */
-  const ParseSubqueryExpression* table_query() const {
-    return table_query_.get();
-  }
-
- 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<const ParseTreeNode*> *non_container_child_fields,
-      std::vector<std::string> *container_child_field_names,
-      std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const override {
-    non_container_child_field_names->push_back("test_expression");
-    non_container_child_fields->push_back(test_expression_.get());
-
-    non_container_child_field_names->push_back("table_query");
-    non_container_child_fields->push_back(table_query_.get());
-  }
-
- private:
-  std::unique_ptr<ParseExpression> test_expression_;
-  std::unique_ptr<ParseSubqueryExpression> table_query_;
-
-  DISALLOW_COPY_AND_ASSIGN(ParsePredicateInTableQuery);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_PARSER_PARSE_PREDICATE_IN_TABLE_QUERY_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/parser/ParsePriority.hpp
----------------------------------------------------------------------
diff --git a/parser/ParsePriority.hpp b/parser/ParsePriority.hpp
deleted file mode 100644
index e53fbfa..0000000
--- a/parser/ParsePriority.hpp
+++ /dev/null
@@ -1,96 +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_PARSER_PARSE_PRIORITY_HPP_
-#define QUICKSTEP_PARSER_PARSE_PRIORITY_HPP_
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "parser/ParseLiteralValue.hpp"
-#include "parser/ParseTreeNode.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-
-/** \addtogroup Parser
- *  @{
- */
-
-/**
- * @brief A parsed representation of PRIORITY.
- **/
-class ParsePriority : public ParseTreeNode {
- public:
-  /**
-   * @brief Constructor.
-   *
-   * @param line_number The line number of "PRIORITY" in the SQL statement.
-   * @param column_number The column number of "PRIORITY" in the SQL statement.
-   * @param priority_expression The PRIORITY value expression.
-   **/
-  ParsePriority(const int line_number,
-                const int column_number,
-                NumericParseLiteralValue *priority_expression)
-      : ParseTreeNode(line_number, column_number),
-        priority_expression_(priority_expression) {}
-
-  /**
-   * @brief Destructor.
-   */
-  ~ParsePriority() override {}
-
-  /**
-   * @brief Gets the PRIORITY expression.
-   *
-   * @return PRIORITY expression
-   */
-  const NumericParseLiteralValue* priority_expression() const {
-    return priority_expression_.get();
-  }
-
-  std::string getName() const override {
-    return "PRIORITY";
-  }
-
- 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<const ParseTreeNode *> *non_container_child_fields,
-      std::vector<std::string> *container_child_field_names,
-      std::vector<std::vector<const ParseTreeNode *>> *container_child_fields)
-      const override {
-    non_container_child_field_names->push_back("");
-    non_container_child_fields->push_back(priority_expression_.get());
-  }
-
- private:
-  std::unique_ptr<NumericParseLiteralValue> priority_expression_;
-
-  DISALLOW_COPY_AND_ASSIGN(ParsePriority);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_PARSER_PARSE_PRIORITY_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/parser/ParseSample.cpp
----------------------------------------------------------------------
diff --git a/parser/ParseSample.cpp b/parser/ParseSample.cpp
deleted file mode 100644
index 47e69e6..0000000
--- a/parser/ParseSample.cpp
+++ /dev/null
@@ -1,39 +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 "parser/ParseSample.hpp"
-
-#include <string>
-#include <vector>
-
-#include "parser/ParseLiteralValue.hpp"
-
-namespace quickstep {
-
-void ParseSample::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<const ParseTreeNode*> *non_container_child_fields,
-                                      std::vector<std::string> *container_child_field_names,
-                                      std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const {
-  non_container_child_field_names->push_back("Sample Percentage");
-  non_container_child_fields->push_back(percentage_.get());
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/parser/ParseSample.hpp
----------------------------------------------------------------------
diff --git a/parser/ParseSample.hpp b/parser/ParseSample.hpp
deleted file mode 100644
index e2b5672..0000000
--- a/parser/ParseSample.hpp
+++ /dev/null
@@ -1,105 +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_PARSER_PARSE_SAMPLE_HPP_
-#define QUICKSTEP_PARSER_PARSE_SAMPLE_HPP_
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "parser/ParseLiteralValue.hpp"
-#include "parser/ParseTreeNode.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-
-/** \addtogroup Parser
- *  @{
- */
-
-/**
- * @brief A parsed representation of block/tuple sample.
- */
-class ParseSample : public ParseTreeNode {
- public:
-  /**
-   * @brief Constructor.
-   * @note This constructor takes ownership of \c percentage.
-   *
-   * @param line_number The line number of "SAMPLE" in the SQL statement.
-   * @param column_number The column number of "SAMPLE" in the SQL statement.
-   * @param is_block_sample The flag indicating whether this is block sample or tuple sample.
-   * @param percentage The percentage of data to sample.
-   */
-  ParseSample(const int line_number,
-              const int column_number,
-              const bool is_block_sample,
-              NumericParseLiteralValue *percentage)
-      : ParseTreeNode(line_number, column_number),
-        percentage_(percentage),
-        is_block_sample_(is_block_sample) {}
-
-  /**
-   * @brief Destructor.
-   */
-  ~ParseSample() override {}
-
-  /**
-   * @brief Get the sample percentage.
-   *
-   * @return The sample percentage.
-   */
-  const NumericParseLiteralValue* percentage() const {
-    return percentage_.get();
-  }
-
-  /**
-   * @brief Get the sample type indicating flag.
-   *
-   * @return True if this is a block sample. False if this is a tuple sample.
-   */
-  bool is_block_sample() const {
-    return is_block_sample_;
-  }
-
-  std::string getName() const override {
-    return "SAMPLE";
-  }
-
- 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<const ParseTreeNode*> *non_container_child_fields,
-                           std::vector<std::string> *container_child_field_names,
-                           std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const override;
-
- private:
-  std::unique_ptr<NumericParseLiteralValue> percentage_;
-  const bool is_block_sample_;
-
-  DISALLOW_COPY_AND_ASSIGN(ParseSample);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_PARSER_PARSE_SAMPLE_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/parser/ParseSelect.hpp
----------------------------------------------------------------------
diff --git a/parser/ParseSelect.hpp b/parser/ParseSelect.hpp
deleted file mode 100644
index d6732e6..0000000
--- a/parser/ParseSelect.hpp
+++ /dev/null
@@ -1,235 +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_PARSER_PARSE_SELECT_HPP_
-#define QUICKSTEP_PARSER_PARSE_SELECT_HPP_
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "parser/ParseGroupBy.hpp"
-#include "parser/ParseHaving.hpp"
-#include "parser/ParseLimit.hpp"
-#include "parser/ParseOrderBy.hpp"
-#include "parser/ParsePredicate.hpp"
-#include "parser/ParseSelectionClause.hpp"
-#include "parser/ParseTableReference.hpp"
-#include "parser/ParseTreeNode.hpp"
-#include "parser/ParseWindow.hpp"
-#include "utility/Macros.hpp"
-#include "utility/PtrList.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-/**
- * @brief The parsed representation of a (sub-query) SELECT statement.
- **/
-class ParseSelect : public ParseTreeNode {
- public:
-  /**
-   * @brief Constructor.
-   * @note Takes ownership of all pointers.
-   *
-   * @param line_number Line number of the first token of this node in the SQL statement.
-   * @param column_number Column number of the first token of this node in the SQL statement.
-   * @param selection The parsed selection, which becomes owned by this
-   *        ParseStatementSelect.
-   * @param from_list The parsed list of table references in the FROM clause,
-   *        which becomes owned by this ParseStatementSelect.
-   * @param where_predicate An optional predicate representing the parsed
-   *        WHERE clause (may be NULL if no predicate). Becomes owned by this
-   *        ParseStatementSelect if non-NULL.
-   * @param group_by Optional parsed GROUP BY clause. Becomes owned by this ParseStatementSelect.
-   * @param having_predicate Optional parsed HAVING clause. Becomes owned by this ParseStatementSelect.
-   * @param order_by Optional parsed ORDER BY clause. Becomes owned by this ParseStatementSelect.
-   * @param limit Optional parsed LIMIT clause. Becomes owned by this ParseStatementSelect.
-   **/
-  ParseSelect(const int line_number,
-              const int column_number,
-              ParseSelectionClause *selection,
-              PtrList<ParseTableReference> *from_list,
-              ParsePredicate *where_predicate,
-              ParseGroupBy *group_by,
-              ParseHaving *having,
-              ParseOrderBy *order_by,
-              ParseLimit *limit,
-              PtrList<ParseWindow> *window_list)
-      : ParseTreeNode(line_number, column_number),
-        selection_(selection),
-        from_list_(from_list),
-        where_predicate_(where_predicate),
-        group_by_(group_by),
-        having_(having),
-        order_by_(order_by),
-        limit_(limit),
-        window_list_(window_list) {
-  }
-
-  ~ParseSelect() override {
-  }
-
-  std::string getName() const override {
-    return "Select";
-  }
-
-  /**
-   * @brief Gets the selection.
-   *
-   * @return The selection.
-   **/
-  const ParseSelectionClause& selection() const {
-    return *selection_;
-  }
-
-  /**
-   * @brief Gets the FROM list.
-   *
-   * @return The list of table references in the FROM clause.
-   **/
-  const PtrList<ParseTableReference>& from_list() const {
-    return *from_list_;
-  }
-
-  /**
-   * @brief Determines whether this select statement has a WHERE predicate.
-   *
-   * @return Whether there is a WHERE predicate in this statement.
-   **/
-  bool hasWherePredicate() const {
-    return where_predicate_.get() != nullptr;
-  }
-
-  /**
-   * @brief Gets the WHERE predicate.
-   * @warning Always call hasWherePredicate() first.
-   *
-   * @return The parsed WHERE predicate.
-   **/
-  const ParsePredicate& where_predicate() const {
-    DCHECK(hasWherePredicate());
-    return *where_predicate_;
-  }
-
-  /**
-   * @brief Gets the parsed GROUP BY.
-   *
-   * @return The parsed GROUP BY.
-   */
-  const ParseGroupBy* group_by() const { return group_by_.get(); }
-
-  /**
-   * @brief Gets the parsed HAVING.
-   *
-   * @return The parsed HAVNING.
-   */
-  const ParseHaving* having() const { return having_.get(); }
-
-  /**
-   * @brief Gets the parsed ORDER BY.
-   *
-   * @return The parsed ORDER BY.
-   */
-  const ParseOrderBy* order_by() const { return order_by_.get(); }
-
-  /**
-   * @brief Gets the parsed LIMIT.
-   *
-   * @return The parsed LIMIT.
-   */
-  const ParseLimit* limit() const { return limit_.get(); }
-
-  /**
-   * @brief Gets the parsed WINDOW.
-   *
-   * @return The parsed WINDOW.
-   */
-  const PtrList<ParseWindow>* window_list() const { return window_list_.get(); }
-
- 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<const ParseTreeNode*> *non_container_child_fields,
-      std::vector<std::string> *container_child_field_names,
-      std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const override {
-    non_container_child_field_names->push_back("select_clause");
-    non_container_child_fields->push_back(selection_.get());
-
-    if (where_predicate_ != nullptr) {
-      non_container_child_field_names->push_back("where_clause");
-      non_container_child_fields->push_back(where_predicate_.get());
-    }
-
-    if (from_list_ != nullptr) {
-      container_child_field_names->push_back("from_clause");
-      container_child_fields->emplace_back();
-      for (const ParseTableReference &from_item : *from_list_) {
-        container_child_fields->back().push_back(&from_item);
-      }
-    }
-
-    if (group_by_ != nullptr) {
-      non_container_child_field_names->push_back("group_by");
-      non_container_child_fields->push_back(group_by_.get());
-    }
-
-    if (having_ != nullptr) {
-      non_container_child_field_names->push_back("having");
-      non_container_child_fields->push_back(having_.get());
-    }
-
-    if (order_by_ != nullptr) {
-      non_container_child_field_names->push_back("order_by");
-      non_container_child_fields->push_back(order_by_.get());
-    }
-
-    if (limit_ != nullptr) {
-      non_container_child_field_names->push_back("limit");
-      non_container_child_fields->push_back(limit_.get());
-    }
-
-    if (window_list_ != nullptr) {
-      container_child_field_names->push_back("window_list");
-      container_child_fields->emplace_back();
-      for (const ParseWindow &window : *window_list_) {
-        container_child_fields->back().push_back(&window);
-      }
-    }
-  }
-
- private:
-  std::unique_ptr<ParseSelectionClause> selection_;
-  std::unique_ptr<PtrList<ParseTableReference> > from_list_;
-  std::unique_ptr<ParsePredicate> where_predicate_;
-  std::unique_ptr<ParseGroupBy> group_by_;
-  std::unique_ptr<ParseHaving> having_;
-  std::unique_ptr<ParseOrderBy> order_by_;
-  std::unique_ptr<ParseLimit> limit_;
-  std::unique_ptr<PtrList<ParseWindow>> window_list_;
-
-  DISALLOW_COPY_AND_ASSIGN(ParseSelect);
-};
-
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_PARSER_PARSESELECT_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/parser/ParseSelectionClause.cpp
----------------------------------------------------------------------
diff --git a/parser/ParseSelectionClause.cpp b/parser/ParseSelectionClause.cpp
deleted file mode 100644
index 1e9a807..0000000
--- a/parser/ParseSelectionClause.cpp
+++ /dev/null
@@ -1,60 +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 "parser/ParseSelectionClause.hpp"
-
-#include <string>
-#include <vector>
-
-#include "parser/ParseExpression.hpp"
-#include "parser/ParseString.hpp"
-
-namespace quickstep {
-
-void ParseSelectionItem::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<const ParseTreeNode*> *non_container_child_fields,
-    std::vector<std::string> *container_child_field_names,
-    std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const {
-  if (alias_ != nullptr) {
-    inline_field_names->push_back("alias");
-    inline_field_values->push_back(alias_->value());
-  }
-
-  non_container_child_field_names->push_back("");
-  non_container_child_fields->push_back(expression_.get());
-}
-
-void ParseSelectionList::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<const ParseTreeNode*> *non_container_child_fields,
-    std::vector<std::string> *container_child_field_names,
-    std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const {
-  container_child_field_names->push_back("");
-  container_child_fields->emplace_back();
-  for (const ParseSelectionItem& select_item : select_item_list_) {
-    container_child_fields->back().push_back(&select_item);
-  }
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/parser/ParseSelectionClause.hpp
----------------------------------------------------------------------
diff --git a/parser/ParseSelectionClause.hpp b/parser/ParseSelectionClause.hpp
deleted file mode 100644
index f636f36..0000000
--- a/parser/ParseSelectionClause.hpp
+++ /dev/null
@@ -1,219 +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_PARSER_PARSE_SELECTION_CLAUSE_HPP_
-#define QUICKSTEP_PARSER_PARSE_SELECTION_CLAUSE_HPP_
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "parser/ParseExpression.hpp"
-#include "parser/ParseString.hpp"
-#include "parser/ParseTreeNode.hpp"
-#include "utility/Macros.hpp"
-#include "utility/PtrList.hpp"
-
-namespace quickstep {
-
-class ParseSelectionItem;
-
-/** \addtogroup Parser
- *  @{
- */
-
-/**
- * @brief The complete selection in a SELECT statement.
- **/
-class ParseSelectionClause : public ParseTreeNode {
- public:
-  /**
-   * @brief The type of a SELECT clause.
-   */
-  enum SelectionType {
-    kStar,     //!< kStar Represents a SELECT clause with * as its only SELECT-list item.
-    kNonStar,  //!< kNonStar Represents a SELECT clause with expressions.
-  };
-
-  /**
-   * @return The type of this SELECT clause.
-   */
-  virtual SelectionType getSelectionType() const = 0;
-
- protected:
-  ParseSelectionClause(const int line_number, const int column_number)
-      : ParseTreeNode(line_number, column_number) {
-  }
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(ParseSelectionClause);
-};
-
-/**
- * @brief A "star" (*) selection, representing all attributes from all
- *        relations in the FROM list.
- **/
-class ParseSelectionStar : public ParseSelectionClause {
- public:
-  /**
-   * @brief Constructor.
-   *
-   * @param line_number The line number of "*" in the SQL statement string.
-   * @param column_number The column number of "*" in the SQL statement string.
-   */
-  ParseSelectionStar(const int line_number, const int column_number)
-      : ParseSelectionClause(line_number, column_number) {
-  }
-
-  SelectionType getSelectionType() const override {
-    return kStar;
-  }
-
-  std::string getName() const override { return "SelectStar"; }
-
- 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<const ParseTreeNode*> *non_container_child_fields,
-      std::vector<std::string> *container_child_field_names,
-      std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const override {}
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(ParseSelectionStar);
-};
-
-/**
- * @brief A list of comma-seperated ParseSelectionItems.
- **/
-class ParseSelectionList : public ParseSelectionClause {
- public:
-  /**
-   * @brief Constructor.
-   *
-   * @param line_number The line number of the first token of the SELECT list in the SQL statement string.
-   * @param column_number The column number of the first token of the SELECT list in the SQL statement string.
-   */
-  ParseSelectionList(const int line_number, const int column_number)
-      : ParseSelectionClause(line_number, column_number) {
-  }
-
-  SelectionType getSelectionType() const override {
-    return kNonStar;
-  }
-
-  std::string getName() const override { return "SelectList"; }
-
-  /**
-   * @return The list of SELECT-list items.
-   */
-  const PtrList<ParseSelectionItem>& select_item_list() const { return select_item_list_; }
-
-  /**
-   * @brief Append an item to the selection list.
-   *
-   * @param item The selection item to add to the end of this selection list,
-   *        which becomes owned by this ParseSelectionList.
-   **/
-  void add(ParseSelectionItem *item) {
-    select_item_list_.push_back(item);
-  }
-
- 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<const ParseTreeNode*> *non_container_child_fields,
-      std::vector<std::string> *container_child_field_names,
-      std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const override;
-
- private:
-  PtrList<ParseSelectionItem> select_item_list_;
-
-  DISALLOW_COPY_AND_ASSIGN(ParseSelectionList);
-};
-
-/**
- * @brief A SELECT-list item that consists of an expression and optionally an alias.
- */
-class ParseSelectionItem : public ParseTreeNode {
- public:
-  /**
-   * @brief Constructor.
-   *
-   * @param line_number The line number of the first token of this item in the SQL statement string.
-   * @param column_number The column number of the first token of this item in the SQL statement string.
-   * @param expression The SELECT-list expression.
-   * @param alias The expression alias name.
-   */
-  ParseSelectionItem(const int line_number,
-                     const int column_number,
-                     ParseExpression *expression,
-                     ParseString *alias = nullptr)
-     : ParseTreeNode(line_number, column_number),
-       expression_(expression),
-       alias_(alias) {}
-
-  /**
-   * @brief Destructor.
-   */
-  ~ParseSelectionItem() override {}
-
-  std::string getName() const override { return "SelectListItem"; }
-
-  /**
-   * @return The SELECT-list expression.
-   */
-  const ParseExpression* expression() const { return expression_.get(); }
-
-  /**
-   * @return The alias of the SELECT-list expression.
-   */
-  const ParseString* alias() const { return alias_.get(); }
-
-  /**
-   * @return Generates a human-readable name for the current expression.
-   */
-  std::string generateName() const {
-    return expression_->generateName();
-  }
-
- 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<const ParseTreeNode*> *non_container_child_fields,
-        std::vector<std::string> *container_child_field_names,
-        std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const override;
-
- private:
-  std::unique_ptr<ParseExpression> expression_;
-  std::unique_ptr<ParseString> alias_;
-
-  DISALLOW_COPY_AND_ASSIGN(ParseSelectionItem);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_PARSER_PARSE_SELECTION_CLAUSE_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/parser/ParseSimpleTableReference.cpp
----------------------------------------------------------------------
diff --git a/parser/ParseSimpleTableReference.cpp b/parser/ParseSimpleTableReference.cpp
deleted file mode 100644
index 518dc20..0000000
--- a/parser/ParseSimpleTableReference.cpp
+++ /dev/null
@@ -1,53 +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 "parser/ParseSimpleTableReference.hpp"
-
-#include <string>
-#include <vector>
-
-#include "parser/ParseSample.hpp"
-#include "parser/ParseTableReference.hpp"
-
-namespace quickstep {
-
-class ParseTreeNode;
-
-void ParseSimpleTableReference::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<const ParseTreeNode*> *non_container_child_fields,
-    std::vector<std::string> *container_child_field_names,
-    std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const {
-  ParseTableReference::getFieldStringItems(inline_field_names,
-                                           inline_field_values,
-                                           non_container_child_field_names,
-                                           non_container_child_fields,
-                                           container_child_field_names,
-                                           container_child_fields);
-  inline_field_names->push_back("table");
-  inline_field_values->push_back(table_name_->value());
-  if (sample_ != nullptr) {
-    non_container_child_field_names->push_back("sample");
-    non_container_child_fields->push_back(sample_.get());
-  }
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/parser/ParseSimpleTableReference.hpp
----------------------------------------------------------------------
diff --git a/parser/ParseSimpleTableReference.hpp b/parser/ParseSimpleTableReference.hpp
deleted file mode 100644
index 4ff92a5..0000000
--- a/parser/ParseSimpleTableReference.hpp
+++ /dev/null
@@ -1,102 +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_PARSER_PARSE_SIMPLE_TABLE_REFERENCE_HPP_
-#define QUICKSTEP_PARSER_PARSE_SIMPLE_TABLE_REFERENCE_HPP_
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "parser/ParseSample.hpp"
-#include "parser/ParseString.hpp"
-#include "parser/ParseTableReference.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-
-class ParseTreeNode;
-
-/** \addtogroup Parser
- *  @{
- */
-
-/**
- * @brief A FROM-list table reference by relation name.
- */
-class ParseSimpleTableReference : public ParseTableReference {
- public:
-  /**
-   * @brief Constructor.
-   * @note Takes ownership of \p table_name and \p sample.
-   *
-   * @param line_number The line number of the first token of the table reference.
-   * @param column_number The column number of the first token of the table reference.
-   * @param table_name The table name.
-   * @param sample The sampling type and percentage associated with the table reference.
-   */
-  ParseSimpleTableReference(const int line_number,
-                            const int column_number,
-                            ParseString *table_name,
-                            ParseSample *sample)
-      : ParseTableReference(line_number, column_number),
-        table_name_(table_name),
-        sample_(sample) {}
-
-  /**
-   * @brief Destructor.
-   */
-  ~ParseSimpleTableReference() override {}
-
-  TableReferenceType getTableReferenceType() const override {
-    return kSimpleTableReference;
-  }
-
-  std::string getName() const override { return "TableReference"; }
-
-  /**
-   * @return The table name.
-   */
-  const ParseString* table_name() const { return table_name_.get(); }
-
-  /**
-   * @return The sample type and percentage.
-   */
-  const ParseSample* sample() const { return sample_.get(); }
-
- 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<const ParseTreeNode*> *non_container_child_fields,
-      std::vector<std::string> *container_child_field_names,
-      std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const override;
-
- private:
-  std::unique_ptr<ParseString> table_name_;
-  std::unique_ptr<ParseSample> sample_;
-  DISALLOW_COPY_AND_ASSIGN(ParseSimpleTableReference);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_PARSER_PARSE_SIMPLE_TABLE_REFERENCE_HPP_


[04/51] [abbrv] [partial] incubator-quickstep git commit: remove c++ files

Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/physical/TableReference.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/physical/TableReference.cpp b/query_optimizer/physical/TableReference.cpp
deleted file mode 100644
index bfd6464..0000000
--- a/query_optimizer/physical/TableReference.cpp
+++ /dev/null
@@ -1,56 +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/physical/TableReference.hpp"
-
-#include <string>
-#include <vector>
-
-#include "catalog/CatalogRelation.hpp"
-#include "query_optimizer/OptimizerTree.hpp"
-#include "utility/Cast.hpp"
-
-namespace quickstep {
-namespace optimizer {
-namespace physical {
-
-namespace E = ::quickstep::optimizer::expressions;
-
-void TableReference::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("relation");
-  inline_field_values->push_back(relation_->getName());
-
-  if (alias_ != relation_->getName()) {
-    inline_field_names->push_back("alias");
-    inline_field_values->push_back(alias_);
-  }
-
-  container_child_field_names->push_back("");
-  container_child_fields->push_back(CastSharedPtrVector<OptimizerTreeBase>(attribute_list_));
-}
-
-}  // namespace physical
-}  // namespace optimizer
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/physical/TableReference.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/physical/TableReference.hpp b/query_optimizer/physical/TableReference.hpp
deleted file mode 100644
index 638d73b..0000000
--- a/query_optimizer/physical/TableReference.hpp
+++ /dev/null
@@ -1,138 +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_PHYSICAL_TABLE_REFERENCE_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_PHYSICAL_TABLE_REFERENCE_HPP_
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "query_optimizer/expressions/ExpressionUtil.hpp"
-#include "query_optimizer/expressions/NamedExpression.hpp"
-#include "query_optimizer/physical/Physical.hpp"
-#include "query_optimizer/physical/PhysicalType.hpp"
-#include "utility/Macros.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-class CatalogRelation;
-
-namespace optimizer {
-namespace physical {
-
-/** \addtogroup OptimizerPhysical
- *  @{
- */
-
-class TableReference;
-typedef std::shared_ptr<const TableReference> TableReferencePtr;
-
-/**
- * @brief Leaf physical node that represents a reference to a catalog relation.
- */
-class TableReference : public Physical {
- public:
-  PhysicalType getPhysicalType() const override { return PhysicalType::kTableReference; }
-
-  std::string getName() const override { return "TableReference"; }
-
-  /**
-   * @return The input catalog relation.
-   */
-  const CatalogRelation* relation() const { return relation_; }
-
-  /**
-   * @return The list of references to the relation attributes.
-   */
-  const std::vector<expressions::AttributeReferencePtr>& attribute_list() const {
-    return attribute_list_;
-  }
-
-  PhysicalPtr copyWithNewChildren(
-      const std::vector<PhysicalPtr> &new_children) const override {
-    DCHECK_EQ(new_children.size(), children().size());
-    return TableReferencePtr(new TableReference(relation_, alias_, attribute_list_));
-  }
-
-  std::vector<expressions::AttributeReferencePtr> getOutputAttributes() const override {
-    return attribute_list_;
-  }
-
-  std::vector<expressions::AttributeReferencePtr> getReferencedAttributes() const override {
-    return {};
-  }
-
-  bool maybeCopyWithPrunedExpressions(
-      const expressions::UnorderedNamedExpressionSet &referenced_expressions,
-      PhysicalPtr *output) const override {
-    // The project attributes cannot be changed in a TableReference.
-    return false;
-  }
-
-  /**
-   * @brief Creates a TableReference.
-   *
-   * @param relation The referenced catalog relation.
-   * @param alias The relation alias in the query. It is used only for printing.
-   * @param attribute_list The list of AttributeReferences of the relation.
-   * @return An immutable TableReference.
-   */
-  static TableReferencePtr Create(
-      const CatalogRelation *relation,
-      const std::string &alias,
-      const std::vector<expressions::AttributeReferencePtr> &attribute_list) {
-    return TableReferencePtr(new TableReference(relation, alias, attribute_list));
-  }
-
- 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:
-  TableReference(
-      const CatalogRelation *relation, const std::string &alias,
-      const std::vector<expressions::AttributeReferencePtr> &attribute_list)
-      : relation_(relation),
-        alias_(alias),
-        attribute_list_(attribute_list) {}
-
-  const CatalogRelation *relation_;
-  std::string alias_;
-  std::vector<expressions::AttributeReferencePtr> attribute_list_;
-
-  DISALLOW_COPY_AND_ASSIGN(TableReference);
-};
-
-/** @} */
-
-}  // namespace physical
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_QUERY_OPTIMIZER_PHYSICAL_TABLE_REFERENCE_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/physical/TopLevelPlan.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/physical/TopLevelPlan.cpp b/query_optimizer/physical/TopLevelPlan.cpp
deleted file mode 100644
index 6c80a35..0000000
--- a/query_optimizer/physical/TopLevelPlan.cpp
+++ /dev/null
@@ -1,57 +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/physical/TopLevelPlan.hpp"
-
-#include <string>
-#include <vector>
-
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/physical/Physical.hpp"
-#include "utility/Cast.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-namespace optimizer {
-namespace physical {
-
-void TopLevelPlan::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("plan");
-  non_container_child_fields->push_back(plan_);
-
-  if (!shared_subplans_.empty()) {
-    container_child_field_names->push_back("shared_subplans");
-    container_child_fields->push_back(CastSharedPtrVector<OptimizerTreeBase>(shared_subplans_));
-  }
-
-  container_child_field_names->push_back("output_attributes");
-  container_child_fields->push_back(
-      CastSharedPtrVector<OptimizerTreeBase>(plan_->getOutputAttributes()));
-}
-
-}  // namespace physical
-}  // namespace optimizer
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/physical/TopLevelPlan.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/physical/TopLevelPlan.hpp b/query_optimizer/physical/TopLevelPlan.hpp
deleted file mode 100644
index 7dfc2b6..0000000
--- a/query_optimizer/physical/TopLevelPlan.hpp
+++ /dev/null
@@ -1,209 +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_PHYSICAL_TOP_LEVEL_PLAN_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_PHYSICAL_TOP_LEVEL_PLAN_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/ExpressionUtil.hpp"
-#include "query_optimizer/physical/LIPFilterConfiguration.hpp"
-#include "query_optimizer/physical/Physical.hpp"
-#include "query_optimizer/physical/PhysicalType.hpp"
-#include "utility/Macros.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-namespace optimizer {
-namespace physical {
-
-/** \addtogroup OptimizerPhysical
- *  @{
- */
-
-class TopLevelPlan;
-typedef std::shared_ptr<const TopLevelPlan> TopLevelPlanPtr;
-
-/**
- * @brief Root node of a physical plan tree. It contains the complete plan for
- *        a query and shared subplans referenced used in multiple places in
- *        the query plan.
- */
-class TopLevelPlan : public Physical {
- public:
-  PhysicalType getPhysicalType() const override {
-    return PhysicalType::kTopLevelPlan;
-  }
-
-  std::string getName() const override { return "TopLevelPlan"; }
-
-  /**
-   * @return The complete query plan.
-   */
-  const PhysicalPtr& plan() const { return plan_; }
-
-  /**
-   * @return The vector of the shared subplans.
-   */
-  const std::vector<PhysicalPtr>& shared_subplans() const {
-    return shared_subplans_;
-  }
-
-  /**
-   * @return Map from the expression ID of an attribute reference to the
-   *         uncorrelated subquery that produces the attribute.
-   */
-  const std::unordered_map<expressions::ExprId, int>& uncorrelated_subquery_map() const {
-    return uncorrelated_subquery_map_;
-  }
-
-  /**
-   * @brief Gets a shared subquery given by the position.
-   *
-   * @param index The position of the shared subplan to be returned.
-   * @return The shared subplan at the index \p index in <shared_subplans_>.
-   */
-  const PhysicalPtr& shared_subplan_at(int index) const {
-    return shared_subplans_[index];
-  }
-
-  /**
-   * @brief Creates a copy of the TopLevelPlan with lip_filter_configuration_
-   *        replaced by \p new_lip_filter_configuration.
-   *
-   * @param new_lip_filter_configuration The new lip_filter_configuration to be
-   *        substituted for the existing one.
-   * @return A copy of this TopLevelPlan with the new lip_filter_configuration.
-   */
-  TopLevelPlanPtr copyWithLIPFilterConfiguration(
-      const LIPFilterConfigurationPtr &new_lip_filter_configuration) const {
-    return TopLevelPlan::Create(plan_,
-                                shared_subplans_,
-                                uncorrelated_subquery_map_,
-                                new_lip_filter_configuration);
-  }
-
-  /**
-   * @return The LIPFilter configuration information for the overall query plan.
-   */
-  const LIPFilterConfigurationPtr& lip_filter_configuration() const {
-    return lip_filter_configuration_;
-  }
-
-  PhysicalPtr copyWithNewChildren(
-      const std::vector<PhysicalPtr> &new_children) const override {
-    DCHECK_EQ(getNumChildren(), new_children.size());
-    // The first child in the new_children is the main plan, and the remaining
-    // children are shared subplans referenced in the main plan.
-    std::vector<PhysicalPtr> new_shared_subplans;
-    if (new_children.size() > 1u) {
-      new_shared_subplans.insert(new_shared_subplans.end(),
-                                 ++new_children.begin(),
-                                 new_children.end());
-    }
-    return TopLevelPlan::Create(new_children[0],
-                                new_shared_subplans,
-                                uncorrelated_subquery_map_);
-  }
-
-  std::vector<expressions::AttributeReferencePtr> getOutputAttributes() const override {
-    return plan()->getOutputAttributes();
-  }
-
-  std::vector<expressions::AttributeReferencePtr> getReferencedAttributes() const override {
-    return {};
-  }
-
-  bool maybeCopyWithPrunedExpressions(
-      const expressions::UnorderedNamedExpressionSet &referenced_expressions,
-      PhysicalPtr *output) const override {
-    // TopLevelPlan does not have any project expressions.
-    return false;
-  }
-
-  /**
-   * @brief Creates a TopLevelPlan.
-   *
-   * @param plan The query plan.
-   * @param shared_subplans The subplans referenced in the main input plan.
-   * @param uncorrelated_subquery_map Map from the expression ID of an attribute
-   *        reference to the uncorrelated subquery that produces the attribute.
-   * @param lip_filter_configuration The LIPFilter configuration information
-   *        for the overall query plan.
-   * @return An immutable TopLevelPlan.
-   */
-  static TopLevelPlanPtr Create(
-      const PhysicalPtr &plan,
-      const std::vector<PhysicalPtr> &shared_subplans = {},
-      const std::unordered_map<expressions::ExprId, int> &uncorrelated_subquery_map
-          = std::unordered_map<expressions::ExprId, int>(),
-      const LIPFilterConfigurationPtr &lip_filter_configuration = nullptr) {
-    return TopLevelPlanPtr(new TopLevelPlan(plan,
-                                            shared_subplans,
-                                            uncorrelated_subquery_map,
-                                            lip_filter_configuration));
-  }
-
- 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:
-  TopLevelPlan(const PhysicalPtr &plan,
-               const std::vector<PhysicalPtr> &shared_subplans,
-               const std::unordered_map<expressions::ExprId, int> &uncorrelated_subquery_map,
-               const LIPFilterConfigurationPtr &lip_filter_configuration)
-      : plan_(plan),
-        shared_subplans_(shared_subplans),
-        uncorrelated_subquery_map_(uncorrelated_subquery_map),
-        lip_filter_configuration_(lip_filter_configuration) {
-    addChild(plan);
-    for (const PhysicalPtr &shared_subplan : shared_subplans) {
-      addChild(shared_subplan);
-    }
-  }
-
-  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_;
-
-  DISALLOW_COPY_AND_ASSIGN(TopLevelPlan);
-};
-
-/** @} */
-
-}  // namespace physical
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif /* QUERY_PLANNER_PHYSICAL_TOPLEVEL_PLAN_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/physical/UpdateTable.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/physical/UpdateTable.cpp b/query_optimizer/physical/UpdateTable.cpp
deleted file mode 100644
index 0c42543..0000000
--- a/query_optimizer/physical/UpdateTable.cpp
+++ /dev/null
@@ -1,77 +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/physical/UpdateTable.hpp"
-
-#include <string>
-#include <vector>
-
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "query_optimizer/expressions/Predicate.hpp"
-#include "query_optimizer/expressions/Scalar.hpp"
-#include "utility/Cast.hpp"
-
-namespace quickstep {
-namespace optimizer {
-namespace physical {
-
-std::vector<expressions::AttributeReferencePtr> UpdateTable::getReferencedAttributes() const {
-  std::vector<expressions::AttributeReferencePtr> referenced_attributes = assignees_;
-  for (const expressions::ScalarPtr& assignment_expression : assignment_expressions_) {
-    std::vector<expressions::AttributeReferencePtr> attrs_referenced_in_expression =
-        assignment_expression->getReferencedAttributes();
-    referenced_attributes.insert(referenced_attributes.end(),
-                                 attrs_referenced_in_expression.begin(),
-                                 attrs_referenced_in_expression.end());
-  }
-  if (predicate_ != nullptr) {
-    std::vector<expressions::AttributeReferencePtr> attrs_referenced_in_predicate =
-        predicate_->getReferencedAttributes();
-    referenced_attributes.insert(referenced_attributes.end(),
-                                 attrs_referenced_in_predicate.begin(),
-                                 attrs_referenced_in_predicate.end());
-  }
-  return referenced_attributes;
-}
-
-void UpdateTable::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("input");
-  non_container_child_fields->push_back(input_);
-  if (predicate_ != nullptr) {
-    non_container_child_field_names->push_back("predicate");
-    non_container_child_fields->push_back(predicate_);
-  }
-
-  container_child_field_names->push_back("attributes");
-  container_child_fields->push_back(CastSharedPtrVector<OptimizerTreeBase>(assignees_));
-  container_child_field_names->push_back("assigned_values");
-  container_child_fields->push_back(
-      CastSharedPtrVector<OptimizerTreeBase>(assignment_expressions_));
-}
-
-}  // namespace physical
-}  // namespace optimizer
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/physical/UpdateTable.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/physical/UpdateTable.hpp b/query_optimizer/physical/UpdateTable.hpp
deleted file mode 100644
index 1c93e17..0000000
--- a/query_optimizer/physical/UpdateTable.hpp
+++ /dev/null
@@ -1,162 +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_PHYSICAL_UPDATETABLE_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_PHYSICAL_UPDATETABLE_HPP_
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "query_optimizer/expressions/ExpressionUtil.hpp"
-#include "query_optimizer/expressions/NamedExpression.hpp"
-#include "query_optimizer/expressions/Predicate.hpp"
-#include "query_optimizer/expressions/Scalar.hpp"
-#include "query_optimizer/physical/Physical.hpp"
-#include "query_optimizer/physical/PhysicalType.hpp"
-#include "utility/Macros.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-namespace optimizer {
-namespace physical {
-
-/** \addtogroup OptimizerPhysical
- *  @{
- */
-
-class UpdateTable;
-typedef std::shared_ptr<const UpdateTable> UpdateTablePtr;
-
-/**
- * @brief Updates a relation with new assignments to some tuples.
- */
-class UpdateTable : public Physical {
- public:
-  PhysicalType getPhysicalType() const override {
-    return PhysicalType::kUpdateTable;
-  }
-
-  std::string getName() const override { return "UpdateTable"; }
-
-  /**
-   * @return The logical node that creates the table to be updated.
-   */
-  const PhysicalPtr& input() const { return input_; }
-
-  /**
-   * @return The attributes to be assigned values to.
-   */
-  const std::vector<expressions::AttributeReferencePtr>& assignees() const {
-    return assignees_;
-  }
-
-  /**
-   * @return The expressions for which the values are assigned.
-   */
-  const std::vector<expressions::ScalarPtr>& assignment_expressions() const {
-    return assignment_expressions_;
-  }
-
-  /**
-   * @return The predicate to select tuples to be updated.
-   */
-  const expressions::PredicatePtr& predicate() const { return predicate_; }
-
-  PhysicalPtr copyWithNewChildren(
-      const std::vector<PhysicalPtr> &new_children) const override {
-    DCHECK_EQ(getNumChildren(), new_children.size());
-    return Create(new_children[0], assignees_, assignment_expressions_,
-                  predicate_);
-  }
-
-  std::vector<expressions::AttributeReferencePtr> getOutputAttributes() const override {
-    return std::vector<expressions::AttributeReferencePtr>();
-  }
-
-  std::vector<expressions::AttributeReferencePtr> getReferencedAttributes() const override;
-
-  bool maybeCopyWithPrunedExpressions(
-      const expressions::UnorderedNamedExpressionSet &referenced_expressions,
-      PhysicalPtr *output) const override {
-    return false;
-  }
-
-  /**
-   * @brief Creates an UpdateTable physical node that represents an operation to
-   *        update a table with given assignments.
-   *
-   * @param input The input gives the table to be updated.
-   * @param assignees The attribute list to assign values to.
-   * @param assignment_expressions The expressions that gives the values to be
-   *                               assigned.
-   * @param predicate The predicate to select tuples to be updated.
-   * @return An immutable UpdateTable node.
-   */
-  static UpdateTablePtr Create(
-      const PhysicalPtr &input,
-      const std::vector<expressions::AttributeReferencePtr> &assignees,
-      const std::vector<expressions::ScalarPtr> &assignment_expressions,
-      const expressions::PredicatePtr &predicate) {
-    return UpdateTablePtr(
-        new UpdateTable(input, assignees, assignment_expressions, predicate));
-  }
-
- 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:
-  UpdateTable(const PhysicalPtr &input,
-              const std::vector<expressions::AttributeReferencePtr> &assignees,
-              const std::vector<expressions::ScalarPtr> &assignment_expressions,
-              const expressions::PredicatePtr &predicate)
-      : input_(input),
-        assignees_(assignees),
-        assignment_expressions_(assignment_expressions),
-        predicate_(predicate) {
-    addChild(input);
-  }
-
-  PhysicalPtr input_;
-  // The attributes to be assigned values to.
-  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_;
-
-  DISALLOW_COPY_AND_ASSIGN(UpdateTable);
-};
-
-/** @} */
-
-}  // namespace physical
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_QUERY_OPTIMIZER_PHYSICAL_UPDATETABLE_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/physical/WindowAggregate.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/physical/WindowAggregate.cpp b/query_optimizer/physical/WindowAggregate.cpp
deleted file mode 100644
index f035ee3..0000000
--- a/query_optimizer/physical/WindowAggregate.cpp
+++ /dev/null
@@ -1,66 +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/physical/WindowAggregate.hpp"
-
-#include <string>
-#include <vector>
-
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "query_optimizer/expressions/ExpressionUtil.hpp"
-#include "query_optimizer/expressions/NamedExpression.hpp"
-#include "query_optimizer/expressions/Predicate.hpp"
-#include "utility/Cast.hpp"
-
-namespace quickstep {
-namespace optimizer {
-namespace physical {
-
-namespace E = ::quickstep::optimizer::expressions;
-
-std::vector<E::AttributeReferencePtr> WindowAggregate::getOutputAttributes() const {
-  std::vector<E::AttributeReferencePtr> output_attributes(
-      input_->getOutputAttributes());
-  output_attributes.push_back(E::ToRef(window_aggregate_expression_));
-  return output_attributes;
-}
-
-std::vector<E::AttributeReferencePtr> WindowAggregate::getReferencedAttributes()
-    const {
-  return window_aggregate_expression_->getReferencedAttributes();
-}
-
-void WindowAggregate::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("input");
-  non_container_child_fields->push_back(input_);
-
-  non_container_child_field_names->push_back("window_aggregate_expression");
-  non_container_child_fields->push_back(window_aggregate_expression_);
-}
-
-}  // namespace physical
-}  // namespace optimizer
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/physical/WindowAggregate.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/physical/WindowAggregate.hpp b/query_optimizer/physical/WindowAggregate.hpp
deleted file mode 100644
index 06eaf63..0000000
--- a/query_optimizer/physical/WindowAggregate.hpp
+++ /dev/null
@@ -1,133 +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_PHYSICAL_WINDOW_AGGREGATE_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_PHYSICAL_WINDOW_AGGREGATE_HPP_
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/Alias.hpp"
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "query_optimizer/expressions/ExpressionUtil.hpp"
-#include "query_optimizer/expressions/NamedExpression.hpp"
-#include "query_optimizer/physical/Physical.hpp"
-#include "query_optimizer/physical/PhysicalType.hpp"
-#include "utility/Macros.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-namespace optimizer {
-namespace physical {
-
-/** \addtogroup OptimizerLogical
- *  @{
- */
-
-class WindowAggregate;
-typedef std::shared_ptr<const WindowAggregate> WindowAggregatePtr;
-
-/**
- * @brief Window Aggregate operator that computes window aggregate expressions.
- */
-class WindowAggregate : public Physical {
- public:
-  PhysicalType getPhysicalType() const override {
-    return PhysicalType::kWindowAggregate;
-  }
-
-  std::string getName() const override { return "WindowAggregate"; }
-
-  /**
-   * @return The input physical node.
-   */
-  const PhysicalPtr input() const { return input_; }
-
-  /**
-   * @return Window aggregate expression.
-   */
-  inline const expressions::AliasPtr window_aggregate_expression() const {
-    return window_aggregate_expression_;
-  }
-
-  PhysicalPtr copyWithNewChildren(
-      const std::vector<PhysicalPtr> &new_children) const override {
-    DCHECK_EQ(getNumChildren(), new_children.size());
-    return Create(new_children[0], window_aggregate_expression_);
-  }
-
-  std::vector<expressions::AttributeReferencePtr> getOutputAttributes() const override;
-
-  std::vector<expressions::AttributeReferencePtr> getReferencedAttributes() const override;
-
-  bool maybeCopyWithPrunedExpressions(
-      const expressions::UnorderedNamedExpressionSet &referenced_expressions,
-      PhysicalPtr *output) const override {
-    // The project expressions for an WindowAggregate cannot be changed.
-    return false;
-  }
-
-  /**
-   * @brief Creates an WindowAggregate physical node.
-   *
-   * @param input The input node.
-   * @param window_aggregate_expression The window aggregate expression.
-   * @return An immutable WindowAggregate node.
-   */
-  static WindowAggregatePtr Create(
-      const PhysicalPtr &input,
-      const expressions::AliasPtr &window_aggregate_expression) {
-    return WindowAggregatePtr(new WindowAggregate(input,
-                                                  window_aggregate_expression));
-  }
-
- 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:
-  WindowAggregate(
-      const PhysicalPtr &input,
-      const expressions::AliasPtr &window_aggregate_expression)
-      : input_(input),
-        window_aggregate_expression_(window_aggregate_expression) {
-    addChild(input_);
-  }
-
-  const PhysicalPtr input_;
-  const expressions::AliasPtr window_aggregate_expression_;
-
-  DISALLOW_COPY_AND_ASSIGN(WindowAggregate);
-};
-
-/** @} */
-
-}  // namespace physical
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_QUERY_OPTIMIZER_PHYSICAL_WINDOW_AGGREGATE_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/resolver/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/query_optimizer/resolver/CMakeLists.txt b/query_optimizer/resolver/CMakeLists.txt
deleted file mode 100644
index 5251ccc..0000000
--- a/query_optimizer/resolver/CMakeLists.txt
+++ /dev/null
@@ -1,140 +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.
-
-# Declare micro-libs:
-add_library(quickstep_queryoptimizer_resolver_NameResolver NameResolver.cpp NameResolver.hpp)
-add_library(quickstep_queryoptimizer_resolver_Resolver Resolver.cpp Resolver.hpp)
-
-# Link dependencies:
-target_link_libraries(quickstep_queryoptimizer_resolver_NameResolver
-                      glog
-                      quickstep_catalog_CatalogAttribute
-                      quickstep_catalog_CatalogRelation
-                      quickstep_parser_ParseString
-                      quickstep_queryoptimizer_expressions_AttributeReference
-                      quickstep_queryoptimizer_expressions_ExpressionUtil
-                      quickstep_queryoptimizer_logical_Logical
-                      quickstep_utility_Macros
-                      quickstep_utility_SqlError
-                      quickstep_utility_StringUtil)
-target_link_libraries(quickstep_queryoptimizer_resolver_Resolver
-                      glog
-                      quickstep_catalog_CatalogDatabase
-                      quickstep_expressions_aggregation_AggregateFunction
-                      quickstep_expressions_aggregation_AggregateFunctionFactory
-                      quickstep_expressions_tablegenerator_GeneratorFunction
-                      quickstep_expressions_tablegenerator_GeneratorFunctionFactory
-                      quickstep_expressions_tablegenerator_GeneratorFunctionHandle
-                      quickstep_expressions_windowaggregation_WindowAggregateFunction
-                      quickstep_expressions_windowaggregation_WindowAggregateFunctionFactory
-                      quickstep_parser_ParseAssignment
-                      quickstep_parser_ParseBasicExpressions
-                      quickstep_parser_ParseBlockProperties
-                      quickstep_parser_ParseCaseExpressions
-                      quickstep_parser_ParseExpression
-                      quickstep_parser_ParseGeneratorTableReference
-                      quickstep_parser_ParseGroupBy
-                      quickstep_parser_ParseHaving
-                      quickstep_parser_ParseJoinedTableReference
-                      quickstep_parser_ParseLimit
-                      quickstep_parser_ParseLiteralValue
-                      quickstep_parser_ParseOrderBy
-                      quickstep_parser_ParsePredicate
-                      quickstep_parser_ParsePredicateExists
-                      quickstep_parser_ParsePredicateInTableQuery
-                      quickstep_parser_ParseSelect
-                      quickstep_parser_ParseSelectionClause
-                      quickstep_parser_ParseSimpleTableReference
-                      quickstep_parser_ParseStatement
-                      quickstep_parser_ParseString
-                      quickstep_parser_ParseSubqueryExpression
-                      quickstep_parser_ParseSubqueryTableReference
-                      quickstep_parser_ParseTableReference
-                      quickstep_parser_ParseWindow
-                      quickstep_queryoptimizer_OptimizerContext
-                      quickstep_queryoptimizer_Validator
-                      quickstep_queryoptimizer_expressions_AggregateFunction
-                      quickstep_queryoptimizer_expressions_Alias
-                      quickstep_queryoptimizer_expressions_AttributeReference
-                      quickstep_queryoptimizer_expressions_BinaryExpression
-                      quickstep_queryoptimizer_expressions_Cast
-                      quickstep_queryoptimizer_expressions_ComparisonExpression
-                      quickstep_queryoptimizer_expressions_Exists
-                      quickstep_queryoptimizer_expressions_ExprId
-                      quickstep_queryoptimizer_expressions_ExpressionUtil
-                      quickstep_queryoptimizer_expressions_InTableQuery
-                      quickstep_queryoptimizer_expressions_InValueList
-                      quickstep_queryoptimizer_expressions_LogicalAnd
-                      quickstep_queryoptimizer_expressions_LogicalNot
-                      quickstep_queryoptimizer_expressions_LogicalOr
-                      quickstep_queryoptimizer_expressions_NamedExpression
-                      quickstep_queryoptimizer_expressions_PatternMatcher
-                      quickstep_queryoptimizer_expressions_Predicate
-                      quickstep_queryoptimizer_expressions_PredicateLiteral
-                      quickstep_queryoptimizer_expressions_Scalar
-                      quickstep_queryoptimizer_expressions_ScalarLiteral
-                      quickstep_queryoptimizer_expressions_SearchedCase
-                      quickstep_queryoptimizer_expressions_SimpleCase
-                      quickstep_queryoptimizer_expressions_SubqueryExpression
-                      quickstep_queryoptimizer_expressions_UnaryExpression
-                      quickstep_queryoptimizer_expressions_WindowAggregateFunction
-                      quickstep_queryoptimizer_logical_Aggregate
-                      quickstep_queryoptimizer_logical_CopyFrom
-                      quickstep_queryoptimizer_logical_CreateIndex
-                      quickstep_queryoptimizer_logical_CreateTable
-                      quickstep_queryoptimizer_logical_DeleteTuples
-                      quickstep_queryoptimizer_logical_DropTable
-                      quickstep_queryoptimizer_logical_Filter
-                      quickstep_queryoptimizer_logical_HashJoin
-                      quickstep_queryoptimizer_logical_InsertSelection
-                      quickstep_queryoptimizer_logical_InsertTuple
-                      quickstep_queryoptimizer_logical_Logical
-                      quickstep_queryoptimizer_logical_MultiwayCartesianJoin
-                      quickstep_queryoptimizer_logical_Project
-                      quickstep_queryoptimizer_logical_Sample
-                      quickstep_queryoptimizer_logical_SharedSubplanReference
-                      quickstep_queryoptimizer_logical_Sort
-                      quickstep_queryoptimizer_logical_TableGenerator
-                      quickstep_queryoptimizer_logical_TableReference
-                      quickstep_queryoptimizer_logical_TopLevelPlan
-                      quickstep_queryoptimizer_logical_UpdateTable
-                      quickstep_queryoptimizer_logical_WindowAggregate
-                      quickstep_queryoptimizer_resolver_NameResolver
-                      quickstep_storage_StorageBlockLayout_proto
-                      quickstep_storage_StorageConstants
-                      quickstep_types_IntType
-                      quickstep_types_Type
-                      quickstep_types_TypedValue
-                      quickstep_types_TypeFactory
-                      quickstep_types_operations_binaryoperations_BinaryOperation
-                      quickstep_types_operations_comparisons_Comparison
-                      quickstep_types_operations_comparisons_ComparisonFactory
-                      quickstep_types_operations_comparisons_ComparisonID
-                      quickstep_types_operations_unaryoperations_DateExtractOperation
-                      quickstep_types_operations_unaryoperations_SubstringOperation
-                      quickstep_types_operations_unaryoperations_UnaryOperation
-                      quickstep_utility_Macros
-                      quickstep_utility_PtrList
-                      quickstep_utility_PtrVector
-                      quickstep_utility_SqlError
-                      quickstep_utility_StringUtil)
-
-# Module all-in-one library:
-add_library(quickstep_queryoptimizer_resolver ../../empty_src.cpp QueryResolverModule.hpp)
-target_link_libraries(quickstep_queryoptimizer_resolver
-                      quickstep_queryoptimizer_resolver_NameResolver
-                      quickstep_queryoptimizer_resolver_Resolver)

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/resolver/NameResolver.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/resolver/NameResolver.cpp b/query_optimizer/resolver/NameResolver.cpp
deleted file mode 100644
index 1c6bf6a..0000000
--- a/query_optimizer/resolver/NameResolver.cpp
+++ /dev/null
@@ -1,153 +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/resolver/NameResolver.hpp"
-
-#include <map>
-#include <string>
-#include <vector>
-
-#include "catalog/CatalogAttribute.hpp"
-#include "catalog/CatalogRelation.hpp"
-#include "parser/ParseString.hpp"
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "query_optimizer/logical/Logical.hpp"
-#include "utility/StringUtil.hpp"
-#include "utility/SqlError.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-namespace optimizer {
-namespace resolver {
-
-namespace E = ::quickstep::optimizer::expressions;
-namespace L = ::quickstep::optimizer::logical;
-
-E::AttributeReferencePtr NameResolver::RelationInfo::findAttributeByName(
-    const ParseString *parse_attr_node) const {
-  E::AttributeReferencePtr attribute;
-  const std::string lower_attr_name = ToLower(parse_attr_node->value());
-  const std::map<std::string, int>::const_iterator found_it =
-      name_to_attribute_index_map.find(lower_attr_name);
-  if (found_it != name_to_attribute_index_map.end()) {
-    if (found_it->second == -1) {
-      THROW_SQL_ERROR_AT(parse_attr_node)
-          << "Ambiguous attribute " << lower_attr_name;
-    }
-    attribute = attributes[found_it->second];
-  }
-  return attribute;
-}
-
-void NameResolver::addRelation(
-    const ParseString *parse_rel_name,
-    const L::LogicalPtr &logical) {
-  DCHECK(parse_rel_name != nullptr);
-  relations_.emplace_back(new RelationInfo(*parse_rel_name, logical));
-  const std::string lower_rel_name = ToLower(parse_rel_name->value());
-  if (rel_name_to_rel_info_map_.find(lower_rel_name) !=
-      rel_name_to_rel_info_map_.end()) {
-    THROW_SQL_ERROR_AT(parse_rel_name) << "Relation alias " << lower_rel_name
-                                       << " appears more than once";
-  }
-  rel_name_to_rel_info_map_[lower_rel_name] = relations_.back().get();
-}
-
-E::AttributeReferencePtr NameResolver::lookup(
-    const ParseString *parse_attr_node,
-    const ParseString *parse_rel_node) const {
-  E::AttributeReferencePtr attribute;
-  // Look up the attribute from local scope.
-  if (parse_rel_node == nullptr) {
-    // If the relation name is not given, search all visible relations.
-    for (const std::unique_ptr<RelationInfo> &item : relations_) {
-      E::AttributeReferencePtr found_attribute =
-          item->findAttributeByName(parse_attr_node);
-      if (found_attribute != nullptr) {
-        // More than one relation has the same attribute name.
-        if (attribute != nullptr) {
-          THROW_SQL_ERROR_AT(parse_attr_node) << "Ambiguous attribute "
-                                              << parse_attr_node->value();
-        }
-        attribute = found_attribute;
-      }
-    }
-  } else {
-    const std::map<std::string, const RelationInfo *>::const_iterator found_it =
-        rel_name_to_rel_info_map_.find(ToLower(parse_rel_node->value()));
-    if (found_it != rel_name_to_rel_info_map_.end()) {
-      attribute = found_it->second->findAttributeByName(parse_attr_node);
-    }
-  }
-
-  // If cannot find the attribute in local scope, look into parent scopes.
-  if (attribute == nullptr) {
-    if (parent_resolver_ != nullptr) {
-      const E::AttributeReferencePtr outer_attribute =
-          parent_resolver_->lookup(parse_attr_node, parse_rel_node);
-      if (outer_attribute != nullptr) {
-        attribute = E::AttributeReference::Create(outer_attribute->id(),
-                                                  outer_attribute->attribute_name(),
-                                                  outer_attribute->attribute_alias(),
-                                                  outer_attribute->relation_name(),
-                                                  outer_attribute->getValueType(),
-                                                  E::AttributeReferenceScope::kOuter);
-      }
-    }
-  }
-
-  if (attribute == nullptr) {
-    THROW_SQL_ERROR_AT(parse_attr_node) << "Unrecognized attribute "
-                                        << parse_attr_node->value();
-  }
-
-  return attribute;
-}
-
-void NameResolver::merge(NameResolver *other) {
-  // Check whether there is any conflict name with the input name resolver.
-  for (const auto &scoped_rel_info : other->rel_name_to_rel_info_map_) {
-    const std::string &rel_name = scoped_rel_info.first;
-    if (rel_name_to_rel_info_map_.find(rel_name) != rel_name_to_rel_info_map_.end()) {
-      THROW_SQL_ERROR_AT(&scoped_rel_info.second->parse_relation_name)
-          << "Relation alias " << rel_name << " appears more than once";
-    }
-  }
-
-  for (std::unique_ptr<RelationInfo> &scoped_relation : other->relations_) {
-    relations_.emplace_back(scoped_relation.release());
-  }
-  rel_name_to_rel_info_map_.insert(other->rel_name_to_rel_info_map_.begin(),
-                                   other->rel_name_to_rel_info_map_.end());
-}
-
-std::vector<E::AttributeReferencePtr> NameResolver::getVisibleAttributeReferences() const {
-  std::vector<E::AttributeReferencePtr> referenced_attributes;
-  for (const std::unique_ptr<RelationInfo> &rel : relations_) {
-    referenced_attributes.insert(referenced_attributes.end(),
-                                 rel->attributes.begin(),
-                                 rel->attributes.end());
-  }
-  return referenced_attributes;
-}
-
-}  // namespace resolver
-}  // namespace optimizer
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/resolver/NameResolver.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/resolver/NameResolver.hpp b/query_optimizer/resolver/NameResolver.hpp
deleted file mode 100644
index 88154c7..0000000
--- a/query_optimizer/resolver/NameResolver.hpp
+++ /dev/null
@@ -1,208 +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_RESOLVER_NAME_RESOLVER_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_RESOLVER_NAME_RESOLVER_HPP_
-
-#include <map>
-#include <string>
-#include <vector>
-
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "query_optimizer/expressions/ExpressionUtil.hpp"
-#include "query_optimizer/logical/Logical.hpp"
-#include "utility/Macros.hpp"
-#include "utility/StringUtil.hpp"
-
-namespace quickstep {
-
-class CatalogDatabase;
-class ParseString;
-
-namespace optimizer {
-namespace resolver {
-
-/** \addtogroup QueryResolver
- *  @{
- */
-
-/**
- * @brief Manages name scopes and resolves identifiers (e.g. relation and
- *        attribute names) in a parse tree.
- */
-class NameResolver {
- public:
-  /**
-   * @brief Constructor.
-   *
-   * @param parent_resolver The NameResolver inherited from the outer query.
-   *        NULL if there is no outer query.
-   */
-  explicit NameResolver(const NameResolver *parent_resolver = nullptr)
-      : parent_resolver_(parent_resolver) {}
-
-  /**
-   * @brief Adds the attributes of the relation produced by \p logical
-   *        into the name scope.
-   * @exception Throws a SqlError if the relation name already exists.
-   * @note Does not take ownership of \p parse_rel_name.
-   *
-   * @param parse_rel_name The parse node of the relation name. Cannot be NULL.
-   * @param logical The logical operator that outputs the relation.
-   */
-  void addRelation(
-      const ParseString *parse_rel_name,
-      const logical::LogicalPtr &logical);
-
-  /**
-   * @brief Returns the AttributeReference with the given attribute name and
-   *        relation name.
-   * @exception Throws a SqlError if the relation/attribute is not found or the
-   *            attribute name is ambiguous.
-   * @note Does not take ownership of the two arguments.
-   *
-   * @param parse_attr_node The parser node for the attribute name. Cannot be
-   *                        NULL.
-   * @param parse_rel_node The parser node for the relation name. Maybe NULL.
-   * @return The AttributeReference.
-   */
-  expressions::AttributeReferencePtr lookup(
-      const ParseString *parse_attr_node,
-      const ParseString *parse_rel_node) const;
-
-  /**
-   * @brief Combines the name scopes in the current name resolver and in \p other.
-   *        The ownership of <relations_> in \p other will be transferred to the
-   *        current name resolver.
-   *
-   * @param other The name resolver to be merged into this resolver.
-   */
-  void merge(NameResolver *other);
-
-  /**
-   * @return All AttributeReferences in the current name scope.
-   */
-  std::vector<expressions::AttributeReferencePtr> getVisibleAttributeReferences() const;
-
-  /**
-   * @brief Determines whether \p name is an internal name.
-   *        All internal names are empty.
-   *
-   * @param name The string name to check.
-   * @return True if \p name is an internal name.
-   */
-  static bool IsInternalName(const std::string &name) { return name.empty(); }
-
-  /**
-   * @brief Generates an internal alias from \p name.
-   *
-   * @param name The base string to compose the internal alias.
-   * @return An internal alias.
-   */
-  static std::string GenerateInternalAlias(const std::string &name) {
-    return std::string("$").append(name);
-  }
-
-  /**
-   * @return Get the index in the NameResolver for the next relation.
-   */
-  std::size_t nextScopedRelationPosition() const {
-    return relations_.size();
-  }
-
-  /**
-   * @brief Make the output attributes of all the relations with indices between
-   *        start_relation_id and end_relation_id (excluded) to be nullable.
-   *
-   * @param start_relation_id The starting index of the relation for which
-   *        the nullability of output attributes should be changed.
-   * @param end_relation_id The ending relation index.
-   */
-  void makeOutputAttributesNullable(std::size_t start_relation_id,
-                                    std::size_t end_relation_id) {
-    for (std::size_t idx = start_relation_id; idx < end_relation_id; ++idx) {
-      relations_[idx]->attributes =
-          expressions::GetNullableAttributeVector(relations_[idx]->attributes);
-    }
-  }
-
- private:
-  /**
-   * @brief Info of a relation and its visible attributes in the name scope.
-   */
-  struct RelationInfo {
-    explicit RelationInfo(const ParseString &parse_relation_name_in,
-                          const logical::LogicalPtr &logical_in)
-        : parse_relation_name(parse_relation_name_in),
-          logical(logical_in),
-          attributes(logical->getOutputAttributes()) {
-      int current_attribute_index = 0;
-      for (const expressions::AttributeReferencePtr &attribute : attributes) {
-        if (!IsInternalName(attribute->attribute_name())) {
-          const std::string lower_attr_name =
-              ToLower(attribute->attribute_name());
-          if (name_to_attribute_index_map.find(lower_attr_name) !=
-              name_to_attribute_index_map.end()) {
-            // Use -1 to indicate an ambiguous attribute name.
-            name_to_attribute_index_map[lower_attr_name] = -1;
-          } else {
-            name_to_attribute_index_map[lower_attr_name] =
-                current_attribute_index;
-          }
-        }
-        ++current_attribute_index;
-      }
-    }
-
-    // Finds an attribute with the value of <parse_attr_node> from the current
-    // relation. Returns NULL if no attribute with the given name is found.
-    expressions::AttributeReferencePtr findAttributeByName(const ParseString *parse_attr_node) const;
-
-    const ParseString &parse_relation_name;
-    logical::LogicalPtr logical;
-
-    std::vector<expressions::AttributeReferencePtr> attributes;
-
-    // Map from attribute name to the index in <attributes>.
-    // For an ambiguous attribute, the value is -1.
-    std::map<std::string, int> name_to_attribute_index_map;
-  };
-
-  const NameResolver *parent_resolver_;
-
-  /**
-   * @brief Relation info in the name scope.
-   */
-  std::vector<std::unique_ptr<RelationInfo>> relations_;
-
-  /**
-   * @brief Map from relation name to relation info.
-   */
-  std::map<std::string, const RelationInfo *> rel_name_to_rel_info_map_;
-
-  DISALLOW_COPY_AND_ASSIGN(NameResolver);
-};
-
-/** @} */
-
-}  // namespace resolver
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_QUERY_OPTIMIZER_RESOLVER_NAME_RESOLVER_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/resolver/QueryResolverModule.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/resolver/QueryResolverModule.hpp b/query_optimizer/resolver/QueryResolverModule.hpp
deleted file mode 100644
index 465dfe3..0000000
--- a/query_optimizer/resolver/QueryResolverModule.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 QueryResolver
- *  @ingroup QueryOptimizer
- *
- * Module that performs semantic validation and analysis on parse trees.
- **/


[34/51] [abbrv] [partial] incubator-quickstep git commit: remove c++ files

Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/scalar/ScalarLiteral.hpp
----------------------------------------------------------------------
diff --git a/expressions/scalar/ScalarLiteral.hpp b/expressions/scalar/ScalarLiteral.hpp
deleted file mode 100644
index c7f5ceb..0000000
--- a/expressions/scalar/ScalarLiteral.hpp
+++ /dev/null
@@ -1,124 +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_EXPRESSIONS_SCALAR_SCALAR_LITERAL_HPP_
-#define QUICKSTEP_EXPRESSIONS_SCALAR_SCALAR_LITERAL_HPP_
-
-#include <utility>
-#include <vector>
-
-#include "catalog/CatalogTypedefs.hpp"
-#include "expressions/Expressions.pb.h"
-#include "expressions/scalar/Scalar.hpp"
-#include "storage/StorageBlockInfo.hpp"
-#include "types/TypedValue.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-
-class ColumnVector;
-class Type;
-class ValueAccessor;
-
-struct SubBlocksReference;
-
-/** \addtogroup Expressions
- *  @{
- */
-
-/**
- * @brief Scalars which are literal values from a SQL statement.
- **/
-class ScalarLiteral : public Scalar {
- public:
-  /**
-   * @brief Constructor.
-   *
-   * @param lit A TypedValue to wrap.
-   * @param lit_type The Type that lit belongs to.
-   **/
-  ScalarLiteral(const TypedValue &lit,
-                const Type &lit_type)
-      : Scalar(lit_type),
-        internal_literal_(lit) {
-    internal_literal_.ensureNotReference();
-  }
-
-  ScalarLiteral(TypedValue &&lit,
-                const Type &lit_type)
-      : Scalar(lit_type),
-        internal_literal_(lit) {
-    internal_literal_.ensureNotReference();
-  }
-
-  ~ScalarLiteral() override {
-  }
-
-  serialization::Scalar getProto() const override;
-
-  Scalar* clone() const override;
-
-  ScalarDataSource getDataSource() const override {
-    return kLiteral;
-  }
-
-  TypedValue getValueForSingleTuple(const ValueAccessor &accessor,
-                                    const tuple_id tuple) const override {
-    return internal_literal_.makeReferenceToThis();
-  }
-
-  TypedValue getValueForJoinedTuples(
-      const ValueAccessor &left_accessor,
-      const relation_id left_relation_id,
-      const tuple_id left_tuple_id,
-      const ValueAccessor &right_accessor,
-      const relation_id right_relation_id,
-      const tuple_id right_tuple_id) const override {
-    return internal_literal_.makeReferenceToThis();
-  }
-
-  bool hasStaticValue() const override {
-    return true;
-  }
-
-  const TypedValue& getStaticValue() const override {
-    return internal_literal_;
-  }
-
-  ColumnVector* getAllValues(ValueAccessor *accessor,
-                             const SubBlocksReference *sub_blocks_ref) const override;
-
-  ColumnVector* getAllValuesForJoin(
-      const relation_id left_relation_id,
-      ValueAccessor *left_accessor,
-      const relation_id right_relation_id,
-      ValueAccessor *right_accessor,
-      const std::vector<std::pair<tuple_id, tuple_id>> &joined_tuple_ids) const override;
-
- private:
-  TypedValue internal_literal_;
-
-  DISALLOW_COPY_AND_ASSIGN(ScalarLiteral);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_EXPRESSIONS_SCALAR_SCALAR_LITERAL_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/scalar/ScalarUnaryExpression.cpp
----------------------------------------------------------------------
diff --git a/expressions/scalar/ScalarUnaryExpression.cpp b/expressions/scalar/ScalarUnaryExpression.cpp
deleted file mode 100644
index 72fdbe1..0000000
--- a/expressions/scalar/ScalarUnaryExpression.cpp
+++ /dev/null
@@ -1,169 +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 "expressions/scalar/ScalarUnaryExpression.hpp"
-
-#include <memory>
-#include <string>
-#include <utility>
-#include <vector>
-
-#include "catalog/CatalogTypedefs.hpp"
-#include "expressions/Expressions.pb.h"
-#include "storage/ValueAccessor.hpp"
-#include "types/Type.hpp"
-#include "types/TypeErrors.hpp"
-#include "types/TypedValue.hpp"
-#include "types/containers/ColumnVector.hpp"
-#include "types/operations/Operation.pb.h"
-#include "types/operations/unary_operations/UnaryOperation.hpp"
-
-#ifdef QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_JOIN
-#include "glog/logging.h"
-#endif  // QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_JOIN
-
-namespace quickstep {
-
-struct SubBlocksReference;
-
-ScalarUnaryExpression::ScalarUnaryExpression(const UnaryOperation &operation,
-                                             Scalar *operand)
-    : Scalar(*operation.resultTypeForArgumentType(operand->getType())),
-      operation_(operation),
-      operand_(operand) {
-  initHelper(false);
-}
-
-serialization::Scalar ScalarUnaryExpression::getProto() const {
-  serialization::Scalar proto;
-  proto.set_data_source(serialization::Scalar::UNARY_EXPRESSION);
-  proto.MutableExtension(serialization::ScalarUnaryExpression::operation)->CopyFrom(operation_.getProto());
-  proto.MutableExtension(serialization::ScalarUnaryExpression::operand)->CopyFrom(operand_->getProto());
-
-  return proto;
-}
-
-Scalar* ScalarUnaryExpression::clone() const {
-  return new ScalarUnaryExpression(operation_, operand_->clone());
-}
-
-TypedValue ScalarUnaryExpression::getValueForSingleTuple(const ValueAccessor &accessor,
-                                                         const tuple_id tuple) const {
-  if (fast_operator_.get() == nullptr) {
-    return static_value_.makeReferenceToThis();
-  } else {
-    return fast_operator_->applyToTypedValue(operand_->getValueForSingleTuple(accessor, tuple));
-  }
-}
-
-TypedValue ScalarUnaryExpression::getValueForJoinedTuples(
-    const ValueAccessor &left_accessor,
-    const relation_id left_relation_id,
-    const tuple_id left_tuple_id,
-    const ValueAccessor &right_accessor,
-    const relation_id right_relation_id,
-    const tuple_id right_tuple_id) const {
-  if (fast_operator_.get() == nullptr) {
-    return static_value_.makeReferenceToThis();
-  } else {
-    return fast_operator_->applyToTypedValue(operand_->getValueForJoinedTuples(left_accessor,
-                                                                               left_relation_id,
-                                                                               left_tuple_id,
-                                                                               right_accessor,
-                                                                               right_relation_id,
-                                                                               right_tuple_id));
-  }
-}
-
-ColumnVector* ScalarUnaryExpression::getAllValues(
-    ValueAccessor *accessor,
-    const SubBlocksReference *sub_blocks_ref) const {
-  if (fast_operator_.get() == nullptr) {
-    return ColumnVector::MakeVectorOfValue(getType(),
-                                           static_value_,
-                                           accessor->getNumTuplesVirtual());
-  } else {
-#ifdef QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_SELECTION
-    const attribute_id operand_attr_id = operand_->getAttributeIdForValueAccessor();
-    if (operand_attr_id != -1) {
-      return fast_operator_->applyToValueAccessor(accessor, operand_attr_id);
-    }
-#endif  // QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_SELECTION
-
-    std::unique_ptr<ColumnVector> operand_result(operand_->getAllValues(accessor, sub_blocks_ref));
-    return fast_operator_->applyToColumnVector(*operand_result);
-  }
-}
-
-ColumnVector* ScalarUnaryExpression::getAllValuesForJoin(
-    const relation_id left_relation_id,
-    ValueAccessor *left_accessor,
-    const relation_id right_relation_id,
-    ValueAccessor *right_accessor,
-    const std::vector<std::pair<tuple_id, tuple_id>> &joined_tuple_ids) const {
-  if (fast_operator_.get() == nullptr) {
-    return ColumnVector::MakeVectorOfValue(getType(),
-                                           static_value_,
-                                           joined_tuple_ids.size());
-  } else {
-#ifdef QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_JOIN
-    const attribute_id operand_attr_id = operand_->getAttributeIdForValueAccessor();
-    if (operand_attr_id != -1) {
-      const relation_id operand_relation_id = operand_->getRelationIdForValueAccessor();
-      DCHECK_NE(operand_relation_id, -1);
-      DCHECK((operand_relation_id == left_relation_id)
-             || (operand_relation_id == right_relation_id));
-      const bool using_left_relation = (operand_relation_id == left_relation_id);
-      ValueAccessor *operand_accessor = using_left_relation ? left_accessor
-                                                            : right_accessor;
-      return fast_operator_->applyToValueAccessorForJoin(operand_accessor,
-                                                         using_left_relation,
-                                                         operand_attr_id,
-                                                         joined_tuple_ids);
-    }
-#endif  // QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_JOIN
-
-    std::unique_ptr<ColumnVector> operand_result(
-        operand_->getAllValuesForJoin(left_relation_id,
-                                      left_accessor,
-                                      right_relation_id,
-                                      right_accessor,
-                                      joined_tuple_ids));
-    return fast_operator_->applyToColumnVector(*operand_result);
-  }
-}
-
-void ScalarUnaryExpression::initHelper(bool own_children) {
-  if (operation_.canApplyToType(operand_->getType())) {
-    if (operand_->hasStaticValue()) {
-      static_value_ = operation_.applyToChecked(operand_->getStaticValue(),
-                                                operand_->getType());
-    } else {
-      fast_operator_.reset(operation_.makeUncheckedUnaryOperatorForType(operand_->getType()));
-    }
-  } else {
-    const Type &operand_type = operand_->getType();
-    if (!own_children) {
-      operand_.release();
-    }
-    throw OperationInapplicableToType(operation_.getName(), 1, operand_type.getName().c_str());
-  }
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/scalar/ScalarUnaryExpression.hpp
----------------------------------------------------------------------
diff --git a/expressions/scalar/ScalarUnaryExpression.hpp b/expressions/scalar/ScalarUnaryExpression.hpp
deleted file mode 100644
index 608a842..0000000
--- a/expressions/scalar/ScalarUnaryExpression.hpp
+++ /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.
- **/
-
-#ifndef QUICKSTEP_EXPRESSIONS_SCALAR_SCALAR_UNARY_EXPRESSION_HPP_
-#define QUICKSTEP_EXPRESSIONS_SCALAR_SCALAR_UNARY_EXPRESSION_HPP_
-
-#include <memory>
-#include <utility>
-#include <vector>
-
-#include "catalog/CatalogTypedefs.hpp"
-#include "expressions/Expressions.pb.h"
-#include "expressions/scalar/Scalar.hpp"
-#include "storage/StorageBlockInfo.hpp"
-#include "types/TypedValue.hpp"
-#include "types/operations/unary_operations/UnaryOperation.hpp"
-#include "utility/Macros.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-class ColumnVector;
-class ValueAccessor;
-
-struct SubBlocksReference;
-
-/** \addtogroup Expressions
- *  @{
- */
-
-/**
- * @brief Expressions which are based on a UnaryOperation.
- **/
-class ScalarUnaryExpression : public Scalar {
- public:
-  /**
-   * @brief Constructor.
-   *
-   * @param operation The unary operation to be performed.
-   * @param operand The argument of the operation, which this
-   *        ScalarUnaryExpression takes ownership of.
-   **/
-  ScalarUnaryExpression(const UnaryOperation &operation, Scalar *operand);
-
-  /**
-   * @brief Destructor.
-   **/
-  ~ScalarUnaryExpression() override {
-  }
-
-  serialization::Scalar getProto() const override;
-
-  Scalar* clone() const override;
-
-  ScalarDataSource getDataSource() const override {
-    return kUnaryExpression;
-  }
-
-  TypedValue getValueForSingleTuple(const ValueAccessor &accessor,
-                                    const tuple_id tuple) const override;
-
-  TypedValue getValueForJoinedTuples(
-      const ValueAccessor &left_accessor,
-      const relation_id left_relation_id,
-      const tuple_id left_tuple_id,
-      const ValueAccessor &right_accessor,
-      const relation_id right_relation_id,
-      const tuple_id right_tuple_id) const override;
-
-  bool hasStaticValue() const override {
-    return fast_operator_.get() == nullptr;
-  }
-
-  const TypedValue& getStaticValue() const override {
-    DCHECK(hasStaticValue());
-    return static_value_;
-  }
-
-  ColumnVector* getAllValues(ValueAccessor *accessor,
-                             const SubBlocksReference *sub_blocks_ref) const override;
-
-  ColumnVector* getAllValuesForJoin(
-      const relation_id left_relation_id,
-      ValueAccessor *left_accessor,
-      const relation_id right_relation_id,
-      ValueAccessor *right_accessor,
-      const std::vector<std::pair<tuple_id, tuple_id>> &joined_tuple_ids) const override;
-
- private:
-  void initHelper(bool own_children);
-
-  const UnaryOperation &operation_;
-
-  std::unique_ptr<Scalar> operand_;
-  TypedValue static_value_;
-  std::unique_ptr<UncheckedUnaryOperator> fast_operator_;
-
-  friend class PredicateTest;
-  friend class ScalarTest;
-
-  DISALLOW_COPY_AND_ASSIGN(ScalarUnaryExpression);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_EXPRESSIONS_SCALAR_SCALAR_UNARY_EXPRESSION_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/scalar/tests/ScalarCaseExpression_unittest.cpp
----------------------------------------------------------------------
diff --git a/expressions/scalar/tests/ScalarCaseExpression_unittest.cpp b/expressions/scalar/tests/ScalarCaseExpression_unittest.cpp
deleted file mode 100644
index 2d1064b..0000000
--- a/expressions/scalar/tests/ScalarCaseExpression_unittest.cpp
+++ /dev/null
@@ -1,980 +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 <cstddef>
-#include <cstdio>
-#include <cstring>
-#include <memory>
-#include <utility>
-#include <vector>
-
-#include "catalog/CatalogAttribute.hpp"
-#include "catalog/CatalogRelation.hpp"
-#include "catalog/CatalogRelationSchema.hpp"
-#include "expressions/predicate/ComparisonPredicate.hpp"
-#include "expressions/predicate/ConjunctionPredicate.hpp"
-#include "expressions/predicate/DisjunctionPredicate.hpp"
-#include "expressions/predicate/Predicate.hpp"
-#include "expressions/scalar/Scalar.hpp"
-#include "expressions/scalar/ScalarAttribute.hpp"
-#include "expressions/scalar/ScalarBinaryExpression.hpp"
-#include "expressions/scalar/ScalarCaseExpression.hpp"
-#include "expressions/scalar/ScalarLiteral.hpp"
-#include "expressions/scalar/ScalarUnaryExpression.hpp"
-#include "storage/StorageBlockInfo.hpp"
-#include "storage/TupleIdSequence.hpp"
-#include "storage/ValueAccessor.hpp"
-#include "types/TypeFactory.hpp"
-#include "types/TypeID.hpp"
-#include "types/TypedValue.hpp"
-#include "types/containers/ColumnVector.hpp"
-#include "types/containers/ColumnVectorsValueAccessor.hpp"
-#include "types/operations/binary_operations/BinaryOperationFactory.hpp"
-#include "types/operations/binary_operations/BinaryOperationID.hpp"
-#include "types/operations/comparisons/ComparisonFactory.hpp"
-#include "types/operations/comparisons/ComparisonID.hpp"
-#include "types/operations/unary_operations/UnaryOperationFactory.hpp"
-#include "types/operations/unary_operations/UnaryOperationID.hpp"
-
-#include "gtest/gtest.h"
-
-// NetBSD's libc has snprintf(), but it doesn't show up in the std namespace
-// for C++.
-#ifndef __NetBSD__
-using std::snprintf;
-#endif
-
-namespace quickstep {
-
-class Type;
-
-class ScalarCaseExpressionTest : public ::testing::Test {
- protected:
-  static constexpr std::size_t kNumSampleTuples = 1000;
-
-  virtual void SetUp() {
-    sample_relation_.reset(new CatalogRelation(nullptr, "sample", 0));
-    sample_relation_->addAttribute(new CatalogAttribute(
-        sample_relation_.get(),
-        "int_attr",
-        TypeFactory::GetType(kInt, true)));
-    sample_relation_->addAttribute(new CatalogAttribute(
-        sample_relation_.get(),
-        "double_attr",
-        TypeFactory::GetType(kDouble, true)));
-    sample_relation_->addAttribute(new CatalogAttribute(
-        sample_relation_.get(),
-        "varchar_attr",
-        TypeFactory::GetType(kVarChar, 20, true)));
-
-    std::unique_ptr<NativeColumnVector> int_column(
-        new NativeColumnVector(TypeFactory::GetType(kInt, true), kNumSampleTuples));
-    std::unique_ptr<NativeColumnVector> double_column(
-        new NativeColumnVector(TypeFactory::GetType(kDouble, true), kNumSampleTuples));
-    std::unique_ptr<IndirectColumnVector> varchar_column(
-        new IndirectColumnVector(TypeFactory::GetType(kVarChar, 20, true), kNumSampleTuples));
-
-    for (std::size_t tuple_num = 0; tuple_num < kNumSampleTuples; ++tuple_num) {
-      if (tuple_num % 10 == 0) {
-        int_column->appendNullValue();
-      } else {
-        int int_value = tuple_num;
-        int_column->appendUntypedValue(&int_value);
-      }
-
-      if (tuple_num % 10 == 1) {
-        double_column->appendNullValue();
-      } else {
-        double double_value = -static_cast<double>(tuple_num);
-        double_column->appendUntypedValue(&double_value);
-      }
-
-      if (tuple_num % 10 == 2) {
-        TypedValue varchar_value(kVarChar);
-        varchar_column->appendTypedValue(std::move(varchar_value));
-      } else {
-        char varchar_buffer[20];
-        int written = snprintf(varchar_buffer,
-                               sizeof(varchar_buffer),
-                               "aa%05dzz",
-                               static_cast<int>(tuple_num));
-        ASSERT_LT(written, 20);
-        TypedValue varchar_value(kVarChar, varchar_buffer, std::strlen(varchar_buffer) + 1);
-        varchar_value.ensureNotReference();
-        varchar_column->appendTypedValue(std::move(varchar_value));
-      }
-    }
-
-    sample_data_value_accessor_.addColumn(int_column.release());
-    sample_data_value_accessor_.addColumn(double_column.release());
-    sample_data_value_accessor_.addColumn(varchar_column.release());
-  }
-
-  std::unique_ptr<CatalogRelation> sample_relation_;
-  ColumnVectorsValueAccessor sample_data_value_accessor_;
-};
-
-constexpr std::size_t ScalarCaseExpressionTest::kNumSampleTuples;
-
-// Test a CASE expression that always goes to the same branch.
-TEST_F(ScalarCaseExpressionTest, StaticBranchTest) {
-  std::vector<std::unique_ptr<Predicate>> when_predicates;
-  std::vector<std::unique_ptr<Scalar>> result_expressions;
-
-  const Type &int_type = TypeFactory::GetType(kInt);
-
-  // WHEN 1 > 2 THEN int_attr
-  when_predicates.emplace_back(new ComparisonPredicate(
-      ComparisonFactory::GetComparison(ComparisonID::kGreater),
-      new ScalarLiteral(TypedValue(static_cast<int>(1)), int_type),
-      new ScalarLiteral(TypedValue(static_cast<int>(2)), int_type)));
-  result_expressions.emplace_back(
-      new ScalarAttribute(*sample_relation_->getAttributeById(0)));
-
-  // WHEN 2 > 1 THEN 42
-  when_predicates.emplace_back(new ComparisonPredicate(
-      ComparisonFactory::GetComparison(ComparisonID::kGreater),
-      new ScalarLiteral(TypedValue(static_cast<int>(2)), int_type),
-      new ScalarLiteral(TypedValue(static_cast<int>(1)), int_type)));
-  result_expressions.emplace_back(
-      new ScalarLiteral(TypedValue(static_cast<int>(42)), int_type));
-
-  // WHEN int_attr > 50 THEN -int_attr
-  when_predicates.emplace_back(new ComparisonPredicate(
-      ComparisonFactory::GetComparison(ComparisonID::kGreater),
-      new ScalarAttribute(*sample_relation_->getAttributeById(0)),
-      new ScalarLiteral(TypedValue(static_cast<int>(50)), int_type)));
-  result_expressions.emplace_back(new ScalarUnaryExpression(
-      UnaryOperationFactory::GetUnaryOperation(UnaryOperationID::kNegate),
-      new ScalarAttribute(*sample_relation_->getAttributeById(0))));
-
-  // ELSE 123
-  ScalarCaseExpression case_expr(
-      TypeFactory::GetType(kInt, true),
-      std::move(when_predicates),
-      std::move(result_expressions),
-      new ScalarLiteral(TypedValue(static_cast<int>(123)), int_type));
-
-  ASSERT_TRUE(case_expr.hasStaticValue());
-  ASSERT_EQ(kInt, case_expr.getStaticValue().getTypeID());
-  ASSERT_FALSE(case_expr.getStaticValue().isNull());
-  EXPECT_EQ(42, case_expr.getStaticValue().getLiteral<int>());
-}
-
-TEST_F(ScalarCaseExpressionTest, BasicComparisonAndLiteralTest) {
-  static const char kFirstLawString[]
-      = "A robot may not injure a human being or, through inaction, allow a "
-        "human being to come to harm.";
-  static const char kSecondLawString[]
-      = "A robot must obey orders given it by human beings except where such "
-        "orders would conflict with the First Law.";
-  static const char kThirdLawString[]
-      = "A robot must protect its own existence as long as such protection "
-        "does not conflict with the First or Second Law.";
-
-  std::vector<std::unique_ptr<Predicate>> when_predicates;
-  std::vector<std::unique_ptr<Scalar>> result_expressions;
-
-  const Type &int_type = TypeFactory::GetType(kInt);
-  const Type &double_type = TypeFactory::GetType(kDouble);
-  // Maximum length of 160 chars is longer than is needed for any of the
-  // sample strings.
-  const Type &varchar_type = TypeFactory::GetType(kVarChar, 160, false);
-
-  // WHEN int_attr < [kNumSampleTuples / 2] THEN [kFirstLawString]
-  when_predicates.emplace_back(new ComparisonPredicate(
-      ComparisonFactory::GetComparison(ComparisonID::kLess),
-      new ScalarAttribute(*sample_relation_->getAttributeById(0)),
-      new ScalarLiteral(TypedValue(static_cast<int>(kNumSampleTuples / 2)), int_type)));
-  result_expressions.emplace_back(new ScalarLiteral(
-      TypedValue(kVarChar, kFirstLawString, std::strlen(kFirstLawString) + 1),
-      varchar_type));
-
-  // WHEN double_attr > [-kNumSampleTuples * 3.0 / 4.0] THEN [kSecondLawString]
-  when_predicates.emplace_back(new ComparisonPredicate(
-      ComparisonFactory::GetComparison(ComparisonID::kGreater),
-      new ScalarAttribute(*sample_relation_->getAttributeById(1)),
-      new ScalarLiteral(TypedValue(-static_cast<double>(kNumSampleTuples) * 3.0 / 4.0), double_type)));
-  result_expressions.emplace_back(new ScalarLiteral(
-      TypedValue(kVarChar, kSecondLawString, std::strlen(kSecondLawString) + 1),
-      varchar_type));
-
-  // ELSE [kThirdLawString]
-  ScalarCaseExpression case_expr(
-      TypeFactory::GetType(kVarChar, 160, false),
-      std::move(when_predicates),
-      std::move(result_expressions),
-      new ScalarLiteral(TypedValue(kVarChar, kThirdLawString, std::strlen(kThirdLawString) + 1),
-                        varchar_type));
-
-  std::unique_ptr<ColumnVector> result_cv(
-      case_expr.getAllValues(&sample_data_value_accessor_, nullptr));
-  ASSERT_FALSE(result_cv->isNative());
-  const IndirectColumnVector &indirect_result_cv
-      = static_cast<const IndirectColumnVector&>(*result_cv);
-  EXPECT_EQ(kNumSampleTuples, indirect_result_cv.size());
-
-  for (std::size_t tuple_num = 0;
-       tuple_num < indirect_result_cv.size();
-       ++tuple_num) {
-    if ((tuple_num % 10 != 0) && (tuple_num < kNumSampleTuples / 2)) {
-      EXPECT_STREQ(kFirstLawString,
-                   static_cast<const char*>(indirect_result_cv.getUntypedValue(tuple_num)));
-    } else if ((tuple_num % 10 != 1) && (tuple_num < kNumSampleTuples * 3 / 4)) {
-      EXPECT_STREQ(kSecondLawString,
-                   static_cast<const char*>(indirect_result_cv.getUntypedValue(tuple_num)));
-    } else {
-      EXPECT_STREQ(kThirdLawString,
-                   static_cast<const char*>(indirect_result_cv.getUntypedValue(tuple_num)));
-    }
-  }
-}
-
-// Same as above, but use a TupleIdSequenceAdapterValueAccessor that filters
-// the input.
-TEST_F(ScalarCaseExpressionTest, BasicComparisonAndLiteralWithFilteredInputTest) {
-  // Filter out every seventh tuple.
-  TupleIdSequence filter_sequence(kNumSampleTuples);
-  std::size_t num_filtered_tuples = 0;
-  for (std::size_t tuple_num = 0;
-       tuple_num < kNumSampleTuples;
-       ++tuple_num) {
-    if (tuple_num % 7 != 0) {
-      filter_sequence.set(tuple_num, true);
-      ++num_filtered_tuples;
-    }
-  }
-
-  std::unique_ptr<ValueAccessor> filtered_accessor(
-      sample_data_value_accessor_.createSharedTupleIdSequenceAdapter(filter_sequence));
-
-  static const char kFirstLawString[]
-      = "A robot may not injure a human being or, through inaction, allow a "
-        "human being to come to harm.";
-  static const char kSecondLawString[]
-      = "A robot must obey orders given it by human beings except where such "
-        "orders would conflict with the First Law.";
-  static const char kThirdLawString[]
-      = "A robot must protect its own existence as long as such protection "
-        "does not conflict with the First or Second Law.";
-
-  std::vector<std::unique_ptr<Predicate>> when_predicates;
-  std::vector<std::unique_ptr<Scalar>> result_expressions;
-
-  const Type &int_type = TypeFactory::GetType(kInt);
-  const Type &double_type = TypeFactory::GetType(kDouble);
-  const Type &varchar_type = TypeFactory::GetType(kVarChar, 160, false);
-
-  // WHEN int_attr < [kNumSampleTuples / 2] THEN [kFirstLawString]
-  when_predicates.emplace_back(new ComparisonPredicate(
-      ComparisonFactory::GetComparison(ComparisonID::kLess),
-      new ScalarAttribute(*sample_relation_->getAttributeById(0)),
-      new ScalarLiteral(TypedValue(static_cast<int>(kNumSampleTuples / 2)), int_type)));
-  result_expressions.emplace_back(new ScalarLiteral(
-      TypedValue(kVarChar, kFirstLawString, std::strlen(kFirstLawString) + 1),
-      varchar_type));
-
-  // WHEN double_attr > [kNumSampleTuples * 3.0 / 4.0] THEN [kSecondLawString]
-  when_predicates.emplace_back(new ComparisonPredicate(
-      ComparisonFactory::GetComparison(ComparisonID::kGreater),
-      new ScalarAttribute(*sample_relation_->getAttributeById(1)),
-      new ScalarLiteral(TypedValue(-static_cast<double>(kNumSampleTuples) * 3.0 / 4.0),
-                        double_type)));
-  result_expressions.emplace_back(new ScalarLiteral(
-      TypedValue(kVarChar, kSecondLawString, std::strlen(kSecondLawString) + 1),
-      varchar_type));
-
-  // ELSE [kThirdLawString]
-  ScalarCaseExpression case_expr(
-      TypeFactory::GetType(kVarChar, 160, false),
-      std::move(when_predicates),
-      std::move(result_expressions),
-      new ScalarLiteral(TypedValue(kVarChar, kThirdLawString, std::strlen(kThirdLawString) + 1),
-                        varchar_type));
-
-  std::unique_ptr<ColumnVector> result_cv(
-      case_expr.getAllValues(filtered_accessor.get(), nullptr));
-  ASSERT_FALSE(result_cv->isNative());
-  const IndirectColumnVector &indirect_result_cv
-      = static_cast<const IndirectColumnVector&>(*result_cv);
-  EXPECT_EQ(num_filtered_tuples, indirect_result_cv.size());
-
-  std::size_t original_tuple_num = 0;
-  for (std::size_t tuple_num = 0;
-       tuple_num < indirect_result_cv.size();
-       ++tuple_num, ++original_tuple_num) {
-    if (original_tuple_num % 7 == 0) {
-      ++original_tuple_num;
-    }
-
-    if ((original_tuple_num % 10 != 0) && (original_tuple_num < kNumSampleTuples / 2)) {
-      EXPECT_STREQ(kFirstLawString,
-                   static_cast<const char*>(indirect_result_cv.getUntypedValue(tuple_num)));
-    } else if ((original_tuple_num % 10 != 1) && (original_tuple_num < kNumSampleTuples * 3 / 4)) {
-      EXPECT_STREQ(kSecondLawString,
-                   static_cast<const char*>(indirect_result_cv.getUntypedValue(tuple_num)));
-    } else {
-      EXPECT_STREQ(kThirdLawString,
-                   static_cast<const char*>(indirect_result_cv.getUntypedValue(tuple_num)));
-    }
-  }
-}
-
-// If a tuple matches multiple WHEN clauses, get the value from the first one.
-TEST_F(ScalarCaseExpressionTest, WhenClauseOrderTest) {
-  static const char kFirstLawString[]
-      = "A robot may not injure a human being or, through inaction, allow a "
-        "human being to come to harm.";
-  static const char kSecondLawString[]
-      = "A robot must obey orders given it by human beings except where such "
-        "orders would conflict with the First Law.";
-  static const char kThirdLawString[]
-      = "A robot must protect its own existence as long as such protection "
-        "does not conflict with the First or Second Law.";
-
-  std::vector<std::unique_ptr<Predicate>> when_predicates;
-  std::vector<std::unique_ptr<Scalar>> result_expressions;
-
-  const Type &int_type = TypeFactory::GetType(kInt);
-  const Type &varchar_type = TypeFactory::GetType(kVarChar, 160, false);
-
-  // WHEN int_attr < 500 THEN [kFirstLawString]
-  when_predicates.emplace_back(new ComparisonPredicate(
-      ComparisonFactory::GetComparison(ComparisonID::kLess),
-      new ScalarAttribute(*sample_relation_->getAttributeById(0)),
-      new ScalarLiteral(TypedValue(static_cast<int>(500)), int_type)));
-  result_expressions.emplace_back(new ScalarLiteral(
-      TypedValue(kVarChar, kFirstLawString, std::strlen(kFirstLawString) + 1),
-      varchar_type));
-
-  // WHEN int_attr < 750 THEN [kSecondLawString]
-  when_predicates.emplace_back(new ComparisonPredicate(
-      ComparisonFactory::GetComparison(ComparisonID::kLess),
-      new ScalarAttribute(*sample_relation_->getAttributeById(0)),
-      new ScalarLiteral(TypedValue(static_cast<int>(750)), int_type)));
-  result_expressions.emplace_back(new ScalarLiteral(
-      TypedValue(kVarChar, kSecondLawString, std::strlen(kSecondLawString) + 1),
-      varchar_type));
-
-  // ELSE [kThirdLawString]
-  ScalarCaseExpression case_expr(
-      TypeFactory::GetType(kVarChar, 160, false),
-      std::move(when_predicates),
-      std::move(result_expressions),
-      new ScalarLiteral(TypedValue(kVarChar, kThirdLawString, std::strlen(kThirdLawString) + 1),
-                        varchar_type));
-
-  std::unique_ptr<ColumnVector> result_cv(
-      case_expr.getAllValues(&sample_data_value_accessor_, nullptr));
-  ASSERT_FALSE(result_cv->isNative());
-  const IndirectColumnVector &indirect_result_cv
-      = static_cast<const IndirectColumnVector&>(*result_cv);
-  EXPECT_EQ(kNumSampleTuples, indirect_result_cv.size());
-
-  for (std::size_t tuple_num = 0;
-       tuple_num < indirect_result_cv.size();
-       ++tuple_num) {
-    if ((tuple_num % 10 != 0) && (tuple_num < 500)) {
-      EXPECT_STREQ(kFirstLawString,
-                   static_cast<const char*>(indirect_result_cv.getUntypedValue(tuple_num)));
-    } else if ((tuple_num % 10 != 0) && (tuple_num < 750)) {
-      EXPECT_STREQ(kSecondLawString,
-                   static_cast<const char*>(indirect_result_cv.getUntypedValue(tuple_num)));
-    } else {
-      EXPECT_STREQ(kThirdLawString,
-                   static_cast<const char*>(indirect_result_cv.getUntypedValue(tuple_num)));
-    }
-  }
-}
-
-TEST_F(ScalarCaseExpressionTest, ComplexConjunctionAndCalculatedExpressionTest) {
-  const Type &int_type = TypeFactory::GetType(kInt);
-  const Type &varchar_type = TypeFactory::GetType(kVarChar, 20, false);
-
-  std::vector<std::unique_ptr<Predicate>> when_predicates;
-  std::vector<std::unique_ptr<Scalar>> result_expressions;
-
-  // WHEN (int_attr * 2) + double_attr < 500 AND varchar_attr > 'aa002'
-  // THEN -int_attr
-  static const char kStringLit1[] = "aa002";
-  ConjunctionPredicate *first_case_predicate = new ConjunctionPredicate();
-  first_case_predicate->addPredicate(new ComparisonPredicate(
-      ComparisonFactory::GetComparison(ComparisonID::kLess),
-      new ScalarBinaryExpression(
-          BinaryOperationFactory::GetBinaryOperation(BinaryOperationID::kAdd),
-          new ScalarBinaryExpression(
-              BinaryOperationFactory::GetBinaryOperation(BinaryOperationID::kMultiply),
-              new ScalarAttribute(*sample_relation_->getAttributeById(0)),
-              new ScalarLiteral(TypedValue(2), int_type)),
-          new ScalarAttribute(*sample_relation_->getAttributeById(1))),
-      new ScalarLiteral(TypedValue(static_cast<int>(kNumSampleTuples / 2)), int_type)));
-  first_case_predicate->addPredicate(new ComparisonPredicate(
-      ComparisonFactory::GetComparison(ComparisonID::kGreater),
-      new ScalarAttribute(*sample_relation_->getAttributeById(2)),
-      new ScalarLiteral(TypedValue(kVarChar, kStringLit1, std::strlen(kStringLit1) + 1), varchar_type)));
-  when_predicates.emplace_back(first_case_predicate);
-
-  result_expressions.emplace_back(new ScalarUnaryExpression(
-      UnaryOperationFactory::GetUnaryOperation(UnaryOperationID::kNegate),
-      new ScalarAttribute(*sample_relation_->getAttributeById(0))));
-
-  // WHEN int_attr >= 50 AND (CASE WHEN varchar_attr < 'aa007' THEN 1 ELSE -1) > 0
-  // THEN int_attr + 10
-  static const char kStringLit2[] = "aa007";
-  ConjunctionPredicate *second_case_predicate = new ConjunctionPredicate();
-  second_case_predicate->addPredicate(new ComparisonPredicate(
-      ComparisonFactory::GetComparison(ComparisonID::kGreaterOrEqual),
-      new ScalarAttribute(*sample_relation_->getAttributeById(0)),
-      new ScalarLiteral(TypedValue(50), int_type)));
-  std::vector<std::unique_ptr<Predicate>> subcase_preds;
-  subcase_preds.emplace_back(new ComparisonPredicate(
-      ComparisonFactory::GetComparison(ComparisonID::kLess),
-      new ScalarAttribute(*sample_relation_->getAttributeById(2)),
-      new ScalarLiteral(TypedValue(kVarChar, kStringLit2, std::strlen(kStringLit2) + 1), varchar_type)));
-  std::vector<std::unique_ptr<Scalar>> subcase_results;
-  subcase_results.emplace_back(new ScalarLiteral(TypedValue(1), int_type));
-  second_case_predicate->addPredicate(new ComparisonPredicate(
-      ComparisonFactory::GetComparison(ComparisonID::kGreater),
-      new ScalarCaseExpression(
-          TypeFactory::GetType(kInt, false),
-          std::move(subcase_preds),
-          std::move(subcase_results),
-          new ScalarLiteral(TypedValue(-1), int_type)),
-      new ScalarLiteral(TypedValue(0), int_type)));
-  when_predicates.emplace_back(second_case_predicate);
-
-  result_expressions.emplace_back(new ScalarBinaryExpression(
-      BinaryOperationFactory::GetBinaryOperation(BinaryOperationID::kAdd),
-      new ScalarAttribute(*sample_relation_->getAttributeById(0)),
-      new ScalarLiteral(TypedValue(10), int_type)));
-
-  // ELSE 5 * int_attr
-  ScalarCaseExpression case_expr(
-      TypeFactory::GetType(kInt, true),
-      std::move(when_predicates),
-      std::move(result_expressions),
-      new ScalarBinaryExpression(
-          BinaryOperationFactory::GetBinaryOperation(BinaryOperationID::kMultiply),
-          new ScalarLiteral(TypedValue(5), int_type),
-          new ScalarAttribute(*sample_relation_->getAttributeById(0))));
-
-  std::unique_ptr<ColumnVector> result_cv(
-      case_expr.getAllValues(&sample_data_value_accessor_, nullptr));
-  ASSERT_TRUE(result_cv->isNative());
-  const NativeColumnVector &native_result_cv
-      = static_cast<const NativeColumnVector&>(*result_cv);
-  EXPECT_EQ(kNumSampleTuples, native_result_cv.size());
-
-  for (std::size_t tuple_num = 0;
-       tuple_num < native_result_cv.size();
-       ++tuple_num) {
-    if ((tuple_num % 10 != 0)
-        && (tuple_num % 10 != 1)
-        && (tuple_num % 10 != 2)
-        && (tuple_num < 500)
-        && (tuple_num >= 200)) {
-      ASSERT_NE(nullptr, native_result_cv.getUntypedValue(tuple_num));
-      EXPECT_EQ(-static_cast<int>(tuple_num),
-                *static_cast<const int*>(native_result_cv.getUntypedValue(tuple_num)));
-    } else if ((tuple_num % 10 != 0)
-               && (tuple_num % 10 != 2)
-               && (tuple_num >= 50 && tuple_num < 700)) {
-      ASSERT_NE(nullptr, native_result_cv.getUntypedValue(tuple_num));
-      EXPECT_EQ(static_cast<int>(tuple_num) + 10,
-                *static_cast<const int*>(native_result_cv.getUntypedValue(tuple_num)));
-    } else if (tuple_num % 10 == 0) {
-      EXPECT_EQ(nullptr, native_result_cv.getUntypedValue(tuple_num));
-    } else {
-      ASSERT_NE(nullptr, native_result_cv.getUntypedValue(tuple_num));
-      EXPECT_EQ(static_cast<int>(tuple_num) * 5,
-                *static_cast<const int*>(native_result_cv.getUntypedValue(tuple_num)));
-    }
-  }
-}
-
-// Same as above, but use a TupleIdSequenceAdapterValueAccessor that filters
-// the input.
-TEST_F(ScalarCaseExpressionTest,
-       ComplexConjunctionAndCalculatedExpressionWithFilteredInputTest) {
-  // Filter out every seventh tuple.
-  TupleIdSequence filter_sequence(kNumSampleTuples);
-  std::size_t num_filtered_tuples = 0;
-  for (std::size_t tuple_num = 0;
-       tuple_num < kNumSampleTuples;
-       ++tuple_num) {
-    if (tuple_num % 7 != 0) {
-      filter_sequence.set(tuple_num, true);
-      ++num_filtered_tuples;
-    }
-  }
-
-  std::unique_ptr<ValueAccessor> filtered_accessor(
-      sample_data_value_accessor_.createSharedTupleIdSequenceAdapter(filter_sequence));
-
-  std::vector<std::unique_ptr<Predicate>> when_predicates;
-  std::vector<std::unique_ptr<Scalar>> result_expressions;
-
-  const Type &int_type = TypeFactory::GetType(kInt);
-  const Type &varchar_type = TypeFactory::GetType(kVarChar, 20, false);
-
-  // WHEN (int_attr * 2) + double_attr < 500 AND varchar_attr > 'aa002'
-  // THEN -int_attr
-  static const char kStringLit1[] = "aa002";
-  ConjunctionPredicate *first_case_predicate = new ConjunctionPredicate();
-  first_case_predicate->addPredicate(new ComparisonPredicate(
-      ComparisonFactory::GetComparison(ComparisonID::kLess),
-      new ScalarBinaryExpression(
-          BinaryOperationFactory::GetBinaryOperation(BinaryOperationID::kAdd),
-          new ScalarBinaryExpression(
-              BinaryOperationFactory::GetBinaryOperation(BinaryOperationID::kMultiply),
-              new ScalarAttribute(*sample_relation_->getAttributeById(0)),
-              new ScalarLiteral(TypedValue(2), int_type)),
-          new ScalarAttribute(*sample_relation_->getAttributeById(1))),
-      new ScalarLiteral(TypedValue(static_cast<int>(kNumSampleTuples / 2)), int_type)));
-  first_case_predicate->addPredicate(new ComparisonPredicate(
-      ComparisonFactory::GetComparison(ComparisonID::kGreater),
-      new ScalarAttribute(*sample_relation_->getAttributeById(2)),
-      new ScalarLiteral(TypedValue(kVarChar, kStringLit1, std::strlen(kStringLit1) + 1), varchar_type)));
-  when_predicates.emplace_back(first_case_predicate);
-
-  result_expressions.emplace_back(new ScalarUnaryExpression(
-      UnaryOperationFactory::GetUnaryOperation(UnaryOperationID::kNegate),
-      new ScalarAttribute(*sample_relation_->getAttributeById(0))));
-
-  // WHEN int_attr >= 50 AND (CASE WHEN varchar_attr < 'aa007' THEN 1 ELSE -1) > 0
-  // THEN int_attr + 10
-  static const char kStringLit2[] = "aa007";
-  ConjunctionPredicate *second_case_predicate = new ConjunctionPredicate();
-  second_case_predicate->addPredicate(new ComparisonPredicate(
-      ComparisonFactory::GetComparison(ComparisonID::kGreaterOrEqual),
-      new ScalarAttribute(*sample_relation_->getAttributeById(0)),
-      new ScalarLiteral(TypedValue(50), int_type)));
-  std::vector<std::unique_ptr<Predicate>> subcase_preds;
-  subcase_preds.emplace_back(new ComparisonPredicate(
-      ComparisonFactory::GetComparison(ComparisonID::kLess),
-      new ScalarAttribute(*sample_relation_->getAttributeById(2)),
-      new ScalarLiteral(TypedValue(kVarChar, kStringLit2, std::strlen(kStringLit2) + 1), varchar_type)));
-  std::vector<std::unique_ptr<Scalar>> subcase_results;
-  subcase_results.emplace_back(new ScalarLiteral(TypedValue(1), int_type));
-  second_case_predicate->addPredicate(new ComparisonPredicate(
-      ComparisonFactory::GetComparison(ComparisonID::kGreater),
-      new ScalarCaseExpression(
-          TypeFactory::GetType(kInt, false),
-          std::move(subcase_preds),
-          std::move(subcase_results),
-          new ScalarLiteral(TypedValue(-1), int_type)),
-      new ScalarLiteral(TypedValue(0), int_type)));
-  when_predicates.emplace_back(second_case_predicate);
-
-  result_expressions.emplace_back(new ScalarBinaryExpression(
-      BinaryOperationFactory::GetBinaryOperation(BinaryOperationID::kAdd),
-      new ScalarAttribute(*sample_relation_->getAttributeById(0)),
-      new ScalarLiteral(TypedValue(10), int_type)));
-
-  // ELSE 5 * int_attr
-  ScalarCaseExpression case_expr(
-      TypeFactory::GetType(kInt, true),
-      std::move(when_predicates),
-      std::move(result_expressions),
-      new ScalarBinaryExpression(
-          BinaryOperationFactory::GetBinaryOperation(BinaryOperationID::kMultiply),
-          new ScalarLiteral(TypedValue(5), int_type),
-          new ScalarAttribute(*sample_relation_->getAttributeById(0))));
-
-  std::unique_ptr<ColumnVector> result_cv(
-      case_expr.getAllValues(filtered_accessor.get(), nullptr));
-  ASSERT_TRUE(result_cv->isNative());
-  const NativeColumnVector &native_result_cv
-      = static_cast<const NativeColumnVector&>(*result_cv);
-  EXPECT_EQ(num_filtered_tuples, native_result_cv.size());
-
-  std::size_t original_tuple_num = 0;
-  for (std::size_t tuple_num = 0;
-       tuple_num < native_result_cv.size();
-       ++tuple_num, ++original_tuple_num) {
-    if (original_tuple_num % 7 == 0) {
-      ++original_tuple_num;
-    }
-
-    if ((original_tuple_num % 10 != 0)
-        && (original_tuple_num % 10 != 1)
-        && (original_tuple_num % 10 != 2)
-        && (original_tuple_num < 500)
-        && (original_tuple_num >= 200)) {
-      ASSERT_NE(nullptr, native_result_cv.getUntypedValue(tuple_num));
-      EXPECT_EQ(-static_cast<int>(original_tuple_num),
-                *static_cast<const int*>(native_result_cv.getUntypedValue(tuple_num)));
-    } else if ((original_tuple_num % 10 != 0)
-               && (original_tuple_num % 10 != 2)
-               && (original_tuple_num >= 50 && original_tuple_num < 700)) {
-      ASSERT_NE(nullptr, native_result_cv.getUntypedValue(tuple_num));
-      EXPECT_EQ(static_cast<int>(original_tuple_num) + 10,
-                *static_cast<const int*>(native_result_cv.getUntypedValue(tuple_num)));
-    } else if (original_tuple_num % 10 == 0) {
-      EXPECT_EQ(nullptr, native_result_cv.getUntypedValue(tuple_num));
-    } else {
-      ASSERT_NE(nullptr, native_result_cv.getUntypedValue(tuple_num));
-      EXPECT_EQ(static_cast<int>(original_tuple_num) * 5,
-                *static_cast<const int*>(native_result_cv.getUntypedValue(tuple_num)));
-    }
-  }
-}
-
-TEST_F(ScalarCaseExpressionTest, ComplexDisjunctionAndCalculatedExpressionTest) {
-  const Type &int_type = TypeFactory::GetType(kInt);
-  const Type &varchar_type = TypeFactory::GetType(kVarChar, 20, false);
-
-  std::vector<std::unique_ptr<Predicate>> when_predicates;
-  std::vector<std::unique_ptr<Scalar>> result_expressions;
-
-  // WHEN (int_attr * 2) + double_attr > 750 OR varchar_attr < 'aa002'
-  // THEN -int_attr
-  static const char kStringLit1[] = "aa002";
-  DisjunctionPredicate *first_case_predicate = new DisjunctionPredicate();
-  first_case_predicate->addPredicate(new ComparisonPredicate(
-      ComparisonFactory::GetComparison(ComparisonID::kGreater),
-      new ScalarBinaryExpression(
-          BinaryOperationFactory::GetBinaryOperation(BinaryOperationID::kAdd),
-          new ScalarBinaryExpression(
-              BinaryOperationFactory::GetBinaryOperation(BinaryOperationID::kMultiply),
-              new ScalarAttribute(*sample_relation_->getAttributeById(0)),
-              new ScalarLiteral(TypedValue(2), int_type)),
-          new ScalarAttribute(*sample_relation_->getAttributeById(1))),
-      new ScalarLiteral(TypedValue(750), int_type)));
-  first_case_predicate->addPredicate(new ComparisonPredicate(
-      ComparisonFactory::GetComparison(ComparisonID::kLess),
-      new ScalarAttribute(*sample_relation_->getAttributeById(2)),
-      new ScalarLiteral(TypedValue(kVarChar, kStringLit1, std::strlen(kStringLit1) + 1), varchar_type)));
-  when_predicates.emplace_back(first_case_predicate);
-
-  result_expressions.emplace_back(new ScalarUnaryExpression(
-      UnaryOperationFactory::GetUnaryOperation(UnaryOperationID::kNegate),
-      new ScalarAttribute(*sample_relation_->getAttributeById(0))));
-
-  // WHEN int_attr < 350 OR (CASE WHEN varchar_attr < 'aa006' THEN 1 ELSE -1) < 0
-  // THEN int_attr + 10
-  static const char kStringLit2[] = "aa006";
-  DisjunctionPredicate *second_case_predicate = new DisjunctionPredicate();
-  second_case_predicate->addPredicate(new ComparisonPredicate(
-      ComparisonFactory::GetComparison(ComparisonID::kLess),
-      new ScalarAttribute(*sample_relation_->getAttributeById(0)),
-      new ScalarLiteral(TypedValue(350), int_type)));
-  std::vector<std::unique_ptr<Predicate>> subcase_preds;
-  subcase_preds.emplace_back(new ComparisonPredicate(
-      ComparisonFactory::GetComparison(ComparisonID::kLess),
-      new ScalarAttribute(*sample_relation_->getAttributeById(2)),
-      new ScalarLiteral(TypedValue(kVarChar, kStringLit2, std::strlen(kStringLit2) + 1), varchar_type)));
-  std::vector<std::unique_ptr<Scalar>> subcase_results;
-  subcase_results.emplace_back(new ScalarLiteral(TypedValue(1), int_type));
-  second_case_predicate->addPredicate(new ComparisonPredicate(
-      ComparisonFactory::GetComparison(ComparisonID::kLess),
-      new ScalarCaseExpression(
-          TypeFactory::GetType(kInt, false),
-          std::move(subcase_preds),
-          std::move(subcase_results),
-          new ScalarLiteral(TypedValue(-1), int_type)),
-      new ScalarLiteral(TypedValue(0), int_type)));
-  when_predicates.emplace_back(second_case_predicate);
-
-  result_expressions.emplace_back(new ScalarBinaryExpression(
-      BinaryOperationFactory::GetBinaryOperation(BinaryOperationID::kAdd),
-      new ScalarAttribute(*sample_relation_->getAttributeById(0)),
-      new ScalarLiteral(TypedValue(10), int_type)));
-
-  // ELSE 5 * int_attr
-  ScalarCaseExpression case_expr(
-      TypeFactory::GetType(kInt, true),
-      std::move(when_predicates),
-      std::move(result_expressions),
-      new ScalarBinaryExpression(
-          BinaryOperationFactory::GetBinaryOperation(BinaryOperationID::kMultiply),
-          new ScalarLiteral(TypedValue(5), int_type),
-          new ScalarAttribute(*sample_relation_->getAttributeById(0))));
-
-  std::unique_ptr<ColumnVector> result_cv(
-      case_expr.getAllValues(&sample_data_value_accessor_, nullptr));
-  ASSERT_TRUE(result_cv->isNative());
-  const NativeColumnVector &native_result_cv
-      = static_cast<const NativeColumnVector&>(*result_cv);
-  EXPECT_EQ(kNumSampleTuples, native_result_cv.size());
-
-  for (std::size_t tuple_num = 0;
-       tuple_num < native_result_cv.size();
-       ++tuple_num) {
-    if (tuple_num % 10 == 0) {
-      EXPECT_EQ(nullptr, native_result_cv.getUntypedValue(tuple_num));
-    } else if (((tuple_num % 10 != 1) && (tuple_num > 750))
-               || ((tuple_num % 10 != 2) && (tuple_num < 200))) {
-      ASSERT_NE(nullptr, native_result_cv.getUntypedValue(tuple_num));
-      EXPECT_EQ(-static_cast<int>(tuple_num),
-                *static_cast<const int*>(native_result_cv.getUntypedValue(tuple_num)));
-    } else if ((tuple_num < 350)
-               || (tuple_num % 10 == 2)
-               || ((tuple_num % 10 != 2) && (tuple_num >= 600))) {
-      ASSERT_NE(nullptr, native_result_cv.getUntypedValue(tuple_num));
-      EXPECT_EQ(static_cast<int>(tuple_num) + 10,
-                *static_cast<const int*>(native_result_cv.getUntypedValue(tuple_num)));
-    } else {
-      ASSERT_NE(nullptr, native_result_cv.getUntypedValue(tuple_num));
-      EXPECT_EQ(static_cast<int>(tuple_num) * 5,
-                *static_cast<const int*>(native_result_cv.getUntypedValue(tuple_num)));
-    }
-  }
-}
-
-// Same as above, but use a TupleIdSequenceAdapterValueAccessor that filters
-// the input.
-TEST_F(ScalarCaseExpressionTest,
-       ComplexDisjunctionAndCalculatedExpressionWithFilteredInputTest) {
-  const Type &int_type = TypeFactory::GetType(kInt);
-  const Type &varchar_type = TypeFactory::GetType(kVarChar, 20, false);
-
-  // Filter out every seventh tuple.
-  TupleIdSequence filter_sequence(kNumSampleTuples);
-  std::size_t num_filtered_tuples = 0;
-  for (std::size_t tuple_num = 0;
-       tuple_num < kNumSampleTuples;
-       ++tuple_num) {
-    if (tuple_num % 7 != 0) {
-      filter_sequence.set(tuple_num, true);
-      ++num_filtered_tuples;
-    }
-  }
-
-  std::unique_ptr<ValueAccessor> filtered_accessor(
-      sample_data_value_accessor_.createSharedTupleIdSequenceAdapter(filter_sequence));
-
-  std::vector<std::unique_ptr<Predicate>> when_predicates;
-  std::vector<std::unique_ptr<Scalar>> result_expressions;
-
-  // WHEN (int_attr * 2) + double_attr > 750 OR varchar_attr < 'aa002'
-  // THEN -int_attr
-  static const char kStringLit1[] = "aa002";
-  DisjunctionPredicate *first_case_predicate = new DisjunctionPredicate();
-  first_case_predicate->addPredicate(new ComparisonPredicate(
-      ComparisonFactory::GetComparison(ComparisonID::kGreater),
-      new ScalarBinaryExpression(
-          BinaryOperationFactory::GetBinaryOperation(BinaryOperationID::kAdd),
-          new ScalarBinaryExpression(
-              BinaryOperationFactory::GetBinaryOperation(BinaryOperationID::kMultiply),
-              new ScalarAttribute(*sample_relation_->getAttributeById(0)),
-              new ScalarLiteral(TypedValue(2), int_type)),
-          new ScalarAttribute(*sample_relation_->getAttributeById(1))),
-      new ScalarLiteral(TypedValue(750), int_type)));
-  first_case_predicate->addPredicate(new ComparisonPredicate(
-      ComparisonFactory::GetComparison(ComparisonID::kLess),
-      new ScalarAttribute(*sample_relation_->getAttributeById(2)),
-      new ScalarLiteral(TypedValue(kVarChar, kStringLit1, std::strlen(kStringLit1) + 1), varchar_type)));
-  when_predicates.emplace_back(first_case_predicate);
-
-  result_expressions.emplace_back(new ScalarUnaryExpression(
-      UnaryOperationFactory::GetUnaryOperation(UnaryOperationID::kNegate),
-      new ScalarAttribute(*sample_relation_->getAttributeById(0))));
-
-  // WHEN int_attr < 350 OR (CASE WHEN varchar_attr < 'aa006' THEN 1 ELSE -1) < 0
-  // THEN int_attr + 10
-  static const char kStringLit2[] = "aa006";
-  DisjunctionPredicate *second_case_predicate = new DisjunctionPredicate();
-  second_case_predicate->addPredicate(new ComparisonPredicate(
-      ComparisonFactory::GetComparison(ComparisonID::kLess),
-      new ScalarAttribute(*sample_relation_->getAttributeById(0)),
-      new ScalarLiteral(TypedValue(350), int_type)));
-  std::vector<std::unique_ptr<Predicate>> subcase_preds;
-  subcase_preds.emplace_back(new ComparisonPredicate(
-      ComparisonFactory::GetComparison(ComparisonID::kLess),
-      new ScalarAttribute(*sample_relation_->getAttributeById(2)),
-      new ScalarLiteral(TypedValue(kVarChar, kStringLit2, std::strlen(kStringLit2) + 1), varchar_type)));
-  std::vector<std::unique_ptr<Scalar>> subcase_results;
-  subcase_results.emplace_back(new ScalarLiteral(TypedValue(1), int_type));
-  second_case_predicate->addPredicate(new ComparisonPredicate(
-      ComparisonFactory::GetComparison(ComparisonID::kLess),
-      new ScalarCaseExpression(
-          TypeFactory::GetType(kInt, false),
-          std::move(subcase_preds),
-          std::move(subcase_results),
-          new ScalarLiteral(TypedValue(-1), int_type)),
-      new ScalarLiteral(TypedValue(0), int_type)));
-  when_predicates.emplace_back(second_case_predicate);
-
-  result_expressions.emplace_back(new ScalarBinaryExpression(
-      BinaryOperationFactory::GetBinaryOperation(BinaryOperationID::kAdd),
-      new ScalarAttribute(*sample_relation_->getAttributeById(0)),
-      new ScalarLiteral(TypedValue(10), int_type)));
-
-  // ELSE 5 * int_attr
-  ScalarCaseExpression case_expr(
-      TypeFactory::GetType(kInt, true),
-      std::move(when_predicates),
-      std::move(result_expressions),
-      new ScalarBinaryExpression(
-          BinaryOperationFactory::GetBinaryOperation(BinaryOperationID::kMultiply),
-          new ScalarLiteral(TypedValue(5), int_type),
-          new ScalarAttribute(*sample_relation_->getAttributeById(0))));
-
-  std::unique_ptr<ColumnVector> result_cv(
-      case_expr.getAllValues(filtered_accessor.get(), nullptr));
-  ASSERT_TRUE(result_cv->isNative());
-  const NativeColumnVector &native_result_cv
-      = static_cast<const NativeColumnVector&>(*result_cv);
-  EXPECT_EQ(num_filtered_tuples, native_result_cv.size());
-
-  std::size_t original_tuple_num = 0;
-  for (std::size_t tuple_num = 0;
-       tuple_num < native_result_cv.size();
-       ++tuple_num, ++original_tuple_num) {
-    if (original_tuple_num % 7 == 0) {
-      ++original_tuple_num;
-    }
-
-    if (original_tuple_num % 10 == 0) {
-      EXPECT_EQ(nullptr, native_result_cv.getUntypedValue(tuple_num));
-    } else if (((original_tuple_num % 10 != 1) && (original_tuple_num > 750))
-               || ((original_tuple_num % 10 != 2) && (original_tuple_num < 200))) {
-      ASSERT_NE(nullptr, native_result_cv.getUntypedValue(tuple_num));
-      EXPECT_EQ(-static_cast<int>(original_tuple_num),
-                *static_cast<const int*>(native_result_cv.getUntypedValue(tuple_num)));
-    } else if ((original_tuple_num < 350)
-               || (original_tuple_num % 10 == 2)
-               || ((original_tuple_num % 10 != 2) && (original_tuple_num >= 600))) {
-      ASSERT_NE(nullptr, native_result_cv.getUntypedValue(tuple_num));
-      EXPECT_EQ(static_cast<int>(original_tuple_num) + 10,
-                *static_cast<const int*>(native_result_cv.getUntypedValue(tuple_num)));
-    } else {
-      ASSERT_NE(nullptr, native_result_cv.getUntypedValue(tuple_num));
-      EXPECT_EQ(static_cast<int>(original_tuple_num) * 5,
-                *static_cast<const int*>(native_result_cv.getUntypedValue(tuple_num)));
-    }
-  }
-}
-
-// Test CASE evaluation over joins, with both WHEN predicates and THEN
-// expressions referencing attributes in both relations.
-TEST_F(ScalarCaseExpressionTest, JoinTest) {
-  // Simulate a join with another relation.
-  CatalogRelation other_relation(nullptr, "other", 1);
-  other_relation.addAttribute(new CatalogAttribute(&other_relation,
-                                                   "other_double",
-                                                   TypeFactory::GetType(kDouble, false)));
-  other_relation.addAttribute(new CatalogAttribute(&other_relation,
-                                                   "other_int",
-                                                   TypeFactory::GetType(kInt, false)));
-
-  static const double kOtherDoubleValues[] = {-250.0, -750.0};
-  std::unique_ptr<NativeColumnVector> other_double_column(
-      new NativeColumnVector(TypeFactory::GetType(kDouble, false), 2));
-  other_double_column->appendUntypedValue(kOtherDoubleValues);
-  other_double_column->appendUntypedValue(kOtherDoubleValues + 1);
-
-  static const int kOtherIntValues[] = {10, -1};
-  std::unique_ptr<NativeColumnVector> other_int_column(
-      new NativeColumnVector(TypeFactory::GetType(kInt, false), 2));
-  other_int_column->appendUntypedValue(kOtherIntValues);
-  other_int_column->appendUntypedValue(kOtherIntValues + 1);
-
-  ColumnVectorsValueAccessor other_accessor;
-  other_accessor.addColumn(other_double_column.release());
-  other_accessor.addColumn(other_int_column.release());
-
-  // Setup expression.
-  std::vector<std::unique_ptr<Predicate>> when_predicates;
-  std::vector<std::unique_ptr<Scalar>> result_expressions;
-
-  // WHEN double_attr > other_double THEN int_attr + other_int
-  when_predicates.emplace_back(new ComparisonPredicate(
-      ComparisonFactory::GetComparison(ComparisonID::kGreater),
-      new ScalarAttribute(*sample_relation_->getAttributeById(1)),
-      new ScalarAttribute(*other_relation.getAttributeById(0))));
-  result_expressions.emplace_back(new ScalarBinaryExpression(
-      BinaryOperationFactory::GetBinaryOperation(BinaryOperationID::kAdd),
-      new ScalarAttribute(*sample_relation_->getAttributeById(0)),
-      new ScalarAttribute(*other_relation.getAttributeById(1))));
-
-  // WHEN double_attr < other_double THEN int_attr * other_int
-  when_predicates.emplace_back(new ComparisonPredicate(
-      ComparisonFactory::GetComparison(ComparisonID::kLess),
-      new ScalarAttribute(*sample_relation_->getAttributeById(1)),
-      new ScalarAttribute(*other_relation.getAttributeById(0))));
-  result_expressions.emplace_back(new ScalarBinaryExpression(
-      BinaryOperationFactory::GetBinaryOperation(BinaryOperationID::kMultiply),
-      new ScalarAttribute(*sample_relation_->getAttributeById(0)),
-      new ScalarAttribute(*other_relation.getAttributeById(1))));
-
-  // ELSE 0
-  ScalarCaseExpression case_expr(
-      TypeFactory::GetType(kInt, true),
-      std::move(when_predicates),
-      std::move(result_expressions),
-      new ScalarLiteral(TypedValue(0), TypeFactory::GetType(kInt)));
-
-  // Create a list of joined tuple-id pairs (just the cross-product of tuples).
-  std::vector<std::pair<tuple_id, tuple_id>> joined_tuple_ids;
-  for (std::size_t tuple_num = 0; tuple_num < kNumSampleTuples; ++tuple_num) {
-    joined_tuple_ids.emplace_back(tuple_num, 0);
-    joined_tuple_ids.emplace_back(tuple_num, 1);
-  }
-
-  std::unique_ptr<ColumnVector> result_cv(case_expr.getAllValuesForJoin(
-      0,
-      &sample_data_value_accessor_,
-      1,
-      &other_accessor,
-      joined_tuple_ids));
-  ASSERT_TRUE(result_cv->isNative());
-  const NativeColumnVector &native_result_cv
-      = static_cast<const NativeColumnVector&>(*result_cv);
-  EXPECT_EQ(kNumSampleTuples * 2, native_result_cv.size());
-
-  for (std::size_t result_num = 0;
-       result_num < native_result_cv.size();
-       ++result_num) {
-    // For convenience, calculate expected tuple values here.
-    const bool sample_int_null = ((result_num >> 1) % 10 == 0);
-    const int sample_int = result_num >> 1;
-    const bool sample_double_null = ((result_num >> 1) % 10 == 1);
-    const double sample_double = -static_cast<double>(result_num >> 1);
-    const int other_int = kOtherIntValues[result_num & 0x1];
-    const double other_double = kOtherDoubleValues[result_num & 0x1];
-
-    if (sample_double_null) {
-      ASSERT_NE(nullptr, native_result_cv.getUntypedValue(result_num));
-      EXPECT_EQ(0, *static_cast<const int*>(native_result_cv.getUntypedValue(result_num)));
-    } else if (sample_double > other_double) {
-      if (sample_int_null) {
-        EXPECT_EQ(nullptr, native_result_cv.getUntypedValue(result_num));
-      } else {
-        ASSERT_NE(nullptr, native_result_cv.getUntypedValue(result_num));
-        EXPECT_EQ(sample_int + other_int,
-                  *static_cast<const int*>(native_result_cv.getUntypedValue(result_num)));
-      }
-    } else if (sample_double < other_double) {
-      if (sample_int_null) {
-        EXPECT_EQ(nullptr, native_result_cv.getUntypedValue(result_num));
-      } else {
-        ASSERT_NE(nullptr, native_result_cv.getUntypedValue(result_num));
-        EXPECT_EQ(sample_int * other_int,
-                  *static_cast<const int*>(native_result_cv.getUntypedValue(result_num)));
-      }
-    } else {
-      ASSERT_NE(nullptr, native_result_cv.getUntypedValue(result_num));
-      EXPECT_EQ(0, *static_cast<const int*>(native_result_cv.getUntypedValue(result_num)));
-    }
-  }
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/scalar/tests/Scalar_unittest.cpp
----------------------------------------------------------------------
diff --git a/expressions/scalar/tests/Scalar_unittest.cpp b/expressions/scalar/tests/Scalar_unittest.cpp
deleted file mode 100644
index 8e106bb..0000000
--- a/expressions/scalar/tests/Scalar_unittest.cpp
+++ /dev/null
@@ -1,381 +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 <cstddef>
-#include <cstdint>
-#include <cstring>
-#include <limits>
-#include <memory>
-#include <string>
-
-#include "gtest/gtest.h"
-
-#include "catalog/CatalogAttribute.hpp"
-#include "catalog/CatalogDatabase.hpp"
-#include "catalog/CatalogRelation.hpp"
-#include "expressions/ExpressionFactories.hpp"
-#include "expressions/scalar/Scalar.hpp"
-#include "expressions/scalar/ScalarAttribute.hpp"
-#include "expressions/scalar/ScalarBinaryExpression.hpp"
-#include "expressions/scalar/ScalarLiteral.hpp"
-#include "expressions/scalar/ScalarUnaryExpression.hpp"
-#include "types/DatetimeLit.hpp"
-#include "types/IntervalLit.hpp"
-#include "types/Type.hpp"
-#include "types/TypeFactory.hpp"
-#include "types/TypeID.hpp"
-#include "types/TypedValue.hpp"
-#include "types/operations/binary_operations/BinaryOperation.hpp"
-#include "types/operations/binary_operations/BinaryOperationFactory.hpp"
-#include "types/operations/binary_operations/BinaryOperationID.hpp"
-#include "types/operations/unary_operations/NumericCastOperation.hpp"
-#include "types/operations/unary_operations/UnaryOperation.hpp"
-#include "types/operations/unary_operations/UnaryOperationFactory.hpp"
-#include "types/operations/unary_operations/UnaryOperationID.hpp"
-#include "utility/Macros.hpp"
-
-using std::int64_t;
-using std::numeric_limits;
-using std::size_t;
-using std::string;
-using std::strlen;
-using std::unique_ptr;
-
-namespace quickstep {
-
-namespace {
-
-static const char kSampleStringShort[] = "foo";
-
-static const char kSampleStringLong[] =
-    "Space is big. You just won't believe how vastly, hugely, mind-bogglingly "
-    "big it is. I mean, you may think it's a long way down the road to the "
-    "chemist's, but that's just peanuts to space.";
-
-}  // namespace
-
-class ScalarTest : public ::testing::Test {
- protected:
-  virtual void SetUp() {
-    database_.reset(new CatalogDatabase(NULL, "database_"));
-
-    rel_numeric_ = createCatalogRelation("rel_numeric_");
-    attr_int_ = createCatalogAttribute(rel_numeric_, "attr_int", TypeFactory::GetType(kInt));
-    attr_long_ = createCatalogAttribute(rel_numeric_, "attr_long", TypeFactory::GetType(kLong));
-    attr_float_ = createCatalogAttribute(rel_numeric_, "attr_float", TypeFactory::GetType(kFloat));
-    attr_double_ = createCatalogAttribute(rel_numeric_, "attr_double", TypeFactory::GetType(kDouble));
-
-    rel_date_ = createCatalogRelation("rel_date_");
-    attr_datetime_ = createCatalogAttribute(rel_date_, "attr_datetime", TypeFactory::GetType(kDatetime));
-    attr_datetime_interval_ =
-        createCatalogAttribute(rel_date_, "attr_datetime_interval", TypeFactory::GetType(kDatetimeInterval));
-    attr_year_month_interval_ =
-        createCatalogAttribute(rel_date_, "attr_year_month_interval", TypeFactory::GetType(kYearMonthInterval));
-
-    rel_string_ = createCatalogRelation("rel_string_");
-    size_t length = 12;
-    attr_char_ = createCatalogAttribute(rel_string_, "attr_char", TypeFactory::GetType(kChar, length));
-    attr_varchar_ = createCatalogAttribute(rel_string_, "attr_varchar", TypeFactory::GetType(kVarChar, length));
-  }
-
-  void checkScalarUnaryExpressionSerialization(const UnaryOperation &operation) {
-    checkScalarSerialization(ScalarUnaryExpression(operation, createScalarInt(numeric_limits<int>::max())));
-    checkScalarSerialization(ScalarUnaryExpression(operation, createScalarLong(numeric_limits<int64_t>::max())));
-    checkScalarSerialization(ScalarUnaryExpression(operation, createScalarFloat(numeric_limits<float>::max())));
-    checkScalarSerialization(ScalarUnaryExpression(operation, createScalarDouble(numeric_limits<double>::max())));
-  }
-
-  void checkScalarBinaryExpressionSerialization(const BinaryOperation &operation) {
-    checkScalarSerialization(ScalarBinaryExpression(operation, createScalarInt(9), createScalarInt(-1)));
-    checkScalarSerialization(
-        ScalarBinaryExpression(operation, createScalarInt(0), createScalarLong(static_cast<int64_t>(9))));
-    checkScalarSerialization(
-        ScalarBinaryExpression(operation, createScalarInt(4), createScalarFloat(static_cast<float>(1.2))));
-    checkScalarSerialization(
-        ScalarBinaryExpression(operation, createScalarInt(7), createScalarDouble(static_cast<double>(3.14))));
-
-    checkScalarSerialization(
-        ScalarBinaryExpression(operation, createScalarLong(static_cast<int64_t>(-10)), createScalarInt(8)));
-    checkScalarSerialization(
-        ScalarBinaryExpression(operation,
-                               createScalarLong(static_cast<int64_t>(9)),
-                               createScalarLong(static_cast<int64_t>(-9))));
-    checkScalarSerialization(
-        ScalarBinaryExpression(operation,
-                               createScalarLong(static_cast<int64_t>(-9)),
-                               createScalarFloat(static_cast<float>(1.2))));
-    checkScalarSerialization(
-        ScalarBinaryExpression(operation,
-                               createScalarLong(static_cast<int64_t>(9)),
-                               createScalarDouble(static_cast<double>(3.14))));
-
-    checkScalarSerialization(
-        ScalarBinaryExpression(operation, createScalarFloat(static_cast<float>(1.2)), createScalarInt(-1)));
-    checkScalarSerialization(
-        ScalarBinaryExpression(operation,
-                               createScalarFloat(static_cast<float>(1.2)),
-                               createScalarLong(static_cast<int64_t>(-9))));
-    checkScalarSerialization(
-        ScalarBinaryExpression(operation,
-                               createScalarFloat(static_cast<float>(1.2)),
-                               createScalarFloat(static_cast<float>(-3.6))));
-    checkScalarSerialization(
-        ScalarBinaryExpression(operation,
-                               createScalarFloat(static_cast<float>(-1.2)),
-                               createScalarDouble(static_cast<double>(3.14))));
-
-    checkScalarSerialization(
-        ScalarBinaryExpression(operation, createScalarDouble(static_cast<double>(3.14)), createScalarInt(6)));
-    checkScalarSerialization(
-        ScalarBinaryExpression(operation,
-                               createScalarDouble(static_cast<double>(3.14)),
-                               createScalarLong(static_cast<int64_t>(-9))));
-    checkScalarSerialization(
-        ScalarBinaryExpression(operation,
-                               createScalarDouble(static_cast<double>(-3.14)),
-                               createScalarFloat(static_cast<float>(1.2))));
-    checkScalarSerialization(
-        ScalarBinaryExpression(operation,
-                               createScalarDouble(static_cast<double>(3.14)),
-                               createScalarDouble(static_cast<double>(-3.14))));
-  }
-
-  CatalogRelation* createCatalogRelation(const std::string &name) {
-    return database_->getRelationByIdMutable(database_->addRelation(new CatalogRelation(NULL, name)));
-  }
-
-  const CatalogAttribute* createCatalogAttribute(CatalogRelation* rel, const std::string &name, const Type &type) {
-    rel->addAttribute(new CatalogAttribute(NULL, name, type));
-    return rel->getAttributeByName(name);
-  }
-
-  // All four pointers created below are owned by a Scalar subclass.
-  static Scalar* createScalarInt(int int_literal) {
-    return new ScalarLiteral(TypedValue(int_literal), TypeFactory::GetType(kInt));
-  }
-
-  static Scalar* createScalarLong(int64_t long_literal) {
-    return new ScalarLiteral(TypedValue(long_literal), TypeFactory::GetType(kLong));
-  }
-
-  static Scalar* createScalarFloat(float float_literal) {
-    return new ScalarLiteral(TypedValue(float_literal), TypeFactory::GetType(kFloat));
-  }
-
-  static Scalar* createScalarDouble(double double_literal) {
-    return new ScalarLiteral(TypedValue(double_literal), TypeFactory::GetType(kDouble));
-  }
-
-  void checkScalarSerialization(const Scalar &scalar) {
-    unique_ptr<Scalar> scalar_from_proto(ScalarFactory::ReconstructFromProto(scalar.getProto(), *database_));
-    compareScalar(scalar, *scalar_from_proto);
-  }
-
-  static void compareScalar(const Scalar &expected, const Scalar &checked) {
-    ASSERT_EQ(expected.getDataSource(), checked.getDataSource());
-    ASSERT_TRUE(expected.getType().equals(checked.getType()));
-
-    switch (expected.getDataSource()) {
-      case Scalar::kLiteral: {
-        compareTypedValue(expected.getType(), expected.getStaticValue(), checked.getStaticValue());
-        break;
-      }
-      case Scalar::kAttribute: {
-        compareCatalogAttribute(static_cast<const ScalarAttribute&>(expected).getAttribute(),
-                                static_cast<const ScalarAttribute&>(checked).getAttribute());
-        break;
-      }
-      case Scalar::kUnaryExpression: {
-        EXPECT_EQ(expected.hasStaticValue(), checked.hasStaticValue());
-        if (expected.hasStaticValue()) {
-          compareTypedValue(expected.getType(), expected.getStaticValue(), checked.getStaticValue());
-        }
-
-        EXPECT_EQ(static_cast<const ScalarUnaryExpression&>(expected).operation_.getUnaryOperationID(),
-                  static_cast<const ScalarUnaryExpression&>(checked).operation_.getUnaryOperationID());
-        compareScalar(*(static_cast<const ScalarUnaryExpression&>(expected).operand_),
-                      *(static_cast<const ScalarUnaryExpression&>(checked).operand_));
-        break;
-      }
-      case Scalar::kBinaryExpression: {
-        EXPECT_EQ(expected.hasStaticValue(), checked.hasStaticValue());
-        if (expected.hasStaticValue()) {
-          compareTypedValue(expected.getType(), expected.getStaticValue(), checked.getStaticValue());
-        }
-
-        EXPECT_EQ(static_cast<const ScalarBinaryExpression&>(expected).operation_.getBinaryOperationID(),
-                  static_cast<const ScalarBinaryExpression&>(checked).operation_.getBinaryOperationID());
-        compareScalar(*(static_cast<const ScalarBinaryExpression&>(expected).left_operand_),
-                      *(static_cast<const ScalarBinaryExpression&>(checked).left_operand_));
-        compareScalar(*(static_cast<const ScalarBinaryExpression&>(expected).right_operand_),
-                      *(static_cast<const ScalarBinaryExpression&>(checked).right_operand_));
-        break;
-      }
-      default:
-        FATAL_ERROR("checked is not a valid Scalar in compareScalar");
-    }
-  }
-
-  static void compareTypedValue(const Type &type,
-                                const TypedValue &expected,
-                                const TypedValue &checked) {
-    ASSERT_EQ(expected.isNull(), checked.isNull());
-
-    if (expected.isNull()) {
-      return;
-    }
-
-    switch (type.getTypeID()) {
-      case kInt:
-        EXPECT_EQ(expected.getLiteral<int>(), checked.getLiteral<int>());
-        break;
-      case kLong:
-        EXPECT_EQ(expected.getLiteral<int64_t>(), checked.getLiteral<int64_t>());
-        break;
-      case kFloat:
-        EXPECT_FLOAT_EQ(expected.getLiteral<float>(), checked.getLiteral<float>());
-        break;
-      case kDouble:
-        EXPECT_DOUBLE_EQ(expected.getLiteral<double>(), checked.getLiteral<double>());
-        break;
-      case kDatetime:
-        EXPECT_EQ(expected.getLiteral<DatetimeLit>(), checked.getLiteral<DatetimeLit>());
-        break;
-      case kDatetimeInterval:
-        EXPECT_EQ(expected.getLiteral<DatetimeIntervalLit>(), checked.getLiteral<DatetimeIntervalLit>());
-        break;
-      case kYearMonthInterval:
-        EXPECT_EQ(expected.getLiteral<YearMonthIntervalLit>(), checked.getLiteral<YearMonthIntervalLit>());
-        break;
-      case kChar:  // Fall through.
-      case kVarChar:
-        EXPECT_EQ(expected.getDataSize(), checked.getDataSize());
-        EXPECT_EQ(expected.getAsciiStringLength(), checked.getAsciiStringLength());
-        EXPECT_STREQ(static_cast<const char*>(expected.getDataPtr()),
-                     static_cast<const char*>(checked.getDataPtr()));
-        break;
-      default:
-        FATAL_ERROR("Unrecognized Type in compareTypedValue");
-    }
-  }
-
-  static void compareCatalogAttribute(const CatalogAttribute &expected, const CatalogAttribute &checked) {
-    EXPECT_EQ(expected.getID(), checked.getID());
-    EXPECT_EQ(expected.getName(), checked.getName());
-    EXPECT_TRUE(expected.getType().equals(checked.getType()));
-  }
-
-  unique_ptr<CatalogDatabase> database_;
-  // Both pointers below are owned by database_.
-  CatalogRelation *rel_numeric_, *rel_date_, *rel_string_;
-  // All pointers below are owned by relations.
-  const CatalogAttribute *attr_int_, *attr_long_, *attr_float_, *attr_double_,
-      *attr_datetime_, *attr_datetime_interval_, *attr_year_month_interval_,
-      *attr_char_, *attr_varchar_;
-};
-
-TEST_F(ScalarTest, ScalarLiteralSerializationTest) {
-  checkScalarSerialization(ScalarLiteral(TypedValue(kInt),
-                                         TypeFactory::GetType(kInt, true /* nullable */)));
-  checkScalarSerialization(ScalarLiteral(TypedValue(4),
-                                         TypeFactory::GetType(kInt, false /* nullable */)));
-
-  checkScalarSerialization(ScalarLiteral(TypedValue(kLong),
-                                         TypeFactory::GetType(kLong, true /* nullable */)));
-  checkScalarSerialization(ScalarLiteral(TypedValue(static_cast<int64_t>(9)),
-                                         TypeFactory::GetType(kLong, false /* nullable */)));
-
-  checkScalarSerialization(ScalarLiteral(TypedValue(kFloat),
-                                         TypeFactory::GetType(kFloat, true /* nullable */)));
-  checkScalarSerialization(ScalarLiteral(TypedValue(static_cast<float>(1.2)),
-                                         TypeFactory::GetType(kFloat, false /* nullable */)));
-
-  checkScalarSerialization(ScalarLiteral(TypedValue(kDouble),
-                                         TypeFactory::GetType(kDouble, true /* nullable */)));
-  checkScalarSerialization(ScalarLiteral(TypedValue(static_cast<double>(1.3)),
-                                         TypeFactory::GetType(kDouble, false /* nullable */)));
-
-  checkScalarSerialization(ScalarLiteral(TypedValue(kChar),
-                                         TypeFactory::GetType(kChar, 0, true /* nullable */)));
-  checkScalarSerialization(ScalarLiteral(TypedValue(kChar, kSampleStringShort, strlen(kSampleStringShort)+5),
-                                         TypeFactory::GetType(kChar,
-                                                              strlen(kSampleStringShort) + 5,
-                                                              false /* nullable */)));
-
-  checkScalarSerialization(ScalarLiteral(TypedValue(kVarChar),
-                                         TypeFactory::GetType(kVarChar, 0, true)));
-  checkScalarSerialization(ScalarLiteral(TypedValue(kVarChar, kSampleStringLong, strlen(kSampleStringLong)+1),
-                                         TypeFactory::GetType(kVarChar,
-                                                              strlen(kSampleStringLong),
-                                                              false /* nullable */)));
-
-  checkScalarSerialization(ScalarLiteral(TypedValue(kDatetime),
-                                         TypeFactory::GetType(kDatetime, true /* nullable */)));
-  DatetimeLit datetime;
-  datetime.ticks = static_cast<int64_t>(0xFFFFF);
-  checkScalarSerialization(ScalarLiteral(TypedValue(datetime),
-                                         TypeFactory::GetType(kDatetime, false /* nullable */)));
-
-  checkScalarSerialization(ScalarLiteral(TypedValue(kDatetimeInterval),
-                                         TypeFactory::GetType(kDatetimeInterval,
-                                                              true /* nullable */)));
-  DatetimeIntervalLit datetime_interval;
-  datetime_interval.interval_ticks = static_cast<int64_t>(0xFF);
-  checkScalarSerialization(ScalarLiteral(TypedValue(datetime_interval),
-                                         TypeFactory::GetType(kDatetimeInterval,
-                                                              false /* nullable */)));
-
-  checkScalarSerialization(ScalarLiteral(TypedValue(kYearMonthInterval),
-                                         TypeFactory::GetType(kYearMonthInterval,
-                                                              true /* nullable */)));
-  YearMonthIntervalLit year_month_interval;
-  year_month_interval.months = static_cast<int64_t>(14);
-  checkScalarSerialization(ScalarLiteral(TypedValue(year_month_interval),
-                                         TypeFactory::GetType(kYearMonthInterval,
-                                                              false /* nullable */)));
-}
-
-TEST_F(ScalarTest, ScalarAttributeSerializationTest) {
-  checkScalarSerialization(ScalarAttribute(*attr_int_));
-  checkScalarSerialization(ScalarAttribute(*attr_long_));
-  checkScalarSerialization(ScalarAttribute(*attr_float_));
-  checkScalarSerialization(ScalarAttribute(*attr_double_));
-
-  checkScalarSerialization(ScalarAttribute(*attr_datetime_));
-  checkScalarSerialization(ScalarAttribute(*attr_datetime_interval_));
-  checkScalarSerialization(ScalarAttribute(*attr_year_month_interval_));
-
-  checkScalarSerialization(ScalarAttribute(*attr_char_));
-  checkScalarSerialization(ScalarAttribute(*attr_varchar_));
-}
-
-TEST_F(ScalarTest, ScalarUnaryExpressionSerializationTest) {
-  checkScalarUnaryExpressionSerialization(UnaryOperationFactory::GetUnaryOperation(UnaryOperationID::kNegate));
-  checkScalarUnaryExpressionSerialization(NumericCastOperation::Instance(TypeFactory::GetType(kDouble)));
-}
-
-TEST_F(ScalarTest, ScalarBinaryExpressionSerializationTest) {
-  checkScalarBinaryExpressionSerialization(BinaryOperationFactory::GetBinaryOperation(BinaryOperationID::kAdd));
-  checkScalarBinaryExpressionSerialization(BinaryOperationFactory::GetBinaryOperation(BinaryOperationID::kSubtract));
-  checkScalarBinaryExpressionSerialization(BinaryOperationFactory::GetBinaryOperation(BinaryOperationID::kMultiply));
-  checkScalarBinaryExpressionSerialization(BinaryOperationFactory::GetBinaryOperation(BinaryOperationID::kDivide));
-  checkScalarBinaryExpressionSerialization(BinaryOperationFactory::GetBinaryOperation(BinaryOperationID::kModulo));
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/table_generator/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/expressions/table_generator/CMakeLists.txt b/expressions/table_generator/CMakeLists.txt
deleted file mode 100644
index 037944e..0000000
--- a/expressions/table_generator/CMakeLists.txt
+++ /dev/null
@@ -1,66 +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.
-
-QS_PROTOBUF_GENERATE_CPP(expressions_tablegenerator_GeneratorFunction_proto_srcs
-                         expressions_tablegenerator_GeneratorFunction_proto_hdrs
-                         GeneratorFunction.proto)
-
-# Declare micro-libs:
-add_library(quickstep_expressions_tablegenerator_GenerateSeries
-            ../../empty_src.cpp
-            GeneratorFunction.hpp)
-add_library(quickstep_expressions_tablegenerator_GenerateSeriesHandle
-            ../../empty_src.cpp
-            GeneratorFunctionHandle.hpp)
-add_library(quickstep_expressions_tablegenerator_GeneratorFunction
-            ../../empty_src.cpp
-            GeneratorFunction.hpp)
-add_library(quickstep_expressions_tablegenerator_GeneratorFunction_proto
-            ${expressions_tablegenerator_GeneratorFunction_proto_srcs})
-add_library(quickstep_expressions_tablegenerator_GeneratorFunctionFactory
-            GeneratorFunctionFactory.cpp
-            GeneratorFunctionFactory.hpp)
-add_library(quickstep_expressions_tablegenerator_GeneratorFunctionHandle
-            ../../empty_src.cpp
-            GeneratorFunctionHandle.hpp)
-
-# Link dependencies:
-target_link_libraries(quickstep_expressions_tablegenerator_GenerateSeries
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_expressions_tablegenerator_GenerateSeriesHandle
-                      glog
-                      quickstep_expressions_tablegenerator_GeneratorFunction_proto
-                      quickstep_types_TypedValue
-                      quickstep_types_TypedValue_proto
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_expressions_tablegenerator_GeneratorFunction
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_expressions_tablegenerator_GeneratorFunctionFactory
-                      glog
-                      quickstep_expressions_tablegenerator_GenerateSeries
-                      quickstep_expressions_tablegenerator_GeneratorFunction
-                      quickstep_expressions_tablegenerator_GeneratorFunction_proto
-                      quickstep_types_TypedValue
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_expressions_tablegenerator_GeneratorFunctionHandle
-                      quickstep_expressions_tablegenerator_GeneratorFunction_proto
-                      quickstep_types_TypedValue
-                      quickstep_types_TypedValue_proto
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_expressions_tablegenerator_GeneratorFunction_proto
-                      quickstep_types_TypedValue_proto
-                      ${PROTOBUF_LIBRARY})


[14/51] [abbrv] [partial] incubator-quickstep git commit: remove c++ files

Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/ExecutionGenerator.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/ExecutionGenerator.cpp b/query_optimizer/ExecutionGenerator.cpp
deleted file mode 100644
index 2e0d8f3..0000000
--- a/query_optimizer/ExecutionGenerator.cpp
+++ /dev/null
@@ -1,1725 +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/ExecutionGenerator.hpp"
-
-#include <algorithm>
-#include <cstddef>
-#include <memory>
-#include <string>
-#include <type_traits>
-#include <unordered_map>
-
-#include "query_optimizer/QueryOptimizerConfig.h"  // For QUICKSTEP_DISTRIBUTED.
-
-#ifdef QUICKSTEP_DISTRIBUTED
-#include <unordered_set>
-#endif
-
-#include <utility>
-#include <vector>
-
-#ifdef QUICKSTEP_DISTRIBUTED
-#include "catalog/Catalog.pb.h"
-#endif
-
-#include "catalog/CatalogAttribute.hpp"
-#include "catalog/CatalogDatabase.hpp"
-#include "catalog/CatalogRelation.hpp"
-#include "catalog/CatalogRelationSchema.hpp"
-#include "catalog/CatalogTypedefs.hpp"
-#include "expressions/Expressions.pb.h"
-#include "expressions/aggregation/AggregateFunction.hpp"
-#include "expressions/aggregation/AggregateFunction.pb.h"
-#include "expressions/predicate/Predicate.hpp"
-#include "expressions/scalar/Scalar.hpp"
-#include "expressions/scalar/ScalarAttribute.hpp"
-#include "expressions/window_aggregation/WindowAggregateFunction.hpp"
-#include "expressions/window_aggregation/WindowAggregateFunction.pb.h"
-#include "query_execution/QueryContext.hpp"
-#include "query_execution/QueryContext.pb.h"
-#include "query_optimizer/LIPFilterGenerator.hpp"
-#include "query_optimizer/OptimizerContext.hpp"
-#include "query_optimizer/QueryHandle.hpp"
-#include "query_optimizer/QueryPlan.hpp"
-#include "query_optimizer/cost_model/SimpleCostModel.hpp"
-#include "query_optimizer/cost_model/StarSchemaSimpleCostModel.hpp"
-#include "query_optimizer/expressions/AggregateFunction.hpp"
-#include "query_optimizer/expressions/Alias.hpp"
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "query_optimizer/expressions/ComparisonExpression.hpp"
-#include "query_optimizer/expressions/ExpressionType.hpp"
-#include "query_optimizer/expressions/PatternMatcher.hpp"
-#include "query_optimizer/expressions/Scalar.hpp"
-#include "query_optimizer/expressions/ScalarLiteral.hpp"
-#include "query_optimizer/expressions/WindowAggregateFunction.hpp"
-#include "query_optimizer/physical/CopyFrom.hpp"
-#include "query_optimizer/physical/CreateIndex.hpp"
-#include "query_optimizer/physical/CreateTable.hpp"
-#include "query_optimizer/physical/DeleteTuples.hpp"
-#include "query_optimizer/physical/DropTable.hpp"
-#include "query_optimizer/physical/HashJoin.hpp"
-#include "query_optimizer/physical/InsertSelection.hpp"
-#include "query_optimizer/physical/InsertTuple.hpp"
-#include "query_optimizer/physical/LIPFilterConfiguration.hpp"
-#include "query_optimizer/physical/NestedLoopsJoin.hpp"
-#include "query_optimizer/physical/PatternMatcher.hpp"
-#include "query_optimizer/physical/Physical.hpp"
-#include "query_optimizer/physical/PhysicalType.hpp"
-#include "query_optimizer/physical/Sample.hpp"
-#include "query_optimizer/physical/Selection.hpp"
-#include "query_optimizer/physical/SharedSubplanReference.hpp"
-#include "query_optimizer/physical/Sort.hpp"
-#include "query_optimizer/physical/TableGenerator.hpp"
-#include "query_optimizer/physical/TableReference.hpp"
-#include "query_optimizer/physical/TopLevelPlan.hpp"
-#include "query_optimizer/physical/UpdateTable.hpp"
-#include "query_optimizer/physical/WindowAggregate.hpp"
-#include "relational_operators/AggregationOperator.hpp"
-#include "relational_operators/BuildHashOperator.hpp"
-#include "relational_operators/CreateIndexOperator.hpp"
-#include "relational_operators/CreateTableOperator.hpp"
-#include "relational_operators/DeleteOperator.hpp"
-#include "relational_operators/DestroyAggregationStateOperator.hpp"
-#include "relational_operators/DestroyHashOperator.hpp"
-#include "relational_operators/DropTableOperator.hpp"
-#include "relational_operators/FinalizeAggregationOperator.hpp"
-#include "relational_operators/HashJoinOperator.hpp"
-#include "relational_operators/InsertOperator.hpp"
-#include "relational_operators/NestedLoopsJoinOperator.hpp"
-#include "relational_operators/RelationalOperator.hpp"
-#include "relational_operators/SampleOperator.hpp"
-#include "relational_operators/SaveBlocksOperator.hpp"
-#include "relational_operators/SelectOperator.hpp"
-#include "relational_operators/SortMergeRunOperator.hpp"
-#include "relational_operators/SortRunGenerationOperator.hpp"
-#include "relational_operators/TableGeneratorOperator.hpp"
-#include "relational_operators/TextScanOperator.hpp"
-#include "relational_operators/UpdateOperator.hpp"
-#include "relational_operators/WindowAggregationOperator.hpp"
-#include "storage/AggregationOperationState.pb.h"
-#include "storage/HashTable.pb.h"
-#include "storage/HashTableFactory.hpp"
-#include "storage/InsertDestination.pb.h"
-#include "storage/StorageBlockLayout.hpp"
-#include "storage/StorageBlockLayout.pb.h"
-#include "storage/SubBlockTypeRegistry.hpp"
-#include "types/Type.hpp"
-#include "types/Type.pb.h"
-#include "types/TypedValue.hpp"
-#include "types/TypedValue.pb.h"
-#include "types/containers/Tuple.pb.h"
-#include "utility/SqlError.hpp"
-
-#include "gflags/gflags.h"
-#include "glog/logging.h"
-
-using std::move;
-using std::static_pointer_cast;
-using std::unique_ptr;
-using std::unordered_map;
-using std::vector;
-
-namespace quickstep {
-namespace optimizer {
-
-DEFINE_string(join_hashtable_type, "SeparateChaining",
-              "HashTable implementation to use for hash joins (valid options "
-              "are SeparateChaining or LinearOpenAddressing)");
-static const volatile bool join_hashtable_type_dummy
-    = gflags::RegisterFlagValidator(&FLAGS_join_hashtable_type,
-                                    &ValidateHashTableImplTypeString);
-
-DEFINE_string(aggregate_hashtable_type, "SeparateChaining",
-              "HashTable implementation to use for aggregates with GROUP BY "
-              "(valid options are SeparateChaining or LinearOpenAddressing)");
-static const volatile bool aggregate_hashtable_type_dummy
-    = gflags::RegisterFlagValidator(&FLAGS_aggregate_hashtable_type,
-                                    &ValidateHashTableImplTypeString);
-
-DEFINE_bool(parallelize_load, true, "Parallelize loading data files.");
-
-namespace E = ::quickstep::optimizer::expressions;
-namespace P = ::quickstep::optimizer::physical;
-namespace S = ::quickstep::serialization;
-
-constexpr QueryPlan::DAGNodeIndex ExecutionGenerator::CatalogRelationInfo::kInvalidOperatorIndex;
-
-void ExecutionGenerator::generatePlan(const P::PhysicalPtr &physical_plan) {
-  CHECK(P::SomeTopLevelPlan::MatchesWithConditionalCast(physical_plan, &top_level_physical_plan_))
-      << "The physical plan must be rooted by a TopLevelPlan";
-
-  cost_model_for_aggregation_.reset(
-      new cost::StarSchemaSimpleCostModel(top_level_physical_plan_->shared_subplans()));
-  cost_model_for_hash_join_.reset(
-      new cost::SimpleCostModel(top_level_physical_plan_->shared_subplans()));
-
-  const auto &lip_filter_configuration =
-      top_level_physical_plan_->lip_filter_configuration();
-  if (lip_filter_configuration != nullptr) {
-    lip_filter_generator_.reset(new LIPFilterGenerator(lip_filter_configuration));
-  }
-
-  const CatalogRelation *result_relation = nullptr;
-
-  try {
-    for (const P::PhysicalPtr &shared_subplan : top_level_physical_plan_->shared_subplans()) {
-      generatePlanInternal(shared_subplan);
-    }
-    generatePlanInternal(top_level_physical_plan_->plan());
-
-    // Deploy LIPFilters if enabled.
-    if (lip_filter_generator_ != nullptr) {
-      lip_filter_generator_->deployLIPFilters(execution_plan_, query_context_proto_);
-    }
-
-    // Set the query result relation if the input plan exists in physical_to_execution_map_,
-    // which indicates the plan is the result of a SELECT query.
-    const std::unordered_map<P::PhysicalPtr, CatalogRelationInfo>::const_iterator it =
-        physical_to_output_relation_map_.find(top_level_physical_plan_->plan());
-    if (it != physical_to_output_relation_map_.end()) {
-      result_relation = it->second.relation;
-    }
-  } catch (...) {
-    // Drop all temporary relations.
-    dropAllTemporaryRelations();
-    throw;
-  }
-
-  // Add one DropTableOperator per temporary relation, except for the result relation, if any.
-  // NOTE(zuyu): the Cli shell drops the result relation after printing, if enabled.
-  for (const CatalogRelationInfo &temporary_relation_info : temporary_relation_info_vec_) {
-    const CatalogRelation *temporary_relation = temporary_relation_info.relation;
-    if (temporary_relation == result_relation) {
-      query_handle_->setQueryResultRelation(
-          catalog_database_->getRelationByIdMutable(result_relation->getID()));
-      continue;
-    }
-    const QueryPlan::DAGNodeIndex drop_table_index =
-        execution_plan_->addRelationalOperator(
-            new DropTableOperator(query_handle_->query_id(),
-                                  *temporary_relation,
-                                  catalog_database_,
-                                  false /* only_drop_blocks */));
-    DCHECK(!temporary_relation_info.isStoredRelation());
-    execution_plan_->addDependenciesForDropOperator(
-        drop_table_index,
-        temporary_relation_info.producer_operator_index);
-  }
-
-#ifdef QUICKSTEP_DISTRIBUTED
-  catalog_database_cache_proto_->set_name(catalog_database_->getName());
-
-  LOG(INFO) << "CatalogDatabaseCache proto has " << referenced_relation_ids_.size() << " relation(s)";
-  for (const relation_id rel_id : referenced_relation_ids_) {
-    const CatalogRelationSchema &relation =
-        catalog_database_->getRelationSchemaById(rel_id);
-    LOG(INFO) << "RelationSchema " << rel_id
-              << ", name: " << relation.getName()
-              << ", " << relation.size()  << " attribute(s)";
-    catalog_database_cache_proto_->add_relations()->MergeFrom(relation.getProto());
-  }
-#endif
-}
-
-void ExecutionGenerator::generatePlanInternal(
-    const P::PhysicalPtr &physical_plan) {
-  // Generate the execution plan in bottom-up.
-  for (const P::PhysicalPtr &child : physical_plan->children()) {
-    generatePlanInternal(child);
-  }
-
-  // If enabled, collect attribute substitution map for LIPFilterGenerator.
-  if (lip_filter_generator_ != nullptr) {
-    lip_filter_generator_->registerAttributeMap(physical_plan, attribute_substitution_map_);
-  }
-
-  switch (physical_plan->getPhysicalType()) {
-    case P::PhysicalType::kAggregate:
-      return convertAggregate(
-          std::static_pointer_cast<const P::Aggregate>(physical_plan));
-    case P::PhysicalType::kCopyFrom:
-      return convertCopyFrom(
-          std::static_pointer_cast<const P::CopyFrom>(physical_plan));
-    case P::PhysicalType::kCreateIndex:
-      return convertCreateIndex(
-          std::static_pointer_cast<const P::CreateIndex>(physical_plan));
-    case P::PhysicalType::kCreateTable:
-      return convertCreateTable(
-          std::static_pointer_cast<const P::CreateTable>(physical_plan));
-    case P::PhysicalType::kDeleteTuples:
-      return convertDeleteTuples(
-          std::static_pointer_cast<const P::DeleteTuples>(physical_plan));
-    case P::PhysicalType::kDropTable:
-      return convertDropTable(
-          std::static_pointer_cast<const P::DropTable>(physical_plan));
-    case P::PhysicalType::kHashJoin:
-      return convertHashJoin(
-          std::static_pointer_cast<const P::HashJoin>(physical_plan));
-    case P::PhysicalType::kInsertSelection:
-      return convertInsertSelection(
-          std::static_pointer_cast<const P::InsertSelection>(physical_plan));
-    case P::PhysicalType::kInsertTuple:
-      return convertInsertTuple(
-          std::static_pointer_cast<const P::InsertTuple>(physical_plan));
-    case P::PhysicalType::kNestedLoopsJoin:
-      return convertNestedLoopsJoin(
-          std::static_pointer_cast<const P::NestedLoopsJoin>(physical_plan));
-    case P::PhysicalType::kSample:
-      return convertSample(
-          std::static_pointer_cast<const P::Sample>(physical_plan));
-    case P::PhysicalType::kSelection:
-      return convertSelection(
-          std::static_pointer_cast<const P::Selection>(physical_plan));
-    case P::PhysicalType::kSharedSubplanReference:
-      return convertSharedSubplanReference(
-          std::static_pointer_cast<const P::SharedSubplanReference>(physical_plan));
-    case P::PhysicalType::kSort:
-      return convertSort(
-          std::static_pointer_cast<const P::Sort>(physical_plan));
-    case P::PhysicalType::kTableGenerator:
-      return convertTableGenerator(
-          std::static_pointer_cast<const P::TableGenerator>(physical_plan));
-    case P::PhysicalType::kTableReference:
-      return convertTableReference(
-          std::static_pointer_cast<const P::TableReference>(physical_plan));
-    case P::PhysicalType::kUpdateTable:
-      return convertUpdateTable(
-          std::static_pointer_cast<const P::UpdateTable>(physical_plan));
-    case P::PhysicalType::kWindowAggregate:
-      return convertWindowAggregate(
-          std::static_pointer_cast<const P::WindowAggregate>(physical_plan));
-    default:
-      LOG(FATAL) << "Unknown physical plan node "
-                 << physical_plan->getShortString();
-  }
-}
-
-std::string ExecutionGenerator::getNewRelationName() {
-  std::ostringstream out;
-  out << OptimizerContext::kInternalTemporaryRelationNamePrefix
-      << query_handle_->query_id() << "_" << rel_id_;
-  ++rel_id_;
-  return out.str();
-}
-
-void ExecutionGenerator::createTemporaryCatalogRelation(
-    const P::PhysicalPtr &physical,
-    const CatalogRelation **catalog_relation_output,
-    S::InsertDestination *insert_destination_proto) {
-  std::unique_ptr<CatalogRelation> catalog_relation(
-      new CatalogRelation(catalog_database_,
-                          getNewRelationName(),
-                          -1 /* id */,
-                          true /* is_temporary*/));
-  attribute_id aid = 0;
-  for (const E::NamedExpressionPtr &project_expression :
-       physical->getOutputAttributes()) {
-    // The attribute name is simply set to the attribute id to make it distinct.
-    std::unique_ptr<CatalogAttribute> catalog_attribute(
-        new CatalogAttribute(catalog_relation.get(),
-                             std::to_string(aid),
-                             project_expression->getValueType(),
-                             aid,
-                             project_expression->attribute_alias()));
-    attribute_substitution_map_[project_expression->id()] =
-        catalog_attribute.get();
-    catalog_relation->addAttribute(catalog_attribute.release());
-    ++aid;
-  }
-
-  *catalog_relation_output = catalog_relation.get();
-  const relation_id output_rel_id = catalog_database_->addRelation(
-      catalog_relation.release());
-
-#ifdef QUICKSTEP_DISTRIBUTED
-  referenced_relation_ids_.insert(output_rel_id);
-#endif
-
-  insert_destination_proto->set_insert_destination_type(S::InsertDestinationType::BLOCK_POOL);
-  insert_destination_proto->set_relation_id(output_rel_id);
-}
-
-void ExecutionGenerator::dropAllTemporaryRelations() {
-  for (const CatalogRelationInfo &temporary_relation_info :
-       temporary_relation_info_vec_) {
-    DCHECK_EQ(temporary_relation_info.relation->size_blocks(), 0u);
-    catalog_database_->dropRelationById(temporary_relation_info.relation->getID());
-  }
-}
-
-void ExecutionGenerator::convertNamedExpressions(
-    const std::vector<E::NamedExpressionPtr> &named_expressions,
-    S::QueryContext::ScalarGroup *scalar_group_proto) {
-  for (const E::NamedExpressionPtr &project_expression : named_expressions) {
-    unique_ptr<const Scalar> execution_scalar;
-    E::AliasPtr alias;
-    if (E::SomeAlias::MatchesWithConditionalCast(project_expression, &alias)) {
-      E::ScalarPtr scalar;
-      // We have not added aggregate expressions yet,
-      // so all child expressions of an Alias should be a Scalar.
-      CHECK(E::SomeScalar::MatchesWithConditionalCast(alias->expression(), &scalar))
-          << alias->toString();
-      execution_scalar.reset(scalar->concretize(attribute_substitution_map_));
-    } else {
-      execution_scalar.reset(project_expression->concretize(attribute_substitution_map_));
-    }
-
-    scalar_group_proto->add_scalars()->CopyFrom(execution_scalar->getProto());
-  }
-}
-
-Predicate* ExecutionGenerator::convertPredicate(
-    const expressions::PredicatePtr &optimizer_predicate) const {
-  return optimizer_predicate->concretize(attribute_substitution_map_);
-}
-
-void ExecutionGenerator::convertTableReference(
-    const P::TableReferencePtr &physical_table_reference) {
-  // TableReference is not converted to an execution operator;
-  // instead it just provides CatalogRelation info for its
-  // parent (e.g. the substitution map from an AttributeReference
-  // to a CatalogAttribute).
-  const CatalogRelation *catalog_relation = physical_table_reference->relation();
-
-#ifdef QUICKSTEP_DISTRIBUTED
-  referenced_relation_ids_.insert(catalog_relation->getID());
-#endif
-
-  const std::vector<E::AttributeReferencePtr> &attribute_references =
-      physical_table_reference->attribute_list();
-  DCHECK_EQ(attribute_references.size(), catalog_relation->size());
-
-  for (CatalogRelation::size_type i = 0; i < catalog_relation->size(); ++i) {
-    attribute_substitution_map_.emplace(attribute_references[i]->id(),
-                                        catalog_relation->getAttributeById(i));
-  }
-  physical_to_output_relation_map_.emplace(
-      std::piecewise_construct,
-      std::forward_as_tuple(physical_table_reference),
-      std::forward_as_tuple(CatalogRelationInfo::kInvalidOperatorIndex,
-                            catalog_relation));
-}
-
-void ExecutionGenerator::convertSample(const P::SamplePtr &physical_sample) {
-  // Create InsertDestination proto.
-  const CatalogRelation *output_relation = nullptr;
-  const QueryContext::insert_destination_id insert_destination_index =
-      query_context_proto_->insert_destinations_size();
-  S::InsertDestination *insert_destination_proto =
-      query_context_proto_->add_insert_destinations();
-  createTemporaryCatalogRelation(physical_sample,
-                                 &output_relation,
-                                 insert_destination_proto);
-
-  // Create and add a Sample operator.
-  const CatalogRelationInfo *input_relation_info =
-      findRelationInfoOutputByPhysical(physical_sample->input());
-  DCHECK(input_relation_info != nullptr);
-
-  SampleOperator *sample_op =
-      new SampleOperator(query_handle_->query_id(),
-                         *input_relation_info->relation,
-                         *output_relation,
-                         insert_destination_index,
-                         input_relation_info->isStoredRelation(),
-                         physical_sample->is_block_sample(),
-                         physical_sample->percentage());
-  const QueryPlan::DAGNodeIndex sample_index =
-      execution_plan_->addRelationalOperator(sample_op);
-  insert_destination_proto->set_relational_op_index(sample_index);
-
-  if (!input_relation_info->isStoredRelation()) {
-    execution_plan_->addDirectDependency(sample_index,
-                                         input_relation_info->producer_operator_index,
-                                         false /* is_pipeline_breaker */);
-  }
-  physical_to_output_relation_map_.emplace(
-      std::piecewise_construct,
-      std::forward_as_tuple(physical_sample),
-      std::forward_as_tuple(sample_index,
-                            output_relation));
-  temporary_relation_info_vec_.emplace_back(sample_index, output_relation);
-}
-
-bool ExecutionGenerator::convertSimpleProjection(
-    const QueryContext::scalar_group_id project_expressions_group_index,
-    std::vector<attribute_id> *attributes) const {
-  const S::QueryContext::ScalarGroup &scalar_group_proto =
-      query_context_proto_->scalar_groups(project_expressions_group_index);
-
-  for (int i = 0; i < scalar_group_proto.scalars_size(); ++i) {
-    if (scalar_group_proto.scalars(i).data_source() != S::Scalar::ATTRIBUTE) {
-      return false;
-    }
-  }
-
-  for (int i = 0; i < scalar_group_proto.scalars_size(); ++i) {
-    attributes->push_back(
-      scalar_group_proto.scalars(i).GetExtension(S::ScalarAttribute::attribute_id));
-  }
-
-  return true;
-}
-
-void ExecutionGenerator::convertSelection(
-    const P::SelectionPtr &physical_selection) {
-  // Check if the Selection is only for renaming columns.
-  if (physical_selection->filter_predicate() == nullptr) {
-    const std::vector<E::AttributeReferencePtr> input_attributes =
-        physical_selection->input()->getOutputAttributes();
-    const std::vector<E::NamedExpressionPtr> &project_expressions =
-        physical_selection->project_expressions();
-    if (project_expressions.size() == input_attributes.size()) {
-      bool has_different_attrs = false;
-      for (std::size_t attr_idx = 0; attr_idx < input_attributes.size(); ++attr_idx) {
-        if (project_expressions[attr_idx]->id() != input_attributes[attr_idx]->id()) {
-          has_different_attrs = true;
-          break;
-        }
-      }
-      if (!has_different_attrs) {
-        const std::unordered_map<P::PhysicalPtr, CatalogRelationInfo>::const_iterator input_catalog_rel_it =
-            physical_to_output_relation_map_.find(physical_selection->input());
-        DCHECK(input_catalog_rel_it != physical_to_output_relation_map_.end());
-        if (!input_catalog_rel_it->second.isStoredRelation()) {
-          CatalogRelation *catalog_relation =
-              const_cast<CatalogRelation*>(input_catalog_rel_it->second.relation);
-          for (std::size_t attr_idx = 0; attr_idx < project_expressions.size(); ++attr_idx) {
-            CatalogAttribute *catalog_attribute =
-                catalog_relation->getAttributeByIdMutable(attr_idx);
-            DCHECK(catalog_attribute != nullptr);
-            catalog_attribute->setDisplayName(
-                project_expressions[attr_idx]->attribute_alias());
-          }
-          physical_to_output_relation_map_.emplace(physical_selection,
-                                                   input_catalog_rel_it->second);
-          return;
-        }
-      }
-    }
-  }
-
-  // Convert the project expressions proto.
-  const QueryContext::scalar_group_id project_expressions_group_index =
-      query_context_proto_->scalar_groups_size();
-  convertNamedExpressions(physical_selection->project_expressions(),
-                          query_context_proto_->add_scalar_groups());
-
-  // Convert the predicate proto.
-  QueryContext::predicate_id execution_predicate_index = QueryContext::kInvalidPredicateId;
-  if (physical_selection->filter_predicate()) {
-    execution_predicate_index = query_context_proto_->predicates_size();
-
-    unique_ptr<const Predicate> execution_predicate(convertPredicate(physical_selection->filter_predicate()));
-    query_context_proto_->add_predicates()->CopyFrom(execution_predicate->getProto());
-  }
-
-  // Create InsertDestination proto.
-  const CatalogRelation *output_relation = nullptr;
-  const QueryContext::insert_destination_id insert_destination_index =
-      query_context_proto_->insert_destinations_size();
-  S::InsertDestination *insert_destination_proto = query_context_proto_->add_insert_destinations();
-  createTemporaryCatalogRelation(physical_selection,
-                                 &output_relation,
-                                 insert_destination_proto);
-
-  // Create and add a Select operator.
-  const CatalogRelationInfo *input_relation_info =
-      findRelationInfoOutputByPhysical(physical_selection->input());
-  DCHECK(input_relation_info != nullptr);
-
-  // Use the "simple" form of the selection operator (a pure projection that
-  // doesn't require any expression evaluation or intermediate copies) if
-  // possible.
-  std::vector<attribute_id> attributes;
-  SelectOperator *op =
-      convertSimpleProjection(project_expressions_group_index, &attributes)
-          ? new SelectOperator(query_handle_->query_id(),
-                               *input_relation_info->relation,
-                               *output_relation,
-                               insert_destination_index,
-                               execution_predicate_index,
-                               move(attributes),
-                               input_relation_info->isStoredRelation())
-          : new SelectOperator(query_handle_->query_id(),
-                               *input_relation_info->relation,
-                               *output_relation,
-                               insert_destination_index,
-                               execution_predicate_index,
-                               project_expressions_group_index,
-                               input_relation_info->isStoredRelation());
-
-  const QueryPlan::DAGNodeIndex select_index =
-      execution_plan_->addRelationalOperator(op);
-  insert_destination_proto->set_relational_op_index(select_index);
-
-  if (!input_relation_info->isStoredRelation()) {
-    execution_plan_->addDirectDependency(select_index,
-                                         input_relation_info->producer_operator_index,
-                                         false /* is_pipeline_breaker */);
-  }
-  physical_to_output_relation_map_.emplace(
-      std::piecewise_construct,
-      std::forward_as_tuple(physical_selection),
-      std::forward_as_tuple(select_index,
-                            output_relation));
-  temporary_relation_info_vec_.emplace_back(select_index, output_relation);
-
-  if (lip_filter_generator_ != nullptr) {
-    lip_filter_generator_->addSelectionInfo(physical_selection, select_index);
-  }
-}
-
-void ExecutionGenerator::convertSharedSubplanReference(const physical::SharedSubplanReferencePtr &physical_plan) {
-  const std::unordered_map<physical::PhysicalPtr, CatalogRelationInfo>::const_iterator found_it =
-      physical_to_output_relation_map_.find(
-          top_level_physical_plan_->shared_subplan_at(physical_plan->subplan_id()));
-  if (found_it != physical_to_output_relation_map_.end()) {
-    physical_to_output_relation_map_.emplace(physical_plan, found_it->second);
-
-    // Propagate the (ExprId -> CatalogAttribute) mapping.
-    const std::vector<E::AttributeReferencePtr> &referenced_attributes =
-        physical_plan->referenced_attributes();
-    const std::vector<E::AttributeReferencePtr> &output_attributes =
-        physical_plan->output_attributes();
-    for (std::size_t i = 0; i < referenced_attributes.size(); ++i) {
-      attribute_substitution_map_[output_attributes[i]->id()] =
-          attribute_substitution_map_[referenced_attributes[i]->id()];
-    }
-  }
-}
-
-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();
-
-  std::vector<attribute_id> probe_attribute_ids;
-  std::vector<attribute_id> build_attribute_ids;
-
-  std::size_t build_cardinality =
-      cost_model_for_hash_join_->estimateCardinality(build_physical);
-
-  bool any_probe_attributes_nullable = false;
-  bool any_build_attributes_nullable = false;
-
-  const std::vector<E::AttributeReferencePtr> &left_join_attributes =
-      physical_plan->left_join_attributes();
-  for (const E::AttributeReferencePtr &left_join_attribute : left_join_attributes) {
-    const CatalogAttribute *probe_catalog_attribute
-        = attribute_substitution_map_[left_join_attribute->id()];
-    probe_attribute_ids.emplace_back(probe_catalog_attribute->getID());
-
-    if (probe_catalog_attribute->getType().isNullable()) {
-      any_probe_attributes_nullable = true;
-    }
-  }
-
-  const std::vector<E::AttributeReferencePtr> &right_join_attributes =
-      physical_plan->right_join_attributes();
-  for (const E::AttributeReferencePtr &right_join_attribute : right_join_attributes) {
-    const CatalogAttribute *build_catalog_attribute
-        = attribute_substitution_map_[right_join_attribute->id()];
-    build_attribute_ids.emplace_back(build_catalog_attribute->getID());
-
-    if (build_catalog_attribute->getType().isNullable()) {
-      any_build_attributes_nullable = true;
-    }
-  }
-
-  // Remember key types for call to SimplifyHashTableImplTypeProto() below.
-  std::vector<const Type*> key_types;
-  for (std::vector<E::AttributeReferencePtr>::size_type attr_idx = 0;
-       attr_idx < left_join_attributes.size();
-       ++attr_idx) {
-    const Type &left_attribute_type = left_join_attributes[attr_idx]->getValueType();
-    const Type &right_attribute_type = right_join_attributes[attr_idx]->getValueType();
-    if (left_attribute_type.getTypeID() != right_attribute_type.getTypeID()) {
-      THROW_SQL_ERROR() << "Equality join predicate between two attributes of different types "
-                           "is not allowed in HashJoin";
-    }
-    key_types.push_back(&left_attribute_type);
-  }
-
-  // Convert the residual predicate proto.
-  QueryContext::predicate_id residual_predicate_index = QueryContext::kInvalidPredicateId;
-  if (physical_plan->residual_predicate()) {
-    residual_predicate_index = query_context_proto_->predicates_size();
-
-    unique_ptr<const Predicate> residual_predicate(convertPredicate(physical_plan->residual_predicate()));
-    query_context_proto_->add_predicates()->CopyFrom(residual_predicate->getProto());
-  }
-
-  // Convert the project expressions proto.
-  const QueryContext::scalar_group_id project_expressions_group_index =
-      query_context_proto_->scalar_groups_size();
-  convertNamedExpressions(physical_plan->project_expressions(),
-                          query_context_proto_->add_scalar_groups());
-
-  const CatalogRelationInfo *build_relation_info =
-      findRelationInfoOutputByPhysical(build_physical);
-  const CatalogRelationInfo *probe_operator_info =
-      findRelationInfoOutputByPhysical(probe_physical);
-
-  // Create a vector that indicates whether each project expression is using
-  // attributes from the build relation as input. This information is required
-  // by the current implementation of hash left outer join
-  std::unique_ptr<std::vector<bool>> is_selection_on_build;
-  if (physical_plan->join_type() == P::HashJoin::JoinType::kLeftOuterJoin) {
-    is_selection_on_build.reset(
-        new std::vector<bool>(
-            E::MarkExpressionsReferingAnyAttribute(
-                physical_plan->project_expressions(),
-                build_physical->getOutputAttributes())));
-  }
-
-  // FIXME(quickstep-team): Add support for self-join.
-  if (build_relation_info->relation == probe_operator_info->relation) {
-    THROW_SQL_ERROR() << "Self-join is not supported";
-  }
-
-  // Create join hash table proto.
-  const QueryContext::join_hash_table_id join_hash_table_index =
-      query_context_proto_->join_hash_tables_size();
-  S::HashTable *hash_table_proto = query_context_proto_->add_join_hash_tables();
-
-  // SimplifyHashTableImplTypeProto() switches the hash table implementation
-  // from SeparateChaining to SimpleScalarSeparateChaining when there is a
-  // single scalar key type with a reversible hash function.
-  hash_table_proto->set_hash_table_impl_type(
-      SimplifyHashTableImplTypeProto(
-          HashTableImplTypeProtoFromString(FLAGS_join_hashtable_type),
-          key_types));
-
-  const CatalogRelationSchema *build_relation = build_relation_info->relation;
-  for (const attribute_id build_attribute : build_attribute_ids) {
-    hash_table_proto->add_key_types()->CopyFrom(
-        build_relation->getAttributeById(build_attribute)->getType().getProto());
-  }
-
-  hash_table_proto->set_estimated_num_entries(build_cardinality);
-
-  // Create three operators.
-  const QueryPlan::DAGNodeIndex build_operator_index =
-      execution_plan_->addRelationalOperator(
-          new BuildHashOperator(
-              query_handle_->query_id(),
-              *build_relation_info->relation,
-              build_relation_info->isStoredRelation(),
-              build_attribute_ids,
-              any_build_attributes_nullable,
-              join_hash_table_index));
-
-  // Create InsertDestination proto.
-  const CatalogRelation *output_relation = nullptr;
-  const QueryContext::insert_destination_id insert_destination_index =
-      query_context_proto_->insert_destinations_size();
-  S::InsertDestination *insert_destination_proto = query_context_proto_->add_insert_destinations();
-  createTemporaryCatalogRelation(physical_plan,
-                                 &output_relation,
-                                 insert_destination_proto);
-
-  // Get JoinType
-  HashJoinOperator::JoinType join_type;
-  switch (physical_plan->join_type()) {
-    case P::HashJoin::JoinType::kInnerJoin:
-      join_type = HashJoinOperator::JoinType::kInnerJoin;
-      break;
-    case P::HashJoin::JoinType::kLeftSemiJoin:
-      join_type = HashJoinOperator::JoinType::kLeftSemiJoin;
-      break;
-    case P::HashJoin::JoinType::kLeftAntiJoin:
-      join_type = HashJoinOperator::JoinType::kLeftAntiJoin;
-      break;
-    case P::HashJoin::JoinType::kLeftOuterJoin:
-      join_type = HashJoinOperator::JoinType::kLeftOuterJoin;
-      break;
-    default:
-      LOG(FATAL) << "Invalid physical::HashJoin::JoinType: "
-                 << static_cast<typename std::underlying_type<P::HashJoin::JoinType>::type>(
-                        physical_plan->join_type());
-  }
-
-  // Create hash join operator
-  const QueryPlan::DAGNodeIndex join_operator_index =
-      execution_plan_->addRelationalOperator(
-          new HashJoinOperator(
-              query_handle_->query_id(),
-              *build_relation_info->relation,
-              *probe_operator_info->relation,
-              probe_operator_info->isStoredRelation(),
-              probe_attribute_ids,
-              any_probe_attributes_nullable,
-              *output_relation,
-              insert_destination_index,
-              join_hash_table_index,
-              residual_predicate_index,
-              project_expressions_group_index,
-              is_selection_on_build.get(),
-              join_type));
-  insert_destination_proto->set_relational_op_index(join_operator_index);
-
-  const QueryPlan::DAGNodeIndex destroy_operator_index =
-      execution_plan_->addRelationalOperator(new DestroyHashOperator(
-          query_handle_->query_id(), join_hash_table_index));
-
-  if (!build_relation_info->isStoredRelation()) {
-    execution_plan_->addDirectDependency(build_operator_index,
-                                         build_relation_info->producer_operator_index,
-                                         false /* is_pipeline_breaker */);
-    // Add the dependency for the producer operator of the build relation
-    // to prevent the build relation from being destroyed until after the join
-    // is complete (see QueryPlan::addDependenciesForDropOperator(), which
-    // makes the drop operator for the temporary relation dependent on all its
-    // consumers having finished).
-    execution_plan_->addDirectDependency(join_operator_index,
-                                         build_relation_info->producer_operator_index,
-                                         true /* is_pipeline_breaker */);
-  }
-  if (!probe_operator_info->isStoredRelation()) {
-    execution_plan_->addDirectDependency(join_operator_index,
-                                         probe_operator_info->producer_operator_index,
-                                         false /* is_pipeline_breaker */);
-  }
-  execution_plan_->addDirectDependency(join_operator_index,
-                                       build_operator_index,
-                                       true /* is_pipeline_breaker */);
-  execution_plan_->addDirectDependency(destroy_operator_index,
-                                       join_operator_index,
-                                       true /* is_pipeline_breaker */);
-
-  physical_to_output_relation_map_.emplace(
-      std::piecewise_construct,
-      std::forward_as_tuple(physical_plan),
-      std::forward_as_tuple(join_operator_index,
-                            output_relation));
-  temporary_relation_info_vec_.emplace_back(join_operator_index, output_relation);
-
-  if (lip_filter_generator_ != nullptr) {
-    lip_filter_generator_->addHashJoinInfo(physical_plan,
-                                           build_operator_index,
-                                           join_operator_index);
-  }
-}
-
-void ExecutionGenerator::convertNestedLoopsJoin(
-    const P::NestedLoopsJoinPtr &physical_plan) {
-  // NestedLoopsJoin is converted to a NestedLoopsJoin operator.
-
-  // Convert the join predicate proto.
-  const QueryContext::predicate_id execution_join_predicate_index = query_context_proto_->predicates_size();
-  if (physical_plan->join_predicate()) {
-    unique_ptr<const Predicate> execution_join_predicate(convertPredicate(physical_plan->join_predicate()));
-    query_context_proto_->add_predicates()->CopyFrom(execution_join_predicate->getProto());
-  } else {
-    query_context_proto_->add_predicates()->set_predicate_type(S::Predicate::TRUE);
-  }
-
-  // Convert the project expressions proto.
-  const QueryContext::scalar_group_id project_expressions_group_index =
-      query_context_proto_->scalar_groups_size();
-  convertNamedExpressions(physical_plan->project_expressions(),
-                          query_context_proto_->add_scalar_groups());
-
-  const CatalogRelationInfo *left_relation_info =
-      findRelationInfoOutputByPhysical(physical_plan->left());
-  const CatalogRelationInfo *right_relation_info =
-      findRelationInfoOutputByPhysical(physical_plan->right());
-
-  // FIXME(quickstep-team): Add support for self-join.
-  if (left_relation_info->relation == right_relation_info->relation) {
-    THROW_SQL_ERROR() << "NestedLoopsJoin does not support self-join yet";
-  }
-
-  // Create InsertDestination proto.
-  const CatalogRelation *output_relation = nullptr;
-  const QueryContext::insert_destination_id insert_destination_index =
-      query_context_proto_->insert_destinations_size();
-  S::InsertDestination *insert_destination_proto = query_context_proto_->add_insert_destinations();
-  createTemporaryCatalogRelation(physical_plan,
-                                 &output_relation,
-                                 insert_destination_proto);
-
-  // Create and add a NestedLoopsJoin operator.
-  const QueryPlan::DAGNodeIndex join_operator_index =
-      execution_plan_->addRelationalOperator(
-          new NestedLoopsJoinOperator(query_handle_->query_id(),
-                                      *left_relation_info->relation,
-                                      *right_relation_info->relation,
-                                      *output_relation,
-                                      insert_destination_index,
-                                      execution_join_predicate_index,
-                                      project_expressions_group_index,
-                                      left_relation_info->isStoredRelation(),
-                                      right_relation_info->isStoredRelation()));
-  insert_destination_proto->set_relational_op_index(join_operator_index);
-
-  if (!left_relation_info->isStoredRelation()) {
-    execution_plan_->addDirectDependency(join_operator_index,
-                                         left_relation_info->producer_operator_index,
-                                         false /* is_pipeline_breaker */);
-  }
-  if (!right_relation_info->isStoredRelation()) {
-    execution_plan_->addDirectDependency(join_operator_index,
-                                         right_relation_info->producer_operator_index,
-                                         false /* is_pipeline_breaker */);
-  }
-
-  physical_to_output_relation_map_.emplace(
-      std::piecewise_construct,
-      std::forward_as_tuple(physical_plan),
-      std::forward_as_tuple(join_operator_index,
-                            output_relation));
-  temporary_relation_info_vec_.emplace_back(join_operator_index, output_relation);
-}
-
-void ExecutionGenerator::convertCopyFrom(
-    const P::CopyFromPtr &physical_plan) {
-  // CopyFrom is converted to a TextScan and a SaveBlocks.
-
-  const CatalogRelation *output_relation = physical_plan->catalog_relation();
-
-  // Create InsertDestination proto.
-  const QueryContext::insert_destination_id insert_destination_index =
-      query_context_proto_->insert_destinations_size();
-  S::InsertDestination *insert_destination_proto = query_context_proto_->add_insert_destinations();
-
-  insert_destination_proto->set_insert_destination_type(S::InsertDestinationType::BLOCK_POOL);
-  insert_destination_proto->set_relation_id(output_relation->getID());
-  insert_destination_proto->mutable_layout()->MergeFrom(
-      output_relation->getDefaultStorageBlockLayout().getDescription());
-
-  const vector<block_id> blocks(physical_plan->catalog_relation()->getBlocksSnapshot());
-  for (const block_id block : blocks) {
-    insert_destination_proto->AddExtension(S::BlockPoolInsertDestination::blocks, block);
-  }
-
-  const QueryPlan::DAGNodeIndex scan_operator_index =
-      execution_plan_->addRelationalOperator(
-          new TextScanOperator(
-              query_handle_->query_id(),
-              physical_plan->file_name(),
-              physical_plan->column_delimiter(),
-              physical_plan->escape_strings(),
-              *output_relation,
-              insert_destination_index));
-  insert_destination_proto->set_relational_op_index(scan_operator_index);
-
-  const QueryPlan::DAGNodeIndex save_blocks_operator_index =
-      execution_plan_->addRelationalOperator(
-          new SaveBlocksOperator(query_handle_->query_id()));
-  execution_plan_->addDirectDependency(save_blocks_operator_index,
-                                       scan_operator_index,
-                                       false /* is_pipeline_breaker */);
-}
-
-void ExecutionGenerator::convertCreateIndex(
-  const P::CreateIndexPtr &physical_plan) {
-  // CreateIndex is converted to a CreateIndex operator.
-  const CatalogRelationInfo *input_relation_info =
-      findRelationInfoOutputByPhysical(physical_plan->input());
-  CatalogRelation *input_relation =
-      catalog_database_->getRelationByIdMutable(
-            input_relation_info->relation->getID());
-
-  // Check if any index with the specified name already exists.
-  if (input_relation->hasIndexWithName(physical_plan->index_name())) {
-    THROW_SQL_ERROR() << "The relation " << input_relation->getName()
-        << " already has an index named "<< physical_plan->index_name();
-  }
-
-  DCHECK_GT(physical_plan->index_attributes().size(), 0u);
-
-  // Convert attribute references to a vector of pointers to catalog attributes.
-  std::vector<const CatalogAttribute*> index_attributes;
-  for (const E::AttributeReferencePtr &attribute : physical_plan->index_attributes()) {
-    const CatalogAttribute *catalog_attribute
-        = input_relation->getAttributeByName(attribute->attribute_name());
-    DCHECK(catalog_attribute != nullptr);
-    index_attributes.emplace_back(catalog_attribute);
-  }
-
-  // Create a copy of index description and add all the specified attributes to it.
-  IndexSubBlockDescription index_description(*physical_plan->index_description());
-  for (const CatalogAttribute* catalog_attribute : index_attributes) {
-    index_description.add_indexed_attribute_ids(catalog_attribute->getID());
-  }
-  if (input_relation->hasIndexWithDescription(index_description)) {
-    // Check if the given index description already exists in the relation.
-    THROW_SQL_ERROR() << "The relation " << input_relation->getName()
-        << " already defines this index on the given attribute(s).";
-  }
-  if (!SubBlockTypeRegistry::IndexDescriptionIsValid(*input_relation, index_description)) {
-    // Check if the given index description is valid.
-    THROW_SQL_ERROR() << "The index with given properties cannot be created.";
-  }
-  execution_plan_->addRelationalOperator(
-      new CreateIndexOperator(query_handle_->query_id(),
-                              input_relation,
-                              physical_plan->index_name(),
-                              std::move(index_description)));
-}
-
-void ExecutionGenerator::convertCreateTable(
-    const P::CreateTablePtr &physical_plan) {
-  // CreateTable is converted to a CreateTable operator.
-
-  std::unique_ptr<CatalogRelation> catalog_relation(new CatalogRelation(
-      catalog_database_,
-      physical_plan->relation_name(),
-      -1 /* id */,
-      false /* is_temporary*/));
-  attribute_id aid = 0;
-  for (const E::AttributeReferencePtr &attribute :
-       physical_plan->attributes()) {
-    std::unique_ptr<CatalogAttribute> catalog_attribute(new CatalogAttribute(
-        catalog_relation.get(),
-        attribute->attribute_name(),
-        attribute->getValueType(),
-        aid,
-        attribute->attribute_alias()));
-    catalog_relation->addAttribute(catalog_attribute.release());
-    ++aid;
-  }
-
-  // If specified, set the physical block type as the users'. Otherwise,
-  // the system uses the default layout.
-  if (physical_plan->block_properties()) {
-    if (!StorageBlockLayout::DescriptionIsValid(*catalog_relation,
-                                                *physical_plan->block_properties())) {
-      THROW_SQL_ERROR() << "BLOCKPROPERTIES is invalid.";
-    }
-
-    std::unique_ptr<StorageBlockLayout> layout(
-        new StorageBlockLayout(*catalog_relation, *physical_plan->block_properties()));
-    layout->finalize();
-    catalog_relation->setDefaultStorageBlockLayout(layout.release());
-  }
-
-  execution_plan_->addRelationalOperator(
-      new CreateTableOperator(query_handle_->query_id(),
-                              catalog_relation.release(),
-                              catalog_database_));
-}
-
-void ExecutionGenerator::convertDeleteTuples(
-    const P::DeleteTuplesPtr &physical_plan) {
-  // If there is a selection predicate and the predicate value
-  // is not statically true, DeleteTuples is converted to
-  // a DeleteOperator and a SaveBlocksOperator; if there is not
-  // a selection predicate or the predicate value is statically true,
-  // it is converted to a DropTableOperator; otherwise, the predicate
-  // value is statically false, so no operator needs to be created.
-
-  unique_ptr<const Predicate> execution_predicate;
-  if (physical_plan->predicate()) {
-    execution_predicate.reset(convertPredicate(physical_plan->predicate()));
-  }
-
-  const CatalogRelationInfo *input_relation_info =
-      findRelationInfoOutputByPhysical(physical_plan->input());
-  DCHECK(input_relation_info != nullptr);
-  if (execution_predicate == nullptr ||
-      (execution_predicate->hasStaticResult() &&
-       execution_predicate->getStaticResult())) {
-    const QueryPlan::DAGNodeIndex drop_table_index =
-        execution_plan_->addRelationalOperator(
-            new DropTableOperator(query_handle_->query_id(),
-                                  *input_relation_info->relation,
-                                  catalog_database_,
-                                  true /* only_drop_blocks */));
-    if (!input_relation_info->isStoredRelation()) {
-      execution_plan_->addDirectDependency(drop_table_index,
-                                           input_relation_info->producer_operator_index,
-                                           true /* is_pipeline_breaker */);
-    }
-  } else if (!execution_predicate->hasStaticResult()) {
-    const QueryContext::predicate_id execution_predicate_index = query_context_proto_->predicates_size();
-    query_context_proto_->add_predicates()->CopyFrom(execution_predicate->getProto());
-
-    const QueryPlan::DAGNodeIndex delete_tuples_index =
-        execution_plan_->addRelationalOperator(
-            new DeleteOperator(query_handle_->query_id(),
-                               *input_relation_info->relation,
-                               execution_predicate_index,
-                               input_relation_info->isStoredRelation()));
-
-    if (!input_relation_info->isStoredRelation()) {
-      execution_plan_->addDirectDependency(delete_tuples_index,
-                                           input_relation_info->producer_operator_index,
-                                           false /* is_pipeline_breaker */);
-    }
-
-    const QueryPlan::DAGNodeIndex save_blocks_index =
-        execution_plan_->addRelationalOperator(
-            new SaveBlocksOperator(query_handle_->query_id()));
-    execution_plan_->addDirectDependency(save_blocks_index,
-                                         delete_tuples_index,
-                                         false /* is_pipeline_breaker */);
-  }
-}
-
-void ExecutionGenerator::convertDropTable(
-    const P::DropTablePtr &physical_plan) {
-  // DropTable is converted to a DropTable operator.
-  const CatalogRelation &catalog_relation = *physical_plan->catalog_relation();
-
-#ifdef QUICKSTEP_DISTRIBUTED
-  referenced_relation_ids_.insert(catalog_relation.getID());
-#endif
-
-  execution_plan_->addRelationalOperator(
-      new DropTableOperator(query_handle_->query_id(),
-                            catalog_relation,
-                            catalog_database_));
-}
-
-void ExecutionGenerator::convertInsertTuple(
-    const P::InsertTuplePtr &physical_plan) {
-  // InsertTuple is converted to an Insert and a SaveBlocks.
-
-  const CatalogRelationInfo *input_relation_info =
-      findRelationInfoOutputByPhysical(physical_plan->input());
-  const CatalogRelation &input_relation =
-      *catalog_database_->getRelationById(
-          input_relation_info->relation->getID());
-
-  // Construct the tuple proto to be inserted.
-  const QueryContext::tuple_id tuple_index = query_context_proto_->tuples_size();
-
-  S::Tuple *tuple_proto = query_context_proto_->add_tuples();
-  for (const E::ScalarLiteralPtr &literal : physical_plan->column_values()) {
-    tuple_proto->add_attribute_values()->CopyFrom(literal->value().getProto());
-  }
-
-  // FIXME(qzeng): A better way is using a traits struct to look up whether a storage
-  //               block supports ad-hoc insertion instead of hard-coding the block types.
-  const StorageBlockLayout &storage_block_layout =
-      input_relation.getDefaultStorageBlockLayout();
-  if (storage_block_layout.getDescription().tuple_store_description().sub_block_type() ==
-      TupleStorageSubBlockDescription::COMPRESSED_COLUMN_STORE ||
-      storage_block_layout.getDescription().tuple_store_description().sub_block_type() ==
-            TupleStorageSubBlockDescription::COMPRESSED_PACKED_ROW_STORE) {
-    THROW_SQL_ERROR() << "INSERT statement is not supported for the relation "
-                      << input_relation.getName()
-                      << ", because its storage blocks do not support ad-hoc insertion";
-  }
-
-  // Create InsertDestination proto.
-  const QueryContext::insert_destination_id insert_destination_index =
-      query_context_proto_->insert_destinations_size();
-  S::InsertDestination *insert_destination_proto = query_context_proto_->add_insert_destinations();
-
-  insert_destination_proto->set_insert_destination_type(S::InsertDestinationType::BLOCK_POOL);
-  insert_destination_proto->set_relation_id(input_relation.getID());
-  insert_destination_proto->mutable_layout()->MergeFrom(
-      input_relation.getDefaultStorageBlockLayout().getDescription());
-
-  const vector<block_id> blocks(input_relation.getBlocksSnapshot());
-  for (const block_id block : blocks) {
-    insert_destination_proto->AddExtension(S::BlockPoolInsertDestination::blocks, block);
-  }
-
-  const QueryPlan::DAGNodeIndex insert_operator_index =
-      execution_plan_->addRelationalOperator(
-          new InsertOperator(query_handle_->query_id(),
-                             input_relation,
-                             insert_destination_index,
-                             tuple_index));
-  insert_destination_proto->set_relational_op_index(insert_operator_index);
-
-  const QueryPlan::DAGNodeIndex save_blocks_index =
-      execution_plan_->addRelationalOperator(
-          new SaveBlocksOperator(query_handle_->query_id()));
-  if (!input_relation_info->isStoredRelation()) {
-    execution_plan_->addDirectDependency(insert_operator_index,
-                                         input_relation_info->producer_operator_index,
-                                         true /* is_pipeline_breaker */);
-  }
-  execution_plan_->addDirectDependency(save_blocks_index,
-                                       insert_operator_index,
-                                       false /* is_pipeline_breaker */);
-}
-
-void ExecutionGenerator::convertInsertSelection(
-    const P::InsertSelectionPtr &physical_plan) {
-  // InsertSelection is converted to a Select and a SaveBlocks.
-
-  const CatalogRelationInfo *destination_relation_info =
-      findRelationInfoOutputByPhysical(physical_plan->destination());
-  const CatalogRelation &destination_relation = *destination_relation_info->relation;
-
-  // FIXME(qzeng): A better way is using a traits struct to look up whether a storage
-  //               block supports ad-hoc insertion instead of hard-coding the block types.
-  const StorageBlockLayout &storage_block_layout =
-      destination_relation.getDefaultStorageBlockLayout();
-  if (storage_block_layout.getDescription().tuple_store_description().sub_block_type() ==
-          TupleStorageSubBlockDescription::COMPRESSED_COLUMN_STORE
-      || storage_block_layout.getDescription().tuple_store_description().sub_block_type() ==
-             TupleStorageSubBlockDescription::COMPRESSED_PACKED_ROW_STORE) {
-    THROW_SQL_ERROR() << "INSERT statement is not supported for the relation "
-                      << destination_relation.getName()
-                      << ", because its storage blocks do not support ad-hoc insertion";
-  }
-
-  // Create InsertDestination proto.
-  const QueryContext::insert_destination_id insert_destination_index =
-      query_context_proto_->insert_destinations_size();
-  S::InsertDestination *insert_destination_proto = query_context_proto_->add_insert_destinations();
-
-  insert_destination_proto->set_insert_destination_type(S::InsertDestinationType::BLOCK_POOL);
-  insert_destination_proto->set_relation_id(destination_relation.getID());
-  insert_destination_proto->mutable_layout()->MergeFrom(
-      destination_relation.getDefaultStorageBlockLayout().getDescription());
-
-  const vector<block_id> blocks(destination_relation.getBlocksSnapshot());
-  for (const block_id block : blocks) {
-    insert_destination_proto->AddExtension(S::BlockPoolInsertDestination::blocks, block);
-  }
-
-  const CatalogRelationInfo *selection_relation_info =
-      findRelationInfoOutputByPhysical(physical_plan->selection());
-
-  // Prepare the attributes, which are output columns of the selection relation.
-  std::vector<attribute_id> attributes;
-  for (E::AttributeReferencePtr attr_ref : physical_plan->selection()->getOutputAttributes()) {
-    unique_ptr<const Scalar> attribute(attr_ref->concretize(attribute_substitution_map_));
-
-    DCHECK_EQ(Scalar::kAttribute, attribute->getDataSource());
-    attributes.push_back(
-        static_cast<const ScalarAttribute*>(attribute.get())->getAttribute().getID());
-  }
-
-  // Create the select operator.
-  // TODO(jianqiao): This select operator is actually redundant. That is,
-  // we may directly set physical_plan_->selection()'s output relation to be
-  // destination_relation, instead of creating an intermediate selection_relation
-  // and then copy the data into destination_relation. One way to achieve this
-  // optimization is to enable specifying a specific output relation for each
-  // physical plan by modifying class Physical.
-  SelectOperator *insert_selection_op =
-      new SelectOperator(query_handle_->query_id(),
-                         *selection_relation_info->relation,
-                         destination_relation,
-                         insert_destination_index,
-                         QueryContext::kInvalidPredicateId,
-                         move(attributes),
-                         selection_relation_info->isStoredRelation());
-
-  const QueryPlan::DAGNodeIndex insert_selection_index =
-      execution_plan_->addRelationalOperator(insert_selection_op);
-  insert_destination_proto->set_relational_op_index(insert_selection_index);
-
-  const QueryPlan::DAGNodeIndex save_blocks_index =
-      execution_plan_->addRelationalOperator(new SaveBlocksOperator(query_handle_->query_id()));
-
-  if (!selection_relation_info->isStoredRelation()) {
-    execution_plan_->addDirectDependency(insert_selection_index,
-                                         selection_relation_info->producer_operator_index,
-                                         false /* is_pipeline_breaker */);
-  }
-  execution_plan_->addDirectDependency(save_blocks_index,
-                                       insert_selection_index,
-                                       false /* is_pipeline_breaker */);
-}
-
-void ExecutionGenerator::convertUpdateTable(
-    const P::UpdateTablePtr &physical_plan) {
-  // UpdateTable is converted to an Update and a SaveBlocks.
-
-  const CatalogRelationInfo *input_relation_info =
-      findRelationInfoOutputByPhysical(physical_plan->input());
-  DCHECK(input_relation_info != nullptr);
-
-  const relation_id input_rel_id = input_relation_info->relation->getID();
-
-  // Create InsertDestination proto.
-  const QueryContext::insert_destination_id relocation_destination_index =
-      query_context_proto_->insert_destinations_size();
-  S::InsertDestination *relocation_destination_proto = query_context_proto_->add_insert_destinations();
-
-  relocation_destination_proto->set_insert_destination_type(S::InsertDestinationType::BLOCK_POOL);
-  relocation_destination_proto->set_relation_id(input_rel_id);
-
-  // Convert the predicate proto.
-  QueryContext::predicate_id execution_predicate_index = QueryContext::kInvalidPredicateId;
-  if (physical_plan->predicate()) {
-    execution_predicate_index = query_context_proto_->predicates_size();
-
-    unique_ptr<const Predicate> execution_predicate(convertPredicate(physical_plan->predicate()));
-    query_context_proto_->add_predicates()->CopyFrom(execution_predicate->getProto());
-  }
-
-  // Convert assignment expressions as a UpdateGroup proto.
-  const vector<E::AttributeReferencePtr> &assignees = physical_plan->assignees();
-  const vector<E::ScalarPtr> &assignment_expressions = physical_plan->assignment_expressions();
-
-  DCHECK_EQ(assignees.size(), assignment_expressions.size())
-      << physical_plan->toString();
-
-  const QueryContext::update_group_id update_group_index = query_context_proto_->update_groups_size();
-  S::QueryContext::UpdateGroup *update_group_proto = query_context_proto_->add_update_groups();
-  update_group_proto->set_relation_id(input_rel_id);
-
-  for (vector<E::AttributeReferencePtr>::size_type i = 0; i < assignees.size(); ++i) {
-    unique_ptr<const Scalar> attribute(
-        assignees[i]->concretize(attribute_substitution_map_));
-    DCHECK_EQ(Scalar::kAttribute, attribute->getDataSource())
-        << assignees[i]->toString();
-
-    S::QueryContext::UpdateGroup::UpdateAssignment *update_assignment_proto =
-        update_group_proto->add_update_assignments();
-
-    update_assignment_proto->set_attribute_id(
-        static_cast<const ScalarAttribute*>(attribute.get())->getAttribute().getID());
-
-    unique_ptr<const Scalar> value(
-        assignment_expressions[i]->concretize(attribute_substitution_map_));
-    update_assignment_proto->mutable_scalar()->CopyFrom(value->getProto());
-  }
-
-  const QueryPlan::DAGNodeIndex update_operator_index =
-      execution_plan_->addRelationalOperator(new UpdateOperator(
-          query_handle_->query_id(),
-          *catalog_database_->getRelationById(
-              input_rel_id),
-          relocation_destination_index,
-          execution_predicate_index,
-          update_group_index));
-  relocation_destination_proto->set_relational_op_index(update_operator_index);
-
-  const QueryPlan::DAGNodeIndex save_blocks_index =
-      execution_plan_->addRelationalOperator(
-          new SaveBlocksOperator(query_handle_->query_id()));
-  if (!input_relation_info->isStoredRelation()) {
-    execution_plan_->addDirectDependency(update_operator_index,
-                                         input_relation_info->producer_operator_index,
-                                         false /* is_pipeline_breaker */);
-  }
-  execution_plan_->addDirectDependency(save_blocks_index,
-                                       update_operator_index,
-                                       false /* is_pipeline_breaker */);
-}
-
-void ExecutionGenerator::convertAggregate(
-    const P::AggregatePtr &physical_plan) {
-  // Create aggr state proto.
-  const QueryContext::aggregation_state_id aggr_state_index =
-      query_context_proto_->aggregation_states_size();
-  S::AggregationOperationState *aggr_state_proto = query_context_proto_->add_aggregation_states();
-
-  const CatalogRelationInfo *input_relation_info =
-      findRelationInfoOutputByPhysical(physical_plan->input());
-  aggr_state_proto->set_relation_id(input_relation_info->relation->getID());
-
-  std::vector<const Type*> group_by_types;
-  for (const E::NamedExpressionPtr &grouping_expression : physical_plan->grouping_expressions()) {
-    unique_ptr<const Scalar> execution_group_by_expression;
-    E::AliasPtr alias;
-    if (E::SomeAlias::MatchesWithConditionalCast(grouping_expression, &alias)) {
-      E::ScalarPtr scalar;
-      // NOTE(zuyu): For aggregate expressions, all child expressions of an
-      // Alias should be a Scalar.
-      CHECK(E::SomeScalar::MatchesWithConditionalCast(alias->expression(), &scalar))
-          << alias->toString();
-      execution_group_by_expression.reset(scalar->concretize(attribute_substitution_map_));
-    } else {
-      execution_group_by_expression.reset(
-          grouping_expression->concretize(attribute_substitution_map_));
-    }
-    aggr_state_proto->add_group_by_expressions()->CopyFrom(execution_group_by_expression->getProto());
-    group_by_types.push_back(&execution_group_by_expression->getType());
-  }
-
-  if (!group_by_types.empty()) {
-    // Right now, only SeparateChaining is supported.
-    aggr_state_proto->set_hash_table_impl_type(
-        serialization::HashTableImplType::SEPARATE_CHAINING);
-  }
-
-  for (const E::AliasPtr &named_aggregate_expression : physical_plan->aggregate_expressions()) {
-    const E::AggregateFunctionPtr unnamed_aggregate_expression =
-        std::static_pointer_cast<const E::AggregateFunction>(named_aggregate_expression->expression());
-
-    // Add a new entry in 'aggregates'.
-    S::Aggregate *aggr_proto = aggr_state_proto->add_aggregates();
-
-    // Set the AggregateFunction.
-    aggr_proto->mutable_function()->CopyFrom(
-        unnamed_aggregate_expression->getAggregate().getProto());
-
-    // Add each of the aggregate's arguments.
-    for (const E::ScalarPtr &argument : unnamed_aggregate_expression->getArguments()) {
-      unique_ptr<const Scalar> concretized_argument(argument->concretize(attribute_substitution_map_));
-      aggr_proto->add_argument()->CopyFrom(concretized_argument->getProto());
-    }
-
-    // Set whether it is a DISTINCT aggregation.
-    aggr_proto->set_is_distinct(unnamed_aggregate_expression->is_distinct());
-
-    // Add distinctify hash table impl type if it is a DISTINCT aggregation.
-    if (unnamed_aggregate_expression->is_distinct()) {
-      const std::vector<E::ScalarPtr> &arguments = unnamed_aggregate_expression->getArguments();
-      DCHECK_GE(arguments.size(), 1u);
-      // Right now only SeparateChaining implementation is supported.
-      aggr_state_proto->add_distinctify_hash_table_impl_types(
-          serialization::HashTableImplType::SEPARATE_CHAINING);
-    }
-  }
-
-  if (physical_plan->filter_predicate() != nullptr) {
-    unique_ptr<const Predicate> predicate(convertPredicate(physical_plan->filter_predicate()));
-    aggr_state_proto->mutable_predicate()->CopyFrom(predicate->getProto());
-  }
-
-  const std::size_t estimated_num_groups =
-      cost_model_for_aggregation_->estimateNumGroupsForAggregate(physical_plan);
-  aggr_state_proto->set_estimated_num_entries(std::max(16uL, estimated_num_groups));
-
-  const QueryPlan::DAGNodeIndex aggregation_operator_index =
-      execution_plan_->addRelationalOperator(
-          new AggregationOperator(
-              query_handle_->query_id(),
-              *input_relation_info->relation,
-              input_relation_info->isStoredRelation(),
-              aggr_state_index));
-
-  if (!input_relation_info->isStoredRelation()) {
-    execution_plan_->addDirectDependency(aggregation_operator_index,
-                                         input_relation_info->producer_operator_index,
-                                         false /* is_pipeline_breaker */);
-  }
-
-  // Create InsertDestination proto.
-  const CatalogRelation *output_relation = nullptr;
-  const QueryContext::insert_destination_id insert_destination_index =
-      query_context_proto_->insert_destinations_size();
-  S::InsertDestination *insert_destination_proto = query_context_proto_->add_insert_destinations();
-  createTemporaryCatalogRelation(physical_plan,
-                                 &output_relation,
-                                 insert_destination_proto);
-
-  const QueryPlan::DAGNodeIndex finalize_aggregation_operator_index =
-      execution_plan_->addRelationalOperator(
-          new FinalizeAggregationOperator(query_handle_->query_id(),
-                                          aggr_state_index,
-                                          *output_relation,
-                                          insert_destination_index));
-
-  insert_destination_proto->set_relational_op_index(finalize_aggregation_operator_index);
-
-  execution_plan_->addDirectDependency(finalize_aggregation_operator_index,
-                                       aggregation_operator_index,
-                                       true /* is_pipeline_breaker */);
-
-  physical_to_output_relation_map_.emplace(
-      std::piecewise_construct,
-      std::forward_as_tuple(physical_plan),
-      std::forward_as_tuple(finalize_aggregation_operator_index, output_relation));
-  temporary_relation_info_vec_.emplace_back(finalize_aggregation_operator_index,
-                                            output_relation);
-
-  const QueryPlan::DAGNodeIndex destroy_aggregation_state_operator_index =
-      execution_plan_->addRelationalOperator(
-          new DestroyAggregationStateOperator(query_handle_->query_id(),
-                                              aggr_state_index));
-
-  execution_plan_->addDirectDependency(destroy_aggregation_state_operator_index,
-                                       finalize_aggregation_operator_index,
-                                       true);
-
-  if (lip_filter_generator_ != nullptr) {
-    lip_filter_generator_->addAggregateInfo(physical_plan,
-                                            aggregation_operator_index);
-  }
-}
-
-void ExecutionGenerator::convertSort(const P::SortPtr &physical_sort) {
-  // Create sort configuration for run generation.
-  vector<bool> sort_ordering(physical_sort->sort_ascending());
-  vector<bool> sort_null_ordering(physical_sort->nulls_first_flags());
-  PtrVector<Scalar> sort_run_gen_attributes;
-  for (const E::AttributeReferencePtr &sort_attribute :
-       physical_sort->sort_attributes()) {
-    sort_run_gen_attributes.push_back(
-        sort_attribute->concretize(attribute_substitution_map_));
-  }
-  const SortConfiguration sort_run_gen_config(sort_run_gen_attributes,
-                                              std::move(sort_ordering),
-                                              std::move(sort_null_ordering));
-  const QueryContext::sort_config_id sort_run_gen_config_id =
-      query_context_proto_->sort_configs_size();
-  S::SortConfiguration *sort_run_gen_config_proto =
-      query_context_proto_->add_sort_configs();
-  sort_run_gen_config_proto->CopyFrom(sort_run_gen_config.getProto());
-
-  // Create SortRunGenerationOperator.
-  const CatalogRelation *initial_runs_relation;
-  const QueryContext::insert_destination_id initial_runs_destination_id =
-      query_context_proto_->insert_destinations_size();
-  S::InsertDestination *initial_runs_destination_proto =
-      query_context_proto_->add_insert_destinations();
-  createTemporaryCatalogRelation(
-      physical_sort, &initial_runs_relation, initial_runs_destination_proto);
-
-  const CatalogRelationInfo *input_relation_info =
-      findRelationInfoOutputByPhysical(physical_sort->input());
-  const QueryPlan::DAGNodeIndex run_generator_index =
-      execution_plan_->addRelationalOperator(new SortRunGenerationOperator(
-          query_handle_->query_id(),
-          *input_relation_info->relation,
-          *initial_runs_relation,
-          initial_runs_destination_id,
-          sort_run_gen_config_id,
-          input_relation_info->isStoredRelation()));
-  if (!input_relation_info->isStoredRelation()) {
-    execution_plan_->addDirectDependency(run_generator_index,
-                                         input_relation_info->producer_operator_index,
-                                         false /* is_pipeline_breaker */);
-  }
-  temporary_relation_info_vec_.emplace_back(run_generator_index,
-                                            initial_runs_relation);
-  initial_runs_destination_proto->set_relational_op_index(run_generator_index);
-
-  // Create sort configuration for run merging.
-  sort_ordering = physical_sort->sort_ascending();
-  sort_null_ordering = physical_sort->nulls_first_flags();
-  PtrVector<Scalar> sort_merge_run_attributes;
-  for (const E::AttributeReferencePtr &sort_attribute :
-       physical_sort->sort_attributes()) {
-    sort_merge_run_attributes.push_back(
-        sort_attribute->concretize(attribute_substitution_map_));
-  }
-  const SortConfiguration sort_merge_run_config(sort_merge_run_attributes,
-                                                std::move(sort_ordering),
-                                                std::move(sort_null_ordering));
-  const QueryContext::sort_config_id sort_merge_run_config_id =
-      query_context_proto_->sort_configs_size();
-  S::SortConfiguration *sort_merge_run_config_proto =
-      query_context_proto_->add_sort_configs();
-  sort_merge_run_config_proto->CopyFrom(sort_merge_run_config.getProto());
-
-  // Create SortMergeRunOperator.
-  const CatalogRelation *merged_runs_relation;
-  const QueryContext::insert_destination_id merged_runs_destination_id =
-    query_context_proto_->insert_destinations_size();
-  S::InsertDestination *merged_runs_destination_proto =
-    query_context_proto_->add_insert_destinations();
-  createTemporaryCatalogRelation(physical_sort,
-                                 &merged_runs_relation,
-                                 merged_runs_destination_proto);
-  const CatalogRelation *sorted_relation;
-  const QueryContext::insert_destination_id sorted_output_destination_id =
-    query_context_proto_->insert_destinations_size();
-  S::InsertDestination *sorted_output_destination_proto =
-    query_context_proto_->add_insert_destinations();
-  createTemporaryCatalogRelation(physical_sort,
-                                 &sorted_relation,
-                                 sorted_output_destination_proto);
-
-  // TODO(qzeng): Make the merge factor configurable.
-  const QueryPlan::DAGNodeIndex merge_run_operator_index =
-      execution_plan_->addRelationalOperator(new SortMergeRunOperator(
-          query_handle_->query_id(),
-          *initial_runs_relation,
-          *sorted_relation,
-          sorted_output_destination_id,
-          *merged_runs_relation,
-          merged_runs_destination_id,
-          sort_merge_run_config_id,
-          64 /* merge_factor */,
-          physical_sort->limit(),
-          false /* input_relation_is_stored */));
-
-  execution_plan_->addDirectDependency(merge_run_operator_index,
-                                       run_generator_index,
-                                       false /* is_pipeline_breaker */);
-  merged_runs_destination_proto->set_relational_op_index(merge_run_operator_index);
-  sorted_output_destination_proto->set_relational_op_index(merge_run_operator_index);
-
-  // Do not add merged_runs_relation into 'temporary_relation_info_vec_'
-  // and create the DropTableOperator for it at the end. Instead, add the drop
-  // operator right here, because the relation won't be used by any other operator.
-  const QueryPlan::DAGNodeIndex drop_merged_runs_index =
-      execution_plan_->addRelationalOperator(
-          new DropTableOperator(
-              query_handle_->query_id(),
-              *merged_runs_relation,
-              catalog_database_,
-              false /* only_drop_blocks */));
-  execution_plan_->addDirectDependency(
-      drop_merged_runs_index,
-      merge_run_operator_index,
-      true /* is_pipeline_breaker */);
-
-  temporary_relation_info_vec_.emplace_back(merge_run_operator_index,
-                                            sorted_relation);
-  physical_to_output_relation_map_.emplace(
-      std::piecewise_construct,
-      std::forward_as_tuple(physical_sort),
-      std::forward_as_tuple(merge_run_operator_index,
-                            sorted_relation));
-}
-
-void ExecutionGenerator::convertTableGenerator(
-    const P::TableGeneratorPtr &physical_tablegen) {
-  // Create InsertDestination proto.
-  const CatalogRelation *output_relation = nullptr;
-  const QueryContext::insert_destination_id insert_destination_index =
-      query_context_proto_->insert_destinations_size();
-  S::InsertDestination *insert_destination_proto =
-      query_context_proto_->add_insert_destinations();
-  createTemporaryCatalogRelation(physical_tablegen,
-                                 &output_relation,
-                                 insert_destination_proto);
-
-  // Create GeneratorFunctionHandle proto
-  const QueryContext::generator_function_id generator_function_index =
-      query_context_proto_->generator_functions_size();
-  query_context_proto_->add_generator_functions()->CopyFrom(
-      physical_tablegen->generator_function_handle()->getProto());
-
-  TableGeneratorOperator *op =
-      new TableGeneratorOperator(query_handle_->query_id(),
-                                 *output_relation,
-                                 insert_destination_index,
-                                 generator_function_index);
-
-  const QueryPlan::DAGNodeIndex tablegen_index =
-      execution_plan_->addRelationalOperator(op);
-  insert_destination_proto->set_relational_op_index(tablegen_index);
-
-  physical_to_output_relation_map_.emplace(
-      std::piecewise_construct,
-      std::forward_as_tuple(physical_tablegen),
-      std::forward_as_tuple(tablegen_index,
-                            output_relation));
-  temporary_relation_info_vec_.emplace_back(tablegen_index, output_relation);
-}
-
-void ExecutionGenerator::convertWindowAggregate(
-    const P::WindowAggregatePtr &physical_plan) {
-  // Create window_aggregation_operation_state proto.
-  const QueryContext::window_aggregation_state_id window_aggr_state_index =
-      query_context_proto_->window_aggregation_states_size();
-  S::WindowAggregationOperationState *window_aggr_state_proto =
-      query_context_proto_->add_window_aggregation_states();
-
-  // Get input.
-  const CatalogRelationInfo *input_relation_info =
-      findRelationInfoOutputByPhysical(physical_plan->input());
-  window_aggr_state_proto->set_input_relation_id(input_relation_info->relation->getID());
-
-  // Get window aggregate function expression.
-  const E::AliasPtr &named_window_aggregate_expression =
-      physical_plan->window_aggregate_expression();
-  const E::WindowAggregateFunctionPtr &window_aggregate_function =
-      std::static_pointer_cast<const E::WindowAggregateFunction>(
-          named_window_aggregate_expression->expression());
-
-  // Set the WindowAggregateFunction.
-  window_aggr_state_proto->mutable_function()->MergeFrom(
-      window_aggregate_function->window_aggregate().getProto());
-
-  // Set the arguments.
-  for (const E::ScalarPtr &argument : window_aggregate_function->arguments()) {
-    unique_ptr<const Scalar> concretized_argument(argument->concretize(attribute_substitution_map_));
-    window_aggr_state_proto->add_arguments()->MergeFrom(concretized_argument->getProto());
-  }
-
-  // Set partition keys.
-  const E::WindowInfo &window_info = window_aggregate_function->window_info();
-  for (const E::ScalarPtr &partition_by_attribute
-      : window_info.partition_by_attributes) {
-    unique_ptr<const Scalar> concretized_partition_by_attribute(
-        partition_by_attribute->concretize(attribute_substitution_map_));
-    window_aggr_state_proto->add_partition_by_attributes()
-        ->MergeFrom(concretized_partition_by_attribute->getProto());
-  }
-
-  // Set order keys.
-  for (const E::ScalarPtr &order_by_attribute
-      : window_info.order_by_attributes) {
-    unique_ptr<const Scalar> concretized_order_by_attribute(
-        order_by_attribute->concretize(attribute_substitution_map_));
-    window_aggr_state_proto->add_order_by_attributes()
-        ->MergeFrom(concretized_order_by_attribute->getProto());
-  }
-
-  // Set window frame info.
-  if (window_info.frame_info == nullptr) {
-    // If the frame is not specified, use the default setting:
-    //   1. If ORDER BY key is specified, use cumulative aggregation:
-    //      ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW.
-    //   2. If ORDER BY key is not specified either, use the whole partition:
-    //      ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING.
-    window_aggr_state_proto->set_is_row(true);  // frame mode: ROWS.
-    window_aggr_state_proto->set_num_preceding(-1);  // UNBOUNDED PRECEDING.
-    window_aggr_state_proto->set_num_following(
-        window_info.order_by_attributes.empty()
-            ? -1  // UNBOUNDED FOLLOWING.
-            : 0);  // CURRENT ROW.
-  } else {
-    const E::WindowFrameInfo *window_frame_info = window_info.frame_info;
-    window_aggr_state_proto->set_is_row(window_frame_info->is_row);
-    window_aggr_state_proto->set_num_preceding(window_frame_info->num_preceding);
-    window_aggr_state_proto->set_num_following(window_frame_info->num_following);
-  }
-
-  // Create InsertDestination proto.
-  const CatalogRelation *output_relation = nullptr;
-  const QueryContext::insert_destination_id insert_destination_index =
-      query_context_proto_->insert_destinations_size();
-  S::InsertDestination *insert_destination_proto = query_context_proto_->add_insert_destinations();
-  createTemporaryCatalogRelation(physical_plan,
-                                 &output_relation,
-                                 insert_destination_proto);
-
-  const QueryPlan::DAGNodeIndex window_aggregation_operator_index =
-      execution_plan_->addRelationalOperator(
-          new WindowAggregationOperator(query_handle_->query_id(),
-                                        *input_relation_info->relation,
-                                        *output_relation,
-                                        window_aggr_state_index,
-                                        insert_destination_index));
-
-  // TODO(Shixuan): Once parallelism is introduced, the is_pipeline_breaker
-  //                could be set to false.
-  if (!input_relation_info->isStoredRelation()) {
-    execution_plan_->addDirectDependency(window_aggregation_operator_index,
-                                         input_relation_info->producer_operator_index,
-                                         true /* is_pipeline_breaker */);
-  }
-
-  insert_destination_proto->set_relational_op_index(window_aggregation_operator_index);
-
-  // Add to map and temp_relation_info_vec.
-  physical_to_output_relation_map_.emplace(
-      std::piecewise_construct,
-      std::forward_as_tuple(physical_plan),
-      std::forward_as_tuple(window_aggregation_operator_index, output_relation));
-  temporary_relation_info_vec_.emplace_back(window_aggregation_operator_index,
-                                            output_relation);
-}
-
-}  // namespace optimizer
-}  // namespace quickstep


[32/51] [abbrv] [partial] incubator-quickstep git commit: remove c++ files

Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/window_aggregation/WindowAggregateFunctionMin.hpp
----------------------------------------------------------------------
diff --git a/expressions/window_aggregation/WindowAggregateFunctionMin.hpp b/expressions/window_aggregation/WindowAggregateFunctionMin.hpp
deleted file mode 100644
index 8bb4386..0000000
--- a/expressions/window_aggregation/WindowAggregateFunctionMin.hpp
+++ /dev/null
@@ -1,79 +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_EXPRESSIONS_WINDOW_AGGREGATION_WINDOW_AGGREGATE_FUNCTION_MIN_HPP_
-#define QUICKSTEP_EXPRESSIONS_WINDOW_AGGREGATION_WINDOW_AGGREGATE_FUNCTION_MIN_HPP_
-
-#include <string>
-#include <vector>
-
-#include "expressions/window_aggregation/WindowAggregateFunction.hpp"
-#include "expressions/window_aggregation/WindowAggregationID.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-
-class Type;
-class WindowAggregationHandle;
-
-/** \addtogroup Expressions
- *  @{
- */
-
-/**
- * @brief WindowAggregateFunction representing SQL MIN() OVER term.
- **/
-class WindowAggregateFunctionMin : public WindowAggregateFunction {
- public:
-  static const WindowAggregateFunctionMin& Instance() {
-    static WindowAggregateFunctionMin instance;
-    return instance;
-  }
-
-  std::string getName() const override {
-    return "MIN";
-  }
-
-  bool canApplyToTypes(
-      const std::vector<const Type*> &argument_types) const override;
-
-  const Type* resultTypeForArgumentTypes(
-      const std::vector<const Type*> &argument_types) const override;
-
-  WindowAggregationHandle* createHandle(
-      const std::vector<const Type*> &argument_types,
-      const std::vector<std::unique_ptr<const Scalar>> &partition_by_attributes,
-      const std::vector<std::unique_ptr<const Scalar>> &order_by_attributes,
-      const bool is_row,
-      const std::int64_t num_preceding,
-      const std::int64_t num_following) const override;
-
- private:
-  WindowAggregateFunctionMin()
-      : WindowAggregateFunction(WindowAggregationID::kMin) {
-  }
-
-  DISALLOW_COPY_AND_ASSIGN(WindowAggregateFunctionMin);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_EXPRESSIONS_WINDOW_AGGREGATION_WINDOW_AGGREGATE_FUNCTION_MIN_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/window_aggregation/WindowAggregateFunctionSum.cpp
----------------------------------------------------------------------
diff --git a/expressions/window_aggregation/WindowAggregateFunctionSum.cpp b/expressions/window_aggregation/WindowAggregateFunctionSum.cpp
deleted file mode 100644
index 14c51d8..0000000
--- a/expressions/window_aggregation/WindowAggregateFunctionSum.cpp
+++ /dev/null
@@ -1,86 +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 "expressions/window_aggregation/WindowAggregateFunctionSum.hpp"
-
-#include <vector>
-
-#include "expressions/window_aggregation/WindowAggregationHandle.hpp"
-#include "types/Type.hpp"
-#include "types/TypeFactory.hpp"
-#include "types/TypeID.hpp"
-#include "types/operations/binary_operations/BinaryOperation.hpp"
-#include "types/operations/binary_operations/BinaryOperationFactory.hpp"
-#include "types/operations/binary_operations/BinaryOperationID.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-bool WindowAggregateFunctionSum::canApplyToTypes(
-    const std::vector<const Type*> &argument_types) const {
-  // SUM is unary.
-  if (argument_types.size() != 1) {
-    return false;
-  }
-
-  // Argument must be addable.
-  return BinaryOperationFactory::GetBinaryOperation(BinaryOperationID::kAdd)
-             .canApplyToTypes(*argument_types.front(), *argument_types.front());
-}
-
-const Type* WindowAggregateFunctionSum::resultTypeForArgumentTypes(
-    const std::vector<const Type*> &argument_types) const {
-  if (!canApplyToTypes(argument_types)) {
-    return nullptr;
-  }
-
-  // SUM may return NULL if there are no input rows, and we automatically widen
-  // int to long and float to double to have more headroom when adding up many
-  // values.
-  const Type *sum_type = &(argument_types.front()->getNullableVersion());
-  switch (sum_type->getTypeID()) {
-    case kInt:
-      sum_type = &TypeFactory::GetType(kLong, true);
-      break;
-    case kFloat:
-      sum_type = &TypeFactory::GetType(kDouble, true);
-      break;
-    default:
-      break;
-  }
-
-  return sum_type;
-}
-
-WindowAggregationHandle* WindowAggregateFunctionSum::createHandle(
-    const std::vector<const Type*> &argument_types,
-    const std::vector<std::unique_ptr<const Scalar>> &partition_by_attributes,
-    const std::vector<std::unique_ptr<const Scalar>> &order_by_attributes,
-    const bool is_row,
-    const std::int64_t num_preceding,
-    const std::int64_t num_following) const {
-  DCHECK(canApplyToTypes(argument_types))
-      << "Attempted to create a WindowAggregationHandleSum for argument Type(s) "
-      << "that SUM can not be applied to.";
-
-  return nullptr;
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/window_aggregation/WindowAggregateFunctionSum.hpp
----------------------------------------------------------------------
diff --git a/expressions/window_aggregation/WindowAggregateFunctionSum.hpp b/expressions/window_aggregation/WindowAggregateFunctionSum.hpp
deleted file mode 100644
index 89582dd..0000000
--- a/expressions/window_aggregation/WindowAggregateFunctionSum.hpp
+++ /dev/null
@@ -1,79 +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_EXPRESSIONS_WINDOW_AGGREGATION_WINDOW_AGGREGATE_FUNCTION_SUM_HPP_
-#define QUICKSTEP_EXPRESSIONS_WINDOW_AGGREGATION_WINDOW_AGGREGATE_FUNCTION_SUM_HPP_
-
-#include <string>
-#include <vector>
-
-#include "expressions/window_aggregation/WindowAggregateFunction.hpp"
-#include "expressions/window_aggregation/WindowAggregationID.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-
-class Type;
-class WindowAggregationHandle;
-
-/** \addtogroup Expressions
- *  @{
- */
-
-/**
- * @brief WindowAggregateFunction representing SQL SUM() OVER term.
- **/
-class WindowAggregateFunctionSum : public WindowAggregateFunction {
- public:
-  static const WindowAggregateFunctionSum& Instance() {
-    static WindowAggregateFunctionSum instance;
-    return instance;
-  }
-
-  std::string getName() const override {
-    return "SUM";
-  }
-
-  bool canApplyToTypes(
-      const std::vector<const Type*> &argument_types) const override;
-
-  const Type* resultTypeForArgumentTypes(
-      const std::vector<const Type*> &argument_types) const override;
-
-  WindowAggregationHandle* createHandle(
-      const std::vector<const Type*> &argument_types,
-      const std::vector<std::unique_ptr<const Scalar>> &partition_by_attributes,
-      const std::vector<std::unique_ptr<const Scalar>> &order_by_attributes,
-      const bool is_row,
-      const std::int64_t num_preceding,
-      const std::int64_t num_following) const override;
-
- private:
-  WindowAggregateFunctionSum()
-      : WindowAggregateFunction(WindowAggregationID::kSum) {
-  }
-
-  DISALLOW_COPY_AND_ASSIGN(WindowAggregateFunctionSum);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_EXPRESSIONS_WINDOW_AGGREGATION_WINDOW_AGGREGATE_FUNCTION_SUM_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/window_aggregation/WindowAggregationHandle.cpp
----------------------------------------------------------------------
diff --git a/expressions/window_aggregation/WindowAggregationHandle.cpp b/expressions/window_aggregation/WindowAggregationHandle.cpp
deleted file mode 100644
index f26656d..0000000
--- a/expressions/window_aggregation/WindowAggregationHandle.cpp
+++ /dev/null
@@ -1,186 +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 "expressions/window_aggregation/WindowAggregationHandle.hpp"
-
-#include <cstddef>
-#include <memory>
-#include <vector>
-
-#include "catalog/CatalogTypedefs.hpp"
-#include "expressions/scalar/Scalar.hpp"
-#include "types/Type.hpp"
-#include "types/TypeFactory.hpp"
-#include "types/TypeID.hpp"
-#include "types/TypedValue.hpp"
-#include "types/containers/ColumnVectorsValueAccessor.hpp"
-#include "types/operations/binary_operations/BinaryOperation.hpp"
-#include "types/operations/binary_operations/BinaryOperationFactory.hpp"
-#include "types/operations/binary_operations/BinaryOperationID.hpp"
-#include "types/operations/comparisons/Comparison.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-WindowAggregationHandle::WindowAggregationHandle(
-    const std::vector<std::unique_ptr<const Scalar>> &partition_by_attributes,
-    const std::vector<std::unique_ptr<const Scalar>> &order_by_attributes,
-    const bool is_row,
-    const std::int64_t num_preceding,
-    const std::int64_t num_following)
-    : is_row_(is_row),
-      num_preceding_(num_preceding),
-      num_following_(num_following) {
-  // IDs and types of partition keys.
-  std::vector<const Type*> partition_key_types;
-  for (const std::unique_ptr<const Scalar> &partition_by_attribute : partition_by_attributes) {
-    partition_key_ids_.push_back(
-        partition_by_attribute->getAttributeIdForValueAccessor());
-    partition_key_types.push_back(&partition_by_attribute->getType());
-  }
-
-  // Comparison operators for checking if two tuples belong to the same partition.
-  for (const Type *partition_key_type : partition_key_types) {
-    partition_equal_comparators_.emplace_back(
-        ComparisonFactory::GetComparison(ComparisonID::kEqual)
-            .makeUncheckedComparatorForTypes(*partition_key_type, *partition_key_type));
-  }
-
-  // IDs and types of order keys.
-  const Type *first_order_key_type = nullptr;
-  for (const std::unique_ptr<const Scalar> &order_by_attribute : order_by_attributes) {
-    order_key_ids_.push_back(
-        order_by_attribute->getAttributeIdForValueAccessor());
-    if (first_order_key_type == nullptr) {
-      first_order_key_type = &order_by_attribute->getType();
-    }
-  }
-
-  // ID and type of the first order key if in RANGE mode.
-  if (!is_row) {
-    DCHECK(first_order_key_type != nullptr);
-
-    // Comparators and operators to check window frame in RANGE mode.
-    const Type &long_type = TypeFactory::GetType(kLong, false);
-    range_compare_type_ =
-        TypeFactory::GetUnifyingType(*first_order_key_type, long_type);
-
-    range_add_operator_.reset(
-        BinaryOperationFactory::GetBinaryOperation(BinaryOperationID::kAdd)
-            .makeUncheckedBinaryOperatorForTypes(*first_order_key_type, long_type));
-    range_comparator_.reset(
-        ComparisonFactory::GetComparison(ComparisonID::kLessOrEqual)
-            .makeUncheckedComparatorForTypes(*range_compare_type_, *range_compare_type_));
-  }
-}
-
-bool WindowAggregationHandle::samePartition(
-    const ColumnVectorsValueAccessor *tuple_accessor,
-    const tuple_id test_tuple_id) const {
-  // If test tuple does not exist.
-  if (test_tuple_id < 0 ||
-      test_tuple_id >= tuple_accessor->getNumTuples()) {
-    return false;
-  }
-
-  // Check all partition by attributes.
-  for (std::size_t partition_by_index = 0;
-       partition_by_index < partition_key_ids_.size();
-       ++partition_by_index) {
-    if (!partition_equal_comparators_[partition_by_index]->compareTypedValues(
-            tuple_accessor->getTypedValue(partition_key_ids_[partition_by_index]),
-            tuple_accessor->getTypedValueAtAbsolutePosition(
-                partition_key_ids_[partition_by_index], test_tuple_id))) {
-      return false;
-    }
-  }
-
-  return true;
-}
-
-bool WindowAggregationHandle::inWindow(
-    const ColumnVectorsValueAccessor *tuple_accessor,
-    const tuple_id test_tuple_id) const {
-  // If test tuple does not exist.
-  if (!samePartition(tuple_accessor, test_tuple_id)) {
-    return false;
-  }
-
-  tuple_id current_tuple_id = tuple_accessor->getCurrentPosition();
-
-  // If test tuple is the current tuple, then it is in the window.
-  if (test_tuple_id == current_tuple_id) {
-    return true;
-  }
-
-  // In ROWS mode, check the difference of tuple_id.
-  if (is_row_) {
-    if (num_preceding_ != -1 &&
-        test_tuple_id < current_tuple_id - num_preceding_) {
-      return false;
-    }
-
-    if (num_following_ != -1 &&
-        test_tuple_id > current_tuple_id + num_following_) {
-      return false;
-    }
-  } else {
-    // In RANGE mode, check the difference of first order key value.
-    // Get the test value.
-    const Type &long_type = TypeFactory::GetType(kLong, false);
-    TypedValue test_value =
-        range_add_operator_->applyToTypedValues(
-            tuple_accessor->getTypedValueAtAbsolutePosition(order_key_ids_[0], test_tuple_id),
-            long_type.makeZeroValue());
-
-    // NULL will be considered not in range.
-    if (test_value.isNull() ||
-        tuple_accessor->getTypedValue(order_key_ids_[0]).isNull()) {
-      return false;
-    }
-
-    // Get the boundary value if it is not UNBOUNDED.
-    if (num_preceding_ > -1) {
-      // num_preceding needs to be negated for calculation.
-      std::int64_t neg_num_preceding = -num_preceding_;
-      TypedValue start_boundary_value =
-          range_add_operator_->applyToTypedValues(
-              tuple_accessor->getTypedValue(order_key_ids_[0]),
-              long_type.makeValue(&neg_num_preceding));
-      if (!range_comparator_->compareTypedValues(start_boundary_value, test_value)) {
-        return false;
-      }
-    }
-
-    if (num_following_ > -1) {
-      TypedValue end_boundary_value =
-          range_add_operator_->applyToTypedValues(
-              tuple_accessor->getTypedValue(order_key_ids_[0]),
-              long_type.makeValue(&num_following_));
-      if (!range_comparator_->compareTypedValues(test_value, end_boundary_value)) {
-        return false;
-      }
-    }
-  }
-
-  return true;
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/window_aggregation/WindowAggregationHandle.hpp
----------------------------------------------------------------------
diff --git a/expressions/window_aggregation/WindowAggregationHandle.hpp b/expressions/window_aggregation/WindowAggregationHandle.hpp
deleted file mode 100644
index 3569123..0000000
--- a/expressions/window_aggregation/WindowAggregationHandle.hpp
+++ /dev/null
@@ -1,173 +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_EXPRESSIONS_WINDOW_AGGREGATION_WINDOW_AGGREGATION_HANDLE_HPP_
-#define QUICKSTEP_EXPRESSIONS_WINDOW_AGGREGATION_WINDOW_AGGREGATION_HANDLE_HPP_
-
-#include <cstddef>
-#include <memory>
-#include <vector>
-
-#include "catalog/CatalogRelationSchema.hpp"
-#include "catalog/CatalogTypedefs.hpp"
-#include "storage/StorageBlockInfo.hpp"
-#include "types/Type.hpp"
-#include "types/TypeFactory.hpp"
-#include "types/TypeID.hpp"
-#include "types/TypedValue.hpp"
-#include "types/containers/ColumnVector.hpp"
-#include "types/containers/ColumnVectorsValueAccessor.hpp"
-#include "types/operations/comparisons/Comparison.hpp"
-#include "types/operations/comparisons/ComparisonFactory.hpp"
-#include "types/operations/comparisons/ComparisonID.hpp"
-#include "types/operations/binary_operations/BinaryOperation.hpp"
-#include "types/operations/binary_operations/BinaryOperationFactory.hpp"
-#include "types/operations/binary_operations/BinaryOperationID.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-
-class Scalar;
-class Type;
-class ValueAccessor;
-
-/** \addtogroup Expressions
- *  @{
- */
-
-/**
- * @brief WindowAggregationHandle encapsulates logic for actually computing
- *        window aggregates with particular argument(s).
- * @note See also WindowAggregateFunction, which represents a SQL aggregate
- *       function in the abstract sense.
- *
- * A WindowAggregationHandle is created by calling
- * WindowAggregateFunction::createHandle(). The WindowAggregationHandle object
- * provides methods that are used to actually compute the window aggregate.
- *
- * The work flow for computing a window aggregate is:
- *     1. One thread will handle all the computation, iterating from the first
- *        tuple to the last tuple. Note there will be two modes that could be
- *        used upon different situations:
- *        a. If the window aggregate is defined as accumulative, which are:
- *           i.  Functions applied to whole partition, such as rank(), ntile()
- *               and dense_rank(). (Not implemented yet).
- *           ii. The window frame is defined as "BETWEEN UNBOUNDED PRECEDING
- *               AND CURRENT ROW" or "BETWEEN CURRENT ROW AND UNBOUNDED
- *               FOLLOWING".
- *           Then, for functions except median, we could store some global
- *           values without keeping all the tuple values around. For simplicity,
- *           in avg(), count() and sum(), we treat the accumulative one as
- *           sliding window since the time complexity does not vary.
- *        b. If the window frame is sliding, such as "BETWEEN 3 PRECEDING AND
- *           3 FOLLOWING", we have to store all the tuples in the state (at
- *           least two pointers to the start tuple and end tuple), so that
- *           we could know which values should be dropped as the window slides.
- *        For each computed value, generate a TypedValue and store it into a
- *        ColumnVector for window aggregate values.
- *     2. Return the result ColumnVector.
- *
- * TODO(Shixuan): Currently we don't support parallelization. The basic idea for
- * parallelization is to calculate the partial result inside each block. Each
- * block could visit the following blocks as long as the block's last partition
- * is not finished. WindowAggregationOperationState will be used for handling
- * the global state of the calculation.
- **/
-
-class WindowAggregationHandle {
- public:
-  /**
-   * @brief Destructor.
-   **/
-  virtual ~WindowAggregationHandle() {}
-
-  /**
-   * @brief Calculate the window aggregate result.
-   *
-   * @param block_accessors A pointer to the value accessor of block attributes.
-   * @param arguments The ColumnVectors of arguments
-   *
-   * @return A ColumnVector of the calculated window aggregates.
-   **/
-  virtual ColumnVector* calculate(ColumnVectorsValueAccessor* block_accessors,
-                                  const std::vector<ColumnVector*> &arguments) const = 0;
-
- protected:
-  /**
-   * @brief Constructor.
-   *
-   * @param partition_by_attributes A list of attributes used as partition key.
-   * @param order_by_attributes A list of attributes used as order key.
-   * @param is_row True if the frame mode is ROWS, false if RANGE.
-   * @param num_preceding The number of rows/range that precedes the current row.
-   * @param num_following The number of rows/range that follows the current row.
-   **/
-  WindowAggregationHandle(
-      const std::vector<std::unique_ptr<const Scalar>> &partition_by_attributes,
-      const std::vector<std::unique_ptr<const Scalar>> &order_by_attributes,
-      const bool is_row,
-      const std::int64_t num_preceding,
-      const std::int64_t num_following);
-
-  /**
-   * @brief Check if test tuple is in the same partition as the current
-   *        tuple in the accessor.
-   *
-   * @param tuple_accessor The ValueAccessor for tuples.
-   * @param test_tuple_id The id of the test tuple.
-   *
-   * @return True if test tuple is in the same partition as the current tuple in
-   *         the accessor, false if not.
-   **/
-  bool samePartition(const ColumnVectorsValueAccessor *tuple_accessor,
-                     const tuple_id test_tuple_id) const;
-
-  /**
-   * @brief Check if test tuple is in the defined range.
-   *
-   * @param tuple_accessor The ValueAccessor for tuples.
-   * @param test_tuple_id The id of the test tuple.
-   *
-   * @return True if test tuple is in the defined window, false if not.
-   **/
-  bool inWindow(const ColumnVectorsValueAccessor *tuple_accessor,
-                const tuple_id test_tuple_id) const;
-
-  // IDs and comparators for partition keys.
-  std::vector<attribute_id> partition_key_ids_;
-  std::vector<std::unique_ptr<UncheckedComparator>> partition_equal_comparators_;
-
-  // IDs, type, Comparator and operator for frame boundary check in RANGE mode.
-  std::vector<attribute_id> order_key_ids_;
-  std::unique_ptr<UncheckedBinaryOperator> range_add_operator_;
-  std::unique_ptr<UncheckedComparator> range_comparator_;  // Less than or Equal
-  const Type* range_compare_type_;
-
-  // Window frame information.
-  const bool is_row_;
-  const std::int64_t num_preceding_;
-  const std::int64_t num_following_;
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(WindowAggregationHandle);
-};
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_EXPRESSIONS_WINDOW_AGGREGATION_WINDOW_AGGREGATION_HANDLE_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/window_aggregation/WindowAggregationHandleAvg.cpp
----------------------------------------------------------------------
diff --git a/expressions/window_aggregation/WindowAggregationHandleAvg.cpp b/expressions/window_aggregation/WindowAggregationHandleAvg.cpp
deleted file mode 100644
index b1c6e3b..0000000
--- a/expressions/window_aggregation/WindowAggregationHandleAvg.cpp
+++ /dev/null
@@ -1,174 +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 "expressions/window_aggregation/WindowAggregationHandleAvg.hpp"
-
-#include <cstddef>
-#include <memory>
-#include <vector>
-
-#include "catalog/CatalogTypedefs.hpp"
-#include "expressions/window_aggregation/WindowAggregationHandle.hpp"
-#include "storage/ValueAccessor.hpp"
-#include "types/Type.hpp"
-#include "types/TypeFactory.hpp"
-#include "types/TypeID.hpp"
-#include "types/TypedValue.hpp"
-#include "types/containers/ColumnVectorsValueAccessor.hpp"
-#include "types/operations/binary_operations/BinaryOperation.hpp"
-#include "types/operations/binary_operations/BinaryOperationFactory.hpp"
-#include "types/operations/binary_operations/BinaryOperationID.hpp"
-#include "types/operations/comparisons/Comparison.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-WindowAggregationHandleAvg::WindowAggregationHandleAvg(
-    const std::vector<std::unique_ptr<const Scalar>> &partition_by_attributes,
-    const std::vector<std::unique_ptr<const Scalar>> &order_by_attributes,
-    const bool is_row,
-    const std::int64_t num_preceding,
-    const std::int64_t num_following,
-    const Type *argument_type)
-    : WindowAggregationHandle(partition_by_attributes,
-                              order_by_attributes,
-                              is_row,
-                              num_preceding,
-                              num_following) {
-  // We sum Int as Long and Float as Double so that we have more headroom when
-  // adding many values.
-  TypeID type_id;
-  switch (argument_type->getTypeID()) {
-    case kInt:
-    case kLong:
-      type_id = kLong;
-      break;
-    case kFloat:
-    case kDouble:
-      type_id = kDouble;
-      break;
-    default:
-      type_id = argument_type->getTypeID();
-      break;
-  }
-
-  sum_type_ = &(TypeFactory::GetType(type_id));
-
-  // Result is nullable, because AVG() over 0 values (or all NULL values) is
-  // NULL.
-  result_type_
-      = &(BinaryOperationFactory::GetBinaryOperation(BinaryOperationID::kDivide)
-              .resultTypeForArgumentTypes(*sum_type_, TypeFactory::GetType(kDouble))
-                  ->getNullableVersion());
-
-  // Make operators to do arithmetic:
-  // Add operator for summing argument values.
-  fast_add_operator_.reset(
-      BinaryOperationFactory::GetBinaryOperation(BinaryOperationID::kAdd)
-          .makeUncheckedBinaryOperatorForTypes(*sum_type_, *argument_type));
-
-  // Subtract operator for dropping argument values off the window.
-  fast_subtract_operator_.reset(
-      BinaryOperationFactory::GetBinaryOperation(BinaryOperationID::kSubtract)
-          .makeUncheckedBinaryOperatorForTypes(*sum_type_, *argument_type));
-
-  // Divide operator for dividing sum by count to get final average.
-  divide_operator_.reset(
-      BinaryOperationFactory::GetBinaryOperation(BinaryOperationID::kDivide)
-          .makeUncheckedBinaryOperatorForTypes(*sum_type_, TypeFactory::GetType(kDouble)));
-}
-
-ColumnVector* WindowAggregationHandleAvg::calculate(
-    ColumnVectorsValueAccessor *tuple_accessor,
-    const std::vector<ColumnVector*> &arguments) const {
-  DCHECK_EQ(1u, arguments.size());
-  DCHECK(arguments[0]->isNative());
-  DCHECK_EQ(static_cast<std::size_t>(tuple_accessor->getNumTuples()),
-            static_cast<const NativeColumnVector*>(arguments[0])->size());
-
-  // Initialize the output column and argument accessor.
-  NativeColumnVector *window_aggregates =
-      new NativeColumnVector(*result_type_, tuple_accessor->getNumTuples());
-  ColumnVectorsValueAccessor *argument_accessor = new ColumnVectorsValueAccessor();
-  argument_accessor->addColumn(arguments[0]);
-
-  // Initialize the information about the window.
-  TypedValue sum = sum_type_->makeZeroValue();
-  std::uint64_t count = 0;
-  tuple_id start_tuple_id = 0;  // The id of the first tuple in the window.
-  tuple_id end_tuple_id = 0;  // The id of the tuple that just passed the last
-                              // tuple in the window.
-
-  // Create a window for each tuple and calculate the window aggregate.
-  tuple_accessor->beginIteration();
-  argument_accessor->beginIteration();
-
-  while (tuple_accessor->next() && argument_accessor->next()) {
-    tuple_id current_tuple_id = tuple_accessor->getCurrentPosition();
-
-    // If current tuple is not in the same partition as the previous tuple,
-    // reset the window.
-    if (!samePartition(tuple_accessor, current_tuple_id - 1)) {
-      start_tuple_id = current_tuple_id;
-      end_tuple_id = current_tuple_id;
-      count = 0;
-      sum = sum_type_->makeZeroValue();
-    }
-
-    // Drop tuples that will be out of the window from the beginning.
-    while (!inWindow(tuple_accessor, start_tuple_id)) {
-      TypedValue start_value =
-          argument_accessor->getTypedValueAtAbsolutePosition(0, start_tuple_id);
-      // Ignore the value if NULL.
-      if (!start_value.isNull()) {
-        sum = fast_subtract_operator_->applyToTypedValues(sum, start_value);
-        count--;
-      }
-
-      start_tuple_id++;
-    }
-
-    // Add tuples that will be included by the window at the end.
-    while (inWindow(tuple_accessor, end_tuple_id)) {
-      TypedValue end_value =
-          argument_accessor->getTypedValueAtAbsolutePosition(0, end_tuple_id);
-
-      // Ignore the value if NULL.
-      if (!end_value.isNull()) {
-        sum = fast_add_operator_->applyToTypedValues(sum, end_value);
-        count++;
-      }
-
-      end_tuple_id++;
-    }
-
-    // If all values are NULLs, return NULL; Otherwise, return the quotient.
-    if (count == 0) {
-      window_aggregates->appendTypedValue(result_type_->makeNullValue());
-    } else {
-      window_aggregates->appendTypedValue(
-          divide_operator_->applyToTypedValues(sum, TypedValue(static_cast<double>(count))));
-    }
-  }
-
-  return window_aggregates;
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/window_aggregation/WindowAggregationHandleAvg.hpp
----------------------------------------------------------------------
diff --git a/expressions/window_aggregation/WindowAggregationHandleAvg.hpp b/expressions/window_aggregation/WindowAggregationHandleAvg.hpp
deleted file mode 100644
index e3885f0..0000000
--- a/expressions/window_aggregation/WindowAggregationHandleAvg.hpp
+++ /dev/null
@@ -1,92 +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_EXPRESSIONS_WINDOW_AGGREGATION_WINDOW_AGGREGATION_HANDLE_AVG_HPP_
-#define QUICKSTEP_EXPRESSIONS_WINDOW_AGGREGATION_WINDOW_AGGREGATION_HANDLE_AVG_HPP_
-
-#include <cstddef>
-#include <cstdint>
-#include <memory>
-#include <queue>
-#include <vector>
-
-#include "catalog/CatalogTypedefs.hpp"
-#include "expressions/window_aggregation/WindowAggregationHandle.hpp"
-#include "types/Type.hpp"
-#include "types/TypedValue.hpp"
-#include "types/operations/binary_operations/BinaryOperation.hpp"
-#include "utility/Macros.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-class ColumnVector;
-class ColumnVectorsValueAccessor;
-class ValueAccessor;
-
-/** \addtogroup Expressions
- *  @{
- */
-
-/**
- * @brief A WindowAggregationHandle for average.
- **/
-class WindowAggregationHandleAvg : public WindowAggregationHandle {
- public:
-  ~WindowAggregationHandleAvg() override {}
-
-  ColumnVector* calculate(ColumnVectorsValueAccessor* block_accessors,
-                          const std::vector<ColumnVector*> &arguments) const override;
-
- private:
-  friend class WindowAggregateFunctionAvg;
-
-  /**
-   * @brief Constructor.
-   *
-   * @param partition_by_attributes A list of attributes used as partition key.
-   * @param order_by_attributes A list of attributes used as order key.
-   * @param is_row True if the frame mode is ROWS, false if RANGE.
-   * @param num_preceding The number of rows/range that precedes the current row.
-   * @param num_following The number of rows/range that follows the current row.
-   * @param argument_type Type of the argument.
-   **/
-  WindowAggregationHandleAvg(
-      const std::vector<std::unique_ptr<const Scalar>> &partition_by_attributes,
-      const std::vector<std::unique_ptr<const Scalar>> &order_by_attributes,
-      const bool is_row,
-      const std::int64_t num_preceding,
-      const std::int64_t num_following,
-      const Type *argument_type);
-
-  const Type *sum_type_;
-  const Type *result_type_;
-  std::unique_ptr<UncheckedBinaryOperator> fast_add_operator_;
-  std::unique_ptr<UncheckedBinaryOperator> fast_subtract_operator_;
-  std::unique_ptr<UncheckedBinaryOperator> divide_operator_;
-
-  DISALLOW_COPY_AND_ASSIGN(WindowAggregationHandleAvg);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_EXPRESSIONS_WINDOW_AGGREGATION_WINDOW_AGGREGATION_HANDLE_AVG_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/window_aggregation/WindowAggregationID.hpp
----------------------------------------------------------------------
diff --git a/expressions/window_aggregation/WindowAggregationID.hpp b/expressions/window_aggregation/WindowAggregationID.hpp
deleted file mode 100644
index da90357..0000000
--- a/expressions/window_aggregation/WindowAggregationID.hpp
+++ /dev/null
@@ -1,44 +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_EXPRESSIONS_WINDOW_AGGREGATION_WINDOW_AGGREGATION_ID_HPP_
-#define QUICKSTEP_EXPRESSIONS_WINDOW_AGGREGATION_WINDOW_AGGREGATION_ID_HPP_
-
-namespace quickstep {
-
-/** \addtogroup Expressions
- *  @{
- */
-
-/**
- * @brief The possible types of window aggregations.
- **/
-enum class WindowAggregationID {
-  kAvg,
-  kCount,
-  kMin,
-  kMax,
-  kSum
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_EXPRESSIONS_WINDOW_AGGREGATION_WINDOW_AGGREGATION_ID_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/window_aggregation/tests/WindowAggregationHandleAvg_unittest.cpp
----------------------------------------------------------------------
diff --git a/expressions/window_aggregation/tests/WindowAggregationHandleAvg_unittest.cpp b/expressions/window_aggregation/tests/WindowAggregationHandleAvg_unittest.cpp
deleted file mode 100644
index 6e1364a..0000000
--- a/expressions/window_aggregation/tests/WindowAggregationHandleAvg_unittest.cpp
+++ /dev/null
@@ -1,518 +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 <cstddef>
-#include <cstdint>
-#include <memory>
-#include <vector>
-
-#include "catalog/CatalogAttribute.hpp"
-#include "catalog/CatalogTypedefs.hpp"
-#include "expressions/scalar/Scalar.hpp"
-#include "expressions/scalar/ScalarAttribute.hpp"
-#include "expressions/window_aggregation/WindowAggregateFunction.hpp"
-#include "expressions/window_aggregation/WindowAggregateFunctionFactory.hpp"
-#include "expressions/window_aggregation/WindowAggregationHandle.hpp"
-#include "expressions/window_aggregation/WindowAggregationID.hpp"
-#include "storage/ValueAccessor.hpp"
-#include "types/CharType.hpp"
-#include "types/DateOperatorOverloads.hpp"
-#include "types/DatetimeIntervalType.hpp"
-#include "types/DoubleType.hpp"
-#include "types/FloatType.hpp"
-#include "types/IntType.hpp"
-#include "types/IntervalLit.hpp"
-#include "types/LongType.hpp"
-#include "types/Type.hpp"
-#include "types/TypeFactory.hpp"
-#include "types/TypeID.hpp"
-#include "types/TypedValue.hpp"
-#include "types/VarCharType.hpp"
-#include "types/YearMonthIntervalType.hpp"
-#include "types/containers/ColumnVector.hpp"
-#include "types/containers/ColumnVectorsValueAccessor.hpp"
-
-#include "gtest/gtest.h"
-
-namespace quickstep {
-
-namespace {
-
-  constexpr int kNumTuples = 100;
-  constexpr int kNumTuplesPerPartition = 8;
-  constexpr int kNullInterval = 25;
-  constexpr int kNumPreceding = 2;
-  constexpr int kNumFollowing = 2;
-  constexpr int kPartitionKeyIndex = 0;
-  constexpr int kOrderKeyIndex = 1;
-  constexpr int kNumTuplesPerOrderKey = 2;
-
-}  // namespace
-
-// Attribute value could be null if set true.
-class WindowAggregationHandleAvgTest : public::testing::Test {
- protected:
-  // Handle initialization.
-  WindowAggregationHandle* initializeHandle(const Type &argument_type,
-                                            const bool is_row = true,
-                                            const std::int64_t num_preceding = -1,
-                                            const std::int64_t num_following = 0) {
-    const WindowAggregateFunction &function =
-        WindowAggregateFunctionFactory::Get(WindowAggregationID::kAvg);
-    const Type &int_type = TypeFactory::GetType(kInt, false);
-    std::vector<std::unique_ptr<const Scalar>> partition_by_attributes;
-    std::vector<std::unique_ptr<const Scalar>> order_by_attributes;
-    partition_by_attributes.emplace_back(
-        new ScalarAttribute(CatalogAttribute(nullptr, "partition_key", int_type, kPartitionKeyIndex)));
-    order_by_attributes.emplace_back(
-        new ScalarAttribute(CatalogAttribute(nullptr, "order_key", int_type, kOrderKeyIndex)));
-    std::vector<const Type*> partition_key_types(1, &TypeFactory::GetType(kInt, false));
-
-    return function.createHandle(std::vector<const Type*>(1, &argument_type),
-                                 partition_by_attributes,
-                                 order_by_attributes,
-                                 is_row,
-                                 num_preceding,
-                                 num_following);
-  }
-
-  // Test canApplyToTypes().
-  static bool CanApplyToTypesTest(TypeID typeID) {
-    const Type &type = (typeID == kChar || typeID == kVarChar) ?
-        TypeFactory::GetType(typeID, static_cast<std::size_t>(10)) :
-        TypeFactory::GetType(typeID);
-
-    return WindowAggregateFunctionFactory::Get(WindowAggregationID::kAvg).canApplyToTypes(
-        std::vector<const Type*>(1, &type));
-  }
-
-  // Test resultTypeForArgumentTypes().
-  static bool ResultTypeForArgumentTypesTest(TypeID input_type_id,
-                                             TypeID output_type_id) {
-    const Type *result_type
-        = WindowAggregateFunctionFactory::Get(WindowAggregationID::kAvg).resultTypeForArgumentTypes(
-            std::vector<const Type*>(1, &TypeFactory::GetType(input_type_id)));
-    return (result_type->getTypeID() == output_type_id);
-  }
-
-  template <typename CppType>
-  static void CheckAvgValues(
-      const std::vector<CppType*> &expected,
-      const ColumnVector *actual) {
-    EXPECT_TRUE(actual->isNative());
-    const NativeColumnVector *native = static_cast<const NativeColumnVector*>(actual);
-
-    EXPECT_EQ(expected.size(), native->size());
-    for (std::size_t i = 0; i < expected.size(); ++i) {
-      if (expected[i] == nullptr) {
-        EXPECT_TRUE(native->getTypedValue(i).isNull());
-      } else {
-        EXPECT_EQ(*expected[i], native->getTypedValue(i).getLiteral<CppType>());
-      }
-    }
-  }
-
-  // Static templated methods for set a meaningful value to data types.
-  template <typename CppType>
-  static void SetDataType(int value, CppType *data) {
-    *data = value;
-  }
-
-  template <typename GenericType, typename OutputType = DoubleType>
-  void checkWindowAggregationAvgGeneric() {
-    // Create argument, partition key and cpptype vectors.
-    std::vector<typename GenericType::cpptype*> argument_cpp_vector;
-    argument_cpp_vector.reserve(kNumTuples);
-    ColumnVector *argument_type_vector =
-        createArgumentGeneric<GenericType>(&argument_cpp_vector);
-    NativeColumnVector *partition_key_vector =
-        new NativeColumnVector(IntType::InstanceNonNullable(), kNumTuples);
-    NativeColumnVector *order_key_vector =
-        new NativeColumnVector(IntType::InstanceNonNullable(), kNumTuples);
-
-    for (int i = 0; i < kNumTuples; ++i) {
-      partition_key_vector->appendTypedValue(TypedValue(i / kNumTuplesPerPartition));
-      order_key_vector->appendTypedValue(TypedValue(i / kNumTuplesPerOrderKey));
-    }
-
-    // Create tuple ValueAccessor.
-    ColumnVectorsValueAccessor *tuple_accessor = new ColumnVectorsValueAccessor();
-    tuple_accessor->addColumn(partition_key_vector);
-    tuple_accessor->addColumn(order_key_vector);
-    tuple_accessor->addColumn(argument_type_vector);
-
-    // Test UNBOUNDED PRECEDING AND CURRENT ROW.
-    checkAccumulate<GenericType, OutputType>(tuple_accessor,
-                                             argument_type_vector,
-                                             argument_cpp_vector);
-    // Test kNumPreceding PRECEDING AND kNumFollowing FOLLOWING.
-    checkSlidingWindow<GenericType, OutputType>(tuple_accessor,
-                                                argument_type_vector,
-                                                argument_cpp_vector);
-  }
-
-  template <typename GenericType>
-  ColumnVector *createArgumentGeneric(
-      std::vector<typename GenericType::cpptype*> *argument_cpp_vector) {
-    const GenericType &type = GenericType::Instance(true);
-    NativeColumnVector *column = new NativeColumnVector(type, kNumTuples);
-
-    for (int i = 0; i < kNumTuples; ++i) {
-      // Insert a NULL every kNullInterval tuples.
-      if (i % kNullInterval == 0) {
-        argument_cpp_vector->push_back(nullptr);
-        column->appendTypedValue(type.makeNullValue());
-        continue;
-      }
-
-      typename GenericType::cpptype *val = new typename GenericType::cpptype;
-
-      if (type.getTypeID() == kInt || type.getTypeID() == kLong) {
-        SetDataType(i - 10, val);
-      } else {
-        SetDataType(static_cast<float>(i - 10) / 10, val);
-      }
-
-      column->appendTypedValue(type.makeValue(val));
-      argument_cpp_vector->push_back(val);
-    }
-
-    return column;
-  }
-
-  template <typename GenericType, typename OutputType>
-  void checkAccumulate(ColumnVectorsValueAccessor *tuple_accessor,
-                       ColumnVector *argument_type_vector,
-                       const std::vector<typename GenericType::cpptype*> &argument_cpp_vector) {
-    std::vector<ColumnVector*> arguments;
-    arguments.push_back(argument_type_vector);
-
-    // Check ROWS mode.
-    WindowAggregationHandle *rows_handle =
-        initializeHandle(GenericType::Instance(true),
-                         true  /* is_row */,
-                         -1  /* num_preceding: UNBOUNDED PRECEDING */,
-                         0  /* num_following: CURRENT ROW */);
-    ColumnVector *rows_result =
-        rows_handle->calculate(tuple_accessor, arguments);
-
-    // Get the cpptype result.
-    std::vector<typename OutputType::cpptype*> rows_result_cpp_vector;
-    typename GenericType::cpptype rows_sum;
-    int rows_count;
-    for (std::size_t i = 0; i < argument_cpp_vector.size(); ++i) {
-      // Start of new partition
-      if (i % kNumTuplesPerPartition == 0) {
-        SetDataType(0, &rows_sum);
-        rows_count = 0;
-      }
-
-      typename GenericType::cpptype *value = argument_cpp_vector[i];
-      if (value != nullptr) {
-        rows_sum += *value;
-        rows_count++;
-      }
-
-      if (rows_count == 0) {
-        rows_result_cpp_vector.push_back(nullptr);
-      } else {
-        typename OutputType::cpptype *result_cpp_value =
-            new typename OutputType::cpptype;
-        *result_cpp_value = static_cast<typename OutputType::cpptype>(rows_sum) / rows_count;
-        rows_result_cpp_vector.push_back(result_cpp_value);
-      }
-    }
-
-    CheckAvgValues(rows_result_cpp_vector, rows_result);
-
-    // Check RANGE mode.
-    WindowAggregationHandle *range_handle =
-        initializeHandle(GenericType::Instance(true),
-                         false  /* is_row */,
-                         -1  /* num_preceding: UNBOUNDED PRECEDING */,
-                         0  /* num_following: CURRENT ROW */);
-    ColumnVector *range_result =
-        range_handle->calculate(tuple_accessor, arguments);
-
-    // Get the cpptype result.
-    std::vector<typename OutputType::cpptype*> range_result_cpp_vector;
-    typename GenericType::cpptype range_sum;
-    int range_count;
-    std::size_t current_tuple = 0;
-    while (current_tuple < kNumTuples) {
-      // Start of new partition
-      if (current_tuple % kNumTuplesPerPartition == 0) {
-        SetDataType(0, &range_sum);
-        range_count = 0;
-      }
-
-      // We have to consider following tuples with the same order key value.
-      std::size_t next_tuple = current_tuple;
-      while (next_tuple < kNumTuples &&
-             next_tuple / kNumTuplesPerPartition == current_tuple / kNumTuplesPerPartition &&
-             next_tuple / kNumTuplesPerOrderKey == current_tuple / kNumTuplesPerOrderKey) {
-        typename GenericType::cpptype *value = argument_cpp_vector[next_tuple];
-        if (value != nullptr) {
-          range_sum += *value;
-          range_count++;
-        }
-
-        next_tuple++;
-      }
-
-      // Calculate the result cpp value.
-      typename OutputType::cpptype *result_cpp_value = nullptr;
-      if (range_count != 0) {
-        result_cpp_value = new typename OutputType::cpptype;
-        *result_cpp_value = static_cast<typename OutputType::cpptype>(range_sum) / range_count;
-      }
-
-      // Add the result values to the tuples with in the same order key value.
-      while (current_tuple != next_tuple) {
-        range_result_cpp_vector.push_back(result_cpp_value);
-        current_tuple++;
-      }
-    }
-
-    CheckAvgValues(range_result_cpp_vector, range_result);
-  }
-
-  template <typename GenericType, typename OutputType>
-  void checkSlidingWindow(ColumnVectorsValueAccessor *tuple_accessor,
-                          ColumnVector *argument_type_vector,
-                          const std::vector<typename GenericType::cpptype*> &argument_cpp_vector) {
-    std::vector<ColumnVector*> arguments;
-    arguments.push_back(argument_type_vector);
-
-    // Check ROWS mode.
-    WindowAggregationHandle *rows_handle =
-        initializeHandle(GenericType::Instance(true),
-                         true  /* is_row */,
-                         kNumPreceding,
-                         kNumFollowing);
-    ColumnVector *rows_result =
-        rows_handle->calculate(tuple_accessor, arguments);
-
-    // Get the cpptype result.
-    // For each value, calculate all surrounding values in the window.
-    std::vector<typename OutputType::cpptype*> rows_result_cpp_vector;
-
-    for (std::size_t i = 0; i < argument_cpp_vector.size(); ++i) {
-      typename GenericType::cpptype sum;
-      SetDataType(0, &sum);
-      int count = 0;
-
-      if (argument_cpp_vector[i] != nullptr) {
-        sum += *argument_cpp_vector[i];
-        count++;
-      }
-
-      for (std::size_t precede = 1; precede <= kNumPreceding; ++precede) {
-        // Not the same partition.
-        if (i / kNumTuplesPerPartition != (i - precede) / kNumTuplesPerPartition ||
-            i < precede) {
-          break;
-        }
-
-        if (argument_cpp_vector[i - precede] != nullptr) {
-          sum += *argument_cpp_vector[i - precede];
-          count++;
-        }
-      }
-
-      for (int follow = 1; follow <= kNumPreceding; ++follow) {
-        // Not the same partition.
-        if (i / kNumTuplesPerPartition != (i + follow) / kNumTuplesPerPartition ||
-            i + follow >= kNumTuples) {
-          break;
-        }
-
-        if (argument_cpp_vector[i + follow] != nullptr) {
-          sum += *argument_cpp_vector[i + follow];
-          count++;
-        }
-      }
-
-      if (count == 0) {
-        rows_result_cpp_vector.push_back(nullptr);
-      } else {
-        typename OutputType::cpptype *result_cpp_value =
-            new typename OutputType::cpptype;
-        *result_cpp_value = static_cast<typename OutputType::cpptype>(sum) / count;
-        rows_result_cpp_vector.push_back(result_cpp_value);
-      }
-    }
-
-    CheckAvgValues(rows_result_cpp_vector, rows_result);
-
-    // Check RANGE mode.
-    WindowAggregationHandle *range_handle =
-        initializeHandle(GenericType::Instance(true),
-                         false  /* is_row */,
-                         kNumPreceding,
-                         kNumFollowing);
-    ColumnVector *range_result =
-        range_handle->calculate(tuple_accessor, arguments);
-
-    // Get the cpptype result.
-    // For each value, calculate all surrounding values in the window.
-    std::vector<typename OutputType::cpptype*> range_result_cpp_vector;
-
-    for (std::size_t i = 0; i < argument_cpp_vector.size(); ++i) {
-      typename GenericType::cpptype sum;
-      SetDataType(0, &sum);
-      int count = 0;
-
-      if (argument_cpp_vector[i] != nullptr) {
-        sum += *argument_cpp_vector[i];
-        count++;
-      }
-
-      int preceding_bound = i / kNumTuplesPerOrderKey - kNumPreceding;
-      for (std::size_t precede = 1; precede <= kNumTuples; ++precede) {
-        // Not in range or the same partition.
-        if (i / kNumTuplesPerPartition != (i - precede) / kNumTuplesPerPartition ||
-            static_cast<int>((i - precede) / kNumTuplesPerOrderKey) < preceding_bound) {
-          break;
-        }
-
-        if (argument_cpp_vector[i - precede] != nullptr) {
-          sum += *argument_cpp_vector[i - precede];
-          count++;
-        }
-      }
-
-      int following_bound = i / kNumTuplesPerOrderKey + kNumFollowing;
-      for (int follow = 1; follow <= kNumTuples; ++follow) {
-        // Not in range or the same partition.
-        if (i + follow >= kNumTuples ||
-            i / kNumTuplesPerPartition != (i + follow) / kNumTuplesPerPartition ||
-            static_cast<int>((i + follow) / kNumTuplesPerOrderKey) > following_bound) {
-          break;
-        }
-
-        if (argument_cpp_vector[i + follow] != nullptr) {
-          sum += *argument_cpp_vector[i + follow];
-          count++;
-        }
-      }
-
-      if (count == 0) {
-        rows_result_cpp_vector.push_back(nullptr);
-      } else {
-        typename OutputType::cpptype *result_cpp_value =
-            new typename OutputType::cpptype;
-        *result_cpp_value = static_cast<typename OutputType::cpptype>(sum) / count;
-        range_result_cpp_vector.push_back(result_cpp_value);
-      }
-    }
-
-    CheckAvgValues(range_result_cpp_vector, range_result);
-  }
-};
-
-template <>
-void WindowAggregationHandleAvgTest::CheckAvgValues<double>(
-    const std::vector<double*> &expected,
-    const ColumnVector *actual) {
-  EXPECT_TRUE(actual->isNative());
-  const NativeColumnVector *native = static_cast<const NativeColumnVector*>(actual);
-
-  EXPECT_EQ(expected.size(), native->size());
-  for (std::size_t i = 0; i < expected.size(); ++i) {
-    if (expected[i] == nullptr) {
-      EXPECT_TRUE(native->getTypedValue(i).isNull());
-    } else {
-      EXPECT_EQ(*expected[i], native->getTypedValue(i).getLiteral<double>());
-    }
-  }
-}
-
-template <>
-void WindowAggregationHandleAvgTest::SetDataType<DatetimeIntervalLit>(
-    int value, DatetimeIntervalLit *data) {
-  data->interval_ticks = value;
-}
-
-template <>
-void WindowAggregationHandleAvgTest::SetDataType<YearMonthIntervalLit>(
-    int value, YearMonthIntervalLit *data) {
-  data->months = value;
-}
-
-typedef WindowAggregationHandleAvgTest WindowAggregationHandleAvgDeathTest;
-
-TEST_F(WindowAggregationHandleAvgTest, IntTypeTest) {
-  checkWindowAggregationAvgGeneric<IntType>();
-}
-
-TEST_F(WindowAggregationHandleAvgTest, LongTypeTest) {
-  checkWindowAggregationAvgGeneric<LongType>();
-}
-
-TEST_F(WindowAggregationHandleAvgTest, FloatTypeTest) {
-  checkWindowAggregationAvgGeneric<FloatType>();
-}
-
-TEST_F(WindowAggregationHandleAvgTest, DoubleTypeTest) {
-  checkWindowAggregationAvgGeneric<DoubleType>();
-}
-
-TEST_F(WindowAggregationHandleAvgTest, DatetimeIntervalTypeTest) {
-  checkWindowAggregationAvgGeneric<DatetimeIntervalType, DatetimeIntervalType>();
-}
-
-TEST_F(WindowAggregationHandleAvgTest, YearMonthIntervalTypeTest) {
-  checkWindowAggregationAvgGeneric<YearMonthIntervalType, YearMonthIntervalType>();
-}
-
-#ifdef QUICKSTEP_DEBUG
-TEST_F(WindowAggregationHandleAvgDeathTest, CharTypeTest) {
-  const Type &type = CharType::Instance(true, 10);
-  EXPECT_DEATH(initializeHandle(type), "");
-}
-
-TEST_F(WindowAggregationHandleAvgDeathTest, VarTypeTest) {
-  const Type &type = VarCharType::Instance(true, 10);
-  EXPECT_DEATH(initializeHandle(type), "");
-}
-#endif
-
-TEST_F(WindowAggregationHandleAvgDeathTest, canApplyToTypeTest) {
-  EXPECT_TRUE(CanApplyToTypesTest(kInt));
-  EXPECT_TRUE(CanApplyToTypesTest(kLong));
-  EXPECT_TRUE(CanApplyToTypesTest(kFloat));
-  EXPECT_TRUE(CanApplyToTypesTest(kDouble));
-  EXPECT_FALSE(CanApplyToTypesTest(kChar));
-  EXPECT_FALSE(CanApplyToTypesTest(kVarChar));
-  EXPECT_FALSE(CanApplyToTypesTest(kDatetime));
-  EXPECT_TRUE(CanApplyToTypesTest(kDatetimeInterval));
-  EXPECT_TRUE(CanApplyToTypesTest(kYearMonthInterval));
-}
-
-TEST_F(WindowAggregationHandleAvgDeathTest, ResultTypeForArgumentTypeTest) {
-  EXPECT_TRUE(ResultTypeForArgumentTypesTest(kInt, kDouble));
-  EXPECT_TRUE(ResultTypeForArgumentTypesTest(kLong, kDouble));
-  EXPECT_TRUE(ResultTypeForArgumentTypesTest(kFloat, kDouble));
-  EXPECT_TRUE(ResultTypeForArgumentTypesTest(kDouble, kDouble));
-  EXPECT_TRUE(ResultTypeForArgumentTypesTest(kDatetimeInterval, kDatetimeInterval));
-  EXPECT_TRUE(ResultTypeForArgumentTypesTest(kYearMonthInterval, kYearMonthInterval));
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/parser/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/parser/CMakeLists.txt b/parser/CMakeLists.txt
deleted file mode 100644
index b1bd870..0000000
--- a/parser/CMakeLists.txt
+++ /dev/null
@@ -1,440 +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.
-
-# Although flex option nounistd works fine for the generated cpp file, we need
-# to make sure this is also set for the header.
-set_property(
-  DIRECTORY
-  APPEND PROPERTY COMPILE_DEFINITIONS YY_NO_UNISTD_H
-)
-
-find_package(BISON)
-if (BISON_FOUND)
-  if (BISON_VERSION VERSION_GREATER 2.4 OR BISON_VERSION VERSION_EQUAL 2.4)
-    set(RUN_BISON TRUE)
-  else()
-    set(RUN_BISON FALSE)
-    message(WARNING "You are using a version of bison which is too old to build quickstep's "
-                    "parser. A preprocessed copy of the parser sources will be used.")
-  endif()
-else()
-  set(RUN_BISON FALSE)
-  message(WARNING "Unable to find bison. A preprocessed copy of the parser sources will be used.")
-endif()
-
-find_package(FLEX)
-if (FLEX_FOUND)
-  # TODO(chasseur): This might not be the exact version to test for.
-  if (FLEX_VERSION VERSION_GREATER 2.5.38)
-    set(RUN_FLEX TRUE)
-  else()
-    set(RUN_FLEX FALSE)
-    message(WARNING "You are using a version of flex which is too old to build quickstep's lexer. "
-                    "A preprocessed copy of the lexer sources will be used.")
-  endif()
-else()
-  set(RUN_FLEX FALSE)
-  message(WARNING "Unable to find flex. A preprocessed copy of the lexer sources will be used.")
-endif()
-
-
-if (RUN_BISON)
-  BISON_TARGET(SqlParser SqlParser.ypp ${CMAKE_CURRENT_BINARY_DIR}/SqlParser_gen.cpp)
-else()
-  file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/preprocessed/SqlParser_gen.hpp DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
-  file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/preprocessed/SqlParser_gen.cpp DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
-  set(BISON_SqlParser_OUTPUTS
-      ${CMAKE_CURRENT_BINARY_DIR}/SqlParser_gen.cpp
-      ${CMAKE_CURRENT_BINARY_DIR}/SqlParser_gen.hpp)
-endif()
-
-if (RUN_FLEX)
-  FILE(TO_NATIVE_PATH "${CMAKE_CURRENT_BINARY_DIR}/SqlLexer_gen.hpp" LEXER_HEADER_FILE)
-  FLEX_TARGET(SqlLexer SqlLexer.lpp ${CMAKE_CURRENT_BINARY_DIR}/SqlLexer_gen.cpp
-              COMPILE_FLAGS "-i -I --header-file=${LEXER_HEADER_FILE}")
-  if (RUN_BISON)
-    ADD_FLEX_BISON_DEPENDENCY(SqlLexer SqlParser)
-  endif()
-else()
-  file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/preprocessed/SqlLexer_gen.hpp DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
-  file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/preprocessed/SqlLexer_gen.cpp DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
-  set(FLEX_SqlLexer_OUTPUTS
-      ${CMAKE_CURRENT_BINARY_DIR}/SqlLexer_gen.cpp
-      ${CMAKE_CURRENT_BINARY_DIR}/SqlLexer_gen.hpp)
-  if (RUN_BISON)
-    set_source_files_properties(
-        ${CMAKE_CURRENT_BINARY_DIR}/SqlLexer_gen.hpp
-        ${CMAKE_CURRENT_BINARY_DIR}/SqlLexer_gen.cpp
-        PROPERTIES OBJECT_DEPENDS ${BISON_SqlParser_OUTPUT_HEADER})
-  endif()
-endif()
-
-# Declare micro-libs:
-add_library(quickstep_parser_ParseAssignment ../empty_src.cpp ParseAssignment.hpp)
-add_library(quickstep_parser_ParseAttributeDefinition ParseAttributeDefinition.cpp ParseAttributeDefinition.hpp)
-add_library(quickstep_parser_ParseBasicExpressions ParseBasicExpressions.cpp ParseBasicExpressions.hpp)
-add_library(quickstep_parser_ParseBlockProperties ParseBlockProperties.cpp ParseBlockProperties.hpp)
-add_library(quickstep_parser_ParseCaseExpressions ParseCaseExpressions.cpp ParseCaseExpressions.hpp)
-add_library(quickstep_parser_ParseExpression ../empty_src.cpp ParseExpression.hpp)
-add_library(quickstep_parser_ParseGeneratorTableReference ParseGeneratorTableReference.cpp ParseGeneratorTableReference.hpp)
-add_library(quickstep_parser_ParseGroupBy ParseGroupBy.cpp ParseGroupBy.hpp)
-add_library(quickstep_parser_ParseHaving ParseHaving.cpp ParseHaving.hpp)
-add_library(quickstep_parser_ParseIndexProperties ParseIndexProperties.cpp ParseIndexProperties.hpp)
-add_library(quickstep_parser_ParseJoinedTableReference ParseJoinedTableReference.cpp ParseJoinedTableReference.hpp)
-add_library(quickstep_parser_ParseKeyValue ../empty_src.cpp ParseKeyValue.hpp)
-add_library(quickstep_parser_ParseLimit ParseLimit.cpp ParseLimit.hpp)
-add_library(quickstep_parser_ParseLiteralValue ParseLiteralValue.cpp ParseLiteralValue.hpp)
-add_library(quickstep_parser_ParseOrderBy ParseOrderBy.cpp ParseOrderBy.hpp)
-add_library(quickstep_parser_ParsePartitionClause ../empty_src.cpp ParsePartitionClause.hpp)
-add_library(quickstep_parser_ParsePredicate ParsePredicate.cpp ParsePredicate.hpp)
-add_library(quickstep_parser_ParsePredicateExists ../empty_src.cpp ParsePredicateExists.hpp)
-add_library(quickstep_parser_ParsePredicateInTableQuery ../empty_src.cpp ParsePredicateInTableQuery.hpp)
-add_library(quickstep_parser_ParsePriority ../empty_src.cpp ParsePriority.hpp)
-add_library(quickstep_parser_ParseSample ParseSample.cpp ParseSample.hpp)
-add_library(quickstep_parser_ParseSelect ../empty_src.cpp ParseSelect.hpp)
-add_library(quickstep_parser_ParseSelectionClause ParseSelectionClause.cpp ParseSelectionClause.hpp)
-add_library(quickstep_parser_ParseSimpleTableReference ParseSimpleTableReference.cpp ParseSimpleTableReference.hpp)
-add_library(quickstep_parser_ParseStatement ../empty_src.cpp ParseStatement.hpp)
-add_library(quickstep_parser_ParseString ParseString.cpp ParseString.hpp)
-add_library(quickstep_parser_ParseSubqueryExpression ParseSubqueryExpression.cpp ParseSubqueryExpression.hpp)
-add_library(quickstep_parser_ParseSubqueryTableReference ParseSubqueryTableReference.cpp ParseSubqueryTableReference.hpp)
-add_library(quickstep_parser_ParseTableReference ParseTableReference.cpp ParseTableReference.hpp)
-add_library(quickstep_parser_ParseTreeNode ../empty_src.cpp ParseTreeNode.hpp)
-add_library(quickstep_parser_ParseWindow ../empty_src.cpp ParseWindow.hpp)
-add_library(quickstep_parser_ParserUtil ParserUtil.cpp ParserUtil.hpp)
-add_library(quickstep_parser_SqlParserWrapper SqlParserWrapper.cpp SqlParserWrapper.hpp)
-add_library(quickstep_parser_SqlParser ${BISON_SqlParser_OUTPUTS})
-add_library(quickstep_parser_SqlLexer ${FLEX_SqlLexer_OUTPUTS})
-
-# Link dependencies:
-target_link_libraries(quickstep_parser_ParseAssignment
-                      quickstep_parser_ParseExpression
-                      quickstep_parser_ParseString
-                      quickstep_parser_ParseTreeNode
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_parser_ParseAttributeDefinition
-                      quickstep_parser_ParseString
-                      quickstep_parser_ParseTreeNode
-                      quickstep_types_Type
-                      quickstep_utility_Macros
-                      quickstep_utility_PtrList)
-target_link_libraries(quickstep_parser_ParseBasicExpressions
-                      quickstep_parser_ParseExpression
-                      quickstep_parser_ParseLiteralValue
-                      quickstep_parser_ParseString
-                      quickstep_parser_ParseTreeNode
-                      quickstep_parser_ParseWindow
-                      quickstep_types_operations_binaryoperations_BinaryOperation
-                      quickstep_types_operations_unaryoperations_UnaryOperation
-                      quickstep_utility_Macros
-                      quickstep_utility_PtrList)
-target_link_libraries(quickstep_parser_ParseBlockProperties
-                      glog
-                      quickstep_parser_ParseKeyValue
-                      quickstep_parser_ParseString
-                      quickstep_parser_ParseTreeNode
-                      quickstep_utility_Macros
-                      quickstep_utility_PtrList
-                      quickstep_utility_StringUtil)
-target_link_libraries(quickstep_parser_ParseCaseExpressions
-                      quickstep_parser_ParseExpression
-                      quickstep_parser_ParsePredicate
-                      quickstep_parser_ParseTreeNode
-                      quickstep_utility_Macros
-                      quickstep_utility_PtrVector)
-target_link_libraries(quickstep_parser_ParseExpression
-                      quickstep_parser_ParseTreeNode
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_parser_ParseGeneratorTableReference
-                      quickstep_parser_ParseBasicExpressions
-                      quickstep_parser_ParseTableReference
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_parser_ParseGroupBy
-                      quickstep_parser_ParseExpression
-                      quickstep_parser_ParseTreeNode
-                      quickstep_utility_Macros
-                      quickstep_utility_PtrList)
-target_link_libraries(quickstep_parser_ParseHaving
-                      quickstep_parser_ParsePredicate
-                      quickstep_parser_ParseTreeNode
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_parser_ParseIndexProperties
-                      glog
-                      quickstep_parser_ParseKeyValue
-                      quickstep_parser_ParseString
-                      quickstep_parser_ParseTreeNode
-                      quickstep_storage_StorageBlockLayout_proto
-                      quickstep_utility_Macros
-                      quickstep_utility_PtrList
-                      quickstep_utility_StringUtil)
-target_link_libraries(quickstep_parser_ParseJoinedTableReference
-                      quickstep_parser_ParsePredicate
-                      quickstep_parser_ParseTableReference
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_parser_ParseLimit
-                      quickstep_parser_ParseLiteralValue
-                      quickstep_parser_ParseTreeNode
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_parser_ParseLiteralValue
-                      glog
-                      quickstep_parser_ParseString
-                      quickstep_parser_ParseTreeNode
-                      quickstep_types_DatetimeIntervalType
-                      quickstep_types_DoubleType
-                      quickstep_types_IntType
-                      quickstep_types_LongType
-                      quickstep_types_NullType
-                      quickstep_types_Type
-                      quickstep_types_TypedValue
-                      quickstep_types_VarCharType
-                      quickstep_types_YearMonthIntervalType
-                      quickstep_utility_Macros
-                      quickstep_utility_SqlError)
-target_link_libraries(quickstep_parser_ParseOrderBy
-                      quickstep_parser_ParseExpression
-                      quickstep_parser_ParseTreeNode
-                      quickstep_utility_Macros
-                      quickstep_utility_PtrList)
-target_link_libraries(quickstep_parser_ParsePartitionClause
-                      quickstep_parser_ParseLiteralValue
-                      quickstep_parser_ParseString
-                      quickstep_parser_ParseTreeNode
-                      quickstep_utility_Macros
-                      quickstep_utility_PtrList)
-target_link_libraries(quickstep_parser_ParsePredicate
-                      quickstep_parser_ParseExpression
-                      quickstep_parser_ParseTreeNode
-                      quickstep_types_operations_comparisons_Comparison
-                      quickstep_utility_Macros
-                      quickstep_utility_PtrList)
-target_link_libraries(quickstep_parser_ParsePredicateExists
-                      quickstep_parser_ParsePredicate
-                      quickstep_parser_ParseSubqueryExpression
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_parser_ParsePredicateInTableQuery
-                      quickstep_parser_ParseExpression
-                      quickstep_parser_ParsePredicate
-                      quickstep_parser_ParseSubqueryExpression
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_parser_ParsePriority
-                      quickstep_parser_ParseLiteralValue
-                      quickstep_parser_ParseTreeNode
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_parser_ParseSample
-                      quickstep_parser_ParseLiteralValue
-                      quickstep_parser_ParseTreeNode
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_parser_ParseSelect
-                      glog
-                      quickstep_parser_ParseGroupBy
-                      quickstep_parser_ParseHaving
-                      quickstep_parser_ParseLimit
-                      quickstep_parser_ParseOrderBy
-                      quickstep_parser_ParsePredicate
-                      quickstep_parser_ParseSelectionClause
-                      quickstep_parser_ParseTableReference
-                      quickstep_parser_ParseTreeNode
-                      quickstep_parser_ParseWindow
-                      quickstep_utility_Macros
-                      quickstep_utility_PtrList)
-target_link_libraries(quickstep_parser_ParseSelectionClause
-                      quickstep_parser_ParseExpression
-                      quickstep_parser_ParseString
-                      quickstep_parser_ParseTreeNode
-                      quickstep_utility_Macros
-                      quickstep_utility_PtrList)
-target_link_libraries(quickstep_parser_ParseSimpleTableReference
-                      quickstep_parser_ParseSample
-                      quickstep_parser_ParseString
-                      quickstep_parser_ParseTableReference
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_parser_ParseStatement
-                      glog
-                      quickstep_parser_ParseAssignment
-                      quickstep_parser_ParseAttributeDefinition
-                      quickstep_parser_ParseBasicExpressions
-                      quickstep_parser_ParseBlockProperties
-                      quickstep_parser_ParseIndexProperties
-                      quickstep_parser_ParseKeyValue
-                      quickstep_parser_ParsePartitionClause
-                      quickstep_parser_ParsePredicate
-                      quickstep_parser_ParsePriority
-                      quickstep_parser_ParseSelect
-                      quickstep_parser_ParseString
-                      quickstep_parser_ParseSubqueryTableReference
-                      quickstep_parser_ParseTreeNode
-                      quickstep_storage_StorageBlockInfo
-                      quickstep_utility_Macros
-                      quickstep_utility_PtrList
-                      quickstep_utility_PtrVector)
-target_link_libraries(quickstep_parser_ParseString
-                      quickstep_parser_ParseTreeNode
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_parser_ParseKeyValue
-                      quickstep_parser_ParseLiteralValue
-                      quickstep_parser_ParseString
-                      quickstep_parser_ParseTreeNode
-                      quickstep_utility_Macros
-                      quickstep_utility_PtrList)
-target_link_libraries(quickstep_parser_ParseSubqueryExpression
-                      glog
-                      quickstep_parser_ParseExpression
-                      quickstep_parser_ParseSelect
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_parser_ParseSubqueryTableReference
-                      quickstep_parser_ParseSubqueryExpression
-                      quickstep_parser_ParseTableReference
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_parser_ParseTableReference
-                      quickstep_parser_ParseString
-                      quickstep_parser_ParseTreeNode
-                      quickstep_utility_Macros
-                      quickstep_utility_PtrList)
-target_link_libraries(quickstep_parser_ParseTreeNode
-                      quickstep_utility_Macros
-                      quickstep_utility_TreeStringSerializable)
-target_link_libraries(quickstep_parser_ParserUtil
-                      quickstep_utility_SqlError)
-target_link_libraries(quickstep_parser_ParseWindow
-                      quickstep_parser_ParseExpression
-                      quickstep_parser_ParseOrderBy
-                      quickstep_parser_ParseString
-                      quickstep_parser_ParseTreeNode
-                      quickstep_utility_PtrList)
-target_link_libraries(quickstep_parser_SqlLexer
-                      quickstep_parser_ParseJoinedTableReference
-                      quickstep_parser_ParseLiteralValue
-                      quickstep_parser_ParserUtil
-                      quickstep_parser_ParseString
-                      quickstep_parser_SqlParser
-                      quickstep_utility_PtrList
-                      quickstep_utility_PtrVector)
-target_link_libraries(quickstep_parser_SqlParser
-                      quickstep_catalog_PartitionSchemeHeader
-                      quickstep_parser_ParseAssignment
-                      quickstep_parser_ParseAttributeDefinition
-                      quickstep_parser_ParseBasicExpressions
-                      quickstep_parser_ParseBlockProperties
-                      quickstep_parser_ParseCaseExpressions
-                      quickstep_parser_ParseExpression
-                      quickstep_parser_ParseGeneratorTableReference
-                      quickstep_parser_ParseGroupBy
-                      quickstep_parser_ParseHaving
-                      quickstep_parser_ParseJoinedTableReference
-                      quickstep_parser_ParseKeyValue
-                      quickstep_parser_ParseLimit
-                      quickstep_parser_ParseLiteralValue
-                      quickstep_parser_ParseOrderBy
-                      quickstep_parser_ParsePartitionClause
-                      quickstep_parser_ParsePredicate
-                      quickstep_parser_ParsePredicateExists
-                      quickstep_parser_ParsePredicateInTableQuery
-                      quickstep_parser_ParsePriority
-                      quickstep_parser_ParseSample
-                      quickstep_parser_ParseSelect
-                      quickstep_parser_ParseSelectionClause
-                      quickstep_parser_ParseSimpleTableReference
-                      quickstep_parser_ParseStatement
-                      quickstep_parser_ParseString
-                      quickstep_parser_ParseSubqueryExpression
-                      quickstep_parser_ParseSubqueryTableReference
-                      quickstep_parser_ParseTableReference
-                      quickstep_parser_ParseWindow
-                      quickstep_parser_ParserUtil
-                      quickstep_storage_StorageBlockInfo
-                      quickstep_types_Type
-                      quickstep_types_TypeFactory
-                      quickstep_types_TypeID
-                      quickstep_types_operations_binaryoperations_BinaryOperation
-                      quickstep_types_operations_binaryoperations_BinaryOperationFactory
-                      quickstep_types_operations_binaryoperations_BinaryOperationID
-                      quickstep_types_operations_comparisons_Comparison
-                      quickstep_types_operations_comparisons_ComparisonFactory
-                      quickstep_types_operations_comparisons_ComparisonID
-                      quickstep_types_operations_unaryoperations_UnaryOperation
-                      quickstep_types_operations_unaryoperations_UnaryOperationFactory
-                      quickstep_types_operations_unaryoperations_UnaryOperationID
-                      quickstep_utility_PtrList
-                      quickstep_utility_PtrVector)
-target_link_libraries(quickstep_parser_SqlParserWrapper
-                      glog
-                      quickstep_parser_ParseJoinedTableReference
-                      quickstep_parser_ParseStatement
-                      quickstep_parser_SqlLexer
-                      quickstep_parser_SqlParser
-                      quickstep_utility_Macros
-                      quickstep_utility_SqlError)
-
-# Dependencies on generated sources.
-set_property(SOURCE SqlParserWrapper.cpp APPEND PROPERTY OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/SqlParser_gen.hpp)
-# The dependency is on the header, but this picks up the generated sources
-# from the CMake environment.
-set_property(SOURCE SqlParserWrapper.cpp APPEND PROPERTY OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/SqlLexer_gen.cpp)
-set_property(SOURCE ${CMAKE_CURRENT_BINARY_DIR}/SqlParser_gen.cpp APPEND PROPERTY OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/SqlLexer_gen.cpp)
-
-# Lexers generated by some versions of Flex use the C "register" keyword. This
-# supresses warnings about that for the lexer ONLY.
-include(CheckCXXCompilerFlag)
-CHECK_CXX_COMPILER_FLAG("-Wno-deprecated-register" COMPILER_HAS_WNO_DEPRECATED_REGISTER)
-if (COMPILER_HAS_WNO_DEPRECATED_REGISTER)
-  set_target_properties(quickstep_parser_SqlLexer PROPERTIES COMPILE_FLAGS "-Wno-deprecated-register")
-endif()
-
-# GCC will make a warning for unsigned-signed comparisons which are inherent
-# in the lexer. For this, we turn off the sign compare.
-set_target_properties(quickstep_parser_SqlLexer PROPERTIES COMPILE_FLAGS "-Wno-sign-compare")
-
-add_subdirectory(tests)
-
-# Module all-in-one library:
-add_library(quickstep_parser ../empty_src.cpp ParserModule.hpp)
-target_link_libraries(quickstep_parser
-                      quickstep_parser_ParseAssignment
-                      quickstep_parser_ParseAttributeDefinition
-                      quickstep_parser_ParseBasicExpressions
-                      quickstep_parser_ParseBlockProperties
-                      quickstep_parser_ParseCaseExpressions
-                      quickstep_parser_ParseExpression
-                      quickstep_parser_ParseGeneratorTableReference
-                      quickstep_parser_ParseGroupBy
-                      quickstep_parser_ParseHaving
-                      quickstep_parser_ParseIndexProperties
-                      quickstep_parser_ParseJoinedTableReference
-                      quickstep_parser_ParseLimit
-                      quickstep_parser_ParseLiteralValue
-                      quickstep_parser_ParseOrderBy
-                      quickstep_parser_ParsePartitionClause
-                      quickstep_parser_ParsePredicate
-                      quickstep_parser_ParsePredicateExists
-                      quickstep_parser_ParsePredicateInTableQuery
-                      quickstep_parser_ParsePriority
-                      quickstep_parser_ParserUtil
-                      quickstep_parser_ParseSample
-                      quickstep_parser_ParseSelect
-                      quickstep_parser_ParseSelectionClause
-                      quickstep_parser_ParseSimpleTableReference
-                      quickstep_parser_ParseStatement
-                      quickstep_parser_ParseString
-                      quickstep_parser_ParseKeyValue
-                      quickstep_parser_ParseSubqueryExpression
-                      quickstep_parser_ParseSubqueryTableReference
-                      quickstep_parser_ParseTableReference
-                      quickstep_parser_ParseTreeNode
-                      quickstep_parser_ParseWindow
-                      quickstep_parser_SqlLexer
-                      quickstep_parser_SqlParser
-                      quickstep_parser_SqlParserWrapper)

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/parser/ParseAssignment.hpp
----------------------------------------------------------------------
diff --git a/parser/ParseAssignment.hpp b/parser/ParseAssignment.hpp
deleted file mode 100644
index eea0a7c..0000000
--- a/parser/ParseAssignment.hpp
+++ /dev/null
@@ -1,110 +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_PARSER_PARSE_ASSIGNMENT_HPP_
-#define QUICKSTEP_PARSER_PARSE_ASSIGNMENT_HPP_
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "parser/ParseExpression.hpp"
-#include "parser/ParseString.hpp"
-#include "parser/ParseTreeNode.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-
-/** \addtogroup Parser
- *  @{
- */
-
-/**
- * @brief Parsed representation of an assignment of a value to an attribute.
- **/
-class ParseAssignment : public ParseTreeNode {
- public:
-  /**
-   * @brief Constructor
-   *
-   * @param line_number The line number of the first token of this parser node.
-   * @param column_number The column number of the first token of this parser node.
-   * @param attr_name The name of the attribute in the assignment.
-   * @param value The scalar value of the assignment (becomes owned by this
-   *        ParseAssignment).
-   **/
-  ParseAssignment(const int line_number, const int column_number, ParseString *attr_name, ParseExpression *value)
-      : ParseTreeNode(line_number, column_number), attr_name_(attr_name), value_(value) {
-  }
-
-  /**
-   * @brief Destructor.
-   **/
-  ~ParseAssignment() override {
-  }
-
-  std::string getName() const override {
-    return "AttributeAssignment";
-  }
-
-  /**
-   * @brief Get the name of the attribute in the assignment.
-   *
-   * @return The attribute name.
-   **/
-  const ParseString* attr_name() const {
-    return attr_name_.get();
-  }
-
-  /**
-   * @brief Get the scalar in the assignment.
-   *
-   * @return The scalar value.
-   **/
-  const ParseExpression& value() const {
-    return *value_;
-  }
-
- 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<const ParseTreeNode*> *non_container_child_fields,
-      std::vector<std::string> *container_child_field_names,
-      std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const override {
-    inline_field_names->push_back("attribute_name");
-    inline_field_values->push_back(attr_name_->value());
-
-    non_container_child_field_names->push_back("value");
-    non_container_child_fields->push_back(value_.get());
-  }
-
- private:
-  std::unique_ptr<ParseString> attr_name_;
-  std::unique_ptr<ParseExpression> value_;
-
-  DISALLOW_COPY_AND_ASSIGN(ParseAssignment);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_PARSER_PARSE_ASSIGNMENT_HPP_


[43/51] [abbrv] [partial] incubator-quickstep git commit: remove c++ files

Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/compression/CompressionDictionary.cpp
----------------------------------------------------------------------
diff --git a/compression/CompressionDictionary.cpp b/compression/CompressionDictionary.cpp
deleted file mode 100644
index 72c183f..0000000
--- a/compression/CompressionDictionary.cpp
+++ /dev/null
@@ -1,415 +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 "compression/CompressionDictionary.hpp"
-
-#include <cstddef>
-#include <cstdint>
-#include <iterator>
-#include <limits>
-#include <utility>
-
-#include "compression/CompressionDictionaryLite.hpp"
-#include "types/TypedValue.hpp"
-#include "types/operations/comparisons/ComparisonID.hpp"
-#include "types/operations/comparisons/ComparisonUtil.hpp"
-#include "types/operations/comparisons/EqualComparison.hpp"
-#include "utility/Macros.hpp"
-
-#include "glog/logging.h"
-
-using std::numeric_limits;
-using std::pair;
-using std::size_t;
-using std::uint32_t;
-
-namespace quickstep {
-
-namespace compression_dictionary_internal {
-
-template <bool variable_length>
-class CompressionDictionaryIterator : public std::iterator<std::random_access_iterator_tag, const void*> {
- public:
-  typedef std::iterator<std::random_access_iterator_tag, const void*>::difference_type difference_type;
-
-  CompressionDictionaryIterator(const CompressionDictionary &dictionary, const uint32_t code)
-      : dictionary_(&dictionary),
-        code_(code) {
-  }
-
-  CompressionDictionaryIterator()
-      : dictionary_(nullptr),
-        code_(0) {
-  }
-
-  CompressionDictionaryIterator(const CompressionDictionaryIterator &other)
-      : dictionary_(other.dictionary_),
-        code_(other.code_) {
-  }
-
-  CompressionDictionaryIterator& operator=(const CompressionDictionaryIterator& other) = default;
-
-  // Comparisons.
-  inline bool operator==(const CompressionDictionaryIterator& other) const {
-    DCHECK_EQ(dictionary_, other.dictionary_);
-    return code_ == other.code_;
-  }
-
-  inline bool operator!=(const CompressionDictionaryIterator& other) const {
-    DCHECK_EQ(dictionary_, other.dictionary_);
-    return code_ != other.code_;
-  }
-
-  inline bool operator<(const CompressionDictionaryIterator& other) const {
-    DCHECK_EQ(dictionary_, other.dictionary_);
-    return code_ < other.code_;
-  }
-
-  inline bool operator<=(const CompressionDictionaryIterator& other) const {
-    DCHECK_EQ(dictionary_, other.dictionary_);
-    return code_ <= other.code_;
-  }
-
-  inline bool operator>(const CompressionDictionaryIterator& other) const {
-    DCHECK_EQ(dictionary_, other.dictionary_);
-    return code_ > other.code_;
-  }
-
-  inline bool operator>=(const CompressionDictionaryIterator& other) const {
-    DCHECK_EQ(dictionary_, other.dictionary_);
-    return code_ >= other.code_;
-  }
-
-  // Increment/decrement.
-  inline CompressionDictionaryIterator& operator++() {
-    ++code_;
-    return *this;
-  }
-
-  CompressionDictionaryIterator operator++(int) {
-    CompressionDictionaryIterator result(*this);
-    ++(*this);
-    return result;
-  }
-
-  inline CompressionDictionaryIterator& operator--() {
-    --code_;
-    return *this;
-  }
-
-  CompressionDictionaryIterator operator--(int) {
-    CompressionDictionaryIterator result(*this);
-    --(*this);
-    return result;
-  }
-
-  // Compound assignment.
-  inline CompressionDictionaryIterator& operator+=(difference_type n) {
-    code_ += n;
-    return *this;
-  }
-
-  inline CompressionDictionaryIterator& operator-=(difference_type n) {
-    code_ -= n;
-    return *this;
-  }
-
-  // Note: + operator with difference_type on the left is not defined.
-  CompressionDictionaryIterator operator+(difference_type n) const {
-    return CompressionDictionaryIterator(dictionary_, code_ + n);
-  }
-
-  CompressionDictionaryIterator operator-(difference_type n) const {
-    return CompressionDictionaryIterator(dictionary_, code_ - n);
-  }
-
-  difference_type operator-(const CompressionDictionaryIterator &other) const {
-    DCHECK_EQ(dictionary_, other.dictionary_);
-    return code_ - other.code_;
-  }
-
-  // Dereference.
-  inline const void* operator*() const {
-    DCHECK(dictionary_ != nullptr);
-    if (variable_length) {
-      return dictionary_->variableLengthGetUntypedValueHelper<std::uint32_t>(code_);
-    } else {
-      return dictionary_->fixedLengthGetUntypedValueHelper<std::uint32_t>(code_);
-    }
-  }
-
-  inline const void** operator->() const {
-    FATAL_ERROR("-> dereference operator unimplemented for CompressionDictionaryIterator.");
-  }
-
-  const void* operator[](difference_type n) const {
-    DCHECK(dictionary_ != nullptr);
-    if (variable_length) {
-      return dictionary_->variableLengthGetUntypedValueHelper<std::uint32_t>(code_ + n);
-    } else {
-      return dictionary_->fixedLengthGetUntypedValueHelper<std::uint32_t>(code_ + n);
-    }
-  }
-
-  uint32_t getCode() const {
-    return code_;
-  }
-
- private:
-  const CompressionDictionary *dictionary_;
-  uint32_t code_;
-};
-
-}  // namespace compression_dictionary_internal
-
-using compression_dictionary_internal::CompressionDictionaryIterator;
-
-uint32_t CompressionDictionary::getCodeForUntypedValue(const void *value) const {
-  if (value == nullptr) {
-    return getNullCode() == numeric_limits<uint32_t>::max() ? number_of_codes_including_null_
-                                                            : getNullCode();
-  }
-
-  uint32_t candidate_code = getLowerBoundCodeForUntypedValue(value);
-  if (candidate_code >= *static_cast<const uint32_t*>(dictionary_memory_)) {
-    return number_of_codes_including_null_;
-  }
-
-  if (CheckUntypedValuesEqual(type_, value, getUntypedValueForCode(candidate_code))) {
-    return candidate_code;
-  } else {
-    return number_of_codes_including_null_;
-  }
-}
-
-std::pair<uint32_t, uint32_t> CompressionDictionary::getLimitCodesForComparisonUntyped(
-    const ComparisonID comp,
-    const void *value) const {
-  if (value == nullptr) {
-    return pair<uint32_t, uint32_t>(number_of_codes_including_null_,
-                                    number_of_codes_including_null_);
-  }
-
-  pair<uint32_t, uint32_t> limit_codes;
-  switch (comp) {
-    case ComparisonID::kEqual:
-      limit_codes.first = getCodeForUntypedValue(value);
-      limit_codes.second = (limit_codes.first == number_of_codes_including_null_)
-                           ? limit_codes.first
-                           : limit_codes.first + 1;
-      break;
-    case ComparisonID::kNotEqual:
-      LOG(FATAL) << "Called CompressionDictionary::getLimitCodesForComparisonUntyped() "
-                 << "with comparison kNotEqual, which is not allowed.";
-    case ComparisonID::kLess:
-      limit_codes.first = 0;
-      limit_codes.second = getLowerBoundCodeForUntypedValue(value, true);
-      break;
-    case ComparisonID::kLessOrEqual:
-      limit_codes.first = 0;
-      limit_codes.second = getUpperBoundCodeForUntypedValue(value);
-      break;
-    case ComparisonID::kGreater:
-      limit_codes.first = getUpperBoundCodeForUntypedValue(value);
-      limit_codes.second = *static_cast<const uint32_t*>(dictionary_memory_);
-      break;
-    case ComparisonID::kGreaterOrEqual:
-      limit_codes.first = getLowerBoundCodeForUntypedValue(value);
-      limit_codes.second = *static_cast<const uint32_t*>(dictionary_memory_);
-      break;
-    default:
-      LOG(FATAL) << "Unknown comparison in CompressionDictionary::getLimitCodesForComparisonUntyped().";
-  }
-
-  return limit_codes;
-}
-
-std::uint32_t CompressionDictionary::getCodeForDifferentTypedValue(const TypedValue &value,
-                                                                   const Type &value_type) const {
-  if (value.isNull()) {
-    return getNullCode() == numeric_limits<uint32_t>::max() ? number_of_codes_including_null_
-                                                            : getNullCode();
-  }
-
-  uint32_t candidate_code = getLowerBoundCodeForDifferentTypedValue(value, value_type);
-  if (candidate_code >= *static_cast<const uint32_t*>(dictionary_memory_)) {
-    return candidate_code;
-  }
-
-  if (EqualComparison::Instance().compareTypedValuesChecked(
-          value, value_type,
-          getTypedValueForCode(candidate_code), type_)) {
-    return candidate_code;
-  } else {
-    return number_of_codes_including_null_;
-  }
-}
-
-std::pair<uint32_t, uint32_t> CompressionDictionary::getLimitCodesForComparisonDifferentTyped(
-    const ComparisonID comp,
-    const TypedValue &value,
-    const Type &value_type) const {
-  if (value.isNull()) {
-    return pair<uint32_t, uint32_t>(number_of_codes_including_null_,
-                                    number_of_codes_including_null_);
-  }
-
-  pair<uint32_t, uint32_t> limit_codes;
-  switch (comp) {
-    case ComparisonID::kEqual:
-      limit_codes.first = getCodeForDifferentTypedValue(value, value_type);
-      limit_codes.second = (limit_codes.first == number_of_codes_including_null_)
-                           ? limit_codes.first
-                           : limit_codes.first + 1;
-      break;
-    case ComparisonID::kNotEqual:
-      LOG(FATAL) << "Called CompressionDictionary::getLimitCodesForComparisonTyped() "
-                 <<  "with comparison kNotEqual, which is not allowed.";
-    case ComparisonID::kLess:
-      limit_codes.first = 0;
-      limit_codes.second = getLowerBoundCodeForDifferentTypedValue(value, value_type, true);
-      break;
-    case ComparisonID::kLessOrEqual:
-      limit_codes.first = 0;
-      limit_codes.second = getUpperBoundCodeForDifferentTypedValue(value, value_type);
-      break;
-    case ComparisonID::kGreater:
-      limit_codes.first = getUpperBoundCodeForDifferentTypedValue(value, value_type);
-      limit_codes.second = *static_cast<const uint32_t*>(dictionary_memory_);
-      break;
-    case ComparisonID::kGreaterOrEqual:
-      limit_codes.first = getLowerBoundCodeForDifferentTypedValue(value, value_type);
-      limit_codes.second = *static_cast<const uint32_t*>(dictionary_memory_);
-      break;
-    default:
-      LOG(FATAL) << "Unknown comparison in CompressionDictionary::getLimitCodesForComparisonTyped().";
-  }
-
-  return limit_codes;
-}
-
-uint32_t CompressionDictionary::getLowerBoundCodeForUntypedValue(const void *value,
-                                                                 const bool ignore_null_code) const {
-  uint32_t code;
-  if (type_is_variable_length_) {
-    CompressionDictionaryIterator<true> begin_it(*this, 0);
-    CompressionDictionaryIterator<true> end_it(*this,
-                                               *static_cast<const uint32_t*>(dictionary_memory_));
-    code = GetBoundForUntypedValue<CompressionDictionaryIterator<true>, LowerBoundFunctor>(
-        type_,
-        begin_it,
-        end_it,
-        value).getCode();
-  } else {
-    CompressionDictionaryIterator<false> begin_it(*this, 0);
-    CompressionDictionaryIterator<false> end_it(*this,
-                                                *static_cast<const uint32_t*>(dictionary_memory_));
-    code = GetBoundForUntypedValue<CompressionDictionaryIterator<false>, LowerBoundFunctor>(
-        type_,
-        begin_it,
-        end_it,
-        value).getCode();
-  }
-
-  return !ignore_null_code && (code == *static_cast<const uint32_t*>(dictionary_memory_))
-             ? number_of_codes_including_null_
-             : code;
-}
-
-uint32_t CompressionDictionary::getUpperBoundCodeForUntypedValue(const void *value) const {
-  if (type_is_variable_length_) {
-    CompressionDictionaryIterator<true> begin_it(*this, 0);
-    CompressionDictionaryIterator<true> end_it(*this,
-                                               *static_cast<const uint32_t*>(dictionary_memory_));
-    return GetBoundForUntypedValue<CompressionDictionaryIterator<true>, UpperBoundFunctor>(
-        type_,
-        begin_it,
-        end_it,
-        value).getCode();
-  } else {
-    CompressionDictionaryIterator<false> begin_it(*this, 0);
-    CompressionDictionaryIterator<false> end_it(*this,
-                                                *static_cast<const uint32_t*>(dictionary_memory_));
-    return GetBoundForUntypedValue<CompressionDictionaryIterator<false>, UpperBoundFunctor>(
-        type_,
-        begin_it,
-        end_it,
-        value).getCode();
-  }
-}
-
-uint32_t CompressionDictionary::getLowerBoundCodeForDifferentTypedValue(
-    const TypedValue &value,
-    const Type &value_type,
-    const bool ignore_null_code) const {
-  uint32_t code;
-  if (type_is_variable_length_) {
-    CompressionDictionaryIterator<true> begin_it(*this, 0);
-    CompressionDictionaryIterator<true> end_it(*this,
-                                               *static_cast<const uint32_t*>(dictionary_memory_));
-    code = GetBoundForDifferentTypedValue<CompressionDictionaryIterator<true>, LowerBoundFunctor>(
-        type_,
-        begin_it,
-        end_it,
-        value,
-        value_type).getCode();
-  } else {
-    CompressionDictionaryIterator<false> begin_it(*this, 0);
-    CompressionDictionaryIterator<false> end_it(*this,
-                                                *static_cast<const uint32_t*>(dictionary_memory_));
-    code = GetBoundForDifferentTypedValue<CompressionDictionaryIterator<false>, LowerBoundFunctor>(
-        type_,
-        begin_it,
-        end_it,
-        value,
-        value_type).getCode();
-  }
-
-  return !ignore_null_code && (code == *static_cast<const uint32_t*>(dictionary_memory_))
-             ? number_of_codes_including_null_
-             : code;
-}
-
-uint32_t CompressionDictionary::getUpperBoundCodeForDifferentTypedValue(
-    const TypedValue &value,
-    const Type &value_type) const {
-  if (type_is_variable_length_) {
-    CompressionDictionaryIterator<true> begin_it(*this, 0);
-    CompressionDictionaryIterator<true> end_it(*this,
-                                               *static_cast<const uint32_t*>(dictionary_memory_));
-    return GetBoundForDifferentTypedValue<CompressionDictionaryIterator<true>, UpperBoundFunctor>(
-        type_,
-        begin_it,
-        end_it,
-        value,
-        value_type).getCode();
-  } else {
-    CompressionDictionaryIterator<false> begin_it(*this, 0);
-    CompressionDictionaryIterator<false> end_it(*this,
-                                                *static_cast<const uint32_t*>(dictionary_memory_));
-    return GetBoundForDifferentTypedValue<CompressionDictionaryIterator<false>, UpperBoundFunctor>(
-        type_,
-        begin_it,
-        end_it,
-        value,
-        value_type).getCode();
-  }
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/compression/CompressionDictionary.hpp
----------------------------------------------------------------------
diff --git a/compression/CompressionDictionary.hpp b/compression/CompressionDictionary.hpp
deleted file mode 100644
index 27592e8..0000000
--- a/compression/CompressionDictionary.hpp
+++ /dev/null
@@ -1,260 +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_COMPRESSION_COMPRESSION_DICTIONARY_HPP_
-#define QUICKSTEP_COMPRESSION_COMPRESSION_DICTIONARY_HPP_
-
-#include <cstddef>
-#include <cstdint>
-#include <limits>
-#include <utility>
-
-#include "compression/CompressionDictionaryLite.hpp"
-#include "types/Type.hpp"
-#include "types/TypedValue.hpp"
-#include "types/operations/comparisons/ComparisonID.hpp"
-#include "utility/Macros.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-namespace compression_dictionary_internal {
-template <bool variable_length_type> class CompressionDictionaryIterator;
-}
-
-/** \addtogroup Compression
- *  @{
- */
-
-// In-memory format of a CompressionDictionary is as follows:
-//     std::uint32_t num_codes - number of codes/values stored in dictionary
-//                               (excluding NULL)
-//     std::uint32_t null_code - a code representing a NULL value (equal to
-//                               num_codes if NULL is present, or the maximum
-//                               possible value of std::uint32_t if NULL is not
-//                               present)
-// For fixed-length types:
-//     array of num_codes values
-// For variable-length types:
-//     array of num_codes offsets of variable-length values
-//     variable-length storage region, with values stored at offsets specified
-//         by previous array.
-
-/**
- * @brief Extends the basic interface provided by CompressionDictionaryLite
- *        with methods for inverse lookup.
- **/
-class CompressionDictionary : public CompressionDictionaryLite {
- public:
-  /**
-   * @brief Constructor.
-   *
-   * @param type The type of values being compressed. LessComparison must be
-   *        applicable to this Type.
-   * @param dictionary_memory The memory location of the physical dictionary.
-   * @param dictionary_memory_size The size (in bytes) of the physical
-   *        dictionary at dictionary_memory.
-   **/
-  CompressionDictionary(const Type &type,
-                        const void *dictionary_memory,
-                        const std::size_t dictionary_memory_size)
-      : CompressionDictionaryLite(type, dictionary_memory, dictionary_memory_size) {
-  }
-
-  virtual ~CompressionDictionary() {
-  }
-
-  /**
-   * @brief Get the compressed code that represents the specified untyped
-   *        value.
-   * @note This uses a binary search to find the appropriate code. It runs in
-   *       O(log(n)) time.
-   *
-   * @param value An untyped pointer to a value, which must be of the exact
-   *        same Type as the Type used to construct this dictionary.
-   * @return The code for value in this dictionary, or the value of
-   *         numberOfCodes() (the maximum code plus one) if value is not
-   *         contained in this dictionary.
-   **/
-  std::uint32_t getCodeForUntypedValue(const void *value) const;
-
-  /**
-   * @brief Get the compressed code that represents the specified typed value.
-   * @note This uses a binary search to find the appropriate code. It runs in
-   *       O(log(n)) time.
-   *
-   * @param value A typed value, which can be either the exact same Type as
-   *        the values in this dictionary, or another Type which is comparable
-   *        according to LessComparison.
-   * @param value_type The Type that value belongs to.
-   * @return The code for value in this dictionary, or the value of
-   *         numberOfCodes() (the maximum code plus one) if value is not
-   *         contained in this dictionary.
-   **/
-  std::uint32_t getCodeForTypedValue(const TypedValue &value,
-                                     const Type &value_type) const {
-    if (value.isNull()) {
-      return getNullCode() == std::numeric_limits<std::uint32_t>::max() ? number_of_codes_including_null_
-                                                                        : getNullCode();
-    } else if (value_type.isSubsumedBy(type_)) {
-      return getCodeForUntypedValue(value.getDataPtr());
-    } else {
-      return getCodeForDifferentTypedValue(value, value_type);
-    }
-  }
-
-  /**
-   * @brief Find the first code which is not less than the specified untyped
-   *        value, similar to std::lower_bound().
-   * @warning value must not be NULL.
-   *
-   * @param value An untyped pointer to a value, which must be of the exact
-   *        same Type as the Type used to construct this dictionary.
-   * @return The first code whose corresponding uncompressed value is not less
-   *         than value. May return numberOfCodes() if every value in the
-   *         dictionary is less than value.
-   **/
-  std::uint32_t getLowerBoundCodeForUntypedValue(const void *value,
-                                                 const bool ignore_null_code = false) const;
-
-  /**
-   * @brief Find the first code which is not less than the specified typed
-   *        value, similar to std::lower_bound().
-   * @warning value must not be NULL.
-   *
-   * @param value A typed value, which can be either the exact same Type as
-   *        the values in this dictionary, or another Type which is comparable
-   *        according to LessComparison.
-   * @param value_type The Type that value belongs to.
-   * @return The first code whose corresponding uncompressed value is not less
-   *         than value. May return numberOfCodes() if every value in the
-   *         dictionary is less than value.
-   **/
-  std::uint32_t getLowerBoundCodeForTypedValue(const TypedValue &value,
-                                               const Type &value_type,
-                                               const bool ignore_null_code = false) const {
-    DCHECK(!value.isNull());
-    if (value_type.isSubsumedBy(type_)) {
-      return getLowerBoundCodeForUntypedValue(value.getDataPtr(), ignore_null_code);
-    } else {
-      return getLowerBoundCodeForDifferentTypedValue(value, value_type, ignore_null_code);
-    }
-  }
-
-  /**
-   * @brief Find the first code which is greater than the specified untyped
-   *        value, similar to std::upper_bound().
-   * @warning value must not be NULL.
-   *
-   * @param value An untyped pointer to a value, which must be of the exact
-   *        same Type as the Type used to construct this dictionary.
-   * @return The first code whose corresponding uncompressed value is greater
-   *         than value. May return numberOfCodes() if every value in the
-   *         dictionary is less than or equal to value.
-   **/
-  std::uint32_t getUpperBoundCodeForUntypedValue(const void *value) const;
-
-  /**
-   * @brief Find the first code which is greater than the specified typed
-   *        value, similar to std::upper_bound().
-   * @warning value must not be NULL.
-   *
-   * @param value A typed value, which can be either the exact same Type as
-   *        the values in this dictionary, or another Type which is comparable
-   *        according to LessComparison.
-   * @param value_type The Type that value belongs to.
-   * @return The first code whose corresponding uncompressed value is greater
-   *         than value. May return numberOfCodes() if every value in the
-   *         dictionary is less than or equal to value.
-   **/
-  std::uint32_t getUpperBoundCodeForTypedValue(const TypedValue &value,
-                                               const Type &value_type) const {
-    DCHECK(!value.isNull());
-    if (value_type.isSubsumedBy(type_)) {
-      return getUpperBoundCodeForUntypedValue(value.getDataPtr());
-    } else {
-      return getUpperBoundCodeForDifferentTypedValue(value, value_type);
-    }
-  }
-
-  /**
-   * @brief Determine the range of codes that match a specified comparison with
-   *        a specified untyped value.
-   *
-   * @param comp The comparison to evaluate.
-   * @param value An untyped pointer to a value, which must be of the exact
-   *        same Type as the Type used to construct this dictionary.
-   * @return The limits of the range of codes which match the predicate
-   *         "coded-value comp value". The range is [first, second) (i.e. it
-   *         is inclusive of first but not second).
-   **/
-  std::pair<std::uint32_t, std::uint32_t> getLimitCodesForComparisonUntyped(
-      const ComparisonID comp,
-      const void *value) const;
-
-  /**
-   * @brief Determine the range of codes that match a specified comparison with
-   *        a specified typed value.
-   *
-   * @param comp The comparison to evaluate.
-   * @param value A typed value, which can be either the exact same Type as
-   *        the values in this dictionary, or another Type which is comparable
-   *        according to LessComparison.
-   * @param value_type The Type that value belongs to.
-   * @return The limits of the range of codes which match the predicate
-   *         "coded-value comp value". The range is [first, second) (i.e. it
-   *         is inclusive of first but not second).
-   **/
-  std::pair<std::uint32_t, std::uint32_t> getLimitCodesForComparisonTyped(
-      const ComparisonID comp,
-      const TypedValue &value,
-      const Type &value_type) const {
-    if (value_type.isSubsumedBy(type_)) {
-      return getLimitCodesForComparisonUntyped(comp,
-                                               value.isNull() ? nullptr : value.getDataPtr());
-    } else {
-      return getLimitCodesForComparisonDifferentTyped(comp, value, value_type);
-    }
-  }
-
- private:
-  friend class compression_dictionary_internal::CompressionDictionaryIterator<false>;
-  friend class compression_dictionary_internal::CompressionDictionaryIterator<true>;
-
-  std::uint32_t getCodeForDifferentTypedValue(const TypedValue &value,
-                                              const Type &value_type) const;
-  std::uint32_t getLowerBoundCodeForDifferentTypedValue(const TypedValue &value,
-                                                        const Type &value_type,
-                                                        const bool ignore_null_code = false) const;
-  std::uint32_t getUpperBoundCodeForDifferentTypedValue(const TypedValue &value,
-                                                        const Type &value_type) const;
-  std::pair<std::uint32_t, std::uint32_t> getLimitCodesForComparisonDifferentTyped(
-      const ComparisonID comp,
-      const TypedValue &value,
-      const Type &value_type) const;
-
-  DISALLOW_COPY_AND_ASSIGN(CompressionDictionary);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_COMPRESSION_COMPRESSION_DICTIONARY_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/compression/CompressionDictionaryBuilder.cpp
----------------------------------------------------------------------
diff --git a/compression/CompressionDictionaryBuilder.cpp b/compression/CompressionDictionaryBuilder.cpp
deleted file mode 100644
index 905af91..0000000
--- a/compression/CompressionDictionaryBuilder.cpp
+++ /dev/null
@@ -1,207 +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 "compression/CompressionDictionaryBuilder.hpp"
-
-#include <cstddef>
-#include <cstdint>
-#include <limits>
-#include <unordered_map>
-#include <utility>
-#include <vector>
-
-#include "types/Type.hpp"
-#include "types/TypedValue.hpp"
-#include "types/operations/comparisons/ComparisonUtil.hpp"
-
-#include "glog/logging.h"
-
-using std::numeric_limits;
-using std::pair;
-using std::uint32_t;
-using std::unordered_map;
-
-namespace quickstep {
-
-namespace {
-
-inline void CopyFixedLengthValuesToLocation(const std::vector<TypedValue> &values,
-                                            const std::size_t type_length,
-                                            char *location) {
-  for (const TypedValue &value : values) {
-    value.copyInto(location);
-    location += type_length;
-  }
-}
-
-inline void CopyVariableLengthValuesToLocation(const std::vector<TypedValue> &values,
-                                               char *location) {
-  uint32_t *offset_array_ptr = reinterpret_cast<uint32_t*>(location);
-  char *values_location = static_cast<char*>(location)
-                          + values.size() * sizeof(uint32_t);
-  uint32_t value_offset = 0;
-  for (const TypedValue &value : values) {
-    *offset_array_ptr = value_offset;
-    value.copyInto(values_location + value_offset);
-
-    ++offset_array_ptr;
-    value_offset += value.getDataSize();
-  }
-}
-
-}  // namespace
-
-CompressionDictionaryBuilder::CompressionDictionaryBuilder(const Type &type)
-    : type_(type),
-      type_is_nullable_(type.isNullable()),
-      fixed_type_length_(type.isVariableLength() ? 0 : type.maximumByteLength()),
-      last_inserted_iterator_(value_set_.end()),
-      num_values_(0),
-      code_length_bits_(0),
-      total_value_size_(0),
-      null_value_present_(false),
-      last_insert_was_null_(false),
-      may_contain_out_of_line_literal_(false),
-      built_(false) {
-}
-
-void CompressionDictionaryBuilder::buildDictionary(void *location) {
-  *static_cast<uint32_t*>(location) = num_values_ - null_value_present_;
-  *(static_cast<uint32_t*>(location) + 1)
-      = null_value_present_ ? num_values_ - 1
-                            : std::numeric_limits<uint32_t>::max();
-
-  char *copy_location = static_cast<char*>(location) + 2 * sizeof(uint32_t);
-
-  std::vector<TypedValue> sorted_values;
-  sorted_values.reserve(value_set_.size());
-  if (may_contain_out_of_line_literal_ && !TypedValue::RepresentedInline(type_.getTypeID())) {
-    // Avoid an intermediate copy of out-of-line data.
-    for (const pair<const TypedValue, uint32_t> &value_pair : value_set_) {
-      sorted_values.emplace_back(value_pair.first.makeReferenceToThis());
-    }
-  } else {
-    for (const pair<const TypedValue, uint32_t> &value_pair : value_set_) {
-      sorted_values.emplace_back(value_pair.first);
-    }
-  }
-  SortValues(type_, sorted_values.begin(), sorted_values.end());
-
-  // Update 'value_set_' with the actual codes used for each value so that
-  // getCodeForValue() can do fast lookups.
-  for (uint32_t code = 0; code < sorted_values.size(); ++code) {
-    value_set_.find(sorted_values[code])->second = code;
-  }
-
-  if (fixed_type_length_) {
-    CopyFixedLengthValuesToLocation(sorted_values, fixed_type_length_, copy_location);
-  } else {
-    CopyVariableLengthValuesToLocation(sorted_values, copy_location);
-  }
-
-  built_ = true;
-}
-
-bool CompressionDictionaryBuilder::insertEntryInternal(const TypedValue &value,
-                                                       bool by_reference) {
-  DCHECK(!built_);
-  DCHECK(value.isPlausibleInstanceOf(type_.getSignature()));
-
-  if (type_is_nullable_ && value.isNull()) {
-    last_insert_was_null_ = !null_value_present_;
-    null_value_present_ = true;
-    if (last_insert_was_null_) {
-      ++num_values_;
-      if ((code_length_bits_ == 0) || (num_values_ == (1u << code_length_bits_) + 1)) {
-        ++code_length_bits_;
-      }
-    }
-    return last_insert_was_null_;
-  }
-
-  DCHECK(!value.isNull());
-  if (num_values_ == numeric_limits<uint32_t>::max()) {
-    LOG(FATAL) << "Attempted to insert a value into a CompressionDictionaryBuilder which "
-               << "would cause it to overflow the limit of "
-               << numeric_limits<uint32_t>::max() << " entries.";
-  }
-
-  pair<unordered_map<TypedValue,
-                     uint32_t,
-                     TypedValueHasher,
-                     TypedValueEqualChecker>::iterator,
-       bool> insertion_result;
-  if (by_reference) {
-    insertion_result = value_set_.emplace(value.makeReferenceToThis(),
-                                          numeric_limits<uint32_t>::max());
-  } else {
-    insertion_result = value_set_.emplace(value,
-                                          numeric_limits<uint32_t>::max());
-  }
-  if (!insertion_result.second) {
-    return false;
-  }
-  if (!by_reference) {
-    // const_cast here is safe: TypedValue will be modified in-place and
-    // hash/compare the same.
-    const_cast<TypedValue&>(insertion_result.first->first).ensureNotReference();
-  }
-  last_inserted_iterator_ = insertion_result.first;
-  const std::size_t value_length = (fixed_type_length_ == 0) ? insertion_result.first->first.getDataSize()
-                                                             : fixed_type_length_;
-
-  // Update state.
-  last_insert_was_null_ = false;
-  ++num_values_;
-  if ((code_length_bits_ == 0) || (num_values_ == (1u << code_length_bits_) + 1)) {
-    ++code_length_bits_;
-  }
-  total_value_size_ += value_length;
-  if (total_value_size_ > numeric_limits<uint32_t>::max()) {
-    LOG(FATAL) << "Attempted to insert a value into a CompressionDictionaryBuilder which would "
-               << "overflow the limit of "
-               << numeric_limits<uint32_t>::max() << " total bytes.";
-  }
-
-  return true;
-}
-
-void CompressionDictionaryBuilder::undoLastInsert() {
-  DCHECK(!built_);
-  if (last_insert_was_null_) {
-    null_value_present_ = false;
-    last_insert_was_null_ = false;
-  } else {
-    DCHECK(last_inserted_iterator_ != value_set_.end());
-    total_value_size_ -= (fixed_type_length_ == 0) ? last_inserted_iterator_->first.getDataSize()
-                                                   : fixed_type_length_;
-    value_set_.erase(last_inserted_iterator_);
-    last_inserted_iterator_ = value_set_.end();
-  }
-
-  // Update state.
-  --num_values_;
-  if (num_values_ == 0) {
-    code_length_bits_ = 0;
-  } else if ((code_length_bits_ > 1) && (num_values_ == (1u << (code_length_bits_ - 1)))) {
-    --code_length_bits_;
-  }
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/compression/CompressionDictionaryBuilder.hpp
----------------------------------------------------------------------
diff --git a/compression/CompressionDictionaryBuilder.hpp b/compression/CompressionDictionaryBuilder.hpp
deleted file mode 100644
index cad6852..0000000
--- a/compression/CompressionDictionaryBuilder.hpp
+++ /dev/null
@@ -1,245 +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_COMPRESSION_COMPRESSION_DICTIONARY_BUILDER_HPP_
-#define QUICKSTEP_COMPRESSION_COMPRESSION_DICTIONARY_BUILDER_HPP_
-
-#include <cstddef>
-#include <cstdint>
-#include <unordered_map>
-
-#include "types/Type.hpp"
-#include "types/TypedValue.hpp"
-#include "utility/Macros.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-/** \addtogroup Compression
- *  @{
- */
-
-/**
- * @brief An object which accumulates typed values and builds a physical
- *        dictionary for a CompressionDictionary object. Usable with both
- *        fixed-length and variable-length types.
- **/
-class CompressionDictionaryBuilder {
- public:
-  /**
-   * @brief Constructor.
-   *
-   * @param type The Type to build a CompressionDictionary for. Must be
-   *        orderable by LessComparison.
-   **/
-  explicit CompressionDictionaryBuilder(const Type &type);
-
-  /**
-   * @brief Destructor.
-   **/
-  ~CompressionDictionaryBuilder() {
-  }
-
-  /**
-   * @brief Get the number of entries (unique values/codes) in the dictionary
-   *        being built.
-   *
-   * @return The number of entries in the dictionary.
-   **/
-  inline std::uint32_t numberOfEntries() const {
-    return num_values_;
-  }
-
-  /**
-   * @brief Get the number of bits needed to represent a code in the dictionary
-   *        being built.
-   *
-   * @return The length, in bits, of codes for the dictionary.
-   **/
-  inline std::uint8_t codeLengthBits() const {
-    return code_length_bits_;
-  }
-
-  /**
-   * @brief Get the number of bytes used to represent a code in the dictionary
-   *        being build when all codes are padded up to the next power-of-two
-   *        number of bytes.
-   *
-   * @return The length, in bytes, of codes padded up to a power-of-two bytes.
-   **/
-  inline std::uint8_t codeLengthPaddedBytes() const {
-    if (code_length_bits_ < 9) {
-      return 1;
-    } else if (code_length_bits_ < 17) {
-      return 2;
-    } else {
-      return 4;
-    }
-  }
-
-  /**
-   * @brief Get the number of bytes needed to store the physical dictionary
-   *        being built.
-   *
-   * @return The size, in bytes, of the dictionary.
-   **/
-  inline std::size_t dictionarySizeBytes() const {
-    if (fixed_type_length_) {
-      return 2 * sizeof(std::uint32_t) + total_value_size_;
-    } else {
-      return (num_values_ + 2 - null_value_present_) * sizeof(std::uint32_t)
-             + total_value_size_;
-    }
-  }
-
-  /**
-   * @brief Determine if the dictionary being built contains a particular
-   *        value.
-   **/
-  bool containsValue(const TypedValue &value) const {
-    DCHECK(value.isPlausibleInstanceOf(type_.getSignature()));
-    if (value.isNull()) {
-      return null_value_present_;
-    }
-    return value_set_.find(value) != value_set_.end();
-  }
-
-  /**
-   * @brief Lookup the code for a particular value in a dictionary that has
-   *        been built by this CompressionDictionaryBuilder.
-   * @note This method uses a hash-table lookup for O(1) constant time
-   *       performance in the general case, in contrast to the O(log(n))
-   *       lookup performance of CompressionDictionary::getCodeForTypedValue().
-   * @warning Only call this AFTER buildDictionary().
-   *
-   * @param value A previously-inserted value to look up.
-   * @return The code that maps to value.
-   **/
-  inline std::uint32_t getCodeForValue(const TypedValue &value) const {
-    DCHECK(value.isPlausibleInstanceOf(type_.getSignature()));
-    DCHECK(containsValue(value));
-    DCHECK(built_);
-    if (value.isNull()) {
-      return num_values_ - 1;
-    }
-    return value_set_.find(value)->second;
-  }
-
-  /**
-   * @brief Construct a physical dictionary in the specified memory location.
-   *
-   * @param location The memory location where the physical dictionary should
-   *        be built. Must have dictionarySizeBytes() available to write at
-   *        location.
-   **/
-  void buildDictionary(void *location);
-
-  /**
-   * @brief Add a value to the dictionary being built.
-   * @note This method makes a copy of the value passed in. If the caller can
-   *       guarantee that value remains in existence for the life of this
-   *       CompressionDictionaryBuilder, it is more memory-efficient to use
-   *       insertEntryByReference() instead.
-   *
-   * @param value A typed value to add to the dictionary.
-   * @return True if value has been added, false if it was already present and
-   *         the dictionary was not modified.
-   **/
-  bool insertEntry(const TypedValue &value) {
-    DCHECK(!built_);
-    // This is used in buildDictionary() to avoid an intermediate copy of
-    // out-of-line data.
-    may_contain_out_of_line_literal_ = true;
-    return insertEntryInternal(value, false);
-  }
-
-  /**
-   * @brief Add a value to the dictionary being built without copying it.
-   * @warning The caller must ensure that value is not deleted until after
-   *          done using this CompressionDictionaryBuilder.
-   *
-   * @param value A typed value to add to the dictionary.
-   * @return True if value has been added, false if it was already present and
-   *         the dictionary was not modified.
-   **/
-  bool insertEntryByReference(const TypedValue &value) {
-    DCHECK(!built_);
-    return insertEntryInternal(value, true);
-  }
-
-  /**
-   * @brief Remove the last entry successfully added to the dictionary via
-   *        insertEntry(), reducing the dictionary size and potentially
-   *        reducing the code length in bits.
-   **/
-  void undoLastInsert();
-
- private:
-  struct TypedValueHasher {
-    inline std::size_t operator()(const TypedValue &value) const {
-      return value.getHash();
-    }
-  };
-
-  struct TypedValueEqualChecker {
-    inline bool operator()(const TypedValue &left, const TypedValue &right) const {
-      return left.fastEqualCheck(right);
-    }
-  };
-
-  bool insertEntryInternal(const TypedValue &value, bool by_reference);
-
-  const Type &type_;
-  const bool type_is_nullable_;
-  std::size_t fixed_type_length_;  // 0 for variable-length types.
-
-  // Initially, the uint32_t value associated with each key is simply the max
-  // for uint32_t. buildDictionary() updates values to be the actual compressed
-  // codes for each value so that getCodeForValue() can do fast lookups.
-  std::unordered_map<TypedValue,
-                     std::uint32_t,
-                     TypedValueHasher,
-                     TypedValueEqualChecker>
-      value_set_;
-  std::unordered_map<TypedValue,
-                     std::uint32_t,
-                     TypedValueHasher,
-                     TypedValueEqualChecker>::iterator
-      last_inserted_iterator_;
-
-  std::uint32_t num_values_;
-  std::uint8_t code_length_bits_;
-  std::size_t total_value_size_;
-  bool null_value_present_;
-  bool last_insert_was_null_;
-  bool may_contain_out_of_line_literal_;
-
-  // Keeps track of whether buildDictionary() has been called for
-  // error-checking purposes.
-  bool built_;
-
-  DISALLOW_COPY_AND_ASSIGN(CompressionDictionaryBuilder);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_COMPRESSION_COMPRESSION_DICTIONARY_BUILDER_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/compression/CompressionDictionaryLite.cpp
----------------------------------------------------------------------
diff --git a/compression/CompressionDictionaryLite.cpp b/compression/CompressionDictionaryLite.cpp
deleted file mode 100644
index d21d43c..0000000
--- a/compression/CompressionDictionaryLite.cpp
+++ /dev/null
@@ -1,103 +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 "compression/CompressionDictionaryLite.hpp"
-
-#include <cstddef>
-#include <cstdint>
-
-#include "types/Type.hpp"
-
-#include "glog/logging.h"
-
-using std::size_t;
-using std::uint32_t;
-
-namespace quickstep {
-
-CompressionDictionaryLite::CompressionDictionaryLite(
-    const Type &type,
-    const void *dictionary_memory,
-    const std::size_t dictionary_memory_size)
-    : type_(type),
-      type_is_variable_length_(type_.isVariableLength()),
-      dictionary_memory_(dictionary_memory),
-      dictionary_memory_size_(dictionary_memory_size),
-      number_of_codes_including_null_(*static_cast<const uint32_t*>(dictionary_memory_)),
-      type_fixed_byte_length_(type_.maximumByteLength()) {
-  uint32_t non_null_codes = number_of_codes_including_null_;
-  if (*(static_cast<const uint32_t*>(dictionary_memory_) + 1)
-      == number_of_codes_including_null_) {
-    ++number_of_codes_including_null_;
-  }
-
-  for (code_length_bits_ = 32; code_length_bits_ > 0; --code_length_bits_) {
-    if ((number_of_codes_including_null_ - 1) >> (code_length_bits_ - 1)) {
-      break;
-    }
-  }
-
-  if (type_is_variable_length_) {
-    if (dictionary_memory_size_ <
-        2 * sizeof(uint32_t) + non_null_codes * (sizeof(uint32_t) + type_.minimumByteLength())) {
-      LOG(FATAL) << "Attempted to create a CompressionDictionary with "
-                 << dictionary_memory_size_ << " bytes of memory, which is insufficient for "
-                 << non_null_codes << " entries of type " << type_.getName() << ".";
-    }
-
-    variable_length_data_region_ = static_cast<const char*>(dictionary_memory_)
-                                   + (non_null_codes + 2) * sizeof(uint32_t);
-
-    DCHECK(paranoidOffsetsCheck());
-  } else {
-    if (non_null_codes * type_fixed_byte_length_ + 2 * sizeof(uint32_t)
-        < dictionary_memory_size_) {
-      LOG(FATAL) << "Attempted to create a CompressionDictionary with "
-                 << dictionary_memory_size_ << " bytes of memory, which is insufficient for "
-                 << non_null_codes << " entries of type " << type_.getName() << ".";
-    }
-  }
-
-  // NOTE(chasseur): If dictionary_memory_size_ is larger than the required
-  // amount of memory, it's not strictly an error, but there will be wasted
-  // space.
-}
-
-CompressionDictionaryLite::~CompressionDictionaryLite() {
-}
-
-bool CompressionDictionaryLite::paranoidOffsetsCheck() const {
-  uint32_t num_codes = *static_cast<const uint32_t*>(dictionary_memory_);
-  size_t variable_length_offset = (num_codes + 2) * sizeof(uint32_t);
-  const uint32_t *offsets_array = static_cast<const uint32_t*>(dictionary_memory_) + 2;
-
-  size_t last_offset = variable_length_offset - 1;
-  for (uint32_t code = 0; code < num_codes; ++code) {
-    size_t value_offset = variable_length_offset + offsets_array[code];
-    if ((value_offset >= dictionary_memory_size_)
-        || (value_offset <= last_offset)) {
-      return false;
-    }
-    last_offset = value_offset;
-  }
-
-  return true;
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/compression/CompressionDictionaryLite.hpp
----------------------------------------------------------------------
diff --git a/compression/CompressionDictionaryLite.hpp b/compression/CompressionDictionaryLite.hpp
deleted file mode 100644
index c4c338e..0000000
--- a/compression/CompressionDictionaryLite.hpp
+++ /dev/null
@@ -1,312 +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_COMPRESSION_COMPRESSION_DICTIONARY_LITE_HPP_
-#define QUICKSTEP_COMPRESSION_COMPRESSION_DICTIONARY_LITE_HPP_
-
-#include <cstddef>
-#include <cstdint>
-#include <limits>
-
-#include "types/Type.hpp"
-#include "types/TypedValue.hpp"
-#include "utility/Macros.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-/** \addtogroup Compression
- *  @{
- */
-
-// In-memory format of a CompressionDictionary is as follows:
-//     std::uint32_t num_codes - number of codes/values stored in dictionary
-//                               (excluding NULL)
-//     std::uint32_t null_code - a code representing a NULL value (equal to
-//                               num_codes if NULL is present, or the maximum
-//                               possible value of std::uint32_t if NULL is not
-//                               present)
-// For fixed-length types:
-//     array of num_codes values
-// For variable-length types:
-//     array of num_codes offsets of variable-length values
-//     variable-length storage region, with values stored at offsets specified
-//         by previous array.
-
-/**
- * @brief A dictionary which maps short integer codes to typed values.
- * @note Codes in a CompressionDictionaryLite compare in the same order as the
- *       underlying values.
- **/
-class CompressionDictionaryLite {
- public:
-  /**
-   * @brief Constructor.
-   *
-   * @param type The type of values being compressed. LessComparison must be
-   *        applicable to this Type.
-   * @param dictionary_memory The memory location of the physical dictionary.
-   * @param dictionary_memory_size The size (in bytes) of the physical
-   *        dictionary at dictionary_memory.
-   **/
-  CompressionDictionaryLite(const Type &type,
-                            const void *dictionary_memory,
-                            const std::size_t dictionary_memory_size);
-
-  virtual ~CompressionDictionaryLite() = 0;
-
-  /**
-   * @brief Get the number of code/value mappings in this dictionary.
-   *
-   * @return The number of codes/values in this dictionary.
-   **/
-  inline std::uint32_t numberOfCodes() const {
-    return number_of_codes_including_null_;
-  }
-
-  /**
-   * @brief Get the minimum number of bits needed to represent a code for this
-   *        dictionary.
-   *
-   * @return The length of codes for this dictionary in bits.
-   **/
-  inline std::uint8_t codeLengthBits() const {
-    return code_length_bits_;
-  }
-
-  /**
-   * @brief Determine whether this dictionary contains a code for NULL values.
-   *
-   * @return Whether this dictionary contains NULL.
-   **/
-  inline bool containsNull() const {
-    return getNullCode() != std::numeric_limits<std::uint32_t>::max();
-  }
-
-  /**
-   * @brief Get the code representing NULL in this dictionary, or the maximum
-   *        possible value of a std::uint32_t if NULL is not present in this
-   *        dictionary.
-   *
-   * @return The code representing NULL in this dictionary, or UINT32_MAX if
-   *         NULL is not present in this dictionary.
-   **/
-  inline std::uint32_t getNullCode() const {
-    return *(static_cast<const std::uint32_t*>(dictionary_memory_) + 1);
-  }
-
-  /**
-   * @brief Get an untyped pointer to the value represented by the specified
-   *        code.
-   * @note This version is for codes of 8 bits or less. Also see
-   *       getUntypedValueForShortCode() and getUntypedValueForCode().
-   * @warning It is an error to use this method with a code which does not
-   *          exist in this dictionary, i.e. code must be less than
-   *          numberOfCodes().
-   *
-   * @param code The compressed code to get the value for.
-   * @return An untyped pointer to the value that corresponds to code.
-   **/
-  template <bool check_null = true>
-  inline const void* getUntypedValueForByteCode(const std::uint8_t code) const {
-    if (type_is_variable_length_) {
-      return variableLengthGetUntypedValueHelper<std::uint8_t, check_null>(code);
-    } else {
-      return fixedLengthGetUntypedValueHelper<std::uint8_t, check_null>(code);
-    }
-  }
-
-  /**
-   * @brief Get an untyped pointer to the value represented by the specified
-   *        code.
-   * @note This version is for codes of 16 bits or less. Also see
-   *       getUntypedValueForByteCode() and getUntypedValueForCode().
-   * @warning It is an error to use this method with a code which does not
-   *          exist in this dictionary, i.e. code must be less than
-   *          numberOfCodes().
-   *
-   * @param code The compressed code to get the value for.
-   * @return An untyped pointer to the value that corresponds to code.
-   **/
-  template <bool check_null = true>
-  inline const void* getUntypedValueForShortCode(const std::uint16_t code) const {
-    if (type_is_variable_length_) {
-      return variableLengthGetUntypedValueHelper<std::uint16_t, check_null>(code);
-    } else {
-      return fixedLengthGetUntypedValueHelper<std::uint16_t, check_null>(code);
-    }
-  }
-
-  /**
-   * @brief Get an untyped pointer to the value represented by the specified
-   *        code.
-   * @note This version is for any code up to the maximum length of 32 bits.
-   *       Also see getUntypedValueForByteCode() and
-   *       getUntypedValueForShortCode().
-   * @warning It is an error to use this method with a code which does not
-   *          exist in this dictionary, i.e. code must be less than
-   *          numberOfCodes().
-   *
-   * @param code The compressed code to get the value for.
-   * @return An untyped pointer to the value that corresponds to code.
-   **/
-  template <bool check_null = true>
-  inline const void* getUntypedValueForCode(const std::uint32_t code) const {
-    if (type_is_variable_length_) {
-      return variableLengthGetUntypedValueHelper<std::uint32_t, check_null>(code);
-    } else {
-      return fixedLengthGetUntypedValueHelper<std::uint32_t, check_null>(code);
-    }
-  }
-
-  /**
-   * @brief Get the value represented by the specified code as a TypedValue.
-   * @note This version is for codes of 8 bits or less. Also see
-   *       getTypedValueForShortCode() and getTypedValueForCode().
-   * @warning It is an error to use this method with a code which does not
-   *          exist in this dictionary, i.e. code must be less than
-   *          numberOfCodes().
-   *
-   * @param code The compressed code to get the value for.
-   * @return The typed value that corresponds to code.
-   **/
-  inline TypedValue getTypedValueForByteCode(const std::uint8_t code) const {
-    if (type_is_variable_length_) {
-      return variableLengthGetTypedValueHelper<std::uint8_t>(code);
-    } else {
-      return fixedLengthGetTypedValueHelper<std::uint8_t>(code);
-    }
-  }
-
-  /**
-   * @brief Get the value represented by the specified code as a TypedValue.
-   * @note This version is for codes of 16 bits or less. Also see
-   *       getTypedValueForByteCode() and getTypedValueForCode().
-   * @warning It is an error to use this method with a code which does not
-   *          exist in this dictionary, i.e. code must be less than
-   *          numberOfCodes().
-   *
-   * @param code The compressed code to get the value for.
-   * @return The typed value that corresponds to code.
-   **/
-  inline TypedValue getTypedValueForShortCode(const std::uint16_t code) const {
-    if (type_is_variable_length_) {
-      return variableLengthGetTypedValueHelper<std::uint16_t>(code);
-    } else {
-      return fixedLengthGetTypedValueHelper<std::uint16_t>(code);
-    }
-  }
-
-  /**
-   * @brief Get the value represented by the specified code as a TypedValue.
-   * @note This version is for any code up to the maximum length of 32 bits.
-   *       Also see getTypedValueForByteCode() and getTypedValueForShortCode().
-   * @warning It is an error to use this method with a code which does not
-   *          exist in this dictionary, i.e. code must be less than
-   *          numberOfCodes().
-   *
-   * @param code The compressed code to get the value for.
-   * @return The typed value that corresponds to code.
-   **/
-  inline TypedValue getTypedValueForCode(const std::uint32_t code) const {
-    if (type_is_variable_length_) {
-      return variableLengthGetTypedValueHelper<std::uint32_t>(code);
-    } else {
-      return fixedLengthGetTypedValueHelper<std::uint32_t>(code);
-    }
-  }
-
- protected:
-  template <typename CodeType, bool check_null = true>
-  inline const void* fixedLengthGetUntypedValueHelper(const CodeType code) const {
-    if (check_null && (code == getNullCode())) {
-      return nullptr;
-    }
-    DCHECK_LT(code, numberOfCodes());
-    return static_cast<const char*>(dictionary_memory_)
-           + 2 * sizeof(std::uint32_t)        // Header.
-           + code * type_fixed_byte_length_;  // Index into value array.
-  }
-
-  template <typename CodeType, bool check_null = true>
-  inline const void* variableLengthGetUntypedValueHelper(const CodeType code) const {
-    if (check_null && (code == getNullCode())) {
-      return nullptr;
-    }
-    DCHECK_LT(code, numberOfCodes());
-    const void *retval = variable_length_data_region_
-                         + static_cast<const std::uint32_t*>(dictionary_memory_)[code + 2];
-    DCHECK_LT(retval, static_cast<const char*>(dictionary_memory_) + dictionary_memory_size_);
-    return retval;
-  }
-
-  template <typename CodeType>
-  inline TypedValue fixedLengthGetTypedValueHelper(const CodeType code) const {
-    if (code == getNullCode()) {
-      return TypedValue(type_.getTypeID());;
-    }
-    DCHECK_LT(code, numberOfCodes());
-    return type_.makeValue(static_cast<const char*>(dictionary_memory_)
-                               + 2 * sizeof(std::uint32_t)        // Header.
-                               + code * type_fixed_byte_length_,  // Index into value array.
-                           type_fixed_byte_length_);
-  }
-
-  template <typename CodeType>
-  inline TypedValue variableLengthGetTypedValueHelper(const CodeType code) const {
-    if (code == getNullCode()) {
-      return TypedValue(type_.getTypeID());
-    }
-    DCHECK_LT(code, numberOfCodes());
-
-    std::uint32_t value_offset = static_cast<const std::uint32_t*>(dictionary_memory_)[code + 2];
-    const void *data_ptr = variable_length_data_region_ + value_offset;
-
-    DCHECK_LT(data_ptr, static_cast<const char*>(dictionary_memory_) + dictionary_memory_size_);
-
-    std::size_t data_size = (code == *static_cast<const std::uint32_t*>(dictionary_memory_) - 1) ?
-        (static_cast<const char*>(dictionary_memory_)
-            + dictionary_memory_size_
-            - static_cast<const char*>(data_ptr))
-        : (static_cast<const std::uint32_t*>(dictionary_memory_)[code + 3] - value_offset);
-    return TypedValue(type_.getTypeID(), data_ptr, data_size);
-  }
-
-  const Type &type_;
-  const bool type_is_variable_length_;
-  const void *dictionary_memory_;
-  const std::size_t dictionary_memory_size_;
-  std::uint32_t number_of_codes_including_null_;
-  std::uint8_t code_length_bits_;
-
-  const std::size_t type_fixed_byte_length_;
-  const char *variable_length_data_region_;
-
- private:
-  bool paranoidOffsetsCheck() const;
-
-  DISALLOW_COPY_AND_ASSIGN(CompressionDictionaryLite);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_COMPRESSION_COMPRESSION_DICTIONARY_LITE_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/compression/CompressionModule.hpp
----------------------------------------------------------------------
diff --git a/compression/CompressionModule.hpp b/compression/CompressionModule.hpp
deleted file mode 100644
index f5e3e9b..0000000
--- a/compression/CompressionModule.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 Compression
- *
- * Facilities for ordered dictionary-based compression of values to
- * fixed-length integer codes.
- **/


[33/51] [abbrv] [partial] incubator-quickstep git commit: remove c++ files

Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/table_generator/GenerateSeries.hpp
----------------------------------------------------------------------
diff --git a/expressions/table_generator/GenerateSeries.hpp b/expressions/table_generator/GenerateSeries.hpp
deleted file mode 100644
index d749810..0000000
--- a/expressions/table_generator/GenerateSeries.hpp
+++ /dev/null
@@ -1,149 +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_EXPRESSIONS_TABLE_GENERATOR_GENERATE_SERIES_HPP_
-#define QUICKSTEP_EXPRESSIONS_TABLE_GENERATOR_GENERATE_SERIES_HPP_
-
-#include <string>
-#include <vector>
-
-#include "expressions/table_generator/GenerateSeriesHandle.hpp"
-#include "expressions/table_generator/GeneratorFunction.hpp"
-#include "types/Type.hpp"
-#include "types/TypeFactory.hpp"
-#include "types/TypeID.hpp"
-#include "types/TypedValue.hpp"
-#include "types/operations/comparisons/GreaterComparison.hpp"
-#include "utility/Macros.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-class GeneratorFunctionHandle;
-
-/** \addtogroup Expressions
- *  @{
- */
-
-/**
- * @brief GeneratorFunction that generates a series of values, from a start
- *        value to a stop value with a step size.
- */
-class GenerateSeries : public GeneratorFunction {
- public:
-  /**
-   * @brief Singleton instance of the GenerateSeries class.
-   * @return A const reference to the singleton instance of the GenerateSeries
-   *         class.
-   */
-  static const GenerateSeries& Instance() {
-    static GenerateSeries instance;
-    return instance;
-  }
-
-  const std::string getName() const override {
-    return "generate_series";
-  }
-
-  const std::string getSyntax() const override {
-    return getName() + "(<start>, <end>[, <step>])";
-  }
-
-  GeneratorFunctionHandle* createHandle(
-      const std::vector<TypedValue> &arguments) const override {
-    // Checks arguments and create the function handle for generate_series.
-
-    // Arguments should have the pattern (start, end) or (start, end, step).
-    int arg_size = arguments.size();
-    if (arg_size != 2 && arg_size != 3) {
-      throw GeneratorFunctionInvalidArguments("Invalid number of arguments");
-    }
-
-    std::vector<const Type*> arg_types;
-    for (const TypedValue &arg : arguments) {
-      if (TypeFactory::TypeRequiresLengthParameter(arg.getTypeID())) {
-        throw GeneratorFunctionInvalidArguments("Invalid argument types");
-      }
-      arg_types.emplace_back(&TypeFactory::GetType(arg.getTypeID()));
-    }
-
-    // Get the unified type of all arguments.
-    const Type *unified_type = arg_types[0];
-    for (int i = 1; i < arg_size && unified_type != nullptr; ++i) {
-      unified_type =
-          TypeFactory::GetUnifyingType(*arg_types[i],
-                                       *unified_type);
-    }
-
-    // Check if the unified type if applicable, then create the handle.
-    if (unified_type != nullptr) {
-      TypeID tid = unified_type->getTypeID();
-      if (tid == TypeID::kInt
-          || tid == TypeID::kLong
-          || tid == TypeID::kFloat
-          || tid == TypeID::kDouble) {
-        return concretizeWithType(arg_types, arguments, *unified_type);
-      }
-    }
-    throw GeneratorFunctionInvalidArguments("Invalid argument types");
-    return nullptr;
-  }
-
- protected:
-  GenerateSeries() : GeneratorFunction() {
-  }
-
- private:
-  GeneratorFunctionHandle* concretizeWithType(
-      const std::vector<const Type*> &arg_types,
-      const std::vector<TypedValue> &args,
-      const Type &type) const {
-    DCHECK(args.size() == 2 || args.size() == 3);
-
-    // Coerce all arguments to the unified type.
-    TypedValue start = type.coerceValue(args[0], *arg_types[0]);
-    TypedValue end = type.coerceValue(args[1], *arg_types[1]);
-    TypedValue step =
-        args.size() > 2 ? type.coerceValue(args[2], *arg_types[2])
-                        : type.coerceValue(TypedValue(1), TypeFactory::GetType(TypeID::kInt));
-
-    // Check that step is not 0, and (end - start) / step is positive
-    const GreaterComparison &gt_comparator = GreaterComparison::Instance();
-    bool start_gt_end = gt_comparator.compareTypedValuesChecked(start, type, end, type);
-    bool step_gt_0 = gt_comparator.compareTypedValuesChecked(
-        step, type, TypedValue(0), TypeFactory::GetType(TypeID::kInt));
-    bool step_lt_0 = gt_comparator.compareTypedValuesChecked(
-        TypedValue(0), TypeFactory::GetType(TypeID::kInt), step, type);
-    if ((!start_gt_end && step_lt_0) || (start_gt_end && step_gt_0)) {
-      throw GeneratorFunctionInvalidArguments("Invalid step width");
-    }
-
-    return new GenerateSeriesHandle(getName(), args, type, start, end, step);
-  }
-
-  DISALLOW_COPY_AND_ASSIGN(GenerateSeries);
-};
-
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_EXPRESSIONS_TABLE_GENERATOR_GENERATE_SERIES_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/table_generator/GenerateSeriesHandle.hpp
----------------------------------------------------------------------
diff --git a/expressions/table_generator/GenerateSeriesHandle.hpp b/expressions/table_generator/GenerateSeriesHandle.hpp
deleted file mode 100644
index 594f12b..0000000
--- a/expressions/table_generator/GenerateSeriesHandle.hpp
+++ /dev/null
@@ -1,187 +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_EXPRESSIONS_TABLE_GENERATOR_GENERATE_SERIES_HANDLE_HPP_
-#define QUICKSTEP_EXPRESSIONS_TABLE_GENERATOR_GENERATE_SERIES_HANDLE_HPP_
-
-#include <cstddef>
-#include <cstdint>
-#include <string>
-#include <vector>
-
-#include "expressions/table_generator/GeneratorFunctionHandle.hpp"
-#include "types/Type.hpp"
-#include "types/TypeID.hpp"
-#include "types/TypedValue.hpp"
-#include "types/containers/ColumnVector.hpp"
-#include "types/containers/ColumnVectorsValueAccessor.hpp"
-#include "utility/Macros.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-/** \addtogroup Expressions
- *  @{
- */
-
-/**
- * @brief Handle for the instantiated GenerateSeries function.
- */
-class GenerateSeriesHandle : public GeneratorFunctionHandle {
- public:
-  int getNumberOfOutputColumns() const override {
-    return 1;
-  }
-
-  const std::string getOutputColumnName(int index) const override {
-    if (index > 0) {
-      LOG(FATAL) << "generate_series function has only 1 output column";
-    }
-    // Use the function name as the column name.
-    return getName();
-  }
-
-  const Type& getOutputColumnType(int index) const override {
-    if (index > 0) {
-      LOG(FATAL) << "generate_series function has only 1 output column";
-    }
-    return type_;
-  }
-
-  std::size_t getEstimatedCardinality() const override {
-    switch (type_.getTypeID()) {
-      case TypeID::kInt: {
-        return estimateCardinality<int>();
-      }
-      case TypeID::kLong: {
-        return estimateCardinality<std::int64_t>();
-      }
-      case TypeID::kFloat: {
-        return estimateCardinality<float>();
-      }
-      case TypeID::kDouble: {
-        return estimateCardinality<double>();
-      }
-      default:
-        LOG(FATAL) << "GenerateSeries cannot handle arguments with type "
-                   << type_.getName();
-    }
-    return 0;
-  }
-
-  void populateColumns(ColumnVectorsValueAccessor *results) const override {
-    DCHECK(results != nullptr);
-
-    // Generate the output column.
-    NativeColumnVector *result_vec;
-    switch (type_.getTypeID()) {
-      case TypeID::kInt: {
-        result_vec = generateColumn<int>();
-        break;
-      }
-      case TypeID::kLong: {
-        result_vec = generateColumn<std::int64_t>();
-        break;
-      }
-      case TypeID::kFloat: {
-        result_vec = generateColumn<float>();
-        break;
-      }
-      case TypeID::kDouble: {
-        result_vec = generateColumn<double>();
-        break;
-      }
-      default:
-        // Should not reach here -- type checking should be done inside
-        // GenerateSeries::createHandle() at query compile time.
-        LOG(FATAL) << "GenerateSeries cannot handle arguments with type "
-                   << type_.getName();
-    }
-    // Add the output column into the ColumnVectorsValueAccessor container.
-    results->addColumn(result_vec);
-  }
-
- private:
-  /**
-   * @brief Constructor. A GenerateSeriesHandle object should only be
-   *        instantiated inside method GenerateSeries::createHandle().
-   *
-   * @param func_name The registered name of the GenerateSeries function.
-   * @param orig_args The original constant arguments to this function
-   * @param type The unified type for the arguments.
-   * @param start The start value. Its type should equal unified_type.
-   * @param end The end value. Its type should equal unified_type.
-   * @param step The step size. Its type should equal unified_type.
-   */
-  GenerateSeriesHandle(const std::string &func_name,
-                       const std::vector<TypedValue> &orig_args,
-                       const Type &unified_type,
-                       const TypedValue &start,
-                       const TypedValue &end,
-                       const TypedValue &step)
-      : GeneratorFunctionHandle(func_name, orig_args),
-        type_(unified_type),
-        start_(start),
-        end_(end),
-        step_(step) {
-  }
-
-  template <typename T>
-  NativeColumnVector* generateColumn() const {
-    T start = start_.getLiteral<T>();
-    T end = end_.getLiteral<T>();
-    T step = step_.getLiteral<T>();
-
-    DCHECK_NE(step, static_cast<T>(0));
-    std::size_t length = static_cast<std::size_t>((end - start) / step + 1);
-    DCHECK_GE(length, static_cast<std::size_t>(0));
-
-    NativeColumnVector *result_vec = new NativeColumnVector(type_, length);
-    T value = start;
-    for (std::size_t i = 0; i < length; ++i) {
-      result_vec->appendUntypedValue(&value);
-      value += step;
-    }
-    return result_vec;
-  }
-
-  template <typename T>
-  std::size_t estimateCardinality() const {
-    T step = step_.getLiteral<T>();
-    DCHECK_NE(step, static_cast<T>(0));
-    return static_cast<std::size_t>(
-        (end_.getLiteral<T>() - start_.getLiteral<T>()) / step + 1);
-  }
-
-  const Type &type_;
-  const TypedValue start_;
-  const TypedValue end_;
-  const TypedValue step_;
-
-  friend class GenerateSeries;
-
-  DISALLOW_COPY_AND_ASSIGN(GenerateSeriesHandle);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_EXPRESSIONS_TABLE_GENERATOR_GENERATE_SERIES_HANDLE_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/table_generator/GeneratorFunction.hpp
----------------------------------------------------------------------
diff --git a/expressions/table_generator/GeneratorFunction.hpp b/expressions/table_generator/GeneratorFunction.hpp
deleted file mode 100644
index b83a534..0000000
--- a/expressions/table_generator/GeneratorFunction.hpp
+++ /dev/null
@@ -1,135 +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_EXPRESSIONS_TABLE_GENERATOR_GENERATOR_FUNCTION_HPP_
-#define QUICKSTEP_EXPRESSIONS_TABLE_GENERATOR_GENERATOR_FUNCTION_HPP_
-
-#include <exception>
-#include <string>
-#include <vector>
-
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-
-class GeneratorFunctionHandle;
-class TypedValue;
-
-/** \addtogroup Expressions
- *  @{
- */
-
-/**
- * @brief A class representing a particular generator function in the abstract
- *        sense.
- *
- * Generator functions are used for generating tables. A generator function
- * takes a list of constant arguments at query compile time, and populates the
- * given ColumnVectorValueAccesor at query run time.
- *
- * The GeneratorFunction class provides informational methods about the
- * applicability of a particular generator function to particular constant
- * arguments. The actual implementation of the generator functions' logic is in
- * the GeneratorFunctionHandle class hierarchy, and can be different depending
- * on the particular arguments given to the function. At query compile time,
- * a caller should first call GeneratorFunction::generateHandle() to instantiate
- * an GeneratorFunctionHandle object. The handle object provides information
- * about the concrete function, e.g. the number and types of the output columns
- * Then, at query run time, the backend also uses the handle object's methods
- * to actually generate a table.
- *
- * To add a new generator function, subclass both GeneratorFunction and
- * GeneratorFunctionHandle to implement the logics. Also add a line in
- * GeneratorFunctionFactory's constructor to make the new function registered.
- *
- * See GenerateSeries and GenerateSeriesHandle as an example of how to implement
- * new generator funcitons.
- **/
-class GeneratorFunction {
- public:
-  /**
-   * @brief Get the name of this generator function. The name should be unique
-   * as it is used to register this function into the generator function pool.
-   *
-   * @return The name of this generator function.
-   **/
-  virtual const std::string getName() const = 0;
-
-  /**
-   * @brief Get the usage syntax of this generator function in text form. The
-   *        syntax information will be displayed when the end users ask for help
-   *        on the usage of this function.
-   *
-   * @return The usage syntax of this generator function in text form.
-   **/
-  virtual const std::string getSyntax() const = 0;
-
-  /**
-   * @brief Create an GeneratorFunctionHandle.
-   *
-   * @param arguments A list of zero or more constant arguments to this
-   *        generator funciton.
-   * @exception GeneratorFunctionInvalidArguments The arguments to this
-   *            generator function are invalid.
-   * @return A new GeneratorFunctionHandle object that is used to do the actual
-   *         table generation. Caller is responsible for deleting the returned
-   *         object.
-   **/
-  virtual GeneratorFunctionHandle* createHandle(
-      const std::vector<TypedValue> &arguments) const = 0;
-
- protected:
-  GeneratorFunction() {
-  }
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(GeneratorFunction);
-};
-
-
-/**
- * @brief Exception thrown for invalid arguments to a generator function.
- **/
-class GeneratorFunctionInvalidArguments : public std::exception {
- public:
-  /**
-   * @brief Constructor.
-   *
-   * @param message The error message.
-   **/
-  explicit GeneratorFunctionInvalidArguments(const std::string &message)
-      : message_(message) {
-  }
-
-  ~GeneratorFunctionInvalidArguments() throw() {
-  }
-
-  virtual const char* what() const throw() {
-    return message_.c_str();
-  }
-
- private:
-  std::string message_;
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_EXPRESSIONS_TABLE_GENERATOR_GENERATOR_FUNCTION_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/table_generator/GeneratorFunction.proto
----------------------------------------------------------------------
diff --git a/expressions/table_generator/GeneratorFunction.proto b/expressions/table_generator/GeneratorFunction.proto
deleted file mode 100644
index fc50a2f..0000000
--- a/expressions/table_generator/GeneratorFunction.proto
+++ /dev/null
@@ -1,27 +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.
-
-syntax = "proto2";
-
-package quickstep.serialization;
-
-import "types/TypedValue.proto";
-
-message GeneratorFunctionHandle {
-  required string function_name = 1;
-  repeated TypedValue args = 2;
-}

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/table_generator/GeneratorFunctionFactory.cpp
----------------------------------------------------------------------
diff --git a/expressions/table_generator/GeneratorFunctionFactory.cpp b/expressions/table_generator/GeneratorFunctionFactory.cpp
deleted file mode 100644
index b7dec8b..0000000
--- a/expressions/table_generator/GeneratorFunctionFactory.cpp
+++ /dev/null
@@ -1,73 +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 "expressions/table_generator/GeneratorFunctionFactory.hpp"
-
-#include <string>
-#include <utility>
-#include <vector>
-
-#include "expressions/table_generator/GenerateSeries.hpp"
-#include "expressions/table_generator/GeneratorFunction.hpp"
-#include "expressions/table_generator/GeneratorFunction.pb.h"
-#include "types/TypedValue.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-GeneratorFunctionFactory::GeneratorFunctionFactory() {
-#define REGISTER_GENERATOR_FUNCTION_(FuncClass) \
-  func_map_.emplace(FuncClass::Instance().getName(), &FuncClass::Instance())
-
-  // Register all generator functions here.
-  REGISTER_GENERATOR_FUNCTION_(GenerateSeries);
-
-#undef REGISTER_GENERATOR_FUNCTION_
-}
-
-const GeneratorFunctionFactory& GeneratorFunctionFactory::Instance() {
-  static GeneratorFunctionFactory instance;
-  return instance;
-}
-
-const GeneratorFunction* GeneratorFunctionFactory::getByName(const std::string &name) const {
-  const auto it = func_map_.find(name);
-  if (it != func_map_.end()) {
-    return it->second;
-  } else {
-    return nullptr;
-  }
-}
-
-GeneratorFunctionHandle* GeneratorFunctionFactory::reconstructFromProto(
-    const serialization::GeneratorFunctionHandle &proto) const {
-  const GeneratorFunction *func_template = getByName(proto.function_name());
-  CHECK(func_template != nullptr)
-      << "Generator function " << proto.function_name() << " not found";
-
-  std::vector<TypedValue> args;
-  for (const auto &arg_proto : proto.args()) {
-    args.emplace_back(TypedValue::ReconstructFromProto(arg_proto));
-  }
-
-  return func_template->createHandle(args);
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/table_generator/GeneratorFunctionFactory.hpp
----------------------------------------------------------------------
diff --git a/expressions/table_generator/GeneratorFunctionFactory.hpp b/expressions/table_generator/GeneratorFunctionFactory.hpp
deleted file mode 100644
index 1d9784a..0000000
--- a/expressions/table_generator/GeneratorFunctionFactory.hpp
+++ /dev/null
@@ -1,95 +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_EXPRESSIONS_TABLE_GENERATOR_GENERATOR_FUNCTION_FACTORY_HPP_
-#define QUICKSTEP_EXPRESSIONS_TABLE_GENERATOR_GENERATOR_FUNCTION_FACTORY_HPP_
-
-#include <map>
-#include <string>
-
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-
-class GeneratorFunction;
-class GeneratorFunctionHandle;
-
-namespace serialization { class GeneratorFunctionHandle; }
-
-/** \addtogroup Expressions
- *  @{
- */
-
-/**
- * @brief Singleton factory class that provides access to the various concrete
- *        implementations of GeneratorFunction.
- *
- * @note Generator functions are used for generating tables. A generator
- *       function takes a list of constant arguments at query compile time,
- *       and populates a table at query run time. See the documentation in
- *       GeneratorFunction.hpp for a detailed description and for how to
- *       implement a new generator function.
- **/
-class GeneratorFunctionFactory {
- public:
-  /**
-   * @brief Singleton instance of the GeneratorFunctionFactory class.
-   * @return A const reference to the singleton instance of the
-   *         GeneratorFunctionFactory class.
-   */
-  static const GeneratorFunctionFactory& Instance();
-
-  /**
-   * @brief Get a particular GeneratorFunction by its name.
-   *
-   * @param name The name of the desired GeneratorFunction.
-   * @return A pointer to the GeneratorFunction specified by name, or NULL if
-   *         name does not match any known GeneratorFunction.
-   **/
-  const GeneratorFunction* getByName(const std::string &name) const;
-
-  /**
-   * @brief Reconstruct a particular GeneratorFunctionHandle by its protobuf
-   *        message.
-   *
-   * @param proto A serialized protocol buffer representation of the
-   *        GeneratorFunctionHandle.
-   * @return A new GeneratorFunctionHandle object constructed from the protobuf
-   *         message. Caller is responsible for deleting the returned object.
-   */
-  GeneratorFunctionHandle* reconstructFromProto(
-      const serialization::GeneratorFunctionHandle &proto) const;
-
- private:
-  /**
-   * @brief Constructor. All the implemented generator functions should be
-   *        registered into GeneratorFunctionFactory inside the constructor.
-   */
-  GeneratorFunctionFactory();
-
-  std::map<std::string, const GeneratorFunction *> func_map_;
-
-  DISALLOW_COPY_AND_ASSIGN(GeneratorFunctionFactory);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_EXPRESSIONS_TABLE_GENERATOR_GENERATOR_FUNCTION_FACTORY_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/table_generator/GeneratorFunctionHandle.hpp
----------------------------------------------------------------------
diff --git a/expressions/table_generator/GeneratorFunctionHandle.hpp b/expressions/table_generator/GeneratorFunctionHandle.hpp
deleted file mode 100644
index b2fc068..0000000
--- a/expressions/table_generator/GeneratorFunctionHandle.hpp
+++ /dev/null
@@ -1,153 +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_EXPRESSIONS_TABLE_GENERATOR_GENERATOR_FUNCTION_HANDLE_HPP_
-#define QUICKSTEP_EXPRESSIONS_TABLE_GENERATOR_GENERATOR_FUNCTION_HANDLE_HPP_
-
-#include <cstddef>
-#include <memory>
-#include <sstream>
-#include <string>
-#include <vector>
-
-#include "expressions/table_generator/GeneratorFunction.pb.h"
-#include "types/TypedValue.hpp"
-#include "types/TypedValue.pb.h"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-
-class ColumnVectorsValueAccessor;
-class Type;
-
-/** \addtogroup Expressions
- *  @{
- */
-
-class GeneratorFunctionHandle;
-typedef std::shared_ptr<const GeneratorFunctionHandle> GeneratorFunctionHandlePtr;
-
-/**
- * @brief Abstract representation of a concrete generator function.
- *
- * This class abstracts the required facilities for a particular generator
- * function to be usable by the query processor.
- *
- * To implement a particular generator function, one needs to subclass
- * GeneratorFunctionHandle and implement the methods that provide the function
- * signature information, i.e. the number of output columns and the value type
- * of each output column, where this information will be used by the query
- * processor to generate the query plan. Then, the subclass should implement
- * the populateColumns() method which will actually populate a column-based
- * table (abstracted as ColumnVectorsValueAccessor) at query run time.
- **/
-class GeneratorFunctionHandle {
- public:
-  /**
-   * @brief Get the number of output columns of this generator function.
-   *
-   * @return The number of output columns.
-   */
-  virtual int getNumberOfOutputColumns() const = 0;
-
-  /**
-   * @brief Get the default name of the specified output column.
-   *
-   * @param index The index of the output column.
-   * @return The name of the specified output column.
-   */
-  virtual const std::string getOutputColumnName(int index) const {
-    std::ostringstream oss;
-    oss << "attr" << (index+1);
-    return oss.str();
-  }
-
-  /**
-   * @brief Get the type of the specified output column.
-   *
-   * @param index The index of the output column.
-   * @param The type of the specified output column
-   */
-  virtual const Type &getOutputColumnType(int index) const = 0;
-
-  /**
-   * @brief Get the estimated number of rows that the function will generate.
-   *
-   * @return The estimated number of rows that the function will generate.
-   */
-  virtual std::size_t getEstimatedCardinality() const = 0;
-
-  /**
-   * @brief Populate the given ColumnVectorsValueAccessor with data.
-   *
-   * @param results A mutable ColumnVectorsValueAccessor object that will be
-   *        populated with data columns.
-   */
-  virtual void populateColumns(ColumnVectorsValueAccessor *results) const = 0;
-
-  /**
-   * @brief Get the name of this generator function.
-   *
-   * @return The name of this generator function.
-   **/
-  const std::string &getName() const {
-    return func_name_;
-  }
-
-  /**
-   * @brief Get the serialized protocol buffer representation of this generator
-   *        function handle.
-   * @note To alleviate the burden of writing serialization for each
-   *       implemenation of generator functions, the serialization will only
-   *       take the function name and the original arguments. Then, the
-   *       function handle will be regenerated by GeneratorFunctionFactory
-   *       from the function name and arguemtns at the destination site.
-   *
-   * @return A serialized protocol buffer representation of this generator
-   *         function handle.
-   **/
-  serialization::GeneratorFunctionHandle getProto() const {
-    serialization::GeneratorFunctionHandle proto;
-    proto.set_function_name(func_name_);
-
-    for (const TypedValue &arg : orig_args_) {
-      proto.add_args()->CopyFrom(arg.getProto());
-    }
-    return proto;
-  }
-
- protected:
-  GeneratorFunctionHandle(const std::string &func_name,
-                          const std::vector<TypedValue> &orig_args)
-      : func_name_(func_name),
-        orig_args_(orig_args) {
-  }
-
- private:
-  std::string func_name_;
-  std::vector<TypedValue> orig_args_;
-
-  DISALLOW_COPY_AND_ASSIGN(GeneratorFunctionHandle);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_EXPRESSIONS_TABLE_GENERATOR_GENERATOR_FUNCTION_HANDLE_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/window_aggregation/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/expressions/window_aggregation/CMakeLists.txt b/expressions/window_aggregation/CMakeLists.txt
deleted file mode 100644
index b33a401..0000000
--- a/expressions/window_aggregation/CMakeLists.txt
+++ /dev/null
@@ -1,213 +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.
-
-QS_PROTOBUF_GENERATE_CPP(expressions_windowaggregation_WindowAggregateFunction_proto_srcs
-                         expressions_windowaggregation_WindowAggregateFunction_proto_hdrs
-                         WindowAggregateFunction.proto)
-
-# Declare micro-libs:
-add_library(quickstep_expressions_windowaggregation_WindowAggregateFunction
-            WindowAggregateFunction.cpp
-            WindowAggregateFunction.hpp)
-add_library(quickstep_expressions_windowaggregation_WindowAggregateFunction_proto
-            ${expressions_windowaggregation_WindowAggregateFunction_proto_srcs})
-add_library(quickstep_expressions_windowaggregation_WindowAggregateFunctionAvg
-            WindowAggregateFunctionAvg.cpp
-            WindowAggregateFunctionAvg.hpp)
-add_library(quickstep_expressions_windowaggregation_WindowAggregateFunctionCount
-            WindowAggregateFunctionCount.cpp
-            WindowAggregateFunctionCount.hpp)
-add_library(quickstep_expressions_windowaggregation_WindowAggregateFunctionFactory
-            WindowAggregateFunctionFactory.cpp
-            WindowAggregateFunctionFactory.hpp)
-add_library(quickstep_expressions_windowaggregation_WindowAggregateFunctionMax
-            WindowAggregateFunctionMax.cpp
-            WindowAggregateFunctionMax.hpp)
-add_library(quickstep_expressions_windowaggregation_WindowAggregateFunctionMin
-            WindowAggregateFunctionMin.cpp
-            WindowAggregateFunctionMin.hpp)
-add_library(quickstep_expressions_windowaggregation_WindowAggregateFunctionSum
-            WindowAggregateFunctionSum.cpp
-            WindowAggregateFunctionSum.hpp)
-add_library(quickstep_expressions_windowaggregation_WindowAggregationHandle
-            WindowAggregationHandle.cpp
-            WindowAggregationHandle.hpp)
-add_library(quickstep_expressions_windowaggregation_WindowAggregationHandleAvg
-            WindowAggregationHandleAvg.cpp
-            WindowAggregationHandleAvg.hpp)
-add_library(quickstep_expressions_windowaggregation_WindowAggregationID
-            ../../empty_src.cpp
-            WindowAggregationID.hpp)
-
-# Link dependencies:
-target_link_libraries(quickstep_expressions_windowaggregation_WindowAggregateFunction
-                      glog
-                      quickstep_catalog_CatalogTypedefs
-                      quickstep_expressions_windowaggregation_WindowAggregateFunction_proto
-                      quickstep_expressions_windowaggregation_WindowAggregationID
-                      quickstep_storage_StorageBlockInfo
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_expressions_windowaggregation_WindowAggregateFunction_proto
-                      ${PROTOBUF_LIBRARY})
-target_link_libraries(quickstep_expressions_windowaggregation_WindowAggregateFunctionAvg
-                      glog
-                      quickstep_expressions_windowaggregation_WindowAggregateFunction
-                      quickstep_expressions_windowaggregation_WindowAggregationHandleAvg
-                      quickstep_expressions_windowaggregation_WindowAggregationID
-                      quickstep_types_Type
-                      quickstep_types_TypeFactory
-                      quickstep_types_TypeID
-                      quickstep_types_operations_binaryoperations_BinaryOperation
-                      quickstep_types_operations_binaryoperations_BinaryOperationFactory
-                      quickstep_types_operations_binaryoperations_BinaryOperationID
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_expressions_windowaggregation_WindowAggregateFunctionCount
-                      glog
-                      quickstep_expressions_windowaggregation_WindowAggregateFunction
-                      quickstep_expressions_windowaggregation_WindowAggregationHandle
-                      quickstep_expressions_windowaggregation_WindowAggregationID
-                      quickstep_types_Type
-                      quickstep_types_TypeFactory
-                      quickstep_types_TypeID
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_expressions_windowaggregation_WindowAggregateFunctionFactory
-                      glog
-                      quickstep_expressions_windowaggregation_WindowAggregateFunctionAvg
-                      quickstep_expressions_windowaggregation_WindowAggregateFunctionCount
-                      quickstep_expressions_windowaggregation_WindowAggregateFunctionMax
-                      quickstep_expressions_windowaggregation_WindowAggregateFunctionMin
-                      quickstep_expressions_windowaggregation_WindowAggregateFunctionSum
-                      quickstep_expressions_windowaggregation_WindowAggregateFunction_proto
-                      quickstep_expressions_windowaggregation_WindowAggregationID
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_expressions_windowaggregation_WindowAggregateFunctionMax
-                      glog
-                      quickstep_expressions_windowaggregation_WindowAggregateFunction
-                      quickstep_expressions_windowaggregation_WindowAggregationHandle
-                      quickstep_expressions_windowaggregation_WindowAggregationID
-                      quickstep_types_Type
-                      quickstep_types_operations_comparisons_Comparison
-                      quickstep_types_operations_comparisons_ComparisonFactory
-                      quickstep_types_operations_comparisons_ComparisonID
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_expressions_windowaggregation_WindowAggregateFunctionMin
-                      glog
-                      quickstep_expressions_windowaggregation_WindowAggregateFunction
-                      quickstep_expressions_windowaggregation_WindowAggregationHandle
-                      quickstep_expressions_windowaggregation_WindowAggregationID
-                      quickstep_types_Type
-                      quickstep_types_operations_comparisons_Comparison
-                      quickstep_types_operations_comparisons_ComparisonFactory
-                      quickstep_types_operations_comparisons_ComparisonID
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_expressions_windowaggregation_WindowAggregateFunctionSum
-                      glog
-                      quickstep_expressions_windowaggregation_WindowAggregateFunction
-                      quickstep_expressions_windowaggregation_WindowAggregationHandle
-                      quickstep_expressions_windowaggregation_WindowAggregationID
-                      quickstep_types_Type
-                      quickstep_types_TypeFactory
-                      quickstep_types_TypeID
-                      quickstep_types_operations_binaryoperations_BinaryOperation
-                      quickstep_types_operations_binaryoperations_BinaryOperationFactory
-                      quickstep_types_operations_binaryoperations_BinaryOperationID
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_expressions_windowaggregation_WindowAggregationHandle
-                      glog
-                      quickstep_catalog_CatalogRelationSchema
-                      quickstep_catalog_CatalogTypedefs
-                      quickstep_expressions_scalar_Scalar
-                      quickstep_storage_StorageBlockInfo
-                      quickstep_types_Type
-                      quickstep_types_TypeFactory
-                      quickstep_types_TypeID
-                      quickstep_types_TypedValue
-                      quickstep_types_containers_ColumnVector
-                      quickstep_types_containers_ColumnVectorsValueAccessor
-                      quickstep_types_operations_binaryoperations_BinaryOperation
-                      quickstep_types_operations_binaryoperations_BinaryOperationFactory
-                      quickstep_types_operations_binaryoperations_BinaryOperationID
-                      quickstep_types_operations_comparisons_Comparison
-                      quickstep_types_operations_comparisons_ComparisonFactory
-                      quickstep_types_operations_comparisons_ComparisonID
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_expressions_windowaggregation_WindowAggregationHandleAvg
-                      glog
-                      quickstep_catalog_CatalogTypedefs
-                      quickstep_expressions_windowaggregation_WindowAggregationHandle
-                      quickstep_storage_ValueAccessor
-                      quickstep_types_Type
-                      quickstep_types_TypeFactory
-                      quickstep_types_TypeID
-                      quickstep_types_TypedValue
-                      quickstep_types_containers_ColumnVectorsValueAccessor
-                      quickstep_types_operations_binaryoperations_BinaryOperation
-                      quickstep_types_operations_binaryoperations_BinaryOperationFactory
-                      quickstep_types_operations_binaryoperations_BinaryOperationID
-                      quickstep_types_operations_comparisons_Comparison
-                      quickstep_utility_Macros)
-
-# Submodule all-in-one library:
-add_library(quickstep_expressions_windowaggregation ../../empty_src.cpp)
-target_link_libraries(quickstep_expressions_windowaggregation
-                      quickstep_expressions_windowaggregation_WindowAggregateFunction
-                      quickstep_expressions_windowaggregation_WindowAggregateFunction_proto
-                      quickstep_expressions_windowaggregation_WindowAggregateFunctionAvg
-                      quickstep_expressions_windowaggregation_WindowAggregateFunctionCount
-                      quickstep_expressions_windowaggregation_WindowAggregateFunctionFactory
-                      quickstep_expressions_windowaggregation_WindowAggregateFunctionMax
-                      quickstep_expressions_windowaggregation_WindowAggregateFunctionMin
-                      quickstep_expressions_windowaggregation_WindowAggregateFunctionSum
-                      quickstep_expressions_windowaggregation_WindowAggregationHandle
-                      quickstep_expressions_windowaggregation_WindowAggregationHandleAvg
-                      quickstep_expressions_windowaggregation_WindowAggregationID)
-
-# Tests:
-
-# Unified executable to ammortize cost of linking.
-add_executable(WindowAggregationHandle_tests
-               "${CMAKE_CURRENT_SOURCE_DIR}/tests/WindowAggregationHandleAvg_unittest.cpp")
-target_link_libraries(WindowAggregationHandle_tests
-                      gtest
-                      gtest_main
-                      quickstep_catalog_CatalogAttribute
-                      quickstep_catalog_CatalogTypedefs
-                      quickstep_expressions_scalar_Scalar
-                      quickstep_expressions_scalar_ScalarAttribute
-                      quickstep_expressions_windowaggregation_WindowAggregateFunction
-                      quickstep_expressions_windowaggregation_WindowAggregateFunctionFactory
-                      quickstep_expressions_windowaggregation_WindowAggregationHandle
-                      quickstep_expressions_windowaggregation_WindowAggregationID
-                      quickstep_storage_ValueAccessor
-                      quickstep_types_CharType
-                      quickstep_types_DateOperatorOverloads
-                      quickstep_types_DatetimeIntervalType
-                      quickstep_types_DatetimeType
-                      quickstep_types_DoubleType
-                      quickstep_types_FloatType
-                      quickstep_types_IntType
-                      quickstep_types_IntervalLit
-                      quickstep_types_LongType
-                      quickstep_types_Type
-                      quickstep_types_TypeFactory
-                      quickstep_types_TypeID
-                      quickstep_types_TypedValue
-                      quickstep_types_VarCharType
-                      quickstep_types_YearMonthIntervalType
-                      quickstep_types_containers_ColumnVector
-                      quickstep_types_containers_ColumnVectorsValueAccessor)
-add_test(WindowAggregationHandle_tests WindowAggregationHandle_tests)

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/window_aggregation/WindowAggregateFunction.cpp
----------------------------------------------------------------------
diff --git a/expressions/window_aggregation/WindowAggregateFunction.cpp b/expressions/window_aggregation/WindowAggregateFunction.cpp
deleted file mode 100644
index db208a9..0000000
--- a/expressions/window_aggregation/WindowAggregateFunction.cpp
+++ /dev/null
@@ -1,58 +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 "expressions/window_aggregation/WindowAggregateFunction.hpp"
-
-#include <type_traits>
-
-#include "expressions/window_aggregation/WindowAggregateFunction.pb.h"
-#include "expressions/window_aggregation/WindowAggregationID.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-serialization::WindowAggregateFunction WindowAggregateFunction::getProto() const {
-  serialization::WindowAggregateFunction proto;
-  switch (win_agg_id_) {
-    case WindowAggregationID::kAvg:
-      proto.set_window_aggregation_id(serialization::WindowAggregateFunction::AVG);
-      break;
-    case WindowAggregationID::kCount:
-      proto.set_window_aggregation_id(serialization::WindowAggregateFunction::COUNT);
-      break;
-    case WindowAggregationID::kMax:
-      proto.set_window_aggregation_id(serialization::WindowAggregateFunction::MAX);
-      break;
-    case WindowAggregationID::kMin:
-      proto.set_window_aggregation_id(serialization::WindowAggregateFunction::MIN);
-      break;
-    case WindowAggregationID::kSum:
-      proto.set_window_aggregation_id(serialization::WindowAggregateFunction::SUM);
-      break;
-    default: {
-      LOG(FATAL) << "Unrecognized WindowAggregationID: "
-                 << static_cast<std::underlying_type<WindowAggregationID>::type>(win_agg_id_);
-    }
-  }
-
-  return proto;
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/window_aggregation/WindowAggregateFunction.hpp
----------------------------------------------------------------------
diff --git a/expressions/window_aggregation/WindowAggregateFunction.hpp b/expressions/window_aggregation/WindowAggregateFunction.hpp
deleted file mode 100644
index 2b26ccf..0000000
--- a/expressions/window_aggregation/WindowAggregateFunction.hpp
+++ /dev/null
@@ -1,158 +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_EXPRESSIONS_WINDOW_AGGREGATION_WINDOW_AGGREGATE_FUNCTION_HPP_
-#define QUICKSTEP_EXPRESSIONS_WINDOW_AGGREGATION_WINDOW_AGGREGATE_FUNCTION_HPP_
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "catalog/CatalogTypedefs.hpp"
-#include "expressions/window_aggregation/WindowAggregateFunction.pb.h"
-#include "expressions/window_aggregation/WindowAggregationID.hpp"
-#include "storage/StorageBlockInfo.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-
-class CatalogRelationSchema;
-class Scalar;
-class Type;
-class WindowAggregationHandle;
-
-/** \addtogroup Expressions
- *  @{
- */
-
-/**
- * @brief A class representing a particular window aggregate function in the
- *        abstract sense. Each named aggregate function is represented by a
- *        singleton subclass of WindowAggregateFunction.
- *
- * WindowAggregateFunction provides informational methods about the
- * applicability of a particular window aggregate function to particular
- * argument Type(s). The actual implementation of the window aggregate
- * functions' logic is in the WindowAggregationHandle class hierarchy, and can
- * be different depending on the particular argument Type(s) given to the window
- * aggregate. To perform a window aggregation, a caller should first call
- * WindowAggregateFunction::createHandle() to instantiate an
- * WindowAggregationHandle object, then use the methods of
- * WindowAggregationHandle to do the actual window aggregation. Finally, delete
- * the WindowAggregationHandle after finished.
- *
- * See WindowAggregationHandle for more detailed information about how
- * window aggregates are actually computed.
- **/
-class WindowAggregateFunction {
- public:
-  /**
-   * @brief Get the ID of this window aggregate (i.e. its unique ID amongst all
-   *        the WindowAggregateFunctions).
-   *
-   * @return The WindowAggregationID of this WindowAggregateFunction.
-   **/
-  inline WindowAggregationID getWindowAggregationID() const {
-    return win_agg_id_;
-  }
-
-  /**
-   * @brief Get the human-readable name of this WindowAggregateFunction.
-   *
-   * @return The human-readable name of this WindowAggregateFunction.
-   **/
-  virtual std::string getName() const = 0;
-
-  /**
-   * @brief Get the serialized protocol buffer representation of this
-   *        WindowAggregateFunction.
-   *
-   * @return A serialized protocol buffer representation of this
-   *         WindowAggregateFunction.
-   **/
-  virtual serialization::WindowAggregateFunction getProto() const;
-
-  /**
-   * @brief Determine if this WindowAggregateFunction can be applied to
-   *        arguments of particular Type(s).
-   *
-   * @param argument_types A list of zero or more Types (in order) for
-   *        arguments to this WindowAggregateFunction.
-   * @return Whether this WindowAggregateFunction is applicable to the given
-   *         argument_types.
-   **/
-  virtual bool canApplyToTypes(
-      const std::vector<const Type*> &argument_types) const = 0;
-
-  /**
-   * @brief Determine the result Type for this WindowAggregateFunction given
-   *        arguments of particular Type(s).
-   *
-   * @param argument_types A list of zero or more Types (in order) for
-   *        arguments to this WindowAggregateFunction.
-   * @return The result Type for this WindowAggregateFunction applied to the
-   *         specified argument_types, or nullptr if this
-   *         WindowAggregateFunction is not applicable to the specified Type(s).
-   **/
-  virtual const Type* resultTypeForArgumentTypes(
-      const std::vector<const Type*> &argument_types) const = 0;
-
-  /**
-   * @brief Create a WindowAggregationHandle to compute aggregates.
-   *
-   * @warning It is an error to call this method for argument_types which this
-   *          WindowAggregateFunction can not apply to. For safety, check
-   *          canApplyToTypes() first.
-   *
-   * @param argument_types A list of zero or more Types (in order) for
-   *        arguments to this WindowAggregateFunction.
-   * @param partition_by_attributes A list of attributes used as partition key.
-   * @param order_by_attributes A list of attributes used as order key.
-   * @param is_row True if the frame mode is ROWS, false if RANGE.
-   * @param num_preceding The number of rows/range that precedes the current row.
-   * @param num_following The number of rows/range that follows the current row.
-   *
-   * @return A new WindowAggregationHandle that can be used to compute this
-   *         WindowAggregateFunction over the specified window definition.
-   *         Caller is responsible for deleting the returned object.
-   **/
-  virtual WindowAggregationHandle* createHandle(
-      const std::vector<const Type*> &argument_types,
-      const std::vector<std::unique_ptr<const Scalar>> &partition_by_attributes,
-      const std::vector<std::unique_ptr<const Scalar>> &order_by_attributes,
-      const bool is_row,
-      const std::int64_t num_preceding,
-      const std::int64_t num_following) const = 0;
-
- protected:
-  explicit WindowAggregateFunction(const WindowAggregationID win_agg_id)
-      : win_agg_id_(win_agg_id) {
-  }
-
- private:
-  const WindowAggregationID win_agg_id_;
-
-  DISALLOW_COPY_AND_ASSIGN(WindowAggregateFunction);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_EXPRESSIONS_WINDOW_AGGREGATION_WINDOW_AGGREGATE_FUNCTION_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/window_aggregation/WindowAggregateFunction.proto
----------------------------------------------------------------------
diff --git a/expressions/window_aggregation/WindowAggregateFunction.proto b/expressions/window_aggregation/WindowAggregateFunction.proto
deleted file mode 100644
index 8667422..0000000
--- a/expressions/window_aggregation/WindowAggregateFunction.proto
+++ /dev/null
@@ -1,32 +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.
-
-syntax = "proto2";
-
-package quickstep.serialization;
-
-message WindowAggregateFunction {
-  enum WindowAggregationID {
-    AVG = 0;
-    COUNT = 1;
-    MAX = 2;
-    MIN = 3;
-    SUM = 4;
-  }
-
-  required WindowAggregationID window_aggregation_id = 1;
-}

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/window_aggregation/WindowAggregateFunctionAvg.cpp
----------------------------------------------------------------------
diff --git a/expressions/window_aggregation/WindowAggregateFunctionAvg.cpp b/expressions/window_aggregation/WindowAggregateFunctionAvg.cpp
deleted file mode 100644
index 20c296b..0000000
--- a/expressions/window_aggregation/WindowAggregateFunctionAvg.cpp
+++ /dev/null
@@ -1,93 +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 "expressions/window_aggregation/WindowAggregateFunctionAvg.hpp"
-
-#include <vector>
-
-#include "expressions/window_aggregation/WindowAggregationHandleAvg.hpp"
-#include "types/Type.hpp"
-#include "types/TypeFactory.hpp"
-#include "types/TypeID.hpp"
-#include "types/operations/binary_operations/BinaryOperation.hpp"
-#include "types/operations/binary_operations/BinaryOperationFactory.hpp"
-#include "types/operations/binary_operations/BinaryOperationID.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-bool WindowAggregateFunctionAvg::canApplyToTypes(
-    const std::vector<const Type*> &argument_types) const {
-  // AVG is unary.
-  if (argument_types.size() != 1) {
-    return false;
-  }
-
-  // Argument must be addable and divisible.
-  return BinaryOperationFactory::GetBinaryOperation(BinaryOperationID::kAdd)
-             .canApplyToTypes(*argument_types.front(), *argument_types.front()) &&
-         BinaryOperationFactory::GetBinaryOperation(BinaryOperationID::kDivide)
-             .canApplyToTypes(*argument_types.front(), TypeFactory::GetType(kDouble));
-}
-
-const Type* WindowAggregateFunctionAvg::resultTypeForArgumentTypes(
-    const std::vector<const Type*> &argument_types) const {
-  if (!canApplyToTypes(argument_types)) {
-    return nullptr;
-  }
-
-  // The type used to sum values is nullable, and we automatically widen int to
-  // long and float to double to have more headroom when adding up many values.
-  const Type *sum_type = &(argument_types.front()->getNullableVersion());
-  switch (sum_type->getTypeID()) {
-    case kInt:
-      sum_type = &TypeFactory::GetType(kLong, true);
-      break;
-    case kFloat:
-      sum_type = &TypeFactory::GetType(kDouble, true);
-      break;
-    default:
-      break;
-  }
-
-  return BinaryOperationFactory::GetBinaryOperation(BinaryOperationID::kDivide)
-             .resultTypeForArgumentTypes(*sum_type, TypeFactory::GetType(kDouble));
-}
-
-WindowAggregationHandle* WindowAggregateFunctionAvg::createHandle(
-    const std::vector<const Type*> &argument_types,
-    const std::vector<std::unique_ptr<const Scalar>> &partition_by_attributes,
-    const std::vector<std::unique_ptr<const Scalar>> &order_by_attributes,
-    const bool is_row,
-    const std::int64_t num_preceding,
-    const std::int64_t num_following) const {
-  DCHECK(canApplyToTypes(argument_types))
-      << "Attempted to create an WindowAggregationHandleAvg for argument Type(s)"
-      << " that AVG can not be applied to.";
-
-  return new WindowAggregationHandleAvg(partition_by_attributes,
-                                        order_by_attributes,
-                                        is_row,
-                                        num_preceding,
-                                        num_following,
-                                        argument_types[0]);
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/window_aggregation/WindowAggregateFunctionAvg.hpp
----------------------------------------------------------------------
diff --git a/expressions/window_aggregation/WindowAggregateFunctionAvg.hpp b/expressions/window_aggregation/WindowAggregateFunctionAvg.hpp
deleted file mode 100644
index 1706ce8..0000000
--- a/expressions/window_aggregation/WindowAggregateFunctionAvg.hpp
+++ /dev/null
@@ -1,79 +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_EXPRESSIONS_WINDOW_AGGREGATION_WINDOW_AGGREGATE_FUNCTION_AVG_HPP_
-#define QUICKSTEP_EXPRESSIONS_WINDOW_AGGREGATION_WINDOW_AGGREGATE_FUNCTION_AVG_HPP_
-
-#include <string>
-#include <vector>
-
-#include "expressions/window_aggregation/WindowAggregateFunction.hpp"
-#include "expressions/window_aggregation/WindowAggregationID.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-
-class Type;
-class WindowAggregationHandle;
-
-/** \addtogroup Expressions
- *  @{
- */
-
-/**
- * @brief WindowAggregateFunction representing SQL AVG() OVER term.
- **/
-class WindowAggregateFunctionAvg : public WindowAggregateFunction {
- public:
-  static const WindowAggregateFunctionAvg& Instance() {
-    static WindowAggregateFunctionAvg instance;
-    return instance;
-  }
-
-  std::string getName() const override {
-    return "AVG";
-  }
-
-  bool canApplyToTypes(
-      const std::vector<const Type*> &argument_types) const override;
-
-  const Type* resultTypeForArgumentTypes(
-      const std::vector<const Type*> &argument_types) const override;
-
-  WindowAggregationHandle* createHandle(
-      const std::vector<const Type*> &argument_types,
-      const std::vector<std::unique_ptr<const Scalar>> &partition_by_attributes,
-      const std::vector<std::unique_ptr<const Scalar>> &order_by_attributes,
-      const bool is_row,
-      const std::int64_t num_preceding,
-      const std::int64_t num_following) const override;
-
- private:
-  WindowAggregateFunctionAvg()
-      : WindowAggregateFunction(WindowAggregationID::kAvg) {
-  }
-
-  DISALLOW_COPY_AND_ASSIGN(WindowAggregateFunctionAvg);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_EXPRESSIONS_WINDOW_AGGREGATION_WINDOW_AGGREGATE_FUNCTION_AVG_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/window_aggregation/WindowAggregateFunctionCount.cpp
----------------------------------------------------------------------
diff --git a/expressions/window_aggregation/WindowAggregateFunctionCount.cpp b/expressions/window_aggregation/WindowAggregateFunctionCount.cpp
deleted file mode 100644
index 9290ac0..0000000
--- a/expressions/window_aggregation/WindowAggregateFunctionCount.cpp
+++ /dev/null
@@ -1,63 +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 "expressions/window_aggregation/WindowAggregateFunctionCount.hpp"
-
-#include <vector>
-
-#include "expressions/window_aggregation/WindowAggregationHandle.hpp"
-#include "types/Type.hpp"
-#include "types/TypeFactory.hpp"
-#include "types/TypeID.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-bool WindowAggregateFunctionCount::canApplyToTypes(
-    const std::vector<const Type*> &argument_types) const {
-  // COUNT may be nullary (i.e. COUNT(*)) or unary.
-  return argument_types.size() <= 1;
-}
-
-const Type* WindowAggregateFunctionCount::resultTypeForArgumentTypes(
-    const std::vector<const Type*> &argument_types) const {
-  if (!canApplyToTypes(argument_types)) {
-    return nullptr;
-  }
-
-  return &TypeFactory::GetType(kLong);
-}
-
-WindowAggregationHandle* WindowAggregateFunctionCount::createHandle(
-    const std::vector<const Type*> &argument_types,
-    const std::vector<std::unique_ptr<const Scalar>> &partition_by_attributes,
-    const std::vector<std::unique_ptr<const Scalar>> &order_by_attributes,
-    const bool is_row,
-    const std::int64_t num_preceding,
-    const std::int64_t num_following) const {
-  DCHECK(canApplyToTypes(argument_types))
-      << "Attempted to create a WindowAggregationHandleCount for argument Types "
-      << "that COUNT can not be applied to (> 1 argument).";
-
-  // TODO(Shixuan): Add handle for Count.
-  return nullptr;
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/window_aggregation/WindowAggregateFunctionCount.hpp
----------------------------------------------------------------------
diff --git a/expressions/window_aggregation/WindowAggregateFunctionCount.hpp b/expressions/window_aggregation/WindowAggregateFunctionCount.hpp
deleted file mode 100644
index f508105..0000000
--- a/expressions/window_aggregation/WindowAggregateFunctionCount.hpp
+++ /dev/null
@@ -1,79 +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_EXPRESSIONS_WINDOW_AGGREGATION_WINDOW_AGGREGATE_FUNCTION_COUNT_HPP_
-#define QUICKSTEP_EXPRESSIONS_WINDOW_AGGREGATION_WINDOW_AGGREGATE_FUNCTION_COUNT_HPP_
-
-#include <string>
-#include <vector>
-
-#include "expressions/window_aggregation/WindowAggregateFunction.hpp"
-#include "expressions/window_aggregation/WindowAggregationID.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-
-class Type;
-class WindowAggregationHandle;
-
-/** \addtogroup Expressions
- *  @{
- */
-
-/**
- * @brief WindowAggregateFunction representing SQL COUNT() OVER term.
- **/
-class WindowAggregateFunctionCount : public WindowAggregateFunction {
- public:
-  static const WindowAggregateFunctionCount& Instance() {
-    static WindowAggregateFunctionCount instance;
-    return instance;
-  }
-
-  std::string getName() const override {
-    return "COUNT";
-  }
-
-  bool canApplyToTypes(
-      const std::vector<const Type*> &argument_types) const override;
-
-  const Type* resultTypeForArgumentTypes(
-      const std::vector<const Type*> &argument_types) const override;
-
-  WindowAggregationHandle* createHandle(
-      const std::vector<const Type*> &argument_types,
-      const std::vector<std::unique_ptr<const Scalar>> &partition_by_attributes,
-      const std::vector<std::unique_ptr<const Scalar>> &order_by_attributes,
-      const bool is_row,
-      const std::int64_t num_preceding,
-      const std::int64_t num_following) const override;
-
- private:
-  WindowAggregateFunctionCount()
-      : WindowAggregateFunction(WindowAggregationID::kCount) {
-  }
-
-  DISALLOW_COPY_AND_ASSIGN(WindowAggregateFunctionCount);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_EXPRESSIONS_WINDOW_AGGREGATION_WINDOW_AGGREGATE_FUNCTION_COUNT_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/window_aggregation/WindowAggregateFunctionFactory.cpp
----------------------------------------------------------------------
diff --git a/expressions/window_aggregation/WindowAggregateFunctionFactory.cpp b/expressions/window_aggregation/WindowAggregateFunctionFactory.cpp
deleted file mode 100644
index bb5d02e..0000000
--- a/expressions/window_aggregation/WindowAggregateFunctionFactory.cpp
+++ /dev/null
@@ -1,106 +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 "expressions/window_aggregation/WindowAggregateFunctionFactory.hpp"
-
-#include <string>
-#include <type_traits>
-
-#include "expressions/window_aggregation/WindowAggregateFunction.pb.h"
-#include "expressions/window_aggregation/WindowAggregateFunctionAvg.hpp"
-#include "expressions/window_aggregation/WindowAggregateFunctionCount.hpp"
-#include "expressions/window_aggregation/WindowAggregateFunctionMax.hpp"
-#include "expressions/window_aggregation/WindowAggregateFunctionMin.hpp"
-#include "expressions/window_aggregation/WindowAggregateFunctionSum.hpp"
-#include "expressions/window_aggregation/WindowAggregationID.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-const WindowAggregateFunction& WindowAggregateFunctionFactory::Get(
-    const WindowAggregationID agg_id) {
-  switch (agg_id) {
-    case WindowAggregationID::kAvg:
-      return WindowAggregateFunctionAvg::Instance();
-    case WindowAggregationID::kCount:
-      return WindowAggregateFunctionCount::Instance();
-    case WindowAggregationID::kMax:
-      return WindowAggregateFunctionMax::Instance();
-    case WindowAggregationID::kMin:
-      return WindowAggregateFunctionMin::Instance();
-    case WindowAggregationID::kSum:
-      return WindowAggregateFunctionSum::Instance();
-    default: {
-      LOG(FATAL) << "Unrecognized WindowAggregationID: "
-                 << static_cast<std::underlying_type<WindowAggregationID>::type>(agg_id);
-    }
-  }
-}
-
-const WindowAggregateFunction* WindowAggregateFunctionFactory::GetByName(
-    const std::string &name) {
-  if (name == "avg") {
-    return &WindowAggregateFunctionAvg::Instance();
-  } else if (name == "count") {
-    return &WindowAggregateFunctionCount::Instance();
-  } else if (name == "max") {
-    return &WindowAggregateFunctionMax::Instance();
-  } else if (name == "min") {
-    return &WindowAggregateFunctionMin::Instance();
-  } else if (name == "sum") {
-    return &WindowAggregateFunctionSum::Instance();
-  } else {
-    return nullptr;
-  }
-}
-
-bool WindowAggregateFunctionFactory::ProtoIsValid(
-    const serialization::WindowAggregateFunction &proto) {
-  return proto.IsInitialized() &&
-         serialization::WindowAggregateFunction::WindowAggregationID_IsValid(proto.window_aggregation_id());
-}
-
-const WindowAggregateFunction& WindowAggregateFunctionFactory::ReconstructFromProto(
-    const serialization::WindowAggregateFunction &proto) {
-  DCHECK(ProtoIsValid(proto))
-      << "Attempted to reconstruct an WindowAggregateFunction from an invalid proto:\n"
-      << proto.DebugString();
-
-  switch (proto.window_aggregation_id()) {
-    case serialization::WindowAggregateFunction::AVG:
-      return WindowAggregateFunctionAvg::Instance();
-    case serialization::WindowAggregateFunction::COUNT:
-      return WindowAggregateFunctionCount::Instance();
-    case serialization::WindowAggregateFunction::MAX:
-      return WindowAggregateFunctionMax::Instance();
-    case serialization::WindowAggregateFunction::MIN:
-      return WindowAggregateFunctionMin::Instance();
-    case serialization::WindowAggregateFunction::SUM:
-      return WindowAggregateFunctionSum::Instance();
-    default: {
-      LOG(FATAL) << "Unrecognized serialization::WindowAggregateFunction::WindowAggregationID: "
-                 << proto.window_aggregation_id()
-                 << "\nFull proto debug string:\n"
-                 << proto.DebugString();
-    }
-  }
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/window_aggregation/WindowAggregateFunctionFactory.hpp
----------------------------------------------------------------------
diff --git a/expressions/window_aggregation/WindowAggregateFunctionFactory.hpp b/expressions/window_aggregation/WindowAggregateFunctionFactory.hpp
deleted file mode 100644
index e572b13..0000000
--- a/expressions/window_aggregation/WindowAggregateFunctionFactory.hpp
+++ /dev/null
@@ -1,96 +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_EXPRESSIONS_WINDOW_AGGREGATION_WINDOW_AGGREGATE_FUNCTION_FACTORY_HPP_
-#define QUICKSTEP_EXPRESSIONS_WINDOW_AGGREGATION_WINDOW_AGGREGATE_FUNCTION_FACTORY_HPP_
-
-#include <string>
-
-#include "expressions/window_aggregation/WindowAggregationID.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-
-class WindowAggregateFunction;
-namespace serialization { class WindowAggregateFunction; }
-
-/** \addtogroup Expressions
- *  @{
- */
-
-/**
- * @brief All-static factory with methods that provide access to the various
- *        concrete implementations of WindowAggregateFunction.
- *
- * WindowAggregateFunctionFactory allows client code to use any
- * WindowAggregateFunction in Quickstep in a generic way without having to know
- * about all the specific subclasses of WindowAggregateFunction. In particular,
- * it is used to deserialize WindowAggregateFunctions used in
- * WindowAggregationOperationState from their protobuf representations
- * (originally created by the optimizer) when deserializing a QueryContext.
- **/
-namespace WindowAggregateFunctionFactory {
-  /**
-   * @brief Get a particular WindowAggregateFunction by its ID.
-   *
-   * @param agg_id The ID of the desired WindowAggregateFunction.
-   * @return A reference to the singleton instance of the
-   *         WindowAggregateFunction specified by agg_id.
-   **/
-  const WindowAggregateFunction& Get(const WindowAggregationID agg_id);
-
-  /**
-   * @brief Get a particular WindowAggregateFunction by its name in SQL syntax.
-   *
-   * @param name The name of the desired WindowAggregateFunction in lower case.
-   * @return A pointer to the WindowAggregateFunction specified by name, or NULL
-   *         if name does not match any known WindowAggregateFunction.
-   **/
-  const WindowAggregateFunction* GetByName(const std::string &name);
-
-  /**
-   * @brief Determine if a serialized protobuf representation of a
-   *        WindowAggregateFunction is fully-formed and valid.
-   *
-   * @param proto A serialized protobuf representation of a
-   *              WindowAggregateFunction to check for validity.
-   * @return Whether proto is fully-formed and valid.
-   **/
-  bool ProtoIsValid(const serialization::WindowAggregateFunction &proto);
-
-  /**
-   * @brief Get the WindowAggregateFunction represented by a proto.
-   *
-   * @warning It is an error to call this method with an invalid proto.
-   *          ProtoIsValid() should be called first to check.
-   *
-   * @param proto A serialized protobuf representation of a
-   *              WindowAggregateFunction.
-   * @return The WindowAggregateFunction represented by proto.
-   **/
-  const WindowAggregateFunction& ReconstructFromProto(
-      const serialization::WindowAggregateFunction &proto);
-
-}  // namespace WindowAggregateFunctionFactory
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_EXPRESSIONS_WINDOW_AGGREGATION_WINDOW_AGGREGATE_FUNCTION_FACTORY_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/window_aggregation/WindowAggregateFunctionMax.cpp
----------------------------------------------------------------------
diff --git a/expressions/window_aggregation/WindowAggregateFunctionMax.cpp b/expressions/window_aggregation/WindowAggregateFunctionMax.cpp
deleted file mode 100644
index 594301a..0000000
--- a/expressions/window_aggregation/WindowAggregateFunctionMax.cpp
+++ /dev/null
@@ -1,71 +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 "expressions/window_aggregation/WindowAggregateFunctionMax.hpp"
-
-#include <vector>
-
-#include "expressions/window_aggregation/WindowAggregationHandle.hpp"
-#include "types/Type.hpp"
-#include "types/operations/comparisons/Comparison.hpp"
-#include "types/operations/comparisons/ComparisonFactory.hpp"
-#include "types/operations/comparisons/ComparisonID.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-bool WindowAggregateFunctionMax::canApplyToTypes(
-    const std::vector<const Type*> &argument_types) const {
-  // MAX is unary.
-  if (argument_types.size() != 1) {
-    return false;
-  }
-
-  // Argument must be comparable by '>'.
-  return ComparisonFactory::GetComparison(ComparisonID::kGreater).canCompareTypes(
-      *argument_types.front(),
-      *argument_types.front());
-}
-
-const Type* WindowAggregateFunctionMax::resultTypeForArgumentTypes(
-    const std::vector<const Type*> &argument_types) const {
-  if (!canApplyToTypes(argument_types)) {
-    return nullptr;
-  }
-
-  return &(argument_types.front()->getNullableVersion());
-}
-
-WindowAggregationHandle* WindowAggregateFunctionMax::createHandle(
-    const std::vector<const Type*> &argument_types,
-    const std::vector<std::unique_ptr<const Scalar>> &partition_by_attributes,
-    const std::vector<std::unique_ptr<const Scalar>> &order_by_attributes,
-    const bool is_row,
-    const std::int64_t num_preceding,
-    const std::int64_t num_following) const {
-  DCHECK(canApplyToTypes(argument_types))
-      << "Attempted to create a WindowAggregationHandleMax for argument Type(s) "
-      << "that MAX can not be applied to.";
-
-  // TODO(Shixuan): Add handle for Max.
-  return nullptr;
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/window_aggregation/WindowAggregateFunctionMax.hpp
----------------------------------------------------------------------
diff --git a/expressions/window_aggregation/WindowAggregateFunctionMax.hpp b/expressions/window_aggregation/WindowAggregateFunctionMax.hpp
deleted file mode 100644
index 15563df..0000000
--- a/expressions/window_aggregation/WindowAggregateFunctionMax.hpp
+++ /dev/null
@@ -1,79 +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_EXPRESSIONS_WINDOW_AGGREGATION_WINDOW_AGGREGATE_FUNCTION_MAX_HPP_
-#define QUICKSTEP_EXPRESSIONS_WINDOW_AGGREGATION_WINDOW_AGGREGATE_FUNCTION_MAX_HPP_
-
-#include <string>
-#include <vector>
-
-#include "expressions/window_aggregation/WindowAggregateFunction.hpp"
-#include "expressions/window_aggregation/WindowAggregationID.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-
-class Type;
-class WindowAggregationHandle;
-
-/** \addtogroup Expressions
- *  @{
- */
-
-/**
- * @brief WindowAggregateFunction representing SQL MAX() OVER term.
- **/
-class WindowAggregateFunctionMax : public WindowAggregateFunction {
- public:
-  static const WindowAggregateFunctionMax& Instance() {
-    static WindowAggregateFunctionMax instance;
-    return instance;
-  }
-
-  std::string getName() const override {
-    return "MAX";
-  }
-
-  bool canApplyToTypes(
-      const std::vector<const Type*> &argument_types) const override;
-
-  const Type* resultTypeForArgumentTypes(
-      const std::vector<const Type*> &argument_types) const override;
-
-  WindowAggregationHandle* createHandle(
-      const std::vector<const Type*> &argument_types,
-      const std::vector<std::unique_ptr<const Scalar>> &partition_by_attributes,
-      const std::vector<std::unique_ptr<const Scalar>> &order_by_attributes,
-      const bool is_row,
-      const std::int64_t num_preceding,
-      const std::int64_t num_following) const override;
-
- private:
-  WindowAggregateFunctionMax()
-      : WindowAggregateFunction(WindowAggregationID::kMax) {
-  }
-
-  DISALLOW_COPY_AND_ASSIGN(WindowAggregateFunctionMax);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_EXPRESSIONS_WINDOW_AGGREGATION_WINDOW_AGGREGATE_FUNCTION_MAX_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/window_aggregation/WindowAggregateFunctionMin.cpp
----------------------------------------------------------------------
diff --git a/expressions/window_aggregation/WindowAggregateFunctionMin.cpp b/expressions/window_aggregation/WindowAggregateFunctionMin.cpp
deleted file mode 100644
index 650241f..0000000
--- a/expressions/window_aggregation/WindowAggregateFunctionMin.cpp
+++ /dev/null
@@ -1,70 +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 "expressions/window_aggregation/WindowAggregateFunctionMin.hpp"
-
-#include <vector>
-
-#include "expressions/window_aggregation/WindowAggregationHandle.hpp"
-#include "types/Type.hpp"
-#include "types/operations/comparisons/Comparison.hpp"
-#include "types/operations/comparisons/ComparisonFactory.hpp"
-#include "types/operations/comparisons/ComparisonID.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-bool WindowAggregateFunctionMin::canApplyToTypes(
-    const std::vector<const Type*> &argument_types) const {
-  // MIN is unary.
-  if (argument_types.size() != 1) {
-    return false;
-  }
-
-  // Argument must be comparable by '<'.
-  return ComparisonFactory::GetComparison(ComparisonID::kLess).canCompareTypes(
-      *argument_types.front(),
-      *argument_types.front());
-}
-
-const Type* WindowAggregateFunctionMin::resultTypeForArgumentTypes(
-    const std::vector<const Type*> &argument_types) const {
-  if (!canApplyToTypes(argument_types)) {
-    return nullptr;
-  }
-
-  return &(argument_types.front()->getNullableVersion());
-}
-
-WindowAggregationHandle* WindowAggregateFunctionMin::createHandle(
-    const std::vector<const Type*> &argument_types,
-    const std::vector<std::unique_ptr<const Scalar>> &partition_by_attributes,
-    const std::vector<std::unique_ptr<const Scalar>> &order_by_attributes,
-    const bool is_row,
-    const std::int64_t num_preceding,
-    const std::int64_t num_following) const {
-  DCHECK(canApplyToTypes(argument_types))
-      << "Attempted to create a WindowAggregationHandleMin for argument Type(s) "
-      << "that MIN can not be applied to.";
-
-  return nullptr;
-}
-
-}  // namespace quickstep


[30/51] [abbrv] [partial] incubator-quickstep git commit: remove c++ files

Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/parser/ParseIndexProperties.hpp
----------------------------------------------------------------------
diff --git a/parser/ParseIndexProperties.hpp b/parser/ParseIndexProperties.hpp
deleted file mode 100644
index 1ff13be..0000000
--- a/parser/ParseIndexProperties.hpp
+++ /dev/null
@@ -1,512 +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_PARSER_PARSE_INDEX_PROPERTIES_HPP_
-#define QUICKSTEP_PARSER_PARSE_INDEX_PROPERTIES_HPP_
-
-#include <cstdint>
-#include <memory>
-#include <string>
-#include <vector>
-#include <unordered_map>
-
-#include "parser/ParseKeyValue.hpp"
-#include "parser/ParseString.hpp"
-#include "parser/ParseTreeNode.hpp"
-#include "storage/StorageBlockLayout.pb.h"
-#include "utility/Macros.hpp"
-#include "utility/PtrList.hpp"
-#include "utility/StringUtil.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-/** \addtogroup Parser
- *  @{
- */
-
-/**
- * @brief Base class for different types of indices and their associated properties
- */
-class IndexProperties {
- public:
-  typedef std::unordered_map<const char*, ParseKeyValue::KeyValueType> valid_property_map_type;
-
-  // An enum specifying the reason for an invalid index description, if any.
-  enum class InvalidIndexType {
-    kNone = 0,
-    kUnimplemented,
-    kDuplicateKey,
-    kInvalidKey,
-    kInvalidValue,
-    kTypeIsNotString,
-    kSizeIsFloat,
-    kSizeIsNegative,
-    kNumHashesIsFloat,
-    kNumHashesIsNegative,
-    kProjectedCountIsFloat,
-    kProjectedCountIsNegative
-  };
-
-  /**
-   * @brief Constructor.
-   * @note The constructor takes ownership of index_sub_block_description.
-   *
-   * @param index_sub_block_description A pointer to an IndexSubBlockDescription proto object.
-   * @param invalid_index_type An enum describing the validity of index.
-   * @param invalid_property_node A pointer to an invalid ParseKeyValue node, if any.
-   **/
-  IndexProperties(IndexSubBlockDescription *index_sub_block_description,
-                  const InvalidIndexType invalid_index_type = InvalidIndexType::kNone,
-                  const ParseKeyValue *invalid_property_node = nullptr)
-      : index_sub_block_description_(index_sub_block_description),
-        invalid_index_type_(invalid_index_type),
-        invalid_property_node_(invalid_property_node) {
-  }
-
-  /**
-   * @brief Virtual Destructor
-   */
-  virtual ~IndexProperties() {
-  }
-
-  /**
-   * @brief Returns printable string that specifies reason for invalid index instance.
-   *
-   * @return The string describing the reason for invalid index
-   **/
-  virtual std::string getReasonForInvalidIndexDescription() const = 0;
-
-  /**
-   * @brief Modifies the index description given a set of custom properties
-   *        specified as a key-value list of properties.
-   *
-   * @param key_value_list Key Value list of custom properties.
-   * @return Returns true if the given set of custom properties was valid
-   *         and was applied correctly, otherwise returns false.
-   **/
-  virtual bool addCustomProperties(const PtrList<ParseKeyValue> *key_value_list) = 0;
-
-  /**
-   * @brief Checks whether this instance describes a valid index or not.
-   *
-   * @return True if index description is valid, false otherwise.
-   **/
-  bool isIndexPropertyValid() const {
-    return invalid_index_type_ == InvalidIndexType::kNone;
-  }
-
-  /**
-   * @brief Returns the parse node corresponding for invalid index instance, if any.
-   *
-   * @return The parse node.
-   **/
-  const ParseKeyValue* getInvalidPropertyNode() const {
-    return invalid_property_node_;
-  }
-
-  /**
-   * @brief Returns a protobuf object representing the index description.
-   *
-   * @return An IndexSubBlockDescription object.
-   **/
-  const IndexSubBlockDescription* getIndexDescription() const {
-    return index_sub_block_description_.get();
-  }
-
-  /**
-   * @brief A helper function that checks whether the given list of custom properties
-   *        contains duplicate keys or not.
-   *
-   * @param key_value_list Key Value list of custom properties.
-   * @param invalid_node Double pointer to an invalid node that is used to store duplicate node, if any.
-   * @return Returns true if the given set of custom properties contains duplicate
-   *         keys, otherwise returns false.
-   **/
-  bool hasDuplicateCustomProperty(const PtrList<ParseKeyValue> *key_value_list, const ParseKeyValue **invalid_node) {
-    // Define an existence map, which checks for duplicate properties in the key_value_list.
-    std::unordered_map<std::string, bool> is_duplicate_property;
-    for (const ParseKeyValue &key_value : *key_value_list) {
-      const std::string key = ToLower(key_value.key()->value());
-      if (is_duplicate_property.find(key) != is_duplicate_property.end()) {
-        *invalid_node = &key_value;
-        return true;  // duplicate found, return true.
-      } else {
-        is_duplicate_property[key] = true;
-      }
-    }
-    return false;  // no duplicates, return false.
-  }
-
- protected:
-  std::unique_ptr<IndexSubBlockDescription> index_sub_block_description_;
-  InvalidIndexType invalid_index_type_;
-  const ParseKeyValue *invalid_property_node_;  // referred object owned by ParseIndexProperties class.
-
-  /**
-   * @brief A setter function that be used to invalidate the index.
-   *
-   * @param invalid_index_type An enum corresponding to the reason, which invalidated the index.
-   * @param invalid_property_node Pointer to the node, which may have caused invalidation.
-   **/
-  void setIndexDescriptionAsInvalid(const InvalidIndexType invalid_index_type,
-                                    const ParseKeyValue *invalid_property_node) {
-    invalid_index_type_ = invalid_index_type;
-    invalid_property_node_ = invalid_property_node;
-    index_sub_block_description_.reset();
-  }
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(IndexProperties);
-};
-
-/**
- * @brief Implementation of index properties for a BitWeaving Index (H or V).
- */
-class BitWeavingIndexProperties : public IndexProperties {
- public:
-  static const char *kBitWeavingType;  // is of type string.
-
-  /**
-   * @brief Constructor.
-   **/
-  BitWeavingIndexProperties()
-    : IndexProperties(new IndexSubBlockDescription()) {
-    // Default to BITWEAVING_V, custom properties can change this to H.
-    index_sub_block_description_->set_sub_block_type(IndexSubBlockDescription::BITWEAVING_V);
-  }
-
-  ~BitWeavingIndexProperties() override {
-  }
-
-  std::string getReasonForInvalidIndexDescription() const override {
-    switch (invalid_index_type_) {
-      case InvalidIndexType::kNone:
-        return "";
-      case InvalidIndexType::kDuplicateKey:  // Fall through.
-      case InvalidIndexType::kInvalidKey:
-        return "The only valid property for BitWeaving is TYPE.";
-      case InvalidIndexType::kTypeIsNotString:  // Fall through.
-      case InvalidIndexType::kInvalidValue:
-        return "The only valid values for TYPE are V or H.";
-      default:
-        return "Unknown reason";
-    }
-  }
-
-  bool addCustomProperties(const PtrList<ParseKeyValue> *key_value_list) override {
-    if (key_value_list->size() == 0u) {
-      // No properties specified.
-      return true;
-    } else if (key_value_list->size() == 1u) {
-      const ParseKeyValue &key_value = *key_value_list->begin();
-      if (key_value.getKeyValueType() != ParseKeyValue::KeyValueType::kStringString) {
-        setIndexDescriptionAsInvalid(InvalidIndexType::kTypeIsNotString, &key_value);
-        return false;
-      }
-      const std::string key = ToLower(key_value.key()->value());
-      const std::string value = ToLower(
-          static_cast<const ParseKeyStringValue&>(key_value).value()->value());
-      if (key.compare(kBitWeavingType) == 0) {
-        if (value.compare("h") == 0) {
-          index_sub_block_description_->set_sub_block_type(IndexSubBlockDescription::BITWEAVING_H);
-          return true;
-        } else if (value.compare("v") != 0) {
-          setIndexDescriptionAsInvalid(InvalidIndexType::kInvalidValue, &key_value);
-          return false;
-        } else {
-          // If V was specified, then we do nothing because it's set to V by default.
-          return true;
-        }
-      } else {
-        // Incorrect key specified.
-        setIndexDescriptionAsInvalid(InvalidIndexType::kInvalidKey, &key_value);
-        return false;
-      }
-    } else {
-      // More than one key. This must be an error.
-      invalid_index_type_ = InvalidIndexType::kDuplicateKey;
-      return false;
-    }
-  }
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(BitWeavingIndexProperties);
-};
-
-/**
- * @brief Implementation of index properties for Bloom Filter Index
- */
-class BloomFilterIndexProperties : public IndexProperties {
- public:
-  // Index properties associated with this index.
-
-  static const char *kBloomFilterSizeInBytes;    // is of type integer
-  static const char *kBloomFilterNumHashes;      // is of type integer
-  static const char *kBloomFilterProjectElementCount;  // is of type integer
-
-  /**
-   * @brief Constructor.
-   **/
-  BloomFilterIndexProperties()
-      : IndexProperties(new IndexSubBlockDescription()) {
-    index_sub_block_description_->set_sub_block_type(IndexSubBlockDescription::BLOOM_FILTER);
-
-    // Initialize the valid_property_map_ for this index with appropriate type for each property.
-    valid_property_map_[kBloomFilterSizeInBytes] = ParseKeyValue::KeyValueType::kStringInteger;
-    valid_property_map_[kBloomFilterNumHashes] = ParseKeyValue::KeyValueType::kStringInteger;
-    valid_property_map_[kBloomFilterProjectElementCount] = ParseKeyValue::KeyValueType::kStringInteger;
-  }
-
-  ~BloomFilterIndexProperties() override {
-  }
-
-  std::string getReasonForInvalidIndexDescription() const override {
-    switch (invalid_index_type_) {
-      case InvalidIndexType::kNone:
-        return "";
-      case InvalidIndexType::kUnimplemented:
-        return "Bloom Filter index is not yet implemented";
-      case InvalidIndexType::kDuplicateKey:
-        return "Index property is specified more than once";
-      case InvalidIndexType::kInvalidKey:
-        return "Invalid property for this index";
-      case InvalidIndexType::kSizeIsFloat:
-        return "Size cannot be specified as a float";
-      case InvalidIndexType::kSizeIsNegative:
-        return "Size cannot be negative";
-      case InvalidIndexType::kNumHashesIsFloat:
-        return "Num_hashes cannot be specified as a float";
-      case InvalidIndexType::kNumHashesIsNegative:
-        return "Num_hashes cannot be negative";
-      case InvalidIndexType::kProjectedCountIsFloat:
-        return "Projected_element_count cannot be specified as a float";
-      case InvalidIndexType::kProjectedCountIsNegative:
-        return "Projected_element_count cannot be negative";
-      default:
-        return "Unknown reason";
-    }
-  }
-
-  bool addCustomProperties(const PtrList<ParseKeyValue> *key_value_list) override {
-    // If the index is unimplemented, skip adding the custom properties.
-    if (invalid_index_type_ == InvalidIndexType::kUnimplemented) {
-      return false;
-    }
-
-    // Verify for duplicates, if any.
-    if (hasDuplicateCustomProperty(key_value_list, &invalid_property_node_)) {
-      invalid_index_type_ = InvalidIndexType::kDuplicateKey;
-      return false;
-    }
-
-    for (const ParseKeyValue &key_value : *key_value_list) {
-      const std::string key = ToLower(key_value.key()->value());
-      if (key.compare(kBloomFilterSizeInBytes) == 0) {
-        const ParseKeyIntegerValue *key_integer_value = static_cast<const ParseKeyIntegerValue*>(&key_value);
-        if (key_integer_value->value()->float_like()) {
-          setIndexDescriptionAsInvalid(InvalidIndexType::kSizeIsFloat, &key_value);
-          return false;
-        }
-        const std::int64_t bloom_filter_size = key_integer_value->value()->long_value();
-        if (bloom_filter_size < 0) {
-          setIndexDescriptionAsInvalid(InvalidIndexType::kSizeIsNegative, &key_value);
-          return false;
-        }
-        // All good! allow the default bloom filter size to be modified.
-        index_sub_block_description_->SetExtension(BloomFilterIndexSubBlockDescription::bloom_filter_size,
-                                                   bloom_filter_size);
-      } else if (key.compare(kBloomFilterNumHashes) == 0) {
-        const ParseKeyIntegerValue *key_integer_value = static_cast<const ParseKeyIntegerValue*>(&key_value);
-        if (key_integer_value->value()->float_like()) {
-          setIndexDescriptionAsInvalid(InvalidIndexType::kNumHashesIsFloat, &key_value);
-          return false;
-        }
-        const std::int64_t number_of_hashes = key_integer_value->value()->long_value();
-        if (number_of_hashes < 0) {
-          setIndexDescriptionAsInvalid(InvalidIndexType::kNumHashesIsNegative, &key_value);
-          return false;
-        }
-        // All good! allow the default num_hashes to be modified.
-        index_sub_block_description_->SetExtension(BloomFilterIndexSubBlockDescription::number_of_hashes,
-                                                   number_of_hashes);
-      } else if (key.compare(kBloomFilterProjectElementCount) == 0) {
-        const ParseKeyIntegerValue *key_integer_value = static_cast<const ParseKeyIntegerValue*>(&key_value);
-        if (key_integer_value->value()->float_like()) {
-          setIndexDescriptionAsInvalid(InvalidIndexType::kProjectedCountIsFloat, &key_value);
-          return false;
-        }
-        const std::int64_t projected_element_count = key_integer_value->value()->long_value();
-        if (projected_element_count < 0) {
-          setIndexDescriptionAsInvalid(InvalidIndexType::kProjectedCountIsNegative, &key_value);
-          return false;
-        }
-        // All good! allow the default projected_element_count to be modified.
-        index_sub_block_description_->SetExtension(BloomFilterIndexSubBlockDescription::projected_element_count,
-                                                   projected_element_count);
-      } else {
-        // None of the defined properties matched, this is an invalid property for this index.
-        setIndexDescriptionAsInvalid(InvalidIndexType::kInvalidKey, &key_value);
-        return false;
-      }
-    }
-    invalid_index_type_ = InvalidIndexType::kNone;
-    invalid_property_node_ = nullptr;
-    return true;
-  }
-
- private:
-  // A map of index property constants and their associated type.
-  valid_property_map_type valid_property_map_;
-
-  DISALLOW_COPY_AND_ASSIGN(BloomFilterIndexProperties);
-};
-
-/**
- * @brief Implementation of index properties for CSB Tree Index.
- */
-class CSBTreeIndexProperties : public IndexProperties {
- public:
-  /**
-   * @brief Constructor.
-   **/
-  CSBTreeIndexProperties()
-    : IndexProperties(new IndexSubBlockDescription()) {
-    index_sub_block_description_->set_sub_block_type(IndexSubBlockDescription::CSB_TREE);
-  }
-
-  ~CSBTreeIndexProperties() override {
-  }
-
-  std::string getReasonForInvalidIndexDescription() const override {
-    switch (invalid_index_type_) {
-      case InvalidIndexType::kNone:
-        return "";
-      case InvalidIndexType::kUnimplemented:
-        return "CSB Tree index is not yet implemented";
-      case InvalidIndexType::kInvalidKey:
-        return "CSB Tree index does not define index properties";
-      default:
-        return "Unknown reason";
-    }
-  }
-
-  bool addCustomProperties(const PtrList<ParseKeyValue> *key_value_list) override {
-    // CSBTreeIndex does not define any additional index property,
-    // so a call to this function will invalidate the index.
-    invalid_index_type_ = InvalidIndexType::kInvalidKey;
-    invalid_property_node_ = nullptr;
-    index_sub_block_description_.reset();
-    return false;
-  }
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(CSBTreeIndexProperties);
-};
-
-/**
- * @brief Implementation of index properties for SMA Index.
- */
-class SMAIndexProperties : public IndexProperties {
- public:
-  /**
-   * @brief Constructor.
-   */
-  SMAIndexProperties() : IndexProperties(new IndexSubBlockDescription()) {
-    index_sub_block_description_->set_sub_block_type(IndexSubBlockDescription::SMA);
-  }
-
-  ~SMAIndexProperties() override {
-  }
-
-  std::string getReasonForInvalidIndexDescription() const override {
-    switch (invalid_index_type_) {
-      case InvalidIndexType::kNone:
-        return "";
-      case InvalidIndexType::kInvalidKey:
-        return "SMA index does not define index properties";
-      default:
-        return "Unknown reason";
-    }
-  }
-
-  bool addCustomProperties(const PtrList<ParseKeyValue> *key_value_list) override {
-    // SMA does not define any index properties, so calling this function
-    // will invalidate the index.
-    invalid_index_type_ = InvalidIndexType::kInvalidKey;
-    invalid_property_node_ = nullptr;
-    index_sub_block_description_.reset();
-    return false;
-  }
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(SMAIndexProperties);
-};
-
-/**
- * @brief Encapsulates the IndexProperties key-value list. Makes the job
- *        of resolving IndexProperties easy.
- */
-class ParseIndexProperties : public ParseTreeNode {
- public:
-  /**
-   * @brief Constructor.
-   *
-   * @param line_number Beginning line number.
-   * @param column_number Beginning column number.
-   * @param properties PtrList to the KeyValues.
-   */
-  ParseIndexProperties(const int line_number,
-                       const int column_number,
-                       PtrList<ParseKeyValue> *key_value_list)
-      : ParseTreeNode(line_number, column_number),
-        key_value_list_(key_value_list) {
-  }
-
-  std::string getName() const override { return "IndexProperties"; }
-
-  const PtrList<ParseKeyValue>* getKeyValueList() const {
-    return key_value_list_.get();
-  }
-
- 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<const ParseTreeNode*> *non_container_child_fields,
-      std::vector<std::string> *container_child_field_names,
-      std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const override {
-    for (const ParseKeyValue &index_property : *key_value_list_) {
-      non_container_child_field_names->push_back("index_property");
-      non_container_child_fields->push_back(&index_property);
-    }
-  }
-
- private:
-  std::unique_ptr<PtrList<ParseKeyValue>> key_value_list_;
-
-  DISALLOW_COPY_AND_ASSIGN(ParseIndexProperties);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_PARSER_PARSE_INDEX_PROPERTIES_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/parser/ParseJoinedTableReference.cpp
----------------------------------------------------------------------
diff --git a/parser/ParseJoinedTableReference.cpp b/parser/ParseJoinedTableReference.cpp
deleted file mode 100644
index b2cbeb2..0000000
--- a/parser/ParseJoinedTableReference.cpp
+++ /dev/null
@@ -1,73 +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 "parser/ParseJoinedTableReference.hpp"
-
-#include <string>
-#include <type_traits>
-#include <vector>
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-void ParseJoinedTableReference::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<const ParseTreeNode*> *non_container_child_fields,
-    std::vector<std::string> *container_child_field_names,
-    std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const {
-  ParseTableReference::getFieldStringItems(inline_field_names,
-                                           inline_field_values,
-                                           non_container_child_field_names,
-                                           non_container_child_fields,
-                                           container_child_field_names,
-                                           container_child_fields);
-
-  inline_field_names->push_back("join_type");
-  switch (join_type_) {
-    case JoinType::kInnerJoin:
-      inline_field_values->push_back("InnerJoin");
-      break;
-    case JoinType::kLeftOuterJoin:
-      inline_field_values->push_back("LeftOuterJoin");
-      break;
-    case JoinType::kRightOuterJoin:
-      inline_field_values->push_back("RightOuterJoin");
-      break;
-    case JoinType::kFullOuterJoin:
-      inline_field_values->push_back("FullOuterJoin");
-      break;
-    default:
-      LOG(FATAL) << "Invalid JoinType: "
-                 << static_cast<typename std::underlying_type<JoinType>::type>(join_type_);
-  }
-
-  non_container_child_field_names->push_back("left_table");
-  non_container_child_fields->push_back(left_table_.get());
-
-  non_container_child_field_names->push_back("right_table");
-  non_container_child_fields->push_back(right_table_.get());
-
-  non_container_child_field_names->push_back("join_predicate");
-  non_container_child_fields->push_back(join_predicate_.get());
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/parser/ParseJoinedTableReference.hpp
----------------------------------------------------------------------
diff --git a/parser/ParseJoinedTableReference.hpp b/parser/ParseJoinedTableReference.hpp
deleted file mode 100644
index f1f4aa2..0000000
--- a/parser/ParseJoinedTableReference.hpp
+++ /dev/null
@@ -1,130 +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_PARSER_PARSE_JOINED_TABLE_REFERENCE_HPP_
-#define QUICKSTEP_PARSER_PARSE_JOINED_TABLE_REFERENCE_HPP_
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "parser/ParsePredicate.hpp"
-#include "parser/ParseTableReference.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-
-class ParseTreeNode;
-
-/** \addtogroup Parser
- *  @{
- */
-
-/**
- * @brief Parsed representation of a joined table.
- */
-class ParseJoinedTableReference : public ParseTableReference {
- public:
-  enum class JoinType {
-    kInnerJoin = 0,
-    kLeftOuterJoin,
-    kRightOuterJoin,
-    kFullOuterJoin
-  };
-
-  /**
-   * @brief Constructor.
-   *
-   * @param line_number The line number of the token "JOIN" in the SQL statement.
-   * @param column_number The column number of the token "JOIN" in the SQL statement.
-   * @param join_type The join type.
-   * @param left_table The left-hand side table.
-   * @param right_table The right-hand side table.
-   * @param join_predicate The join predicate.
-   */
-  ParseJoinedTableReference(const int line_number,
-                            const int column_number,
-                            const JoinType join_type,
-                            ParseTableReference *left_table,
-                            ParseTableReference *right_table,
-                            ParsePredicate *join_predicate)
-    : ParseTableReference(line_number, column_number),
-      join_type_(join_type),
-      left_table_(left_table),
-      right_table_(right_table),
-      join_predicate_(join_predicate) {
-  }
-
-  TableReferenceType getTableReferenceType() const override {
-    return kJoinedTableReference;
-  }
-
-  std::string getName() const override { return "JoinedTable"; }
-
-  /**
-   * @return The join type.
-   */
-  JoinType join_type() const {
-    return join_type_;
-  }
-
-  /**
-   * @return The left-side table.
-   */
-  const ParseTableReference* left_table() const {
-    return left_table_.get();
-  }
-
-  /**
-   * @return The right-side table.
-   */
-  const ParseTableReference* right_table() const {
-    return right_table_.get();
-  }
-
-  /**
-   * @return The join predicate.
-   */
-  const ParsePredicate* join_predicate() const {
-    return join_predicate_.get();
-  }
-
- 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<const ParseTreeNode*> *non_container_child_fields,
-      std::vector<std::string> *container_child_field_names,
-      std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const override;
-
- private:
-  const JoinType join_type_;
-  std::unique_ptr<ParseTableReference> left_table_;
-  std::unique_ptr<ParseTableReference> right_table_;
-  std::unique_ptr<ParsePredicate> join_predicate_;
-
-  DISALLOW_COPY_AND_ASSIGN(ParseJoinedTableReference);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_PARSER_PARSE_JOINED_TABLE_REFERENCE_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/parser/ParseKeyValue.hpp
----------------------------------------------------------------------
diff --git a/parser/ParseKeyValue.hpp b/parser/ParseKeyValue.hpp
deleted file mode 100644
index 9d6d511..0000000
--- a/parser/ParseKeyValue.hpp
+++ /dev/null
@@ -1,257 +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_PARSER_PARSE_KEY_VALUE_HPP_
-#define QUICKSTEP_PARSER_PARSE_KEY_VALUE_HPP_
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "parser/ParseLiteralValue.hpp"
-#include "parser/ParseString.hpp"
-#include "parser/ParseTreeNode.hpp"
-#include "utility/Macros.hpp"
-#include "utility/PtrList.hpp"
-
-namespace quickstep {
-
-/**
- * @brief Base class for the Parse Key Values.
- */
-class ParseKeyValue : public ParseTreeNode {
- public:
-  enum class KeyValueType {
-    kStringString,
-    kStringStringList,
-    kStringInteger
-  };
-
-  /**
-   * @brief Single value constructor.
-   *
-   * @param line_number Line number of the first token of this node in the SQL statement.
-   * @param column_number Column number of the first token of this node in the SQL statement.
-   * @param value A single literal value.
-   **/
-  ParseKeyValue(const int line_number,
-                const int column_number,
-                ParseString *key)
-      : ParseTreeNode(line_number, column_number),
-        key_(key) { }
-
-  /**
-   * @brief Destructor.
-   **/
-  ~ParseKeyValue() override { }
-
-  /**
-   * @brief Get the subclass type of the parse key value.
-   */
-  virtual KeyValueType getKeyValueType() const = 0;
-
-  /**
-   * @return Pointer to the key string.
-   */
-  const ParseString* key() const {
-    return key_.get();
-  }
-
-  std::string getName() const override {
-    return "KeyValue";
-  }
-
- protected:
-  std::unique_ptr<ParseString> key_;
-};
-
-/**
- * @brief The parsed representation of a key-value pair.
- **/
-class ParseKeyStringValue : public ParseKeyValue {
- public:
-  /**
-   * @brief Single value constructor.
-   *
-   * @param line_number Line number of the first token of this node in the SQL statement.
-   * @param column_number Column number of the first token of this node in the SQL statement.
-   * @param key A parse string representing the key.
-   * @param value A parse string representing the key.
-   **/
-  ParseKeyStringValue(const int line_number,
-                      const int column_number,
-                      ParseString *key,
-                      ParseString *value)
-      : ParseKeyValue(line_number, column_number, key),
-        value_(value) { }
-
-  KeyValueType getKeyValueType() const override {
-    return ParseKeyValue::KeyValueType::kStringString;
-  }
-
-  /**
-   * @return A pointer to the value ParseString.
-   */
-  const ParseString* value() const {
-    return value_.get();
-  }
-
-  std::string getName() const override {
-    return "KeyStringValue";
-  }
-
- 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<const ParseTreeNode*> *non_container_child_fields,
-      std::vector<std::string> *container_child_field_names,
-      std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const override {
-    inline_field_names->push_back("key");
-    inline_field_values->push_back(key_->value());
-
-    non_container_child_field_names->push_back("value");
-    non_container_child_fields->push_back(value_.get());
-  }
-
- private:
-  std::unique_ptr<ParseString> value_;
-
-  DISALLOW_COPY_AND_ASSIGN(ParseKeyStringValue);
-};
-
-/**
- * @brief The parsed representation of a key-value pair. Value is a list of values.
- **/
-class ParseKeyStringList : public ParseKeyValue {
- public:
-  /**
-   * @brief Single value constructor.
-   *
-   * @param line_number Line number of the first token of this node in the SQL statement.
-   * @param column_number Column number of the first token of this node in the SQL statement.
-   * @param key A parse string representing the key.
-   * @param value A list of string values.
-   **/
-  ParseKeyStringList(const int line_number,
-                     const int column_number,
-                     ParseString *key,
-                     PtrList<ParseString> *value)
-      : ParseKeyValue(line_number, column_number, key),
-        value_(value) { }
-
-  KeyValueType getKeyValueType() const override {
-    return ParseKeyValue::KeyValueType::kStringStringList;
-  }
-
-  /**
-   * @return A list of ParseStrings.
-   */
-  const PtrList<ParseString>* value() const {
-    return value_.get();
-  }
-
-  std::string getName() const override {
-    return "KeyStringList";
-  }
-
- 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<const ParseTreeNode*> *non_container_child_fields,
-      std::vector<std::string> *container_child_field_names,
-      std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const override {
-    inline_field_names->push_back("key");
-    inline_field_values->push_back(key_->value());
-
-    container_child_field_names->push_back("value_list");
-    container_child_fields->emplace_back();
-    for (const ParseString &value : *value_) {
-      container_child_fields->back().push_back(&value);
-    }
-  }
-
- private:
-  std::unique_ptr<PtrList<ParseString> > value_;
-
-  DISALLOW_COPY_AND_ASSIGN(ParseKeyStringList);
-};
-
-/**
- * @brief The parsed representation of a key-value pair.
- **/
-class ParseKeyIntegerValue : public ParseKeyValue {
- public:
-  /**
-   * @brief Single value constructor.
-   *
-   * @param line_number Line number of the first token of this node in the SQL statement.
-   * @param column_number Column number of the first token of this node in the SQL statement.
-   * @param key A parse string representing the key.
-   * @param value A single numeric literal value.
-   **/
-  ParseKeyIntegerValue(const int line_number,
-                       const int column_number,
-                       ParseString *key,
-                       NumericParseLiteralValue *value)
-      : ParseKeyValue(line_number, column_number, key),
-        value_(value) { }
-
-  KeyValueType getKeyValueType() const override {
-    return ParseKeyValue::KeyValueType::kStringInteger;
-  }
-
-  /**
-   * @return A pointer to the value ParseString.
-   */
-  const NumericParseLiteralValue* value() const {
-    return value_.get();
-  }
-
-  std::string getName() const override {
-    return "KeyIntegerValue";
-  }
-
- 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<const ParseTreeNode*> *non_container_child_fields,
-      std::vector<std::string> *container_child_field_names,
-      std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const override {
-    inline_field_names->push_back("key");
-    inline_field_values->push_back(key_->value());
-
-    non_container_child_field_names->push_back("value");
-    non_container_child_fields->push_back(value_.get());
-  }
-
- private:
-  std::unique_ptr<NumericParseLiteralValue> value_;
-
-  DISALLOW_COPY_AND_ASSIGN(ParseKeyIntegerValue);
-};
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_PARSER_PARSE_KEY_VALUE_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/parser/ParseLimit.cpp
----------------------------------------------------------------------
diff --git a/parser/ParseLimit.cpp b/parser/ParseLimit.cpp
deleted file mode 100644
index f39c430..0000000
--- a/parser/ParseLimit.cpp
+++ /dev/null
@@ -1,39 +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 "parser/ParseLimit.hpp"
-
-#include <string>
-#include <vector>
-
-#include "parser/ParseLiteralValue.hpp"
-
-namespace quickstep {
-
-void ParseLimit::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<const ParseTreeNode*> *non_container_child_fields,
-                                     std::vector<std::string> *container_child_field_names,
-                                     std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const {
-  non_container_child_field_names->push_back("");
-  non_container_child_fields->push_back(limit_expression_.get());
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/parser/ParseLimit.hpp
----------------------------------------------------------------------
diff --git a/parser/ParseLimit.hpp b/parser/ParseLimit.hpp
deleted file mode 100644
index 2afb049..0000000
--- a/parser/ParseLimit.hpp
+++ /dev/null
@@ -1,90 +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_PARSER_PARSE_LIMIT_HPP_
-#define QUICKSTEP_PARSER_PARSE_LIMIT_HPP_
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "parser/ParseLiteralValue.hpp"
-#include "parser/ParseTreeNode.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-
-/** \addtogroup Parser
- *  @{
- */
-
-/**
- * @brief A parsed representation of LIMIT.
- */
-class ParseLimit : public ParseTreeNode {
- public:
-  /**
-   * @brief Constructor.
-   *
-   * @param line_number The line number of "LIMIT" in the SQL statement.
-   * @param column_number The column number of "LIMIT" in the SQL statement.
-   * @param limit_expression The LIMIT value expression.
-   */
-  ParseLimit(const int line_number, const int column_number, NumericParseLiteralValue *limit_expression)
-      : ParseTreeNode(line_number, column_number),
-        limit_expression_(limit_expression) {
-  }
-
-  /**
-   * @brief Destructor.
-   */
-  ~ParseLimit() override {}
-
-  /**
-   * @brief Gets the LIMIT expression.
-   *
-   * @return LIMIT expression
-   */
-  const NumericParseLiteralValue* limit_expression() const {
-    return limit_expression_.get();
-  }
-
-  std::string getName() const override {
-    return "LIMIT";
-  }
-
- 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<const ParseTreeNode*> *non_container_child_fields,
-                           std::vector<std::string> *container_child_field_names,
-                           std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const override;
-
- private:
-  std::unique_ptr<NumericParseLiteralValue> limit_expression_;
-
-  DISALLOW_COPY_AND_ASSIGN(ParseLimit);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_PARSER_PARSELIMIT_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/parser/ParseLiteralValue.cpp
----------------------------------------------------------------------
diff --git a/parser/ParseLiteralValue.cpp b/parser/ParseLiteralValue.cpp
deleted file mode 100644
index d4753ab..0000000
--- a/parser/ParseLiteralValue.cpp
+++ /dev/null
@@ -1,211 +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 __STDC_FORMAT_MACROS
-#define __STDC_FORMAT_MACROS
-#endif
-
-#include "parser/ParseLiteralValue.hpp"
-
-#include <cinttypes>
-#include <cstdint>
-#include <cstdio>
-#include <limits>
-#include <string>
-#include <utility>
-#include <vector>
-
-#include "types/DatetimeIntervalType.hpp"
-#include "types/DoubleType.hpp"
-#include "types/IntType.hpp"
-#include "types/LongType.hpp"
-#include "types/NullType.hpp"
-#include "types/Type.hpp"
-#include "types/VarCharType.hpp"
-#include "types/YearMonthIntervalType.hpp"
-#include "utility/SqlError.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-TypedValue NullParseLiteralValue::concretize(
-    const Type *type_hint,
-    const Type **concretized_type) const {
-  if (type_hint == nullptr) {
-    *concretized_type = &NullType::InstanceNullable();
-  } else {
-    *concretized_type = &(type_hint->getNullableVersion());
-  }
-  return (*concretized_type)->makeNullValue();
-}
-
-NumericParseLiteralValue::NumericParseLiteralValue(const int line_number,
-                                                   const int column_number,
-                                                   const char *numstring)
-    : ParseLiteralValue(line_number, column_number),
-      numeric_string_(numstring) {
-  float_like_ = (numeric_string_.find('.') != std::string::npos)
-                || (numeric_string_.find('e') != std::string::npos)
-                || (numeric_string_.find('E') != std::string::npos);
-
-  if (!float_like_) {
-    CHECK_EQ(1, std::sscanf(numeric_string_.c_str(), "%" SCNd64, &long_value_))
-        << "Failed to parse int64_t from numeric string \""
-        << numeric_string_ << "\n";
-  }
-}
-
-void NumericParseLiteralValue::prependMinus() {
-  std::string minused("-");
-  minused.append(numeric_string_);
-  numeric_string_ = std::move(minused);
-
-  if (!float_like_) {
-    long_value_ = -long_value_;
-  }
-}
-
-TypedValue NumericParseLiteralValue::concretize(
-    const Type *type_hint,
-    const Type **concretized_type) const {
-  TypedValue parsed_value;
-  if ((type_hint != nullptr)
-      && (type_hint->getSuperTypeID() == Type::kNumeric)
-      && (type_hint->parseValueFromString(numeric_string_, &parsed_value))) {
-    *concretized_type = &(type_hint->getNonNullableVersion());
-    return parsed_value;
-  }
-
-  if (float_like_) {
-    *concretized_type = &DoubleType::InstanceNonNullable();
-    CHECK((*concretized_type)->parseValueFromString(numeric_string_, &parsed_value))
-        << "Failed to parse double from numeric string \""
-        << numeric_string_ << "\"";
-    return parsed_value;
-  } else {
-    if ((long_value_ >= std::numeric_limits<int>::min())
-        && (long_value_ <= std::numeric_limits<int>::max())) {
-      *concretized_type = &IntType::InstanceNonNullable();
-      return TypedValue(static_cast<int>(long_value_));
-    } else {
-      *concretized_type = &LongType::InstanceNonNullable();
-      return TypedValue(long_value_);
-    }
-  }
-}
-
-void NumericParseLiteralValue::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<const ParseTreeNode*> *non_container_child_fields,
-    std::vector<std::string> *container_child_field_names,
-    std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const {
-  inline_field_names->push_back("numeric_string");
-  inline_field_values->push_back(numeric_string_);
-
-  inline_field_names->push_back("float_like");
-  inline_field_values->push_back(float_like_ ? "true" : "false");
-}
-
-bool StringParseLiteralValue::ParseAmbiguousInterval(
-    ParseString *value,
-    StringParseLiteralValue **output) {
-  *output = new StringParseLiteralValue(value,
-                                        nullptr);  // Initially no explicit type.
-
-  // Try parsing as DatetimeInterval.
-  (*output)->explicit_type_ = &DatetimeIntervalType::InstanceNonNullable();
-  if ((*output)->tryExplicitTypeParse()) {
-    return true;
-  }
-
-  // Try parsing as YearMonthInterval.
-  (*output)->explicit_type_ = &YearMonthIntervalType::InstanceNonNullable();
-  if ((*output)->tryExplicitTypeParse()) {
-    return true;
-  }
-
-  delete *output;
-  *output = nullptr;
-  return false;
-}
-
-TypedValue StringParseLiteralValue::concretize(const Type *type_hint,
-                                               const Type **concretized_type) const {
-  if (explicit_type_ != nullptr) {
-    if ((type_hint != nullptr) && (type_hint->isSafelyCoercibleFrom(*explicit_type_))) {
-      *concretized_type = type_hint;
-      return type_hint->coerceValue(explicit_parsed_value_, *explicit_type_);
-    } else {
-      *concretized_type = explicit_type_;
-      return explicit_parsed_value_;
-    }
-  } else {
-    TypedValue parsed_value;
-    if ((type_hint != nullptr)
-        && (type_hint->parseValueFromString(value_->value(), &parsed_value))) {
-      *concretized_type = &(type_hint->getNonNullableVersion());
-      return parsed_value;
-    } else {
-      *concretized_type = &VarCharType::InstanceNonNullable(value_->value().length());
-      CHECK((*concretized_type)->parseValueFromString(value_->value(), &parsed_value));
-      return parsed_value;
-    }
-  }
-}
-
-std::string StringParseLiteralValue::generateName() const {
-  std::string name;
-  if (explicit_type_ != nullptr) {
-    name.append(explicit_type_->getName());
-    name.push_back('(');
-  }
-  name.push_back('\'');
-  name.append(value_->value());
-  name.push_back('\'');
-  if (explicit_type_ != nullptr) {
-    name.push_back(')');
-  }
-  return name;
-}
-
-bool StringParseLiteralValue::tryExplicitTypeParse() {
-  DCHECK(explicit_type_ != nullptr);
-  return explicit_type_->parseValueFromString(value_->value(), &explicit_parsed_value_);
-}
-
-void StringParseLiteralValue::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<const ParseTreeNode*> *non_container_child_fields,
-    std::vector<std::string> *container_child_field_names,
-    std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const {
-  inline_field_names->push_back("value");
-  inline_field_values->push_back(value_->value());
-
-  if (explicit_type_ != nullptr) {
-    inline_field_names->push_back("explicit_type");
-    inline_field_values->push_back(explicit_type_->getName());
-  }
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/parser/ParseLiteralValue.hpp
----------------------------------------------------------------------
diff --git a/parser/ParseLiteralValue.hpp b/parser/ParseLiteralValue.hpp
deleted file mode 100644
index 105a774..0000000
--- a/parser/ParseLiteralValue.hpp
+++ /dev/null
@@ -1,354 +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_PARSER_PARSE_LITERAL_VALUE_HPP_
-#define QUICKSTEP_PARSER_PARSE_LITERAL_VALUE_HPP_
-
-#include <cstdint>
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "parser/ParseString.hpp"
-#include "parser/ParseTreeNode.hpp"
-#include "types/TypedValue.hpp"
-#include "utility/Macros.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-class Type;
-
-/** \addtogroup Parser
- *  @{
- */
-
-/**
- * @brief The parsed representation of a literal data value.
- **/
-class ParseLiteralValue : public ParseTreeNode {
- public:
-  /**
-   * @brief Virtual destructor.
-   **/
-  ~ParseLiteralValue() override {
-  }
-
-  /**
-   * @brief Obtain this value as a literal TypedValue in the quickstep type
-   *        system.
-   *
-   * @param type_hint A hint of what Type is expected. This may be used to give
-   *        NULL values the correct Type, or to disambiguate between types that
-   *        have similar human-readable text formats. type_hint may be NULL, in
-   *        which case the most sensible guess for the value's Type is used
-   *        (for a NULL literal, the special type NullType is used).
-   * @param concretized_type After the call, *concretized_type will point to
-   *        the actual Type that the returned TypedValue belongs to.
-   * @return The concrete version of this literal value.
-   **/
-  virtual TypedValue concretize(const Type *type_hint,
-                                const Type **concretized_type) const = 0;
-
-  /**
-   * @brief Obtain an exact, deep copy of this ParseLiteralValue.
-   *
-   * @return A copy of this ParseLiteralValue.
-   **/
-  virtual ParseLiteralValue* clone() const = 0;
-
-  /**
-   * @brief Get a human-readable representation of this value.
-   *
-   * @return The human-readable form of this value.
-   **/
-  virtual std::string generateName() const = 0;
-
- protected:
-  /**
-   * @brief Constructor.
-   *
-   * @param line_number Line number of the first token of this node in the SQL statement.
-   * @param column_number Column number of the first token of this node in the SQL statement.
-   **/
-  ParseLiteralValue(const int line_number, const int column_number)
-      : ParseTreeNode(line_number, column_number) {
-  }
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(ParseLiteralValue);
-};
-
-/**
- * @brief The parsed representation of a NULL literal.
- **/
-class NullParseLiteralValue: public ParseLiteralValue {
- public:
-  /**
-   * @brief Constructor.
-   *
-   * @param line_number Line number of the first token of this node in the SQL statement.
-   * @param column_number Column number of the first token of this node in the SQL statement.
-   **/
-  NullParseLiteralValue(const int line_number, const int column_number)
-      : ParseLiteralValue(line_number, column_number) {
-  }
-
-  std::string getName() const override {
-    return "NullLiteral";
-  }
-
-  TypedValue concretize(const Type *type_hint,
-                        const Type **concretized_type) const override;
-
-  ParseLiteralValue* clone() const override {
-    return new NullParseLiteralValue(line_number(), column_number());
-  }
-
-  std::string generateName() const override {
-    return "NULL";
-  }
-
- 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<const ParseTreeNode*> *non_container_child_fields,
-      std::vector<std::string> *container_child_field_names,
-      std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const override {
-  }
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(NullParseLiteralValue);
-};
-
-/**
- * @brief The parsed representation of an unquoted numeric literal.
- **/
-class NumericParseLiteralValue : public ParseLiteralValue {
- public:
-  /**
-   * @brief Constructor.
-   *
-   * @param line_number Line number of the first token of this node in the SQL statement.
-   * @param column_number Column number of the first token of this node in the SQL statement.
-   * @param numstring The C-string form of the numeric value.
-   **/
-  NumericParseLiteralValue(const int line_number,
-                           const int column_number,
-                           const char *numstring);
-
-  /**
-   * @brief Destructor.
-   **/
-  ~NumericParseLiteralValue() override {
-  }
-
-  std::string getName() const override {
-    return "NumericLiteral";
-  }
-
-  /**
-   * @brief Prepend a minus sign to this numeric value, negating it.
-   * @note This exists to work around a quirk in our Bison SQL grammar, since
-   *       a minus sign can be the leading character in a negative number OR
-   *       can represent the unary negation operation applied to a numeric
-   *       value. Our solution is to have the Lexer scan all numeric literals
-   *       as unsigned values, while the parser has a rule that calls this
-   *       method when a minus-sign token occurs in front of a numeric literal.
-   **/
-  void prependMinus();
-
-  /**
-   * @brief Determine whether this numeric value looks like a floating-point
-   *        value.
-   *
-   * @return True if the value is "float-like", false otherwise.
-   **/
-  bool float_like() const {
-    return float_like_;
-  }
-
-  /**
-   * @brief Get this numeric value as a long.
-   *
-   * @return This numeric value as a long.
-   **/
-  std::int64_t long_value() const {
-    DCHECK(!float_like_)
-        << "Attempted to read integer value from float-like "
-        << "NumericParseLiteralValue";
-    return long_value_;
-  }
-
-  /**
-   * @note This implementation of concretize() always tries to honor the given
-   *       type_hint first. If resolution with the supplied type_hint fails, or
-   *       if no type_hint is given, then the following rules apply:
-   *         1. If the literal contains a decimal point or exponent, resolve as
-   *            DoubleType (unless FloatType is hinted, we always use
-   *            DoubleType for more precision).
-   *         2. Otherwise, if the literal is in-range for a 32-bit signed
-   *            integer, resolve as IntType.
-   *         3. Otherwise, resolve as LongType.
-   **/
-  TypedValue concretize(const Type *type_hint,
-                        const Type **concretized_type) const override;
-
-  ParseLiteralValue* clone() const override {
-    return new NumericParseLiteralValue(line_number(),
-                                        column_number(),
-                                        numeric_string_.c_str());
-  }
-
-  std::string generateName() const override {
-    return numeric_string_;
-  }
-
- 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<const ParseTreeNode*> *non_container_child_fields,
-      std::vector<std::string> *container_child_field_names,
-      std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const override;
-
- private:
-  std::int64_t long_value_;
-  bool float_like_;
-
-  std::string numeric_string_;
-
-  DISALLOW_COPY_AND_ASSIGN(NumericParseLiteralValue);
-};
-
-/**
- * @brief The parsed representation of a quoted string value. This includes
- *        explicitly typed literals of the form "TYPE 'literal value'".
- **/
-class StringParseLiteralValue : public ParseLiteralValue {
- public:
-  /**
-   * @brief Constructor.
-   *
-   * @param value The string.
-   * @param explicit_type If non-NULL, indicates an explicit Type that appeared
-   *        immediately before a quoted string in the SQL syntax. If NULL, then
-   *        value appeared by itself as a quoted string without an explicit
-   *        Type.
-   **/
-  explicit StringParseLiteralValue(ParseString *value,
-                                   const Type *explicit_type)
-      : ParseLiteralValue(value->line_number(), value->column_number()),
-        value_(value),
-        explicit_type_(explicit_type) {
-  }
-
-  ~StringParseLiteralValue() override {
-  }
-
-  /**
-   * @brief Attempt to parse an interval literal that was specified
-   *        in the form "INTERVAL 'value string'" in SQL syntax.
-   * @note There are two distinct INTERVAL Types in Quickstep:
-   *       DatetimeInterval ("DATETIME INTERVAL" in SQL) and YearMonthInterval
-   *       ("YEARMONTH INTERVAL" in SQL). The INTERVAL keyword by itself is
-   *       ambiguous and does not name a Type, however the text formats for
-   *       literals of the two different interval Types are distinct and
-   *       non-overlapping, so if a valid interval literal string follows the
-   *       INTERVAL keyword, the Type can be determined unambiguously. This
-   *       method does just that, allowing the SQL parser to be more forgiving
-   *       when interval literals don't specify the flavor of interval
-   *       up-front.
-   *
-   * @param value A string literal that followed an INTERVAL keyword in SQL
-   *        syntax. On successful parse, this becomes owned by the parsed
-   *        StringParseLiteralValue. On failure, it is deleted.
-   * @param output On successful parse, *output is overwritten to point to a
-   *        new heap-allocated StringParseLiteralValue representing the parsed
-   *        interval literal.
-   * @return true if value was successfully parsed as either of the interval
-   *         types, false otherwise.
-   **/
-  static bool ParseAmbiguousInterval(ParseString *value,
-                                     StringParseLiteralValue **output);
-
-  /**
-   * @note The rules for what type this literal is resolved as depend on
-   *       whether an explicit_type_ from the SQL context exists, and whether
-   *       a type_hint is provided. Specifically, they are:
-   *         1. If there is an explicit_type_:
-   *           a. If there is a type_hint and it is safely coercible from
-   *              explicit_type_, do the coercion and resolve as type_hint.
-   *           b. Otherwise resolve as explicit_type_.
-   *         2. If there is no explicit_type_:
-   *           a. If there is a type_hint and it can successfully parse the
-   *              string value, resolve as the hinted type.
-   *           b. Otherwise, resolve as a non-nullable VarCharType that is
-   *              exactly long enough for this string literal.
-   **/
-  TypedValue concretize(const Type *type_hint,
-                        const Type **concretized_type) const override;
-
-  std::string getName() const override {
-    return "StringLiteral";
-  }
-
-  ParseLiteralValue* clone() const override {
-    return new StringParseLiteralValue(value_->clone(), explicit_type_);
-  }
-
-  std::string generateName() const override;
-
-  /**
-   * @brief Attempt to parse this string literal as an instance of the
-   *        explicit Type provided to the constructor. This should ALWAYS be
-   *        called by the parser immediately after creating a
-   *        StringParseLiteralValue with an explicit Type.
-   *
-   * @return true if parse was successful, false if the string was not in a
-   *         valid format for the specified explicit Type.
-   **/
-  bool tryExplicitTypeParse();
-
- 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<const ParseTreeNode*> *non_container_child_fields,
-      std::vector<std::string> *container_child_field_names,
-      std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const override;
-
- private:
-  std::unique_ptr<ParseString> value_;
-  const Type *explicit_type_;
-  TypedValue explicit_parsed_value_;
-
-  DISALLOW_COPY_AND_ASSIGN(StringParseLiteralValue);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_PARSER_PARSE_LITERAL_VALUE_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/parser/ParseOrderBy.cpp
----------------------------------------------------------------------
diff --git a/parser/ParseOrderBy.cpp b/parser/ParseOrderBy.cpp
deleted file mode 100644
index da46a1f..0000000
--- a/parser/ParseOrderBy.cpp
+++ /dev/null
@@ -1,57 +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 "parser/ParseOrderBy.hpp"
-
-#include <string>
-#include <vector>
-
-#include "parser/ParseExpression.hpp"
-
-namespace quickstep {
-
-void ParseOrderByItem::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<const ParseTreeNode*> *non_container_child_fields,
-    std::vector<std::string> *container_child_field_names,
-    std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const {
-  inline_field_names->push_back("is_asc");
-  inline_field_values->push_back(is_ascending_ ? "true" : "false");
-  inline_field_names->push_back("nulls_first");
-  inline_field_values->push_back(nulls_first_ ? "true" : "false");
-
-  non_container_child_field_names->push_back("");
-  non_container_child_fields->push_back(ordering_expression_.get());
-}
-
-void ParseOrderBy::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<const ParseTreeNode*> *non_container_child_fields,
-                                       std::vector<std::string> *container_child_field_names,
-                                       std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const {
-  for (const ParseOrderByItem &order_by_item : *order_by_items_) {
-    non_container_child_field_names->push_back("");
-    non_container_child_fields->push_back(&order_by_item);
-  }
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/parser/ParseOrderBy.hpp
----------------------------------------------------------------------
diff --git a/parser/ParseOrderBy.hpp b/parser/ParseOrderBy.hpp
deleted file mode 100644
index 88e9679..0000000
--- a/parser/ParseOrderBy.hpp
+++ /dev/null
@@ -1,167 +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_PARSER_PARSE_ORDERBY_HPP_
-#define QUICKSTEP_PARSER_PARSE_ORDERBY_HPP_
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "parser/ParseExpression.hpp"
-#include "parser/ParseTreeNode.hpp"
-#include "utility/Macros.hpp"
-#include "utility/PtrList.hpp"
-
-namespace quickstep {
-
-/** \addtogroup Parser
- *  @{
- */
-
-/**
- * @brief The parsed representation of an ORDER BY item consisting of
- *        an ordering expression and its ordering direction.
- */
-class ParseOrderByItem : public ParseTreeNode {
- public:
-  /**
-   * @brief Constructor.
-   *
-   * @param line_number The line number of the first token of this ORDER BY item
-   *                    in the SQL statement.
-   * @param column_number The column number of the first token of this ORDER BY
-   *                      item in the SQL statement.
-   * @param ordering_expression The ordering expression.
-   * @param is_ascending The optional ordering direction. The default value is
-   *                     true.
-   * @param nulls_first True if nulls are sorted before non-nulls.
-   *                    The default value is true when is_ascending is false,
-   *                    false otherwise.
-   */
-  ParseOrderByItem(const int line_number,
-                   const int column_number,
-                   ParseExpression *ordering_expression,
-                   const bool *is_ascending,
-                   const bool *nulls_first)
-      : ParseTreeNode(line_number, column_number),
-        ordering_expression_(ordering_expression),
-        is_ascending_(is_ascending == nullptr ? true : *is_ascending),
-        nulls_first_(nulls_first == nullptr ? !is_ascending_ : *nulls_first) {
-  }
-
-  /**
-   * @brief Destructor.
-   */
-  ~ParseOrderByItem() override {}
-
-  std::string getName() const override {
-    return "OrderByItem";
-  }
-
-  /**
-   * @return Ordering expression.
-   */
-  const ParseExpression* ordering_expression() const {
-    return ordering_expression_.get();
-  }
-
-  /**
-   * @return True if the ordering direction is ascending.
-   */
-  bool is_ascending() const {
-    return is_ascending_;
-  }
-
-  /**
-   * @return True if nulls are sorted before other values.
-   */
-  bool nulls_first() const {
-    return nulls_first_;
-  }
-
- 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<const ParseTreeNode*> *non_container_child_fields,
-                           std::vector<std::string> *container_child_field_names,
-                           std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const override;
-
- private:
-  std::unique_ptr<ParseExpression> ordering_expression_;
-  bool is_ascending_;
-  bool nulls_first_;
-
-  DISALLOW_COPY_AND_ASSIGN(ParseOrderByItem);
-};
-
-/**
- * @brief The parsed representation of ORDER BY.
- */
-class ParseOrderBy : public ParseTreeNode {
- public:
-  /**
-   * @brief Constructor.
-   *
-   * @param line_number The line number of "ORDER" in the SQL statement.
-   * @param column_number The column number of "ORDER" in the SQL statement.
-   * @param order_by_items The ORDER BY expression and the ordering direction.
-   */
-  ParseOrderBy(const int line_number, const int column_number, PtrList<ParseOrderByItem> *order_by_items)
-      : ParseTreeNode(line_number, column_number), order_by_items_(order_by_items) {
-  }
-
-  /**
-   * @brief Destructor.
-   */
-  ~ParseOrderBy() override {}
-
-  /**
-   * @brief Gets the ORDER BY expressions.
-   *
-   * @return ORDER BY expressions.
-   */
-  const PtrList<ParseOrderByItem>* order_by_items() const {
-    return order_by_items_.get();
-  }
-
-  std::string getName() const override {
-    return "OrderBy";
-  }
-
- 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<const ParseTreeNode*> *non_container_child_fields,
-                           std::vector<std::string> *container_child_field_names,
-                           std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const override;
-
- private:
-  std::unique_ptr<PtrList<ParseOrderByItem>> order_by_items_;
-
-  DISALLOW_COPY_AND_ASSIGN(ParseOrderBy);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_PARSER_PARSEORDERBY_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/parser/ParsePartitionClause.hpp
----------------------------------------------------------------------
diff --git a/parser/ParsePartitionClause.hpp b/parser/ParsePartitionClause.hpp
deleted file mode 100644
index d2912e7..0000000
--- a/parser/ParsePartitionClause.hpp
+++ /dev/null
@@ -1,134 +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_PARSER_PARSE_PARTITION_CLAUSE_HPP_
-#define QUICKSTEP_PARSER_PARSE_PARTITION_CLAUSE_HPP_
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "parser/ParseLiteralValue.hpp"
-#include "parser/ParseString.hpp"
-#include "parser/ParseTreeNode.hpp"
-#include "utility/Macros.hpp"
-#include "utility/PtrList.hpp"
-
-namespace quickstep {
-
-/** \addtogroup Parser
- *  @{
- */
-
-/**
- * @brief A parsed representation of partition clause.
- */
-class ParsePartitionClause : public ParseTreeNode {
- public:
-  /**
-   * @brief Constructor.
-   *
-   * @param line_number The line number of "PARTITION CLAUSE" in the SQL statement.
-   * @param column_number The column number of "PARTITION CLAUSE" in the SQL statement.
-   * @param partition_type The type of partitioning to be made - Hash or Range
-   * @param attribute_name_list A list of attributes of the relation based on which the partitioning has to be done.
-   * @param num_partitions The number of partitions to be created.
-   */
-  ParsePartitionClause(const int line_number,
-                       const int column_number,
-                       ParseString *partition_type,
-                       PtrList<ParseString> *attribute_name_list,
-                       NumericParseLiteralValue *num_partitions)
-      : ParseTreeNode(line_number, column_number),
-        partition_type_(partition_type),
-        attribute_name_list_(attribute_name_list),
-        num_partitions_(num_partitions) {
-  }
-
-  /**
-   * @brief Destructor.
-   */
-  ~ParsePartitionClause() override {}
-
-  std::string getName() const override {
-    return "PartitionClause";
-  }
-
-  /**
-   * @brief Get the type of the partitioning to be created.
-   *
-   * @return The type of partitioning.
-   **/
-  const ParseString* partition_type() const {
-    return partition_type_.get();
-  }
-
-  /**
-   * @brief Get the list of attributes on which partitioning is supposed to be defined.
-   *
-   * @return The list of attributes on which partitioning is to be based on.
-   **/
-  const PtrList<ParseString>& attribute_name_list() const {
-    return *attribute_name_list_;
-  }
-
-  /**
-   * @brief Get the number of partitions.
-   *
-   * @return The number of partitions.
-   */
-  const NumericParseLiteralValue* num_partitions() const {
-    return num_partitions_.get();
-  }
-
- 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<const ParseTreeNode*> *non_container_child_fields,
-                           std::vector<std::string> *container_child_field_names,
-                           std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const override {
-    inline_field_names->push_back("partition_type");
-    inline_field_values->push_back(partition_type_->value());
-
-    if (attribute_name_list_.get() != nullptr) {
-      container_child_field_names->push_back("attribute_name_list");
-      container_child_fields->emplace_back();
-      for (const ParseString& attribute_name : *attribute_name_list_) {
-        container_child_fields->back().push_back(&attribute_name);
-      }
-    }
-
-    non_container_child_field_names->push_back("Number of Partitions");
-    non_container_child_fields->push_back(num_partitions_.get());
-  }
-
- private:
-  std::unique_ptr<ParseString> partition_type_;
-  std::unique_ptr<PtrList<ParseString>> attribute_name_list_;
-  std::unique_ptr<NumericParseLiteralValue> num_partitions_;
-
-  DISALLOW_COPY_AND_ASSIGN(ParsePartitionClause);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_PARSER_PARSE_PARTITION_CLAUSE_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/parser/ParsePredicate.cpp
----------------------------------------------------------------------
diff --git a/parser/ParsePredicate.cpp b/parser/ParsePredicate.cpp
deleted file mode 100644
index 9747b08..0000000
--- a/parser/ParsePredicate.cpp
+++ /dev/null
@@ -1,106 +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 "parser/ParsePredicate.hpp"
-
-#include <string>
-#include <vector>
-
-#include "parser/ParseExpression.hpp"
-#include "types/operations/comparisons/Comparison.hpp"
-
-namespace quickstep {
-
-std::string ParsePredicateComparison::getName() const {
-  return op_.getName();
-}
-
-void ParsePredicateComparison::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<const ParseTreeNode*> *non_container_child_fields,
-    std::vector<std::string> *container_child_field_names,
-    std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const {
-  non_container_child_field_names->push_back("left_operand");
-  non_container_child_field_names->push_back("right_operand");
-  non_container_child_fields->push_back(left_operand_.get());
-  non_container_child_fields->push_back(right_operand_.get());
-}
-
-void ParsePredicateNegation::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<const ParseTreeNode*> *non_container_child_fields,
-    std::vector<std::string> *container_child_field_names,
-    std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const {
-  non_container_child_field_names->push_back("");
-  non_container_child_fields->push_back(operand_.get());
-}
-
-void ParsePredicateBetween::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<const ParseTreeNode*> *non_container_child_fields,
-    std::vector<std::string> *container_child_field_names,
-    std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const {
-  non_container_child_field_names->push_back("check_operand");
-  non_container_child_fields->push_back(check_operand_.get());
-
-  non_container_child_field_names->push_back("lower_bound_operand");
-  non_container_child_fields->push_back(lower_bound_operand_.get());
-
-  non_container_child_field_names->push_back("upper_bound_operand");
-  non_container_child_fields->push_back(upper_bound_operand_.get());
-}
-
-void ParsePredicateWithList::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<const ParseTreeNode*> *non_container_child_fields,
-    std::vector<std::string> *container_child_field_names,
-    std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const {
-  container_child_field_names->push_back("");
-  container_child_fields->emplace_back();
-  for (const ParsePredicate &operand : operands_) {
-    container_child_fields->back().push_back(&operand);
-  }
-}
-
-void ParsePredicateInValueList::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<const ParseTreeNode*> *non_container_child_fields,
-    std::vector<std::string> *container_child_field_names,
-    std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const {
-  non_container_child_field_names->push_back("test_expression");
-  non_container_child_fields->push_back(test_expression_.get());
-
-  container_child_field_names->push_back("value_list");
-  container_child_fields->emplace_back();
-  for (const ParseExpression &value : *value_list_) {
-    container_child_fields->back().emplace_back(&value);
-  }
-}
-
-}  // namespace quickstep


[38/51] [abbrv] [partial] incubator-quickstep git commit: remove c++ files

Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/aggregation/tests/AggregationHandleCount_unittest.cpp
----------------------------------------------------------------------
diff --git a/expressions/aggregation/tests/AggregationHandleCount_unittest.cpp b/expressions/aggregation/tests/AggregationHandleCount_unittest.cpp
deleted file mode 100644
index 78bd249..0000000
--- a/expressions/aggregation/tests/AggregationHandleCount_unittest.cpp
+++ /dev/null
@@ -1,660 +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 <cstddef>
-#include <cstdint>
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "catalog/CatalogTypedefs.hpp"
-#include "expressions/aggregation/AggregateFunction.hpp"
-#include "expressions/aggregation/AggregateFunctionFactory.hpp"
-#include "expressions/aggregation/AggregationHandle.hpp"
-#include "expressions/aggregation/AggregationHandleCount.hpp"
-#include "expressions/aggregation/AggregationID.hpp"
-#include "storage/AggregationOperationState.hpp"
-#include "storage/FastHashTableFactory.hpp"
-#include "storage/StorageManager.hpp"
-#include "types/CharType.hpp"
-#include "types/DoubleType.hpp"
-#include "types/FloatType.hpp"
-#include "types/IntType.hpp"
-#include "types/LongType.hpp"
-#include "types/Type.hpp"
-#include "types/TypeFactory.hpp"
-#include "types/TypeID.hpp"
-#include "types/TypedValue.hpp"
-#include "types/VarCharType.hpp"
-#include "types/containers/ColumnVector.hpp"
-
-#ifdef QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_SELECTION
-#include "types/containers/ColumnVectorsValueAccessor.hpp"
-#endif
-
-#include "gtest/gtest.h"
-
-namespace quickstep {
-
-class AggregationHandleCountTest : public ::testing::Test {
- protected:
-  const Type &dummy_type = TypeFactory::GetType(kInt);
-
-  void iterateHandleNullary(AggregationState *state) {
-    static_cast<const AggregationHandleCount<true, false> &>(
-        *aggregation_handle_count_)
-        .iterateNullaryInl(static_cast<AggregationStateCount *>(state));
-  }
-
-  // Helper method that calls AggregationHandleCount::iterateUnaryInl() to
-  // aggregate 'value' into '*state'.
-  void iterateHandle(AggregationState *state, const TypedValue &value) {
-    static_cast<const AggregationHandleCount<false, true> &>(
-        *aggregation_handle_count_)
-        .iterateUnaryInl(static_cast<AggregationStateCount *>(state), value);
-  }
-
-  void initializeHandle(const Type *argument_type) {
-    if (argument_type == nullptr) {
-      aggregation_handle_count_.reset(
-          AggregateFunctionFactory::Get(AggregationID::kCount)
-              .createHandle(std::vector<const Type *>()));
-    } else {
-      aggregation_handle_count_.reset(
-          AggregateFunctionFactory::Get(AggregationID::kCount)
-              .createHandle(std::vector<const Type *>(1, argument_type)));
-    }
-    aggregation_handle_count_state_.reset(
-        aggregation_handle_count_->createInitialState());
-  }
-
-  static bool ApplyToTypesTest(TypeID typeID) {
-    const Type &type =
-        (typeID == kChar || typeID == kVarChar)
-            ? TypeFactory::GetType(typeID, static_cast<std::size_t>(10))
-            : TypeFactory::GetType(typeID);
-
-    return AggregateFunctionFactory::Get(AggregationID::kCount)
-        .canApplyToTypes(std::vector<const Type *>(1, &type));
-  }
-
-  static bool ResultTypeForArgumentTypeTest(TypeID input_type_id,
-                                            TypeID output_type_id) {
-    const Type *result_type =
-        AggregateFunctionFactory::Get(AggregationID::kCount)
-            .resultTypeForArgumentTypes(std::vector<const Type *>(
-                1, &TypeFactory::GetType(input_type_id)));
-    return (result_type->getTypeID() == output_type_id);
-  }
-
-  static void CheckCountValue(std::int64_t expected,
-                              const AggregationHandle &handle,
-                              const AggregationState &state) {
-    EXPECT_EQ(expected, handle.finalize(state).getLiteral<std::int64_t>());
-  }
-
-  static void CheckCountValue(std::int64_t expected, const TypedValue &value) {
-    EXPECT_EQ(expected, value.getLiteral<std::int64_t>());
-  }
-
-  void checkAggregationCountNullary(int test_count) {
-    initializeHandle(nullptr);
-    CheckCountValue(
-        0, *aggregation_handle_count_, *aggregation_handle_count_state_);
-
-    for (int i = 0; i < test_count; ++i) {
-      iterateHandleNullary(aggregation_handle_count_state_.get());
-    }
-    CheckCountValue(test_count,
-                    *aggregation_handle_count_,
-                    *aggregation_handle_count_state_);
-
-    // Test mergeStates.
-    std::unique_ptr<AggregationState> merge_state(
-        aggregation_handle_count_->createInitialState());
-    aggregation_handle_count_->mergeStates(
-        *merge_state, aggregation_handle_count_state_.get());
-
-    for (int i = 0; i < test_count; ++i) {
-      iterateHandleNullary(merge_state.get());
-    }
-
-    aggregation_handle_count_->mergeStates(
-        *merge_state, aggregation_handle_count_state_.get());
-    CheckCountValue(2 * test_count,
-                    *aggregation_handle_count_,
-                    *aggregation_handle_count_state_);
-  }
-
-  void checkAggregationCountNullaryAccumulate(int test_count) {
-    initializeHandle(nullptr);
-
-    std::unique_ptr<AggregationState> accumulated_state(
-        aggregation_handle_count_->accumulateNullary(test_count));
-
-    // Test the state generated directly by accumulateNullary(), and also test
-    // after merging back.
-    CheckCountValue(test_count, *aggregation_handle_count_, *accumulated_state);
-
-    aggregation_handle_count_->mergeStates(
-        *accumulated_state, aggregation_handle_count_state_.get());
-    CheckCountValue(test_count,
-                    *aggregation_handle_count_,
-                    *aggregation_handle_count_state_);
-  }
-
-  template <typename NumericType>
-  void checkAggregationCountNumeric(int test_count) {
-    const NumericType &type = NumericType::Instance(true);
-    initializeHandle(&type);
-    CheckCountValue(
-        0, *aggregation_handle_count_, *aggregation_handle_count_state_);
-
-    typename NumericType::cpptype val = 0;
-    int count = 0;
-
-    iterateHandle(aggregation_handle_count_state_.get(), type.makeNullValue());
-    for (int i = 0; i < test_count; ++i) {
-      iterateHandle(aggregation_handle_count_state_.get(),
-                    type.makeValue(&val));
-      ++count;
-    }
-    iterateHandle(aggregation_handle_count_state_.get(), type.makeNullValue());
-    CheckCountValue(
-        count, *aggregation_handle_count_, *aggregation_handle_count_state_);
-
-    // Test mergeStates.
-    std::unique_ptr<AggregationState> merge_state(
-        aggregation_handle_count_->createInitialState());
-    aggregation_handle_count_->mergeStates(
-        *merge_state, aggregation_handle_count_state_.get());
-
-    iterateHandle(merge_state.get(), type.makeNullValue());
-    for (int i = 0; i < test_count; ++i) {
-      iterateHandle(merge_state.get(), type.makeValue(&val));
-      ++count;
-    }
-    iterateHandle(merge_state.get(), type.makeNullValue());
-
-    aggregation_handle_count_->mergeStates(
-        *merge_state, aggregation_handle_count_state_.get());
-    CheckCountValue(
-        count, *aggregation_handle_count_, *aggregation_handle_count_state_);
-  }
-
-  template <typename NumericType>
-  ColumnVector* createColumnVectorNumeric(const Type &type, int test_count) {
-    NativeColumnVector *column = new NativeColumnVector(type, test_count + 3);
-
-    typename NumericType::cpptype val = 0;
-    column->appendTypedValue(type.makeNullValue());
-    for (int i = 0; i < test_count; ++i) {
-      column->appendTypedValue(type.makeValue(&val));
-      // One NULL in the middle.
-      if (i == test_count / 2) {
-        column->appendTypedValue(type.makeNullValue());
-      }
-    }
-    column->appendTypedValue(type.makeNullValue());
-    return column;
-  }
-
-  template <typename NumericType>
-  void checkAggregationCountNumericColumnVector(int test_count) {
-    const NumericType &type = NumericType::Instance(true);
-    initializeHandle(&type);
-    CheckCountValue(
-        0, *aggregation_handle_count_, *aggregation_handle_count_state_);
-
-    std::vector<std::unique_ptr<ColumnVector>> column_vectors;
-    column_vectors.emplace_back(
-        createColumnVectorNumeric<NumericType>(type, test_count));
-
-    std::unique_ptr<AggregationState> cv_state(
-        aggregation_handle_count_->accumulateColumnVectors(column_vectors));
-
-    // Test the state generated directly by accumulateColumnVectors(), and also
-    // test after merging back.
-    CheckCountValue(test_count, *aggregation_handle_count_, *cv_state);
-
-    aggregation_handle_count_->mergeStates(
-        *cv_state, aggregation_handle_count_state_.get());
-    CheckCountValue(test_count,
-                    *aggregation_handle_count_,
-                    *aggregation_handle_count_state_);
-  }
-
-#ifdef QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_SELECTION
-  template <typename NumericType>
-  void checkAggregationCountNumericValueAccessor(int test_count) {
-    const NumericType &type = NumericType::Instance(true);
-    initializeHandle(&type);
-    CheckCountValue(
-        0, *aggregation_handle_count_, *aggregation_handle_count_state_);
-
-    std::unique_ptr<ColumnVectorsValueAccessor> accessor(
-        new ColumnVectorsValueAccessor());
-    accessor->addColumn(
-        createColumnVectorNumeric<NumericType>(type, test_count));
-
-    std::unique_ptr<AggregationState> va_state(
-        aggregation_handle_count_->accumulateValueAccessor(
-            accessor.get(), std::vector<attribute_id>(1, 0)));
-
-    // Test the state generated directly by accumulateValueAccessor(), and also
-    // test after merging back.
-    CheckCountValue(test_count, *aggregation_handle_count_, *va_state);
-
-    aggregation_handle_count_->mergeStates(
-        *va_state, aggregation_handle_count_state_.get());
-    CheckCountValue(test_count,
-                    *aggregation_handle_count_,
-                    *aggregation_handle_count_state_);
-  }
-#endif  // QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_SELECTION
-
-  template <typename StringType>
-  void checkAggregationCountString(int test_count) {
-    const StringType &type = StringType::Instance(10, true);
-    initializeHandle(&type);
-    CheckCountValue(
-        0, *aggregation_handle_count_, *aggregation_handle_count_state_);
-
-    std::string string_literal = "test_str";
-    int count = 0;
-
-    iterateHandle(aggregation_handle_count_state_.get(), type.makeNullValue());
-    for (int i = 0; i < test_count; ++i) {
-      iterateHandle(aggregation_handle_count_state_.get(),
-                    type.makeValue(string_literal.c_str(), 10));
-      ++count;
-    }
-    iterateHandle(aggregation_handle_count_state_.get(), type.makeNullValue());
-    CheckCountValue(
-        count, *aggregation_handle_count_, *aggregation_handle_count_state_);
-
-    // Test mergeStates().
-    std::unique_ptr<AggregationState> merge_state(
-        aggregation_handle_count_->createInitialState());
-
-    iterateHandle(merge_state.get(), type.makeNullValue());
-    for (int i = 0; i < test_count; ++i) {
-      iterateHandle(merge_state.get(),
-                    type.makeValue(string_literal.c_str(), 10));
-      ++count;
-    }
-    iterateHandle(merge_state.get(), type.makeNullValue());
-
-    aggregation_handle_count_->mergeStates(
-        *merge_state, aggregation_handle_count_state_.get());
-    CheckCountValue(
-        count, *aggregation_handle_count_, *aggregation_handle_count_state_);
-  }
-
-  template <typename ColumnVectorType>
-  ColumnVector* createColumnVectorString(const Type &type, int test_count) {
-    ColumnVectorType *column = new ColumnVectorType(type, test_count + 3);
-
-    std::string string_literal = "test_str";
-    column->appendTypedValue(type.makeNullValue());
-    for (int i = 0; i < test_count; ++i) {
-      column->appendTypedValue(type.makeValue(string_literal.c_str(), 10));
-      // One NULL in the middle.
-      if (i == test_count / 2) {
-        column->appendTypedValue(type.makeNullValue());
-      }
-    }
-    column->appendTypedValue(type.makeNullValue());
-
-    return column;
-  }
-
-  template <typename StringType, typename ColumnVectorType>
-  void checkAggregationCountStringColumnVector(int test_count) {
-    const StringType &type = StringType::Instance(10, true);
-    initializeHandle(&type);
-    CheckCountValue(
-        0, *aggregation_handle_count_, *aggregation_handle_count_state_);
-
-    std::vector<std::unique_ptr<ColumnVector>> column_vectors;
-    column_vectors.emplace_back(
-        createColumnVectorString<ColumnVectorType>(type, test_count));
-
-    std::unique_ptr<AggregationState> cv_state(
-        aggregation_handle_count_->accumulateColumnVectors(column_vectors));
-
-    // Test the state generated directly by accumulateColumnVectors(), and also
-    // test after merging back.
-    CheckCountValue(test_count, *aggregation_handle_count_, *cv_state);
-
-    aggregation_handle_count_->mergeStates(
-        *cv_state, aggregation_handle_count_state_.get());
-    CheckCountValue(test_count,
-                    *aggregation_handle_count_,
-                    *aggregation_handle_count_state_);
-  }
-
-#ifdef QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_SELECTION
-  template <typename StringType, typename ColumnVectorType>
-  void checkAggregationCountStringValueAccessor(int test_count) {
-    const StringType &type = StringType::Instance(10, true);
-    initializeHandle(&type);
-    CheckCountValue(
-        0, *aggregation_handle_count_, *aggregation_handle_count_state_);
-
-    std::unique_ptr<ColumnVectorsValueAccessor> accessor(
-        new ColumnVectorsValueAccessor());
-    accessor->addColumn(
-        createColumnVectorString<ColumnVectorType>(type, test_count));
-
-    std::unique_ptr<AggregationState> va_state(
-        aggregation_handle_count_->accumulateValueAccessor(
-            accessor.get(), std::vector<attribute_id>(1, 0)));
-
-    // Test the state generated directly by accumulateValueAccessor(), and also
-    // test after merging back.
-    CheckCountValue(test_count, *aggregation_handle_count_, *va_state);
-
-    aggregation_handle_count_->mergeStates(
-        *va_state, aggregation_handle_count_state_.get());
-    CheckCountValue(test_count,
-                    *aggregation_handle_count_,
-                    *aggregation_handle_count_state_);
-  }
-#endif  // QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_SELECTION
-
-  std::unique_ptr<AggregationHandle> aggregation_handle_count_;
-  std::unique_ptr<AggregationState> aggregation_handle_count_state_;
-  std::unique_ptr<StorageManager> storage_manager_;
-};
-
-typedef AggregationHandleCountTest AggregationHandleCountDeathTest;
-
-TEST_F(AggregationHandleCountTest, CountStarTest) {
-  checkAggregationCountNullary(0), checkAggregationCountNullary(10000);
-}
-
-TEST_F(AggregationHandleCountTest, CountStarAccumulateTest) {
-  checkAggregationCountNullaryAccumulate(0),
-      checkAggregationCountNullaryAccumulate(10000);
-}
-
-TEST_F(AggregationHandleCountTest, IntTypeTest) {
-  checkAggregationCountNumeric<IntType>(0);
-  checkAggregationCountNumeric<IntType>(10000);
-}
-
-TEST_F(AggregationHandleCountTest, LongTypeTest) {
-  checkAggregationCountNumeric<LongType>(0);
-  checkAggregationCountNumeric<LongType>(10000);
-}
-
-TEST_F(AggregationHandleCountTest, FloatTypeTest) {
-  checkAggregationCountNumeric<FloatType>(0);
-  checkAggregationCountNumeric<FloatType>(10000);
-}
-
-TEST_F(AggregationHandleCountTest, DoubleTypeTest) {
-  checkAggregationCountNumeric<DoubleType>(0);
-  checkAggregationCountNumeric<DoubleType>(10000);
-}
-
-TEST_F(AggregationHandleCountTest, CharTypeTest) {
-  checkAggregationCountString<CharType>(0);
-  checkAggregationCountString<CharType>(10000);
-}
-
-TEST_F(AggregationHandleCountTest, VarCharTypeTest) {
-  checkAggregationCountString<VarCharType>(0);
-  checkAggregationCountString<VarCharType>(10000);
-}
-
-TEST_F(AggregationHandleCountTest, IntTypeColumnVectorTest) {
-  checkAggregationCountNumericColumnVector<IntType>(0);
-  checkAggregationCountNumericColumnVector<IntType>(10000);
-}
-
-TEST_F(AggregationHandleCountTest, LongTypeColumnVectorTest) {
-  checkAggregationCountNumericColumnVector<LongType>(0);
-  checkAggregationCountNumericColumnVector<LongType>(10000);
-}
-
-TEST_F(AggregationHandleCountTest, FloatTypeColumnVectorTest) {
-  checkAggregationCountNumericColumnVector<FloatType>(0);
-  checkAggregationCountNumericColumnVector<FloatType>(10000);
-}
-
-TEST_F(AggregationHandleCountTest, DoubleTypeColumnVectorTest) {
-  checkAggregationCountNumericColumnVector<DoubleType>(0);
-  checkAggregationCountNumericColumnVector<DoubleType>(10000);
-}
-
-TEST_F(AggregationHandleCountTest, CharTypeColumnVectorTest) {
-  checkAggregationCountStringColumnVector<CharType, NativeColumnVector>(0);
-  checkAggregationCountStringColumnVector<CharType, NativeColumnVector>(10000);
-}
-
-TEST_F(AggregationHandleCountTest, VarCharTypeColumnVectorTest) {
-  checkAggregationCountStringColumnVector<VarCharType, IndirectColumnVector>(0);
-  checkAggregationCountStringColumnVector<VarCharType, IndirectColumnVector>(
-      10000);
-}
-
-#ifdef QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_SELECTION
-TEST_F(AggregationHandleCountTest, IntTypeValueAccessorTest) {
-  checkAggregationCountNumericValueAccessor<IntType>(0);
-  checkAggregationCountNumericValueAccessor<IntType>(10000);
-}
-
-TEST_F(AggregationHandleCountTest, LongTypeValueAccessorTest) {
-  checkAggregationCountNumericValueAccessor<LongType>(0);
-  checkAggregationCountNumericValueAccessor<LongType>(10000);
-}
-
-TEST_F(AggregationHandleCountTest, FloatTypeValueAccessorTest) {
-  checkAggregationCountNumericValueAccessor<FloatType>(0);
-  checkAggregationCountNumericValueAccessor<FloatType>(10000);
-}
-
-TEST_F(AggregationHandleCountTest, DoubleTypeValueAccessorTest) {
-  checkAggregationCountNumericValueAccessor<DoubleType>(0);
-  checkAggregationCountNumericValueAccessor<DoubleType>(10000);
-}
-
-TEST_F(AggregationHandleCountTest, CharTypeValueAccessorTest) {
-  checkAggregationCountStringValueAccessor<CharType, NativeColumnVector>(0);
-  checkAggregationCountStringValueAccessor<CharType, NativeColumnVector>(10000);
-}
-
-TEST_F(AggregationHandleCountTest, VarCharTypeValueAccessorTest) {
-  checkAggregationCountStringValueAccessor<VarCharType, IndirectColumnVector>(
-      0);
-  checkAggregationCountStringValueAccessor<VarCharType, IndirectColumnVector>(
-      10000);
-}
-#endif  // QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_SELECTION
-
-TEST_F(AggregationHandleCountTest, canApplyToTypeTest) {
-  EXPECT_TRUE(ApplyToTypesTest(kInt));
-  EXPECT_TRUE(ApplyToTypesTest(kLong));
-  EXPECT_TRUE(ApplyToTypesTest(kFloat));
-  EXPECT_TRUE(ApplyToTypesTest(kDouble));
-  EXPECT_TRUE(ApplyToTypesTest(kChar));
-  EXPECT_TRUE(ApplyToTypesTest(kVarChar));
-}
-
-TEST_F(AggregationHandleCountTest, ResultTypeForArgumentTypeTest) {
-  EXPECT_TRUE(ResultTypeForArgumentTypeTest(kInt, kLong));
-  EXPECT_TRUE(ResultTypeForArgumentTypeTest(kLong, kLong));
-  EXPECT_TRUE(ResultTypeForArgumentTypeTest(kFloat, kLong));
-  EXPECT_TRUE(ResultTypeForArgumentTypeTest(kDouble, kLong));
-}
-
-TEST_F(AggregationHandleCountTest, GroupByTableMergeTestCount) {
-  const Type &long_non_null_type = LongType::Instance(false);
-  initializeHandle(&long_non_null_type);
-  storage_manager_.reset(new StorageManager("./test_count_data"));
-  std::unique_ptr<AggregationStateHashTableBase> source_hash_table(
-      AggregationStateFastHashTableFactory::CreateResizable(
-          HashTableImplType::kSeparateChaining,
-          std::vector<const Type *>(1, &long_non_null_type),
-          10,
-          {aggregation_handle_count_.get()->getPayloadSize()},
-          {aggregation_handle_count_.get()},
-          storage_manager_.get()));
-  std::unique_ptr<AggregationStateHashTableBase> destination_hash_table(
-      AggregationStateFastHashTableFactory::CreateResizable(
-          HashTableImplType::kSeparateChaining,
-          std::vector<const Type *>(1, &long_non_null_type),
-          10,
-          {aggregation_handle_count_.get()->getPayloadSize()},
-          {aggregation_handle_count_.get()},
-          storage_manager_.get()));
-
-  AggregationStateFastHashTable *destination_hash_table_derived =
-      static_cast<AggregationStateFastHashTable *>(
-          destination_hash_table.get());
-
-  AggregationStateFastHashTable *source_hash_table_derived =
-      static_cast<AggregationStateFastHashTable *>(source_hash_table.get());
-
-  // TODO(harshad) - Use TemplateUtil::CreateBoolInstantiatedInstance to
-  // generate all the combinations of the bool template arguments and test them.
-  AggregationHandleCount<true, false> *aggregation_handle_count_derived =
-      static_cast<AggregationHandleCount<true, false> *>(
-          aggregation_handle_count_.get());
-  // We create three keys: first is present in both the hash tables, second key
-  // is present only in the source hash table while the third key is present
-  // the destination hash table only.
-  std::vector<TypedValue> common_key;
-  common_key.emplace_back(static_cast<std::int64_t>(0));
-  std::vector<TypedValue> exclusive_source_key, exclusive_destination_key;
-  exclusive_source_key.emplace_back(static_cast<std::int64_t>(1));
-  exclusive_destination_key.emplace_back(static_cast<std::int64_t>(2));
-
-  const std::int64_t common_key_source_count = 1;
-  TypedValue common_key_source_count_val(common_key_source_count);
-
-  const std::int64_t common_key_destination_count = 1;
-  TypedValue common_key_destination_count_val(common_key_destination_count);
-
-  const std::int64_t exclusive_key_source_count = 1;
-  TypedValue exclusive_key_source_count_val(exclusive_key_source_count);
-
-  const std::int64_t exclusive_key_destination_count = 1;
-  TypedValue exclusive_key_destination_count_val(
-      exclusive_key_destination_count);
-
-  std::unique_ptr<AggregationStateCount> common_key_source_state(
-      static_cast<AggregationStateCount *>(
-          aggregation_handle_count_->createInitialState()));
-  std::unique_ptr<AggregationStateCount> common_key_destination_state(
-      static_cast<AggregationStateCount *>(
-          aggregation_handle_count_->createInitialState()));
-  std::unique_ptr<AggregationStateCount> exclusive_key_source_state(
-      static_cast<AggregationStateCount *>(
-          aggregation_handle_count_->createInitialState()));
-  std::unique_ptr<AggregationStateCount> exclusive_key_destination_state(
-      static_cast<AggregationStateCount *>(
-          aggregation_handle_count_->createInitialState()));
-
-  // Create count value states for keys.
-  aggregation_handle_count_derived->iterateUnaryInl(
-      common_key_source_state.get(), common_key_source_count_val);
-  std::int64_t actual_val =
-      aggregation_handle_count_->finalize(*common_key_source_state)
-          .getLiteral<std::int64_t>();
-  EXPECT_EQ(common_key_source_count_val.getLiteral<std::int64_t>(), actual_val);
-
-  aggregation_handle_count_derived->iterateUnaryInl(
-      common_key_destination_state.get(), common_key_destination_count_val);
-  actual_val =
-      aggregation_handle_count_->finalize(*common_key_destination_state)
-          .getLiteral<std::int64_t>();
-  EXPECT_EQ(common_key_destination_count_val.getLiteral<std::int64_t>(),
-            actual_val);
-
-  aggregation_handle_count_derived->iterateUnaryInl(
-      exclusive_key_destination_state.get(),
-      exclusive_key_destination_count_val);
-  actual_val =
-      aggregation_handle_count_->finalize(*exclusive_key_destination_state)
-          .getLiteral<std::int64_t>();
-  EXPECT_EQ(exclusive_key_destination_count_val.getLiteral<std::int64_t>(),
-            actual_val);
-
-  aggregation_handle_count_derived->iterateUnaryInl(
-      exclusive_key_source_state.get(), exclusive_key_source_count_val);
-  actual_val = aggregation_handle_count_->finalize(*exclusive_key_source_state)
-                   .getLiteral<std::int64_t>();
-  EXPECT_EQ(exclusive_key_source_count_val.getLiteral<std::int64_t>(),
-            actual_val);
-
-  // Add the key-state pairs to the hash tables.
-  unsigned char buffer[100];
-  buffer[0] = '\0';
-  memcpy(buffer + 1,
-         common_key_source_state.get()->getPayloadAddress(),
-         aggregation_handle_count_.get()->getPayloadSize());
-  source_hash_table_derived->putCompositeKey(common_key, buffer);
-
-  memcpy(buffer + 1,
-         common_key_destination_state.get()->getPayloadAddress(),
-         aggregation_handle_count_.get()->getPayloadSize());
-  destination_hash_table_derived->putCompositeKey(common_key, buffer);
-
-  memcpy(buffer + 1,
-         exclusive_key_source_state.get()->getPayloadAddress(),
-         aggregation_handle_count_.get()->getPayloadSize());
-  source_hash_table_derived->putCompositeKey(exclusive_source_key, buffer);
-
-  memcpy(buffer + 1,
-         exclusive_key_destination_state.get()->getPayloadAddress(),
-         aggregation_handle_count_.get()->getPayloadSize());
-  destination_hash_table_derived->putCompositeKey(exclusive_destination_key,
-                                                      buffer);
-
-  EXPECT_EQ(2u, destination_hash_table_derived->numEntries());
-  EXPECT_EQ(2u, source_hash_table_derived->numEntries());
-
-  AggregationOperationState::mergeGroupByHashTables(
-      source_hash_table.get(), destination_hash_table.get());
-
-  EXPECT_EQ(3u, destination_hash_table_derived->numEntries());
-
-  CheckCountValue(
-      common_key_destination_count_val.getLiteral<std::int64_t>() +
-          common_key_source_count_val.getLiteral<std::int64_t>(),
-      aggregation_handle_count_derived->finalizeHashTableEntryFast(
-          destination_hash_table_derived->getSingleCompositeKey(common_key) +
-          1));
-  CheckCountValue(
-      exclusive_key_destination_count_val.getLiteral<std::int64_t>(),
-      aggregation_handle_count_derived->finalizeHashTableEntryFast(
-          destination_hash_table_derived->getSingleCompositeKey(
-              exclusive_destination_key) +
-          1));
-  CheckCountValue(exclusive_key_source_count_val.getLiteral<std::int64_t>(),
-                  aggregation_handle_count_derived->finalizeHashTableEntryFast(
-                      source_hash_table_derived->getSingleCompositeKey(
-                          exclusive_source_key) +
-                      1));
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/aggregation/tests/AggregationHandleMax_unittest.cpp
----------------------------------------------------------------------
diff --git a/expressions/aggregation/tests/AggregationHandleMax_unittest.cpp b/expressions/aggregation/tests/AggregationHandleMax_unittest.cpp
deleted file mode 100644
index 026bd1d..0000000
--- a/expressions/aggregation/tests/AggregationHandleMax_unittest.cpp
+++ /dev/null
@@ -1,826 +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 <cstddef>
-#include <cstdint>
-#include <cstring>
-#include <memory>
-#include <sstream>
-#include <string>
-#include <vector>
-
-#include "catalog/CatalogTypedefs.hpp"
-#include "expressions/aggregation/AggregateFunction.hpp"
-#include "expressions/aggregation/AggregateFunctionFactory.hpp"
-#include "expressions/aggregation/AggregationHandle.hpp"
-#include "expressions/aggregation/AggregationHandleMax.hpp"
-#include "expressions/aggregation/AggregationID.hpp"
-#include "storage/AggregationOperationState.hpp"
-#include "storage/FastHashTableFactory.hpp"
-#include "storage/HashTableBase.hpp"
-#include "storage/StorageManager.hpp"
-#include "types/CharType.hpp"
-#include "types/DatetimeIntervalType.hpp"
-#include "types/DatetimeLit.hpp"
-#include "types/DatetimeType.hpp"
-#include "types/DoubleType.hpp"
-#include "types/FloatType.hpp"
-#include "types/IntType.hpp"
-#include "types/IntervalLit.hpp"
-#include "types/LongType.hpp"
-#include "types/Type.hpp"
-#include "types/TypeFactory.hpp"
-#include "types/TypeID.hpp"
-#include "types/TypedValue.hpp"
-#include "types/VarCharType.hpp"
-#include "types/YearMonthIntervalType.hpp"
-#include "types/containers/ColumnVector.hpp"
-
-#ifdef QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_SELECTION
-#include "types/containers/ColumnVectorsValueAccessor.hpp"
-#endif
-
-#include "types/operations/comparisons/Comparison.hpp"
-#include "types/operations/comparisons/ComparisonFactory.hpp"
-#include "types/operations/comparisons/ComparisonID.hpp"
-
-#include "gtest/gtest.h"
-
-namespace quickstep {
-
-class AggregationHandleMaxTest : public ::testing::Test {
- protected:
-  static const int kNumSamples = 200;
-  static const int kIterations = 5;
-
-  // Helper method that calls AggregationHandleMax::iterateUnaryInl() to
-  // aggregate 'value' into '*state'.
-  void iterateHandle(AggregationState *state, const TypedValue &value) {
-    static_cast<const AggregationHandleMax &>(*aggregation_handle_max_)
-        .iterateUnaryInl(static_cast<AggregationStateMax *>(state), value);
-  }
-
-  void initializeHandle(const Type &type) {
-    aggregation_handle_max_.reset(
-        AggregateFunctionFactory::Get(AggregationID::kMax)
-            .createHandle(std::vector<const Type *>(1, &type)));
-    aggregation_handle_max_state_.reset(
-        aggregation_handle_max_->createInitialState());
-  }
-
-  static bool ApplyToTypesTest(TypeID typeID) {
-    const Type &type =
-        (typeID == kChar || typeID == kVarChar)
-            ? TypeFactory::GetType(typeID, static_cast<std::size_t>(10))
-            : TypeFactory::GetType(typeID);
-
-    return AggregateFunctionFactory::Get(AggregationID::kMax)
-        .canApplyToTypes(std::vector<const Type *>(1, &type));
-  }
-
-  static bool ResultTypeForArgumentTypeTest(TypeID input_type_id,
-                                            TypeID output_type_id) {
-    const Type *result_type =
-        AggregateFunctionFactory::Get(AggregationID::kMax)
-            .resultTypeForArgumentTypes(std::vector<const Type *>(
-                1, &TypeFactory::GetType(input_type_id)));
-    return (result_type->getTypeID() == output_type_id);
-  }
-
-  template <typename CppType>
-  static void CheckMaxValue(CppType expected,
-                            const AggregationHandle &handle,
-                            const AggregationState &state) {
-    EXPECT_EQ(expected, handle.finalize(state).getLiteral<CppType>());
-  }
-
-  template <typename CppType>
-  static void CheckMaxValue(CppType expected, const TypedValue &value) {
-    EXPECT_EQ(expected, value.getLiteral<CppType>());
-  }
-
-  static void CheckMaxString(const std::string &expected,
-                             const AggregationHandle &handle,
-                             const AggregationState &state) {
-    TypedValue value = handle.finalize(state);
-
-    ASSERT_EQ(expected.length(), value.getAsciiStringLength());
-    EXPECT_EQ(0,
-              std::strncmp(expected.c_str(),
-                           static_cast<const char *>(value.getDataPtr()),
-                           value.getAsciiStringLength()));
-  }
-
-  // Static templated method to initialize data types.
-  template <typename CppType>
-  void SetDataType(int value, CppType *data) {
-    *data = value;
-  }
-
-  template <typename GenericType>
-  void checkAggregationMaxGeneric() {
-    const GenericType &type = GenericType::Instance(true);
-    initializeHandle(type);
-    EXPECT_TRUE(
-        aggregation_handle_max_->finalize(*aggregation_handle_max_state_)
-            .isNull());
-
-    typename GenericType::cpptype val;
-    typename GenericType::cpptype max;
-    SetDataType(0, &max);
-
-    iterateHandle(aggregation_handle_max_state_.get(), type.makeNullValue());
-    for (int i = 0; i < kIterations; ++i) {
-      for (int j = 0; j < kNumSamples; ++j) {
-        if (type.getTypeID() == kInt || type.getTypeID() == kLong) {
-          SetDataType(i * kNumSamples + j - 10, &val);
-        } else {
-          SetDataType(static_cast<float>(i * kNumSamples + j - 10) / 10, &val);
-        }
-        iterateHandle(aggregation_handle_max_state_.get(),
-                      type.makeValue(&val));
-        if (max < val) {
-          max = val;
-        }
-      }
-    }
-    iterateHandle(aggregation_handle_max_state_.get(), type.makeNullValue());
-    CheckMaxValue<typename GenericType::cpptype>(
-        max, *aggregation_handle_max_, *aggregation_handle_max_state_);
-
-    // Test mergeStates().
-    std::unique_ptr<AggregationState> merge_state(
-        aggregation_handle_max_->createInitialState());
-    aggregation_handle_max_->mergeStates(*merge_state,
-                                         aggregation_handle_max_state_.get());
-
-    iterateHandle(merge_state.get(), type.makeNullValue());
-    for (int i = 0; i < kIterations; ++i) {
-      for (int j = kNumSamples - 1; j >= 0; --j) {
-        if (type.getTypeID() == kInt || type.getTypeID() == kLong) {
-          SetDataType(i * kNumSamples + j - 20, &val);
-        } else {
-          SetDataType(static_cast<float>(i * kNumSamples + j - 20) / 10, &val);
-        }
-        iterateHandle(merge_state.get(), type.makeValue(&val));
-        if (max < val) {
-          max = val;
-        }
-      }
-    }
-    aggregation_handle_max_->mergeStates(*merge_state,
-                                         aggregation_handle_max_state_.get());
-    CheckMaxValue<typename GenericType::cpptype>(
-        max, *aggregation_handle_max_, *aggregation_handle_max_state_);
-  }
-
-  template <typename GenericType>
-  ColumnVector* createColumnVectorGeneric(const Type &type,
-                                          typename GenericType::cpptype *max) {
-    NativeColumnVector *column =
-        new NativeColumnVector(type, kIterations * kNumSamples + 3);
-
-    typename GenericType::cpptype val;
-    SetDataType(0, max);
-
-    column->appendTypedValue(type.makeNullValue());
-    for (int i = 0; i < kIterations; ++i) {
-      for (int j = 0; j < kNumSamples; ++j) {
-        if (type.getTypeID() == kInt || type.getTypeID() == kLong) {
-          SetDataType(i * kNumSamples + j - 10, &val);
-        } else {
-          SetDataType(static_cast<float>(i * kNumSamples + j - 10) / 10, &val);
-        }
-        column->appendTypedValue(type.makeValue(&val));
-        if (*max < val) {
-          *max = val;
-        }
-      }
-      // One NULL in the middle.
-      if (i == kIterations / 2) {
-        column->appendTypedValue(type.makeNullValue());
-      }
-    }
-    column->appendTypedValue(type.makeNullValue());
-
-    return column;
-  }
-
-  template <typename GenericType>
-  void checkAggregationMaxGenericColumnVector() {
-    const GenericType &type = GenericType::Instance(true);
-    initializeHandle(type);
-    EXPECT_TRUE(
-        aggregation_handle_max_->finalize(*aggregation_handle_max_state_)
-            .isNull());
-
-    typename GenericType::cpptype max;
-    std::vector<std::unique_ptr<ColumnVector>> column_vectors;
-    column_vectors.emplace_back(
-        createColumnVectorGeneric<GenericType>(type, &max));
-
-    std::unique_ptr<AggregationState> cv_state(
-        aggregation_handle_max_->accumulateColumnVectors(column_vectors));
-
-    // Test the state generated directly by accumulateColumnVectors(), and also
-    // test after merging back.
-    CheckMaxValue<typename GenericType::cpptype>(
-        max, *aggregation_handle_max_, *cv_state);
-
-    aggregation_handle_max_->mergeStates(*cv_state,
-                                         aggregation_handle_max_state_.get());
-    CheckMaxValue<typename GenericType::cpptype>(
-        max, *aggregation_handle_max_, *aggregation_handle_max_state_);
-  }
-
-#ifdef QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_SELECTION
-  template <typename GenericType>
-  void checkAggregationMaxGenericValueAccessor() {
-    const GenericType &type = GenericType::Instance(true);
-    initializeHandle(type);
-    EXPECT_TRUE(
-        aggregation_handle_max_->finalize(*aggregation_handle_max_state_)
-            .isNull());
-
-    std::unique_ptr<ColumnVectorsValueAccessor> accessor(
-        new ColumnVectorsValueAccessor());
-
-    typename GenericType::cpptype max;
-    accessor->addColumn(createColumnVectorGeneric<GenericType>(type, &max));
-
-    std::unique_ptr<AggregationState> va_state(
-        aggregation_handle_max_->accumulateValueAccessor(
-            accessor.get(), std::vector<attribute_id>(1, 0)));
-
-    // Test the state generated directly by accumulateValueAccessor(), and also
-    // test after merging back.
-    CheckMaxValue<typename GenericType::cpptype>(
-        max, *aggregation_handle_max_, *va_state);
-
-    aggregation_handle_max_->mergeStates(*va_state,
-                                         aggregation_handle_max_state_.get());
-    CheckMaxValue<typename GenericType::cpptype>(
-        max, *aggregation_handle_max_, *aggregation_handle_max_state_);
-  }
-#endif  // QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_SELECTION
-
-  template <typename StringType>
-  void checkAggregationMaxString() {
-    const StringType &type = StringType::Instance(10, true);
-    initializeHandle(type);
-    EXPECT_TRUE(
-        aggregation_handle_max_->finalize(*aggregation_handle_max_state_)
-            .isNull());
-
-    std::unique_ptr<UncheckedComparator> fast_comparator_;
-    fast_comparator_.reset(
-        ComparisonFactory::GetComparison(ComparisonID::kGreater)
-            .makeUncheckedComparatorForTypes(type, type));
-    std::string string_literal;
-    std::string max = "";
-    int val;
-    iterateHandle(aggregation_handle_max_state_.get(), type.makeNullValue());
-    for (int i = 0; i < kIterations; ++i) {
-      for (int j = 0; j < kNumSamples; ++j) {
-        val = i * kNumSamples + j;
-        std::ostringstream oss;
-        oss << "max" << val;
-        string_literal = oss.str();
-
-        iterateHandle(
-            aggregation_handle_max_state_.get(),
-            type.makeValue(string_literal.c_str(), string_literal.length() + 1)
-                .ensureNotReference());
-        if (fast_comparator_->compareDataPtrs(string_literal.c_str(),
-                                              max.c_str())) {
-          max = string_literal;
-        }
-      }
-    }
-    iterateHandle(aggregation_handle_max_state_.get(), type.makeNullValue());
-    CheckMaxString(
-        max, *aggregation_handle_max_, *aggregation_handle_max_state_);
-
-    // Test mergeStates().
-    std::unique_ptr<AggregationState> merge_state(
-        aggregation_handle_max_->createInitialState());
-    aggregation_handle_max_->mergeStates(*merge_state,
-                                         aggregation_handle_max_state_.get());
-
-    iterateHandle(merge_state.get(), type.makeNullValue());
-    for (int i = 0; i < kIterations; ++i) {
-      for (int j = kNumSamples - 1; j >= 0; --j) {
-        val = i * kNumSamples + j;
-        std::ostringstream oss;
-        oss << "test" << val;
-        string_literal = oss.str();
-
-        iterateHandle(
-            merge_state.get(),
-            type.makeValue(string_literal.c_str(), string_literal.length() + 1)
-                .ensureNotReference());
-        if (fast_comparator_->compareDataPtrs(string_literal.c_str(),
-                                              max.c_str())) {
-          max = string_literal;
-        }
-      }
-    }
-    aggregation_handle_max_->mergeStates(*merge_state,
-                                         aggregation_handle_max_state_.get());
-    CheckMaxString(
-        max, *aggregation_handle_max_, *aggregation_handle_max_state_);
-  }
-
-  template <typename ColumnVectorType>
-  ColumnVector* createColumnVectorString(const Type &type, std::string *max) {
-    ColumnVectorType *column =
-        new ColumnVectorType(type, kIterations * kNumSamples + 3);
-    std::unique_ptr<UncheckedComparator> fast_comparator_;
-    fast_comparator_.reset(
-        ComparisonFactory::GetComparison(ComparisonID::kGreater)
-            .makeUncheckedComparatorForTypes(type, type));
-    std::string string_literal;
-    *max = "";
-    int val;
-    column->appendTypedValue(type.makeNullValue());
-    for (int i = 0; i < kIterations; ++i) {
-      for (int j = 0; j < kNumSamples; ++j) {
-        val = i * kNumSamples + j;
-        std::ostringstream oss;
-        oss << "max" << val;
-        string_literal = oss.str();
-
-        column->appendTypedValue(
-            type.makeValue(string_literal.c_str(), string_literal.length() + 1)
-                .ensureNotReference());
-        if (fast_comparator_->compareDataPtrs(string_literal.c_str(),
-                                              max->c_str())) {
-          *max = string_literal;
-        }
-      }
-      // One NULL in the middle.
-      if (i == kIterations / 2) {
-        column->appendTypedValue(type.makeNullValue());
-      }
-    }
-    column->appendTypedValue(type.makeNullValue());
-
-    return column;
-  }
-
-  template <typename StringType, typename ColumnVectorType>
-  void checkAggregationMaxStringColumnVector() {
-    const StringType &type = StringType::Instance(10, true);
-    initializeHandle(type);
-    EXPECT_TRUE(
-        aggregation_handle_max_->finalize(*aggregation_handle_max_state_)
-            .isNull());
-
-    std::string max;
-    std::vector<std::unique_ptr<ColumnVector>> column_vectors;
-    column_vectors.emplace_back(
-        createColumnVectorString<ColumnVectorType>(type, &max));
-
-    std::unique_ptr<AggregationState> cv_state(
-        aggregation_handle_max_->accumulateColumnVectors(column_vectors));
-
-    // Test the state generated directly by accumulateColumnVectors(), and also
-    // test after merging back.
-    CheckMaxString(max, *aggregation_handle_max_, *cv_state);
-
-    aggregation_handle_max_->mergeStates(*cv_state,
-                                         aggregation_handle_max_state_.get());
-    CheckMaxString(
-        max, *aggregation_handle_max_, *aggregation_handle_max_state_);
-  }
-
-#ifdef QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_SELECTION
-  template <typename StringType, typename ColumnVectorType>
-  void checkAggregationMaxStringValueAccessor() {
-    const StringType &type = StringType::Instance(10, true);
-    initializeHandle(type);
-    EXPECT_TRUE(
-        aggregation_handle_max_->finalize(*aggregation_handle_max_state_)
-            .isNull());
-
-    std::string max;
-    std::unique_ptr<ColumnVectorsValueAccessor> accessor(
-        new ColumnVectorsValueAccessor());
-    accessor->addColumn(createColumnVectorString<ColumnVectorType>(type, &max));
-
-    std::unique_ptr<AggregationState> va_state(
-        aggregation_handle_max_->accumulateValueAccessor(
-            accessor.get(), std::vector<attribute_id>(1, 0)));
-
-    // Test the state generated directly by accumulateValueAccessor(), and also
-    // test after merging back.
-    CheckMaxString(max, *aggregation_handle_max_, *va_state);
-
-    aggregation_handle_max_->mergeStates(*va_state,
-                                         aggregation_handle_max_state_.get());
-    CheckMaxString(
-        max, *aggregation_handle_max_, *aggregation_handle_max_state_);
-  }
-#endif  // QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_SELECTION
-
-  std::unique_ptr<AggregationHandle> aggregation_handle_max_;
-  std::unique_ptr<AggregationState> aggregation_handle_max_state_;
-  std::unique_ptr<StorageManager> storage_manager_;
-};
-
-template <>
-void AggregationHandleMaxTest::CheckMaxValue<float>(
-    float val, const AggregationHandle &handle, const AggregationState &state) {
-  EXPECT_FLOAT_EQ(val, handle.finalize(state).getLiteral<float>());
-}
-
-template <>
-void AggregationHandleMaxTest::CheckMaxValue<double>(
-    double val,
-    const AggregationHandle &handle,
-    const AggregationState &state) {
-  EXPECT_DOUBLE_EQ(val, handle.finalize(state).getLiteral<double>());
-}
-
-template <>
-void AggregationHandleMaxTest::SetDataType<DatetimeLit>(int value,
-                                                        DatetimeLit *data) {
-  data->ticks = value;
-}
-
-template <>
-void AggregationHandleMaxTest::SetDataType<DatetimeIntervalLit>(
-    int value, DatetimeIntervalLit *data) {
-  data->interval_ticks = value;
-}
-
-template <>
-void AggregationHandleMaxTest::SetDataType<YearMonthIntervalLit>(
-    int value, YearMonthIntervalLit *data) {
-  data->months = value;
-}
-
-typedef AggregationHandleMaxTest AggregationHandleMaxDeathTest;
-
-TEST_F(AggregationHandleMaxTest, IntTypeTest) {
-  checkAggregationMaxGeneric<IntType>();
-}
-
-TEST_F(AggregationHandleMaxTest, LongTypeTest) {
-  checkAggregationMaxGeneric<LongType>();
-}
-
-TEST_F(AggregationHandleMaxTest, FloatTypeTest) {
-  checkAggregationMaxGeneric<FloatType>();
-}
-
-TEST_F(AggregationHandleMaxTest, DoubleTypeTest) {
-  checkAggregationMaxGeneric<DoubleType>();
-}
-
-TEST_F(AggregationHandleMaxTest, DatetimeType) {
-  checkAggregationMaxGeneric<DatetimeType>();
-}
-
-TEST_F(AggregationHandleMaxTest, DatetimeIntervalType) {
-  checkAggregationMaxGeneric<DatetimeIntervalType>();
-}
-
-TEST_F(AggregationHandleMaxTest, YearMonthIntervalType) {
-  checkAggregationMaxGeneric<YearMonthIntervalType>();
-}
-
-TEST_F(AggregationHandleMaxTest, CharTypeTest) {
-  checkAggregationMaxString<CharType>();
-}
-
-TEST_F(AggregationHandleMaxTest, VarCharTypeTest) {
-  checkAggregationMaxString<VarCharType>();
-}
-
-TEST_F(AggregationHandleMaxTest, IntTypeColumnVectorTest) {
-  checkAggregationMaxGenericColumnVector<IntType>();
-}
-
-TEST_F(AggregationHandleMaxTest, LongTypeColumnVectorTest) {
-  checkAggregationMaxGenericColumnVector<LongType>();
-}
-
-TEST_F(AggregationHandleMaxTest, FloatTypeColumnVectorTest) {
-  checkAggregationMaxGenericColumnVector<FloatType>();
-}
-
-TEST_F(AggregationHandleMaxTest, DoubleTypeColumnVectorTest) {
-  checkAggregationMaxGenericColumnVector<DoubleType>();
-}
-
-TEST_F(AggregationHandleMaxTest, DatetimeTypeColumnVectorTest) {
-  checkAggregationMaxGenericColumnVector<DatetimeType>();
-}
-
-TEST_F(AggregationHandleMaxTest, DatetimeIntervalTypeColumnVectorTest) {
-  checkAggregationMaxGenericColumnVector<DatetimeIntervalType>();
-}
-
-TEST_F(AggregationHandleMaxTest, YearMonthIntervalTypeColumnVectorTest) {
-  checkAggregationMaxGenericColumnVector<YearMonthIntervalType>();
-}
-
-TEST_F(AggregationHandleMaxTest, CharTypeColumnVectorTest) {
-  checkAggregationMaxStringColumnVector<CharType, NativeColumnVector>();
-}
-
-TEST_F(AggregationHandleMaxTest, VarCharColumnVectorTypeTest) {
-  checkAggregationMaxStringColumnVector<VarCharType, IndirectColumnVector>();
-}
-
-#ifdef QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_SELECTION
-TEST_F(AggregationHandleMaxTest, IntTypeValueAccessorTest) {
-  checkAggregationMaxGenericValueAccessor<IntType>();
-}
-
-TEST_F(AggregationHandleMaxTest, LongTypeValueAccessorTest) {
-  checkAggregationMaxGenericValueAccessor<LongType>();
-}
-
-TEST_F(AggregationHandleMaxTest, FloatTypeValueAccessorTest) {
-  checkAggregationMaxGenericValueAccessor<FloatType>();
-}
-
-TEST_F(AggregationHandleMaxTest, DoubleTypeValueAccessorTest) {
-  checkAggregationMaxGenericValueAccessor<DoubleType>();
-}
-
-TEST_F(AggregationHandleMaxTest, DatetimeTypeValueAccessorTest) {
-  checkAggregationMaxGenericValueAccessor<DatetimeType>();
-}
-
-TEST_F(AggregationHandleMaxTest, DatetimeIntervalTypeValueAccessorTest) {
-  checkAggregationMaxGenericValueAccessor<DatetimeIntervalType>();
-}
-
-TEST_F(AggregationHandleMaxTest, YearMonthIntervalTypeValueAccessorTest) {
-  checkAggregationMaxGenericValueAccessor<YearMonthIntervalType>();
-}
-
-TEST_F(AggregationHandleMaxTest, CharTypeValueAccessorTest) {
-  checkAggregationMaxStringValueAccessor<CharType, NativeColumnVector>();
-}
-
-TEST_F(AggregationHandleMaxTest, VarCharValueAccessorTypeTest) {
-  checkAggregationMaxStringValueAccessor<VarCharType, IndirectColumnVector>();
-}
-#endif  // QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_SELECTION
-
-#ifdef QUICKSTEP_DEBUG
-TEST_F(AggregationHandleMaxDeathTest, WrongTypeTest) {
-  const Type &int_non_null_type = IntType::Instance(false);
-  const Type &long_type = LongType::Instance(true);
-  const Type &double_type = DoubleType::Instance(true);
-  const Type &float_type = FloatType::Instance(true);
-  const Type &char_type = CharType::Instance(true, 10);
-  const Type &varchar_type = VarCharType::Instance(true, 10);
-
-  initializeHandle(IntType::Instance(true));
-  int int_val = 0;
-  std::int64_t long_val = 0;
-  double double_val = 0;
-  float float_val = 0;
-
-  // Passes.
-  iterateHandle(aggregation_handle_max_state_.get(),
-                int_non_null_type.makeValue(&int_val));
-
-  EXPECT_DEATH(iterateHandle(aggregation_handle_max_state_.get(),
-                             long_type.makeValue(&long_val)),
-               "");
-  EXPECT_DEATH(iterateHandle(aggregation_handle_max_state_.get(),
-                             double_type.makeValue(&double_val)),
-               "");
-  EXPECT_DEATH(iterateHandle(aggregation_handle_max_state_.get(),
-                             float_type.makeValue(&float_val)),
-               "");
-  EXPECT_DEATH(iterateHandle(aggregation_handle_max_state_.get(),
-                             char_type.makeValue("asdf", 5)),
-               "");
-  EXPECT_DEATH(iterateHandle(aggregation_handle_max_state_.get(),
-                             varchar_type.makeValue("asdf", 5)),
-               "");
-
-  // Test mergeStates() with incorrectly typed handles.
-  std::unique_ptr<AggregationHandle> aggregation_handle_max_long(
-      AggregateFunctionFactory::Get(AggregationID::kMax)
-          .createHandle(std::vector<const Type *>(1, &long_type)));
-  std::unique_ptr<AggregationState> aggregation_state_max_merge_long(
-      aggregation_handle_max_long->createInitialState());
-  static_cast<const AggregationHandleMax &>(*aggregation_handle_max_long)
-      .iterateUnaryInl(static_cast<AggregationStateMax *>(
-                           aggregation_state_max_merge_long.get()),
-                       long_type.makeValue(&long_val));
-  EXPECT_DEATH(
-      aggregation_handle_max_->mergeStates(*aggregation_state_max_merge_long,
-                                           aggregation_handle_max_state_.get()),
-      "");
-
-  std::unique_ptr<AggregationHandle> aggregation_handle_max_double(
-      AggregateFunctionFactory::Get(AggregationID::kMax)
-          .createHandle(std::vector<const Type *>(1, &double_type)));
-  std::unique_ptr<AggregationState> aggregation_state_max_merge_double(
-      aggregation_handle_max_double->createInitialState());
-  static_cast<const AggregationHandleMax &>(*aggregation_handle_max_double)
-      .iterateUnaryInl(static_cast<AggregationStateMax *>(
-                           aggregation_state_max_merge_double.get()),
-                       double_type.makeValue(&double_val));
-  EXPECT_DEATH(
-      aggregation_handle_max_->mergeStates(*aggregation_state_max_merge_double,
-                                           aggregation_handle_max_state_.get()),
-      "");
-
-  std::unique_ptr<AggregationHandle> aggregation_handle_max_float(
-      AggregateFunctionFactory::Get(AggregationID::kMax)
-          .createHandle(std::vector<const Type *>(1, &float_type)));
-  std::unique_ptr<AggregationState> aggregation_state_max_merge_float(
-      aggregation_handle_max_float->createInitialState());
-  static_cast<const AggregationHandleMax &>(*aggregation_handle_max_float)
-      .iterateUnaryInl(static_cast<AggregationStateMax *>(
-                           aggregation_state_max_merge_float.get()),
-                       float_type.makeValue(&float_val));
-  EXPECT_DEATH(
-      aggregation_handle_max_->mergeStates(*aggregation_state_max_merge_float,
-                                           aggregation_handle_max_state_.get()),
-      "");
-}
-#endif
-
-TEST_F(AggregationHandleMaxTest, canApplyToTypeTest) {
-  EXPECT_TRUE(ApplyToTypesTest(kInt));
-  EXPECT_TRUE(ApplyToTypesTest(kLong));
-  EXPECT_TRUE(ApplyToTypesTest(kFloat));
-  EXPECT_TRUE(ApplyToTypesTest(kDouble));
-  EXPECT_TRUE(ApplyToTypesTest(kChar));
-  EXPECT_TRUE(ApplyToTypesTest(kVarChar));
-}
-
-TEST_F(AggregationHandleMaxTest, ResultTypeForArgumentTypeTest) {
-  EXPECT_TRUE(ResultTypeForArgumentTypeTest(kInt, kInt));
-  EXPECT_TRUE(ResultTypeForArgumentTypeTest(kLong, kLong));
-  EXPECT_TRUE(ResultTypeForArgumentTypeTest(kFloat, kFloat));
-  EXPECT_TRUE(ResultTypeForArgumentTypeTest(kDouble, kDouble));
-}
-
-TEST_F(AggregationHandleMaxTest, GroupByTableMergeTest) {
-  const Type &int_non_null_type = IntType::Instance(false);
-  initializeHandle(int_non_null_type);
-  storage_manager_.reset(new StorageManager("./test_max_data"));
-  std::unique_ptr<AggregationStateHashTableBase> source_hash_table(
-      AggregationStateFastHashTableFactory::CreateResizable(
-          HashTableImplType::kSeparateChaining,
-          std::vector<const Type *>(1, &int_non_null_type),
-          10,
-          {aggregation_handle_max_.get()->getPayloadSize()},
-          {aggregation_handle_max_.get()},
-          storage_manager_.get()));
-  std::unique_ptr<AggregationStateHashTableBase> destination_hash_table(
-      AggregationStateFastHashTableFactory::CreateResizable(
-          HashTableImplType::kSeparateChaining,
-          std::vector<const Type *>(1, &int_non_null_type),
-          10,
-          {aggregation_handle_max_.get()->getPayloadSize()},
-          {aggregation_handle_max_.get()},
-          storage_manager_.get()));
-
-  AggregationStateFastHashTable *destination_hash_table_derived =
-      static_cast<AggregationStateFastHashTable *>(
-          destination_hash_table.get());
-
-  AggregationStateFastHashTable *source_hash_table_derived =
-      static_cast<AggregationStateFastHashTable *>(source_hash_table.get());
-
-  AggregationHandleMax *aggregation_handle_max_derived =
-      static_cast<AggregationHandleMax *>(aggregation_handle_max_.get());
-  // We create three keys: first is present in both the hash tables, second key
-  // is present only in the source hash table while the third key is present
-  // the destination hash table only.
-  std::vector<TypedValue> common_key;
-  common_key.emplace_back(0);
-  std::vector<TypedValue> exclusive_source_key, exclusive_destination_key;
-  exclusive_source_key.emplace_back(1);
-  exclusive_destination_key.emplace_back(2);
-
-  const int common_key_source_max = 3000;
-  TypedValue common_key_source_max_val(common_key_source_max);
-
-  const int common_key_destination_max = 4000;
-  TypedValue common_key_destination_max_val(common_key_destination_max);
-
-  const int exclusive_key_source_max = 100;
-  TypedValue exclusive_key_source_max_val(exclusive_key_source_max);
-
-  const int exclusive_key_destination_max = 200;
-  TypedValue exclusive_key_destination_max_val(exclusive_key_destination_max);
-
-  std::unique_ptr<AggregationStateMax> common_key_source_state(
-      static_cast<AggregationStateMax *>(
-          aggregation_handle_max_->createInitialState()));
-  std::unique_ptr<AggregationStateMax> common_key_destination_state(
-      static_cast<AggregationStateMax *>(
-          aggregation_handle_max_->createInitialState()));
-  std::unique_ptr<AggregationStateMax> exclusive_key_source_state(
-      static_cast<AggregationStateMax *>(
-          aggregation_handle_max_->createInitialState()));
-  std::unique_ptr<AggregationStateMax> exclusive_key_destination_state(
-      static_cast<AggregationStateMax *>(
-          aggregation_handle_max_->createInitialState()));
-
-  // Create max value states for keys.
-  aggregation_handle_max_derived->iterateUnaryInl(common_key_source_state.get(),
-                                                  common_key_source_max_val);
-  int actual_val = aggregation_handle_max_->finalize(*common_key_source_state)
-                       .getLiteral<int>();
-  EXPECT_EQ(common_key_source_max_val.getLiteral<int>(), actual_val);
-
-  aggregation_handle_max_derived->iterateUnaryInl(
-      common_key_destination_state.get(), common_key_destination_max_val);
-  actual_val = aggregation_handle_max_->finalize(*common_key_destination_state)
-                   .getLiteral<int>();
-  EXPECT_EQ(common_key_destination_max_val.getLiteral<int>(), actual_val);
-
-  aggregation_handle_max_derived->iterateUnaryInl(
-      exclusive_key_destination_state.get(), exclusive_key_destination_max_val);
-  actual_val =
-      aggregation_handle_max_->finalize(*exclusive_key_destination_state)
-          .getLiteral<int>();
-  EXPECT_EQ(exclusive_key_destination_max_val.getLiteral<int>(), actual_val);
-
-  aggregation_handle_max_derived->iterateUnaryInl(
-      exclusive_key_source_state.get(), exclusive_key_source_max_val);
-  actual_val = aggregation_handle_max_->finalize(*exclusive_key_source_state)
-                   .getLiteral<int>();
-  EXPECT_EQ(exclusive_key_source_max_val.getLiteral<int>(), actual_val);
-
-  // Add the key-state pairs to the hash tables.
-  unsigned char buffer[100];
-  buffer[0] = '\0';
-  memcpy(buffer + 1,
-         common_key_source_state.get()->getPayloadAddress(),
-         aggregation_handle_max_.get()->getPayloadSize());
-  source_hash_table_derived->putCompositeKey(common_key, buffer);
-
-  memcpy(buffer + 1,
-         common_key_destination_state.get()->getPayloadAddress(),
-         aggregation_handle_max_.get()->getPayloadSize());
-  destination_hash_table_derived->putCompositeKey(common_key, buffer);
-
-  memcpy(buffer + 1,
-         exclusive_key_source_state.get()->getPayloadAddress(),
-         aggregation_handle_max_.get()->getPayloadSize());
-  source_hash_table_derived->putCompositeKey(exclusive_source_key, buffer);
-
-  memcpy(buffer + 1,
-         exclusive_key_destination_state.get()->getPayloadAddress(),
-         aggregation_handle_max_.get()->getPayloadSize());
-  destination_hash_table_derived->putCompositeKey(exclusive_destination_key,
-                                                      buffer);
-
-  EXPECT_EQ(2u, destination_hash_table_derived->numEntries());
-  EXPECT_EQ(2u, source_hash_table_derived->numEntries());
-
-  AggregationOperationState::mergeGroupByHashTables(
-      source_hash_table.get(), destination_hash_table.get());
-
-  EXPECT_EQ(3u, destination_hash_table_derived->numEntries());
-
-  CheckMaxValue<int>(
-      common_key_destination_max_val.getLiteral<int>(),
-      aggregation_handle_max_derived->finalizeHashTableEntryFast(
-          destination_hash_table_derived->getSingleCompositeKey(common_key) +
-          1));
-  CheckMaxValue<int>(exclusive_key_destination_max_val.getLiteral<int>(),
-                     aggregation_handle_max_derived->finalizeHashTableEntryFast(
-                         destination_hash_table_derived->getSingleCompositeKey(
-                             exclusive_destination_key) +
-                         1));
-  CheckMaxValue<int>(exclusive_key_source_max_val.getLiteral<int>(),
-                     aggregation_handle_max_derived->finalizeHashTableEntryFast(
-                         source_hash_table_derived->getSingleCompositeKey(
-                             exclusive_source_key) +
-                         1));
-}
-
-}  // namespace quickstep


[15/51] [abbrv] [partial] incubator-quickstep git commit: remove c++ files

Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_execution/tests/WorkerSelectionPolicy_unittest.cpp
----------------------------------------------------------------------
diff --git a/query_execution/tests/WorkerSelectionPolicy_unittest.cpp b/query_execution/tests/WorkerSelectionPolicy_unittest.cpp
deleted file mode 100644
index 68de5e5..0000000
--- a/query_execution/tests/WorkerSelectionPolicy_unittest.cpp
+++ /dev/null
@@ -1,169 +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 <cstddef>
-#include <memory>
-#include <random>
-#include <utility>
-#include <vector>
-
-#include "gtest/gtest.h"
-
-#include "query_execution/QueryExecutionTypedefs.hpp"
-#include "query_execution/WorkerDirectory.hpp"
-#include "query_execution/WorkerSelectionPolicy.hpp"
-
-namespace quickstep {
-
-class WorkerSelectionPolicyTest : public ::testing::Test {
- protected:
-  WorkerDirectory* getWorkerDirectory() {
-    return directory_.get();
-  }
-
-  const std::size_t getRandomWorkerID() const {
-    std::uniform_int_distribution<std::size_t> dist(
-        0, directory_->getNumWorkers() - 1);
-    return dist(*mt_);
-  }
-
-  void SetUp() {
-    std::vector<int> numa_nodes;
-    std::vector<client_id> client_ids;
-
-    numa_nodes.reserve(kNumWorkers);
-    client_ids.reserve(kNumWorkers);
-
-    std::random_device rd;
-    mt_.reset(new std::mt19937_64(rd()));
-    for (std::size_t worker_thread_index = 0; worker_thread_index < kNumWorkers; ++worker_thread_index) {
-      // NUMA node id = worker_thread_index % 4
-      // Client ID = worker_thread_index * 2 + 1
-      numa_nodes.push_back(worker_thread_index % 4);
-      client_ids.push_back(worker_thread_index * 2 + 1);
-    }
-    directory_.reset(new WorkerDirectory(kNumWorkers, client_ids, numa_nodes));
-  }
-
- private:
-  static const std::size_t kNumWorkers = 100;
-  std::unique_ptr<std::mt19937_64> mt_;
-  std::unique_ptr<WorkerDirectory> directory_;
-};
-
-TEST_F(WorkerSelectionPolicyTest, RoundRobinTest) {
-  // Check if the round robin policy selects the next worker correctly.
-  const std::size_t kStartWorkerID = getRandomWorkerID();
-  RoundRobinWorkerSelectionPolicy rr_policy(*getWorkerDirectory(),
-                                            kStartWorkerID);
-
-  const std::size_t kNumIterations =
-      (getWorkerDirectory()->getNumWorkers()) * 2;
-  std::size_t expected_next_worker_thread_index = kStartWorkerID;
-  for (std::size_t iteration = 0; iteration < kNumIterations; ++iteration) {
-    EXPECT_EQ(expected_next_worker_thread_index, rr_policy.getNextWorkerID());
-    expected_next_worker_thread_index = (expected_next_worker_thread_index + 1) %
-                              (getWorkerDirectory()->getNumWorkers());
-  }
-}
-
-TEST_F(WorkerSelectionPolicyTest, RoundRobinAddWorkerTest) {
-  // Add a worker to the worker directory dynamically. Check if this worker
-  // gets selected by the Round Robin policy.
-  const std::size_t kStartWorkerID = getWorkerDirectory()->getNumWorkers() - 1;
-  RoundRobinWorkerSelectionPolicy rr_policy(*getWorkerDirectory(),
-                                            kStartWorkerID);
-
-  EXPECT_EQ(kStartWorkerID, rr_policy.getNextWorkerID());
-
-  // Add a new worker.
-  const std::size_t new_worker_thread_index = getWorkerDirectory()->getNumWorkers();
-  getWorkerDirectory()->addWorker(new_worker_thread_index * 2 + 1 /** client_id **/,
-                                  0 /** NUMA node ID **/);
-
-  EXPECT_EQ(new_worker_thread_index, rr_policy.getNextWorkerID());
-}
-
-TEST_F(WorkerSelectionPolicyTest, LoadBalancingTest) {
-  // Create a random set of worker load values (i.e. number of queued workorders)
-  const std::size_t kMaxLoad = 100;
-  std::vector<std::size_t> worker_loads;
-  worker_loads.reserve(getWorkerDirectory()->getNumWorkers());
-
-  std::random_device rd;
-  std::mt19937_64 mt(rd());
-  std::uniform_int_distribution<std::size_t> dist(0, kMaxLoad);
-
-  for (std::size_t worker_thread_index = 0;
-       worker_thread_index < getWorkerDirectory()->getNumWorkers();
-       ++worker_thread_index) {
-    // For each worker ..
-    const std::size_t worker_load = dist(mt);
-    // assign a random load.
-    worker_loads.push_back(worker_load);
-    for (std::size_t workorder_count = 0;
-         workorder_count < worker_load;
-         ++workorder_count) {
-      getWorkerDirectory()->incrementNumQueuedWorkOrders(worker_thread_index);
-    }
-  }
-
-  LoadBalancingWorkerSelectionPolicy lb_policy(*getWorkerDirectory());
-  // At this point, all the workers have been assigned a random amount of load.
-  // Keep decrementing one workorder from every worker and check if the policy
-  // correctly chooses the next worker.
-  std::size_t zero_load_counts = 0;
-  for (std::size_t worker_load_index = 0;
-       zero_load_counts < worker_loads.size();
-       worker_load_index = (worker_load_index + 1) % worker_loads.size()) {
-    EXPECT_EQ(getWorkerDirectory()->getLeastLoadedWorker().first,
-              lb_policy.getNextWorkerID());
-    if (worker_loads[worker_load_index] > 0) {
-      getWorkerDirectory()->decrementNumQueuedWorkOrders(worker_load_index);
-      --worker_loads[worker_load_index];
-    } else {
-      ++zero_load_counts;
-    }
-  }
-  EXPECT_EQ(getWorkerDirectory()->getLeastLoadedWorker().first,
-            lb_policy.getNextWorkerID());
-}
-
-TEST_F(WorkerSelectionPolicyTest, RandomWorkerPolicyTest) {
-  // Expect that the randomly chosen worker falls in the limits of worker IDs.
-  RandomWorkerSelectionPolicy rand_policy(*getWorkerDirectory());
-  const std::size_t kNumIterations = 100;
-
-  for (std::size_t iter = 0; iter < kNumIterations; ++iter) {
-    const std::size_t chosen_worker_thread_index = rand_policy.getNextWorkerID();
-    EXPECT_GE(getWorkerDirectory()->getNumWorkers(), chosen_worker_thread_index);
-  }
-
-  // Add a new worker and repeat the test above.
-  const std::size_t new_worker_thread_index = getWorkerDirectory()->getNumWorkers();
-  getWorkerDirectory()->addWorker(new_worker_thread_index * 2 + 1 /** client_id **/,
-                                  0 /** NUMA node ID **/);
-
-  for (std::size_t iter = 0; iter < kNumIterations; ++iter) {
-    const std::size_t chosen_worker_thread_index = rand_policy.getNextWorkerID();
-    EXPECT_GE(getWorkerDirectory()->getNumWorkers(), chosen_worker_thread_index);
-  }
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/query_optimizer/CMakeLists.txt b/query_optimizer/CMakeLists.txt
deleted file mode 100644
index 10c52a1..0000000
--- a/query_optimizer/CMakeLists.txt
+++ /dev/null
@@ -1,263 +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.
-
-if (ENABLE_DISTRIBUTED)
-  set(QUICKSTEP_DISTRIBUTED TRUE)
-endif()
-
-configure_file (
-  "${CMAKE_CURRENT_SOURCE_DIR}/QueryOptimizerConfig.h.in"
-  "${CMAKE_CURRENT_BINARY_DIR}/QueryOptimizerConfig.h"
-)
-
-if (BUILD_SHARED_LIBS)
-  set(GFLAGS_LIB_NAME gflags_nothreads-shared)
-else()
-  set(GFLAGS_LIB_NAME gflags_nothreads-static)
-endif()
-
-add_subdirectory(cost_model)
-add_subdirectory(expressions)
-add_subdirectory(logical)
-add_subdirectory(physical)
-add_subdirectory(resolver)
-add_subdirectory(rules)
-add_subdirectory(strategy)
-add_subdirectory(tests)
-
-# Declare micro-libs:
-add_library(quickstep_queryoptimizer_ExecutionGenerator ExecutionGenerator.cpp ExecutionGenerator.hpp)
-add_library(quickstep_queryoptimizer_LIPFilterGenerator LIPFilterGenerator.cpp LIPFilterGenerator.hpp)
-add_library(quickstep_queryoptimizer_LogicalGenerator LogicalGenerator.cpp LogicalGenerator.hpp)
-add_library(quickstep_queryoptimizer_LogicalToPhysicalMapper
-            ../empty_src.cpp
-            LogicalToPhysicalMapper.hpp)
-add_library(quickstep_queryoptimizer_Optimizer Optimizer.cpp Optimizer.hpp)
-add_library(quickstep_queryoptimizer_OptimizerContext OptimizerContext.cpp OptimizerContext.hpp)
-add_library(quickstep_queryoptimizer_OptimizerTree ../empty_src.cpp OptimizerTree.hpp)
-add_library(quickstep_queryoptimizer_PhysicalGenerator PhysicalGenerator.cpp PhysicalGenerator.hpp)
-add_library(quickstep_queryoptimizer_QueryHandle ../empty_src.cpp QueryHandle.hpp)
-add_library(quickstep_queryoptimizer_QueryPlan ../empty_src.cpp QueryPlan.hpp)
-add_library(quickstep_queryoptimizer_QueryProcessor QueryProcessor.cpp QueryProcessor.hpp)
-add_library(quickstep_queryoptimizer_Validator ../empty_src.cpp Validator.hpp)
-
-# Link dependencies:
-target_link_libraries(quickstep_queryoptimizer_ExecutionGenerator
-                      glog
-                      quickstep_catalog_CatalogAttribute
-                      quickstep_catalog_CatalogDatabase
-                      quickstep_catalog_CatalogRelation
-                      quickstep_catalog_CatalogRelationSchema
-                      quickstep_catalog_CatalogTypedefs
-                      quickstep_expressions_Expressions_proto
-                      quickstep_expressions_aggregation_AggregateFunction
-                      quickstep_expressions_aggregation_AggregateFunction_proto
-                      quickstep_expressions_predicate_Predicate
-                      quickstep_expressions_scalar_Scalar
-                      quickstep_expressions_scalar_ScalarAttribute
-                      quickstep_expressions_windowaggregation_WindowAggregateFunction
-                      quickstep_expressions_windowaggregation_WindowAggregateFunction_proto
-                      quickstep_queryexecution_QueryContext
-                      quickstep_queryexecution_QueryContext_proto
-                      quickstep_queryoptimizer_LIPFilterGenerator
-                      quickstep_queryoptimizer_OptimizerContext
-                      quickstep_queryoptimizer_QueryHandle
-                      quickstep_queryoptimizer_QueryPlan
-                      quickstep_queryoptimizer_costmodel_CostModel
-                      quickstep_queryoptimizer_costmodel_SimpleCostModel
-                      quickstep_queryoptimizer_costmodel_StarSchemaSimpleCostModel
-                      quickstep_queryoptimizer_expressions_AggregateFunction
-                      quickstep_queryoptimizer_expressions_Alias
-                      quickstep_queryoptimizer_expressions_AttributeReference
-                      quickstep_queryoptimizer_expressions_ComparisonExpression
-                      quickstep_queryoptimizer_expressions_ExprId
-                      quickstep_queryoptimizer_expressions_ExpressionType
-                      quickstep_queryoptimizer_expressions_NamedExpression
-                      quickstep_queryoptimizer_expressions_PatternMatcher
-                      quickstep_queryoptimizer_expressions_Predicate
-                      quickstep_queryoptimizer_expressions_Scalar
-                      quickstep_queryoptimizer_expressions_ScalarLiteral
-                      quickstep_queryoptimizer_expressions_WindowAggregateFunction
-                      quickstep_queryoptimizer_physical_Aggregate
-                      quickstep_queryoptimizer_physical_CopyFrom
-                      quickstep_queryoptimizer_physical_CreateIndex
-                      quickstep_queryoptimizer_physical_CreateTable
-                      quickstep_queryoptimizer_physical_DeleteTuples
-                      quickstep_queryoptimizer_physical_DropTable
-                      quickstep_queryoptimizer_physical_HashJoin
-                      quickstep_queryoptimizer_physical_InsertSelection
-                      quickstep_queryoptimizer_physical_InsertTuple
-                      quickstep_queryoptimizer_physical_LIPFilterConfiguration
-                      quickstep_queryoptimizer_physical_NestedLoopsJoin
-                      quickstep_queryoptimizer_physical_PatternMatcher
-                      quickstep_queryoptimizer_physical_Physical
-                      quickstep_queryoptimizer_physical_PhysicalType
-                      quickstep_queryoptimizer_physical_Sample
-                      quickstep_queryoptimizer_physical_Selection
-                      quickstep_queryoptimizer_physical_SharedSubplanReference
-                      quickstep_queryoptimizer_physical_Sort
-                      quickstep_queryoptimizer_physical_TableGenerator
-                      quickstep_queryoptimizer_physical_TableReference
-                      quickstep_queryoptimizer_physical_TopLevelPlan
-                      quickstep_queryoptimizer_physical_UpdateTable
-                      quickstep_queryoptimizer_physical_WindowAggregate
-                      quickstep_relationaloperators_AggregationOperator
-                      quickstep_relationaloperators_BuildHashOperator
-                      quickstep_relationaloperators_CreateIndexOperator
-                      quickstep_relationaloperators_CreateTableOperator
-                      quickstep_relationaloperators_DeleteOperator
-                      quickstep_relationaloperators_DestroyAggregationStateOperator
-                      quickstep_relationaloperators_DestroyHashOperator
-                      quickstep_relationaloperators_DropTableOperator
-                      quickstep_relationaloperators_FinalizeAggregationOperator
-                      quickstep_relationaloperators_HashJoinOperator
-                      quickstep_relationaloperators_InsertOperator
-                      quickstep_relationaloperators_NestedLoopsJoinOperator
-                      quickstep_relationaloperators_RelationalOperator
-                      quickstep_relationaloperators_SampleOperator
-                      quickstep_relationaloperators_SaveBlocksOperator
-                      quickstep_relationaloperators_SelectOperator
-                      quickstep_relationaloperators_SortMergeRunOperator
-                      quickstep_relationaloperators_SortRunGenerationOperator
-                      quickstep_relationaloperators_TableGeneratorOperator
-                      quickstep_relationaloperators_TextScanOperator
-                      quickstep_relationaloperators_UpdateOperator
-                      quickstep_relationaloperators_WindowAggregationOperator
-                      quickstep_storage_AggregationOperationState_proto
-                      quickstep_storage_HashTableFactory
-                      quickstep_storage_HashTable_proto
-                      quickstep_storage_InsertDestination_proto
-                      quickstep_storage_StorageBlockLayout
-                      quickstep_storage_StorageBlockLayout_proto
-                      quickstep_storage_SubBlockTypeRegistry
-                      quickstep_types_Type
-                      quickstep_types_Type_proto
-                      quickstep_types_TypedValue
-                      quickstep_types_TypedValue_proto
-                      quickstep_types_containers_Tuple_proto
-                      quickstep_utility_Macros
-                      quickstep_utility_SqlError)
-if (ENABLE_DISTRIBUTED)
-  target_link_libraries(quickstep_queryoptimizer_ExecutionGenerator
-                        quickstep_catalog_Catalog_proto)
-endif()
-target_link_libraries(quickstep_queryoptimizer_LIPFilterGenerator
-                      glog
-                      quickstep_catalog_CatalogAttribute
-                      quickstep_queryexecution_QueryContext
-                      quickstep_queryexecution_QueryContext_proto
-                      quickstep_queryoptimizer_QueryPlan
-                      quickstep_queryoptimizer_expressions_ExprId
-                      quickstep_queryoptimizer_physical_Aggregate
-                      quickstep_queryoptimizer_physical_HashJoin
-                      quickstep_queryoptimizer_physical_LIPFilterConfiguration
-                      quickstep_queryoptimizer_physical_Physical
-                      quickstep_queryoptimizer_physical_Selection
-                      quickstep_relationaloperators_RelationalOperator
-                      quickstep_types_Type
-                      quickstep_utility_Macros
-                      quickstep_utility_lipfilter_LIPFilter
-                      quickstep_utility_lipfilter_LIPFilter_proto)
-target_link_libraries(quickstep_queryoptimizer_LogicalGenerator
-                      glog
-                      quickstep_parser_ParseStatement
-                      quickstep_queryoptimizer_OptimizerContext
-                      quickstep_queryoptimizer_logical_Logical
-                      quickstep_queryoptimizer_resolver_Resolver
-                      quickstep_queryoptimizer_rules_CollapseProject
-                      quickstep_queryoptimizer_rules_GenerateJoins
-                      quickstep_queryoptimizer_rules_PushDownFilter
-                      quickstep_queryoptimizer_rules_PushDownSemiAntiJoin
-                      quickstep_queryoptimizer_rules_Rule
-                      quickstep_queryoptimizer_rules_UnnestSubqueries
-                      quickstep_queryoptimizer_Validator
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_LogicalToPhysicalMapper
-                      quickstep_queryoptimizer_logical_Logical
-                      quickstep_queryoptimizer_physical_Physical
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_Optimizer
-                      quickstep_queryoptimizer_ExecutionGenerator
-                      quickstep_queryoptimizer_LogicalGenerator
-                      quickstep_queryoptimizer_PhysicalGenerator
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_OptimizerContext
-                      quickstep_queryoptimizer_expressions_ExprId
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_OptimizerTree
-                      quickstep_storage_StorageBlockLayout_proto
-                      quickstep_utility_Macros
-                      quickstep_utility_TreeStringSerializable)
-target_link_libraries(quickstep_queryoptimizer_PhysicalGenerator
-                      ${GFLAGS_LIB_NAME}
-                      quickstep_queryoptimizer_LogicalToPhysicalMapper
-                      quickstep_queryoptimizer_logical_Logical
-                      quickstep_queryoptimizer_physical_Physical
-                      quickstep_queryoptimizer_rules_AttachLIPFilters
-                      quickstep_queryoptimizer_rules_PruneColumns
-                      quickstep_queryoptimizer_rules_StarSchemaHashJoinOrderOptimization
-                      quickstep_queryoptimizer_rules_SwapProbeBuild
-                      quickstep_queryoptimizer_strategy_Aggregate
-                      quickstep_queryoptimizer_strategy_Join
-                      quickstep_queryoptimizer_strategy_OneToOne
-                      quickstep_queryoptimizer_strategy_Selection
-                      quickstep_queryoptimizer_strategy_Strategy
-                      quickstep_queryoptimizer_Validator
-                      quickstep_utility_Macros
-                      quickstep_utility_PlanVisualizer)
-target_link_libraries(quickstep_queryoptimizer_QueryHandle
-                      quickstep_catalog_Catalog_proto
-                      quickstep_queryexecution_QueryContext_proto
-                      quickstep_queryoptimizer_QueryPlan
-                      quickstep_utility_Macros
-                      tmb)
-target_link_libraries(quickstep_queryoptimizer_QueryPlan
-                      quickstep_relationaloperators_RelationalOperator
-                      quickstep_utility_DAG
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_QueryProcessor
-                      quickstep_catalog_Catalog
-                      quickstep_catalog_Catalog_proto
-                      quickstep_queryoptimizer_Optimizer
-                      quickstep_queryoptimizer_OptimizerContext
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_Validator
-                      glog
-                      quickstep_queryoptimizer_expressions_AttributeReference
-                      quickstep_queryoptimizer_expressions_ExpressionUtil)
-
-# Module all-in-one library:
-add_library(quickstep_queryoptimizer ../empty_src.cpp QueryOptimizerModule.hpp)
-target_link_libraries(quickstep_queryoptimizer
-                      quickstep_queryoptimizer_ExecutionGenerator
-                      quickstep_queryoptimizer_LIPFilterGenerator
-                      quickstep_queryoptimizer_LogicalGenerator
-                      quickstep_queryoptimizer_LogicalToPhysicalMapper
-                      quickstep_queryoptimizer_Optimizer
-                      quickstep_queryoptimizer_OptimizerContext
-                      quickstep_queryoptimizer_OptimizerTree
-                      quickstep_queryoptimizer_PhysicalGenerator
-                      quickstep_queryoptimizer_QueryHandle
-                      quickstep_queryoptimizer_QueryPlan
-                      quickstep_queryoptimizer_QueryProcessor
-                      quickstep_queryoptimizer_Validator
-                      quickstep_queryoptimizer_costmodel
-                      quickstep_queryoptimizer_expressions
-                      quickstep_queryoptimizer_logical
-                      quickstep_queryoptimizer_physical
-                      quickstep_queryoptimizer_resolver
-                      quickstep_queryoptimizer_rules)


[11/51] [abbrv] [partial] incubator-quickstep git commit: remove c++ files

Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/expressions/BinaryExpression.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/BinaryExpression.cpp b/query_optimizer/expressions/BinaryExpression.cpp
deleted file mode 100644
index 446dd55..0000000
--- a/query_optimizer/expressions/BinaryExpression.cpp
+++ /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.
- **/
-
-#include "query_optimizer/expressions/BinaryExpression.hpp"
-
-#include <string>
-#include <unordered_map>
-#include <vector>
-
-#include "expressions/scalar/ScalarBinaryExpression.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/PatternMatcher.hpp"
-#include "types/operations/binary_operations/BinaryOperation.hpp"
-#include "types/operations/binary_operations/BinaryOperationID.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-class Type;
-
-namespace optimizer {
-namespace expressions {
-
-BinaryExpression::BinaryExpression(const BinaryOperation &operation,
-                                   const ScalarPtr &left,
-                                   const ScalarPtr &right)
-    : operation_(operation), left_(left), right_(right) {
-  DCHECK(operation_.canApplyToTypes(left_->getValueType(),
-                                    right_->getValueType()))
-      << toString();
-  addChild(left_);
-  addChild(right_);
-}
-
-std::string BinaryExpression::getName() const {
-  switch (operation_.getBinaryOperationID()) {
-    case BinaryOperationID::kAdd:
-      return "Add";
-    case BinaryOperationID::kSubtract:
-      return "Subtract";
-    case BinaryOperationID::kMultiply:
-      return "Multiply";
-    case BinaryOperationID::kDivide:
-      return "Divide";
-    case BinaryOperationID::kModulo:
-      return "Modulo";
-    default:
-      LOG(FATAL) << "Unknown binary operation";
-  }
-}
-
-const Type &BinaryExpression::getValueType() const {
-  return *operation_.resultTypeForArgumentTypes(left_->getValueType(),
-                                                right_->getValueType());
-}
-
-ExpressionPtr BinaryExpression::copyWithNewChildren(
-    const std::vector<ExpressionPtr> &new_children) const {
-  DCHECK_EQ(new_children.size(), children().size());
-  DCHECK(SomeScalar::Matches(new_children[0]));
-  DCHECK(SomeScalar::Matches(new_children[1]));
-  return BinaryExpression::Create(
-      operation_,
-      std::static_pointer_cast<const Scalar>(new_children[0]),
-      std::static_pointer_cast<const Scalar>(new_children[1]));
-}
-
-std::vector<AttributeReferencePtr> BinaryExpression::getReferencedAttributes() const {
-  std::vector<AttributeReferencePtr> referenced_attributes =
-      left_->getReferencedAttributes();
-  const std::vector<AttributeReferencePtr> referenced_attributes_by_right_operand =
-      right_->getReferencedAttributes();
-  referenced_attributes.insert(referenced_attributes.end(),
-                               referenced_attributes_by_right_operand.begin(),
-                               referenced_attributes_by_right_operand.end());
-  return referenced_attributes;
-}
-
-::quickstep::Scalar *BinaryExpression::concretize(
-    const std::unordered_map<ExprId, const CatalogAttribute*> &substitution_map) const {
-  return new ::quickstep::ScalarBinaryExpression(
-      operation_,
-      left_->concretize(substitution_map),
-      right_->concretize(substitution_map));
-}
-
-void BinaryExpression::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("");
-  container_child_fields->push_back({left_, right_});
-}
-
-}  // namespace expressions
-}  // namespace optimizer
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/expressions/BinaryExpression.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/BinaryExpression.hpp b/query_optimizer/expressions/BinaryExpression.hpp
deleted file mode 100644
index 9b11ed1..0000000
--- a/query_optimizer/expressions/BinaryExpression.hpp
+++ /dev/null
@@ -1,127 +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_BINARY_EXPRESSION_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_EXPRESSIONS_BINARY_EXPRESSION_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 "utility/Macros.hpp"
-
-namespace quickstep {
-
-class BinaryOperation;
-class CatalogAttribute;
-class Type;
-
-namespace optimizer {
-namespace expressions {
-
-/** \addtogroup OptimizerExpressions
- *  @{
- */
-
-class BinaryExpression;
-typedef std::shared_ptr<const BinaryExpression> BinaryExpressionPtr;
-
-/**
- * @brief Applies a binary operator to two scalar expressions and returns a
- *        scalar value.
- */
-class BinaryExpression : public Scalar {
- public:
-  ExpressionType getExpressionType() const override {
-    return ExpressionType::kBinaryExpression;
-  }
-
-  std::string getName() const override;
-
-  const Type& getValueType() const override;
-
-  bool isConstant() const override {
-    return left_->isConstant() && right_->isConstant();
-  }
-
-  /**
-   * @return The binary operation.
-   */
-  const BinaryOperation& operation() const { return operation_; }
-
-  /**
-   * @return The left operand.
-   */
-  const ScalarPtr& left() const { return left_; }
-
-  /**
-   * @return The right operand.
-   */
-  const ScalarPtr& right() const { return right_; }
-
-  ExpressionPtr copyWithNewChildren(
-      const std::vector<ExpressionPtr> &new_children) const override;
-
-  std::vector<AttributeReferencePtr> getReferencedAttributes() const override;
-
-  ::quickstep::Scalar* concretize(
-      const std::unordered_map<ExprId, const CatalogAttribute*> &substitution_map) const override;
-
-  static BinaryExpressionPtr Create(const BinaryOperation &operation,
-                                    const ScalarPtr &left,
-                                    const ScalarPtr &right) {
-    return BinaryExpressionPtr(new BinaryExpression(operation, left, right));
-  }
-
- 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:
-  BinaryExpression(const BinaryOperation &operation,
-                   const ScalarPtr &left,
-                   const ScalarPtr &right);
-
-  const BinaryOperation &operation_;
-
-  ScalarPtr left_;
-  ScalarPtr right_;
-
-  DISALLOW_COPY_AND_ASSIGN(BinaryExpression);
-};
-
-/** @} */
-
-}  // namespace expressions
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_QUERY_OPTIMIZER_EXPRESSIONS_BINARY_EXPRESSION_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/expressions/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/CMakeLists.txt b/query_optimizer/expressions/CMakeLists.txt
deleted file mode 100644
index 35fac90..0000000
--- a/query_optimizer/expressions/CMakeLists.txt
+++ /dev/null
@@ -1,348 +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.
-
-# Declare micro-libs:
-add_library(quickstep_queryoptimizer_expressions_AggregateFunction AggregateFunction.cpp AggregateFunction.hpp)
-add_library(quickstep_queryoptimizer_expressions_Alias Alias.cpp Alias.hpp)
-add_library(quickstep_queryoptimizer_expressions_AttributeReference AttributeReference.cpp AttributeReference.hpp)
-add_library(quickstep_queryoptimizer_expressions_BinaryExpression BinaryExpression.cpp BinaryExpression.hpp)
-add_library(quickstep_queryoptimizer_expressions_Cast Cast.cpp Cast.hpp)
-add_library(quickstep_queryoptimizer_expressions_ComparisonExpression ComparisonExpression.cpp
-            ComparisonExpression.hpp)
-add_library(quickstep_queryoptimizer_expressions_Exists Exists.cpp Exists.hpp)
-add_library(quickstep_queryoptimizer_expressions_Expression ../../empty_src.cpp Expression.hpp)
-add_library(quickstep_queryoptimizer_expressions_ExpressionType ../../empty_src.cpp ExpressionType.hpp)
-add_library(quickstep_queryoptimizer_expressions_ExprId ../../empty_src.cpp ExprId.hpp)
-add_library(quickstep_queryoptimizer_expressions_ExpressionUtil ExpressionUtil.cpp ExpressionUtil.hpp)
-add_library(quickstep_queryoptimizer_expressions_InTableQuery InTableQuery.cpp InTableQuery.hpp)
-add_library(quickstep_queryoptimizer_expressions_InValueList InValueList.cpp InValueList.hpp)
-add_library(quickstep_queryoptimizer_expressions_LogicalAnd LogicalAnd.cpp LogicalAnd.hpp)
-add_library(quickstep_queryoptimizer_expressions_LogicalNot LogicalNot.cpp LogicalNot.hpp)
-add_library(quickstep_queryoptimizer_expressions_LogicalOr LogicalOr.cpp LogicalOr.hpp)
-add_library(quickstep_queryoptimizer_expressions_NamedExpression NamedExpression.cpp NamedExpression.hpp)
-add_library(quickstep_queryoptimizer_expressions_PatternMatcher ../../empty_src.cpp PatternMatcher.hpp)
-add_library(quickstep_queryoptimizer_expressions_Predicate ../../empty_src.cpp Predicate.hpp)
-add_library(quickstep_queryoptimizer_expressions_PredicateLiteral PredicateLiteral.cpp PredicateLiteral.hpp)
-add_library(quickstep_queryoptimizer_expressions_Scalar ../../empty_src.cpp Scalar.hpp)
-add_library(quickstep_queryoptimizer_expressions_ScalarLiteral ScalarLiteral.cpp ScalarLiteral.hpp)
-add_library(quickstep_queryoptimizer_expressions_SearchedCase SearchedCase.cpp SearchedCase.hpp)
-add_library(quickstep_queryoptimizer_expressions_SimpleCase SimpleCase.cpp SimpleCase.hpp)
-add_library(quickstep_queryoptimizer_expressions_SubqueryExpression SubqueryExpression.cpp SubqueryExpression.hpp)
-add_library(quickstep_queryoptimizer_expressions_UnaryExpression UnaryExpression.cpp UnaryExpression.hpp)
-add_library(quickstep_queryoptimizer_expressions_WindowAggregateFunction WindowAggregateFunction.cpp WindowAggregateFunction.hpp)
-
-# Link dependencies:
-target_link_libraries(quickstep_queryoptimizer_expressions_AggregateFunction
-                      glog
-                      quickstep_expressions_aggregation_AggregateFunction
-                      quickstep_queryoptimizer_OptimizerTree
-                      quickstep_queryoptimizer_expressions_AttributeReference
-                      quickstep_queryoptimizer_expressions_Expression
-                      quickstep_queryoptimizer_expressions_ExpressionType
-                      quickstep_queryoptimizer_expressions_PatternMatcher
-                      quickstep_queryoptimizer_expressions_Scalar
-                      quickstep_types_Type
-                      quickstep_utility_Cast
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_expressions_Alias
-                      glog
-                      quickstep_catalog_CatalogTypedefs
-                      quickstep_queryoptimizer_OptimizerTree
-                      quickstep_queryoptimizer_expressions_AttributeReference
-                      quickstep_queryoptimizer_expressions_ExprId
-                      quickstep_queryoptimizer_expressions_Expression
-                      quickstep_queryoptimizer_expressions_ExpressionType
-                      quickstep_queryoptimizer_expressions_NamedExpression
-                      quickstep_queryoptimizer_expressions_PatternMatcher
-                      quickstep_queryoptimizer_expressions_Scalar
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_expressions_AttributeReference
-                      glog
-                      quickstep_catalog_CatalogTypedefs
-                      quickstep_expressions_scalar_ScalarAttribute
-                      quickstep_queryoptimizer_expressions_ExprId
-                      quickstep_queryoptimizer_expressions_Expression
-                      quickstep_queryoptimizer_expressions_ExpressionType
-                      quickstep_queryoptimizer_expressions_NamedExpression
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_expressions_BinaryExpression
-                      glog
-                      quickstep_expressions_scalar_ScalarBinaryExpression
-                      quickstep_queryoptimizer_OptimizerTree
-                      quickstep_queryoptimizer_expressions_AttributeReference
-                      quickstep_queryoptimizer_expressions_ExprId
-                      quickstep_queryoptimizer_expressions_Expression
-                      quickstep_queryoptimizer_expressions_ExpressionType
-                      quickstep_queryoptimizer_expressions_PatternMatcher
-                      quickstep_queryoptimizer_expressions_Scalar
-                      quickstep_types_operations_binaryoperations_BinaryOperation
-                      quickstep_types_operations_binaryoperations_BinaryOperationID
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_expressions_Cast
-                      glog
-                      quickstep_expressions_scalar_Scalar
-                      quickstep_expressions_scalar_ScalarUnaryExpression
-                      quickstep_queryoptimizer_OptimizerTree
-                      quickstep_queryoptimizer_expressions_AttributeReference
-                      quickstep_queryoptimizer_expressions_ExprId
-                      quickstep_queryoptimizer_expressions_Expression
-                      quickstep_queryoptimizer_expressions_ExpressionType
-                      quickstep_queryoptimizer_expressions_PatternMatcher
-                      quickstep_queryoptimizer_expressions_Scalar
-                      quickstep_types_Type
-                      quickstep_types_operations_unaryoperations_NumericCastOperation
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_expressions_ComparisonExpression
-                      glog
-                      quickstep_expressions_predicate_ComparisonPredicate
-                      quickstep_queryoptimizer_OptimizerTree
-                      quickstep_queryoptimizer_expressions_AttributeReference
-                      quickstep_queryoptimizer_expressions_ExprId
-                      quickstep_queryoptimizer_expressions_Expression
-                      quickstep_queryoptimizer_expressions_ExpressionType
-                      quickstep_queryoptimizer_expressions_PatternMatcher
-                      quickstep_queryoptimizer_expressions_Predicate
-                      quickstep_queryoptimizer_expressions_Scalar
-                      quickstep_types_operations_comparisons_Comparison
-                      quickstep_types_operations_comparisons_ComparisonID
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_expressions_Exists
-                      quickstep_queryoptimizer_OptimizerTree
-                      quickstep_queryoptimizer_expressions_AttributeReference
-                      quickstep_queryoptimizer_expressions_ExprId
-                      quickstep_queryoptimizer_expressions_Expression
-                      quickstep_queryoptimizer_expressions_ExpressionType
-                      quickstep_queryoptimizer_expressions_Predicate
-                      quickstep_queryoptimizer_expressions_SubqueryExpression
-                      quickstep_utility_Macros
-                      glog)
-target_link_libraries(quickstep_queryoptimizer_expressions_Expression
-                      quickstep_queryoptimizer_OptimizerTree
-                      quickstep_queryoptimizer_expressions_ExpressionType
-                      quickstep_types_Type
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_expressions_ExpressionUtil
-                      glog
-                      quickstep_queryoptimizer_expressions_AttributeReference
-                      quickstep_queryoptimizer_expressions_ExprId
-                      quickstep_queryoptimizer_expressions_NamedExpression
-                      quickstep_queryoptimizer_expressions_PatternMatcher)
-target_link_libraries(quickstep_queryoptimizer_expressions_InTableQuery
-                      quickstep_queryoptimizer_OptimizerTree
-                      quickstep_queryoptimizer_expressions_AttributeReference
-                      quickstep_queryoptimizer_expressions_ExprId
-                      quickstep_queryoptimizer_expressions_Expression
-                      quickstep_queryoptimizer_expressions_ExpressionType
-                      quickstep_queryoptimizer_expressions_Predicate
-                      quickstep_queryoptimizer_expressions_Scalar
-                      quickstep_queryoptimizer_expressions_SubqueryExpression
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_expressions_InValueList
-                      quickstep_queryoptimizer_OptimizerTree
-                      quickstep_expressions_predicate_DisjunctionPredicate
-                      quickstep_expressions_predicate_Predicate
-                      quickstep_queryoptimizer_expressions_AttributeReference
-                      quickstep_queryoptimizer_expressions_ComparisonExpression
-                      quickstep_queryoptimizer_expressions_ExprId
-                      quickstep_queryoptimizer_expressions_Expression
-                      quickstep_queryoptimizer_expressions_ExpressionType
-                      quickstep_queryoptimizer_expressions_Predicate
-                      quickstep_queryoptimizer_expressions_Scalar
-                      quickstep_types_operations_comparisons_ComparisonFactory
-                      quickstep_types_operations_comparisons_ComparisonID
-                      quickstep_utility_Cast
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_expressions_LogicalAnd
-                      glog
-                      quickstep_expressions_predicate_ConjunctionPredicate
-                      quickstep_expressions_predicate_TrivialPredicates
-                      quickstep_queryoptimizer_OptimizerTree
-                      quickstep_queryoptimizer_expressions_AttributeReference
-                      quickstep_queryoptimizer_expressions_ExprId
-                      quickstep_queryoptimizer_expressions_Expression
-                      quickstep_queryoptimizer_expressions_ExpressionType
-                      quickstep_queryoptimizer_expressions_PatternMatcher
-                      quickstep_queryoptimizer_expressions_Predicate
-                      quickstep_queryoptimizer_expressions_PredicateLiteral
-                      quickstep_utility_Cast
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_expressions_LogicalNot
-                      glog
-                      quickstep_expressions_predicate_NegationPredicate
-                      quickstep_queryoptimizer_OptimizerTree
-                      quickstep_queryoptimizer_expressions_AttributeReference
-                      quickstep_queryoptimizer_expressions_ExprId
-                      quickstep_queryoptimizer_expressions_Expression
-                      quickstep_queryoptimizer_expressions_ExpressionType
-                      quickstep_queryoptimizer_expressions_PatternMatcher
-                      quickstep_queryoptimizer_expressions_Predicate
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_expressions_LogicalOr
-                      glog
-                      quickstep_expressions_predicate_DisjunctionPredicate
-                      quickstep_expressions_predicate_TrivialPredicates
-                      quickstep_queryoptimizer_OptimizerTree
-                      quickstep_queryoptimizer_expressions_AttributeReference
-                      quickstep_queryoptimizer_expressions_ExprId
-                      quickstep_queryoptimizer_expressions_Expression
-                      quickstep_queryoptimizer_expressions_ExpressionType
-                      quickstep_queryoptimizer_expressions_PatternMatcher
-                      quickstep_queryoptimizer_expressions_Predicate
-                      quickstep_queryoptimizer_expressions_PredicateLiteral
-                      quickstep_utility_Cast
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_expressions_NamedExpression
-                      quickstep_queryoptimizer_OptimizerTree
-                      quickstep_queryoptimizer_expressions_ExprId
-                      quickstep_queryoptimizer_expressions_Scalar
-                      quickstep_types_Type
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_expressions_PatternMatcher
-                      quickstep_queryoptimizer_expressions_ExpressionType)
-target_link_libraries(quickstep_queryoptimizer_expressions_Predicate
-                      quickstep_queryoptimizer_expressions_ExprId
-                      quickstep_queryoptimizer_expressions_Expression
-                      quickstep_types_Type
-                      quickstep_types_TypeFactory
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_expressions_PredicateLiteral
-                      glog
-                      quickstep_expressions_predicate_TrivialPredicates
-                      quickstep_queryoptimizer_OptimizerTree
-                      quickstep_queryoptimizer_expressions_AttributeReference
-                      quickstep_queryoptimizer_expressions_ExprId
-                      quickstep_queryoptimizer_expressions_Expression
-                      quickstep_queryoptimizer_expressions_ExpressionType
-                      quickstep_queryoptimizer_expressions_Predicate
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_expressions_Scalar
-                      glog
-                      quickstep_queryoptimizer_expressions_ExprId
-                      quickstep_queryoptimizer_expressions_Expression
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_expressions_ScalarLiteral
-                      glog
-                      quickstep_expressions_scalar_ScalarLiteral
-                      quickstep_queryoptimizer_OptimizerTree
-                      quickstep_queryoptimizer_expressions_AttributeReference
-                      quickstep_queryoptimizer_expressions_ExprId
-                      quickstep_queryoptimizer_expressions_Expression
-                      quickstep_queryoptimizer_expressions_ExpressionType
-                      quickstep_queryoptimizer_expressions_Scalar
-                      quickstep_types_Type
-                      quickstep_types_TypedValue
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_expressions_SearchedCase
-                      quickstep_expressions_predicate_Predicate
-                      quickstep_expressions_scalar_Scalar
-                      quickstep_expressions_scalar_ScalarCaseExpression
-                      quickstep_expressions_scalar_ScalarLiteral
-                      quickstep_queryoptimizer_OptimizerTree
-                      quickstep_queryoptimizer_expressions_AttributeReference
-                      quickstep_queryoptimizer_expressions_ExprId
-                      quickstep_queryoptimizer_expressions_Expression
-                      quickstep_queryoptimizer_expressions_ExpressionType
-                      quickstep_queryoptimizer_expressions_Predicate
-                      quickstep_queryoptimizer_expressions_Scalar
-                      quickstep_types_Type
-                      quickstep_utility_Cast
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_expressions_SimpleCase
-                      quickstep_expressions_predicate_Predicate
-                      quickstep_expressions_scalar_Scalar
-                      quickstep_expressions_scalar_ScalarCaseExpression
-                      quickstep_expressions_scalar_ScalarLiteral
-                      quickstep_queryoptimizer_OptimizerTree
-                      quickstep_queryoptimizer_expressions_AttributeReference
-                      quickstep_queryoptimizer_expressions_ComparisonExpression
-                      quickstep_queryoptimizer_expressions_ExprId
-                      quickstep_queryoptimizer_expressions_Expression
-                      quickstep_queryoptimizer_expressions_ExpressionType
-                      quickstep_queryoptimizer_expressions_Predicate
-                      quickstep_queryoptimizer_expressions_Scalar
-                      quickstep_types_Type
-                      quickstep_types_operations_comparisons_ComparisonFactory
-                      quickstep_types_operations_comparisons_ComparisonID
-                      quickstep_utility_Cast
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_expressions_SubqueryExpression
-                      glog
-                      quickstep_queryoptimizer_OptimizerTree
-                      quickstep_queryoptimizer_expressions_AttributeReference
-                      quickstep_queryoptimizer_expressions_ExprId
-                      quickstep_queryoptimizer_expressions_Expression
-                      quickstep_queryoptimizer_expressions_ExpressionType
-                      quickstep_queryoptimizer_expressions_Scalar
-                      quickstep_queryoptimizer_logical_Logical
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_expressions_UnaryExpression
-                      glog
-                      quickstep_expressions_scalar_ScalarUnaryExpression
-                      quickstep_queryoptimizer_OptimizerTree
-                      quickstep_queryoptimizer_expressions_AttributeReference
-                      quickstep_queryoptimizer_expressions_ExprId
-                      quickstep_queryoptimizer_expressions_Expression
-                      quickstep_queryoptimizer_expressions_ExpressionType
-                      quickstep_queryoptimizer_expressions_PatternMatcher
-                      quickstep_queryoptimizer_expressions_Scalar
-                      quickstep_types_operations_unaryoperations_UnaryOperation
-                      quickstep_types_operations_unaryoperations_UnaryOperationID
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_expressions_WindowAggregateFunction
-                      glog
-                      quickstep_expressions_windowaggregation_WindowAggregateFunction
-                      quickstep_queryoptimizer_OptimizerTree
-                      quickstep_queryoptimizer_expressions_AttributeReference
-                      quickstep_queryoptimizer_expressions_Expression
-                      quickstep_queryoptimizer_expressions_ExpressionType
-                      quickstep_queryoptimizer_expressions_PatternMatcher
-                      quickstep_queryoptimizer_expressions_Scalar
-                      quickstep_types_Type
-                      quickstep_utility_Cast
-                      quickstep_utility_Macros)
-
-
-# Module all-in-one library:
-add_library(quickstep_queryoptimizer_expressions ../../empty_src.cpp OptimizerExpressionsModule.hpp)
-target_link_libraries(quickstep_queryoptimizer_expressions
-                      quickstep_queryoptimizer_expressions_AggregateFunction
-                      quickstep_queryoptimizer_expressions_Alias
-                      quickstep_queryoptimizer_expressions_AttributeReference
-                      quickstep_queryoptimizer_expressions_BinaryExpression
-                      quickstep_queryoptimizer_expressions_Cast
-                      quickstep_queryoptimizer_expressions_ComparisonExpression
-                      quickstep_queryoptimizer_expressions_Exists
-                      quickstep_queryoptimizer_expressions_Expression
-                      quickstep_queryoptimizer_expressions_ExpressionType
-                      quickstep_queryoptimizer_expressions_ExprId
-                      quickstep_queryoptimizer_expressions_ExpressionUtil
-                      quickstep_queryoptimizer_expressions_InTableQuery
-                      quickstep_queryoptimizer_expressions_InValueList
-                      quickstep_queryoptimizer_expressions_LogicalAnd
-                      quickstep_queryoptimizer_expressions_LogicalNot
-                      quickstep_queryoptimizer_expressions_LogicalOr
-                      quickstep_queryoptimizer_expressions_NamedExpression
-                      quickstep_queryoptimizer_expressions_PatternMatcher
-                      quickstep_queryoptimizer_expressions_Predicate
-                      quickstep_queryoptimizer_expressions_PredicateLiteral
-                      quickstep_queryoptimizer_expressions_Scalar
-                      quickstep_queryoptimizer_expressions_ScalarLiteral
-                      quickstep_queryoptimizer_expressions_SearchedCase
-                      quickstep_queryoptimizer_expressions_SimpleCase
-                      quickstep_queryoptimizer_expressions_SubqueryExpression
-                      quickstep_queryoptimizer_expressions_UnaryExpression
-                      quickstep_queryoptimizer_expressions_WindowAggregateFunction)

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/expressions/Cast.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/Cast.cpp b/query_optimizer/expressions/Cast.cpp
deleted file mode 100644
index c0813c5..0000000
--- a/query_optimizer/expressions/Cast.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/Cast.hpp"
-
-#include <string>
-#include <unordered_map>
-#include <vector>
-
-#include "expressions/scalar/Scalar.hpp"
-#include "expressions/scalar/ScalarUnaryExpression.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/PatternMatcher.hpp"
-#include "query_optimizer/expressions/Scalar.hpp"
-#include "types/Type.hpp"
-#include "types/operations/unary_operations/NumericCastOperation.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-namespace optimizer {
-namespace expressions {
-
-ExpressionPtr Cast::copyWithNewChildren(
-    const std::vector<ExpressionPtr> &new_children) const {
-  DCHECK_EQ(getNumChildren(), new_children.size());
-  ScalarPtr scalar;
-  CHECK(SomeScalar::MatchesWithConditionalCast(new_children[0], &scalar))
-      << new_children[0]->toString();
-  return Create(scalar, target_type_);
-}
-
-::quickstep::Scalar *Cast::concretize(
-    const std::unordered_map<ExprId, const CatalogAttribute*> &substitution_map) const {
-  return new ::quickstep::ScalarUnaryExpression(::quickstep::NumericCastOperation::Instance(target_type_),
-                                                operand_->concretize(substitution_map));
-}
-
-void Cast::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("target_type");
-  inline_field_values->push_back(target_type_.getName());
-
-  non_container_child_field_names->push_back("operand");
-  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/Cast.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/Cast.hpp b/query_optimizer/expressions/Cast.hpp
deleted file mode 100644
index ac5bd02..0000000
--- a/query_optimizer/expressions/Cast.hpp
+++ /dev/null
@@ -1,121 +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_CAST_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_EXPRESSIONS_CAST_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 "utility/Macros.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-class CatalogAttribute;
-class Type;
-
-namespace optimizer {
-namespace expressions {
-
-/** \addtogroup OptimizerExpressions
- *  @{
- */
-
-class Cast;
-typedef std::shared_ptr<const Cast> CastPtr;
-
-/**
- * @brief Converts a value of a type to another type.
- */
-class Cast : public Scalar {
- public:
-  ExpressionType getExpressionType() const override { return ExpressionType::kCast; }
-
-  std::string getName() const override { return "Cast"; }
-
-  const Type& getValueType() const override { return target_type_; }
-
-  bool isConstant() const override { return operand_->isConstant(); }
-
-  /**
-   * @return The expression to be coerced.
-   */
-  const ScalarPtr& operand() const { return operand_; }
-
-  std::vector<AttributeReferencePtr> getReferencedAttributes() const override {
-    return operand_->getReferencedAttributes();
-  }
-
-  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 a Cast expression that converts \p operand to \p target_type.
-   *
-   * @param operand The input expression to be coerced.
-   * @param target_type The target type that the expression is converted to.
-   * @return A Cast expression.
-   */
-  static CastPtr Create(const ScalarPtr &operand, const Type &target_type) {
-    return CastPtr(new Cast(operand, target_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:
-  Cast(const ScalarPtr &operand, const Type &target_type)
-      : operand_(operand),
-        target_type_(target_type) {
-    addChild(operand);
-    DCHECK(target_type.isCoercibleFrom(operand->getValueType()));
-  }
-
-  ScalarPtr operand_;
-  const Type &target_type_;
-
-  DISALLOW_COPY_AND_ASSIGN(Cast);
-};
-
-/** @} */
-
-}  // namespace expressions
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_QUERY_OPTIMIZER_EXPRESSIONS_CAST_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/expressions/ComparisonExpression.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/ComparisonExpression.cpp b/query_optimizer/expressions/ComparisonExpression.cpp
deleted file mode 100644
index 8d93794..0000000
--- a/query_optimizer/expressions/ComparisonExpression.cpp
+++ /dev/null
@@ -1,105 +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/ComparisonExpression.hpp"
-
-#include <string>
-#include <unordered_map>
-#include <vector>
-
-#include "expressions/predicate/ComparisonPredicate.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/PatternMatcher.hpp"
-#include "query_optimizer/expressions/Scalar.hpp"
-#include "types/operations/comparisons/Comparison.hpp"
-#include "types/operations/comparisons/ComparisonID.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-namespace optimizer {
-namespace expressions {
-
-ComparisonExpression::ComparisonExpression(const Comparison &comparison,
-                                           const ScalarPtr &left,
-                                           const ScalarPtr &right)
-    : comparison_(comparison), left_(left), right_(right) {
-  DCHECK(comparison_.canCompareTypes(left->getValueType(),
-                                     right->getValueType()));
-  addChild(left_);
-  addChild(right_);
-}
-
-std::string ComparisonExpression::getName() const {
-  return comparison_.getName();
-}
-
-bool ComparisonExpression::isEqualityComparisonPredicate() const {
-  return comparison_.getComparisonID() == ComparisonID::kEqual;
-}
-
-ExpressionPtr ComparisonExpression::copyWithNewChildren(
-    const std::vector<ExpressionPtr> &new_children) const {
-  DCHECK_EQ(new_children.size(), children().size());
-  ScalarPtr left_operand;
-  ScalarPtr right_operand;
-  CHECK(SomeScalar::MatchesWithConditionalCast(new_children[0], &left_operand));
-  CHECK(SomeScalar::MatchesWithConditionalCast(new_children[1], &right_operand));
-  return ComparisonExpression::Create(comparison_, left_operand, right_operand);
-}
-
-std::vector<AttributeReferencePtr>
-ComparisonExpression::getReferencedAttributes() const {
-  std::vector<AttributeReferencePtr> referenced_attributes =
-      left_->getReferencedAttributes();
-  const std::vector<AttributeReferencePtr> referenced_attributes_by_right_operand =
-      right_->getReferencedAttributes();
-  referenced_attributes.insert(referenced_attributes.end(),
-                               referenced_attributes_by_right_operand.begin(),
-                               referenced_attributes_by_right_operand.end());
-  return referenced_attributes;
-}
-
-::quickstep::Predicate* ComparisonExpression::concretize(
-    const std::unordered_map<ExprId, const CatalogAttribute*> &substitution_map) const {
-  return new ::quickstep::ComparisonPredicate(
-      comparison_,
-      left_->concretize(substitution_map),
-      right_->concretize(substitution_map));
-}
-
-void ComparisonExpression::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_field_names->push_back("");
-  non_container_child_fields->push_back(left_);
-  non_container_child_fields->push_back(right_);
-}
-
-}  // namespace expressions
-}  // namespace optimizer
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/expressions/ComparisonExpression.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/ComparisonExpression.hpp b/query_optimizer/expressions/ComparisonExpression.hpp
deleted file mode 100644
index 011e04e..0000000
--- a/query_optimizer/expressions/ComparisonExpression.hpp
+++ /dev/null
@@ -1,136 +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_COMPARISON_EXPRESSION_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_EXPRESSIONS_COMPARISON_EXPRESSION_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 "query_optimizer/expressions/Scalar.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-
-class CatalogAttribute;
-class Comparison;
-class Predicate;
-
-namespace optimizer {
-namespace expressions {
-
-/** \addtogroup OptimizerExpressions
- *  @{
- */
-
-class ComparisonExpression;
-typedef std::shared_ptr<const ComparisonExpression> ComparisonExpressionPtr;
-
-/**
- * @brief Applies a comparison operator to two scalar expressions and returns a
- *        bool value.
- */
-class ComparisonExpression : public Predicate {
- public:
-  ExpressionType getExpressionType() const override {
-    return ExpressionType::kComparisonExpression;
-  }
-
-  bool isConstant() const override {
-    return left_->isConstant() && right_->isConstant();
-  }
-
-  std::string getName() const override;
-
-  /**
-   * @return The comparison operator.
-   */
-  const Comparison& comparison() const { return comparison_; }
-
-  /**
-   * @return The left operand.
-   */
-  const ScalarPtr& left() const { return left_; }
-
-  /**
-   * @return The right operand.
-   */
-  const ScalarPtr& right() const { return right_; }
-
-  bool isEqualityComparisonPredicate() const;
-
-  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 ComparisonExpression.
-   *
-   * @param comparison The comparison operator.
-   * @param left The left operand.
-   * @param right The right operand.
-   * @return An immutable ComparisonExpression.
-   */
-  static ComparisonExpressionPtr Create(const Comparison &comparison,
-                                        const ScalarPtr &left,
-                                        const ScalarPtr &right) {
-    return ComparisonExpressionPtr(
-        new ComparisonExpression(comparison, left, right));
-  }
-
- 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:
-  ComparisonExpression(const Comparison &comparison,
-                       const ScalarPtr &left,
-                       const ScalarPtr &right);
-
-  const Comparison &comparison_;
-  ScalarPtr left_;
-  ScalarPtr right_;
-
-  DISALLOW_COPY_AND_ASSIGN(ComparisonExpression);
-};
-
-/** @} */
-
-}  // namespace expressions
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_QUERY_OPTIMIZER_EXPRESSIONS_COMPARISON_EXPRESSION_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/expressions/Exists.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/Exists.cpp b/query_optimizer/expressions/Exists.cpp
deleted file mode 100644
index a7b0201..0000000
--- a/query_optimizer/expressions/Exists.cpp
+++ /dev/null
@@ -1,57 +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/Exists.hpp"
-
-#include <vector>
-#include <string>
-
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/ExprId.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-class CatalogAttribute;
-class Predicate;
-
-namespace optimizer {
-namespace expressions {
-
-::quickstep::Predicate* Exists::concretize(
-    const std::unordered_map<ExprId, const CatalogAttribute*> &substitution_map) const {
-  LOG(FATAL) << "Exists predicate should not be concretized";
-  return nullptr;
-}
-
-void Exists::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("exists_subquery");
-  non_container_child_fields->push_back(exists_subquery_);
-}
-
-}  // namespace expressions
-}  // namespace optimizer
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/expressions/Exists.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/Exists.hpp b/query_optimizer/expressions/Exists.hpp
deleted file mode 100644
index 0b75de5..0000000
--- a/query_optimizer/expressions/Exists.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_EXISTS_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_EXPRESSIONS_EXISTS_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 "query_optimizer/expressions/SubqueryExpression.hpp"
-#include "utility/Macros.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-class CatalogAttribute;
-class Predicate;
-
-namespace optimizer {
-namespace expressions {
-
-/** \addtogroup OptimizerExpressions
- *  @{
- */
-
-class Exists;
-typedef std::shared_ptr<const Exists> ExistsPtr;
-
-/**
- * @brief EXISTS predicate expression.
- */
-class Exists : public Predicate {
- public:
-  ExpressionType getExpressionType() const override {
-    return ExpressionType::kExists;
-  }
-
-  std::string getName() const override {
-    return "Exists";
-  }
-
-  bool isConstant() const override {
-    return false;
-  }
-
-  /**
-   * @return The subquery expression for this EXISTS predicate.
-   */
-  const SubqueryExpressionPtr& exists_subquery() const {
-    return exists_subquery_;
-  }
-
-  ExpressionPtr copyWithNewChildren(
-      const std::vector<ExpressionPtr> &new_children) const override {
-    DCHECK_EQ(1u, new_children.size());
-    return Create(std::static_pointer_cast<const SubqueryExpression>(new_children[0]));
-  }
-
-  std::vector<AttributeReferencePtr> getReferencedAttributes() const override {
-    return {};
-  }
-
-  ::quickstep::Predicate* concretize(
-      const std::unordered_map<ExprId, const CatalogAttribute*> &substitution_map) const override;
-
-  /**
-   * @brief Create an Exists predicate expression.
-   *
-   * @param exists_subquery The subquery expression for this EXISTS predicate.
-   * @return An immutable Exists expression node.
-   */
-  static ExistsPtr Create(const SubqueryExpressionPtr &exists_subquery) {
-    return ExistsPtr(new Exists(exists_subquery));
-  }
-
- 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 Exists(const SubqueryExpressionPtr &exists_subquery)
-      : exists_subquery_(exists_subquery) {
-    addChild(exists_subquery_);
-  }
-
-  SubqueryExpressionPtr exists_subquery_;
-
-  DISALLOW_COPY_AND_ASSIGN(Exists);
-};
-
-/** @} */
-
-}  // namespace expressions
-}  // namespace optimizer
-}  // namespace quickstep
-
-
-#endif /* QUICKSTEP_QUERY_OPTIMIZER_EXPRESSIONS_EXISTS_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/expressions/ExprId.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/ExprId.hpp b/query_optimizer/expressions/ExprId.hpp
deleted file mode 100644
index be5dd6a..0000000
--- a/query_optimizer/expressions/ExprId.hpp
+++ /dev/null
@@ -1,42 +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_EXPR_ID_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER__EXPRESSIONS_EXPR_ID_HPP_
-
-namespace quickstep {
-namespace optimizer {
-namespace expressions {
-
-/** \addtogroup OptimizerExpressions
- *  @{
- */
-
-/**
- * @brief Expression ID for a named expression.
- */
-typedef int ExprId;
-
-/** @} */
-
-}  // namespace expressions
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_QUERY_OPTIMIZER__EXPRESSIONS_EXPR_ID_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/expressions/Expression.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/Expression.hpp b/query_optimizer/expressions/Expression.hpp
deleted file mode 100644
index 7127047..0000000
--- a/query_optimizer/expressions/Expression.hpp
+++ /dev/null
@@ -1,96 +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_EXPRESSION_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_EXPRESSIONS_EXPRESSION_HPP_
-
-#include <memory>
-#include <map>
-#include <vector>
-
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/ExpressionType.hpp"
-#include "types/Type.hpp"
-#include "utility/Macros.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-namespace optimizer {
-namespace expressions {
-
-/** \addtogroup OptimizerExpressions
- *  @{
- */
-
-class AttributeReference;
-class Expression;
-
-typedef std::shared_ptr<const Expression> ExpressionPtr;
-
-/**
- * @brief Base class for all expressions in the query optimizer.
- */
-class Expression : public OptimizerTree<Expression> {
- public:
-  /**
-   * @brief Destructor.
-   */
-  ~Expression() override {}
-
-  /**
-   * @brief Returns the expression type.
-   *
-   * @return ExpressionType of this expression.
-   */
-  virtual ExpressionType getExpressionType() const = 0;
-
-  /**
-   * @brief Returns the type of the output.
-   *
-   * @return The type of the output.
-   */
-  virtual const Type& getValueType() const = 0;
-
-  /**
-   * @brief Returns AttributeReferences referenced by this expression.
-   *
-   * @return A vector of AttributeReference referenced by this expression.
-   */
-  virtual std::vector<std::shared_ptr<const AttributeReference>> getReferencedAttributes() const = 0;
-
-  /**
-   * @return True if this expression is constant.
-   */
-  virtual bool isConstant() const = 0;
-
- protected:
-  Expression() {}
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(Expression);
-};
-
-/** @} */
-
-}  // namespace expressions
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_QUERY_OPTIMIZER_EXPRESSIONS_EXPRESSION_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/expressions/ExpressionType.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/ExpressionType.hpp b/query_optimizer/expressions/ExpressionType.hpp
deleted file mode 100644
index 5008f1d..0000000
--- a/query_optimizer/expressions/ExpressionType.hpp
+++ /dev/null
@@ -1,62 +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_EXPRESSION_TYPE_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_EXPRESSIONS_EXPRESSION_TYPE_HPP_
-
-namespace quickstep {
-namespace optimizer {
-namespace expressions {
-
-/** \addtogroup OptimizerExpressions
- *  @{
- */
-
-/**
- * @brief Optimizer expression types.
- **/
-enum class ExpressionType {
-  kAggregateFunction,
-  kAlias,
-  kAttributeReference,
-  kBinaryExpression,
-  kCast,
-  kComparisonExpression,
-  kExists,
-  kInTableQuery,
-  kInValueList,
-  kLogicalAnd,
-  kLogicalOr,
-  kLogicalNot,
-  kPredicateLiteral,
-  kScalarLiteral,
-  kSearchedCase,
-  kSimpleCase,
-  kSubqueryExpression,
-  kUnaryExpression,
-  kWindowAggregateFunction
-};
-
-/** @} */
-
-}  // namespace expressions
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_QUERY_OPTIMIZER_EXPRESSIONS_EXPRESSION_TYPE_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/expressions/ExpressionUtil.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/ExpressionUtil.cpp b/query_optimizer/expressions/ExpressionUtil.cpp
deleted file mode 100644
index c9541ef..0000000
--- a/query_optimizer/expressions/ExpressionUtil.cpp
+++ /dev/null
@@ -1,73 +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/ExpressionUtil.hpp"
-
-#include <vector>
-
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "query_optimizer/expressions/NamedExpression.hpp"
-
-namespace quickstep {
-namespace optimizer {
-namespace expressions {
-
-AttributeReferencePtr ToRef(const NamedExpressionPtr &expression) {
-  return AttributeReference::Create(expression->id(),
-                                    expression->attribute_name(),
-                                    expression->attribute_alias(),
-                                    expression->relation_name(),
-                                    expression->getValueType(),
-                                    AttributeReferenceScope::kLocal);
-}
-
-std::vector<AttributeReferencePtr> GetNullableAttributeVector(
-    const std::vector<AttributeReferencePtr> &attributes) {
-  std::vector<AttributeReferencePtr> nullable_attributes;
-  for (const auto &attr : attributes) {
-    if (!attr->getValueType().isNullable()) {
-      nullable_attributes.emplace_back(
-          AttributeReference::Create(attr->id(),
-                                     attr->attribute_name(),
-                                     attr->attribute_alias(),
-                                     attr->relation_name(),
-                                     attr->getValueType().getNullableVersion(),
-                                     attr->scope()));
-    } else {
-      nullable_attributes.emplace_back(attr);
-    }
-  }
-  return nullable_attributes;
-}
-
-std::vector<AttributeReferencePtr> GetAttributeReferencesWithinScope(
-    const std::vector<AttributeReferencePtr> &attributes,
-    const AttributeReferenceScope scope) {
-  std::vector<AttributeReferencePtr> filtered_attributes;
-  for (const auto &attr_it : attributes) {
-    if (attr_it->scope() == scope) {
-      filtered_attributes.emplace_back(attr_it);
-    }
-  }
-  return filtered_attributes;
-}
-
-}  // namespace expressions
-}  // namespace optimizer
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/expressions/ExpressionUtil.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/ExpressionUtil.hpp b/query_optimizer/expressions/ExpressionUtil.hpp
deleted file mode 100644
index 422d5ab..0000000
--- a/query_optimizer/expressions/ExpressionUtil.hpp
+++ /dev/null
@@ -1,243 +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_EXPRESSION_UTIL_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_EXPRESSIONS_EXPRESSION_UTIL_HPP_
-
-#include <cstddef>
-#include <functional>
-#include <memory>
-#include <unordered_set>
-#include <vector>
-
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "query_optimizer/expressions/ExprId.hpp"
-#include "query_optimizer/expressions/NamedExpression.hpp"
-#include "query_optimizer/expressions/PatternMatcher.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-namespace optimizer {
-namespace expressions {
-
-/** \addtogroup OptimizerExpressions
- *  @{
- */
-
-/**
- * @brief ExprID comparator for two named expressions.
- */
-struct NamedExpressionCompare {
-  inline bool operator()(const NamedExpressionPtr &lhs,
-                         const NamedExpressionPtr &rhs) const {
-    return lhs->id() < rhs->id();
-  }
-};
-
-/**
- * @brief Implements the equal function for named expressions.
- */
-struct NamedExpressionEqual {
-  inline bool operator()(const NamedExpressionPtr &lhs,
-                         const NamedExpressionPtr &rhs) const {
-    return lhs->id() == rhs->id();
-  }
-};
-
-/**
- * @brief Implements the function function for named expressions.
- */
-struct NamedExpressionHash {
-  inline std::size_t operator()(const NamedExpressionPtr &named_expr) const {
-    return std::hash<expressions::ExprId>()(named_expr->id());
-  }
-};
-
-typedef std::unordered_set<NamedExpressionPtr, NamedExpressionHash, NamedExpressionEqual> UnorderedNamedExpressionSet;
-typedef std::unordered_set<AttributeReferencePtr, NamedExpressionHash, NamedExpressionEqual> UnorderedAttributeSet;
-
-/**
- * @brief Checks whether \p expression_to_check is contained by \p expressions.
- *
- * @param expressions A list of expressions to be checked with.
- * @param expression_to_check The expression that is to be checked if it is in
- *                            \p expressions.
- * @return True if \p expression_to_check is contained by \p expressions.
- */
-template <class NamedExpressionType1, class NamedExpressionType2>
-bool ContainsExpression(
-    const std::vector<std::shared_ptr<const NamedExpressionType1>> &expressions,
-    const std::shared_ptr<const NamedExpressionType2> &expression_to_check) {
-  for (const std::shared_ptr<const NamedExpressionType1> &expression :
-       expressions) {
-    if (expression->equals(expression_to_check)) {
-      return true;
-    }
-  }
-  return false;
-}
-
-/**
- * @brief Checks whether expr_id equals any expression's id in \p expressions.
- *
- * @param expressions A list of expressions to be checked with.
- * @param expr_id The ExprId that is to be checked if it is in \p expressions.
- * @return True if \p expr_id is contained by \p expressions.
- */
-template <class NamedExpressionType>
-bool ContainsExprId(
-    const std::vector<std::shared_ptr<const NamedExpressionType>> &expressions,
-    const ExprId expr_id) {
-  for (const std::shared_ptr<const NamedExpressionType> &expression : expressions) {
-    if (expression->id() == expr_id) {
-      return true;
-    }
-  }
-  return false;
-}
-
-/**
- * @brief Checks whether \p left is a subset of \p right.
- *
- * @param left The left operand of the subset operator (i.e. the one that may be
- *             a subset).
- * @param right The right operand of the subset operator (i.e. the one that may
- *              contain the other operand).
- * @return True if \p left is a subset of \p right.
- */
-template <class NamedExpressionType>
-bool SubsetOfExpressions(
-    const std::vector<std::shared_ptr<const NamedExpressionType>> &left,
-    const std::vector<std::shared_ptr<const NamedExpressionType>> &right) {
-  UnorderedNamedExpressionSet supset(right.begin(), right.end());
-  for (const std::shared_ptr<const NamedExpressionType> &expr : left) {
-    if (supset.find(expr) == supset.end()) {
-      return false;
-    }
-  }
-  return true;
-}
-
-/**
- * @brief Make a copy of the input attribute vector with each attribute's type
- *        converted as nullable.
- *
- * @param attributes The input attribute vector.
- * @return The nullable copy of the input attribute vector.
- */
-std::vector<AttributeReferencePtr> GetNullableAttributeVector(
-    const std::vector<AttributeReferencePtr> &attributes);
-
-/**
- * @brief Returns a reference to this named expression.
- *
- * @return An AttributeReference of this named expression.
- */
-AttributeReferencePtr ToRef(const NamedExpressionPtr &expression);
-
-/**
- * @brief Given a vector of expressions and a vector of attributes, return a
- *        bool vector that indicates whether each expression is refering to
- *        ANY attribute in the attribute vector.
- *
- * @param expressions The vector of expressions to be checked.
- * @param attributes The vector of attributes to be checked.
- * @return A vector of bools indicating whether each expression is refering to
- *         any attribute in the attribute vector. Note that the length of this
- *         bool vector equals the length of \p expressions.
- */
-template <class NamedExpressionType>
-std::vector<bool> MarkExpressionsReferingAnyAttribute(
-    const std::vector<std::shared_ptr<const NamedExpressionType>> &expressions,
-    const std::vector<AttributeReferencePtr> &attributes) {
-  std::vector<bool> matches;
-  UnorderedAttributeSet attr_set(attributes.begin(), attributes.end());
-  for (std::size_t i = 0; i < expressions.size(); ++i) {
-    for (const auto referenced_attr : expressions[i]->getReferencedAttributes()) {
-      if (attr_set.find(referenced_attr) != attr_set.end()) {
-        matches.emplace_back(true);
-      } else {
-        matches.emplace_back(false);
-      }
-    }
-  }
-  return matches;
-}
-
-/**
- * @brief Filter a vector of AttributeReferencePtr to get those which are in
- *        the specified scope.
- *
- * @param attributes The vector of AttributeReferencePtr to be filtered.
- * @param scope The specified reference scope.
- *
- * @return A vector of AttributeReferencePtr within the specified scope.
- */
-std::vector<AttributeReferencePtr> GetAttributeReferencesWithinScope(
-    const std::vector<AttributeReferencePtr> &attributes,
-    const AttributeReferenceScope scope);
-
-/**
- * @brief Creates a list of AttributeReferences from a list of NamedExpressions
- *        with each AttributeReference referencing a distinct NamedExpression.
- *        The input and the output have 1:1 matching.
- *
- * @param expressions A list of NamedExpressions to be converted to
- *                    AttributeReferences.
- * @return AttributeReferences for the NamedExpressions.
- */
-template <class NamedExpressionType>
-std::vector<AttributeReferencePtr> ToRefVector(
-    const std::vector<std::shared_ptr<const NamedExpressionType>> &expressions) {
-  std::vector<AttributeReferencePtr> cast_expressions;
-  for (const std::shared_ptr<const NamedExpressionType> &expression :
-       expressions) {
-    cast_expressions.push_back(ToRef(expression));
-  }
-  return cast_expressions;
-}
-
-/**
- * @brief Casts a list of Expressions to a list of NamedExpressions.
- *
- * @param expressions A list of expressions to be cast to NamedExpression. The
- *                    expressions must be of type NamedExpression.
- * @return A list of casted NamedExpressions.
- */
-template <class ExpressionType>
-std::vector<NamedExpressionPtr> ToNamedExpressions(
-    const std::vector<std::shared_ptr<const ExpressionType>> &expressions) {
-  std::vector<NamedExpressionPtr> cast_expressions;
-  for (const std::shared_ptr<const ExpressionType> &expression : expressions) {
-    NamedExpressionPtr cast_expression;
-    CHECK(SomeNamedExpression::MatchesWithConditionalCast(expression, &cast_expression))
-        << expression->toString();
-    cast_expressions.push_back(cast_expression);
-  }
-  return cast_expressions;
-}
-
-/** @} */
-
-}  // namespace expressions
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_QUERY_OPTIMIZER_EXPRESSIONS_EXPRESSION_UTIL_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/expressions/InTableQuery.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/InTableQuery.cpp b/query_optimizer/expressions/InTableQuery.cpp
deleted file mode 100644
index 7122664..0000000
--- a/query_optimizer/expressions/InTableQuery.cpp
+++ /dev/null
@@ -1,55 +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/InTableQuery.hpp"
-
-#include <string>
-#include <vector>
-
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/ExprId.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-namespace optimizer {
-namespace expressions {
-
-::quickstep::Predicate* InTableQuery::concretize(
-    const std::unordered_map<ExprId, const CatalogAttribute*> &substitution_map) const {
-  LOG(FATAL) << "InTableQuery predicate should not be concretized";
-}
-
-void InTableQuery::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("test_expression");
-  non_container_child_fields->push_back(test_expression_);
-
-  non_container_child_field_names->push_back("table_query");
-  non_container_child_fields->push_back(table_query_);
-}
-
-}  // namespace expressions
-}  // namespace optimizer
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/expressions/InTableQuery.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/InTableQuery.hpp b/query_optimizer/expressions/InTableQuery.hpp
deleted file mode 100644
index 8e6d0e7..0000000
--- a/query_optimizer/expressions/InTableQuery.hpp
+++ /dev/null
@@ -1,145 +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_TABLE_QUERY_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_EXPRESSIONS_IN_TABLE_QUERY_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 "query_optimizer/expressions/Scalar.hpp"
-#include "query_optimizer/expressions/SubqueryExpression.hpp"
-#include "utility/Macros.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-class CatalogAttribute;
-class Predicate;
-
-namespace optimizer {
-namespace expressions {
-
-/** \addtogroup OptimizerExpressions
- *  @{
- */
-
-class InTableQuery;
-typedef std::shared_ptr<const InTableQuery> InTableQueryPtr;
-
-/**
- * @brief IN predicate with a subquery.
- */
-class InTableQuery : public Predicate {
- public:
-  ExpressionType getExpressionType() const override {
-    return ExpressionType::kInTableQuery;
-  }
-
-  std::string getName() const override {
-    return "InTableQuery";
-  }
-
-  bool isConstant() const override {
-    return false;
-  }
-
-  /**
-   * @return The expression to test with the result of the table subquery.
-   */
-  const ScalarPtr& test_expression() const {
-    return test_expression_;
-  }
-
-  /**
-   * @return The table subquery that returns a single column to search for
-   *         the value of the test expression.
-   */
-  const SubqueryExpressionPtr& table_query() const {
-    return table_query_;
-  }
-
-  ExpressionPtr copyWithNewChildren(
-      const std::vector<ExpressionPtr> &new_children) const override {
-    DCHECK_EQ(2u, new_children.size());
-    return Create(std::static_pointer_cast<const Scalar>(new_children[0]),
-                  std::static_pointer_cast<const SubqueryExpression>(new_children[1]));
-  }
-
-  std::vector<AttributeReferencePtr> getReferencedAttributes() const override {
-    return {};
-  }
-
-  ::quickstep::Predicate* concretize(
-      const std::unordered_map<ExprId, const CatalogAttribute*> &substitution_map) const override;
-
-  /**
-   * @brief Create an IN predicate with a subquery.
-   *
-   * @param test_expression The expression to test with the result of a table subquery.
-   * @param table_query The table subquery that returns a single column to search for
-   *        the value of the test expression.
-   *
-   * @return An immutable IN predicate node.
-   */
-  static InTableQueryPtr Create(const ScalarPtr &test_expression,
-                                const SubqueryExpressionPtr &table_query) {
-    return InTableQueryPtr(new InTableQuery(test_expression, table_query));
-  }
-
- 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:
-  InTableQuery(const ScalarPtr &test_expression,
-               const SubqueryExpressionPtr &table_query)
-      : test_expression_(test_expression),
-        table_query_(table_query) {
-    addChild(test_expression_);
-    addChild(table_query_);
-  }
-
-  ScalarPtr test_expression_;
-  SubqueryExpressionPtr table_query_;
-
-  DISALLOW_COPY_AND_ASSIGN(InTableQuery);
-};
-
-/** @} */
-
-}  // namespace expressions
-}  // namespace optimizer
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_QUERY_OPTIMIZER_EXPRESSIONS_IN_TABLE_QUERY_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/expressions/InValueList.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/InValueList.cpp b/query_optimizer/expressions/InValueList.cpp
deleted file mode 100644
index 0451db7..0000000
--- a/query_optimizer/expressions/InValueList.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/InValueList.hpp"
-
-#include <string>
-#include <vector>
-
-#include "expressions/predicate/DisjunctionPredicate.hpp"
-#include "expressions/predicate/Predicate.hpp"
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/ComparisonExpression.hpp"
-#include "query_optimizer/expressions/ExprId.hpp"
-#include "query_optimizer/expressions/Predicate.hpp"
-#include "query_optimizer/expressions/Scalar.hpp"
-#include "types/operations/comparisons/ComparisonID.hpp"
-#include "types/operations/comparisons/ComparisonFactory.hpp"
-#include "utility/Cast.hpp"
-
-namespace quickstep {
-namespace optimizer {
-namespace expressions {
-
-::quickstep::Predicate* InValueList::concretize(
-    const std::unordered_map<ExprId, const CatalogAttribute*> &substitution_map) const {
-  std::unique_ptr<quickstep::DisjunctionPredicate>
-      disjunction_predicate(new quickstep::DisjunctionPredicate());
-  for (const ScalarPtr &match_expression : match_expressions_) {
-    const PredicatePtr match_predicate =
-        ComparisonExpression::Create(
-            quickstep::ComparisonFactory::GetComparison(quickstep::ComparisonID::kEqual),
-            test_expression_,
-            match_expression);
-
-    disjunction_predicate->addPredicate(
-        match_predicate->concretize(substitution_map));
-  }
-  return disjunction_predicate.release();
-}
-
-void InValueList::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("test_expression");
-  non_container_child_fields->push_back(test_expression_);
-
-  container_child_field_names->push_back("match_expressions");
-  container_child_fields->push_back(
-      CastSharedPtrVector<OptimizerTreeBase>(match_expressions_));
-}
-
-}  // namespace expressions
-}  // namespace optimizer
-}  // namespace quickstep


[03/51] [abbrv] [partial] incubator-quickstep git commit: remove c++ files

Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/resolver/Resolver.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/resolver/Resolver.cpp b/query_optimizer/resolver/Resolver.cpp
deleted file mode 100644
index 38ec24a..0000000
--- a/query_optimizer/resolver/Resolver.cpp
+++ /dev/null
@@ -1,3129 +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/resolver/Resolver.hpp"
-
-#include <algorithm>
-#include <map>
-#include <memory>
-#include <set>
-#include <string>
-#include <unordered_map>
-#include <unordered_set>
-#include <vector>
-#include <utility>
-
-#include "catalog/CatalogDatabase.hpp"
-#include "expressions/aggregation/AggregateFunction.hpp"
-#include "expressions/aggregation/AggregateFunctionFactory.hpp"
-#include "expressions/table_generator/GeneratorFunction.hpp"
-#include "expressions/table_generator/GeneratorFunctionFactory.hpp"
-#include "expressions/table_generator/GeneratorFunctionHandle.hpp"
-#include "expressions/window_aggregation/WindowAggregateFunction.hpp"
-#include "expressions/window_aggregation/WindowAggregateFunctionFactory.hpp"
-#include "parser/ParseAssignment.hpp"
-#include "parser/ParseBasicExpressions.hpp"
-#include "parser/ParseBlockProperties.hpp"
-#include "parser/ParseCaseExpressions.hpp"
-#include "parser/ParseExpression.hpp"
-#include "parser/ParseGeneratorTableReference.hpp"
-#include "parser/ParseGroupBy.hpp"
-#include "parser/ParseHaving.hpp"
-#include "parser/ParseJoinedTableReference.hpp"
-#include "parser/ParseLimit.hpp"
-#include "parser/ParseLiteralValue.hpp"
-#include "parser/ParseOrderBy.hpp"
-#include "parser/ParsePredicate.hpp"
-#include "parser/ParsePredicateExists.hpp"
-#include "parser/ParsePredicateInTableQuery.hpp"
-#include "parser/ParseSelect.hpp"
-#include "parser/ParseSelectionClause.hpp"
-#include "parser/ParseSimpleTableReference.hpp"
-#include "parser/ParseStatement.hpp"
-#include "parser/ParseString.hpp"
-#include "parser/ParseSubqueryExpression.hpp"
-#include "parser/ParseSubqueryTableReference.hpp"
-#include "parser/ParseTableReference.hpp"
-#include "parser/ParseWindow.hpp"
-#include "query_optimizer/OptimizerContext.hpp"
-#include "query_optimizer/Validator.hpp"
-#include "query_optimizer/expressions/AggregateFunction.hpp"
-#include "query_optimizer/expressions/Alias.hpp"
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "query_optimizer/expressions/BinaryExpression.hpp"
-#include "query_optimizer/expressions/Cast.hpp"
-#include "query_optimizer/expressions/ComparisonExpression.hpp"
-#include "query_optimizer/expressions/Exists.hpp"
-#include "query_optimizer/expressions/ExprId.hpp"
-#include "query_optimizer/expressions/ExpressionUtil.hpp"
-#include "query_optimizer/expressions/InTableQuery.hpp"
-#include "query_optimizer/expressions/InValueList.hpp"
-#include "query_optimizer/expressions/LogicalAnd.hpp"
-#include "query_optimizer/expressions/LogicalNot.hpp"
-#include "query_optimizer/expressions/LogicalOr.hpp"
-#include "query_optimizer/expressions/NamedExpression.hpp"
-#include "query_optimizer/expressions/PatternMatcher.hpp"
-#include "query_optimizer/expressions/Predicate.hpp"
-#include "query_optimizer/expressions/PredicateLiteral.hpp"
-#include "query_optimizer/expressions/Scalar.hpp"
-#include "query_optimizer/expressions/ScalarLiteral.hpp"
-#include "query_optimizer/expressions/SearchedCase.hpp"
-#include "query_optimizer/expressions/SimpleCase.hpp"
-#include "query_optimizer/expressions/SubqueryExpression.hpp"
-#include "query_optimizer/expressions/UnaryExpression.hpp"
-#include "query_optimizer/expressions/WindowAggregateFunction.hpp"
-#include "query_optimizer/logical/Aggregate.hpp"
-#include "query_optimizer/logical/CopyFrom.hpp"
-#include "query_optimizer/logical/CreateIndex.hpp"
-#include "query_optimizer/logical/CreateTable.hpp"
-#include "query_optimizer/logical/DeleteTuples.hpp"
-#include "query_optimizer/logical/DropTable.hpp"
-#include "query_optimizer/logical/Filter.hpp"
-#include "query_optimizer/logical/HashJoin.hpp"
-#include "query_optimizer/logical/InsertSelection.hpp"
-#include "query_optimizer/logical/InsertTuple.hpp"
-#include "query_optimizer/logical/MultiwayCartesianJoin.hpp"
-#include "query_optimizer/logical/Project.hpp"
-#include "query_optimizer/logical/Sample.hpp"
-#include "query_optimizer/logical/SharedSubplanReference.hpp"
-#include "query_optimizer/logical/Sort.hpp"
-#include "query_optimizer/logical/TableGenerator.hpp"
-#include "query_optimizer/logical/TableReference.hpp"
-#include "query_optimizer/logical/TopLevelPlan.hpp"
-#include "query_optimizer/logical/UpdateTable.hpp"
-#include "query_optimizer/logical/WindowAggregate.hpp"
-#include "query_optimizer/resolver/NameResolver.hpp"
-#include "storage/StorageBlockLayout.pb.h"
-#include "storage/StorageConstants.hpp"
-#include "types/IntType.hpp"
-#include "types/Type.hpp"
-#include "types/TypedValue.hpp"
-#include "types/TypeFactory.hpp"
-#include "types/operations/binary_operations/BinaryOperation.hpp"
-#include "types/operations/comparisons/Comparison.hpp"
-#include "types/operations/comparisons/ComparisonFactory.hpp"
-#include "types/operations/comparisons/ComparisonID.hpp"
-#include "types/operations/unary_operations/DateExtractOperation.hpp"
-#include "types/operations/unary_operations/SubstringOperation.hpp"
-#include "types/operations/unary_operations/UnaryOperation.hpp"
-#include "utility/PtrList.hpp"
-#include "utility/PtrVector.hpp"
-#include "utility/SqlError.hpp"
-#include "utility/StringUtil.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-namespace optimizer {
-namespace resolver {
-
-namespace E = ::quickstep::optimizer::expressions;
-namespace L = ::quickstep::optimizer::logical;
-
-struct Resolver::ExpressionResolutionInfo {
-  /**
-   * @brief Constructs an ExpressionResolutionInfo that disallows aggregate
-   *        expressions.
-   *
-   * @param name_resolver_in The name resolver.
-   * @param clause_name The name of the current clause. This is only used to
-   *                    display errors when there is an aggregate expression.
-   * @param select_list_info info for SELECT-list expressions. NULL if
-   *                         references to SELECT-list expressions are not
-   *                         allowed.
-   */
-  ExpressionResolutionInfo(const NameResolver &name_resolver_in,
-                           const std::string &clause_name,
-                           SelectListInfo *select_list_info_in)
-      : name_resolver(name_resolver_in),
-        not_allow_aggregate_here(clause_name),
-        select_list_info(select_list_info_in) {}
-
-  /**
-   * @brief Constructs an ExpressionResolutionInfo that allows aggregate
-   *        expressions. Does not take ownership of
-   *        \p query_aggregation_info_in.
-   *
-   * @param name_resolver_in The name resolver.
-   * @param query_aggregation_info_in Container for aggregate expressions.
-   * @param select_list_info info for SELECT-list expressions. NULL if
-   *                         references to SELECT-list expressions are not
-   *                         allowed.
-   */
-  ExpressionResolutionInfo(const NameResolver &name_resolver_in,
-                           QueryAggregationInfo *query_aggregation_info_in,
-                           WindowAggregationInfo *window_aggregation_info_in,
-                           SelectListInfo *select_list_info_in)
-      : name_resolver(name_resolver_in),
-        query_aggregation_info(query_aggregation_info_in),
-        window_aggregation_info(window_aggregation_info_in),
-        select_list_info(select_list_info_in) {}
-
-  /**
-   * @brief Constructor an ExpressionResolutionInfo with parameters inherited
-   *        from another ExpressionResolutionInfo.
-   *
-   * @param parent The ExpressionResolutionInfo where the parameters are
-   *               inherited from.
-   */
-  explicit ExpressionResolutionInfo(const ExpressionResolutionInfo &parent)
-      : name_resolver(parent.name_resolver),
-        not_allow_aggregate_here(parent.not_allow_aggregate_here),
-        query_aggregation_info(parent.query_aggregation_info),
-        window_aggregation_info(parent.window_aggregation_info),
-        select_list_info(parent.select_list_info) {}
-
-  /**
-   * @return True if the expression contains an aggregate function.
-   */
-  bool hasAggregate() const { return parse_aggregate_expression != nullptr; }
-
-  /**
-   * @return True if the expression contains a window aggregate function.
-   **/
-  bool hasWindowAggregate() const {
-    return parse_window_aggregate_expression != nullptr;
-  }
-
-  const NameResolver &name_resolver;
-  // Empty if aggregations are allowed.
-  const std::string not_allow_aggregate_here;
-
-  // Can be NULL if aggregations are not allowed.
-  QueryAggregationInfo *query_aggregation_info = nullptr;
-
-  // Alias expressions that wraps window aggregate functions.
-  WindowAggregationInfo *window_aggregation_info = nullptr;
-
-  // Can be NULL if alias references to SELECT-list expressions are not allowed.
-  SelectListInfo *select_list_info = nullptr;
-  // The first aggregate in the expression.
-  const ParseTreeNode *parse_aggregate_expression = nullptr;
-  // The first window aggregate in the expression.
-  const ParseTreeNode *parse_window_aggregate_expression = nullptr;
-};
-
-struct Resolver::QueryAggregationInfo {
-  explicit QueryAggregationInfo(bool has_group_by_in)
-      : has_group_by(has_group_by_in) {}
-
-  // Whether the current query block has a GROUP BY.
-  const bool has_group_by;
-  // Alias expressions that wraps aggregate functions.
-  std::vector<E::AliasPtr> aggregate_expressions;
-};
-
-struct Resolver::WindowPlan {
-  WindowPlan(const L::LogicalPtr &logical_plan_in,
-             E::WindowInfo &&window_info_in)  // NOLINT(whitespace/operators)
-      : logical_plan(logical_plan_in),
-        window_info(std::move(window_info_in)) {}
-
-  const L::LogicalPtr logical_plan;
-  const E::WindowInfo window_info;
-};
-
-struct Resolver::WindowAggregationInfo {
-  explicit WindowAggregationInfo(const std::unordered_map<std::string, WindowPlan> &window_map_in)
-      : window_map(window_map_in) {}
-
-  // Whether the current query block has a GROUP BY.
-  const std::unordered_map<std::string, WindowPlan> window_map;
-  // Alias expressions that wraps window aggregate functions.
-  std::vector<E::AliasPtr> window_aggregate_expressions;
-};
-
-struct Resolver::SelectListInfo {
- public:
-  /**
-   * @brief Constructor.
-   *
-   * @param select_list_expressions_in SELECT-list expressions.
-   * @param has_aggregate_per_expression_in
-   *            For each SELECT-list expression, indicates whether it contains
-   *            an aggregate.
-   */
-  SelectListInfo(
-      const std::vector<E::NamedExpressionPtr> &select_list_expressions_in,
-      const std::vector<bool> &has_aggregate_per_expression_in)
-      : select_list_expressions(select_list_expressions_in),
-        has_aggregate_per_expression(has_aggregate_per_expression_in),
-        is_referenced(select_list_expressions.size(), false) {
-    for (std::vector<E::NamedExpressionPtr>::size_type idx = 0;
-         idx < select_list_expressions.size();
-         ++idx) {
-      if (!NameResolver::IsInternalName(
-              select_list_expressions[idx]->attribute_alias())) {
-        const std::string lower_alias =
-            ToLower(select_list_expressions[idx]->attribute_alias());
-        if (alias_to_expression_map.find(lower_alias) !=
-            alias_to_expression_map.end()) {
-          alias_to_expression_map[lower_alias] = -1;
-        } else {
-          alias_to_expression_map[lower_alias] = idx;
-        }
-      }
-    }
-  }
-
-  /**
-   * @return The map from each alias to the 0-based position of the
-   *         corresponding expression in the <select_list_expressions>.
-   */
-  const std::map<std::string, int> &getAliasMap() const {
-    return alias_to_expression_map;
-  }
-
-  const std::vector<E::NamedExpressionPtr> &select_list_expressions;
-
-  // Has 1:1 matching with <select_list_expressions>.
-  // True if the corresponding expression has an aggregate.
-  const std::vector<bool> &has_aggregate_per_expression;
-
-  // Has 1:1 matching with <select_list_expressions>.
-  // True if the corresponding expression is referenced by an
-  // ordinal number or an alias.
-  std::vector<bool> is_referenced;
-
- private:
-  // Map from the alias to the position of the corresponding expression.
-  // Map to -1 if the alias is ambiguous.
-  std::map<std::string, int> alias_to_expression_map;
-};
-
-L::LogicalPtr Resolver::resolve(const ParseStatement &parse_query) {
-  switch (parse_query.getStatementType()) {
-    case ParseStatement::kCopyFrom:
-      context_->set_is_catalog_changed();
-      logical_plan_ = resolveCopyFrom(
-          static_cast<const ParseStatementCopyFrom&>(parse_query));
-      break;
-    case ParseStatement::kCreateTable:
-      context_->set_is_catalog_changed();
-      logical_plan_ = resolveCreateTable(
-          static_cast<const ParseStatementCreateTable&>(parse_query));
-      break;
-    case ParseStatement::kCreateIndex:
-      context_->set_is_catalog_changed();
-      logical_plan_ = resolveCreateIndex(
-          static_cast<const ParseStatementCreateIndex&>(parse_query));
-      break;
-    case ParseStatement::kDelete:
-      context_->set_is_catalog_changed();
-      logical_plan_ =
-          resolveDelete(static_cast<const ParseStatementDelete&>(parse_query));
-      break;
-    case ParseStatement::kDropTable:
-      context_->set_is_catalog_changed();
-      logical_plan_ = resolveDropTable(
-          static_cast<const ParseStatementDropTable&>(parse_query));
-      break;
-    case ParseStatement::kInsert: {
-      context_->set_is_catalog_changed();
-      const ParseStatementInsert &insert_statement =
-          static_cast<const ParseStatementInsert&>(parse_query);
-      if (insert_statement.getInsertType() == ParseStatementInsert::InsertType::kTuple) {
-        logical_plan_ =
-            resolveInsertTuple(static_cast<const ParseStatementInsertTuple&>(insert_statement));
-      } else {
-        DCHECK(insert_statement.getInsertType() == ParseStatementInsert::InsertType::kSelection);
-        const ParseStatementInsertSelection &insert_selection_statement =
-            static_cast<const ParseStatementInsertSelection&>(insert_statement);
-
-        if (insert_selection_statement.with_clause() != nullptr) {
-          resolveWithClause(*insert_selection_statement.with_clause());
-        }
-        logical_plan_ = resolveInsertSelection(insert_selection_statement);
-
-        if (insert_selection_statement.with_clause() != nullptr) {
-          // Report an error if there is a WITH query that is not actually used.
-          if (!with_queries_info_.unreferenced_query_indexes.empty()) {
-            int unreferenced_with_query_index = *with_queries_info_.unreferenced_query_indexes.begin();
-            const ParseSubqueryTableReference &unreferenced_with_query =
-                (*insert_selection_statement.with_clause())[unreferenced_with_query_index];
-            THROW_SQL_ERROR_AT(&unreferenced_with_query)
-                << "WITH query "
-                << unreferenced_with_query.table_reference_signature()->table_alias()->value()
-                << " is defined but not used";
-          }
-        }
-      }
-      break;
-    }
-    case ParseStatement::kSelect: {
-      const ParseStatementSelect &select_statement =
-          static_cast<const ParseStatementSelect&>(parse_query);
-      if (select_statement.with_clause() != nullptr) {
-        resolveWithClause(*select_statement.with_clause());
-      }
-      logical_plan_ =
-          resolveSelect(*select_statement.select_query(),
-                        "" /* select_name */,
-                        nullptr /* No Type hints */,
-                        nullptr /* parent_resolver */);
-      if (select_statement.with_clause() != nullptr) {
-        // Report an error if there is a WITH query that is not actually used.
-        if (!with_queries_info_.unreferenced_query_indexes.empty()) {
-          int unreferenced_with_query_index = *with_queries_info_.unreferenced_query_indexes.begin();
-          const ParseSubqueryTableReference &unreferenced_with_query =
-              (*select_statement.with_clause())[unreferenced_with_query_index];
-          THROW_SQL_ERROR_AT(&unreferenced_with_query)
-              << "WITH query "
-              << unreferenced_with_query.table_reference_signature()->table_alias()->value()
-              << " is defined but not used";
-        }
-      }
-      break;
-    }
-    case ParseStatement::kUpdate:
-      context_->set_is_catalog_changed();
-      logical_plan_ =
-          resolveUpdate(static_cast<const ParseStatementUpdate&>(parse_query));
-      break;
-    default:
-      LOG(FATAL) << "Unhandled query statement:" << parse_query.toString();
-  }
-
-  logical_plan_ = L::TopLevelPlan::Create(logical_plan_,
-                                          with_queries_info_.with_query_plans);
-
-#ifdef QUICKSTEP_DEBUG
-  Validate(logical_plan_);
-#endif
-
-  return logical_plan_;
-}
-
-L::LogicalPtr Resolver::resolveCopyFrom(
-    const ParseStatementCopyFrom &copy_from_statement) {
-  // Default parameters.
-  std::string column_delimiter_ = "\t";
-  bool escape_strings_ = true;
-
-  const ParseCopyFromParams *params = copy_from_statement.params();
-  if (params != nullptr) {
-    if (params->delimiter != nullptr) {
-      column_delimiter_ = params->delimiter->value();
-      if (column_delimiter_.size() != 1) {
-        THROW_SQL_ERROR_AT(params->delimiter)
-            << "DELIMITER is not a single character";
-      }
-    }
-    escape_strings_ = params->escape_strings;
-  }
-
-  return L::CopyFrom::Create(resolveRelationName(copy_from_statement.relation_name()),
-                             copy_from_statement.source_filename()->value(),
-                             column_delimiter_[0],
-                             escape_strings_);
-}
-
-L::LogicalPtr Resolver::resolveCreateTable(
-    const ParseStatementCreateTable &create_table_statement) {
-  // Resolve relation name.
-  const std::string relation_name =
-      create_table_statement.relation_name()->value();
-  if (catalog_database_.hasRelationWithName(relation_name)) {
-    THROW_SQL_ERROR_AT(create_table_statement.relation_name())
-        << "Relation " << create_table_statement.relation_name()->value()
-        << " already exists";
-  }
-  if (relation_name.compare(0,
-                            std::strlen(OptimizerContext::kInternalTemporaryRelationNamePrefix),
-                            OptimizerContext::kInternalTemporaryRelationNamePrefix) == 0) {
-    THROW_SQL_ERROR_AT(create_table_statement.relation_name())
-        << "Relation name cannot start with "
-        << OptimizerContext::kInternalTemporaryRelationNamePrefix;
-  }
-
-  // Resolve attribute definitions.
-  std::vector<E::AttributeReferencePtr> attributes;
-  std::set<std::string> attribute_name_set;
-  for (const ParseAttributeDefinition &attribute_definition :
-       create_table_statement.attribute_definition_list()) {
-    const std::string lower_attribute_name =
-        ToLower(attribute_definition.name()->value());
-    if (attribute_name_set.find(lower_attribute_name) !=
-        attribute_name_set.end()) {
-      THROW_SQL_ERROR_AT(attribute_definition.name())
-          << "Column " << attribute_definition.name()->value()
-          << " is specified more than once";
-    }
-    attributes.emplace_back(
-        E::AttributeReference::Create(context_->nextExprId(),
-                                      attribute_definition.name()->value(),
-                                      attribute_definition.name()->value(),
-                                      relation_name,
-                                      attribute_definition.data_type().getType(),
-                                      E::AttributeReferenceScope::kLocal));
-    attribute_name_set.insert(lower_attribute_name);
-  }
-
-  std::shared_ptr<const StorageBlockLayoutDescription>
-      block_properties(resolveBlockProperties(create_table_statement));
-
-  return L::CreateTable::Create(relation_name, attributes, block_properties);
-}
-
-StorageBlockLayoutDescription* Resolver::resolveBlockProperties(
-    const ParseStatementCreateTable &create_table_statement) {
-  const ParseBlockProperties *block_properties
-      = create_table_statement.opt_block_properties();
-  // If there are no block properties.
-  if (block_properties == nullptr) {
-    return nullptr;
-  }
-  // Check for error conditions.
-  const ParseKeyValue *repeated_key_value
-      = block_properties->getFirstRepeatedKeyValue();
-  if (repeated_key_value != nullptr) {
-    THROW_SQL_ERROR_AT(repeated_key_value)
-        << "Properties must be specified at most once.";
-  }
-  const ParseKeyValue *invalid_key_value
-      = block_properties->getFirstInvalidKeyValue();
-  if (invalid_key_value != nullptr) {
-    THROW_SQL_ERROR_AT(invalid_key_value)
-        << "Unrecognized property name.";
-  }
-
-  // Begin resolution of properties.
-  std::unique_ptr<StorageBlockLayoutDescription>
-      storage_block_description(new StorageBlockLayoutDescription());
-  TupleStorageSubBlockDescription *description =
-      storage_block_description->mutable_tuple_store_description();
-
-  // Resolve TYPE property.
-  // The type of the block will determine these:
-  bool block_requires_sort = false;
-  bool block_requires_compress = false;
-
-  const ParseString *type_parse_string = block_properties->getType();
-  if (type_parse_string == nullptr) {
-    THROW_SQL_ERROR_AT(block_properties)
-        << "TYPE property must be specified and be a string.";
-  }
-  const std::string type_string = ToLower(type_parse_string->value());
-  if (type_string.compare("rowstore") == 0) {
-    description->set_sub_block_type(
-        quickstep::TupleStorageSubBlockDescription::PACKED_ROW_STORE);
-  } else if (type_string.compare("split_rowstore") == 0) {
-    description->set_sub_block_type(
-        quickstep::TupleStorageSubBlockDescription::SPLIT_ROW_STORE);
-  } else if (type_string.compare("columnstore") == 0) {
-    description->set_sub_block_type(
-        quickstep::TupleStorageSubBlockDescription::BASIC_COLUMN_STORE);
-    block_requires_sort = true;
-  } else if (type_string.compare("compressed_rowstore") == 0) {
-    description->set_sub_block_type(
-        quickstep::TupleStorageSubBlockDescription::COMPRESSED_PACKED_ROW_STORE);
-    block_requires_compress = true;
-  } else if (type_string.compare("compressed_columnstore") == 0) {
-    description->set_sub_block_type(
-        quickstep::TupleStorageSubBlockDescription::COMPRESSED_COLUMN_STORE);
-    block_requires_sort = true;
-    block_requires_compress = true;
-  } else {
-    THROW_SQL_ERROR_AT(type_parse_string) << "Unrecognized storage type.";
-  }
-
-  // Helper lambda function which will be used in COMPRESS and SORT resolution.
-  // Returns the column id from the name of the given attribute. Returns -1 if
-  // the attribute is not found.
-  auto columnIdFromAttributeName = [&create_table_statement](
-      const std::string& attribute_name) -> int {
-    const std::string search_name = ToLower(attribute_name);
-    int i = 0;
-    for (const ParseAttributeDefinition &attribute_definition :
-     create_table_statement.attribute_definition_list()) {
-      const std::string lower_attribute_name =
-        ToLower(attribute_definition.name()->value());
-      if (lower_attribute_name.compare(search_name) == 0) {
-        return i;
-      }
-      i++;
-    }
-    return -1;
-  };
-
-  // Resolve the SORT property.
-  const ParseString *sort_parse_string = block_properties->getSort();
-  if (block_requires_sort) {
-    if (sort_parse_string == nullptr) {
-      THROW_SQL_ERROR_AT(type_parse_string)
-          << "The SORT property must be specified as an attribute name.";
-    } else {
-      const std::string &sort_name = sort_parse_string->value();
-      // Lookup the name and map to a column id.
-      int sort_id = columnIdFromAttributeName(sort_name);
-      if (sort_id == -1) {
-        THROW_SQL_ERROR_AT(sort_parse_string)
-          << "The SORT property did not match any attribute name.";
-      } else {
-        if (description->sub_block_type() ==
-            TupleStorageSubBlockDescription::BASIC_COLUMN_STORE) {
-          description->SetExtension(
-              BasicColumnStoreTupleStorageSubBlockDescription::sort_attribute_id, sort_id);
-        } else if (description->sub_block_type() ==
-            TupleStorageSubBlockDescription::COMPRESSED_COLUMN_STORE) {
-          description->SetExtension(
-              CompressedColumnStoreTupleStorageSubBlockDescription::sort_attribute_id, sort_id);
-        }
-      }
-    }
-  } else {
-    if (sort_parse_string != nullptr) {
-      THROW_SQL_ERROR_AT(sort_parse_string)
-          << "The SORT property does not apply to this block type.";
-    }
-  }
-  // Resolve the COMPRESS property.
-  if (block_requires_compress) {
-    std::vector<std::size_t> compressed_column_ids;
-    // If we compress all the columns in the relation.
-    if (block_properties->compressAll()) {
-      for (std::size_t attribute_id = 0;
-           attribute_id < create_table_statement.attribute_definition_list().size();
-           ++attribute_id) {
-        compressed_column_ids.push_back(attribute_id);
-      }
-    } else {
-      // Otherwise search through the relation, mapping attribute names to their id.
-      const PtrList<ParseString> *compress_parse_strings
-          = block_properties->getCompressed();
-      if (compress_parse_strings == nullptr) {
-        THROW_SQL_ERROR_AT(block_properties)
-          << "The COMPRESS property must be specified as ALL or a list of attributes.";
-      }
-      for (const ParseString &compressed_attribute_name : *compress_parse_strings) {
-        int column_id = columnIdFromAttributeName(compressed_attribute_name.value());
-        if (column_id == -1) {
-          THROW_SQL_ERROR_AT(&compressed_attribute_name)
-              << "The given attribute was not found.";
-        } else {
-          compressed_column_ids.push_back(static_cast<std::size_t>(column_id));
-        }
-      }
-    }
-    // Add the found column ids to the proto message.
-    for (std::size_t column_id : compressed_column_ids) {
-      if (description->sub_block_type() ==
-          TupleStorageSubBlockDescription::COMPRESSED_PACKED_ROW_STORE) {
-        description->AddExtension(
-            CompressedPackedRowStoreTupleStorageSubBlockDescription::compressed_attribute_id, column_id);
-      } else if (description->sub_block_type() ==
-          TupleStorageSubBlockDescription::COMPRESSED_COLUMN_STORE) {
-        description->AddExtension(
-            CompressedColumnStoreTupleStorageSubBlockDescription::compressed_attribute_id, column_id);
-      }
-    }
-  } else {
-    // If the user specified COMPRESS but the block type did not require it, throw.
-    if (block_properties->compressAll() ||
-        block_properties->getCompressed() != nullptr) {
-      THROW_SQL_ERROR_AT(type_parse_string)
-          << "The COMPRESS property does not apply to this block type.";
-    }
-  }
-  // Resolve the Block size (size -> # of slots).
-  std::int64_t slots = kDefaultBlockSizeInSlots;
-  if (block_properties->hasBlockSizeMb()) {
-    const std::int64_t block_size_in_mega_bytes = block_properties->getBlockSizeMbValue();
-    if (block_size_in_mega_bytes == -1) {
-      // Indicates an error condition if the property is present but getter returns -1.
-      THROW_SQL_ERROR_AT(block_properties->getBlockSizeMb())
-          << "The BLOCKSIZEMB property must be an integer.";
-    } else if ((block_size_in_mega_bytes * kAMegaByte) % kSlotSizeBytes != 0) {
-      THROW_SQL_ERROR_AT(block_properties->getBlockSizeMb())
-          << "The BLOCKSIZEMB property must be multiple times of "
-          << std::to_string(kSlotSizeBytes / kAMegaByte) << "MB.";
-    }
-
-    slots = (block_size_in_mega_bytes * kAMegaByte) / kSlotSizeBytes;
-    DLOG(INFO) << "Resolver using BLOCKSIZEMB of " << slots << " slots"
-        << " which is " << (slots * kSlotSizeBytes) << " bytes versus"
-        << " user requested " << (block_size_in_mega_bytes * kAMegaByte) << " bytes.";
-    const std::uint64_t max_size_slots = kBlockSizeUpperBoundBytes / kSlotSizeBytes;
-    const std::uint64_t min_size_slots = kBlockSizeLowerBoundBytes / kSlotSizeBytes;
-    if (static_cast<std::uint64_t>(slots) < min_size_slots ||
-        static_cast<std::uint64_t>(slots) > max_size_slots) {
-      THROW_SQL_ERROR_AT(block_properties->getBlockSizeMb())
-          << "The BLOCKSIZEMB property must be between "
-          << std::to_string(kBlockSizeLowerBoundBytes / kAMegaByte) << "MB and "
-          << std::to_string(kBlockSizeUpperBoundBytes / kAMegaByte) << "MB.";
-    }
-  }
-  storage_block_description->set_num_slots(slots);
-
-  return storage_block_description.release();
-}
-
-L::LogicalPtr Resolver::resolveCreateIndex(
-    const ParseStatementCreateIndex &create_index_statement) {
-  // Resolve relation reference.
-  const L::LogicalPtr input = resolveSimpleTableReference(
-      *create_index_statement.relation_name(), nullptr /* reference_alias */);
-
-  const std::string &index_name = create_index_statement.index_name()->value();
-
-  // Resolve attribute references.
-  const PtrList<ParseAttribute> *index_attributes = create_index_statement.attribute_list();
-  const std::vector<E::AttributeReferencePtr> &relation_attributes =
-      input->getOutputAttributes();
-  std::vector<E::AttributeReferencePtr> resolved_attributes;
-  if (index_attributes == nullptr) {
-    // Specify to build index on all the attributes, if no attribute was specified.
-    for (const E::AttributeReferencePtr &relation_attribute : relation_attributes) {
-      resolved_attributes.emplace_back(relation_attribute);
-    }
-  } else {
-    // Otherwise specify to build index on the attributes that were given.
-    for (const ParseAttribute &index_attribute : *index_attributes) {
-      bool is_resolved = false;
-      for (const E::AttributeReferencePtr &relation_attribute : relation_attributes) {
-        const std::string &relation_attr_name = relation_attribute->attribute_name();
-        const std::string &index_attr_name = index_attribute.attr_name()->value();
-        if (relation_attr_name.compare(index_attr_name) == 0) {
-          is_resolved = true;
-          resolved_attributes.emplace_back(relation_attribute);
-          break;
-        }
-      }
-      if (!is_resolved) {
-        THROW_SQL_ERROR_AT(&index_attribute) << "Attribute "<< index_attribute.attr_name()->value()
-            << " is undefined for the relation "<< create_index_statement.relation_name()->value();
-      }
-    }
-  }
-
-  // Resolve index properties.
-  std::shared_ptr<const IndexSubBlockDescription> index_description_shared;
-  const IndexProperties *index_properties = create_index_statement.getIndexProperties();
-  if (index_properties->isIndexPropertyValid()) {
-    // Create a deep copy of the index description and pass its ownership to the shared ptr.
-    std::unique_ptr<IndexSubBlockDescription> index_description(new IndexSubBlockDescription());
-    index_description->CopyFrom(*index_properties->getIndexDescription());
-    index_description_shared.reset(index_description.release());
-    DCHECK(index_description_shared != nullptr);
-  } else {
-    if (index_properties->getInvalidPropertyNode() != nullptr) {
-      // If exact location is known in the parser, the error is thrown at that specific node.
-      THROW_SQL_ERROR_AT(index_properties->getInvalidPropertyNode())
-          << index_properties->getReasonForInvalidIndexDescription();
-    } else {
-      // Else the error is thrown at the index name node.
-      THROW_SQL_ERROR_AT(create_index_statement.index_type())
-         << index_properties->getReasonForInvalidIndexDescription();
-    }
-  }
-
-  return L::CreateIndex::Create(input, index_name, resolved_attributes, index_description_shared);
-}
-
-L::LogicalPtr Resolver::resolveDelete(
-    const ParseStatementDelete &delete_tuples_statement) {
-  NameResolver name_resolver;
-
-  const L::LogicalPtr input_logical = resolveSimpleTableReference(
-      *delete_tuples_statement.relation_name(), nullptr /* reference alias */);
-  name_resolver.addRelation(delete_tuples_statement.relation_name(),
-                            input_logical);
-
-  // Resolve the predicate to select tuples to be deleted.
-  E::PredicatePtr predicate;
-  if (delete_tuples_statement.where_predicate() != nullptr) {
-    ExpressionResolutionInfo expr_resolution_info(
-        name_resolver,
-        "WHERE clause" /* clause_name */,
-        nullptr /* select_list_info */);
-    predicate = resolvePredicate(*delete_tuples_statement.where_predicate(),
-                                 &expr_resolution_info);
-  }
-
-  return L::DeleteTuples::Create(input_logical, predicate);
-}
-
-L::LogicalPtr Resolver::resolveDropTable(
-    const ParseStatementDropTable &drop_table_statement) {
-  return L::DropTable::Create(
-      resolveRelationName(drop_table_statement.relation_name()));
-}
-
-L::LogicalPtr Resolver::resolveInsertSelection(
-    const ParseStatementInsertSelection &insert_statement) {
-  NameResolver name_resolver;
-
-  // Resolve the destination relation.
-  const L::LogicalPtr destination_logical = resolveSimpleTableReference(
-      *insert_statement.relation_name(), nullptr /* reference alias */);
-  name_resolver.addRelation(insert_statement.relation_name(),
-                            destination_logical);
-  const std::vector<E::AttributeReferencePtr> destination_attributes =
-      destination_logical->getOutputAttributes();
-
-  // Gather type information of the destination relation columns.
-  std::vector<const Type *> type_hints;
-  for (E::AttributeReferencePtr attr : destination_attributes) {
-    type_hints.emplace_back(&attr->getValueType());
-  }
-
-  // Resolve the selection query.
-  const L::LogicalPtr selection_logical =
-      resolveSelect(*insert_statement.select_query(),
-                    "" /* select_name */,
-                    &type_hints,
-                    nullptr /* parent_resolver */);
-  const std::vector<E::AttributeReferencePtr> selection_attributes =
-      selection_logical->getOutputAttributes();
-
-  // Check that number of columns match between the selection relation and
-  // the destination relation.
-  if (selection_attributes.size() != destination_attributes.size()) {
-    THROW_SQL_ERROR_AT(insert_statement.relation_name())
-        << "The relation " << insert_statement.relation_name()->value()
-        << " has " << std::to_string(destination_attributes.size())
-        << " columns, but " << std::to_string(selection_attributes.size())
-        << " columns are generated by the SELECT query";
-  }
-
-  // Add cast operation if the selection column type does not match the destination
-  // column type
-  std::vector<E::NamedExpressionPtr> cast_expressions;
-  for (std::vector<E::AttributeReferencePtr>::size_type aid = 0;
-       aid < destination_attributes.size();
-       ++aid) {
-    const Type& destination_type = destination_attributes[aid]->getValueType();
-    const Type& selection_type = selection_attributes[aid]->getValueType();
-    if (destination_type.equals(selection_type)) {
-      cast_expressions.emplace_back(selection_attributes[aid]);
-    } else {
-      // TODO(jianqiao): implement Cast operation for non-numeric types.
-      if (destination_type.getSuperTypeID() == Type::SuperTypeID::kNumeric &&
-          selection_type.getSuperTypeID() == Type::SuperTypeID::kNumeric &&
-          destination_type.isSafelyCoercibleFrom(selection_type)) {
-        // Add cast operation
-        const E::AttributeReferencePtr attr = selection_attributes[aid];
-        const E::ExpressionPtr cast_expr =
-            E::Cast::Create(attr, destination_type);
-        cast_expressions.emplace_back(
-            E::Alias::Create(context_->nextExprId(),
-                             cast_expr,
-                             attr->attribute_name(),
-                             attr->attribute_alias()));
-      } else {
-        THROW_SQL_ERROR_AT(insert_statement.relation_name())
-            << "The assigned value for the column "
-            << insert_statement.relation_name()->value() << "."
-            << destination_attributes[aid]->attribute_name() << " has type "
-            << selection_attributes[aid]->getValueType().getName()
-            << ", which cannot be safely coerced to the column's type "
-            << destination_attributes[aid]->getValueType().getName();
-     }
-    }
-  }
-  return L::InsertSelection::Create(
-      destination_logical,
-      L::Project::Create(selection_logical, cast_expressions));
-}
-
-L::LogicalPtr Resolver::resolveInsertTuple(
-    const ParseStatementInsertTuple &insert_statement) {
-  NameResolver name_resolver;
-
-  const L::LogicalPtr input_logical = resolveSimpleTableReference(
-      *insert_statement.relation_name(), nullptr /* reference alias */);
-  name_resolver.addRelation(insert_statement.relation_name(),
-                            input_logical);
-
-  // Resolve column values.
-  const std::vector<E::AttributeReferencePtr> relation_attributes =
-      input_logical->getOutputAttributes();
-  const PtrList<ParseScalarLiteral> &parse_column_values =
-      insert_statement.getLiteralValues();
-  DCHECK_GT(parse_column_values.size(), 0u);
-
-  if (parse_column_values.size() > relation_attributes.size()) {
-    THROW_SQL_ERROR_AT(insert_statement.relation_name())
-        << "The relation " << insert_statement.relation_name()->value()
-        << " has " << std::to_string(relation_attributes.size())
-        << " columns, but " << std::to_string(parse_column_values.size())
-        << " values are provided";
-  }
-
-  std::vector<E::ScalarLiteralPtr> resolved_column_values;
-  std::vector<E::AttributeReferencePtr>::size_type aid = 0;
-  for (const ParseScalarLiteral &parse_literal_value : parse_column_values) {
-    E::ScalarLiteralPtr resolved_literal_value;
-    ExpressionResolutionInfo expr_resolution_info(
-        name_resolver,
-        "INSERT statement" /* clause_name */,
-        nullptr /* select_list_info */);
-    // When resolving the literal, use the attribute's Type as a hint.
-    CHECK(E::SomeScalarLiteral::MatchesWithConditionalCast(
-        resolveExpression(parse_literal_value,
-                          &(relation_attributes[aid]->getValueType()),
-                          &expr_resolution_info),
-        &resolved_literal_value));
-
-    // Check that the resolved Type is safely coercible to the attribute's
-    // Type.
-    if (!relation_attributes[aid]->getValueType().isSafelyCoercibleFrom(
-            resolved_literal_value->getValueType())) {
-      THROW_SQL_ERROR_AT(&parse_literal_value)
-          << "The assigned value for the column "
-          << relation_attributes[aid]->attribute_name() << " has the type "
-          << resolved_literal_value->getValueType().getName()
-          << ", which cannot be safely coerced to the column's type "
-          << relation_attributes[aid]->getValueType().getName();
-    }
-
-    // If the Type is not exactly right (but is safely coercible), coerce it.
-    if (!resolved_literal_value->getValueType().equals(
-            relation_attributes[aid]->getValueType())) {
-      resolved_literal_value = E::ScalarLiteral::Create(
-          relation_attributes[aid]->getValueType().coerceValue(
-              resolved_literal_value->value(),
-              resolved_literal_value->getValueType()),
-          relation_attributes[aid]->getValueType());
-    }
-
-    resolved_column_values.push_back(resolved_literal_value);
-    ++aid;
-  }
-
-  while (aid < relation_attributes.size()) {
-    if (!relation_attributes[aid]->getValueType().isNullable()) {
-      THROW_SQL_ERROR_AT(insert_statement.relation_name())
-          << "Must assign a non-NULL value to column "
-          << relation_attributes[aid]->attribute_name();
-    }
-    // Create a NULL value.
-    resolved_column_values.push_back(E::ScalarLiteral::Create(
-        relation_attributes[aid]->getValueType().makeNullValue(),
-        relation_attributes[aid]->getValueType()));
-    ++aid;
-  }
-
-  return L::InsertTuple::Create(input_logical, resolved_column_values);
-}
-
-L::LogicalPtr Resolver::resolveUpdate(
-    const ParseStatementUpdate &update_statement) {
-  NameResolver name_resolver;
-  const L::LogicalPtr input = resolveSimpleTableReference(
-      *update_statement.relation_name(), nullptr /* reference_alias */);
-  name_resolver.addRelation(update_statement.relation_name(),
-                            input);
-
-  // Resolve the assigned attributes and expressions.
-  std::vector<E::AttributeReferencePtr> assignees;
-  std::vector<E::ScalarPtr> assignment_expressions;
-  std::set<E::ExprId> assignee_ids;
-  for (const ParseAssignment &assignment : update_statement.assignments()) {
-    const E::AttributeReferencePtr attribute = name_resolver.lookup(
-        assignment.attr_name(), nullptr /* parse_rel_node */);
-    ExpressionResolutionInfo expr_resolution_info(
-        name_resolver,
-        "SET clause" /* clause_name */,
-        nullptr /* select_list_info */);
-
-    // Resolve the assignment expression using the assigned attribute's Type as
-    // a hint.
-    E::ScalarPtr assignment_expression =
-        resolveExpression(assignment.value(),
-                          &(attribute->getValueType()),
-                          &expr_resolution_info);
-
-    if (!attribute->getValueType().isSafelyCoercibleFrom(
-            assignment_expression->getValueType())) {
-      THROW_SQL_ERROR_AT(&assignment)
-          << "The assigned value for the column "
-          << attribute->attribute_name() << " has the type "
-          << assignment_expression->getValueType().getName()
-          << ", which cannot be safely coerced to the column's type "
-          << attribute->getValueType().getName();
-    }
-
-    // Coerce the assignment expression if its Type is not equal to that of the
-    // assigned attribute.
-    if (!assignment_expression->getValueType().equals(attribute->getValueType())) {
-      assignment_expression =
-          E::Cast::Create(assignment_expression, attribute->getValueType());
-    }
-    if (assignee_ids.find(attribute->id()) != assignee_ids.end()) {
-      THROW_SQL_ERROR_AT(&assignment) << "Multiple assignments to the column "
-                                      << attribute->attribute_name();
-    }
-    assignees.push_back(attribute);
-    assignment_expressions.push_back(assignment_expression);
-    assignee_ids.insert(attribute->id());
-  }
-
-  // Resolve the WHERE predicate.
-  expressions::PredicatePtr resolved_where_predicate;
-  if (update_statement.hasWherePredicate()) {
-    ExpressionResolutionInfo expr_resolution_info(
-        name_resolver, "WHERE clause" /* clause_name */,
-        nullptr /* select_list_info */);
-    resolved_where_predicate = resolvePredicate(
-        update_statement.where_predicate(), &expr_resolution_info);
-  }
-
-  return L::UpdateTable::Create(input,
-                                assignees,
-                                assignment_expressions,
-                                resolved_where_predicate);
-}
-
-L::LogicalPtr Resolver::resolveSelect(
-    const ParseSelect &select_query,
-    const std::string &select_name,
-    const std::vector<const Type*> *type_hints,
-    const NameResolver *parent_resolver) {
-  std::unique_ptr<NameResolver> name_resolver(new NameResolver(parent_resolver));
-
-  // Resolve FROM clause.
-  L::LogicalPtr logical_plan;
-  logical_plan =
-      resolveFromClause(select_query.from_list(), name_resolver.get());
-
-  // Resolve WHERE clause.
-  if (select_query.hasWherePredicate()) {
-    ExpressionResolutionInfo expr_resolution_info(
-        *name_resolver, "WHERE clause" /* clause_name */,
-        nullptr /* select_list_info */);
-    const ParsePredicate &parse_predicate = select_query.where_predicate();
-    logical_plan = L::Filter::Create(
-        logical_plan, resolvePredicate(parse_predicate, &expr_resolution_info));
-  }
-
-  // Resolve WINDOW clause.
-  std::unordered_map<std::string, WindowPlan> sorted_window_map;
-  if (select_query.window_list() != nullptr) {
-    if (select_query.window_list()->size() > 1) {
-      THROW_SQL_ERROR_AT(&(*select_query.window_list()->begin()))
-          << "Currently we don't support multiple window aggregation functions";
-    }
-
-    // Sort the table according to the window.
-    for (const ParseWindow &window : *select_query.window_list()) {
-      // Check for duplicate definition.
-      // Currently this is useless since we only support one window.
-      if (sorted_window_map.find(window.name()->value()) != sorted_window_map.end()) {
-        THROW_SQL_ERROR_AT(window.name())
-            << "Duplicate definition of window " << window.name()->value();
-      }
-
-      E::WindowInfo resolved_window = resolveWindow(window, *name_resolver);
-      L::LogicalPtr sorted_logical_plan = resolveSortInWindow(logical_plan,
-                                                              resolved_window);
-
-      WindowPlan window_plan(sorted_logical_plan, std::move(resolved_window));
-
-      sorted_window_map.emplace(window.name()->value(), std::move(window_plan));
-    }
-  }
-
-  QueryAggregationInfo query_aggregation_info(
-      (select_query.group_by() != nullptr));
-  WindowAggregationInfo window_aggregation_info(sorted_window_map);
-
-  // Resolve SELECT-list clause.
-  std::vector<E::NamedExpressionPtr> select_list_expressions;
-  std::vector<bool> has_aggregate_per_expression;
-  resolveSelectClause(select_query.selection(),
-                      select_name,
-                      type_hints,
-                      *name_resolver,
-                      &query_aggregation_info,
-                      &window_aggregation_info,
-                      &select_list_expressions,
-                      &has_aggregate_per_expression);
-  DCHECK_EQ(has_aggregate_per_expression.size(),
-            select_list_expressions.size());
-
-  SelectListInfo select_list_info(select_list_expressions,
-                                  has_aggregate_per_expression);
-
-  // Create window aggregate node if needed
-  for (const E::AliasPtr &alias : window_aggregation_info.window_aggregate_expressions) {
-    E::WindowAggregateFunctionPtr window_aggregate_function;
-    if (!E::SomeWindowAggregateFunction::MatchesWithConditionalCast(alias->expression(),
-                                                                    &window_aggregate_function)) {
-      THROW_SQL_ERROR()
-          << "Unexpected expression in window aggregation function";
-    }
-    L::LogicalPtr sorted_logical_plan;
-
-    // Get the sorted logical plan
-    const std::string window_name = window_aggregate_function->window_name();
-    if (!window_name.empty()) {
-      sorted_logical_plan = sorted_window_map.at(window_name).logical_plan;
-    } else {
-      sorted_logical_plan = resolveSortInWindow(logical_plan,
-                                                window_aggregate_function->window_info());
-    }
-
-    logical_plan = L::WindowAggregate::Create(sorted_logical_plan,
-                                              alias);
-  }
-
-  // Resolve GROUP BY.
-  std::vector<E::NamedExpressionPtr> group_by_expressions;
-  if (select_query.group_by() != nullptr) {
-    for (const ParseExpression &unresolved_group_by_expression :
-         *select_query.group_by()->grouping_expressions()) {
-      ExpressionResolutionInfo expr_resolution_info(
-          *name_resolver, "GROUP BY clause" /* clause_name */,
-          &select_list_info);
-      E::ScalarPtr group_by_scalar = resolveExpression(
-          unresolved_group_by_expression,
-          nullptr,  // No Type hint.
-          &expr_resolution_info);
-
-      // Rewrite it to a reference to a SELECT-list expression
-      // if it is an ordinal reference.
-      rewriteIfOrdinalReference(&unresolved_group_by_expression,
-                                expr_resolution_info,
-                                &select_list_info,
-                                &group_by_scalar);
-
-      if (group_by_scalar->isConstant()) {
-        THROW_SQL_ERROR_AT(&unresolved_group_by_expression)
-            << "Constant expression not allowed in GROUP BY";
-      }
-
-      // If the group by expression is not a named expression,
-      // wrap it with an Alias.
-      E::NamedExpressionPtr group_by_expression;
-      if (!E::SomeNamedExpression::MatchesWithConditionalCast(group_by_scalar,
-                                                              &group_by_expression)) {
-        const std::string internal_alias =
-            GenerateGroupingAttributeAlias(group_by_expressions.size());
-        group_by_expression = E::Alias::Create(
-            context_->nextExprId(),
-            group_by_scalar,
-            "" /* attribute_name */,
-            internal_alias,
-            "$groupby" /* relation_name */);
-      }
-      group_by_expressions.push_back(group_by_expression);
-    }
-  }
-
-  // Resolve HAVING.
-  E::PredicatePtr having_predicate;
-  if (select_query.having() != nullptr) {
-    ExpressionResolutionInfo expr_resolution_info(
-        *name_resolver, &query_aggregation_info, &window_aggregation_info, &select_list_info);
-    having_predicate = resolvePredicate(
-        *select_query.having()->having_predicate(), &expr_resolution_info);
-  }
-
-  // Resolve ORDER BY.
-  std::vector<E::ScalarPtr> order_by_expressions;
-  // True if ascending.
-  std::vector<bool> order_by_directions;
-  std::vector<bool> nulls_first;
-  if (select_query.order_by() != nullptr) {
-    for (const ParseOrderByItem &order_by_item :
-         *select_query.order_by()->order_by_items()) {
-      ExpressionResolutionInfo expr_resolution_info(
-          *name_resolver, &query_aggregation_info, &window_aggregation_info, &select_list_info);
-      E::ScalarPtr order_by_scalar = resolveExpression(
-          *order_by_item.ordering_expression(),
-          nullptr,  // No Type hint.
-          &expr_resolution_info);
-
-      // Rewrite it to a reference to a SELECT-list expression
-      // if it is an ordinal reference.
-      rewriteIfOrdinalReference(&order_by_item, expr_resolution_info,
-                                &select_list_info, &order_by_scalar);
-
-      if (order_by_scalar->isConstant()) {
-        THROW_SQL_ERROR_AT(&order_by_item)
-            << "Constant expression not allowed in ORDER BY";
-      }
-
-      order_by_expressions.push_back(order_by_scalar);
-      order_by_directions.push_back(order_by_item.is_ascending());
-      nulls_first.push_back(order_by_item.nulls_first());
-    }
-  }
-
-  // If we have GROUP BY, at least one aggregate expression or HAVING,
-  // we need an Aggregate node. If there is a HAVING but no GROUP BY,
-  // the implicit GROUP BY is GROUP BY () with no grouping columns.
-  const bool need_aggregate =
-      (!query_aggregation_info.aggregate_expressions.empty() ||
-       !group_by_expressions.empty() || having_predicate != nullptr);
-
-  // If we have GROUP BY, at least one aggregate expression or HAVING,
-  // validate each SELECT-list, HAVING and ORDER BY expressions that
-  // they do not reference an attribute that is neither a GROUP BY column or
-  // an aggregate expression.
-  if (need_aggregate) {
-    std::unordered_set<E::ExprId> visible_expr_id_set;
-    for (const E::AliasPtr &aggregate_expression :
-         query_aggregation_info.aggregate_expressions) {
-      visible_expr_id_set.emplace(aggregate_expression->id());
-    }
-    for (const E::NamedExpressionPtr &group_by_expression :
-         group_by_expressions) {
-      visible_expr_id_set.emplace(group_by_expression->id());
-    }
-
-    // First check all SELECT-list expressions.
-    validateSelectExpressionsForAggregation(select_query.selection(),
-                                            select_list_expressions,
-                                            visible_expr_id_set);
-
-    // Now we have validated all SELECT-list expressions,
-    // add them to the visible expression set.
-    for (const E::NamedExpressionPtr &select_list_expression :
-         select_list_expressions) {
-      visible_expr_id_set.emplace(select_list_expression->id());
-    }
-
-    // Next check the HAVING predicate and ordering expressions.
-    if (select_query.having() != nullptr) {
-      validateExpressionForAggregation(
-          select_query.having()->having_predicate(), having_predicate,
-          visible_expr_id_set);
-    }
-    if (select_query.order_by() != nullptr) {
-      validateOrderingExpressionsForAggregation(*select_query.order_by(),
-                                                order_by_expressions,
-                                                visible_expr_id_set);
-    }
-  }
-
-  // Add a Project if we need to precompute some SELECT-list columns
-  // before Aggregate.
-  appendProjectIfNeedPrecomputationBeforeAggregation(
-      select_list_info, &select_list_expressions, &logical_plan);
-
-  if (need_aggregate) {
-    // Add an aggregate node.
-    logical_plan =
-        L::Aggregate::Create(logical_plan, group_by_expressions,
-                             query_aggregation_info.aggregate_expressions);
-
-    // Add a Project if we need to precompute some SELECT-list columns
-    // after Aggregate.
-    appendProjectIfNeedPrecomputationAfterAggregation(
-        select_list_info, &select_list_expressions, &logical_plan);
-  }
-
-  if (having_predicate != nullptr) {
-    logical_plan = L::Filter::Create(logical_plan, having_predicate);
-  }
-
-  if (!order_by_expressions.empty()) {
-    // Here we may need another Project, because an ordering expression
-    // may reference a SELECT expression at a non-top level.
-    // Wrap a Project on the Sort if there is some non-attribute
-    // ordering expression.
-    std::vector<E::NamedExpressionPtr> wrap_project_expressions;
-    std::vector<E::AttributeReferencePtr> order_by_attributes;
-    for (const E::ScalarPtr &order_by_expression : order_by_expressions) {
-      E::AttributeReferencePtr order_by_attribute;
-      if (!E::SomeAttributeReference::MatchesWithConditionalCast(order_by_expression,
-                                                                 &order_by_attribute)) {
-        const std::string internal_alias =
-            GenerateOrderingAttributeAlias(wrap_project_expressions.size());
-        const E::AliasPtr computed_order_by_expression =
-            E::Alias::Create(context_->nextExprId(),
-                             order_by_expression,
-                             "" /* attribute_name */,
-                             internal_alias,
-                             "$orderby" /* relation_name */);
-        wrap_project_expressions.push_back(computed_order_by_expression);
-        order_by_attribute = E::ToRef(computed_order_by_expression);
-      }
-      order_by_attributes.push_back(order_by_attribute);
-    }
-
-    if (!wrap_project_expressions.empty()) {
-      const std::vector<expressions::AttributeReferencePtr> child_project_attributes =
-          logical_plan->getOutputAttributes();
-      wrap_project_expressions.insert(wrap_project_expressions.end(),
-                                      child_project_attributes.begin(),
-                                      child_project_attributes.end());
-      logical_plan = L::Project::Create(logical_plan, wrap_project_expressions);
-    }
-
-    if (select_query.limit() != nullptr) {
-      logical_plan =
-          L::Sort::Create(logical_plan,
-                          std::move(order_by_attributes),
-                          std::move(order_by_directions),
-                          std::move(nulls_first),
-                          select_query.limit()->limit_expression()->long_value());
-    } else {
-      logical_plan =
-          L::Sort::Create(logical_plan,
-                          std::move(order_by_attributes),
-                          std::move(order_by_directions),
-                          std::move(nulls_first),
-                          -1 /* limit */);
-    }
-  } else if (select_query.limit() != nullptr) {
-    THROW_SQL_ERROR_AT(select_query.limit())
-        << "LIMIT is not supported without ORDER BY";
-  }
-
-  logical_plan = L::Project::Create(logical_plan, select_list_expressions);
-
-  return logical_plan;
-}
-
-E::SubqueryExpressionPtr Resolver::resolveSubqueryExpression(
-    const ParseSubqueryExpression &parse_subquery_expression,
-    const std::vector<const Type*> *type_hints,
-    ExpressionResolutionInfo *expression_resolution_info,
-    const bool has_single_column) {
-  L::LogicalPtr logical_subquery =
-      resolveSelect(*parse_subquery_expression.query(),
-                    "" /* select_name */,
-                    type_hints,
-                    &expression_resolution_info->name_resolver);
-
-  // Raise SQL error if the subquery is expected to return only one column but
-  // it returns multiple columns.
-  if (has_single_column && logical_subquery->getOutputAttributes().size() > 1u) {
-    THROW_SQL_ERROR_AT(&parse_subquery_expression)
-        << "Subquery must return exactly one column";
-  }
-
-  if (!context_->has_nested_queries()) {
-    context_->set_has_nested_queries();
-  }
-
-  return E::SubqueryExpression::Create(logical_subquery);
-}
-
-void Resolver::appendProjectIfNeedPrecomputationBeforeAggregation(
-    const SelectListInfo &select_list_info,
-    std::vector<E::NamedExpressionPtr> *select_list_expressions,
-    L::LogicalPtr *logical_plan) {
-  DCHECK_EQ(select_list_info.select_list_expressions.size(),
-            select_list_expressions->size());
-
-  std::vector<E::NamedExpressionPtr> precomputed_expressions;
-  for (std::vector<E::NamedExpressionPtr>::size_type idx = 0;
-       idx < select_list_expressions->size();
-       ++idx) {
-    // Do not precompute aggregations.
-    if (select_list_info.is_referenced[idx] &&
-        !select_list_info.has_aggregate_per_expression[idx]) {
-      precomputed_expressions.push_back((*select_list_expressions)[idx]);
-      (*select_list_expressions)[idx] =
-          E::ToRef((*select_list_expressions)[idx]);
-    }
-  }
-  if (!precomputed_expressions.empty()) {
-    const std::vector<expressions::AttributeReferencePtr> child_project_attributes =
-        (*logical_plan)->getOutputAttributes();
-    precomputed_expressions.insert(precomputed_expressions.end(),
-                                   child_project_attributes.begin(),
-                                   child_project_attributes.end());
-    *logical_plan = L::Project::Create(*logical_plan, precomputed_expressions);
-  }
-}
-
-void Resolver::appendProjectIfNeedPrecomputationAfterAggregation(
-    const SelectListInfo &select_list_info,
-    std::vector<expressions::NamedExpressionPtr> *select_list_expressions,
-    logical::LogicalPtr *logical_plan) {
-  DCHECK_EQ(select_list_info.select_list_expressions.size(),
-            select_list_expressions->size());
-
-  std::vector<E::NamedExpressionPtr> precomputed_expressions;
-  for (std::vector<E::NamedExpressionPtr>::size_type idx = 0; idx < select_list_expressions->size(); ++idx) {
-    // Precompute expressions that contain aggregations and
-    // is not a simple wrapper of an attribute reference..
-    if (select_list_info.is_referenced[idx] &&
-        select_list_info.has_aggregate_per_expression[idx]) {
-      E::AliasPtr select_alias;
-      CHECK(E::SomeAlias::MatchesWithConditionalCast((*select_list_expressions)[idx],
-                                                     &select_alias));
-      if (!E::SomeAttributeReference::Matches(select_alias->expression())) {
-        precomputed_expressions.push_back((*select_list_expressions)[idx]);
-        (*select_list_expressions)[idx] =
-            E::ToRef((*select_list_expressions)[idx]);
-      }
-    }
-  }
-  if (!precomputed_expressions.empty()) {
-    const std::vector<expressions::AttributeReferencePtr> child_project_attributes =
-        (*logical_plan)->getOutputAttributes();
-    precomputed_expressions.insert(precomputed_expressions.end(),
-                                   child_project_attributes.begin(),
-                                   child_project_attributes.end());
-    *logical_plan = L::Project::Create(*logical_plan, precomputed_expressions);
-  }
-}
-
-void Resolver::validateSelectExpressionsForAggregation(
-    const ParseSelectionClause &parse_selection,
-    const std::vector<E::NamedExpressionPtr> &select_list_expressions,
-    const std::unordered_set<E::ExprId> &visible_expr_id_set) const {
-  if (parse_selection.getSelectionType() == ParseSelectionClause::kStar) {
-    for (const E::NamedExpressionPtr &select_list_expression :
-         select_list_expressions) {
-      validateExpressionForAggregation(&parse_selection,
-                                       select_list_expression,
-                                       visible_expr_id_set);
-    }
-  } else {
-    DCHECK_EQ(select_list_expressions.size(),
-              static_cast<const ParseSelectionList&>(parse_selection)
-                  .select_item_list()
-                  .size());
-    PtrList<ParseSelectionItem>::const_iterator parse_item_it =
-        static_cast<const ParseSelectionList&>(parse_selection)
-            .select_item_list()
-            .begin();
-    std::vector<E::NamedExpressionPtr>::const_iterator select_expression_it =
-        select_list_expressions.begin();
-    while (select_expression_it != select_list_expressions.end()) {
-      // Look down the expression tree only if the SELECT expression
-      // itself is not a group by column.
-      if (visible_expr_id_set.find((*select_expression_it)->id()) ==
-          visible_expr_id_set.end()) {
-        validateExpressionForAggregation(
-            &(*parse_item_it), *select_expression_it, visible_expr_id_set);
-      }
-      ++select_expression_it;
-      ++parse_item_it;
-    }
-  }
-}
-
-void Resolver::validateOrderingExpressionsForAggregation(
-    const ParseOrderBy &parse_order_by,
-    const std::vector<E::ScalarPtr> &order_by_expressions,
-    const std::unordered_set<E::ExprId> &visible_expr_id_set) const {
-  DCHECK_EQ(parse_order_by.order_by_items()->size(),
-            order_by_expressions.size());
-  PtrList<ParseOrderByItem>::const_iterator parse_item_it =
-      parse_order_by.order_by_items()->begin();
-  std::vector<E::ScalarPtr>::const_iterator order_by_expression_it =
-      order_by_expressions.begin();
-  while (order_by_expression_it != order_by_expressions.end()) {
-    validateExpressionForAggregation(&(*parse_item_it),
-                                     *order_by_expression_it,
-                                     visible_expr_id_set);
-    ++parse_item_it;
-    ++order_by_expression_it;
-  }
-}
-
-void Resolver::validateExpressionForAggregation(
-    const ParseTreeNode *location, const E::ExpressionPtr &expression,
-    const std::unordered_set<E::ExprId> &visible_expr_id_set) const {
-  if (expression->getNumChildren() > 0) {
-    for (const E::ExpressionPtr &child : expression->children()) {
-      validateExpressionForAggregation(location, child, visible_expr_id_set);
-    }
-  } else {
-    E::AttributeReferencePtr attribute_reference;
-    if (E::SomeAttributeReference::MatchesWithConditionalCast(expression, &attribute_reference) &&
-        visible_expr_id_set.find(attribute_reference->id()) ==
-            visible_expr_id_set.end()) {
-      THROW_SQL_ERROR_AT(location)
-          << "Expression contains an attribute "
-          << attribute_reference->attribute_alias()
-          << ", which is neither a GROUP BY expression nor in an aggregate "
-             "expression";
-    }
-  }
-}
-
-void Resolver::resolveWithClause(
-    const PtrVector<ParseSubqueryTableReference> &with_list) {
-  int index = 0;
-  for (const ParseSubqueryTableReference &with_table_reference : with_list) {
-    NameResolver name_resolver;
-    with_queries_info_.with_query_plans.emplace_back(
-        resolveTableReference(with_table_reference, &name_resolver));
-
-    const ParseString *reference_alias = with_table_reference.table_reference_signature()->table_alias();
-    const std::string lower_alias_name = ToLower(reference_alias->value());
-    if (with_queries_info_.with_query_name_to_vector_position.find(lower_alias_name)
-            != with_queries_info_.with_query_name_to_vector_position.end()) {
-      THROW_SQL_ERROR_AT(reference_alias)
-          << "WITH query name " << reference_alias->value()
-          << " is specified more than once";
-    }
-
-    with_queries_info_.with_query_name_to_vector_position.emplace(lower_alias_name, index);
-    with_queries_info_.unreferenced_query_indexes.insert(index);
-    ++index;
-  }
-}
-
-L::LogicalPtr Resolver::resolveFromClause(
-    const PtrList<ParseTableReference> &from_list,
-    NameResolver *name_resolver) {
-  std::vector<L::LogicalPtr> from_logical_list;
-  for (const ParseTableReference &from_parse_item : from_list) {
-    L::LogicalPtr from_logical_item =
-        resolveTableReference(from_parse_item, name_resolver);
-    from_logical_list.emplace_back(from_logical_item);
-  }
-
-  if (from_logical_list.size() > 1u) {
-    return L::MultiwayCartesianJoin::Create(from_logical_list);
-  } else {
-    return from_logical_list[0];
-  }
-}
-
-L::LogicalPtr Resolver::resolveTableReference(const ParseTableReference &table_reference,
-                                              NameResolver *name_resolver) {
-  L::LogicalPtr logical_plan;
-  const ParseString *reference_alias = nullptr;
-  const ParseTableReferenceSignature *reference_signature = table_reference.table_reference_signature();
-
-  switch (table_reference.getTableReferenceType()) {
-    case ParseTableReference::kSimpleTableReference: {
-      const ParseSimpleTableReference &simple_table_reference =
-          static_cast<const ParseSimpleTableReference&>(table_reference);
-
-      if (reference_signature == nullptr) {
-        reference_alias = simple_table_reference.table_name();
-      } else {
-        DCHECK(reference_signature->table_alias() != nullptr);
-        reference_alias = reference_signature->table_alias();
-      }
-
-      logical_plan = resolveSimpleTableReference(*simple_table_reference.table_name(), reference_alias);
-
-      if (reference_signature != nullptr && reference_signature->column_aliases() != nullptr) {
-        logical_plan = RenameOutputColumns(logical_plan, *reference_signature);
-      }
-      // Create a logical sample operator. Applicable only if \p the table is materialized.
-      // Sampling from subquery table references is not supported.
-      if (simple_table_reference.sample() != nullptr) {
-        logical_plan = L::Sample::Create(logical_plan,
-        simple_table_reference.sample()->is_block_sample(),
-        simple_table_reference.sample()->percentage()->long_value());
-      }
-      name_resolver->addRelation(reference_alias, logical_plan);
-      break;
-    }
-    case ParseTableReference::kGeneratorTableReference: {
-      const ParseGeneratorTableReference &generator_table_reference =
-          static_cast<const ParseGeneratorTableReference&>(table_reference);
-
-      if (reference_signature == nullptr) {
-        reference_alias = generator_table_reference.generator_function()->name();
-      } else {
-        DCHECK(reference_signature->table_alias() != nullptr);
-        reference_alias = reference_signature->table_alias();
-      }
-
-      logical_plan = resolveGeneratorTableReference(generator_table_reference,
-                                                    reference_alias);
-
-      if (reference_signature != nullptr && reference_signature->column_aliases() != nullptr) {
-        logical_plan = RenameOutputColumns(logical_plan, *reference_signature);
-      }
-
-      name_resolver->addRelation(reference_alias, logical_plan);
-      break;
-    }
-    case ParseTableReference::kSubqueryTableReference: {
-      // Any un-named subquery in FROM should has been caught in the parser.
-      DCHECK(reference_signature != nullptr)
-          << "Subquery expressions in FROM must be explicitly named";
-      DCHECK(reference_signature->table_alias() != nullptr);
-
-      reference_alias = reference_signature->table_alias();
-      logical_plan = resolveSelect(
-          *static_cast<const ParseSubqueryTableReference&>(table_reference).subquery_expr()->query(),
-          reference_alias->value(),
-          nullptr /* No Type hints */,
-          nullptr /* parent_resolver */);
-
-      if (reference_signature->column_aliases() != nullptr) {
-        logical_plan = RenameOutputColumns(logical_plan, *reference_signature);
-      }
-
-      name_resolver->addRelation(reference_alias, logical_plan);
-      break;
-    }
-    case ParseTableReference::kJoinedTableReference: {
-      NameResolver joined_table_name_resolver;
-
-      logical_plan = resolveJoinedTableReference(
-          static_cast<const ParseJoinedTableReference&>(table_reference),
-          &joined_table_name_resolver);
-
-      name_resolver->merge(&joined_table_name_resolver);
-      break;
-    }
-    default:
-      LOG(FATAL) << "Unhandeled table reference " << table_reference.toString();
-  }
-
-  return logical_plan;
-}
-
-L::LogicalPtr Resolver::RenameOutputColumns(
-    const L::LogicalPtr &logical_plan,
-    const ParseTableReferenceSignature &table_signature) {
-  const PtrList<ParseString> *column_aliases =
-      table_signature.column_aliases();
-  const std::vector<E::AttributeReferencePtr> output_attributes =
-      logical_plan->getOutputAttributes();
-
-  DCHECK(column_aliases != nullptr);
-
-  // Rename each attribute to its column alias.
-  std::vector<E::NamedExpressionPtr> project_expressions;
-  if (column_aliases->size() != output_attributes.size()) {
-    THROW_SQL_ERROR_AT(&table_signature)
-        << "The number of named columns is different from the number of table columns ("
-        << std::to_string(column_aliases->size()) << " vs. " << std::to_string(output_attributes.size()) << ")";
-  }
-
-  int attr_index = 0;
-  for (const ParseString &column_alias : *column_aliases) {
-    project_expressions.emplace_back(
-        E::Alias::Create(
-            context_->nextExprId(),
-            output_attributes[attr_index],
-            column_alias.value(),
-            column_alias.value()));
-    ++attr_index;
-  }
-
-  return L::Project::Create(logical_plan, project_expressions);
-}
-
-E::WindowInfo Resolver::resolveWindow(const ParseWindow &parse_window,
-                                      const NameResolver &name_resolver) {
-  std::vector<E::AttributeReferencePtr> partition_by_attributes;
-  std::vector<E::AttributeReferencePtr> order_by_attributes;
-  std::vector<bool> order_by_directions;
-  std::vector<bool> nulls_first;
-  E::WindowFrameInfo *frame_info = nullptr;
-
-  // Resolve PARTITION BY
-  if (parse_window.partition_by_expressions() != nullptr) {
-    for (const ParseExpression &unresolved_partition_by_expression :
-         *parse_window.partition_by_expressions()) {
-      ExpressionResolutionInfo expr_resolution_info(
-          name_resolver,
-          "PARTITION BY clause" /* clause_name */,
-          nullptr /* select_list_info */);
-      E::ScalarPtr partition_by_scalar = resolveExpression(
-          unresolved_partition_by_expression,
-          nullptr,  // No Type hint.
-          &expr_resolution_info);
-
-      if (partition_by_scalar->isConstant()) {
-        THROW_SQL_ERROR_AT(&unresolved_partition_by_expression)
-            << "Constant expression not allowed in PARTITION BY";
-      }
-
-      E::AttributeReferencePtr partition_by_attribute;
-      if (!E::SomeAttributeReference::MatchesWithConditionalCast(partition_by_scalar,
-                                                                 &partition_by_attribute)) {
-        THROW_SQL_ERROR_AT(&unresolved_partition_by_expression)
-            << "Only attribute name allowed in PARTITION BY in window definition";
-      }
-
-      partition_by_attributes.push_back(partition_by_attribute);
-    }
-  }
-
-  // Resolve ORDER BY
-  if (parse_window.order_by_expressions() != nullptr) {
-    for (const ParseOrderByItem &order_by_item :
-         *parse_window.order_by_expressions()) {
-      ExpressionResolutionInfo expr_resolution_info(
-          name_resolver,
-          "ORDER BY clause" /* clause name */,
-          nullptr /* select_list_info */);
-      E::ScalarPtr order_by_scalar = resolveExpression(
-          *order_by_item.ordering_expression(),
-          nullptr,  // No Type hint.
-          &expr_resolution_info);
-
-      if (order_by_scalar->isConstant()) {
-        THROW_SQL_ERROR_AT(&order_by_item)
-            << "Constant expression not allowed in ORDER BY";
-      }
-
-      E::AttributeReferencePtr order_by_attribute;
-      if (!E::SomeAttributeReference::MatchesWithConditionalCast(order_by_scalar,
-                                                                 &order_by_attribute)) {
-        THROW_SQL_ERROR_AT(&order_by_item)
-            << "Only attribute name allowed in ORDER BY in window definition";
-      }
-
-      order_by_attributes.push_back(order_by_attribute);
-      order_by_directions.push_back(order_by_item.is_ascending());
-      nulls_first.push_back(order_by_item.nulls_first());
-    }
-  }
-
-  // Resolve window frame
-  if (parse_window.frame_info() != nullptr) {
-    const quickstep::ParseFrameInfo *parse_frame_info = parse_window.frame_info();
-    // For FRAME mode, the first attribute in ORDER BY must be numeric.
-    // TODO(Shixuan): Time-related types should also be supported. To handle
-    // this, some changes in the parser needs to be done since the time range
-    // should be specified with time units. Also, UNBOUNDED flags might be
-    // needed because -1 might not make sense in this case.
-    if (!parse_frame_info->is_row &&
-        (order_by_attributes.empty() ||
-         order_by_attributes[0]->getValueType().getSuperTypeID() != Type::SuperTypeID::kNumeric)) {
-      THROW_SQL_ERROR_AT(&parse_window)
-          << "A numeric attribute should be specified as the first ORDER BY "
-          << "attribute in FRAME mode";
-    }
-
-    frame_info = new E::WindowFrameInfo(parse_frame_info->is_row,
-                                        parse_frame_info->num_preceding,
-                                        parse_frame_info->num_following);
-  }
-
-  return E::WindowInfo(partition_by_attributes,
-                       order_by_attributes,
-                       order_by_directions,
-                       nulls_first,
-                       frame_info);
-}
-
-const CatalogRelation* Resolver::resolveRelationName(
-    const ParseString *relation_name) {
-  const CatalogRelation *relation =
-      catalog_database_.getRelationByName(
-          ToLower(relation_name->value()));
-  if (relation == nullptr) {
-    THROW_SQL_ERROR_AT(relation_name) << "Unrecognized relation "
-                                      << relation_name->value();
-  }
-  return relation;
-}
-
-L::LogicalPtr Resolver::resolveSimpleTableReference(
-    const ParseString &table_name, const ParseString *reference_alias) {
-  // First look up the name in the subqueries.
-  const std::string lower_table_name = ToLower(table_name.value());
-  const std::unordered_map<std::string, int>::const_iterator subplan_it =
-      with_queries_info_.with_query_name_to_vector_position.find(lower_table_name);
-  if (subplan_it != with_queries_info_.with_query_name_to_vector_position.end()) {
-    with_queries_info_.unreferenced_query_indexes.erase(subplan_it->second);
-
-    const std::vector<E::AttributeReferencePtr> with_query_attributes =
-        with_queries_info_.with_query_plans[subplan_it->second]->getOutputAttributes();
-
-    // Create a vector of new attributes to delegate the original output attributes
-    // from the WITH query, to avoid (ExprId -> CatalogAttribute) mapping collision
-    // later in ExecutionGenerator when there are multiple SharedSubplanReference's
-    // referencing a same shared subplan.
-    std::vector<E::AttributeReferencePtr> delegator_attributes;
-    for (const E::AttributeReferencePtr &attribute : with_query_attributes) {
-      delegator_attributes.emplace_back(
-          E::AttributeReference::Create(context_->nextExprId(),
-                                        attribute->attribute_name(),
-                                        attribute->attribute_alias(),
-                                        attribute->relation_name(),
-                                        attribute->getValueType(),
-                                        attribute->scope()));
-    }
-
-    return L::SharedSubplanReference::Create(subplan_it->second,
-                                             with_query_attributes,
-                                             delegator_attributes);
-  }
-
-  // Then look up the name in the database.
-  const CatalogRelation *relation = resolveRelationName(&table_name);
-  const ParseString *scoped_table_name;
-  if (reference_alias == nullptr) {
-    scoped_table_name = &table_name;
-  } else {
-    scoped_table_name = reference_alias;
-  }
-
-  return L::TableReference::Create(relation, scoped_table_name->value(), context_);
-}
-
-L::LogicalPtr Resolver::resolveGeneratorTableReference(
-    const ParseGeneratorTableReference &table_reference,
-    const ParseString *reference_alias) {
-  const ParseString *func_name = table_reference.generator_function()->name();
-
-  // Resolve the generator function
-  const quickstep::GeneratorFunction *func_template =
-      GeneratorFunctionFactory::Instance().getByName(func_name->value());
-  if (func_template == nullptr) {
-      THROW_SQL_ERROR_AT(func_name)
-          << "Generator function " << func_name->value() << " not found";
-  }
-
-  // Check that all arguments are constant literals, also convert them into a
-  // list of TypedValue's.
-  const PtrList<ParseExpression> *func_args = table_reference.generator_function()->arguments();
-  std::vector<TypedValue> concretized_args;
-  if (func_args != nullptr) {
-    for (const ParseExpression& arg : *func_args) {
-      if (arg.getExpressionType() != ParseExpression::kScalarLiteral) {
-        THROW_SQL_ERROR_AT(&arg)
-            << "Argument(s) to a generator function can only be constant literals";
-      }
-      const ParseScalarLiteral &scalar_literal_arg = static_cast<const ParseScalarLiteral&>(arg);
-      const Type* dumb_concretized_type;
-      concretized_args.emplace_back(
-          scalar_literal_arg.literal_value()->concretize(nullptr, &dumb_concretized_type));
-    }
-  }
-
-  // Concretize the generator function with the arguments.
-  quickstep::GeneratorFunctionHandle *func_handle = nullptr;
-  try {
-    func_handle = func_template->createHandle(concretized_args);
-  } catch (const std::exception &e) {
-    DCHECK(func_handle == nullptr);
-    THROW_SQL_ERROR_AT(table_reference.generator_function()) << e.what();
-  }
-  if (func_handle == nullptr) {
-    THROW_SQL_ERROR_AT(table_reference.generator_function())
-        << "Invalid arguments";
-  }
-
-  return L::TableGenerator::Create(quickstep::GeneratorFunctionHandlePtr(func_handle),
-                                   reference_alias->value(),
-                                   context_);
-}
-
-
-L::LogicalPtr Resolver::resolveJoinedTableReference(
-    const ParseJoinedTableReference &joined_table_reference,
-    NameResolver *name_resolver) {
-  std::size_t start_relation_idx_for_left = name_resolver->nextScopedRelationPosition();
-  L::LogicalPtr left_table =
-      resolveTableReference(*joined_table_reference.left_table(), name_resolver);
-
-  std::size_t start_relation_idx_for_right = name_resolver->nextScopedRelationPosition();
-  L::LogicalPtr right_table =
-      resolveTableReference(*joined_table_reference.right_table(), name_resolver);
-
-  std::size_t end_relation_idx = name_resolver->nextScopedRelationPosition();
-
-  ExpressionResolutionInfo resolution_info(*name_resolver,
-                                           "join clause" /* clause_name */,
-                                           nullptr /* select_list_info */);
-  const E::PredicatePtr on_predicate =
-      resolvePredicate(*joined_table_reference.join_predicate(), &resolution_info);
-
-  switch (joined_table_reference.join_type()) {
-    case ParseJoinedTableReference::JoinType::kInnerJoin: {
-      return L::Filter::Create(
-          L::MultiwayCartesianJoin::Create({ left_table, right_table }),
-          on_predicate);
-    }
-    case ParseJoinedTableReference::JoinType::kRightOuterJoin: {
-      // Swap the two tables so it becomes a left outer join.
-      std::swap(left_table, right_table);
-      end_relation_idx = start_relation_idx_for_right;
-      start_relation_idx_for_right = start_relation_idx_for_left;
-    }  // Fall through
-    case ParseJoinedTableReference::JoinType::kLeftOuterJoin: {
-      name_resolver->makeOutputAttributesNullable(start_relation_idx_for_right,
-                                                  end_relation_idx);
-
-      // left_join_attributes and right_join_attributes will be identified by
-      // GenerateJoins during logical optimization.
-      return L::HashJoin::Create(left_table,
-                                 right_table,
-                                 {} /* left_join_attributes */,
-                                 {} /* right_join_attributes */,
-                                 on_predicate,
-                                 L::HashJoin::JoinType::kLeftOuterJoin);
-    }
-    default:
-      break;
-  }
-
-  THROW_SQL_ERROR_AT(&joined_table_reference) << "Full outer join is not supported yet";
-}
-
-L::LogicalPtr Resolver::resolveSortInWindow(
-    const L::LogicalPtr &logical_plan,
-    const E::WindowInfo &window_info) {
-  // Sort the table by (p_key, o_key).
-  std::vector<E::AttributeReferencePtr> sort_attributes(window_info.partition_by_attributes);
-  sort_attributes.insert(sort_attributes.end(),
-                         window_info.order_by_attributes.begin(),
-                         window_info.order_by_attributes.end());
-
-  // If (p_key, o_key) is empty, no sort is needed.
-  if (sort_attributes.empty()) {
-    return logical_plan;
-  }
-
-  std::vector<bool> sort_directions(
-      window_info.partition_by_attributes.size(), true);
-  sort_directions.insert(sort_directions.end(),
-                         window_info.order_by_directions.begin(),
-                         window_info.order_by_directions.end());
-
-  std::vector<bool> sort_nulls_first(
-      window_info.partition_by_attributes.size(), false);
-  sort_nulls_first.insert(sort_nulls_first.end(),
-                          window_info.nulls_first.begin(),
-                          window_info.nulls_first.end());
-
-  L::LogicalPtr sorted_logical_plan =
-      L::Sort::Create(logical_plan,
-                      std::move(sort_attributes),
-                      std::move(sort_directions),
-                      std::move(sort_nulls_first),
-                      -1 /* limit */);
-
-  return sorted_logical_plan;
-}
-
-void Resolver::resolveSelectClause(
-    const ParseSelectionClause &parse_selection,
-    const std::string &select_name,
-    const std::vector<const Type*> *type_hints,
-    const NameResolver &name_resolver,
-    QueryAggregationInfo *query_aggregation_info,
-    WindowAggregationInfo *window_aggregation_info,
-    std::vector<E::NamedExpressionPtr> *project_expressions,
-    std::vector<bool> *has_aggregate_per_expression) {
-  project_expressions->clear();
-  switch (parse_selection.getSelectionType()) {
-    case ParseSelectionClause::kStar: {
-      // Add all visible attributes.
-      *project_expressions = E::ToNamedExpressions(name_resolver.getVisibleAttributeReferences());
-      has_aggregate_per_expression->insert(has_aggregate_per_expression->end(),
-                                           project_expressions->size(),
-                                           false);
-      break;
-    }
-    case ParseSelectionClause::kNonStar: {
-      const ParseSelectionList &selection_list =
-          static_cast<const ParseSelectionList&>(parse_selection);
-
-      // Ignore type hints if its size does not match the number of columns.
-      if (type_hints != nullptr && type_hints->size() != selection_list.select_item_list().size()) {
-        type_hints = nullptr;
-      }
-
-      std::vector<const Type*>::size_type tid = 0;
-      for (const ParseSelectionItem &selection_item :
-           selection_list.select_item_list()) {
-        const ParseString *parse_alias = selection_item.alias();
-        const ParseExpression *parse_project_expression =
-            selection_item.expression();
-        ExpressionResolutionInfo expr_resolution_info(
-            name_resolver,
-            query_aggregation_info,
-            window_aggregation_info,
-            nullptr /* select_list_info */);
-        const E::ScalarPtr project_scalar =
-            resolveExpression(*parse_project_expression,
-                              (type_hints == nullptr ? nullptr : type_hints->at(tid)),
-                              &expr_resolution_info);
-
-        // If the resolved expression is a named expression,
-        // we reuse its ID. Because we resolve an aggregate function
-        // call to an Alias, we need to maintain the ID in the
-        // SELECT-list expression so that we can later correctly
-        // identify the SELECT-list expression during the aggregate validation.
-        E::ExprId project_expression_id;
-        E::NamedExpressionPtr project_named_expression;
-        if (E::SomeNamedExpression::MatchesWithConditionalCast(project_scalar,
-                                                               &project_named_expression)) {
-          project_expression_id = project_named_expression->id();
-        } else {
-          project_expression_id = context_->nextExprId();
-        }
-
-        if (parse_alias != nullptr) {
-          project_named_expression = E::Alias::Create(project_expression_id,
-                                                      project_scalar,
-                                                      parse_alias->value(),
-                                                      parse_alias->value(),
-                                                      select_name);
-        } else {
-          // Create an Alias if the expression is not a named
-          // expression.
-          if (project_named_expression == nullptr) {
-            const std::string generated_name = selection_item.generateName();
-            project_named_expression = E::Alias::Create(project_expression_id,
-                                                        project_scalar,
-                                                        "" /* attribute_name */,
-                                                        generated_name,
-                                                        select_name);
-          } else if (project_named_expression->attribute_alias().at(0) == '$') {
-            // Rename the expression with an internal alias name so that the output
-            // is more human readable.
-            project_named_expression = E::Alias::Create(project_named_expression->id(),
-                                                        project_named_expression,
-                                                        project_named_expression->attribute_name(),
-                                                        selection_item.generateName(),
-                                                        select_name);
-          }
-        }
-        project_expressions->push_back(project_named_expression);
-        has_aggregate_per_expression->push_back(
-            expr_resolution_info.hasAggregate());
-        ++tid;
-  

<TRUNCATED>


[28/51] [abbrv] [partial] incubator-quickstep git commit: remove c++ files

Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/parser/ParseStatement.hpp
----------------------------------------------------------------------
diff --git a/parser/ParseStatement.hpp b/parser/ParseStatement.hpp
deleted file mode 100644
index cb5a1b5..0000000
--- a/parser/ParseStatement.hpp
+++ /dev/null
@@ -1,1215 +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_PARSER_PARSE_STATEMENT_HPP_
-#define QUICKSTEP_PARSER_PARSE_STATEMENT_HPP_
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "parser/ParseAssignment.hpp"
-#include "parser/ParseAttributeDefinition.hpp"
-#include "parser/ParseBasicExpressions.hpp"
-#include "parser/ParseBlockProperties.hpp"
-#include "parser/ParseIndexProperties.hpp"
-#include "parser/ParseKeyValue.hpp"
-#include "parser/ParsePartitionClause.hpp"
-#include "parser/ParsePredicate.hpp"
-#include "parser/ParsePriority.hpp"
-#include "parser/ParseSelect.hpp"
-#include "parser/ParseString.hpp"
-#include "parser/ParseSubqueryTableReference.hpp"
-#include "parser/ParseTreeNode.hpp"
-#include "storage/StorageBlockInfo.hpp"
-#include "utility/Macros.hpp"
-#include "utility/PtrList.hpp"
-#include "utility/PtrVector.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-/** \addtogroup Parser
- *  @{
- */
-
-/**
- * @brief Abstract base class for all complete SQL commands.
- **/
-class ParseStatement : public ParseTreeNode {
- public:
-  /**
-   * @brief The possible types of SQL statements.
-   **/
-  enum StatementType {
-    kCreateTable,
-    kCreateIndex,
-    kDropTable,
-    kSelect,
-    kInsert,
-    kCopyFrom,
-    kUpdate,
-    kDelete,
-    kQuit,
-    kCommand
-  };
-
-  /**
-   * @brief Virtual destructor.
-   **/
-  ~ParseStatement() override {
-  }
-
-  /**
-   * @brief Identify the type of this SQL statement.
-   *
-   * @return The type of this statement.
-   **/
-  virtual StatementType getStatementType() const = 0;
-
-  /**
-   * @brief Get the priority of the SQL statement. Note that the priority is
-   *        an unsigned non-zero integer.
-   *
-   * @return The priority of the SQL statement. The default priority is 1.
-   **/
-  virtual const std::uint64_t getPriority() const {
-    return 1;
-  }
-
- protected:
-  ParseStatement(const int line_number, const int column_number)
-      : ParseTreeNode(line_number, column_number) {
-  }
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(ParseStatement);
-};
-
-/**
- * @brief The parsed representation of a CREATE TABLE statement.
- **/
-class ParseStatementCreateTable : public ParseStatement {
- public:
-  /**
-   * @brief Constructor.
-   *
-   * @param relation_name The name of the relation to create.
-   * @param attribute_definition_list The list of definitions for the
-   *        attributes in the new relation, which becomes owned by this
-   *        ParseStatementCreateTable.
-   * @param opt_block_properties Optional physical properties of the block.
-   **/
-  ParseStatementCreateTable(const int line_number,
-                            const int column_number,
-                            ParseString *relation_name,
-                            PtrList<ParseAttributeDefinition> *attribute_definition_list,
-                            ParseBlockProperties *opt_block_properties,
-                            ParsePartitionClause *opt_partition_clause)
-      : ParseStatement(line_number, column_number),
-        relation_name_(relation_name),
-        attribute_definition_list_(attribute_definition_list),
-        opt_block_properties_(opt_block_properties),
-        opt_partition_clause_(opt_partition_clause) {
-  }
-
-  ~ParseStatementCreateTable() override {
-  }
-
-  StatementType getStatementType() const override {
-    return kCreateTable;
-  }
-
-  std::string getName() const override { return "CreateTableStatement"; }
-
-  /**
-   * @brief Get the name of the relation to create.
-   *
-   * @return The new relation's name.
-   **/
-  const ParseString* relation_name() const {
-    return relation_name_.get();
-  }
-
-  /**
-   * @brief Get the list of attribute definitions.
-   *
-   * @return The list of attribute definitions for the new relation.
-   **/
-  const PtrList<ParseAttributeDefinition>& attribute_definition_list() const {
-    return *attribute_definition_list_;
-  }
-
-  /**
-   * @brief Get a pointer to the BlockProperties.
-   *
-   * @return The BlockProperties or nullptr if not specified.
-   **/
-  const ParseBlockProperties* opt_block_properties() const {
-    return opt_block_properties_.get();
-  }
-
-  /**
-   * @brief Get a pointer to the PartitionClause.
-   *
-   * @return The PartitionClause or nullptr if not specified.
-   **/
-  const ParsePartitionClause* opt_partition_clause() const {
-    return opt_partition_clause_.get();
-  }
-
- 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<const ParseTreeNode*> *non_container_child_fields,
-      std::vector<std::string> *container_child_field_names,
-      std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const override {
-    inline_field_names->push_back("relation_name");
-    inline_field_values->push_back(relation_name_->value());
-
-    container_child_field_names->push_back("attribute_list");
-    container_child_fields->emplace_back();
-    for (const ParseAttributeDefinition& attribute_definition : *attribute_definition_list_) {
-      container_child_fields->back().push_back(&attribute_definition);
-    }
-
-    if (opt_block_properties_) {
-      container_child_field_names->push_back("block_properties");
-      container_child_fields->emplace_back();
-      container_child_fields->back().push_back(opt_block_properties_.get());
-    }
-
-    if (opt_partition_clause_) {
-      container_child_field_names->push_back("partition_clause");
-      container_child_fields->emplace_back();
-      container_child_fields->back().push_back(opt_partition_clause_.get());
-    }
-  }
-
- private:
-  std::unique_ptr<ParseString> relation_name_;
-  std::unique_ptr<PtrList<ParseAttributeDefinition> > attribute_definition_list_;
-  std::unique_ptr<ParseBlockProperties> opt_block_properties_;
-  std::unique_ptr<ParsePartitionClause> opt_partition_clause_;
-
-  DISALLOW_COPY_AND_ASSIGN(ParseStatementCreateTable);
-};
-
-  /**
-   * @brief The parsed representation of a CREATE INDEX statement.
-   **/
-class ParseStatementCreateIndex : public ParseStatement {
- public:
-    /**
-     * @brief Constructor.
-     *
-     * @param index_name The name of the index to create.
-     * @param relation_name The name of the relation to create index upon.
-     * @param attribute_name_list A list of attributes of the relation
-     *        on which the index has to be created. If specified as null,
-     *        then index is created on all the attributes.
-     * @param index_type The type of index to create.
-     **/
-    ParseStatementCreateIndex(const int line_number,
-                              const int column_number,
-                              ParseString *index_name,
-                              ParseString *relation_name,
-                              PtrList<ParseAttribute> *attribute_list,
-                              ParseString *index_type)
-        : ParseStatement(line_number, column_number),
-          index_name_(index_name),
-          relation_name_(relation_name),
-          attribute_list_(attribute_list),
-          index_type_(index_type) {
-      initializeIndexType();
-    }
-
-    /**
-     * @brief Constructor.
-     *
-     * @param index_name The name of the index to create.
-     * @param relation_name The name of the relation to create index upon.
-     * @param attribute_name_list A list of attributes of the relation
-     *        on which the index has to be created. If specified as null,
-     *        then index is created on all the attributes.
-     * @param index_type The type of index to create.
-     * @param index_properties_line_number
-     * @param index_properties_column_number
-     * @param opt_index_properties Optional index properties that were specified.
-     **/
-    ParseStatementCreateIndex(const int line_number,
-                              const int column_number,
-                              ParseString *index_name,
-                              ParseString *relation_name,
-                              PtrList<ParseAttribute> *attribute_list,
-                              ParseString *index_type,
-                              const int index_properties_line_number,
-                              const int index_properties_column_number,
-                              PtrList<ParseKeyValue> *opt_index_properties)
-        : ParseStatement(line_number, column_number),
-          index_name_(index_name),
-          relation_name_(relation_name),
-          attribute_list_(attribute_list),
-          index_type_(index_type) {
-      initializeIndexType();
-      custom_properties_node_.reset(new ParseIndexProperties(index_properties_line_number,
-                                                                   index_properties_column_number,
-                                                                   opt_index_properties));
-      index_properties_->addCustomProperties(custom_properties_node_->getKeyValueList());
-    }
-
-    ~ParseStatementCreateIndex() override {
-    }
-
-    StatementType getStatementType() const override {
-      return kCreateIndex;
-    }
-
-    std::string getName() const override { return "CreateIndexStatement"; }
-
-    /**
-     * @brief Get the name of the index to create.
-     *
-     * @return The index's name.
-     **/
-    const ParseString* index_name() const {
-      return index_name_.get();
-    }
-
-    /**
-     * @brief Get the name of the relation to create index upon.
-     *
-     * @return The relation's name.
-     **/
-    const ParseString* relation_name() const {
-      return relation_name_.get();
-    }
-
-    /**
-     * @brief Get the list of attributes on which index is supposed to be defined.
-     *
-     * @return The list of attributes on which index is to be built.
-     **/
-    const PtrList<ParseAttribute>* attribute_list() const {
-      return attribute_list_.get();
-    }
-
-    /**
-     * @brief Get the type of the index to be created.
-     *
-     * @return The index's type.
-     **/
-    const ParseString* index_type() const {
-      return index_type_.get();
-    }
-
-    /**
-     * @brief Get the index properties associated with this index type.
-     *
-     * @return The index properties for this type.
-     **/
-    const IndexProperties* getIndexProperties() const {
-      return index_properties_.get();
-    }
-
-    const ParseIndexProperties* getCustomPropertiesNode() const {
-      return custom_properties_node_.get();
-    }
-
-    bool hasCustomProperties() const {
-      return custom_properties_node_ != nullptr;
-    }
-
- 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<const ParseTreeNode*> *non_container_child_fields,
-       std::vector<std::string> *container_child_field_names,
-       std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const override {
-      inline_field_names->push_back("index_name");
-      inline_field_values->push_back(index_name_->value());
-
-      inline_field_names->push_back("relation_name");
-      inline_field_values->push_back(relation_name_->value());
-
-      inline_field_names->push_back("index_type");
-      const int index_type_enum_val = std::stoi(index_type_->value());
-      switch (index_type_enum_val) {
-        case IndexSubBlockType::kBitWeavingV:  // Fall through.
-        case IndexSubBlockType::kBitWeavingH:
-          inline_field_values->push_back("bitweaving");
-          break;
-        case IndexSubBlockType::kCSBTree:
-          inline_field_values->push_back("cs_b_tree");
-          break;
-        case IndexSubBlockType::kBloomFilter:
-          inline_field_values->push_back("bloom_filter");
-          break;
-        case IndexSubBlockType::kSMA:
-          inline_field_values->push_back("sma");
-          break;
-        default:
-          inline_field_values->push_back("unknown");
-      }
-
-      if (attribute_list_ != nullptr) {
-        container_child_field_names->push_back("attribute_list");
-        container_child_fields->emplace_back();
-        for (const ParseAttribute &attribute : *attribute_list_) {
-          container_child_fields->back().push_back(&attribute);
-        }
-      }
-
-      if (custom_properties_node_ != nullptr) {
-        container_child_field_names->push_back("index_property_list");
-        container_child_fields->emplace_back();
-        container_child_fields->back().push_back(custom_properties_node_.get());
-      }
-    }
-
- private:
-    std::unique_ptr<ParseString> index_name_;
-    std::unique_ptr<ParseString> relation_name_;
-    std::unique_ptr<PtrList<ParseAttribute>> attribute_list_;
-    std::unique_ptr<ParseString> index_type_;
-    std::unique_ptr<IndexProperties> index_properties_;
-    // Optional custom properties for the index can be specified during creation.
-    std::unique_ptr<const ParseIndexProperties> custom_properties_node_;
-
-    void initializeIndexType() {
-      const int index_type_enum_val = std::stoi(index_type_->value());
-      switch (index_type_enum_val) {
-        case IndexSubBlockType::kBitWeavingV:  // Fall through.
-        case IndexSubBlockType::kBitWeavingH:
-          index_properties_.reset(new BitWeavingIndexProperties());
-          break;
-        case IndexSubBlockType::kBloomFilter:
-          index_properties_.reset(new BloomFilterIndexProperties());
-          break;
-        case IndexSubBlockType::kCSBTree:
-          index_properties_.reset(new CSBTreeIndexProperties());
-          break;
-        case IndexSubBlockType::kSMA:
-          index_properties_.reset(new SMAIndexProperties());
-          break;
-        default:
-          LOG(FATAL) << "Unknown index subblock type.";
-          break;
-      }
-    }
-
-    DISALLOW_COPY_AND_ASSIGN(ParseStatementCreateIndex);
-};
-
-/**
- * @brief The parsed representation of a DROP TABLE statement.
- **/
-class ParseStatementDropTable : public ParseStatement {
- public:
-  /**
-   * @brief Constructor.
-   *
-   * @param line_number Line number of the first token of this node in the SQL statement.
-   * @param column_number Column number of the first token of this node in the SQL statement.
-   * @param relation_name The name of the relation to drop.
-   **/
-  ParseStatementDropTable(const int line_number, const int column_number, ParseString *relation_name)
-      : ParseStatement(line_number, column_number),
-        relation_name_(relation_name) {
-  }
-
-  /**
-   * @brief Destructor.
-   */
-  ~ParseStatementDropTable() override {
-  }
-
-  StatementType getStatementType() const override {
-    return kDropTable;
-  }
-
-  std::string getName() const override { return "DropTableStatement"; }
-
-  /**
-   * @brief Get the name of the relation to drop.
-   *
-   * @return The name of the relation to drop.
-   **/
-  const ParseString* relation_name() const {
-    return relation_name_.get();
-  }
-
- 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<const ParseTreeNode*> *non_container_child_fields,
-      std::vector<std::string> *container_child_field_names,
-      std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const override {
-    inline_field_names->push_back("relation_name");
-    inline_field_values->push_back(relation_name_->value());
-  }
-
- private:
-  std::unique_ptr<ParseString> relation_name_;
-
-  DISALLOW_COPY_AND_ASSIGN(ParseStatementDropTable);
-};
-
-/**
- * @brief The parsed representation of a SELECT statement.
- **/
-class ParseStatementSelect : public ParseStatement {
- public:
-  /**
-   * @brief Constructor.
-   * @note Takes ownership of all pointers.
-   *
-   * @param line_number Line number of the first token of this node in the SQL statement.
-   * @param column_number Column number of the first token of this node in the SQL statement.
-   * @param select_query The top-level SELECT query.
-   * @param with_clause The WITH clause of common table query expressions.
-   * @param priority_clause The PRIORITY clause of this query. If not valid or
-   *        not present, this is NULL.
-   **/
-  ParseStatementSelect(const int line_number,
-                       const int column_number,
-                       ParseSelect *select_query,
-                       PtrVector<ParseSubqueryTableReference> *with_clause,
-                       ParsePriority *priority_clause)
-      : ParseStatement(line_number, column_number),
-        select_query_(select_query),
-        with_clause_(with_clause),
-        priority_clause_(priority_clause) {
-  }
-
-  /**
-   * @brief Destructor.
-   */
-  ~ParseStatementSelect() override {
-  }
-
-  StatementType getStatementType() const override {
-    return kSelect;
-  }
-
-  std::string getName() const override { return "SelectStatement"; }
-
-  /**
-   * @return Gets the top-level SELECT query.
-   */
-  const ParseSelect* select_query() const {
-    return select_query_.get();
-  }
-
-  /**
-   * @brief Gets the WITH table queries.
-   *
-   * @return The parsed WITH table list.
-   */
-  const PtrVector<ParseSubqueryTableReference>* with_clause() const {
-    return with_clause_.get();
-  }
-
-  const std::uint64_t getPriority() const override {
-    if (priority_clause_ != nullptr) {
-      DCHECK(priority_clause_->priority_expression() != nullptr);
-      return priority_clause_->priority_expression()->long_value();
-    }
-    return 1;
-  }
-
- 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<const ParseTreeNode*> *non_container_child_fields,
-      std::vector<std::string> *container_child_field_names,
-      std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const override {
-    non_container_child_field_names->push_back("select_query");
-    non_container_child_fields->push_back(select_query_.get());
-
-    if (with_clause_ != nullptr && !with_clause_->empty()) {
-      container_child_field_names->push_back("with_clause");
-      container_child_fields->emplace_back();
-      for (const ParseSubqueryTableReference &common_subquery : *with_clause_) {
-        container_child_fields->back().push_back(&common_subquery);
-      }
-    }
-
-    if (priority_clause_ != nullptr) {
-      non_container_child_field_names->push_back("priority");
-      non_container_child_fields->push_back(priority_clause_.get());
-    }
-  }
-
- private:
-  std::unique_ptr<ParseSelect> select_query_;
-  std::unique_ptr<PtrVector<ParseSubqueryTableReference>> with_clause_;
-  std::unique_ptr<ParsePriority> priority_clause_;
-
-  DISALLOW_COPY_AND_ASSIGN(ParseStatementSelect);
-};
-
-/**
- * @brief The parsed representation of an INSERT statement.
- *
- * This is an abstract class where each of its subclass represents a concrete
- * type of insert operation.
- **/
-class ParseStatementInsert : public ParseStatement {
- public:
-  enum class InsertType {
-    kTuple = 0,
-    kSelection
-  };
-
-  /**
-   * @brief Constructor.
-   *
-   * @param line_number Line number of the first token of this node in the SQL statement.
-   * @param column_number Column number of the first token of this node in the SQL statement.
-   * @param relation_name The name of the relation to insert into.
-   **/
-  ParseStatementInsert(const int line_number,
-                       const int column_number,
-                       const ParseString *relation_name)
-      : ParseStatement(line_number, column_number),
-        relation_name_(relation_name) {
-  }
-
-  /**
-   * @brief Get the insert type of this insert statement.
-   *
-   * @return The insert type of this insert statement.
-   */
-  virtual InsertType getInsertType() const = 0;
-
-  std::string getName() const override { return "InsertStatement"; }
-
-  StatementType getStatementType() const override {
-    return kInsert;
-  }
-
-  /**
-   * @brief Get the name of the relation to insert into.
-   *
-   * @return The name of the relation to insert into.
-   **/
-  const ParseString* relation_name() const {
-    return relation_name_.get();
-  }
-
- private:
-  std::unique_ptr<const ParseString> relation_name_;
-
-  DISALLOW_COPY_AND_ASSIGN(ParseStatementInsert);
-};
-
-
-/**
- * @brief The parsed representation of an INSERT ... VALUES ... statement.
- **/
-class ParseStatementInsertTuple : public ParseStatementInsert {
- public:
-  /**
-   * @brief Constructor.
-   *
-   * @param line_number Line number of the first token of this node in the SQL statement.
-   * @param column_number Column number of the first token of this node in the SQL statement.
-   * @param relation_name The name of the relation to insert into.
-   * @param literal_values A list of literal values (in attribute-definition
-   *        order) to insert into the specified relation as a new tuple.
-   *        Becomes owned by this ParseStatementInsert.
-   **/
-  ParseStatementInsertTuple(const int line_number,
-                            const int column_number,
-                            const ParseString *relation_name,
-                            PtrList<ParseScalarLiteral> *literal_values)
-      : ParseStatementInsert(line_number, column_number, relation_name),
-        literal_values_(literal_values) {
-  }
-
-  ~ParseStatementInsertTuple() override {
-  }
-
-  InsertType getInsertType() const override {
-    return InsertType::kTuple;
-  }
-
-  /**
-   * @brief Get the parsed literal attribute values to insert.
-   *
-   * @return The list of literal values to insert.
-   **/
-  const PtrList<ParseScalarLiteral>& getLiteralValues() const {
-    return *literal_values_;
-  }
-
- 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<const ParseTreeNode*> *non_container_child_fields,
-      std::vector<std::string> *container_child_field_names,
-      std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const override {
-    inline_field_names->push_back("relation_name");
-    inline_field_values->push_back(relation_name()->value());
-
-    container_child_field_names->push_back("tuple");
-    container_child_fields->emplace_back();
-    for (const ParseScalarLiteral& literal_value : *literal_values_) {
-      container_child_fields->back().push_back(&literal_value);
-    }
-  }
-
- private:
-  std::unique_ptr<PtrList<ParseScalarLiteral> > literal_values_;
-
-  DISALLOW_COPY_AND_ASSIGN(ParseStatementInsertTuple);
-};
-
-/**
- * @brief The parsed representation of an INSERT ... SELECT ... statement.
- **/
-class ParseStatementInsertSelection : public ParseStatementInsert {
- public:
-  /**
-   * @brief Constructor.
-   *
-   * @param line_number Line number of the first token of this node in the SQL statement.
-   * @param column_number Column number of the first token of this node in the SQL statement.
-   * @param relation_name The name of the relation to insert into.
-   * @param select_query The SELECT query for generating insertion tuples.
-   * @param with_clause The WITH clause of common table query expressions.
-   **/
-  ParseStatementInsertSelection(const int line_number,
-                                const int column_number,
-                                const ParseString *relation_name,
-                                ParseSelect *select_query,
-                                PtrVector<ParseSubqueryTableReference> *with_clause)
-      : ParseStatementInsert(line_number, column_number, relation_name),
-        select_query_(select_query),
-        with_clause_(with_clause) {
-  }
-
-  ~ParseStatementInsertSelection() override {
-  }
-
-  InsertType getInsertType() const override {
-    return InsertType::kSelection;
-  }
-
-  /**
-   * @return Gets the SELECT query.
-   */
-  const ParseSelect* select_query() const {
-    return select_query_.get();
-  }
-
-  /**
-   * @brief Gets the WITH table queries.
-   *
-   * @return The parsed WITH table list.
-   */
-  const PtrVector<ParseSubqueryTableReference>* with_clause() const {
-    return with_clause_.get();
-  }
-
- 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<const ParseTreeNode*> *non_container_child_fields,
-      std::vector<std::string> *container_child_field_names,
-      std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const override {
-    inline_field_names->push_back("relation_name");
-    inline_field_values->push_back(relation_name()->value());
-
-    non_container_child_field_names->push_back("select_query");
-    non_container_child_fields->push_back(select_query_.get());
-
-    if (with_clause_ != nullptr && !with_clause_->empty()) {
-      container_child_field_names->push_back("with_clause");
-      container_child_fields->emplace_back();
-      for (const ParseSubqueryTableReference &common_subquery : *with_clause_) {
-        container_child_fields->back().push_back(&common_subquery);
-      }
-    }
-  }
-
- private:
-  std::unique_ptr<ParseSelect> select_query_;
-  std::unique_ptr<PtrVector<ParseSubqueryTableReference>> with_clause_;
-
-  DISALLOW_COPY_AND_ASSIGN(ParseStatementInsertSelection);
-};
-
-/**
- * @brief Optional parameters for a COPY FROM statement.
- **/
-struct ParseCopyFromParams : public ParseTreeNode {
-  /**
-   * @brief Constructor, sets default values.
-   **/
-  ParseCopyFromParams(const int line_number, const int column_number)
-      : ParseTreeNode(line_number, column_number),
-        escape_strings(true) {
-  }
-
-  std::string getName() const override { return "CopyFromParams"; }
-
-  /**
-   * @brief Sets the column delimiter.
-   *
-   * @param delimiter_in The column delimiter string.
-   */
-  void set_delimiter(ParseString* delimiter_in) {
-    delimiter.reset(delimiter_in);
-  }
-
-  /**
-   * @brief The string which terminates individual attribute values in the
-   *        input file. Can be NULL.
-   **/
-  std::unique_ptr<ParseString> delimiter;
-
-  /**
-   * @brief If true, replace C-style escape sequences in strings from the input
-   *        text file.
-   **/
-  bool escape_strings;
-
- 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<const ParseTreeNode*> *non_container_child_fields,
-      std::vector<std::string> *container_child_field_names,
-      std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const override {
-    if (delimiter != nullptr) {
-      inline_field_names->push_back("delimiter");
-      inline_field_values->push_back(delimiter->value());
-    }
-
-    inline_field_names->push_back("escape_string");
-    inline_field_values->push_back(escape_strings ? "true" : "false");
-  }
-};
-
-/**
- * @brief The parsed representation of a COPY FROM statement.
- **/
-class ParseStatementCopyFrom : public ParseStatement {
- public:
-  /**
-   * @brief Constructor.
-   *
-   * @param line_number Line number of the first token of this node in the SQL statement.
-   * @param column_number Column number of the first token of this node in the SQL statement.
-   * @param relation_name The name of the relation to insert into.
-   * @param source_filename The name of the text file to bulk insert from.
-   * @param params The optional parameters of the COPY FROM statement (should
-   *        be supplied with defaults if not otherwise set).
-   **/
-  ParseStatementCopyFrom(const int line_number,
-                         const int column_number,
-                         ParseString *relation_name,
-                         ParseString *source_filename,
-                         ParseCopyFromParams *params)
-      : ParseStatement(line_number, column_number),
-        relation_name_(relation_name),
-        source_filename_(source_filename),
-        params_(params) {
-  }
-
-  /**
-   * @brief Destructor.
-   */
-  ~ParseStatementCopyFrom() override {
-  }
-
-  StatementType getStatementType() const override {
-    return kCopyFrom;
-  }
-
-  std::string getName() const override { return "CopyFromStatement"; }
-
-  /**
-   * @brief Get the name of the relation to insert into.
-   *
-   * @return The name of the relation to insert into.
-   **/
-  const ParseString* relation_name() const {
-    return relation_name_.get();
-  }
-
-  /**
-   * @brief Get the name of the text file to copy from.
-   *
-   * @return The name of the text file to copy from.
-   **/
-  const ParseString* source_filename() const {
-    return source_filename_.get();
-  }
-
-  /**
-   * @brief Get the additional COPY FROM parameters.
-   *
-   * @return The string which terminates individual attribute values in the
-   *         input file.
-   **/
-  const ParseCopyFromParams* params() const {
-    return params_.get();
-  }
-
- 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<const ParseTreeNode*> *non_container_child_fields,
-      std::vector<std::string> *container_child_field_names,
-      std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const override {
-    inline_field_names->push_back("relation_name");
-    inline_field_values->push_back(relation_name_->value());
-
-    inline_field_names->push_back("source_file");
-    inline_field_values->push_back(source_filename_->value());
-
-    if (params_ != nullptr) {
-      non_container_child_field_names->push_back("params");
-      non_container_child_fields->push_back(params_.get());
-    }
-  }
-
- private:
-  std::unique_ptr<ParseString> relation_name_;
-  std::unique_ptr<ParseString> source_filename_;
-  std::unique_ptr<ParseCopyFromParams> params_;
-
-  DISALLOW_COPY_AND_ASSIGN(ParseStatementCopyFrom);
-};
-
-
-/**
- * @brief The parsed representation of an UPDATE statement.
- **/
-class ParseStatementUpdate : public ParseStatement {
- public:
-  /**
-   * @brief Constructor.
-   *
-   * @param line_number Line number of the first token of this node in the SQL statement.
-   * @param column_number Column number of the first token of this node in the SQL statement.
-   * @param relation_name The name of the relation to update.
-   * @param assignments A list of assignment for the attributes in the
-   *        relation, which becomes owned by this ParseStatementUpdate.
-   * @param where_predicate An optional predicate from a WHERE clause in the
-   *        UPDATE statement (may be NULL if no predicate). Becomes owned by
-   *        this ParseStatementUpdate if non-NULL.
-   **/
-  ParseStatementUpdate(const int line_number,
-                       const int column_number,
-                       ParseString *relation_name,
-                       PtrList<ParseAssignment> *assignments,
-                       ParsePredicate *where_predicate)
-      : ParseStatement(line_number, column_number),
-        relation_name_(relation_name),
-        assignments_(assignments),
-        where_predicate_(where_predicate) {
-  }
-
-  /**
-   * @brief Destructor.
-   */
-  ~ParseStatementUpdate() override {
-  }
-
-  StatementType getStatementType() const override {
-    return kUpdate;
-  }
-
-  std::string getName() const override { return "UpdateStatement"; }
-
-  /**
-   * @brief Get the name of the relation to update.
-   *
-   * @return The name of the relation to update.
-   **/
-  const ParseString* relation_name() const {
-    return relation_name_.get();
-  }
-
-  /**
-   * @brief Get the assignments to perform in the update.
-   *
-   * @return A list of assignments to perform in the update.
-   **/
-  const PtrList<ParseAssignment>& assignments() const {
-    return *assignments_;
-  }
-
-  /**
-   * @brief Determine whether this update statement has a WHERE predicate.
-   *
-   * @return Whether there is a WHERE predicate in this statement.
-   **/
-  bool hasWherePredicate() const {
-    return where_predicate_.get() != nullptr;
-  }
-
-  /**
-   * @brief Get the where predicate.
-   * @warning Always call hasWherePredicate() first.
-   *
-   * @return The where predicate for this update.
-   **/
-  const ParsePredicate& where_predicate() const {
-    DCHECK(hasWherePredicate());
-    return *where_predicate_;
-  }
-
- 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<const ParseTreeNode*> *non_container_child_fields,
-      std::vector<std::string> *container_child_field_names,
-      std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const override {
-    inline_field_names->push_back("relation_name");
-    inline_field_values->push_back(relation_name_->value());
-
-    container_child_field_names->push_back("assignment");
-    container_child_fields->emplace_back();
-    for (const ParseAssignment& assignment_item : *assignments_) {
-      container_child_fields->back().push_back(&assignment_item);
-    }
-
-    if (where_predicate_ != nullptr) {
-      non_container_child_field_names->push_back("where_predicate");
-      non_container_child_fields->push_back(where_predicate_.get());
-    }
-  }
-
- private:
-  std::unique_ptr<ParseString> relation_name_;
-  std::unique_ptr<PtrList<ParseAssignment> > assignments_;
-  std::unique_ptr<ParsePredicate> where_predicate_;
-
-  DISALLOW_COPY_AND_ASSIGN(ParseStatementUpdate);
-};
-
-/**
- * @brief The parsed representation of a DELETE statement.
- **/
-class ParseStatementDelete : public ParseStatement {
- public:
-  /**
-   * @brief Constructor
-   *
-   * @param line_number Line number of the first token of this node in the SQL statement.
-   * @param column_number Column number of the first token of this node in the SQL statement.
-   * @param relation_name The name of the relation to delete from.
-   * @param where_predicate An optional predicate from a WHERE clause in the
-   *        DELETE statement (may be NULL if no predicate). Becomes owned by
-   *        this ParseStatementDelete if non-NULL.
-   **/
-  ParseStatementDelete(const int line_number,
-                       const int column_number,
-                       ParseString *relation_name,
-                       ParsePredicate *where_predicate)
-      : ParseStatement(line_number, column_number), relation_name_(relation_name), where_predicate_(where_predicate) {
-  }
-
-  /**
-   * @brief Destructor.
-   */
-  ~ParseStatementDelete() override {
-  }
-
-  StatementType getStatementType() const override {
-    return kDelete;
-  }
-
-  std::string getName() const override { return "DeleteStatement"; }
-
-  /**
-   * @brief Get the name of the relation to delete from.
-   *
-   * @return The name of the relation to delete from.
-   **/
-  const ParseString* relation_name() const {
-    return relation_name_.get();
-  }
-
-  /**
-   * @brief Get the where predicate.
-   *
-   * @return The where predicate for this delete statement.
-   **/
-  const ParsePredicate* where_predicate() const {
-    return where_predicate_.get();
-  }
-
- 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<const ParseTreeNode*> *non_container_child_fields,
-      std::vector<std::string> *container_child_field_names,
-      std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const override {
-    inline_field_names->push_back("relation_name");
-    inline_field_values->push_back(relation_name_->value());
-
-    if (where_predicate_ != nullptr) {
-      non_container_child_field_names->push_back("where_predicate");
-      non_container_child_fields->push_back(where_predicate_.get());
-    }
-  }
-
- private:
-  std::unique_ptr<ParseString> relation_name_;
-  std::unique_ptr<ParsePredicate> where_predicate_;
-
-  DISALLOW_COPY_AND_ASSIGN(ParseStatementDelete);
-};
-
-/**
- * @brief The parsed representation of a QUIT statement, which terminates a
- *        quickstep session.
- **/
-class ParseStatementQuit : public ParseStatement {
- public:
-  /**
-   * @brief Constructor.
-   *
-   * @param line_number Line number of the first token of this node in the SQL statement.
-   * @param column_number Column number of the first token of this node in the SQL statement.
-   */
-  ParseStatementQuit(const int line_number, const int column_number)
-      : ParseStatement(line_number, column_number) {
-  }
-
-  StatementType getStatementType() const override {
-    return kQuit;
-  }
-
-  std::string getName() const override { return "QuitStatement"; }
-
- 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<const ParseTreeNode*> *non_container_child_fields,
-      std::vector<std::string> *container_child_field_names,
-      std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const override {
-  }
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(ParseStatementQuit);
-};
-
-/**
- * @brief Class to hold the parsed command name and an optional argument string.
- * @details Commands are non-sql statements which can be issued to quickstep.
- *          They are entered into the CLI as '.command-name command-string\n'.
- *          The command string is split up into words using whitespace as
- *          a delimiter.
- */
-class ParseCommand : public ParseStatement {
- public:
-  ParseCommand(const int line_number,
-               const int column_number,
-               ParseString *command,
-               PtrVector<ParseString> *arguments)
-      : ParseStatement(line_number, column_number),
-        command_(command),
-        arguments_(arguments) {  }
-
-  /**
-   * @return The name of this class.
-   */
-  std::string getName() const override {
-    return "ParseCommand";
-  }
-
-  /**
-   * @brief All ParseCommands are ParseStatements of the type command.
-   */
-  StatementType getStatementType() const override {
-    return kCommand;
-  }
-
-  /**
-   * @return The name of the command.
-   */
-  const ParseString* command() const {
-    return command_.get();
-  }
-
-  /**
-   * @return The optional argument strings to the command. Possibly empty.
-   */
-  const PtrVector<ParseString>* arguments() const {
-    return arguments_.get();
-  }
-
- 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<const ParseTreeNode*> *non_container_child_fields,
-      std::vector<std::string> *container_child_field_names,
-      std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const override {
-    inline_field_names->push_back("command");
-    inline_field_values->push_back(command_->value());
-
-    for (const ParseString &argument : *arguments_) {
-      non_container_child_field_names->push_back("argument");
-      non_container_child_fields->push_back(&argument);
-    }
-  }
-
- private:
-  std::unique_ptr<ParseString> command_;
-  std::unique_ptr<PtrVector<ParseString>> arguments_;
-
-  DISALLOW_COPY_AND_ASSIGN(ParseCommand);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_PARSER_PARSE_STATEMENT_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/parser/ParseString.cpp
----------------------------------------------------------------------
diff --git a/parser/ParseString.cpp b/parser/ParseString.cpp
deleted file mode 100644
index ca07541..0000000
--- a/parser/ParseString.cpp
+++ /dev/null
@@ -1,37 +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 "parser/ParseString.hpp"
-
-#include <string>
-#include <vector>
-
-namespace quickstep {
-
-void ParseString::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<const ParseTreeNode*> *non_container_child_fields,
-    std::vector<std::string> *container_child_field_names,
-    std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const {
-  inline_field_names->push_back("value");
-  inline_field_values->push_back(value_);
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/parser/ParseString.hpp
----------------------------------------------------------------------
diff --git a/parser/ParseString.hpp b/parser/ParseString.hpp
deleted file mode 100644
index 1997822..0000000
--- a/parser/ParseString.hpp
+++ /dev/null
@@ -1,118 +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_PARSER_PARSE_STRING_HPP_
-#define QUICKSTEP_PARSER_PARSE_STRING_HPP_
-
-#include <cstddef>
-#include <string>
-#include <vector>
-
-#include "parser/ParseTreeNode.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-
-/** \addtogroup Parser
- *  @{
- */
-
-/**
- * @brief String (an identifier or a string literal value) in the SQL statement.
- */
-class ParseString : public ParseTreeNode {
- public:
-  /**
-   * @brief Construction.
-   *
-   * @param line_number Line number of the first token of this node in the SQL statement.
-   * @param column_number Column number of the first token of this node in the SQL statement.
-   * @param value The string value.
-   */
-  ParseString(const int line_number,
-              const int column_number,
-              const std::string &value = "")
-      : ParseTreeNode(line_number, column_number),
-        value_(value) {
-  }
-
-  /**
-   * @brief Destructor.
-   */
-  ~ParseString() override {}
-
-  std::string getName() const override {
-    return "String";
-  }
-
-  /**
-   * @return The string value.
-   */
-  const std::string& value() const { return value_; }
-
-  /**
-   * @brief Append \p c into the string.
-   *
-   * @param c Char to append.
-   */
-  void push_back(char c) {
-    value_.push_back(c);
-  }
-
-  /**
-   * @brief Appends a copy of the first n characters in the array of characters pointed by s.
-   *
-   * @param s The string to be appended.
-   * @param n The number of characters to be copied from \p s.
-   * @return A reference to this ParseString.
-   */
-  ParseString& append(const char *s, const std::size_t n) {
-    value_.append(s, n);
-    return *this;
-  }
-
-  /**
-   * @brief Makes a copy of this ParseString.
-   *
-   * @return A copy of this ParseString. The caller is responsible for taking the ownership.
-   */
-  ParseString* clone() const {
-    return new ParseString(line_number(), column_number(), value_);
-  }
-
- 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<const ParseTreeNode*> *non_container_child_fields,
-      std::vector<std::string> *container_child_field_names,
-      std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const override;
-
- private:
-  std::string value_;
-
-  DISALLOW_COPY_AND_ASSIGN(ParseString);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_PARSER_PARSE_STRING_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/parser/ParseSubqueryExpression.cpp
----------------------------------------------------------------------
diff --git a/parser/ParseSubqueryExpression.cpp b/parser/ParseSubqueryExpression.cpp
deleted file mode 100644
index 991e00c..0000000
--- a/parser/ParseSubqueryExpression.cpp
+++ /dev/null
@@ -1,47 +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 "parser/ParseSubqueryExpression.hpp"
-
-#include <string>
-#include <vector>
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-class ParseTreeNode;
-
-std::string ParseSubqueryExpression::generateName() const {
-  // TODO(jianqiao): generate a more informative name for ParseSubqueryExpression.
-  return getName();
-}
-
-void ParseSubqueryExpression::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<const ParseTreeNode*> *non_container_child_fields,
-    std::vector<std::string> *container_child_field_names,
-    std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const {
-  non_container_child_field_names->push_back("");
-  non_container_child_fields->push_back(query_.get());
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/parser/ParseSubqueryExpression.hpp
----------------------------------------------------------------------
diff --git a/parser/ParseSubqueryExpression.hpp b/parser/ParseSubqueryExpression.hpp
deleted file mode 100644
index c7f9ccf..0000000
--- a/parser/ParseSubqueryExpression.hpp
+++ /dev/null
@@ -1,92 +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_PARSER_PARSE_SUBQUERY_EXPRESSION_HPP_
-#define QUICKSTEP_PARSER_PARSE_SUBQUERY_EXPRESSION_HPP_
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "parser/ParseExpression.hpp"
-#include "parser/ParseSelect.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-
-class ParseTreeNode;
-
-/** \addtogroup Parser
- *  @{
- */
-
-/**
- * @brief Parsed representation of a subquery expression.
- */
-class ParseSubqueryExpression : public ParseExpression {
- public:
-  /**
-   * @brief Constructor. Takes ownership of \p query.
-   *
-   * @param line_number The line number of the beginning of the subquery expression.
-   * @param column_number The column number of the beginning of the subquery expression.
-   * @param query The SELECT subquery.
-   */
-  ParseSubqueryExpression(const int line_number,
-                          const int column_number,
-                          ParseSelect *query)
-      : ParseExpression(line_number, column_number),
-        query_(query) {
-  }
-
-  ~ParseSubqueryExpression() override {
-  }
-
-  ExpressionType getExpressionType() const override {
-    return kSubqueryExpression;
-  }
-
-  /**
-   * @return The SELECT subquery.
-   */
-  const ParseSelect* query() const { return query_.get(); }
-
-  std::string getName() const override { return "SubqueryExpression"; }
-
-  std::string generateName() const override;
-
- 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<const ParseTreeNode*> *non_container_child_fields,
-      std::vector<std::string> *container_child_field_names,
-      std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const override;
-
- private:
-  std::unique_ptr<ParseSelect> query_;
-  DISALLOW_COPY_AND_ASSIGN(ParseSubqueryExpression);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_PARSER_PARSE_SUBQUERY_EXPRESSION_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/parser/ParseSubqueryTableReference.cpp
----------------------------------------------------------------------
diff --git a/parser/ParseSubqueryTableReference.cpp b/parser/ParseSubqueryTableReference.cpp
deleted file mode 100644
index fb2a05d..0000000
--- a/parser/ParseSubqueryTableReference.cpp
+++ /dev/null
@@ -1,46 +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 "parser/ParseSubqueryTableReference.hpp"
-
-#include <string>
-#include <vector>
-
-namespace quickstep {
-
-class ParseTreeNode;
-
-void ParseSubqueryTableReference::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<const ParseTreeNode*> *non_container_child_fields,
-    std::vector<std::string> *container_child_field_names,
-    std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const {
-  ParseTableReference::getFieldStringItems(inline_field_names,
-                                           inline_field_values,
-                                           non_container_child_field_names,
-                                           non_container_child_fields,
-                                           container_child_field_names,
-                                           container_child_fields);
-  non_container_child_field_names->push_back("");
-  non_container_child_fields->push_back(subquery_expr_.get());
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/parser/ParseSubqueryTableReference.hpp
----------------------------------------------------------------------
diff --git a/parser/ParseSubqueryTableReference.hpp b/parser/ParseSubqueryTableReference.hpp
deleted file mode 100644
index 8168fc2..0000000
--- a/parser/ParseSubqueryTableReference.hpp
+++ /dev/null
@@ -1,95 +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_PARSER_PARSE_SUBQUERY_TABLE_REFERENCE_HPP_
-#define QUICKSTEP_PARSER_PARSE_SUBQUERY_TABLE_REFERENCE_HPP_
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "parser/ParseSubqueryExpression.hpp"
-#include "parser/ParseTableReference.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-
-class ParseTreeNode;
-
-/** \addtogroup Parser
- *  @{
- */
-
-/**
- * @brief A subquery table (table derived by a subquery expression) in the FROM clause.
- */
-class ParseSubqueryTableReference : public ParseTableReference {
- public:
-  /**
-   * @brief Constructor. Takes ownership of \p subquery_expr.
-   *
-   * @param line_number The line number of the first token of the table subquery.
-   * @param column_number The column number of the first token of the table subquery.
-   * @param subquery_expr The subquery expression.
-   */
-  ParseSubqueryTableReference(const int line_number,
-                              const int column_number,
-                              ParseSubqueryExpression *subquery_expr)
-      : ParseTableReference(line_number, column_number),
-        subquery_expr_(subquery_expr) {
-  }
-
-  /**
-   * @brief Destructor.
-   */
-  ~ParseSubqueryTableReference() override {}
-
-  TableReferenceType getTableReferenceType() const override {
-    return kSubqueryTableReference;
-  }
-
-  std::string getName() const override { return "SubqueryTable"; }
-
-  /**
-   * @return The subquery expression.
-   */
-  const ParseSubqueryExpression* subquery_expr() const { return subquery_expr_.get(); }
-
- 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<const ParseTreeNode*> *non_container_child_fields,
-      std::vector<std::string> *container_child_field_names,
-      std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const override;
-
- private:
-  std::unique_ptr<ParseSubqueryExpression> subquery_expr_;
-
-  DISALLOW_COPY_AND_ASSIGN(ParseSubqueryTableReference);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-
-
-#endif /* QUICKSTEP_PARSER_PARSE_SUBQUERY_TABLE_REFERENCE_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/parser/ParseTableReference.cpp
----------------------------------------------------------------------
diff --git a/parser/ParseTableReference.cpp b/parser/ParseTableReference.cpp
deleted file mode 100644
index 3ac02f7..0000000
--- a/parser/ParseTableReference.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 "parser/ParseTableReference.hpp"
-
-#include <cstddef>
-#include <string>
-#include <vector>
-
-namespace quickstep {
-
-void ParseTableReferenceSignature::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<const ParseTreeNode*> *non_container_child_fields,
-    std::vector<std::string> *container_child_field_names,
-    std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const {
-  inline_field_names->push_back("table_alias");
-  inline_field_values->push_back(table_alias_->value());
-
-  if (column_aliases_ != nullptr && !column_aliases_->empty()) {
-    std::ostringstream oss;
-    PtrList<ParseString>::const_iterator argument_alias_it = column_aliases_->begin();
-    oss << "(" << argument_alias_it->value();
-    for (std::size_t i = 1; i < column_aliases_->size(); ++i) {
-      ++argument_alias_it;
-      oss << ", " << argument_alias_it->value();
-    }
-    oss << ")";
-    inline_field_names->push_back("columns");
-    inline_field_values->push_back(oss.str());
-  }
-}
-
-void ParseTableReference::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<const ParseTreeNode*> *non_container_child_fields,
-    std::vector<std::string> *container_child_field_names,
-    std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const {
-  if (table_reference_signature_ != nullptr) {
-    non_container_child_field_names->push_back("table_signature");
-    non_container_child_fields->push_back(table_reference_signature_.get());
-  }
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/parser/ParseTableReference.hpp
----------------------------------------------------------------------
diff --git a/parser/ParseTableReference.hpp b/parser/ParseTableReference.hpp
deleted file mode 100644
index 9ef71e4..0000000
--- a/parser/ParseTableReference.hpp
+++ /dev/null
@@ -1,158 +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_PARSER_PARSE_TABLE_REFERENCE_HPP_
-#define QUICKSTEP_PARSER_PARSE_TABLE_REFERENCE_HPP_
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "parser/ParseString.hpp"
-#include "parser/ParseTreeNode.hpp"
-#include "utility/Macros.hpp"
-#include "utility/PtrList.hpp"
-
-namespace quickstep {
-
-/** \addtogroup Parser
- *  @{
- */
-
-/**
- * @brief A table signature for a derived or base table that represents
- *        the table alias (correlation name) and derived
- *        column alias list.
- */
-class ParseTableReferenceSignature : public ParseTreeNode {
- public:
-  /**
-   * @brief Constructor. Takes ownership of all pointers.
-   *
-   * @param line_number The line number of the first token of this node in the SQL statement.
-   * @param column_number The column number of the first token of this node in the SQL statement.
-   * @param table_alias The table alias.
-   * @param column_aliases The column names for the table.
-   */
-  ParseTableReferenceSignature(const int line_number,
-                               const int column_number,
-                               ParseString *table_alias,
-                               PtrList<ParseString> *column_aliases = nullptr)
-      : ParseTreeNode(line_number, column_number),
-        table_alias_(table_alias),
-        column_aliases_(column_aliases) {
-  }
-
-  /**
-   * @brief Destructor.
-   */
-  ~ParseTableReferenceSignature() override {}
-
-  /**
-   * @return The table alias.
-   */
-  const ParseString* table_alias() const { return table_alias_.get(); }
-
-  /**
-   * @return The column aliases.
-   */
-  const PtrList<ParseString>* column_aliases() const { return column_aliases_.get(); }
-
-  std::string getName() const override { return "TableSignature"; }
-
- 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<const ParseTreeNode*> *non_container_child_fields,
-      std::vector<std::string> *container_child_field_names,
-      std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const override;
-
- private:
-  std::unique_ptr<ParseString> table_alias_;
-  std::unique_ptr<PtrList<ParseString>> column_aliases_;
-
-  DISALLOW_COPY_AND_ASSIGN(ParseTableReferenceSignature);
-};
-
-/**
- * @brief Base class for a FROM-list table item, which may be a subquery expression or a simple table reference.
- */
-class ParseTableReference : public ParseTreeNode {
- public:
-  enum TableReferenceType {
-    kGeneratorTableReference,
-    kJoinedTableReference,
-    kSimpleTableReference,
-    kSubqueryTableReference
-  };
-
-  /**
-   * @brief Destructor.
-   */
-  ~ParseTableReference() override {}
-
-  /**
-   * @return The TableReferenceType of this table reference.
-   */
-  virtual TableReferenceType getTableReferenceType() const = 0;
-
-  /**
-   * @brief Sets the table reference signature which gives the table name and table column names that can be used
-   *        to reference the table.
-   * @note Takes ownership of \p table_reference_signature.
-   *
-   * @param table_reference_signature The table reference signature.
-   */
-  void set_table_reference_signature(ParseTableReferenceSignature* table_reference_signature) {
-    table_reference_signature_.reset(table_reference_signature);
-  }
-
-  /**
-   * @return The table reference signature.
-   */
-  const ParseTableReferenceSignature* table_reference_signature() const {
-    return table_reference_signature_.get();
-  }
-
- protected:
-  ParseTableReference(const int line_number, const int column_number)
-      : ParseTreeNode(line_number, column_number) {
-  }
-
-  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<const ParseTreeNode*> *non_container_child_fields,
-      std::vector<std::string> *container_child_field_names,
-      std::vector<std::vector<const ParseTreeNode*>> *container_child_fields) const override;
-
- private:
-  std::unique_ptr<ParseTableReferenceSignature> table_reference_signature_;
-
-  DISALLOW_COPY_AND_ASSIGN(ParseTableReference);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_PARSER_PARSE_TABLE_REFERENCE_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/parser/ParseTreeNode.hpp
----------------------------------------------------------------------
diff --git a/parser/ParseTreeNode.hpp b/parser/ParseTreeNode.hpp
deleted file mode 100644
index c9158f7..0000000
--- a/parser/ParseTreeNode.hpp
+++ /dev/null
@@ -1,77 +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_PARSER_PARSE_TREE_NODE_HPP_
-#define QUICKSTEP_PARSER_PARSE_TREE_NODE_HPP_
-
-#include "utility/Macros.hpp"
-#include "utility/TreeStringSerializable.hpp"
-
-namespace quickstep {
-
-/** \addtogroup Parser
- *  @{
- */
-
-/**
- * @brief Base class for a parse tree node.
- */
-class ParseTreeNode : public TreeStringSerializable<const ParseTreeNode*> {
- public:
-  /**
-   * @brief Destructor.
-   */
-  ~ParseTreeNode() override {}
-
-  /**
-   * @brief Returns the line number.
-   *
-   * @return The line number of this node in the SQL statement.
-   */
-  int line_number() const { return line_number_; }
-
-  /**
-   * @brief Returns the column number.
-   *
-   * @return The column number of this node in the SQL statement.
-   */
-  int column_number() const { return column_number_; }
-
- protected:
-  ParseTreeNode(const int line_number, const int column_number)
-      : line_number_(line_number), column_number_(column_number) {
-  }
-
- private:
-  // 0-based line number of the first token of this parse tree node in the
-  // query string.
-  const int line_number_;
-
-  // 0-based column number of the first token of this parse tree node in the
-  // query string.
-  const int column_number_;
-
-  DISALLOW_COPY_AND_ASSIGN(ParseTreeNode);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif /* QUICKSTEP_PARSER_PARSE_TREE_NODE_HPP_ */

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/parser/ParseWindow.hpp
----------------------------------------------------------------------
diff --git a/parser/ParseWindow.hpp b/parser/ParseWindow.hpp
deleted file mode 100644
index 5d7bf98..0000000
--- a/parser/ParseWindow.hpp
+++ /dev/null
@@ -1,203 +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_PARSER_PARSE_WINDOW_HPP_
-#define QUICKSTEP_PARSER_PARSE_WINDOW_HPP_
-
-#include <cstdint>
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "parser/ParseExpression.hpp"
-#include "parser/ParseOrderBy.hpp"
-#include "parser/ParseString.hpp"
-#include "parser/ParseTreeNode.hpp"
-#include "utility/PtrList.hpp"
-
-namespace quickstep {
-
-/**
- * @brief The information of the how the framing in the window is defined
- **/
-struct ParseFrameInfo : ParseTreeNode {
-  /**
-   * @brief Constructor.
-   * @param row True if the frame mode is ROW, false if it is RANGE.
-   * @param num_pre The number of rows/value of range that is preceding
-   *                the current row in the frame.
-   * @param num_follow The number of rows/value of range that is following
-   *                   the current row in the frame.
-   **/
-  ParseFrameInfo(const int line_number,
-                 const int column_number,
-                 const bool is_row_in,
-                 const std::int64_t num_preceding_in,
-                 const std::int64_t num_following_in)
-      : ParseTreeNode(line_number, column_number),
-        is_row(is_row_in),
-        num_preceding(num_preceding_in),
-        num_following(num_following_in) {
-  }
-
-  std::string getName() const override { return "FrameInfo"; }
-
-  const bool is_row;
-  const std::int64_t num_preceding;
-  const std::int64_t num_following;
-
- 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<const ParseTreeNode *> *non_container_child_fields,
-      std::vector<std::string> *container_child_field_names,
-      std::vector<std::vector<const ParseTreeNode *>> *container_child_fields)
-      const override {
-    inline_field_names->push_back("frame_mode");
-    inline_field_values->push_back(is_row ? "row" : "range");
-
-    inline_field_names->push_back("num_preceding");
-    inline_field_values->push_back(std::to_string(num_preceding));
-
-    inline_field_names->push_back("num_following");
-    inline_field_values->push_back(std::to_string(num_following));
-  }
-};
-
-/**
- * @brief The parsed representation of a WINDOW definition.
- **/
-class ParseWindow : public ParseTreeNode {
- public:
-  /**
-   * @brief Constructor.
-   * @param line_number The line number of the first token of this WINDOW clause
-   *                    in the SQL statement.
-   * @param column_number The column number of the first token of this WINDOW
-   *                      clause in the SQL statement.
-   * @param partition_by_expressions Optional grouping expressions that might be
-   *                                 specified in the SQL statement. Similar to
-   *                                 GROUP BY with regular aggregates.
-   * @param order_by_expressions Optional ordering expressions that might be
-   *                             specified in the SQL statement.
-   * @param frame_info The information about framing.
-   **/
-  ParseWindow(const int line_number,
-              const int column_number,
-              PtrList<ParseExpression> *partition_by_expressions,
-              PtrList<ParseOrderByItem> *order_by_expressions,
-              ParseFrameInfo *frame_info)
-      : ParseTreeNode(line_number, column_number),
-        partition_by_expressions_(partition_by_expressions),
-        order_by_expressions_(order_by_expressions),
-        frame_info_(frame_info) {
-  }
-
-  /**
-   * @brief Destructor.
-   **/
-  ~ParseWindow() override {}
-
-  std::string getName() const override {
-    return "window";
-  }
-
-  /**
-   * @brief Grouping expressions.
-   **/
-  const PtrList<ParseExpression>* partition_by_expressions() const {
-    return partition_by_expressions_.get();
-  }
-
-  /**
-   * @brief Ordering expressions.
-   **/
-  const PtrList<ParseOrderByItem>* order_by_expressions() const {
-    return order_by_expressions_.get();
-  }
-
-  /**
-   * @brief Frame information.
-   **/
-  const ParseFrameInfo* frame_info() const {
-    return frame_info_.get();
-  }
-
-  /**
-   * @return The window name.
-   */
-  const ParseString* name() const {
-    return name_.get();
-  }
-
-  /**
-   * @brief Set the name of the window.
-   * @param name The name of the window.
-   **/
-  void setName(ParseString *name) {
-    name_.reset(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<const ParseTreeNode *> *non_container_child_fields,
-      std::vector<std::string> *container_child_field_names,
-      std::vector<std::vector<const ParseTreeNode *>> *container_child_fields) const override {
-    if (name_ != nullptr) {
-      inline_field_names->push_back("window_name");
-      inline_field_values->push_back(name_->value());
-    }
-
-    container_child_field_names->push_back("partition_by");
-    container_child_fields->emplace_back();
-    if (partition_by_expressions_ != nullptr) {
-      for (const auto &e : *partition_by_expressions_) {
-        container_child_fields->back().emplace_back(&e);
-      }
-    }
-
-    container_child_field_names->push_back("order_by");
-    container_child_fields->emplace_back();
-    if (order_by_expressions_ != nullptr) {
-      for (const auto &e : *order_by_expressions_) {
-        container_child_fields->back().emplace_back(&e);
-      }
-    }
-
-    if (frame_info_ != nullptr) {
-      non_container_child_field_names->push_back("frame_info");
-      non_container_child_fields->push_back(frame_info_.get());
-    }
-  }
-
- private:
-  std::unique_ptr<PtrList<ParseExpression>> partition_by_expressions_;
-  std::unique_ptr<PtrList<ParseOrderByItem>> order_by_expressions_;
-  std::unique_ptr<ParseFrameInfo> frame_info_;
-  std::unique_ptr<ParseString> name_;
-};
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_PARSER_PARSE_WINDOW_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/parser/ParserModule.hpp
----------------------------------------------------------------------
diff --git a/parser/ParserModule.hpp b/parser/ParserModule.hpp
deleted file mode 100644
index 4d45ed5..0000000
--- a/parser/ParserModule.hpp
+++ /dev/null
@@ -1,23 +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 Parser
- *
- * Quickstep's SQL parser.
- **/

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/parser/ParserUtil.cpp
----------------------------------------------------------------------
diff --git a/parser/ParserUtil.cpp b/parser/ParserUtil.cpp
deleted file mode 100644
index 743d10a..0000000
--- a/parser/ParserUtil.cpp
+++ /dev/null
@@ -1,45 +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 "parser/ParserUtil.hpp"
-
-#include "utility/SqlError.hpp"
-
-// From SqlLexer
-extern int quickstep_yyget_lineno(void *yyscanner);
-extern int quickstep_yyget_column(void *yyscanner);
-
-// From SqlParser
-extern int quickstep_yyget_line_number(const YYLTYPE *yyloc);
-extern int quickstep_yyget_column_number(const YYLTYPE *yyloc);
-
-void quickstep_yyerror(const YYLTYPE *yyloc,
-                       void *yyscanner,
-                       quickstep::ParseStatement **statement,
-                       const char *error_message) {
-  // If the error location is explicitly provided, use it;
-  // otherwise use the location stored in yyscanner.
-  if (yyloc != nullptr) {
-    throw ::quickstep::SqlError(quickstep_yyget_line_number(yyloc), quickstep_yyget_column_number(yyloc),
-                                error_message);
-  } else {
-    throw ::quickstep::SqlError(quickstep_yyget_lineno(yyscanner), quickstep_yyget_column(yyscanner),
-                                error_message);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/parser/ParserUtil.hpp
----------------------------------------------------------------------
diff --git a/parser/ParserUtil.hpp b/parser/ParserUtil.hpp
deleted file mode 100644
index fd993fe..0000000
--- a/parser/ParserUtil.hpp
+++ /dev/null
@@ -1,50 +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_PARSER_PARSER_UTIL_HPP_
-#define QUICKSTEP_PARSER_PARSER_UTIL_HPP_
-
-namespace quickstep {
-class ParseStatement;
-}
-
-struct YYLTYPE;
-
-/** \addtogroup Parser
- *  @{
- */
-
-/**
- * @brief Report a parsing error to STDERR.
- *
- * @param yyloc The error location, which may not be the same as the location in
- *              the token currently being scanned.
- * @param yyscanner The scanner context.
- * @param parsed_statement This parameter exists purely so that yyerror() will
- *        have the type signature expected by the parser, and is ignored.
- * @param s A string describing the error encountered.
- **/
-void quickstep_yyerror(const YYLTYPE *yyloc,
-                       void *yyscanner,
-                       quickstep::ParseStatement **statement,
-                       const char *error_message);
-
-/** @} */
-
-#endif  // QUICKSTEP_PARSER_PARSER_UTIL_HPP_


[44/51] [abbrv] [partial] incubator-quickstep git commit: remove c++ files

Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/cli/LineReader.cpp
----------------------------------------------------------------------
diff --git a/cli/LineReader.cpp b/cli/LineReader.cpp
deleted file mode 100644
index 002727d..0000000
--- a/cli/LineReader.cpp
+++ /dev/null
@@ -1,243 +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 "cli/LineReader.hpp"
-
-#include <algorithm>
-#include <cctype>
-#include <string>
-
-using std::ispunct;
-using std::size_t;
-using std::string;
-
-namespace quickstep {
-
-std::string LineReader::getNextCommand() {
-  string multiline_buffer(leftover_);
-
-  // Whether we are continuing to read a command across multiple lines of
-  // input.
-  bool continuing = false;
-
-  // The state of our micro command-scanner. Either normal SQL (where the whole
-  // command terminates with a semicolon), various types of quoted strings
-  // (which terminate with a closing quote, putting the state back to normal),
-  // or SQL comments (which terminate with a newline, putting the state back to
-  // normal).
-  LineState line_state = kNormal;
-
-  // The position we are scanning the multiline_buffer from.
-  size_t scan_position = 0;
-  // The position of a special character, which might terminate a statement or
-  // signify a change in the line_state.
-  for (;;) {
-    size_t special_char_location = string::npos;
-    switch (line_state) {
-      case kNormal:
-        // A semicolon to end the SQL command, or any character which might
-        // put us into a different mode.
-        special_char_location = multiline_buffer.find_first_of(";'\"-eE.\\", scan_position);
-        break;
-      case kSingleQuote:
-        // A single quote which ends the string (note that two successive
-        // single-quotes in a string, which the lexer will make into one
-        // single-quote, will still be fine here: we will go into kNormal
-        // and then, on the next iteration, immediately back into
-        // kSingleQuote).
-        special_char_location = multiline_buffer.find_first_of('\'', scan_position);
-        break;
-      case kSingleQuoteWithEscape:
-        // A single quote which ends the string, or the beginning of an escape
-        // sequence \' which does not end the string.
-        special_char_location = multiline_buffer.find_first_of("'\\", scan_position);
-        break;
-      case kDoubleQuote:
-        // A double quote which ends the string. As above, two successive
-        // double-quotes will still get handled properly.
-        special_char_location = multiline_buffer.find_first_of('"', scan_position);
-        break;
-      case kDoubleQuoteWithEscape:
-        // A single quote which ends the string, or the beginning of an escape
-        // sequence \" which does not end the string.
-        special_char_location = multiline_buffer.find_first_of("\"\\", scan_position);
-        break;
-      case kComment:
-      case kCommand:  // Fall Through.
-        // A newline which ends the command and comment and resumes normal SQL parsing.
-        special_char_location = multiline_buffer.find_first_of('\n', scan_position);
-        break;
-    }
-
-    if (special_char_location == string::npos) {
-      // No special character found in the buffer. Get some more input.
-      scan_position = multiline_buffer.size();
-      if (!getMoreInput(&multiline_buffer, &continuing)) {
-        return string("");
-      }
-    } else {
-      switch (line_state) {
-        case kNormal:
-          // In kNormal, we may end the SQL command or switch into one of the
-          // other states.
-          switch (multiline_buffer[special_char_location]) {
-            case ';':
-              // Command finished. Return it.
-              leftover_ = multiline_buffer.substr(special_char_location + 1);
-              // Clear 'leftover_' if it is blank to avoid counting the remaining
-              // lines in the previous command in computing the positions of each parser node.
-              if (std::all_of(leftover_.begin(), leftover_.end(), ::isspace)) {
-                leftover_.clear();
-              }
-              return multiline_buffer.substr(0, special_char_location + 1);
-            case '\'':
-              // Starting a single-quote string.
-              line_state = kSingleQuote;
-              scan_position = special_char_location + 1;
-              break;
-            case '"':
-              // Starting a double-quote string.
-              line_state = kDoubleQuote;
-              scan_position = special_char_location + 1;
-              break;
-            case '-':
-              // Possibly starting a comment. We must peek ahead to the next
-              // character to be sure.
-              if (multiline_buffer.size() > special_char_location + 1) {
-                if (multiline_buffer[special_char_location + 1] == '-') {
-                  line_state = kComment;
-                  scan_position = special_char_location + 2;
-                } else {
-                  // False alarm.
-                  scan_position = special_char_location + 1;
-                }
-              } else {
-                // No next character is available. Get more input and try
-                // again.
-                scan_position = special_char_location;
-                if (!getMoreInput(&multiline_buffer, &continuing)) {
-                  return string("");
-                }
-              }
-              break;
-            case 'e':
-            case 'E':
-              // e' or E' begins a quoted string with escape sequences. First,
-              // check that the e or E either begins the string or is
-              // immediately preceded by whitespace or punctuation.
-              if ((special_char_location == 0)
-                  || ::isspace(multiline_buffer[special_char_location - 1])
-                  || ::ispunct(multiline_buffer[special_char_location - 1])) {
-                // Peek ahead to see if the next character is a single-quote.
-                if (multiline_buffer.size() > special_char_location + 1) {
-                  if (multiline_buffer[special_char_location + 1] == '\'') {
-                    line_state = kSingleQuoteWithEscape;
-                    scan_position = special_char_location + 2;
-                  } else if (multiline_buffer[special_char_location + 1] == '\"') {
-                    line_state = kDoubleQuoteWithEscape;
-                    scan_position = special_char_location + 2;
-                  } else {
-                    // False alarm. Just a normal character.
-                    scan_position = special_char_location + 1;
-                  }
-                } else {
-                  // Can't peek ahead yet. Get more input and re-scan from
-                  // current position.
-                  scan_position = special_char_location;
-                  if (!getMoreInput(&multiline_buffer, &continuing)) {
-                    return string("");
-                  }
-                }
-              } else {
-                scan_position = special_char_location + 1;
-              }
-              break;
-            case '.':
-            case '\\':  //  Fall Through.
-              // If the dot or forward slash begins the line, begin a command search.
-              if (scan_position == 0) {
-                line_state = kCommand;
-              } else {
-                // This is a regular character, so skip over it.
-                scan_position = special_char_location + 1;
-              }
-              break;
-            default:
-              FATAL_ERROR("Unexpected special character in LineReader::getNextCommand()");
-          }
-          break;
-        case kSingleQuote:
-        case kDoubleQuote:
-        case kComment:
-          // Reached the terminal character for this state. Go back to normal
-          // SQL mode.
-          line_state = kNormal;
-          scan_position = special_char_location + 1;
-          break;
-        case kSingleQuoteWithEscape:
-          if (multiline_buffer[special_char_location] == '\'') {
-            line_state = kNormal;
-            scan_position = special_char_location + 1;
-          } else {
-            // Skip past an escape character.
-            scan_position = special_char_location + 2;
-          }
-          break;
-        case kDoubleQuoteWithEscape:
-          if (multiline_buffer[special_char_location] == '\"') {
-            line_state = kNormal;
-            scan_position = special_char_location + 1;
-          } else {
-            // Skip past an escape character.
-            scan_position = special_char_location + 2;
-          }
-          break;
-        case kCommand:
-          if (multiline_buffer[special_char_location] == '\n') {
-            // Command finished. Return it.
-            leftover_ = multiline_buffer.substr(special_char_location + 1);
-            // Clear 'leftover_' if it is blank to avoid counting the remaining
-            // lines in the previous command in computing the positions of each parser node.
-            if (std::all_of(leftover_.begin(), leftover_.end(), ::isspace)) {
-              leftover_.clear();
-            }
-            return multiline_buffer.substr(0, special_char_location + 1);
-          }
-          break;
-      }
-    }
-  }
-}
-
-bool LineReader::getMoreInput(std::string *input_buffer, bool *continuing) {
-  string nextline = getLineInternal(*continuing);
-  if (nextline.empty()) {
-    return false;
-  } else {
-    if (*continuing
-        || !std::all_of(nextline.begin(), nextline.end(), ::isspace)) {
-      // Don't show the continuing prompt if a blank line was entered.
-      *continuing = true;
-    }
-    input_buffer->append(nextline);
-    return true;
-  }
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/cli/LineReader.hpp
----------------------------------------------------------------------
diff --git a/cli/LineReader.hpp b/cli/LineReader.hpp
deleted file mode 100644
index c7c073f..0000000
--- a/cli/LineReader.hpp
+++ /dev/null
@@ -1,97 +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_CLI_LINE_READER_HPP_
-#define QUICKSTEP_CLI_LINE_READER_HPP_
-
-#include <string>
-
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-
-/** \addtogroup CLI
- *  @{
- */
-
-/**
- * @brief An interface for reading user input from command lines.
- **/
-class LineReader {
- public:
-  /**
-   * @brief Constructor.
-   *
-   * @param default_prompt The default command prompt.
-   * @param continue_prompt The prompt given when a command extends over more
-   *        than one line.
-   **/
-  LineReader(const std::string &default_prompt,
-             const std::string &continue_prompt)
-      : default_prompt_(default_prompt), continue_prompt_(continue_prompt) {
-  }
-
-  /**
-   * @brief Virtual destructor.
-   **/
-  virtual ~LineReader() {
-  }
-
-  /**
-   * @brief Obtain the next full SQL command from user input.
-   *
-   * @return The next user-inputted command.
-   **/
-  std::string getNextCommand();
-
- protected:
-  /**
-   * @brief Get the next newline-terminated line from input.
-   *
-   * @param continuing True if continuing a command from a previous line, false
-   *        otherwise.
-   * @return The next line of input.
-   **/
-  virtual std::string getLineInternal(const bool continuing) = 0;
-
-  const std::string default_prompt_;
-  const std::string continue_prompt_;
-  std::string leftover_;
-
- private:
-  enum LineState {
-    kNormal,
-    kSingleQuote,
-    kSingleQuoteWithEscape,
-    kDoubleQuote,
-    kDoubleQuoteWithEscape,
-    kComment,
-    kCommand
-  };
-
-  bool getMoreInput(std::string *input_buffer, bool *continuing);
-
-  DISALLOW_COPY_AND_ASSIGN(LineReader);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_CLI_LINE_READER_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/cli/LineReaderDumb.cpp
----------------------------------------------------------------------
diff --git a/cli/LineReaderDumb.cpp b/cli/LineReaderDumb.cpp
deleted file mode 100644
index 36edf73..0000000
--- a/cli/LineReaderDumb.cpp
+++ /dev/null
@@ -1,78 +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 "cli/LineReaderDumb.hpp"
-
-#include <cstddef>
-#include <cstdio>
-#include <string>
-
-using std::feof;
-using std::fflush;
-using std::fgetc;
-using std::fgets;
-using std::printf;
-using std::string;
-using std::ungetc;
-
-namespace quickstep {
-
-namespace {
-static constexpr std::size_t kReadBufferSize = 1024;
-}  // namespace
-
-LineReaderDumb::LineReaderDumb(const string &default_prompt, const string &continue_prompt)
-    : LineReader(default_prompt, continue_prompt) {
-}
-
-std::string LineReaderDumb::getLineInternal(const bool continuing) {
-  if (feof(stdin)) {
-    printf("\n");
-    return string("");
-  }
-
-  printf("%s", continuing ? continue_prompt_.c_str() : default_prompt_.c_str());
-  fflush(stdout);
-
-  string line;
-  char read_buffer[kReadBufferSize];
-  while (fgets(read_buffer, sizeof(read_buffer), stdin) != nullptr) {
-    line.append(read_buffer);
-    if ((!line.empty()) && (line.back() == '\n')) {
-      return line;
-    } else {
-      if (feof(stdin)) {
-        break;
-      }
-      const int next_char = fgetc(stdin);
-      if (next_char == EOF) {
-        break;
-      } else {
-        ungetc(next_char, stdin);
-      }
-    }
-  }
-
-  // The above while loop terminated because fgets() hit EOF before it got to
-  // a newline.
-  printf("\n");
-  return string("");
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/cli/LineReaderDumb.hpp
----------------------------------------------------------------------
diff --git a/cli/LineReaderDumb.hpp b/cli/LineReaderDumb.hpp
deleted file mode 100644
index 080268a..0000000
--- a/cli/LineReaderDumb.hpp
+++ /dev/null
@@ -1,54 +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_CLI_LINE_READER_DUMB_HPP_
-#define QUICKSTEP_CLI_LINE_READER_DUMB_HPP_
-
-#include <string>
-
-#include "cli/LineReader.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-
-/** \addtogroup CLI
- *  @{
- */
-
-/**
- * @brief An implementation of LineReader that uses cstdio and doesn't support
- *        history or command editing.
- **/
-class LineReaderDumb : public LineReader {
- public:
-  LineReaderDumb(const std::string &default_prompt,
-                 const std::string &continue_prompt);
-
- protected:
-  std::string getLineInternal(const bool continuing) override;
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(LineReaderDumb);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_CLI_LINE_READER_DUMB_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/cli/LineReaderLineNoise.cpp
----------------------------------------------------------------------
diff --git a/cli/LineReaderLineNoise.cpp b/cli/LineReaderLineNoise.cpp
deleted file mode 100644
index 9c3650e..0000000
--- a/cli/LineReaderLineNoise.cpp
+++ /dev/null
@@ -1,60 +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 "cli/LineReaderLineNoise.hpp"
-
-#include <algorithm>
-#include <cctype>
-#include <cstdlib>
-#include <string>
-#include <utility>
-
-#include "third_party/linenoise/linenoise.h"
-
-namespace quickstep {
-
-LineReaderLineNoise::LineReaderLineNoise(const std::string &default_prompt,
-                                         const std::string &continue_prompt)
-    : LineReader(default_prompt, continue_prompt) {
-}
-
-std::string LineReaderLineNoise::getLineInternal(const bool continuing) {
-  const char *prompt;
-  if (continuing) {
-    prompt = continue_prompt_.c_str();
-  } else {
-    prompt = default_prompt_.c_str();
-  }
-  char *input_line;
-
-  if ((input_line = linenoise(prompt)) != nullptr) {
-    std::string retval(input_line);
-    if (continuing
-        || !std::all_of(retval.begin(), retval.end(), ::isspace)) {
-      // Don't add a blank line that's not part of a command to history.
-      linenoiseHistoryAdd(input_line);
-    }
-    std::free(input_line);
-    return retval;
-  } else {
-    return std::string("");
-  }
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/cli/LineReaderLineNoise.hpp
----------------------------------------------------------------------
diff --git a/cli/LineReaderLineNoise.hpp b/cli/LineReaderLineNoise.hpp
deleted file mode 100644
index ec256f6..0000000
--- a/cli/LineReaderLineNoise.hpp
+++ /dev/null
@@ -1,57 +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_CLI_LINE_READER_LINE_NOISE_HPP_
-#define QUICKSTEP_CLI_LINE_READER_LINE_NOISE_HPP_
-
-#include <string>
-
-#include "cli/LineReader.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-
-/** \addtogroup CLI
- *  @{
- */
-
-/**
- * @brief An implementation of LineReader that uses linenoise to provide
- *        command-history and editing support.
- **/
-class LineReaderLineNoise : public LineReader {
- public:
-  LineReaderLineNoise(const std::string &default_prompt,
-                      const std::string &continue_prompt);
-
-  ~LineReaderLineNoise() override {
-  }
-
- protected:
-  std::string getLineInternal(const bool continuing) override;
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(LineReaderLineNoise);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_CLI_LINE_READER_LINE_NOISE_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/cli/PrintToScreen.cpp
----------------------------------------------------------------------
diff --git a/cli/PrintToScreen.cpp b/cli/PrintToScreen.cpp
deleted file mode 100644
index 7d06474..0000000
--- a/cli/PrintToScreen.cpp
+++ /dev/null
@@ -1,185 +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 "cli/PrintToScreen.hpp"
-
-#include <cstddef>
-#include <cstdio>
-#include <cmath>
-#include <memory>
-#include <vector>
-
-#include "catalog/CatalogAttribute.hpp"
-#include "catalog/CatalogRelation.hpp"
-#include "storage/StorageBlock.hpp"
-#include "storage/StorageBlockInfo.hpp"
-#include "storage/StorageManager.hpp"
-#include "storage/TupleIdSequence.hpp"
-#include "storage/TupleStorageSubBlock.hpp"
-#include "types/IntType.hpp"
-#include "types/Type.hpp"
-#include "types/TypedValue.hpp"
-#include "utility/Macros.hpp"
-
-#include "gflags/gflags.h"
-
-using std::fprintf;
-using std::fputc;
-using std::size_t;
-using std::vector;
-
-namespace quickstep {
-
-DEFINE_bool(printing_enabled, true,
-            "If true, print query results to screen normally. If false, skip "
-            "printing output (e.g. for benchmarking).");
-
-int PrintToScreen::GetNumberOfDigits(int number) {
-  if (number > 0) {
-    return static_cast<int>(log10 (number)) + 1;
-  } else if (number < 0) {
-    return static_cast<int>(log10 ( abs(number) )) + 2;
-  } else {
-    return 1;
-  }
-}
-
-void PrintToScreen::PrintRelation(const CatalogRelation &relation,
-                                  StorageManager *storage_manager,
-                                  FILE *out) {
-  if (!FLAGS_printing_enabled) {
-    return;
-  }
-
-  vector<int> column_widths;
-  column_widths.reserve(relation.size());
-
-  for (CatalogRelation::const_iterator attr_it = relation.begin();
-       attr_it != relation.end();
-       ++attr_it) {
-    // Printed column needs to be wide enough to print:
-    //   1. The attribute name (in the printed "header").
-    //   2. Any value of the attribute's Type.
-    //   3. If the attribute's Type is nullable, the 4-character string "NULL".
-    // We pick the largest of these 3 widths as the column width.
-    int column_width = static_cast<int>(attr_it->getDisplayName().length());
-    column_width = column_width < attr_it->getType().getPrintWidth()
-                   ? attr_it->getType().getPrintWidth()
-                   : column_width;
-    column_width = attr_it->getType().isNullable() && (column_width < 4)
-                   ? 4
-                   : column_width;
-    column_widths.push_back(column_width);
-  }
-
-  printHBar(column_widths, out);
-
-  fputc('|', out);
-  vector<int>::const_iterator width_it = column_widths.begin();
-  CatalogRelation::const_iterator attr_it = relation.begin();
-  for (; width_it != column_widths.end(); ++width_it, ++attr_it) {
-    fprintf(out,
-            "%-*s|",
-            *width_it,
-            attr_it->getDisplayName().c_str());
-  }
-  fputc('\n', out);
-
-  printHBar(column_widths, out);
-
-  std::vector<block_id> blocks = relation.getBlocksSnapshot();
-  for (const block_id current_block_id : blocks) {
-    BlockReference block = storage_manager->getBlock(current_block_id, relation);
-    const TupleStorageSubBlock &tuple_store = block->getTupleStorageSubBlock();
-
-    if (tuple_store.isPacked()) {
-      for (tuple_id tid = 0; tid <= tuple_store.getMaxTupleID(); ++tid) {
-        printTuple(tuple_store, tid, column_widths, out);
-      }
-    } else {
-      std::unique_ptr<TupleIdSequence> existence_map(tuple_store.getExistenceMap());
-      for (tuple_id tid : *existence_map) {
-        printTuple(tuple_store, tid, column_widths, out);
-      }
-    }
-  }
-
-  printHBar(column_widths, out);
-}
-
-void PrintToScreen::printHBar(const vector<int> &column_widths,
-                              FILE *out) {
-  fputc('+', out);
-  for (const int width : column_widths) {
-    for (int i = 0; i < width; ++i) {
-      fputc('-', out);
-    }
-    fputc('+', out);
-  }
-  fputc('\n', out);
-}
-
-void PrintToScreen::printTuple(const TupleStorageSubBlock &tuple_store,
-                               const tuple_id tid,
-                               const vector<int> &column_widths,
-                               FILE *out) {
-  DEBUG_ASSERT(tuple_store.hasTupleWithID(tid));
-  fputc('|', out);
-
-  const CatalogRelationSchema &relation = tuple_store.getRelation();
-  vector<int>::const_iterator width_it = column_widths.begin();
-  CatalogRelation::const_iterator attr_it = relation.begin();
-  for (; attr_it != relation.end(); ++attr_it, ++width_it) {
-    TypedValue value(tuple_store.getAttributeValueTyped(tid, attr_it->getID()));
-    if (value.isNull()) {
-      fprintf(out,
-              "%*s",
-              *width_it,
-              "NULL");
-    } else {
-      attr_it->getType().printValueToFile(value, out, *width_it);
-    }
-
-    fputc('|', out);
-  }
-  fputc('\n', out);
-}
-
-std::size_t PrintToScreen::GetNumTuplesInRelation(
-    const CatalogRelation &relation, StorageManager *storage_manager) {
-  const std::vector<block_id> &blocks = relation.getBlocksSnapshot();
-  std::size_t total_num_tuples = 0;
-  for (block_id block : blocks) {
-    total_num_tuples +=
-        storage_manager->getBlock(block, relation)->getNumTuples();
-  }
-  return total_num_tuples;
-}
-
-void PrintToScreen::PrintOutputSize(const CatalogRelation &relation,
-                                    StorageManager *storage_manager,
-                                    FILE *out) {
-  const std::size_t num_rows = GetNumTuplesInRelation(relation, storage_manager);
-  fprintf(out,
-          "(%lu %s)\n",
-          num_rows,
-          (num_rows == 1) ? "row" : "rows");
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/cli/PrintToScreen.hpp
----------------------------------------------------------------------
diff --git a/cli/PrintToScreen.hpp b/cli/PrintToScreen.hpp
deleted file mode 100644
index 2b5fd7e..0000000
--- a/cli/PrintToScreen.hpp
+++ /dev/null
@@ -1,99 +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_CLI_PRINT_TO_SCREEN_HPP_
-#define QUICKSTEP_CLI_PRINT_TO_SCREEN_HPP_
-
-#include <cstdio>
-#include <vector>
-
-#include "storage/StorageBlockInfo.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-
-class CatalogRelation;
-class StorageManager;
-class TupleStorageSubBlock;
-
-/** \addtogroup CLI
- *  @{
- */
-
-/**
- * @brief All static methods which print all of the tuples in a relation to
- *        a FILE* stream.
- **/
-class PrintToScreen {
- public:
-  static void PrintRelation(const CatalogRelation &relation,
-                            StorageManager *storage_manager,
-                            FILE *out);
-
-  static void printHBar(const std::vector<int> &column_widths,
-                        FILE *out);
-
-  /**
-   * @brief Get the total number of tuples in the given relation.
-   *
-   * @param relation The given relation.
-   * @param storage_manager The storage manager.
-   *
-   * @return The total number of tuples in the relation.
-   **/
-  static std::size_t GetNumTuplesInRelation(const CatalogRelation &relation,
-                                            StorageManager *storage_manager);
-
-  /**
-   * @brief Print the size of the output (i.e. number of rows in the relation).
-   *
-   * @param relation The given relation.
-   * @param storage_manager The storage manager.
-   * @param out The output stream.
-   **/
-  static void PrintOutputSize(const CatalogRelation &relation,
-                              StorageManager *storage_manager,
-                              FILE *out);
-
-  /**
-   * @brief Return the number of digits in a number
-   *
-   * @param number The input number.
-   * @param out The number of digits in the input number.
-   **/
-  static int GetNumberOfDigits(int number);
-
- private:
-  // Undefined default constructor. Class is all-static and should not be
-  // instantiated.
-  PrintToScreen();
-
-  static void printTuple(const TupleStorageSubBlock &tuple_store,
-                         const tuple_id tid,
-                         const std::vector<int> &column_widths,
-                         FILE *out);
-
-  DISALLOW_COPY_AND_ASSIGN(PrintToScreen);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_CLI_PRINT_TO_SCREEN_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/cli/QuickstepCli.cpp
----------------------------------------------------------------------
diff --git a/cli/QuickstepCli.cpp b/cli/QuickstepCli.cpp
deleted file mode 100644
index 656786a..0000000
--- a/cli/QuickstepCli.cpp
+++ /dev/null
@@ -1,451 +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.
- **/
-
-/* A standalone command-line interface to QuickStep */
-
-#include <chrono>
-#include <cstddef>
-#include <cstdio>
-#include <exception>
-#include <memory>
-#include <string>
-#include <utility>
-#include <vector>
-
-#include "cli/CliConfig.h"  // For QUICKSTEP_USE_LINENOISE, QUICKSTEP_ENABLE_GOOGLE_PROFILER.
-
-#include "cli/CommandExecutor.hpp"
-#include "cli/DropRelation.hpp"
-
-#ifdef QUICKSTEP_USE_LINENOISE
-#include "cli/LineReaderLineNoise.hpp"
-typedef quickstep::LineReaderLineNoise LineReaderImpl;
-#else
-#include "cli/LineReaderDumb.hpp"
-typedef quickstep::LineReaderDumb LineReaderImpl;
-#endif
-
-#ifdef QUICKSTEP_ENABLE_GOOGLE_PROFILER
-#include <gperftools/profiler.h>
-#endif
-
-#include "cli/DefaultsConfigurator.hpp"
-#include "cli/Flags.hpp"
-#include "cli/InputParserUtil.hpp"
-#include "cli/PrintToScreen.hpp"
-#include "parser/ParseStatement.hpp"
-#include "parser/SqlParserWrapper.hpp"
-#include "query_execution/ForemanSingleNode.hpp"
-#include "query_execution/QueryExecutionTypedefs.hpp"
-#include "query_execution/QueryExecutionUtil.hpp"
-#include "query_execution/Worker.hpp"
-#include "query_execution/WorkerDirectory.hpp"
-#include "query_optimizer/QueryHandle.hpp"
-#include "query_optimizer/QueryProcessor.hpp"
-#include "storage/StorageConfig.h"  // For QUICKSTEP_HAVE_FILE_MANAGER_HDFS.
-
-#ifdef QUICKSTEP_HAVE_FILE_MANAGER_HDFS
-#include "storage/FileManagerHdfs.hpp"
-#endif
-
-#include "storage/PreloaderThread.hpp"
-#include "storage/StorageConstants.hpp"
-#include "storage/StorageManager.hpp"
-#include "threading/ThreadIDBasedMap.hpp"
-#include "utility/ExecutionDAGVisualizer.hpp"
-#include "utility/Macros.hpp"
-#include "utility/PtrVector.hpp"
-#include "utility/SqlError.hpp"
-#include "utility/StringUtil.hpp"
-
-#include "gflags/gflags.h"
-
-#include "glog/logging.h"
-
-#include "tmb/id_typedefs.h"
-#include "tmb/message_bus.h"
-
-namespace quickstep {
-class CatalogRelation;
-}
-
-using std::fflush;
-using std::fprintf;
-using std::printf;
-using std::string;
-using std::vector;
-
-using quickstep::CatalogRelation;
-using quickstep::DefaultsConfigurator;
-using quickstep::DropRelation;
-using quickstep::FLAGS_num_workers;
-using quickstep::FLAGS_storage_path;
-using quickstep::ForemanSingleNode;
-using quickstep::InputParserUtil;
-using quickstep::MessageBusImpl;
-using quickstep::ParseResult;
-using quickstep::ParseStatement;
-using quickstep::PrintToScreen;
-using quickstep::PtrVector;
-using quickstep::QueryExecutionUtil;
-using quickstep::QueryHandle;
-using quickstep::QueryProcessor;
-using quickstep::SqlParserWrapper;
-using quickstep::Worker;
-using quickstep::WorkerDirectory;
-using quickstep::kAdmitRequestMessage;
-using quickstep::kCatalogFilename;
-using quickstep::kPoisonMessage;
-using quickstep::kWorkloadCompletionMessage;
-
-using tmb::client_id;
-
-namespace quickstep {
-
-DEFINE_bool(preload_buffer_pool, false,
-            "If true, pre-load all known blocks into buffer pool before "
-            "accepting queries (should also set --buffer_pool_slots to be "
-            "large enough to accomodate the entire database).");
-DEFINE_string(worker_affinities, "",
-              "A comma-separated list of CPU IDs to pin worker threads to "
-              "(leaving this empty will cause all worker threads to inherit "
-              "the affinity mask of the Quickstep process, which typically "
-              "means that they will all be runable on any CPU according to "
-              "the kernel's own scheduling policy).");
-DEFINE_bool(initialize_db, false, "If true, initialize a database.");
-DEFINE_bool(print_query, false,
-            "Print each input query statement. This is useful when running a "
-            "large number of queries in a batch.");
-DEFINE_string(profile_file_name, "",
-              "If nonempty, enable profiling using GOOGLE CPU Profiler, and write "
-              "its output to the given file name. This flag has no effect if "
-              "ENABLE_GOOGLE_PROFILER CMake flag was not set during build. "
-              "The profiler only starts collecting samples after the first query, "
-              "so that it runs against a warm buffer pool and caches. If you want to profile "
-              "everything, including the first query run, set the "
-              "environment variable CPUPROFILE instead of passing this flag.");
-              // Here's a detailed explanation of why we skip the first query run
-              // during profiling:
-              // Unless you\u2019ve preloaded the buffer pool (which is not always a good
-              // idea), the first run of the query results in disk I/O and other overhead
-              // that significantly skews the profiling results. It\u2019s the same reason we don\u2019t
-              // include the first run time in our benchmarking: when profiling query
-              // execution, it makes more sense to get numbers using a warm buffer pool and
-              // warm caches. This is not *always* the right thing to do: it\u2019s obviously
-              // wrong for profiling the TextScan operator. In those cases, you might want
-              // to put in your own Profiler probes (just follow the start/stop pattern used
-              // in this file) or just run quickstep with the CPUPROFILE environment variable
-              // set (as per gperftools documentation) to get the full profile for the
-              // entire execution.
-              // To put things in perspective, the first run is, in my experiments, about 5-10
-              // times more expensive than the average run. That means the query needs to be
-              // run at least a hundred times to make the impact of the first run small (< 5 %).
-
-DECLARE_bool(profile_and_report_workorder_perf);
-DECLARE_bool(visualize_execution_dag);
-
-}  // namespace quickstep
-
-int main(int argc, char* argv[]) {
-  google::InitGoogleLogging(argv[0]);
-  gflags::ParseCommandLineFlags(&argc, &argv, true);
-
-  printf("Starting Quickstep with %d worker thread(s) and a %.2f GB buffer pool.\n",
-         FLAGS_num_workers,
-         (static_cast<double>(quickstep::FLAGS_buffer_pool_slots) * quickstep::kSlotSizeBytes)/quickstep::kAGigaByte);
-
-#ifdef QUICKSTEP_HAVE_FILE_MANAGER_HDFS
-  if (quickstep::FLAGS_use_hdfs) {
-    LOG(INFO) << "Using HDFS as the default persistent storage, with namenode at "
-              << quickstep::FLAGS_hdfs_namenode_host << ":"
-              << quickstep::FLAGS_hdfs_namenode_port << " and block replication factor "
-              << quickstep::FLAGS_hdfs_num_replications << "\n";
-  }
-#endif
-
-  // Initialize the thread ID based map here before the Foreman and workers are
-  // constructed because the initialization isn't thread safe.
-  quickstep::ClientIDMap::Instance();
-
-  MessageBusImpl bus;
-  bus.Initialize();
-
-  // The TMB client id for the main thread, used to kill workers at the end.
-  const client_id main_thread_client_id = bus.Connect();
-  bus.RegisterClientAsSender(main_thread_client_id, kAdmitRequestMessage);
-  bus.RegisterClientAsSender(main_thread_client_id, kPoisonMessage);
-  bus.RegisterClientAsReceiver(main_thread_client_id, kWorkloadCompletionMessage);
-
-  quickstep::StorageManager storage_manager(FLAGS_storage_path);
-
-  string catalog_path(FLAGS_storage_path);
-  catalog_path.append(kCatalogFilename);
-  if (quickstep::FLAGS_initialize_db) {  // Initialize the database
-    DefaultsConfigurator::InitializeDefaultDatabase(FLAGS_storage_path, catalog_path);
-  }
-
-  // Setup QueryProcessor, including CatalogDatabase.
-  std::unique_ptr<QueryProcessor> query_processor;
-  try {
-    query_processor = std::make_unique<QueryProcessor>(std::move(catalog_path));
-  } catch (const std::exception &e) {
-    LOG(FATAL) << "FATAL ERROR DURING STARTUP: "
-               << e.what()
-               << "\nIf you intended to create a new database, "
-               << "please use the \"-initialize_db=true\" command line option.";
-  } catch (...) {
-    LOG(FATAL) << "NON-STANDARD EXCEPTION DURING STARTUP";
-  }
-
-  // Parse the CPU affinities for workers and the preloader thread, if enabled
-  // to warm up the buffer pool.
-  const vector<int> worker_cpu_affinities =
-      InputParserUtil::ParseWorkerAffinities(FLAGS_num_workers,
-                                             quickstep::FLAGS_worker_affinities);
-
-  const std::size_t num_numa_nodes_system = DefaultsConfigurator::GetNumNUMANodes();
-
-  if (quickstep::FLAGS_preload_buffer_pool) {
-    std::chrono::time_point<std::chrono::steady_clock> preload_start, preload_end;
-    preload_start = std::chrono::steady_clock::now();
-    printf("Preloading the buffer pool ... ");
-    fflush(stdout);
-    quickstep::PreloaderThread preloader(*query_processor->getDefaultDatabase(),
-                                         &storage_manager,
-                                         worker_cpu_affinities.front());
-
-    preloader.start();
-    preloader.join();
-    preload_end = std::chrono::steady_clock::now();
-    printf("in %g seconds\n",
-           std::chrono::duration<double>(preload_end - preload_start).count());
-  }
-
-  // Get the NUMA affinities for workers.
-  vector<int> cpu_numa_nodes = InputParserUtil::GetNUMANodesForCPUs();
-  if (cpu_numa_nodes.empty()) {
-    // libnuma is not present. Assign -1 as the NUMA node for every worker.
-    cpu_numa_nodes.assign(worker_cpu_affinities.size(), -1);
-  }
-
-  vector<int> worker_numa_nodes;
-  PtrVector<Worker> workers;
-  vector<client_id> worker_client_ids;
-
-  // Initialize the worker threads.
-  DCHECK_EQ(static_cast<std::size_t>(FLAGS_num_workers),
-            worker_cpu_affinities.size());
-  for (std::size_t worker_thread_index = 0;
-       worker_thread_index < worker_cpu_affinities.size();
-       ++worker_thread_index) {
-    int numa_node_id = -1;
-    if (worker_cpu_affinities[worker_thread_index] >= 0) {
-      // This worker can be NUMA affinitized.
-      numa_node_id = cpu_numa_nodes[worker_cpu_affinities[worker_thread_index]];
-    }
-    worker_numa_nodes.push_back(numa_node_id);
-
-    workers.push_back(
-        new Worker(worker_thread_index, &bus, worker_cpu_affinities[worker_thread_index]));
-    worker_client_ids.push_back(workers.back().getBusClientID());
-  }
-
-  // TODO(zuyu): Move WorkerDirectory within Shiftboss once the latter is added.
-  WorkerDirectory worker_directory(worker_cpu_affinities.size(),
-                                   worker_client_ids,
-                                   worker_numa_nodes);
-
-  ForemanSingleNode foreman(
-      main_thread_client_id,
-      &worker_directory,
-      &bus,
-      query_processor->getDefaultDatabase(),
-      &storage_manager,
-      -1,  // Don't pin the Foreman thread.
-      num_numa_nodes_system);
-
-  // Start the worker threads.
-  for (Worker &worker : workers) {
-    worker.start();
-  }
-
-  foreman.start();
-
-  LineReaderImpl line_reader("quickstep> ",
-                             "      ...> ");
-  std::unique_ptr<SqlParserWrapper> parser_wrapper(new SqlParserWrapper());
-  std::chrono::time_point<std::chrono::steady_clock> start, end;
-
-#ifdef QUICKSTEP_ENABLE_GOOGLE_PROFILER
-  bool started_profiling = false;
-#endif
-  for (;;) {
-    string *command_string = new string();
-    *command_string = line_reader.getNextCommand();
-    if (command_string->size() == 0) {
-      delete command_string;
-      break;
-    }
-
-    if (quickstep::FLAGS_print_query) {
-      printf("\n%s\n", command_string->c_str());
-    }
-
-    parser_wrapper->feedNextBuffer(command_string);
-
-    bool quitting = false;
-    // A parse error should reset the parser. This is because the thrown quickstep
-    // SqlError does not do the proper reset work of the YYABORT macro.
-    bool reset_parser = false;
-    for (;;) {
-      ParseResult result = parser_wrapper->getNextStatement();
-      const ParseStatement &statement = *result.parsed_statement;
-      if (result.condition == ParseResult::kSuccess) {
-        if (statement.getStatementType() == ParseStatement::kQuit) {
-          quitting = true;
-          break;
-        }
-
-        if (statement.getStatementType() == ParseStatement::kCommand) {
-          try {
-            quickstep::cli::executeCommand(
-                statement,
-                *(query_processor->getDefaultDatabase()),
-                main_thread_client_id,
-                foreman.getBusClientID(),
-                &bus,
-                &storage_manager,
-                query_processor.get(),
-                stdout);
-          } catch (const quickstep::SqlError &sql_error) {
-            fprintf(stderr, "%s",
-                    sql_error.formatMessage(*command_string).c_str());
-            reset_parser = true;
-            break;
-          }
-          continue;
-        }
-
-        std::unique_ptr<QueryHandle> query_handle(
-            std::make_unique<QueryHandle>(query_processor->query_id(),
-                                          main_thread_client_id,
-                                          statement.getPriority()));
-        try {
-          query_processor->generateQueryHandle(statement, query_handle.get());
-        } catch (const quickstep::SqlError &sql_error) {
-          fprintf(stderr, "%s", sql_error.formatMessage(*command_string).c_str());
-          reset_parser = true;
-          break;
-        }
-
-        DCHECK(query_handle->getQueryPlanMutable() != nullptr);
-        std::unique_ptr<quickstep::ExecutionDAGVisualizer> dag_visualizer;
-        if (quickstep::FLAGS_visualize_execution_dag) {
-          dag_visualizer.reset(
-              new quickstep::ExecutionDAGVisualizer(*query_handle->getQueryPlanMutable()));
-        }
-
-        start = std::chrono::steady_clock::now();
-        QueryExecutionUtil::ConstructAndSendAdmitRequestMessage(
-            main_thread_client_id,
-            foreman.getBusClientID(),
-            query_handle.get(),
-            &bus);
-
-        try {
-          QueryExecutionUtil::ReceiveQueryCompletionMessage(
-              main_thread_client_id, &bus);
-          end = std::chrono::steady_clock::now();
-
-          const CatalogRelation *query_result_relation = query_handle->getQueryResultRelation();
-          if (query_result_relation) {
-            PrintToScreen::PrintRelation(*query_result_relation,
-                                         &storage_manager,
-                                         stdout);
-            PrintToScreen::PrintOutputSize(
-                *query_result_relation,
-                &storage_manager,
-                stdout);
-
-            DropRelation::Drop(*query_result_relation,
-                               query_processor->getDefaultDatabase(),
-                               &storage_manager);
-          }
-
-          query_processor->saveCatalog();
-          std::chrono::duration<double, std::milli> time_ms = end - start;
-          printf("Time: %s ms\n",
-                 quickstep::DoubleToStringWithSignificantDigits(
-                     time_ms.count(), 3).c_str());
-          if (quickstep::FLAGS_profile_and_report_workorder_perf) {
-            // TODO(harshad) - Allow user specified file instead of stdout.
-            foreman.printWorkOrderProfilingResults(query_handle->query_id(),
-                                                   stdout);
-          }
-          if (quickstep::FLAGS_visualize_execution_dag) {
-            const auto &profiling_stats =
-                foreman.getWorkOrderProfilingResults(query_handle->query_id());
-            dag_visualizer->bindProfilingStats(profiling_stats);
-            std::cerr << "\n" << dag_visualizer->toDOT() << "\n";
-          }
-        } catch (const std::exception &e) {
-          fprintf(stderr, "QUERY EXECUTION ERROR: %s\n", e.what());
-          break;
-        }
-      } else {
-        if (result.condition == ParseResult::kError) {
-          fprintf(stderr, "%s", result.error_message.c_str());
-        }
-        reset_parser = true;
-        break;
-      }
-#ifdef QUICKSTEP_ENABLE_GOOGLE_PROFILER
-      // Profile only if profile_file_name flag is set
-      if (!started_profiling && !quickstep::FLAGS_profile_file_name.empty()) {
-        started_profiling = true;
-        ProfilerStart(quickstep::FLAGS_profile_file_name.c_str());
-      }
-#endif
-    }
-
-    if (quitting) {
-      break;
-    } else if (reset_parser) {
-      parser_wrapper.reset(new SqlParserWrapper());
-      reset_parser = false;
-    }
-  }
-
-#ifdef QUICKSTEP_ENABLE_GOOGLE_PROFILER
-  if (started_profiling) {
-    ProfilerStop();
-    ProfilerFlush();
-  }
-#endif
-
-  // Kill the foreman and workers.
-  QueryExecutionUtil::BroadcastPoisonMessage(main_thread_client_id, &bus);
-
-  for (Worker &worker : workers) {
-    worker.join();
-  }
-
-  foreman.join();
-  return 0;
-}

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/cli/tests/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/cli/tests/CMakeLists.txt b/cli/tests/CMakeLists.txt
deleted file mode 100644
index 99fa3a3..0000000
--- a/cli/tests/CMakeLists.txt
+++ /dev/null
@@ -1,52 +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.
-
-add_subdirectory(command_executor)
-
-add_executable(quickstep_cli_tests_CommandExecutorTest
-               CommandExecutorTest.cpp
-               CommandExecutorTestRunner.cpp
-               CommandExecutorTestRunner.hpp
-               "${PROJECT_SOURCE_DIR}/utility/textbased_test/TextBasedTest.cpp"
-               "${PROJECT_SOURCE_DIR}/utility/textbased_test/TextBasedTest.hpp")
-
-target_link_libraries(quickstep_cli_tests_CommandExecutorTest
-                      glog
-                      gtest
-                      gtest_main
-                      quickstep_catalog_CatalogDatabase
-                      quickstep_cli_CommandExecutor
-                      quickstep_cli_DropRelation
-                      quickstep_cli_PrintToScreen
-                      quickstep_parser_ParseStatement
-                      quickstep_parser_SqlParserWrapper
-                      quickstep_queryexecution_AdmitRequestMessage
-                      quickstep_queryexecution_ForemanSingleNode
-                      quickstep_queryexecution_QueryExecutionTypedefs
-                      quickstep_queryexecution_QueryExecutionUtil
-                      quickstep_queryexecution_Worker
-                      quickstep_queryexecution_WorkerDirectory
-                      quickstep_queryoptimizer_Optimizer
-                      quickstep_queryoptimizer_OptimizerContext
-                      quickstep_queryoptimizer_QueryHandle
-                      quickstep_queryoptimizer_tests_TestDatabaseLoader
-                      quickstep_utility_Macros
-                      quickstep_utility_MemStream
-                      quickstep_utility_SqlError
-                      quickstep_utility_TextBasedTestDriver
-                      tmb
-                      ${LIBS})

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/cli/tests/CommandExecutorTest.cpp
----------------------------------------------------------------------
diff --git a/cli/tests/CommandExecutorTest.cpp b/cli/tests/CommandExecutorTest.cpp
deleted file mode 100644
index 6ad2183..0000000
--- a/cli/tests/CommandExecutorTest.cpp
+++ /dev/null
@@ -1,58 +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 <iostream>
-#include <fstream>
-#include <memory>
-
-#include "cli/tests/CommandExecutorTestRunner.hpp"
-#include "utility/textbased_test/TextBasedTestDriver.hpp"
-
-#include "glog/logging.h"
-
-using quickstep::TextBasedTest;
-
-QUICKSTEP_GENERATE_TEXT_TEST(COMMAND_EXECUTOR_TEST);
-
-int main(int argc, char** argv) {
-  google::InitGoogleLogging(argv[0]);
-
-  if (argc < 4) {
-    LOG(ERROR) << "Must have at least 3 arguments, but " << argc - 1
-               << " are provided";
-  }
-
-  std::ifstream input_file(argv[1]);
-  CHECK(input_file.is_open()) << argv[1];
-  std::unique_ptr<quickstep::CommandExecutorTestRunner>
-      test_runner(
-          new quickstep::CommandExecutorTestRunner(argv[3]));
-  test_driver.reset(
-      new quickstep::TextBasedTestDriver(&input_file, test_runner.get()));
-  test_driver->registerOption(
-      quickstep::CommandExecutorTestRunner::kResetOption);
-
-  ::testing::InitGoogleTest(&argc, argv);
-  const int success = RUN_ALL_TESTS();
-  if (success != 0) {
-    test_driver->writeActualOutputToFile(argv[2]);
-  }
-
-  return success;
-}

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/cli/tests/CommandExecutorTestRunner.cpp
----------------------------------------------------------------------
diff --git a/cli/tests/CommandExecutorTestRunner.cpp b/cli/tests/CommandExecutorTestRunner.cpp
deleted file mode 100644
index 41cc9da..0000000
--- a/cli/tests/CommandExecutorTestRunner.cpp
+++ /dev/null
@@ -1,134 +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 "cli/tests/CommandExecutorTestRunner.hpp"
-
-#include <cstdio>
-#include <set>
-#include <string>
-#include <utility>
-
-#include "cli/CommandExecutor.hpp"
-#include "cli/DropRelation.hpp"
-#include "cli/PrintToScreen.hpp"
-#include "parser/ParseStatement.hpp"
-#include "query_execution/AdmitRequestMessage.hpp"
-#include "query_execution/ForemanSingleNode.hpp"
-#include "query_execution/QueryExecutionTypedefs.hpp"
-#include "query_optimizer/Optimizer.hpp"
-#include "query_optimizer/OptimizerContext.hpp"
-#include "query_optimizer/QueryHandle.hpp"
-#include "utility/MemStream.hpp"
-#include "utility/SqlError.hpp"
-
-#include "glog/logging.h"
-
-#include "tmb/tagged_message.h"
-
-namespace quickstep {
-
-class CatalogRelation;
-
-namespace O = ::quickstep::optimizer;
-
-const char CommandExecutorTestRunner::kResetOption[] =
-    "reset_before_execution";
-
-void CommandExecutorTestRunner::runTestCase(
-    const std::string &input, const std::set<std::string> &options,
-    std::string *output) {
-  // TODO(qzeng): Test multi-threaded query execution when we have a Sort operator.
-
-  VLOG(4) << "Test SQL(s): " << input;
-
-  if (options.find(kResetOption) != options.end()) {
-    test_database_loader_.clear();
-    test_database_loader_.createTestRelation(false /* allow_vchar */);
-    test_database_loader_.loadTestRelation();
-  }
-
-  MemStream output_stream;
-  sql_parser_.feedNextBuffer(new std::string(input));
-
-  while (true) {
-    ParseResult result = sql_parser_.getNextStatement();
-    if (result.condition != ParseResult::kSuccess) {
-      if (result.condition == ParseResult::kError) {
-        *output = result.error_message;
-      }
-      break;
-    } else {
-      const ParseStatement &parse_statement = *result.parsed_statement;
-      std::printf("%s\n", parse_statement.toString().c_str());
-      try {
-        if (parse_statement.getStatementType() == ParseStatement::kCommand) {
-          quickstep::cli::executeCommand(
-              *result.parsed_statement,
-              *(test_database_loader_.catalog_database()),
-              main_thread_client_id_,
-              foreman_->getBusClientID(),
-              &bus_,
-              test_database_loader_.storage_manager(),
-              nullptr,
-              output_stream.file());
-        } else {
-          QueryHandle query_handle(0 /* query_id */, main_thread_client_id_);
-          O::OptimizerContext optimizer_context;
-
-          optimizer_.generateQueryHandle(parse_statement,
-                                         test_database_loader_.catalog_database(),
-                                         &optimizer_context,
-                                         &query_handle);
-
-          AdmitRequestMessage request_message(&query_handle);
-          TaggedMessage admit_tagged_message(
-              &request_message, sizeof(request_message), kAdmitRequestMessage);
-          QueryExecutionUtil::SendTMBMessage(&bus_,
-                                             main_thread_client_id_,
-                                             foreman_->getBusClientID(),
-                                             std::move(admit_tagged_message));
-
-          // Receive workload completion message from Foreman.
-          const AnnotatedMessage annotated_msg =
-              bus_.Receive(main_thread_client_id_, 0, true);
-          const TaggedMessage &tagged_message = annotated_msg.tagged_message;
-          DCHECK_EQ(kWorkloadCompletionMessage, tagged_message.message_type());
-          const CatalogRelation *query_result_relation = query_handle.getQueryResultRelation();
-          if (query_result_relation) {
-            PrintToScreen::PrintRelation(*query_result_relation,
-                                         test_database_loader_.storage_manager(),
-                                         output_stream.file());
-            DropRelation::Drop(*query_result_relation,
-                               test_database_loader_.catalog_database(),
-                               test_database_loader_.storage_manager());
-          }
-        }
-      } catch (const SqlError &error) {
-        *output = error.formatMessage(input);
-        break;
-      }
-    }
-  }
-
-  if (output->empty()) {
-    *output = output_stream.str();
-  }
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/cli/tests/CommandExecutorTestRunner.hpp
----------------------------------------------------------------------
diff --git a/cli/tests/CommandExecutorTestRunner.hpp b/cli/tests/CommandExecutorTestRunner.hpp
deleted file mode 100644
index 83c5a9a..0000000
--- a/cli/tests/CommandExecutorTestRunner.hpp
+++ /dev/null
@@ -1,122 +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_CLI_TESTS_COMMAND_EXECUTOR_TEST_RUNNER_HPP_
-#define QUICKSTEP_CLI_TESTS_COMMAND_EXECUTOR_TEST_RUNNER_HPP_
-
-#include <memory>
-#include <set>
-#include <string>
-#include <utility>
-#include <vector>
-
-#include "parser/SqlParserWrapper.hpp"
-#include "query_execution/ForemanSingleNode.hpp"
-#include "query_execution/QueryExecutionTypedefs.hpp"
-#include "query_execution/QueryExecutionUtil.hpp"
-#include "query_execution/Worker.hpp"
-#include "query_execution/WorkerDirectory.hpp"
-#include "query_execution/WorkerMessage.hpp"
-#include "query_optimizer/Optimizer.hpp"
-#include "query_optimizer/tests/TestDatabaseLoader.hpp"
-#include "utility/Macros.hpp"
-#include "utility/textbased_test/TextBasedTestDriver.hpp"
-
-#include "tmb/id_typedefs.h"
-#include "tmb/message_bus.h"
-
-namespace quickstep {
-
-/**
- * @brief TextBasedTestRunner for testing the ExecutionGenerator.
- */
-class CommandExecutorTestRunner : public TextBasedTestRunner {
- public:
-  /**
-   * @brief If this option is enabled, recreate the entire database and
-   * repopulate the data before every test.
-   */
-  static const char kResetOption[];
-
-  /**
-   * @brief Constructor.
-   */
-  explicit CommandExecutorTestRunner(const std::string &storage_path)
-      : test_database_loader_(storage_path) {
-    test_database_loader_.createTestRelation(false /* allow_vchar */);
-    test_database_loader_.loadTestRelation();
-
-    bus_.Initialize();
-
-    main_thread_client_id_ = bus_.Connect();
-    bus_.RegisterClientAsSender(main_thread_client_id_, kAdmitRequestMessage);
-    bus_.RegisterClientAsSender(main_thread_client_id_, kPoisonMessage);
-    bus_.RegisterClientAsReceiver(main_thread_client_id_, kWorkloadCompletionMessage);
-
-    worker_.reset(new Worker(0, &bus_));
-
-    std::vector<client_id> worker_client_ids;
-    worker_client_ids.push_back(worker_->getBusClientID());
-
-    // We don't use the NUMA aware version of foreman code.
-    std::vector<int> numa_nodes;
-    numa_nodes.push_back(-1);
-
-    workers_.reset(new WorkerDirectory(1 /* number of workers */,
-                                       worker_client_ids, numa_nodes));
-    foreman_.reset(
-        new ForemanSingleNode(main_thread_client_id_,
-                              workers_.get(),
-                              &bus_,
-                              test_database_loader_.catalog_database(),
-                              test_database_loader_.storage_manager()));
-
-    foreman_->start();
-    worker_->start();
-  }
-
-  ~CommandExecutorTestRunner() {
-    QueryExecutionUtil::BroadcastPoisonMessage(main_thread_client_id_, &bus_);
-    worker_->join();
-    foreman_->join();
-  }
-
-  void runTestCase(const std::string &input,
-                   const std::set<std::string> &options,
-                   std::string *output) override;
-
- private:
-  SqlParserWrapper sql_parser_;
-  optimizer::TestDatabaseLoader test_database_loader_;
-  optimizer::Optimizer optimizer_;
-
-  tmb::client_id main_thread_client_id_;
-
-  MessageBusImpl bus_;
-  std::unique_ptr<ForemanSingleNode> foreman_;
-  std::unique_ptr<Worker> worker_;
-
-  std::unique_ptr<WorkerDirectory> workers_;
-
-  DISALLOW_COPY_AND_ASSIGN(CommandExecutorTestRunner);
-};
-
-}  // namespace quickstep
-
-#endif  //  QUICKSTEP_CLI_TESTS_COMMAND_EXECUTOR_TEST_RUNNER_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/cli/tests/command_executor/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/cli/tests/command_executor/CMakeLists.txt b/cli/tests/command_executor/CMakeLists.txt
deleted file mode 100644
index 0bdf865..0000000
--- a/cli/tests/command_executor/CMakeLists.txt
+++ /dev/null
@@ -1,33 +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.
-
-add_test(quickstep_cli_tests_commandexecutor_d
-         "../quickstep_cli_tests_CommandExecutorTest"
-         "${CMAKE_CURRENT_SOURCE_DIR}/D.test"
-         "${CMAKE_CURRENT_BINARY_DIR}/Dt.test"
-         "${CMAKE_CURRENT_BINARY_DIR}/D/")
-add_test(quickstep_cli_tests_commandexecutor_dt
-         "../quickstep_cli_tests_CommandExecutorTest"
-         "${CMAKE_CURRENT_SOURCE_DIR}/Dt.test"
-         "${CMAKE_CURRENT_BINARY_DIR}/Dt.test"
-         "${CMAKE_CURRENT_BINARY_DIR}/Dt/")
-
-# Create the folders where the unit tests will store their data blocks for the
-# duration of their test.
-file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/D)
-file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/Dt)
-

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/cli/tests/command_executor/D.test
----------------------------------------------------------------------
diff --git a/cli/tests/command_executor/D.test b/cli/tests/command_executor/D.test
deleted file mode 100644
index 1b35b58..0000000
--- a/cli/tests/command_executor/D.test
+++ /dev/null
@@ -1,122 +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.
-
-CREATE TABLE foo (col1 INT,
-                  col2 LONG,
-                  col3 DOUBLE,
-                  col4 FLOAT,
-                  col5 CHAR(5));
-CREATE TABLE foo2 (col1 INT,
-                   col2 LONG,
-                   col3 DOUBLE,
-                   col4 FLOAT,
-                   averyverylongcolumnnamefortest CHAR(5));
-CREATE TABLE foo3 (col1 INT,
-                   col2 LONG,
-                   col3 DOUBLE,
-                   col4 FLOAT,
-                   col5 CHAR(5));
-CREATE INDEX foo3_index_1 ON foo3 (col1) USING CSBTREE;
-CREATE TABLE foo4 (col1 INT,
-                   col2 LONG,
-                   col3 DOUBLE,
-                   col4 FLOAT,
-                   col5 CHAR(5));
-CREATE INDEX foo4_index_1 ON foo4 (col1, col2) USING CSBTREE;
-CREATE INDEX foo4_index_2 ON foo4 (col3, col4) USING CSBTREE;
-CREATE TABLE averylongtablenamethatseemstoneverend (col1 INT);
-DROP TABLE TEST;
-INSERT INTO averylongtablenamethatseemstoneverend VALUES (1);
-INSERT INTO averylongtablenamethatseemstoneverend VALUES (2);
-INSERT INTO averylongtablenamethatseemstoneverend VALUES (3);
-INSERT INTO foo values(1, 1, 1.0, 1.0, 'XYZ');
-INSERT INTO foo values(2, 1, 1.0, 1.0, 'XYZ');
-INSERT INTO foo values(3, 1, 1.0, 1.0, 'XYZ');
-INSERT INTO foo values(4, 1, 1.0, 1.0, 'XYZ');
-INSERT INTO foo values(5, 1, 1.0, 1.0, 'XYZ');
-INSERT INTO foo2 values(5, 1, 1.0, 1.0, 'XYZ');
-INSERT INTO foo2 values(5, 1, 1.0, 1.0, 'XYZ');
-INSERT INTO foo3 values(5, 1, 1.0, 1.0, 'XYZZ');
---
-==
-\d foo
---
- Table "foo"
- Column | Type   
-+-------+--------+
- col1   | Int    
- col2   | Long   
- col3   | Double 
- col4   | Float  
- col5   | Char(5)
-==
-\d foo2
---
- Table "foo2"
- Column                         | Type   
-+-------------------------------+--------+
- col1                           | Int    
- col2                           | Long   
- col3                           | Double 
- col4                           | Float  
- averyverylongcolumnnamefortest | Char(5)
-==
-\d foo3
---
- Table "foo3"
- Column | Type   
-+-------+--------+
- col1   | Int    
- col2   | Long   
- col3   | Double 
- col4   | Float  
- col5   | Char(5)
- Indexes
-  "foo3_index_1" CSB_TREE (col1)
-==
-\d foo4
---
- Table "foo4"
- Column | Type   
-+-------+--------+
- col1   | Int    
- col2   | Long   
- col3   | Double 
- col4   | Float  
- col5   | Char(5)
- Indexes
-  "foo4_index_2" CSB_TREE (col3, col4)
-  "foo4_index_1" CSB_TREE (col1, col2)
-==
-\d
---
-       List of relations
-
- Name                                  | Type  | Blocks 
-+--------------------------------------+-------+---------+
- foo                                   | table | 1      
- foo2                                  | table | 1      
- foo3                                  | table | 1      
- foo4                                  | table | 0      
- averylongtablenamethatseemstoneverend | table | 1      
-
-==
-\d invalidtable
---
-ERROR:  Unrecognized relation invalidtable (1 : 4)
-\d invalidtable
-   ^

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/cli/tests/command_executor/Dt.test
----------------------------------------------------------------------
diff --git a/cli/tests/command_executor/Dt.test b/cli/tests/command_executor/Dt.test
deleted file mode 100644
index 8d81029..0000000
--- a/cli/tests/command_executor/Dt.test
+++ /dev/null
@@ -1,79 +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.
-
-CREATE TABLE foo (col1 INT,
-                  col2 LONG,
-                  col3 DOUBLE,
-                  col4 FLOAT,
-                  col5 CHAR(5));
-CREATE TABLE foo2 (col1 INT,
-                   col2 LONG,
-                   col3 DOUBLE,
-                   col4 FLOAT,
-                   averyverylongcolumnnamefortest CHAR(5));
-CREATE TABLE foo3 (col1 INT,
-                   col2 LONG,
-                   col3 DOUBLE,
-                   col4 FLOAT,
-                   col5 CHAR(5));
-CREATE TABLE foo4 (col1 INT,
-                   col2 LONG,
-                   col3 DOUBLE,
-                   col4 FLOAT,
-                   col5 CHAR(5));
-DROP TABLE TEST;
-CREATE TABLE averylongtablenamethatseemstoneverend (col1 INT);
-INSERT INTO averylongtablenamethatseemstoneverend VALUES (1);
-INSERT INTO averylongtablenamethatseemstoneverend VALUES (2);
-INSERT INTO averylongtablenamethatseemstoneverend VALUES (3);
-INSERT INTO foo values(1, 1, 1.0, 1.0, 'XYZ');
-INSERT INTO foo values(2, 1, 1.0, 1.0, 'XYZ');
-INSERT INTO foo values(3, 1, 1.0, 1.0, 'XYZ');
-INSERT INTO foo values(4, 1, 1.0, 1.0, 'XYZ');
-INSERT INTO foo values(5, 1, 1.0, 1.0, 'XYZ');
-INSERT INTO foo2 values(5, 1, 1.0, 1.0, 'XYZ');
-INSERT INTO foo2 values(5, 1, 1.0, 1.0, 'XYZ');
-INSERT INTO foo3 values(5, 1, 1.0, 1.0, 'XYZZ');
---
-==
-\dt
---
-       List of relations
-
- Name                                  | Type  | Blocks 
-+--------------------------------------+-------+---------+
- foo                                   | table | 1      
- foo2                                  | table | 1      
- foo3                                  | table | 1      
- foo4                                  | table | 0      
- averylongtablenamethatseemstoneverend | table | 1      
-
-==
-\dt foo
---
-       List of relations
-
- Name   | Type  | Blocks 
-+-------+-------+---------+
- foo    | table | 1      
-
-==
-\dt invalidtable
---
-ERROR:  Unrecognized relation invalidtable (1 : 5)
-\dt invalidtable
-    ^

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/cmake/FindGSasl.cmake
----------------------------------------------------------------------
diff --git a/cmake/FindGSasl.cmake b/cmake/FindGSasl.cmake
deleted file mode 100644
index 28fb5b8..0000000
--- a/cmake/FindGSasl.cmake
+++ /dev/null
@@ -1,42 +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.
-
-# - Try to find the GNU sasl library (gsasl)
-#
-# Once done this will define
-#
-#  GSASL_FOUND - System has gnutls
-#  GSASL_INCLUDE_DIR - The gnutls include directory
-#  GSASL_LIBRARY - The libraries needed to use gnutls
-
-
-IF (GSASL_INCLUDE_DIR AND GSASL_LIBRARY)
-	# in cache already
-  SET(GSASL_FIND_QUIETLY TRUE)
-ENDIF (GSASL_INCLUDE_DIR AND GSASL_LIBRARY)
-
-FIND_PATH(GSASL_INCLUDE_DIR gsasl.h)
-
-FIND_LIBRARY(GSASL_LIBRARY gsasl)
-
-INCLUDE(FindPackageHandleStandardArgs)
-
-# handle the QUIETLY and REQUIRED arguments and set GSASL_FOUND to TRUE if
-# all listed variables are TRUE
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(GSASL DEFAULT_MSG GSASL_LIBRARY GSASL_INCLUDE_DIR)
-
-MARK_AS_ADVANCED(GSASL_INCLUDE_DIR GSASL_LIBRARY)

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/cmake/FindKerberos.cmake
----------------------------------------------------------------------
diff --git a/cmake/FindKerberos.cmake b/cmake/FindKerberos.cmake
deleted file mode 100644
index 11835fb..0000000
--- a/cmake/FindKerberos.cmake
+++ /dev/null
@@ -1,40 +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.
-
-# - Find kerberos
-# Find the native KERBEROS includes and library
-#
-#  KERBEROS_INCLUDE_DIR - where to find krb5.h, etc.
-#  KERBEROS_LIBRARY    - List of libraries when using krb5.
-#  KERBEROS_FOUND        - True if krb5 found.
-
-IF (KERBEROS_INCLUDE_DIR)
-  # Already in cache, be silent
-  SET(KERBEROS_FIND_QUIETLY TRUE)
-ENDIF (KERBEROS_INCLUDE_DIR)
-
-FIND_PATH(KERBEROS_INCLUDE_DIR krb5.h)
-
-SET(KERBEROS_NAMES krb5 k5crypto com_err)
-FIND_LIBRARY(KERBEROS_LIBRARY NAMES ${KERBEROS_NAMES})
-
-# handle the QUIETLY and REQUIRED arguments and set KERBEROS_FOUND to TRUE if
-# all listed variables are TRUE
-INCLUDE(FindPackageHandleStandardArgs)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(KERBEROS DEFAULT_MSG KERBEROS_LIBRARY KERBEROS_INCLUDE_DIR)
-
-MARK_AS_ADVANCED(KERBEROS_LIBRARY KERBEROS_INCLUDE_DIR)

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/cmake/FindLibNuma.cmake
----------------------------------------------------------------------
diff --git a/cmake/FindLibNuma.cmake b/cmake/FindLibNuma.cmake
deleted file mode 100644
index 47a65f4..0000000
--- a/cmake/FindLibNuma.cmake
+++ /dev/null
@@ -1,28 +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.
-
-# Module to find LibNuma
-find_path(LIBNUMA_INCLUDE_DIR NAMES numa.h numaif.h)
-find_library(LIBNUMA_LIBRARY NAMES numa)
-
-include (FindPackageHandleStandardArgs)
-find_package_handle_standard_args(LibNuma DEFAULT_MSG
-                                  LIBNUMA_LIBRARY
-                                  LIBNUMA_INCLUDE_DIR)
-
-mark_as_advanced(LIBNUMA_INCLUDE_DIR LIBNUMA_LIBRARY)
-

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/cmake/FindLibhdfs3.cmake
----------------------------------------------------------------------
diff --git a/cmake/FindLibhdfs3.cmake b/cmake/FindLibhdfs3.cmake
deleted file mode 100644
index 7bd7c7c..0000000
--- a/cmake/FindLibhdfs3.cmake
+++ /dev/null
@@ -1,39 +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.
-
-# Module to find the Pivotal libhdfs3.
-
-find_path(LIBHDFS3_INCLUDE_DIR hdfs/hdfs.h)
-
-find_library(LIBHDFS3_LIBRARY NAMES hdfs3 libhdfs3)
-
-# Linking against libhdfs3 also requires linking against gsasl and kerberos.
-find_package(GSasl REQUIRED)
-find_package(Kerberos REQUIRED)
-
-set(LIBHDFS3_LIBRARIES ${LIBHDFS3_LIBRARY}
-                       ${GSASL_LIBRARY}
-                       ${KERBEROS_LIBRARY})
-set(LIBHDFS3_INCLUDE_DIRS ${LIBHDFS3_INCLUDE_DIR}
-                          ${GSASL_INCLUDE_DIR}
-                          ${KERBEROS_INCLUDE_DIR})
-
-include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(Libhdfs3 DEFAULT_MSG
-                                  LIBHDFS3_LIBRARY LIBHDFS3_INCLUDE_DIR)
-
-mark_as_advanced(LIBHDFS3_INCLUDE_DIR LIBHDFS3_LIBRARY)

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/compression/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/compression/CMakeLists.txt b/compression/CMakeLists.txt
deleted file mode 100644
index ede899c..0000000
--- a/compression/CMakeLists.txt
+++ /dev/null
@@ -1,78 +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.
-
-# Declare micro-libs:
-add_library(quickstep_compression_CompressionDictionary
-            CompressionDictionary.cpp
-            CompressionDictionary.hpp)
-add_library(quickstep_compression_CompressionDictionaryBuilder
-            CompressionDictionaryBuilder.cpp
-            CompressionDictionaryBuilder.hpp)
-add_library(quickstep_compression_CompressionDictionaryLite
-            CompressionDictionaryLite.cpp
-            CompressionDictionaryLite.hpp)
-
-# Link dependencies:
-target_link_libraries(quickstep_compression_CompressionDictionary
-                      glog
-                      quickstep_compression_CompressionDictionaryLite
-                      quickstep_types_Type
-                      quickstep_types_TypedValue
-                      quickstep_types_operations_comparisons_ComparisonID
-                      quickstep_types_operations_comparisons_ComparisonUtil
-                      quickstep_types_operations_comparisons_EqualComparison
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_compression_CompressionDictionaryBuilder
-                      glog
-                      quickstep_types_Type
-                      quickstep_types_TypedValue
-                      quickstep_types_operations_comparisons_ComparisonUtil
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_compression_CompressionDictionaryLite
-                      glog
-                      quickstep_types_Type
-                      quickstep_types_TypedValue
-                      quickstep_utility_Macros)
-
-# Module all-in-one library:
-add_library(quickstep_compression ../empty_src.cpp CompressionModule.hpp)
-target_link_libraries(quickstep_compression
-                      quickstep_compression_CompressionDictionary
-                      quickstep_compression_CompressionDictionaryBuilder
-                      quickstep_compression_CompressionDictionaryLite)
-
-# Tests:
-add_executable(CompressionDictionary_unittest "${CMAKE_CURRENT_SOURCE_DIR}/tests/CompressionDictionary_unittest.cpp")
-target_link_libraries(CompressionDictionary_unittest
-                      gtest
-                      gtest_main
-                      quickstep_compression_CompressionDictionary
-                      quickstep_compression_CompressionDictionaryBuilder
-                      quickstep_types_CharType
-                      quickstep_types_DoubleType
-                      quickstep_types_IntType
-                      quickstep_types_Type
-                      quickstep_types_TypeFactory
-                      quickstep_types_TypeID
-                      quickstep_types_TypedValue
-                      quickstep_types_VarCharType
-                      quickstep_types_operations_comparisons_Comparison
-                      quickstep_types_operations_comparisons_ComparisonFactory
-                      quickstep_types_operations_comparisons_ComparisonID
-                      quickstep_utility_ScopedBuffer
-                      ${LIBS})
-add_test(CompressionDictionary_unittest CompressionDictionary_unittest)


[17/51] [abbrv] [partial] incubator-quickstep git commit: remove c++ files

Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_execution/Shiftboss.hpp
----------------------------------------------------------------------
diff --git a/query_execution/Shiftboss.hpp b/query_execution/Shiftboss.hpp
deleted file mode 100644
index 6538d48..0000000
--- a/query_execution/Shiftboss.hpp
+++ /dev/null
@@ -1,259 +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_EXECUTION_SHIFTBOSS_HPP_
-#define QUICKSTEP_QUERY_EXECUTION_SHIFTBOSS_HPP_
-
-#include <cstddef>
-#include <cstdint>
-#include <memory>
-#include <unordered_map>
-
-#include "catalog/CatalogDatabaseCache.hpp"
-#include "catalog/CatalogTypedefs.hpp"
-#include "query_execution/QueryContext.hpp"
-#include "query_execution/QueryExecutionTypedefs.hpp"
-#include "query_execution/WorkerDirectory.hpp"
-#include "threading/Thread.hpp"
-#include "utility/Macros.hpp"
-
-#include "glog/logging.h"
-
-#include "tmb/address.h"
-#include "tmb/id_typedefs.h"
-#include "tmb/message_bus.h"
-
-namespace quickstep {
-
-class StorageManager;
-
-namespace serialization {
-class CatalogDatabase;
-class QueryContext;
-}  // namespace serialization
-
-/** \addtogroup QueryExecution
- *  @{
- */
-
-/**
- * @brief The Shiftboss accepts workorder protos from shiftboss, and assigns
- *        the workorders to workers.
- **/
-class Shiftboss : public Thread {
- public:
-  /**
-   * @brief Constructor.
-   *
-   * @param bus A pointer to the TMB.
-   * @param storage_manager The StorageManager to use.
-   * @param workers A pointer to the WorkerDirectory.
-   * @param cpu_id The ID of the CPU to which the Shiftboss thread can be pinned.
-   *
-   * @note If cpu_id is not specified, Shiftboss thread can be possibly moved
-   *       around on different CPUs by the OS.
-  **/
-  Shiftboss(tmb::MessageBus *bus,
-            StorageManager *storage_manager,
-            WorkerDirectory *workers,
-            const int cpu_id = -1)
-      : bus_(DCHECK_NOTNULL(bus)),
-        storage_manager_(DCHECK_NOTNULL(storage_manager)),
-        workers_(DCHECK_NOTNULL(workers)),
-        cpu_id_(cpu_id),
-        shiftboss_client_id_(tmb::kClientIdNone),
-        foreman_client_id_(tmb::kClientIdNone),
-        max_msgs_per_worker_(1),
-        start_worker_index_(0u) {
-    // Check to have at least one Worker.
-    DCHECK_GT(workers->getNumWorkers(), 0u);
-
-    shiftboss_client_id_ = bus_->Connect();
-    LOG(INFO) << "Shiftboss TMB client ID: " << shiftboss_client_id_;
-    DCHECK_NE(shiftboss_client_id_, tmb::kClientIdNone);
-
-    // Messages between Foreman and Shiftboss.
-    bus_->RegisterClientAsSender(shiftboss_client_id_, kShiftbossRegistrationMessage);
-    bus_->RegisterClientAsReceiver(shiftboss_client_id_, kShiftbossRegistrationResponseMessage);
-
-    bus_->RegisterClientAsReceiver(shiftboss_client_id_, kQueryInitiateMessage);
-    bus_->RegisterClientAsSender(shiftboss_client_id_, kQueryInitiateResponseMessage);
-
-    bus_->RegisterClientAsReceiver(shiftboss_client_id_, kInitiateRebuildMessage);
-    bus_->RegisterClientAsSender(shiftboss_client_id_, kInitiateRebuildResponseMessage);
-
-    bus_->RegisterClientAsReceiver(shiftboss_client_id_, kSaveQueryResultMessage);
-    bus_->RegisterClientAsSender(shiftboss_client_id_, kSaveQueryResultResponseMessage);
-
-    // Message sent to Worker.
-    bus_->RegisterClientAsSender(shiftboss_client_id_, kShiftbossRegistrationResponseMessage);
-    bus_->RegisterClientAsSender(shiftboss_client_id_, kRebuildWorkOrderMessage);
-
-    // Forward the following message types from Foreman to Workers.
-    bus_->RegisterClientAsReceiver(shiftboss_client_id_, kWorkOrderMessage);
-    bus_->RegisterClientAsSender(shiftboss_client_id_, kWorkOrderMessage);
-
-    // Forward the following message types from Workers to Foreman.
-    bus_->RegisterClientAsReceiver(shiftboss_client_id_, kCatalogRelationNewBlockMessage);
-    bus_->RegisterClientAsSender(shiftboss_client_id_, kCatalogRelationNewBlockMessage);
-
-    bus_->RegisterClientAsReceiver(shiftboss_client_id_, kDataPipelineMessage);
-    bus_->RegisterClientAsSender(shiftboss_client_id_, kDataPipelineMessage);
-
-    bus_->RegisterClientAsReceiver(shiftboss_client_id_, kWorkOrderFeedbackMessage);
-    bus_->RegisterClientAsSender(shiftboss_client_id_, kWorkOrderFeedbackMessage);
-
-    bus_->RegisterClientAsReceiver(shiftboss_client_id_, kWorkOrderCompleteMessage);
-    bus_->RegisterClientAsSender(shiftboss_client_id_, kWorkOrderCompleteMessage);
-
-    bus_->RegisterClientAsReceiver(shiftboss_client_id_, kRebuildWorkOrderCompleteMessage);
-    bus_->RegisterClientAsSender(shiftboss_client_id_, kRebuildWorkOrderCompleteMessage);
-
-    // Clean up query execution states, i.e., QueryContext.
-    bus_->RegisterClientAsReceiver(shiftboss_client_id_, kQueryTeardownMessage);
-
-    // Stop itself.
-    bus_->RegisterClientAsReceiver(shiftboss_client_id_, kPoisonMessage);
-    // Stop all workers.
-    bus_->RegisterClientAsSender(shiftboss_client_id_, kPoisonMessage);
-
-    for (std::size_t i = 0; i < workers_->getNumWorkers(); ++i) {
-      worker_addresses_.AddRecipient(workers_->getClientID(i));
-    }
-
-    registerWithForeman();
-  }
-
-  ~Shiftboss() override {
-  }
-
-  /**
-   * @brief Get the TMB client ID of Shiftboss thread.
-   *
-   * @return TMB client ID of shiftboss thread.
-   **/
-  inline tmb::client_id getBusClientID() const {
-    return shiftboss_client_id_;
-  }
-
-  /**
-   * @brief Get the Work Order processing capacity of all Workers managed by
-   *        Shiftboss during a single round of WorkOrder dispatch.
-   **/
-  inline std::size_t getWorkOrderCapacity() const {
-    DCHECK_NE(max_msgs_per_worker_, 0u);
-    return max_msgs_per_worker_ * workers_->getNumWorkers();
-  }
-
-  /**
-   * @brief Get the Worker to assign WorkOrders for execution. Block to wait if
-   *        all Workers have reached their capacity for queued WorkOrders.
-   **/
-  // TODO(zuyu): To achieve non-blocking, we need a queue to cache received
-  // normal Work Order protos from Foreman and the generated rebuild Work Orders.
-  inline std::size_t getSchedulableWorker();
-
-  /**
-   * @brief Set the maximum number of messages that should be allocated to each
-   *        worker during a single round of WorkOrder dispatch.
-   *
-   * @param max_msgs_per_worker Maximum number of messages.
-   **/
-  inline void setMaxMessagesPerWorker(const std::size_t max_msgs_per_worker) {
-    max_msgs_per_worker_ = max_msgs_per_worker;
-  }
-
- protected:
-  /**
-   * @brief The shiftboss receives workorders, and based on the response it
-   *        assigns workorders to workers.
-   *
-   * @note  The workers who get the messages from the Shiftboss execute and
-   *        subsequently delete the WorkOrder contained in the message.
-   **/
-  void run() override;
-
- private:
-  void registerWithForeman();
-
-  void processShiftbossRegistrationResponseMessage();
-
-  /**
-   * @brief Process the Shiftboss initiate message and ack back.
-   *
-   * @param query_id The given query id.
-   * @param catalog_database_cache_proto The proto used to update
-   *        CatalogDatabaseCache.
-   * @param query_context_proto The QueryContext proto.
-   **/
-  void processQueryInitiateMessage(const std::size_t query_id,
-                                   const serialization::CatalogDatabase &catalog_database_cache_proto,
-                                   const serialization::QueryContext &query_context_proto);
-
-  /**
-   * @brief Process the RebuildWorkOrder initiate message and ack back.
-   *
-   * @param query_id The ID of the query to which this RebuildWorkOrder initiate
-   *        message belongs.
-   * @param op_index The index of the operator for rebuild work orders.
-   * @param dest_index The InsertDestination index in QueryContext to rebuild.
-   * @param rel_id The relation that needs to generate rebuild work orders.
-   **/
-  void processInitiateRebuildMessage(const std::size_t query_id,
-                                     const std::size_t op_index,
-                                     const QueryContext::insert_destination_id dest_index,
-                                     const relation_id rel_id);
-
-  // TODO(zuyu): Use two buses for the message communication between Foreman and Shiftboss,
-  // and Shiftboss and Worker thread pool.
-  tmb::MessageBus *bus_;
-
-  CatalogDatabaseCache database_cache_;
-  StorageManager *storage_manager_;
-  WorkerDirectory *workers_;
-
-  // The ID of the CPU that the Shiftboss thread can optionally be pinned to.
-  const int cpu_id_;
-
-  tmb::client_id shiftboss_client_id_, foreman_client_id_;
-
-  // Unique per Shiftboss instance.
-  std::uint64_t shiftboss_index_;
-
-  // TMB recipients for all workers managed by this Shiftboss.
-  tmb::Address worker_addresses_;
-
-  // During a single round of WorkOrder dispatch, a Worker should be allocated
-  // at most these many WorkOrders.
-  std::size_t max_msgs_per_worker_;
-
-  // The worker index for scheduling Work Order.
-  std::size_t start_worker_index_;
-
-  // QueryContexts per query.
-  std::unordered_map<std::size_t, std::unique_ptr<QueryContext>> query_contexts_;
-
-  DISALLOW_COPY_AND_ASSIGN(Shiftboss);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_QUERY_EXECUTION_SHIFTBOSS_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_execution/ShiftbossDirectory.hpp
----------------------------------------------------------------------
diff --git a/query_execution/ShiftbossDirectory.hpp b/query_execution/ShiftbossDirectory.hpp
deleted file mode 100644
index 88d3039..0000000
--- a/query_execution/ShiftbossDirectory.hpp
+++ /dev/null
@@ -1,186 +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_EXECUTION_SHIFTBOSS_DIRECTORY_HPP_
-#define QUICKSTEP_QUERY_EXECUTION_SHIFTBOSS_DIRECTORY_HPP_
-
-#include <cstddef>
-#include <unordered_map>
-#include <utility>
-#include <vector>
-
-#include "utility/Macros.hpp"
-
-#include "glog/logging.h"
-
-#include "tmb/id_typedefs.h"
-
-namespace quickstep {
-
-/** \addtogroup QueryExecution
- *  @{
- */
-
-/**
- * @brief A class which keeps the metadata about the shiftbosses.
- *
- * @note This class is intended to be used only by ForemanDistributed thread.
- *       Therefore, none of the methods in this class are thread-safe.
- **/
-class ShiftbossDirectory {
- public:
-  /**
-   * @brief Constructor.
-  **/
-  ShiftbossDirectory() = default;
-
-  /**
-   * @brief Add the Shiftboss.
-   *
-   * @param shiftboss_id the TMB client ID of Shiftboss thread.
-   * @param capacity The Work Order processing capacity of Shiftboss.
-   **/
-  void addShiftboss(const tmb::client_id shiftboss_id,
-                    const std::size_t capacity) {
-    client_id_indices_.emplace(shiftboss_id, client_ids_.size());
-    client_ids_.push_back(shiftboss_id);
-    work_order_capacities_.push_back(capacity);
-    num_queued_work_orders_.push_back(0u);
-  }
-
-  /**
-   * @brief Whether the ShiftbossDirectory has any Shiftboss.
-   *
-   * @return True if no Shiftboss in ShiftbossDirectory. Otherwise false.
-   **/
-  bool empty() const {
-    DCHECK_EQ(client_ids_.empty(), client_id_indices_.empty());
-    DCHECK_EQ(client_ids_.empty(), work_order_capacities_.empty());
-    DCHECK_EQ(client_ids_.empty(), num_queued_work_orders_.empty());
-
-    return client_ids_.empty();
-  }
-
-  /**
-   * @brief Get the number of Shiftboss in ShiftbossDirectory.
-   *
-   * @return The number of Shiftboss in ShiftbossDirectory.
-   **/
-  std::size_t size() const {
-    DCHECK_EQ(client_ids_.size(), client_id_indices_.size());
-    DCHECK_EQ(client_ids_.size(), work_order_capacities_.size());
-    DCHECK_EQ(client_ids_.size(), num_queued_work_orders_.size());
-
-    return client_ids_.size();
-  }
-
-  /**
-   * @brief Get the TMB client ID of the specified Shiftboss.
-   *
-   * @param shiftboss_index The index of Shiftboss.
-   *
-   * @return The TMB client ID of the given Shiftboss.
-   **/
-  tmb::client_id getClientId(const std::size_t shiftboss_index) const {
-    DCHECK_LT(shiftboss_index, size());
-    return client_ids_[shiftboss_index];
-  }
-
-  /**
-   * @brief Get the Shiftboss index from the specified client id.
-   *
-   * @param shiftboss_id The TMB client ID of Shiftboss.
-   *
-   * @return The index of the given Shiftboss.
-   **/
-  std::size_t getShiftbossIndex(const tmb::client_id shiftboss_id) const {
-    const auto it = client_id_indices_.find(shiftboss_id);
-    DCHECK(it != client_id_indices_.end());
-
-    return it->second;
-  }
-
-  /**
-   * @brief Whether the given Shiftboss has reached its capacity.
-   *
-   * @param shiftboss_index The index of Shiftboss.
-   *
-   * @return True if reached the capacity. Otherwise false.
-   **/
-  bool hasReachedCapacity(const std::size_t shiftboss_index) const {
-    DCHECK_LT(shiftboss_index, size());
-    return num_queued_work_orders_[shiftboss_index] >= work_order_capacities_[shiftboss_index];
-  }
-
-  /**
-   * @brief Add the number of new work orders for the given Shiftboss.
-   *
-   * @param shiftboss_index The index of Shiftboss.
-   * @param num_new_work_orders The number of the new work orders will be
-   *        executed on Shiftboss indexed by 'shiftboss_index'.
-   **/
-  void addNumQueuedWorkOrders(const std::size_t shiftboss_index,
-                              const std::size_t num_new_work_orders) {
-    num_queued_work_orders_[shiftboss_index] += num_new_work_orders;
-  }
-
-  /**
-   * @brief Increase the number of queued workorders for the given Shiftboss by 1.
-   *
-   * @param shiftboss_index The index of Shiftboss.
-   **/
-  void incrementNumQueuedWorkOrders(const std::size_t shiftboss_index) {
-    DCHECK_LT(shiftboss_index, size());
-    ++num_queued_work_orders_[shiftboss_index];
-  }
-
-  /**
-   * @brief Decrease the number of queued workorders for the given Shiftboss by 1.
-   *
-   * @param shiftboss_index The index of Shiftboss.
-   **/
-  void decrementNumQueuedWorkOrders(const std::size_t shiftboss_index) {
-    DCHECK_LT(shiftboss_index, size());
-    DCHECK_GE(num_queued_work_orders_[shiftboss_index], 1u);
-    --num_queued_work_orders_[shiftboss_index];
-  }
-
- private:
-  // The TMB client IDs of Shiftbosses.
-  // TODO(zuyu): Support deletions, as Shiftbosses go down.
-  std::vector<tmb::client_id> client_ids_;
-
-  // The map from the TMB client ID of Shiftboss to its index in 'client_ids_'.
-  std::unordered_map<tmb::client_id, std::size_t> client_id_indices_;
-
-  // The max number of WorkOrders per Shiftboss.
-  std::vector<std::size_t> work_order_capacities_;
-
-  // The number of WorkOrders queued for execution per Shiftboss, and the value
-  // should be not greater than that of work_order_capacities_.
-  std::vector<std::size_t> num_queued_work_orders_;
-
-  DISALLOW_COPY_AND_ASSIGN(ShiftbossDirectory);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_QUERY_EXECUTION_SHIFTBOSS_DIRECTORY_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_execution/WorkOrderProtosContainer.hpp
----------------------------------------------------------------------
diff --git a/query_execution/WorkOrderProtosContainer.hpp b/query_execution/WorkOrderProtosContainer.hpp
deleted file mode 100644
index b037332..0000000
--- a/query_execution/WorkOrderProtosContainer.hpp
+++ /dev/null
@@ -1,149 +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_EXECUTION_WORKORDER_PROTOS_CONTAINER_HPP_
-#define QUICKSTEP_QUERY_EXECUTION_WORKORDER_PROTOS_CONTAINER_HPP_
-
-#include <cstddef>
-#include <memory>
-#include <queue>
-#include <vector>
-
-#include "relational_operators/WorkOrder.pb.h"  // IWYU pragma: keep
-#include "utility/Macros.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-/** \addtogroup QueryExecution
- *  @{
- */
-
- /**
-  * @brief A container used in the distributed version to hold the normal
-  *        (non-rebuild) WorkOrder protos for a given query.
-  *
-  * @note This container stays alive during the lifetime of the query.
-  **/
-class WorkOrderProtosContainer {
- public:
-  /**
-   * @brief Constructor
-   *
-   * @param num_operators Number of operators in the query DAG.
-   **/
-  explicit WorkOrderProtosContainer(const std::size_t num_operators)
-      : num_operators_(num_operators),
-        operator_containers_(num_operators_) {
-    DCHECK_NE(num_operators_, 0u);
-  }
-
-  /**
-   * @brief Destructor.
-   *
-   * @note If the query is executed normally, we should never encounter a
-   *       situation where at the time of deletion the WorkOrderProtosContainer has
-   *       pending WorkOrders.
-   **/
-  ~WorkOrderProtosContainer() {
-    for (std::size_t op = 0; op < num_operators_; ++op) {
-      if (hasWorkOrderProto(op)) {
-        LOG(WARNING) << "Destroying a WorkOrderProtosContainer that still has pending WorkOrder protos.";
-        break;
-      }
-    }
-  }
-
-  /**
-   * @brief Check if there are some pending WorkOrders for the given operator.
-   *
-   * @param operator_index Index of the operator.
-   *
-   * @return If there are pending WorkOrders.
-   **/
-  bool hasWorkOrderProto(const std::size_t operator_index) const {
-    DCHECK_LT(operator_index, num_operators_);
-    return !operator_containers_[operator_index].empty();
-  }
-
-  /**
-   * @brief Get a WorkOrder for a given operator.
-   *
-   * @param operator_index The index of the operator.
-   *
-   * @return Release a WorkOrder proto. If no WorkOrder proto is available,
-   *         return nullptr.
-   **/
-  serialization::WorkOrder* getWorkOrderProto(const std::size_t operator_index) {
-    DCHECK_LT(operator_index, num_operators_);
-
-    if (operator_containers_[operator_index].empty()) {
-      return nullptr;
-    }
-
-    serialization::WorkOrder *proto =
-        operator_containers_[operator_index].front().release();
-    operator_containers_[operator_index].pop();
-
-    return proto;
-  }
-
-  /**
-   * @brief Add a WorkOrder generated from a given
-   *        operator.
-   *
-   * @param workorder A pointer to the WorkOrder to be added.
-   * @param operator_index The index of the operator in the query DAG.
-   **/
-  void addWorkOrderProto(serialization::WorkOrder *proto,
-                         const std::size_t operator_index) {
-    DCHECK(proto != nullptr);
-    DCHECK_LT(operator_index, num_operators_);
-
-    operator_containers_[operator_index].emplace(
-        std::unique_ptr<serialization::WorkOrder>(proto));
-  }
-
-  /**
-   * @brief Get the number of all pending WorkOrders
-   *        for a given operator.
-   *
-   * @param operator_index The index of the operator.
-   *
-   * @return The number of pending WorkOrders.
-   **/
-  std::size_t getNumWorkOrderProtos(const std::size_t operator_index) const {
-    DCHECK_LT(operator_index, num_operators_);
-    return operator_containers_[operator_index].size();
-  }
-
- private:
-  const std::size_t num_operators_;
-
-  std::vector<std::queue<std::unique_ptr<serialization::WorkOrder>>> operator_containers_;
-
-  DISALLOW_COPY_AND_ASSIGN(WorkOrderProtosContainer);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_QUERY_EXECUTION_WORKORDER_PROTOS_CONTAINER_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_execution/WorkOrdersContainer.cpp
----------------------------------------------------------------------
diff --git a/query_execution/WorkOrdersContainer.cpp b/query_execution/WorkOrdersContainer.cpp
deleted file mode 100644
index a16a8e6..0000000
--- a/query_execution/WorkOrdersContainer.cpp
+++ /dev/null
@@ -1,149 +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_execution/WorkOrdersContainer.hpp"
-
-#include <algorithm>
-#include <cstddef>
-#include <list>
-#include <memory>
-#include <vector>
-
-#include "relational_operators/WorkOrder.hpp"
-
-#include "glog/logging.h"
-
-using std::unique_ptr;
-
-namespace quickstep {
-
-WorkOrdersContainer::~WorkOrdersContainer() {
-  // For each operator ..
-  for (std::size_t op = 0; op < num_operators_; ++op) {
-    if (hasNormalWorkOrder(op) || hasRebuildWorkOrder(op)) {
-      LOG(WARNING) << "Destroying a WorkOrdersContainer that still has pending WorkOrders.";
-      break;
-    }
-  }
-}
-
-WorkOrder* WorkOrdersContainer::InternalListContainer::getWorkOrderForNUMANode(
-    const int numa_node) {
-  for (std::list<unique_ptr<WorkOrder>>::iterator it = workorders_.begin();
-       it != workorders_.end();
-       ++it) {
-    const std::vector<int> &numa_nodes = (*it)->getPreferredNUMANodes();
-    if (!numa_nodes.empty()) {
-      if (std::find(numa_nodes.begin(), numa_nodes.end(), numa_node) !=
-          numa_nodes.end()) {
-        WorkOrder *work_order = it->release();
-        workorders_.erase(it);
-        return work_order;
-      }
-    }
-  }
-  return nullptr;
-}
-
-void WorkOrdersContainer::OperatorWorkOrdersContainer::addWorkOrder(
-    WorkOrder *workorder) {
-  const std::vector<int> &numa_nodes = workorder->getPreferredNUMANodes();
-  if (!numa_nodes.empty()) {
-    if (numa_nodes.size() == 1) {
-      // This WorkOrder prefers exactly one NUMA node.
-      single_numa_node_workorders_[numa_nodes.front()].addWorkOrder(
-          workorder);
-    } else {
-      // This WorkOrder prefers more than one NUMA node.
-      multiple_numa_nodes_workorders_.addWorkOrder(workorder);
-    }
-  } else {
-    numa_agnostic_workorders_.addWorkOrder(workorder);
-  }
-}
-
-std::size_t
-    WorkOrdersContainer::InternalListContainer::getNumWorkOrdersForNUMANode(
-    const int numa_node) const {
-  std::size_t num_workorders = 0;
-  for (const unique_ptr<WorkOrder> &work_order : workorders_) {
-    const std::vector<int> &numa_nodes = work_order->getPreferredNUMANodes();
-    if (!numa_nodes.empty()) {
-      std::vector<int>::const_iterator
-          it = std::find(numa_nodes.begin(), numa_nodes.end(), numa_node);
-      if (it != numa_nodes.end()) {
-        // Found a match.
-       ++num_workorders;
-      }
-    }
-  }
-  return num_workorders;
-}
-
-bool WorkOrdersContainer::InternalListContainer::hasWorkOrderForNUMANode(
-    const int numa_node) const {
-  for (const unique_ptr<WorkOrder> &work_order : workorders_) {
-    const std::vector<int> &numa_nodes = work_order->getPreferredNUMANodes();
-    if (!numa_nodes.empty()) {
-      std::vector<int>::const_iterator
-          it = std::find(numa_nodes.begin(), numa_nodes.end(), numa_node);
-      if (it != numa_nodes.end()) {
-        // Found a match.
-        return true;
-      }
-    }
-  }
-  return false;
-}
-
-WorkOrder* WorkOrdersContainer::OperatorWorkOrdersContainer::getWorkOrder(
-    const bool prefer_single_NUMA_node) {
-  // This function tries to get any available WorkOrder.
-  WorkOrder *workorder = numa_agnostic_workorders_.getWorkOrder();
-  if (workorder == nullptr) {
-    if (prefer_single_NUMA_node) {
-      workorder = getSingleNUMANodeWorkOrderHelper();
-      if (workorder == nullptr) {
-        workorder = multiple_numa_nodes_workorders_.getWorkOrder();
-      }
-    } else {
-      workorder = multiple_numa_nodes_workorders_.getWorkOrder();
-      if (workorder == nullptr) {
-        workorder = getSingleNUMANodeWorkOrderHelper();
-      }
-    }
-  }
-  return workorder;
-}
-
-WorkOrder* WorkOrdersContainer::OperatorWorkOrdersContainer::
-    getSingleNUMANodeWorkOrderHelper() {
-  WorkOrder *workorder = nullptr;
-  for (PtrVector<InternalQueueContainer>::iterator it =
-           single_numa_node_workorders_.begin();
-       it != single_numa_node_workorders_.end(); ++it) {
-    workorder = it->getWorkOrder();
-    if (workorder != nullptr) {
-      return workorder;
-    }
-  }
-  return nullptr;
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_execution/WorkOrdersContainer.hpp
----------------------------------------------------------------------
diff --git a/query_execution/WorkOrdersContainer.hpp b/query_execution/WorkOrdersContainer.hpp
deleted file mode 100644
index c1739bc..0000000
--- a/query_execution/WorkOrdersContainer.hpp
+++ /dev/null
@@ -1,515 +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_EXECUTION_WORKORDERS_CONTAINER_HPP_
-#define QUICKSTEP_QUERY_EXECUTION_WORKORDERS_CONTAINER_HPP_
-
-#include <cstddef>
-#include <list>
-#include <memory>
-#include <queue>
-#include <vector>
-
-#include "relational_operators/WorkOrder.hpp"
-#include "utility/Macros.hpp"
-#include "utility/PtrVector.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-/** \addtogroup QueryExecution
- *  @{
- */
-
- /**
-  * @brief A container to hold the WorkOrders for a given query.
-  * @note This container stays alive during the lifetime of the query.
-  * @note The NUMA node indexing is assumed to start from 0.
-  **/
-class WorkOrdersContainer {
- public:
-  /**
-   * @brief Constructor
-   *
-   * @param num_operators Number of operators in the query DAG.
-   * @param num_numa_nodes Number of NUMA nodes in the system.
-   **/
-  WorkOrdersContainer(const std::size_t num_operators,
-                      const std::size_t num_numa_nodes)
-      : num_operators_(num_operators), num_numa_nodes_(num_numa_nodes) {
-    DEBUG_ASSERT(num_operators != 0);
-    for (std::size_t op = 0; op < num_operators; ++op) {
-      normal_workorders_.push_back(
-          new OperatorWorkOrdersContainer(num_numa_nodes_));
-      rebuild_workorders_.push_back(
-          new OperatorWorkOrdersContainer(num_numa_nodes_));
-    }
-  }
-
-  /**
-   * @brief Destructor.
-   *
-   * @note If the query is executed normally, we should never encounter a
-   *       situation where at the time of deletion the WorkOrdersContainer has
-   *       pending WorkOrders.
-   **/
-  ~WorkOrdersContainer();
-
-  /**
-   * @brief Check if there are some pending WorkOrders for the given operator.
-   *
-   * @param operator_index Index of the operator.
-   *
-   * @return If there are pending WorkOrders.
-   **/
-  inline bool hasNormalWorkOrder(const std::size_t operator_index) const {
-    DCHECK_LT(operator_index, num_operators_);
-    return normal_workorders_[operator_index].hasWorkOrder();
-  }
-
-  /**
-   * @brief Check if there are some pending normal (i.e. non-rebuild) WorkOrders
-   *        for the given operator which prefer the specified NUMA node.
-   *
-   * @param operator_index Index of the operator.
-   * @param numa_node_id The NUMA node.
-   *
-   * @return If there are pending WorkOrders for the given operator which prefer
-   *         numa_node_id.
-   **/
-  inline bool hasNormalWorkOrderForNUMANode(
-      const std::size_t operator_index, const int numa_node_id) const {
-    DCHECK_LT(operator_index, num_operators_);
-    DCHECK_GE(numa_node_id, 0);
-    DCHECK_LT(static_cast<std::size_t>(numa_node_id), num_numa_nodes_);
-    return normal_workorders_[operator_index].hasWorkOrderForNUMANode(
-        numa_node_id);
-  }
-
-  /**
-   * @brief Check if there are some pending rebuild WorkOrders for the given
-   *        operator.
-   *
-   * @param operator_index Index of the operator.
-   *
-   * @return If there are pending rebuild WorkOrders.
-   **/
-  inline bool hasRebuildWorkOrder(const std::size_t operator_index) const {
-    DCHECK_LT(operator_index, num_operators_);
-    return rebuild_workorders_[operator_index].hasWorkOrder();
-  }
-
-  /**
-   * @brief Check if there are some pending rebuild WorkOrders for the given
-   *        operator which prefer the specified NUMA node.
-   *
-   * @param operator_index Index of the operator.
-   * @param numa_node_id The NUMA node.
-   *
-   * @return If there are pending rebuild WorkOrders for the given operator which
-   *         prefer numa_node_id.
-   **/
-  inline bool hasRebuildWorkOrderForNUMANode(
-      const std::size_t operator_index, const int numa_node_id) const {
-    DCHECK_LT(operator_index, num_operators_);
-    DCHECK_GE(numa_node_id, 0);
-    DCHECK_LT(static_cast<std::size_t>(numa_node_id), num_numa_nodes_);
-    return rebuild_workorders_[operator_index].hasWorkOrderForNUMANode(
-        numa_node_id);
-  }
-
-  /**
-   * @brief Get a normal (non-rebuild) WorkOrder for a given operator which
-   *        prefer the given NUMA node.
-   *
-   * @param operator_index The index of the operator.
-   * @param numa_node_id The NUMA node.
-   *
-   * @return A WorkOrder which prefers numa_node_id. If no such WorkOrder is
-   *         available, return nullptr. The caller is responsible for taking the
-   *         ownership.
-   **/
-  WorkOrder* getNormalWorkOrderForNUMANode(const std::size_t operator_index,
-                                           const int numa_node_id) {
-    DCHECK_LT(operator_index, num_operators_);
-    DCHECK_GE(numa_node_id, 0);
-    DCHECK_LT(static_cast<std::size_t>(numa_node_id), num_numa_nodes_);
-    return normal_workorders_[operator_index].getWorkOrderForNUMANode(
-        numa_node_id);
-  }
-
-  /**
-   * @brief Get a normal (non-rebuild) WorkOrder for a given operator.
-   *
-   * @param operator_index The index of the operator.
-   * @param prefer_single_NUMA_node If true, first try to get workorders which
-   *        prefer exactly one NUMA node over workorders which list more than
-   *        one NUMA node as their preference.
-   *
-   * @return A WorkOrder. If no WorkOrder is available, returns nullptr. The
-   *         caller is responsible for taking the ownership.
-   **/
-  WorkOrder* getNormalWorkOrder(const std::size_t operator_index,
-                                const bool prefer_single_NUMA_node = true) {
-    DCHECK_LT(operator_index, num_operators_);
-    return normal_workorders_[operator_index].getWorkOrder(
-        prefer_single_NUMA_node);
-  }
-
-  /**
-   * @brief Get a rebuild WorkOrder for a given operator whch prefer the
-   *        specified NUMA node.
-   *
-   * @param operator_index The index of the operator.
-   * @param numa_node_id The NUMA node.
-   *
-   * @return A WorkOrder that prefers numa_node_id. If no such WorkOrder is
-   *         available, return nullptr. The caller is responsible for taking the
-   *         ownership.
-   **/
-  WorkOrder* getRebuildWorkOrderForNUMANode(const std::size_t operator_index,
-                                            const int numa_node_id) {
-    DCHECK_LT(operator_index, num_operators_);
-    DCHECK_GE(numa_node_id, 0);
-    DCHECK_LT(static_cast<std::size_t>(numa_node_id), num_numa_nodes_);
-    return rebuild_workorders_[operator_index].getWorkOrderForNUMANode(
-        numa_node_id);
-  }
-
-  /**
-   * @brief Get a rebuild WorkOrder for the given operator
-   *
-   * @param operator_index The index of the operator.
-   * @param prefer_single_NUMA_node If true, first try to get workorders which
-   *        prefer exactly one NUMA node over workorders which list more than
-   *        one NUMA node as their preference.
-   *
-   * @return A WorkOrder. If no WorkOrder is available, returns nullptr. The
-   *         caller is responsible for taking the ownership.
-   **/
-  WorkOrder* getRebuildWorkOrder(const std::size_t operator_index,
-                                 const bool prefer_single_NUMA_node = true) {
-    DCHECK_LT(operator_index, num_operators_);
-    return rebuild_workorders_[operator_index].getWorkOrder(
-        prefer_single_NUMA_node);
-  }
-
-  /**
-   * @brief Add a normal (non-rebuild) WorkOrder generated from a given
-   *        operator.
-   *
-   * @note Take the ownership of \p workorder.
-   * @note The workorder to be added contains information about its preferred
-   *       NUMA nodes. This information is used to insert the WorkOrder
-   *       appropriately.
-   *
-   * @param workorder A pointer to the WorkOrder to be added.
-   * @param operator_index The index of the operator in the query DAG.
-   **/
-  void addNormalWorkOrder(WorkOrder *workorder, const std::size_t operator_index) {
-    DCHECK(workorder != nullptr);
-    DCHECK_LT(operator_index, num_operators_);
-    normal_workorders_[operator_index].addWorkOrder(workorder);
-  }
-
-  /**
-   * @brief Add a rebuild WorkOrder generated from a given operator.
-   *
-   * @note Take the ownership of \p workorder.
-   * @note The workorder to be added contains information about its preferred
-   *       NUMA nodes. This information is used to insert the WorkOrder
-   *       appropriately.
-   *
-   * @param workorder A pointer to the WorkOrder to be added.
-   * @param operator_index The index of the operator in the query DAG.
-   **/
-  void addRebuildWorkOrder(WorkOrder *workorder,
-                           const std::size_t operator_index) {
-    DCHECK(workorder != nullptr);
-    DCHECK_LT(operator_index, num_operators_);
-    rebuild_workorders_[operator_index].addWorkOrder(workorder);
-  }
-
-  /**
-   * @brief Get the number of pending normal WorkOrders for a given operator
-   *        which prefer the specified NUMA node.
-   *
-   * @param operator_index The index of the operator.
-   * @param numa_node_id The NUMA node.
-   *
-   * @return The number of pending WorkOrders which prefer numa_node_id.
-   **/
-  inline std::size_t getNumNormalWorkOrdersForNUMANode(
-      const std::size_t operator_index, const int numa_node_id) const {
-    DCHECK_LT(operator_index, num_operators_);
-    DCHECK_GE(numa_node_id, 0);
-    DCHECK_LT(static_cast<std::size_t>(numa_node_id), num_numa_nodes_);
-    return normal_workorders_[operator_index].getNumWorkOrdersForNUMANode(
-        numa_node_id);
-  }
-
-  /**
-   * @brief Get the number of all pending normal (i.e. non-rebuild) WorkOrders
-   *        for a given operator.
-   *
-   * @param operator_index The index of the operator.
-   *
-   * @return The number of pending normal WorkOrders.
-   **/
-  inline std::size_t getNumNormalWorkOrders(
-      const std::size_t operator_index) const {
-    DCHECK_LT(operator_index, num_operators_);
-    return normal_workorders_[operator_index].getNumWorkOrders();
-  }
-
-  /**
-   * @brief Get the number of pending rebuild WorkOrders for a given operator
-   *        which prefer the specified NUMA node.
-   *
-   * @param operator_index The index of the operator.
-   * @param numa_node_id The NUMA node.
-   *
-   * @return The number of pending WorkOrders which prefer numa_node_id.
-   **/
-  inline std::size_t getNumRebuildWorkOrdersForNUMANode(
-      const std::size_t operator_index, const int numa_node_id) const {
-    DCHECK_LT(operator_index, num_operators_);
-    DCHECK_GE(numa_node_id, 0);
-    DCHECK_LT(static_cast<std::size_t>(numa_node_id), num_numa_nodes_);
-    return rebuild_workorders_[operator_index].getNumWorkOrdersForNUMANode(
-        numa_node_id);
-  }
-
-  /**
-   * @brief Get the number of all pending rebuild WorkOrders for a given
-   *        operator.
-   *
-   * @param operator_index The index of the operator.
-   *
-   * @return The number of pending rebuild WorkOrders.
-   **/
-  inline std::size_t getNumRebuildWorkOrders(
-      const std::size_t operator_index) const {
-    DCHECK_LT(operator_index, num_operators_);
-    return rebuild_workorders_[operator_index].getNumWorkOrders();
-  }
-
- private:
-  /**
-   * @brief An internal queue-based container structure to hold the WorkOrders.
-   **/
-  class InternalQueueContainer {
-   public:
-    InternalQueueContainer() {
-    }
-
-    inline void addWorkOrder(WorkOrder *workorder) {
-      workorders_.emplace(std::unique_ptr<WorkOrder>(workorder));
-    }
-
-    inline WorkOrder* getWorkOrder() {
-      if (workorders_.empty()) {
-        return nullptr;
-      }
-
-      WorkOrder *work_order = workorders_.front().release();
-      workorders_.pop();
-      return work_order;
-    }
-
-    inline bool hasWorkOrder() const {
-      return !workorders_.empty();
-    }
-
-    inline std::size_t getNumWorkOrders() const {
-      return workorders_.size();
-    }
-
-   private:
-    std::queue<std::unique_ptr<WorkOrder>> workorders_;
-
-    DISALLOW_COPY_AND_ASSIGN(InternalQueueContainer);
-  };
-
-  /**
-   * @brief An internal list-based container structure to hold the WorkOrders.
-   *
-   * @note We use this class for WorkOrders whose inputs come from multiple NUMA
-   *       nodes e.g. a HashJoinWorkOrder whose probe block and the hash table
-   *       may reside on two different NUMA nodes.
-   **/
-  class InternalListContainer {
-   public:
-    InternalListContainer() {
-    }
-
-    inline void addWorkOrder(WorkOrder *workorder) {
-      workorders_.emplace_back(std::unique_ptr<WorkOrder>(workorder));
-    }
-
-    inline WorkOrder* getWorkOrder() {
-      if (workorders_.empty()) {
-        return nullptr;
-      }
-
-      WorkOrder *work_order = workorders_.front().release();
-      workorders_.pop_front();
-      return work_order;
-    }
-
-    /**
-     * @note This method has O(N) complexity.
-     **/
-    WorkOrder* getWorkOrderForNUMANode(const int numa_node);
-
-    inline bool hasWorkOrder() const {
-      return !workorders_.empty();
-    }
-
-    /**
-     * @brief Check if numa_node is in the set of preferred NUMA nodes for at
-     *        least one WorkOrder in this container.
-     *
-     * @note This method has O(N) complexity.
-     **/
-    bool hasWorkOrderForNUMANode(const int numa_node) const;
-
-    inline std::size_t getNumWorkOrders() const {
-      return workorders_.size();
-    }
-
-    /**
-     * @brief Return the number of WorkOrders that list the numa_node as one of
-     *        the preferred nodes of execution.
-     **/
-    std::size_t getNumWorkOrdersForNUMANode(const int numa_node) const;
-
-   private:
-    std::list<std::unique_ptr<WorkOrder>> workorders_;
-
-    DISALLOW_COPY_AND_ASSIGN(InternalListContainer);
-  };
-
-  /**
-   * @brief A container to hold all the WorkOrders generated by one operator.
-   **/
-  class OperatorWorkOrdersContainer {
-   public:
-    explicit OperatorWorkOrdersContainer(const std::size_t num_numa_nodes)
-        : num_numa_nodes_(num_numa_nodes) {
-      for (std::size_t numa_node = 0; numa_node < num_numa_nodes; ++numa_node) {
-        single_numa_node_workorders_.push_back(new InternalQueueContainer());
-      }
-    }
-
-    void addWorkOrder(WorkOrder *workorder);
-
-    bool hasWorkOrderForNUMANode(const int numa_node_id) const {
-      DCHECK_GE(numa_node_id, 0);
-      DCHECK_LT(static_cast<std::size_t>(numa_node_id), num_numa_nodes_);
-      return single_numa_node_workorders_[numa_node_id].hasWorkOrder() ||
-             multiple_numa_nodes_workorders_.hasWorkOrderForNUMANode(
-                 numa_node_id);
-    }
-
-    bool hasWorkOrder() const {
-      if (!(numa_agnostic_workorders_.hasWorkOrder() ||
-            multiple_numa_nodes_workorders_.hasWorkOrder())) {
-        for (std::size_t i = 0; i < num_numa_nodes_; ++i) {
-          if (hasWorkOrderForNUMANode(i)) {
-            return true;
-          }
-        }
-        return false;
-      }
-      return true;
-    }
-
-    std::size_t getNumWorkOrdersForNUMANode(
-        const int numa_node_id) const {
-      DCHECK_GE(numa_node_id, 0);
-      DCHECK_LT(static_cast<std::size_t>(numa_node_id), num_numa_nodes_);
-      return single_numa_node_workorders_[numa_node_id].getNumWorkOrders() +
-             multiple_numa_nodes_workorders_.getNumWorkOrdersForNUMANode(
-                 numa_node_id);
-    }
-
-    inline std::size_t getNumWorkOrders() const {
-      std::size_t num_workorders = numa_agnostic_workorders_.getNumWorkOrders();
-      // for each NUMA node involved ..
-      for (PtrVector<InternalQueueContainer>::const_iterator it =
-               single_numa_node_workorders_.begin();
-           it != single_numa_node_workorders_.end();
-           ++it) {
-        // Add the number of workorders for the NUMA node.
-        num_workorders += it->getNumWorkOrders();
-      }
-      // Add the number of workorders who have multiple NUMA nodes as input.
-      num_workorders += multiple_numa_nodes_workorders_.getNumWorkOrders();
-      return num_workorders;
-    }
-
-    WorkOrder* getWorkOrderForNUMANode(const int numa_node_id) {
-      DCHECK_GE(numa_node_id, 0);
-      DCHECK_LT(static_cast<std::size_t>(numa_node_id), num_numa_nodes_);
-      WorkOrder *work_order = single_numa_node_workorders_[numa_node_id].getWorkOrder();
-      if (work_order == nullptr) {
-        work_order = multiple_numa_nodes_workorders_.getWorkOrderForNUMANode(
-            numa_node_id);
-      }
-      return work_order;
-    }
-
-    WorkOrder* getWorkOrder(const bool prefer_single_NUMA_node = true);
-
-   private:
-    WorkOrder* getSingleNUMANodeWorkOrderHelper();
-
-    const std::size_t num_numa_nodes_;
-
-    // A container to store NUMA agnostic workorders.
-    InternalQueueContainer numa_agnostic_workorders_;
-
-    // A vector of containers to store workorders which prefer exactly one NUMA
-    // node for execution.
-    PtrVector<InternalQueueContainer> single_numa_node_workorders_;
-
-    // A container to store workorders which prefer more than one NUMA node for
-    // execution.
-    InternalListContainer multiple_numa_nodes_workorders_;
-    // Note that no workorder should be shared among the *_workorders_ structures.
-
-    DISALLOW_COPY_AND_ASSIGN(OperatorWorkOrdersContainer);
-  };
-
-  const std::size_t num_operators_;
-  const std::size_t num_numa_nodes_;
-
-  PtrVector<OperatorWorkOrdersContainer> normal_workorders_;
-  PtrVector<OperatorWorkOrdersContainer> rebuild_workorders_;
-
-  DISALLOW_COPY_AND_ASSIGN(WorkOrdersContainer);
-};
-/** @} */
-
-}  // namespace quickstep
-
-
-#endif  // QUICKSTEP_QUERY_EXECUTION_WORKORDERS_CONTAINER_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_execution/Worker.cpp
----------------------------------------------------------------------
diff --git a/query_execution/Worker.cpp b/query_execution/Worker.cpp
deleted file mode 100644
index 31eb964..0000000
--- a/query_execution/Worker.cpp
+++ /dev/null
@@ -1,155 +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_execution/Worker.hpp"
-
-#include <chrono>
-#include <cstddef>
-#include <cstdint>
-#include <cstdlib>
-#include <utility>
-
-#include "query_execution/QueryExecutionMessages.pb.h"
-#include "query_execution/QueryExecutionTypedefs.hpp"
-#include "query_execution/QueryExecutionUtil.hpp"
-#include "query_execution/WorkerMessage.hpp"
-#include "query_optimizer/QueryOptimizerConfig.h"  // For QUICKSTEP_DISTRIBUTED.
-#include "relational_operators/WorkOrder.hpp"
-#include "threading/ThreadIDBasedMap.hpp"
-#include "threading/ThreadUtil.hpp"
-
-#include "glog/logging.h"
-
-#include "tmb/address.h"
-#include "tmb/id_typedefs.h"
-#include "tmb/message_bus.h"
-#include "tmb/tagged_message.h"
-
-using std::size_t;
-using std::uint64_t;
-
-using tmb::TaggedMessage;
-
-namespace quickstep {
-
-using serialization::WorkOrderCompletionMessage;
-
-void Worker::run() {
-  if (cpu_id_ >= 0) {
-    ThreadUtil::BindToCPU(cpu_id_);
-  }
-  ClientIDMap *thread_id_map = ClientIDMap::Instance();
-  thread_id_map->addValue(worker_client_id_);
-  for (;;) {
-    // Receive() is a blocking call, causing this thread to sleep until next
-    // message is received.
-    const AnnotatedMessage annotated_msg =
-        bus_->Receive(worker_client_id_, 0, true);
-    const TaggedMessage &tagged_message = annotated_msg.tagged_message;
-    switch (tagged_message.message_type()) {
-#ifdef QUICKSTEP_DISTRIBUTED
-      case kShiftbossRegistrationResponseMessage: {
-        serialization::ShiftbossRegistrationResponseMessage proto;
-        CHECK(proto.ParseFromArray(tagged_message.message(), tagged_message.message_bytes()));
-
-        shiftboss_index_ = proto.shiftboss_index();
-        break;
-      }
-#endif  // QUICKSTEP_DISTRIBUTED
-      case kWorkOrderMessage: {
-        WorkOrderCompletionMessage proto;
-        executeWorkOrderHelper(tagged_message, &proto);
-        sendWorkOrderCompleteMessage(
-            annotated_msg.sender, proto, kWorkOrderCompleteMessage);
-        break;
-      }
-      case kRebuildWorkOrderMessage: {
-        WorkOrderCompletionMessage proto;
-        executeWorkOrderHelper(tagged_message, &proto, true /* is_rebuild */);
-        sendWorkOrderCompleteMessage(
-            annotated_msg.sender, proto, kRebuildWorkOrderCompleteMessage);
-        break;
-      }
-      case kPoisonMessage: {
-        // Remove the entry from the thread ID based map for this worker thread.
-        thread_id_map->removeValue();
-        return;
-      }
-    }
-  }
-}
-
-void Worker::sendWorkOrderCompleteMessage(const tmb::client_id receiver,
-                                          const WorkOrderCompletionMessage &proto,
-                                          const message_type_id message_type) {
-  // NOTE(zuyu): Using the heap memory to serialize proto as a c-like string.
-  const size_t proto_length = proto.ByteSize();
-  char *proto_bytes = static_cast<char *>(std::malloc(proto_length));
-  CHECK(proto.SerializeToArray(proto_bytes, proto_length));
-
-  TaggedMessage tagged_message(
-      static_cast<const void *>(proto_bytes), proto_length, message_type);
-  std::free(proto_bytes);
-
-  DLOG(INFO) << "Worker sent WorkOrderCompleteMessage (typed '" << message_type
-             << "') to Scheduler with TMB client ID " << receiver;
-  const tmb::MessageBus::SendStatus send_status =
-      QueryExecutionUtil::SendTMBMessage(
-          bus_, worker_client_id_, receiver, std::move(tagged_message));
-  CHECK(send_status == tmb::MessageBus::SendStatus::kOK);
-}
-
-void Worker::executeWorkOrderHelper(const TaggedMessage &tagged_message,
-                                    WorkOrderCompletionMessage *proto,
-                                    const bool is_rebuild_work_order) {
-  std::chrono::time_point<std::chrono::steady_clock> start, end;
-  WorkerMessage worker_message(
-      *static_cast<const WorkerMessage *>(tagged_message.message()));
-  DCHECK(worker_message.getWorkOrder() != nullptr);
-  const size_t query_id_for_workorder = worker_message.getWorkOrder()->getQueryID();
-
-  // Start measuring the execution time.
-  start = std::chrono::steady_clock::now();
-  worker_message.getWorkOrder()->execute();
-  end = std::chrono::steady_clock::now();
-  delete worker_message.getWorkOrder();
-
-  // Convert the measured timestamps to epoch times in microseconds.
-  const uint64_t execution_start_time =
-      std::chrono::duration_cast<std::chrono::microseconds>(
-          start.time_since_epoch()).count();
-  const uint64_t execution_end_time =
-      std::chrono::duration_cast<std::chrono::microseconds>(
-          end.time_since_epoch()).count();
-
-  // Construct the proto message.
-  proto->set_work_order_type(is_rebuild_work_order ? WorkOrderCompletionMessage::REBUILD
-                                                   : WorkOrderCompletionMessage::NORMAL);
-  proto->set_operator_index(worker_message.getRelationalOpIndex());
-  proto->set_query_id(query_id_for_workorder);
-  proto->set_worker_thread_index(worker_thread_index_);
-  proto->set_execution_start_time(execution_start_time);
-  proto->set_execution_end_time(execution_end_time);
-
-#ifdef QUICKSTEP_DISTRIBUTED
-  proto->set_shiftboss_index(shiftboss_index_);
-#endif  // QUICKSTEP_DISTRIBUTED
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_execution/Worker.hpp
----------------------------------------------------------------------
diff --git a/query_execution/Worker.hpp b/query_execution/Worker.hpp
deleted file mode 100644
index feb7c7d..0000000
--- a/query_execution/Worker.hpp
+++ /dev/null
@@ -1,151 +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_EXECUTION_WORKER_HPP_
-#define QUICKSTEP_QUERY_EXECUTION_WORKER_HPP_
-
-#include <cstddef>
-#include <cstdint>
-
-#include "query_execution/QueryExecutionTypedefs.hpp"
-#include "query_optimizer/QueryOptimizerConfig.h"  // For QUICKSTEP_DISTRIBUTED.
-#include "threading/Thread.hpp"
-#include "utility/Macros.hpp"
-
-#include "tmb/id_typedefs.h"
-#include "tmb/message_bus.h"
-
-namespace tmb { class TaggedMessge; }
-
-namespace quickstep {
-
-namespace serialization { class WorkOrderCompletionMessage; }
-
-/** \addtogroup QueryExecution
- *  @{
- */
-
- /**
-  * @brief A worker thread executes WorkOrders which it receives from Foreman.
-  **/
-class Worker : public Thread {
- public:
-  /**
-   * @brief Constructor
-   *
-   * @param worker_thread_index The unique index of this worker thread in
-   *        WorkerDirectory.
-   * @param bus A pointer to the TMB.
-   * @param cpu_id The ID of the CPU to which this worker thread can be pinned.
-   *
-   * @note If cpu_id is not specified, worker thread can be possibly moved
-   *       around on different CPUs by the OS.
-   **/
-  Worker(const std::size_t worker_thread_index,
-         MessageBus *bus,
-         int cpu_id = -1)
-      : worker_thread_index_(worker_thread_index),
-        bus_(bus),
-        cpu_id_(cpu_id) {
-    DEBUG_ASSERT(bus_ != nullptr);
-    worker_client_id_ = bus_->Connect();
-
-    bus_->RegisterClientAsSender(worker_client_id_, kWorkOrderCompleteMessage);
-    bus_->RegisterClientAsSender(worker_client_id_,
-                                 kRebuildWorkOrderCompleteMessage);
-    bus_->RegisterClientAsSender(worker_client_id_, kCatalogRelationNewBlockMessage);
-    bus_->RegisterClientAsSender(worker_client_id_, kDataPipelineMessage);
-    bus_->RegisterClientAsSender(worker_client_id_, kWorkOrderFeedbackMessage);
-
-    bus_->RegisterClientAsReceiver(worker_client_id_, kWorkOrderMessage);
-    bus_->RegisterClientAsReceiver(worker_client_id_, kRebuildWorkOrderMessage);
-    bus_->RegisterClientAsReceiver(worker_client_id_, kPoisonMessage);
-
-#ifdef QUICKSTEP_DISTRIBUTED
-    bus_->RegisterClientAsReceiver(worker_client_id_, kShiftbossRegistrationResponseMessage);
-#endif  // QUICKSTEP_DISTRIBUTED
-  }
-
-  ~Worker() override {}
-
-  /**
-   * @brief Get the TMB client ID of this worker.
-   *
-   * @return TMB client ID of this worker.
-   **/
-  inline client_id getBusClientID() const {
-    return worker_client_id_;
-  }
-
- protected:
-  /**
-   * @brief Receive workorder one at a time and execute it. After execution, send
-   *        a completion message to the Foreman and delete the WorkOrder.
-   *
-   * @note  On receiving a poison message, the method terminates.
-   **/
-  void run() override;
-
- private:
-  /**
-   * @brief A helper method to execute the WorkOrder and construct a
-   *        completion message.
-   *
-   * @note Right now a single helper method works for all message types.
-   *       If different message types need to collect different statistics for
-   *       the WorkOrder execution, we need to create different helper methods,
-   *       one for each message type.
-   *
-   * @param tagged_message The TaggedMessage which consists of the WorkOrder.
-   * @param proto The proto message to be sent.
-   * @param is_rebuild_work_order Whether it is used for a RebuildWorkOrder.
-   **/
-  void executeWorkOrderHelper(const TaggedMessage &tagged_message,
-                              serialization::WorkOrderCompletionMessage *proto,
-                              const bool is_rebuild_work_order = false);
-
-  /**
-   * @brief A helper method to send the WorkOrder completion message.
-   *
-   * @param receiver The TMB client ID of the receiver.
-   * @param proto The proto message to be sent.
-   * @param message_type The ID of the type of the message being sent.
-   **/
-  void sendWorkOrderCompleteMessage(const tmb::client_id receiver,
-                                    const serialization::WorkOrderCompletionMessage &proto,
-                                    const message_type_id message_type);
-
-  const std::size_t worker_thread_index_;
-  MessageBus *bus_;
-
-  const int cpu_id_;
-  client_id worker_client_id_;
-
-#ifdef QUICKSTEP_DISTRIBUTED
-  std::size_t shiftboss_index_;
-#endif  // QUICKSTEP_DISTRIBUTED
-
-  DISALLOW_COPY_AND_ASSIGN(Worker);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_QUERY_EXECUTION_WORKER_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_execution/WorkerDirectory.hpp
----------------------------------------------------------------------
diff --git a/query_execution/WorkerDirectory.hpp b/query_execution/WorkerDirectory.hpp
deleted file mode 100644
index be5cfc1..0000000
--- a/query_execution/WorkerDirectory.hpp
+++ /dev/null
@@ -1,243 +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_EXECUTION_WORKER_DIRECTORY_HPP_
-#define QUICKSTEP_QUERY_EXECUTION_WORKER_DIRECTORY_HPP_
-
-#include <algorithm>
-#include <cstddef>
-#include <iterator>
-#include <utility>
-#include <vector>
-
-#include "query_execution/QueryExecutionTypedefs.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-
-/** \addtogroup QueryExecution
- *  @{
- */
-/**
- * @brief A class which keeps the metadata about the workers.
- *
- * @note The number of workorders per worker used in this class are as viewed by
- *       Foreman. An alternative implementation can use TMB to query the queue
- *       lengths of each worker.
- *
- * @note This class is intended to be used only by Foreman thread. Therefore
- *       none of the methods in this class are thread-safe.
- **/
-class WorkerDirectory {
- public:
-  /**
-   * @brief Constructor.
-   *
-   * @param num_workers The number of workers.
-   * @param client_ids A vector of TMB client IDs for the workers.
-   * @param numa_node_ids A vector of NUMA node IDs where the workers are
-   *        pinned. If a worker is not pinned to any NUMA node, the NUMA node ID
-   *        for that worker is -1.
-   **/
-  WorkerDirectory(const std::size_t num_workers,
-                  const std::vector<client_id> &client_ids,
-                  const std::vector<int> &numa_node_ids)
-    : num_workers_(num_workers),
-      num_queued_workorders_(num_workers, 0),
-      numa_node_ids_(numa_node_ids),
-      client_ids_(client_ids) {
-    DEBUG_ASSERT(num_workers > 0);
-    DEBUG_ASSERT(client_ids.size() == num_workers);
-    DEBUG_ASSERT(numa_node_ids.size() == num_workers);
-  }
-
-  /**
-   * @brief Get the number of worker threads.
-   *
-   * @return The number of worker threads at the time the function is called.
-   **/
-  inline const std::size_t getNumWorkers() const {
-    return num_workers_;
-  }
-
-  /**
-   * @brief Get the number of queued workorders for the given worker.
-   *
-   * @note The queued number of workorders consist of the workorders waiting for
-   *       execution and the workorder being executed by the specified worker
-   *       at the time this function is called.
-   *
-   * @param worker_thread_index The logical ID of the given worker.
-   *
-   * @return The number of queued workorders.
-   **/
-  inline const std::size_t getNumQueuedWorkOrders(
-      const std::size_t worker_thread_index) const {
-    DEBUG_ASSERT(worker_thread_index < num_workers_);
-    return num_queued_workorders_[worker_thread_index];
-  }
-
-  /**
-   * @brief Increment the number of queued workorders for the given worker by 1.
-   *
-   * @param worker_thread_index The logical ID of the given worker.
-   **/
-  inline void incrementNumQueuedWorkOrders(const std::size_t worker_thread_index) {
-    DEBUG_ASSERT(worker_thread_index < num_workers_);
-    ++num_queued_workorders_[worker_thread_index];
-  }
-
-  /**
-   * @brief Decrement the number of queued workorders for the given worker by 1.
-   *
-   * @param worker_thread_index The logical ID of the given worker.
-   **/
-  inline void decrementNumQueuedWorkOrders(const std::size_t worker_thread_index) {
-    DEBUG_ASSERT(worker_thread_index < num_workers_);
-    DEBUG_ASSERT(num_queued_workorders_[worker_thread_index] >= 1);
-    --num_queued_workorders_[worker_thread_index];
-  }
-
-  /**
-   * @brief Get the NUMA node where the specified worker is pinned to.
-   *
-   * @param worker_thread_index The logical ID of the given worker.
-   *
-   * @return The NUMA node ID where the given worker is pinned. If the worker
-   *         hasn't been pinned to any NUMA node, this value is -1.
-   **/
-  inline int getNUMANode(const std::size_t worker_thread_index) const {
-    DEBUG_ASSERT(worker_thread_index < num_workers_);
-    return numa_node_ids_[worker_thread_index];
-  }
-
-  /**
-   * @brief Get the TMB client ID of the specified worker.
-   *
-   * @param worker_thread_index The logical ID of the given worker.
-   *
-   * @return The TMB client ID of the given worker.
-   **/
-  inline const client_id getClientID(const std::size_t worker_thread_index) const {
-    DEBUG_ASSERT(worker_thread_index < num_workers_);
-    return client_ids_[worker_thread_index];
-  }
-
-  /**
-   * @brief Generate address of a worker.
-   *
-   * @param worker_thread_index The logical ID of the given worker.
-   *
-   * @return TMB Address of the given worker.
-   **/
-  inline Address getWorkerAddress(std::size_t worker_thread_index) const {
-    DEBUG_ASSERT(worker_thread_index < num_workers_);
-    Address worker_address;
-    worker_address.AddRecipient(client_ids_[worker_thread_index]);
-    return worker_address;
-  }
-
-  /**
-   * @brief Add metadata about a new worker.
-   *
-   * @param cid The TMB client ID of the new worker.
-   * @param numa_node_id The NUMA node ID where the new worker is pinned.
-   **/
-  inline void addWorker(const client_id cid, const int numa_node_id) {
-    ++num_workers_;
-    num_queued_workorders_.push_back(0);
-    numa_node_ids_.push_back(numa_node_id);
-    client_ids_.push_back(cid);
-  }
-
-  /**
-   * @brief Get information about the least loaded worker at the time the
-   *        function is called.
-   *
-   * TODO(harshad) This method performs a linear search. Using a dynamic
-   *               priority queue to track worker loads can help this method
-   *               execute faster.
-   * TODO(harshad) Extend this method to find least loaded workers on a given
-   *               NUMA node.
-   *
-   * @note If there are multiple workers with the least amount of load, the
-   *       worker with the smaller logical ID is returned.
-   *
-   * @return A pair: First element is the logical ID of the least loaded worker
-   *         and second element is the number of queued workorders for this
-   *         worker at the time the function is called.
-   **/
-  std::pair<std::size_t, std::size_t> getLeastLoadedWorker() const {
-    std::vector<std::size_t>::const_iterator min_element_iter =
-        std::min_element(std::begin(num_queued_workorders_),
-                         std::end(num_queued_workorders_));
-    DEBUG_ASSERT(min_element_iter != num_queued_workorders_.end());
-    const std::size_t least_loaded_worker_thread_index =
-        std::distance(num_queued_workorders_.begin(), min_element_iter);
-    return std::make_pair(least_loaded_worker_thread_index, *min_element_iter);
-  }
-
-  /**
-   * @brief Get information about the most loaded worker at the time the
-   *        function is called.
-   *
-   * TODO(harshad) This method performs a linear search. Using a dynamic
-   *               priority queue to track worker loads can help this method
-   *               execute faster.
-   * TODO(harshad) Extend this method to find most loaded workers on a given
-   *               NUMA node.
-   *
-   * @note If there are multiple workers with the maximum amount of load, the
-   *       worker with the smaller logical ID is returned.
-   *
-   * @return A pair: First element is the logical ID of the most loaded worker
-   *         and second element is the number of queued workorders for this
-   *         worker at the time the function is called.
-   **/
-  std::pair<std::size_t, std::size_t> getMostLoadedWorker() const {
-    std::vector<std::size_t>::const_iterator max_element_iter =
-        std::max_element(std::begin(num_queued_workorders_),
-                         std::end(num_queued_workorders_));
-    DEBUG_ASSERT(max_element_iter != num_queued_workorders_.end());
-    const std::size_t most_loaded_worker_thread_index =
-        std::distance(num_queued_workorders_.begin(), max_element_iter);
-    return std::make_pair(most_loaded_worker_thread_index, *max_element_iter);
-  }
-
- private:
-  std::size_t num_workers_;
-
-  // The number of WorkOrders queued for execution per worker.
-  std::vector<std::size_t> num_queued_workorders_;
-
-  // The NUMA node IDs where the workers are pinned to. If a worker is not
-  // pinned, the ID is -1.
-  std::vector<int> numa_node_ids_;
-
-  // The vector of client IDs
-  std::vector<client_id> client_ids_;
-
-  DISALLOW_COPY_AND_ASSIGN(WorkerDirectory);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_QUERY_EXECUTION_WORKER_DIRECTORY_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_execution/WorkerMessage.hpp
----------------------------------------------------------------------
diff --git a/query_execution/WorkerMessage.hpp b/query_execution/WorkerMessage.hpp
deleted file mode 100644
index bd84ac6..0000000
--- a/query_execution/WorkerMessage.hpp
+++ /dev/null
@@ -1,144 +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_EXECUTION_WORKER_MESSAGE_HPP_
-#define QUICKSTEP_QUERY_EXECUTION_WORKER_MESSAGE_HPP_
-
-#include <cstddef>
-
-namespace quickstep {
-
-class WorkOrder;
-/**
- * @brief The messages to be sent to the worker from Foreman.
- *
- * @note  This class is copyable.
- **/
-class WorkerMessage {
- public:
-  static constexpr int kInvalidRecipientIndexHint = -1;
-
-  enum class WorkerMessageType {
-    kRebuildWorkOrder = 0,
-    kWorkOrder,
-  };
-
-  /**
-   * @brief A static factory method for generating rebuild WorkOrder messages.
-   *
-   * @param rebuild_workorder The rebuild WorkOrder to be executed by the worker.
-   * @param relational_op_index The index of the relational operator in the
-   *        query plan DAG that generated the given rebuild WorkOrder.
-   *
-   * @return The constructed RebuildWorkOrderMessage.
-   **/
-  static WorkerMessage* RebuildWorkOrderMessage(WorkOrder *rebuild_workorder, const std::size_t relational_op_index) {
-    return new WorkerMessage(rebuild_workorder,
-                             relational_op_index,
-                             WorkerMessageType::kRebuildWorkOrder);
-  }
-
-  /**
-   * @brief A static factory method for generating WorkOrder messages.
-   *
-   * @param workorder The work order to be executed by the worker.
-   * @param relational_op_index The index of the relational operator in the
-   *                            query plan DAG that generated the given
-   *                            workorder.
-   *
-   * @return The constructed WorkOrderMessage.
-   **/
-  static WorkerMessage* WorkOrderMessage(WorkOrder *workorder, const std::size_t relational_op_index) {
-    return new WorkerMessage(workorder,
-                             relational_op_index,
-                             WorkerMessageType::kWorkOrder);
-  }
-
-  /**
-   * @brief Destructor.
-   **/
-  ~WorkerMessage() {
-  }
-
-  /**
-   * @brief Gets the work order to be executed by the worker.
-   * @return A pointer to the work order which the worker should execute.
-   **/
-  inline WorkOrder* getWorkOrder() const {
-    return work_unit_;
-  }
-
-  /**
-   * @brief Get the index of the relational operator in the DAG that generated
-   *        the workorder.
-   **/
-  inline std::size_t getRelationalOpIndex() const {
-    return relational_op_index_;
-  }
-
-  /**
-   * @brief Get the type of this WorkerMessage.
-   **/
-  inline WorkerMessageType getType() const {
-    return type_;
-  }
-
-  /**
-   * @brief Set a hint for the recipient worker thread.
-   *
-   * @param recipient_index_hint The hint i.e. the worker thread index.
-   **/
-  inline void setRecipientHint(const int recipient_index_hint) {
-    recipient_index_hint_ = recipient_index_hint;
-  }
-
-  /**
-   * @brief Get the hint for the recipient worker thread. The hint is invalid if
-   *        it is kInvalidRecipientIndexHint.
-   **/
-  inline int getRecipientHint() const {
-    return recipient_index_hint_;
-  }
-
- private:
-  /**
-   * @brief Constructor.
-   *
-   * @param work_unit The work order to be executed by the worker.
-   * @param relational_op_index The index of the relational operator in the
-   *        query plan DAG that generated the given WorkOrder.
-   * @param type Type of the WorkerMessage.
-   **/
-  WorkerMessage(WorkOrder *work_unit,
-                const std::size_t relational_op_index,
-                const WorkerMessageType type)
-      : work_unit_(work_unit),
-        relational_op_index_(relational_op_index),
-        type_(type),
-        recipient_index_hint_(kInvalidRecipientIndexHint) {}
-
-  WorkOrder *work_unit_;
-  const std::size_t relational_op_index_;
-  const WorkerMessageType type_;
-  int recipient_index_hint_;
-};
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_QUERY_EXECUTION_WORKER_MESSAGE_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_execution/WorkerSelectionPolicy.hpp
----------------------------------------------------------------------
diff --git a/query_execution/WorkerSelectionPolicy.hpp b/query_execution/WorkerSelectionPolicy.hpp
deleted file mode 100644
index 4f4c6eb..0000000
--- a/query_execution/WorkerSelectionPolicy.hpp
+++ /dev/null
@@ -1,146 +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_EXECUTION_WORKER_SELECTION_POLICY_HPP_
-#define QUICKSTEP_QUERY_EXECUTION_WORKER_SELECTION_POLICY_HPP_
-
-#include <cstddef>
-#include <random>
-#include <utility>
-
-#include "query_execution/WorkerDirectory.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-
-/** \addtogroup QueryExecution
- *  @{
- */
-
-/**
- * @brief Base class for a policy to select workers for workorder execution.
- **/
-class WorkerSelectionPolicy {
- public:
-  /**
-   * @brief Constructor.
-   *
-   * @param worker_directory The worker directory.
-   **/
-  explicit WorkerSelectionPolicy(const WorkerDirectory &worker_directory)
-      : worker_directory_(worker_directory) {
-    if (worker_directory.getNumWorkers() == 0) {
-      FATAL_ERROR("WorkerSelectionPolicy needs at least one worker");
-    }
-  }
-
-  /**
-   * @brief Choose the worker for next workorder execution based on the policy.
-   *
-   * @return The logical ID of the worker chosen for next workorder execution.
-   **/
-  virtual std::size_t getNextWorkerID() = 0;
-
- protected:
-  const WorkerDirectory &worker_directory_;
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(WorkerSelectionPolicy);
-};
-
-/**
- * @brief Choose the next worker in a round robin manner.
- **/
-class RoundRobinWorkerSelectionPolicy : public WorkerSelectionPolicy {
- public:
-  /**
-   * @brief Constructor.
-   *
-   * @param worker_directory The worker directory.
-   * @param start_worker_thread_index The ID of the worker which should be chosen
-   *        initially.
-   *
-   * @warning If the number of workers change between the constructor and
-   *          getNextWorkerID() invocations, the worker ID returned by
-   *          getNextWorkerID() initially may not be the same as desired.
-   **/
-  RoundRobinWorkerSelectionPolicy(const WorkerDirectory &worker_directory,
-                                  const std::size_t start_worker_thread_index)
-      : WorkerSelectionPolicy(worker_directory) {
-    if (start_worker_thread_index == 0) {
-      previous_worker_thread_index_ = worker_directory.getNumWorkers() - 1;
-    } else {
-      previous_worker_thread_index_ = start_worker_thread_index - 1;
-    }
-  }
-
-  std::size_t getNextWorkerID() override {
-    previous_worker_thread_index_ =
-        (previous_worker_thread_index_ + 1) % worker_directory_.getNumWorkers();
-    return previous_worker_thread_index_;
-  }
-
- private:
-  std::size_t previous_worker_thread_index_;
-
-  DISALLOW_COPY_AND_ASSIGN(RoundRobinWorkerSelectionPolicy);
-};
-
-/**
- * @brief Choose the next worker so that the load among workers is balanced.
- **/
-class LoadBalancingWorkerSelectionPolicy : public WorkerSelectionPolicy {
- public:
-  explicit LoadBalancingWorkerSelectionPolicy(
-      const WorkerDirectory &worker_directory)
-      : WorkerSelectionPolicy(worker_directory) {}
-
-  std::size_t getNextWorkerID() override {
-    return worker_directory_.getLeastLoadedWorker().first;
-  }
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(LoadBalancingWorkerSelectionPolicy);
-};
-
-/**
- * @brief Choose a (uniform) random worker.
- **/
-class RandomWorkerSelectionPolicy : public WorkerSelectionPolicy {
- public:
-  explicit RandomWorkerSelectionPolicy(const WorkerDirectory &worker_directory)
-      : WorkerSelectionPolicy(worker_directory),
-        mt_(std::random_device()()) {}
-
-  std::size_t getNextWorkerID() override {
-    std::uniform_int_distribution<std::size_t> dist(
-        0, worker_directory_.getNumWorkers() - 1);
-    return dist(mt_);
-  }
-
- private:
-  std::mt19937_64 mt_;
-
-  DISALLOW_COPY_AND_ASSIGN(RandomWorkerSelectionPolicy);
-};
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_QUERY_EXECUTION_WORKER_SELECTION_POLICY_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_execution/tests/BlockLocator_unittest.cpp
----------------------------------------------------------------------
diff --git a/query_execution/tests/BlockLocator_unittest.cpp b/query_execution/tests/BlockLocator_unittest.cpp
deleted file mode 100644
index 32437c3..0000000
--- a/query_execution/tests/BlockLocator_unittest.cpp
+++ /dev/null
@@ -1,230 +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 <cstdlib>
-#include <memory>
-#include <string>
-#include <utility>
-#include <vector>
-
-#include "catalog/CatalogAttribute.hpp"
-#include "catalog/CatalogRelation.hpp"
-#include "query_execution/BlockLocator.hpp"
-#include "query_execution/BlockLocatorUtil.hpp"
-#include "query_execution/QueryExecutionMessages.pb.h"
-#include "query_execution/QueryExecutionTypedefs.hpp"
-#include "query_execution/QueryExecutionUtil.hpp"
-#include "storage/StorageBlob.hpp"
-#include "storage/StorageBlock.hpp"
-#include "storage/StorageBlockInfo.hpp"
-#include "storage/StorageConstants.hpp"
-#include "storage/StorageManager.hpp"
-#include "types/TypeFactory.hpp"
-#include "types/TypeID.hpp"
-
-#include "gflags/gflags.h"
-#include "glog/logging.h"
-#include "gtest/gtest.h"
-
-#include "tmb/id_typedefs.h"
-#include "tmb/message_bus.h"
-#include "tmb/tagged_message.h"
-
-using std::free;
-using std::malloc;
-using std::move;
-using std::string;
-using std::unique_ptr;
-using std::vector;
-
-using tmb::AnnotatedMessage;
-using tmb::MessageBus;
-using tmb::TaggedMessage;
-
-namespace quickstep {
-
-class BlockLocatorTest : public ::testing::Test {
- protected:
-  static const char kStoragePath[];
-  static const char kDomainNetworkAddress[];
-
-  ~BlockLocatorTest() {
-    locator_->join();
-  }
-
-  virtual void SetUp() {
-    bus_.Initialize();
-
-    locator_.reset(new BlockLocator(&bus_));
-    locator_->start();
-
-    worker_client_id_ = bus_.Connect();
-
-    bus_.RegisterClientAsSender(worker_client_id_, kBlockDomainRegistrationMessage);
-    bus_.RegisterClientAsReceiver(worker_client_id_, kBlockDomainRegistrationResponseMessage);
-
-    bus_.RegisterClientAsSender(worker_client_id_, kLocateBlockMessage);
-    bus_.RegisterClientAsReceiver(worker_client_id_, kLocateBlockResponseMessage);
-
-    bus_.RegisterClientAsSender(worker_client_id_, kPoisonMessage);
-
-    block_domain_ =
-        block_locator::getBlockDomain(kDomainNetworkAddress, worker_client_id_, &locator_client_id_, &bus_);
-    DCHECK_EQ(locator_->getBusClientID(), locator_client_id_);
-
-    storage_manager_.reset(
-        new StorageManager(kStoragePath, block_domain_, locator_client_id_, &bus_));
-  }
-
-  virtual void TearDown() {
-    storage_manager_.reset();
-
-    TaggedMessage message(kPoisonMessage);
-
-    LOG(INFO) << "Worker (id '" << worker_client_id_
-              << "') sent PoisonMessage (typed '" << kPoisonMessage
-              << "') to BlockLocator (id '" << locator_client_id_ << "')";
-    CHECK(MessageBus::SendStatus::kOK ==
-        QueryExecutionUtil::SendTMBMessage(&bus_,
-                                           worker_client_id_,
-                                           locator_client_id_,
-                                           move(message)));
-  }
-
-  vector<block_id_domain> getPeerDomains(const block_id block) {
-    serialization::BlockMessage proto;
-    proto.set_block_id(block);
-
-    const int proto_length = proto.ByteSize();
-    char *proto_bytes = static_cast<char*>(malloc(proto_length));
-    CHECK(proto.SerializeToArray(proto_bytes, proto_length));
-
-    TaggedMessage message(static_cast<const void*>(proto_bytes),
-                          proto_length,
-                          kLocateBlockMessage);
-    free(proto_bytes);
-
-  LOG(INFO) << "Worker (id '" << worker_client_id_
-            << "') sent LocateBlockMessage (typed '" << kLocateBlockMessage
-            << "') to BlockLocator";
-    CHECK(MessageBus::SendStatus::kOK ==
-        QueryExecutionUtil::SendTMBMessage(&bus_,
-                                           worker_client_id_,
-                                           locator_client_id_,
-                                           move(message)));
-
-    const AnnotatedMessage annotated_message(bus_.Receive(worker_client_id_, 0, true));
-    const TaggedMessage &tagged_message = annotated_message.tagged_message;
-    CHECK_EQ(kLocateBlockResponseMessage, tagged_message.message_type());
-    LOG(INFO) << "Worker (id '" << worker_client_id_
-              << "') received LocateBlockResponseMessage from BlockLocator";
-
-    serialization::LocateBlockResponseMessage response_proto;
-    CHECK(response_proto.ParseFromArray(tagged_message.message(), tagged_message.message_bytes()));
-
-    vector<block_id_domain> domains;
-    for (int i = 0; i < response_proto.block_domains_size(); ++i) {
-      domains.push_back(response_proto.block_domains(i));
-    }
-
-    return domains;
-  }
-
-  void checkLoaded(const block_id block) {
-    const vector<string> peer_domain_network_addresses = storage_manager_->getPeerDomainNetworkAddresses(block);
-    EXPECT_EQ(1u, peer_domain_network_addresses.size());
-    EXPECT_STREQ(kDomainNetworkAddress, peer_domain_network_addresses[0].data());
-
-    const vector<block_id_domain> domains = getPeerDomains(block);
-    EXPECT_EQ(1u, domains.size());
-    EXPECT_EQ(block_domain_, domains[0]);
-  }
-
-  void checkEvicted(const block_id block) {
-    const vector<string> peer_domain_network_addresses = storage_manager_->getPeerDomainNetworkAddresses(block);
-    EXPECT_TRUE(peer_domain_network_addresses.empty());
-
-    const vector<block_id_domain> domains = getPeerDomains(block);
-    EXPECT_TRUE(domains.empty());
-  }
-
-  tmb::client_id worker_client_id_;
-
-  block_id_domain block_domain_;
-  unique_ptr<StorageManager> storage_manager_;
-
- private:
-  MessageBusImpl bus_;
-
-  unique_ptr<BlockLocator> locator_;
-  tmb::client_id locator_client_id_;
-};
-
-const char BlockLocatorTest::kStoragePath[] = "./block_locator_test_data/";
-const char BlockLocatorTest::kDomainNetworkAddress[] = "ip:port";
-
-TEST_F(BlockLocatorTest, BlockTest) {
-  CatalogRelation relation(nullptr, "rel");
-  relation.addAttribute(new CatalogAttribute(nullptr, "attr_int", TypeFactory::GetType(kInt)));
-
-  const block_id block =
-      storage_manager_->createBlock(relation, relation.getDefaultStorageBlockLayout());
-  checkLoaded(block);
-
-  ASSERT_TRUE(storage_manager_->saveBlockOrBlob(block));
-  storage_manager_->evictBlockOrBlob(block);
-  checkEvicted(block);
-
-  {
-    const BlockReference block_ref = storage_manager_->getBlock(block, relation);
-  }
-  checkLoaded(block);
-
-  storage_manager_->deleteBlockOrBlobFile(block);
-  checkEvicted(block);
-}
-
-TEST_F(BlockLocatorTest, BlobTest) {
-  const block_id blob = storage_manager_->createBlob(kDefaultBlockSizeInSlots);
-  checkLoaded(blob);
-
-  ASSERT_TRUE(storage_manager_->saveBlockOrBlob(blob));
-  storage_manager_->evictBlockOrBlob(blob);
-  checkEvicted(blob);
-
-  {
-    const BlobReference blob_ref = storage_manager_->getBlob(blob);
-  }
-  checkLoaded(blob);
-
-  storage_manager_->deleteBlockOrBlobFile(blob);
-  checkEvicted(blob);
-}
-
-}  // namespace quickstep
-
-int main(int argc, char **argv) {
-  google::InitGoogleLogging(argv[0]);
-  // Honor FLAGS_buffer_pool_slots in StorageManager.
-  gflags::ParseCommandLineFlags(&argc, &argv, true);
-
-  ::testing::InitGoogleTest(&argc, argv);
-
-  return RUN_ALL_TESTS();
-}


[22/51] [abbrv] [partial] incubator-quickstep git commit: remove c++ files

Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/parser/tests/Select.test
----------------------------------------------------------------------
diff --git a/parser/tests/Select.test b/parser/tests/Select.test
deleted file mode 100644
index 8e47519..0000000
--- a/parser/tests/Select.test
+++ /dev/null
@@ -1,1874 +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.
-
-SELECT * FROM test
---
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectStar
-  +-from_clause=
-    +-TableReference[table=test]
-==
-
-# If the error location is beyond the end of the SQL,
-# we point the error to the place next to the last character.
-SELECT *
---
-ERROR: syntax error (1 : 9)
-SELECT *
-        ^
-==
-
-SELECT *;
---
-ERROR: syntax error (1 : 9)
-SELECT *;
-        ^
-==
-
-SELECT $attr FROM test
---
-ERROR: illegal character (1 : 9)
-SELECT $attr FROM test
-        ^
-==
-
-SELECT 1 "" FROM test
---
-ERROR: Zero-length identifier (1 : 11)
-SELECT 1 "" FROM test
-          ^
-==
-
-SELECT 1 FROM test AS ""
---
-ERROR: Zero-length identifier (1 : 24)
-SELECT 1 FROM test AS ""
-                       ^
-==
-
-SELECT attr FROM $test
---
-ERROR: illegal character (1 : 19)
-SELECT attr FROM $test
-                  ^
-==
-
-SELECT FROM test
---
-ERROR: syntax error (1 : 8)
-SELECT FROM test
-       ^
-==
-
-SELECT attr1
---
-ERROR: syntax error (1 : 13)
-SELECT attr1
-            ^
-==
-
-SELECT 1, 2, 3, 4
---
-ERROR: syntax error (1 : 18)
-SELECT 1, 2, 3, 4
-                 ^
-==
-
-SELECT 1, 2, 1+1, 1-1, 1-1.2+1-2.3, attr1, attr2, attr1+1, attr1+1*2+attr2, attr1+1*(2+attr2) FROM test
---
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectList
-  | +-SelectListItem
-  | | +-Literal
-  | |   +-NumericLiteral[numeric_string=1,float_like=false]
-  | +-SelectListItem
-  | | +-Literal
-  | |   +-NumericLiteral[numeric_string=2,float_like=false]
-  | +-SelectListItem
-  | | +-Add
-  | |   +-left_operand=Literal
-  | |   | +-NumericLiteral[numeric_string=1,float_like=false]
-  | |   +-right_operand=Literal
-  | |     +-NumericLiteral[numeric_string=1,float_like=false]
-  | +-SelectListItem
-  | | +-Subtract
-  | |   +-left_operand=Literal
-  | |   | +-NumericLiteral[numeric_string=1,float_like=false]
-  | |   +-right_operand=Literal
-  | |     +-NumericLiteral[numeric_string=1,float_like=false]
-  | +-SelectListItem
-  | | +-Subtract
-  | |   +-left_operand=Add
-  | |   | +-left_operand=Subtract
-  | |   | | +-left_operand=Literal
-  | |   | | | +-NumericLiteral[numeric_string=1,float_like=false]
-  | |   | | +-right_operand=Literal
-  | |   | |   +-NumericLiteral[numeric_string=1.2,float_like=true]
-  | |   | +-right_operand=Literal
-  | |   |   +-NumericLiteral[numeric_string=1,float_like=false]
-  | |   +-right_operand=Literal
-  | |     +-NumericLiteral[numeric_string=2.3,float_like=true]
-  | +-SelectListItem
-  | | +-AttributeReference[attribute_name=attr1]
-  | +-SelectListItem
-  | | +-AttributeReference[attribute_name=attr2]
-  | +-SelectListItem
-  | | +-Add
-  | |   +-left_operand=AttributeReference[attribute_name=attr1]
-  | |   +-right_operand=Literal
-  | |     +-NumericLiteral[numeric_string=1,float_like=false]
-  | +-SelectListItem
-  | | +-Add
-  | |   +-left_operand=Add
-  | |   | +-left_operand=AttributeReference[attribute_name=attr1]
-  | |   | +-right_operand=Multiply
-  | |   |   +-left_operand=Literal
-  | |   |   | +-NumericLiteral[numeric_string=1,float_like=false]
-  | |   |   +-right_operand=Literal
-  | |   |     +-NumericLiteral[numeric_string=2,float_like=false]
-  | |   +-right_operand=AttributeReference[attribute_name=attr2]
-  | +-SelectListItem
-  |   +-Add
-  |     +-left_operand=AttributeReference[attribute_name=attr1]
-  |     +-right_operand=Multiply
-  |       +-left_operand=Literal
-  |       | +-NumericLiteral[numeric_string=1,float_like=false]
-  |       +-right_operand=Add
-  |         +-left_operand=Literal
-  |         | +-NumericLiteral[numeric_string=2,float_like=false]
-  |         +-right_operand=AttributeReference[attribute_name=attr2]
-  +-from_clause=
-    +-TableReference[table=test]
-==
-
-SELECT * FROM 123
---
-ERROR: syntax error (1 : 15)
-SELECT * FROM 123
-              ^
-==
-
-# Alias
-SELECT 1 AS a, 2+1 AS b, 3 a, 4 b FROM test AS a, test a
---
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectList
-  | +-SelectListItem[alias=a]
-  | | +-Literal
-  | |   +-NumericLiteral[numeric_string=1,float_like=false]
-  | +-SelectListItem[alias=b]
-  | | +-Add
-  | |   +-left_operand=Literal
-  | |   | +-NumericLiteral[numeric_string=2,float_like=false]
-  | |   +-right_operand=Literal
-  | |     +-NumericLiteral[numeric_string=1,float_like=false]
-  | +-SelectListItem[alias=a]
-  | | +-Literal
-  | |   +-NumericLiteral[numeric_string=3,float_like=false]
-  | +-SelectListItem[alias=b]
-  |   +-Literal
-  |     +-NumericLiteral[numeric_string=4,float_like=false]
-  +-from_clause=
-    +-TableReference[table=test]
-    | +-table_signature=TableSignature[table_alias=a]
-    +-TableReference[table=test]
-      +-table_signature=TableSignature[table_alias=a]
-==
-
-# Column list aliases in FROM.
-SELECT 1 FROM test test_alias(attr, attr1, attr2, attr3), (SELECT * FROM test) AS subquery(attr1, attr1, attr4)
---
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectList
-  | +-SelectListItem
-  |   +-Literal
-  |     +-NumericLiteral[numeric_string=1,float_like=false]
-  +-from_clause=
-    +-TableReference[table=test]
-    | +-table_signature=TableSignature[table_alias=test_alias,
-    |   columns=(attr, attr1, attr2, attr3)]
-    +-SubqueryTable
-      +-table_signature=TableSignature[table_alias=subquery,
-      | columns=(attr1, attr1, attr4)]
-      +-SubqueryExpression
-        +-Select
-          +-select_clause=SelectStar
-          +-from_clause=
-            +-TableReference[table=test]
-==
-
-# Table subquery must be named.
-SELECT 1 FROM (select * FROM test)
---
-ERROR: syntax error (1 : 35)
-SELECT 1 FROM (select * FROM test)
-                                  ^
-==
-
-SELECT 1 FROM test test_alias(attr+1)
---
-ERROR: syntax error (1 : 35)
-SELECT 1 FROM test test_alias(attr+1)
-                                  ^
-==
-
-SELECT 1 FROM test AS
---
-ERROR: syntax error (1 : 22)
-SELECT 1 FROM test AS
-                     ^
-==
-
-SELECT 1 AS a+1 FROM test
---
-ERROR: syntax error (1 : 14)
-SELECT 1 AS a+1 FROM test
-             ^
-==
-
-SELECT 1 FROM test AS a+1
---
-ERROR: syntax error (1 : 24)
-SELECT 1 FROM test AS a+1
-                       ^
-==
-
-SELECT 1 FROM test WHERE 1=1 AND attr1=1 AND attr+1>=1 AND attr-1<=1 AND attr+1>1 AND attr-1<1
---
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectList
-  | +-SelectListItem
-  |   +-Literal
-  |     +-NumericLiteral[numeric_string=1,float_like=false]
-  +-where_clause=And
-  | +-Equal
-  | | +-left_operand=Literal
-  | | | +-NumericLiteral[numeric_string=1,float_like=false]
-  | | +-right_operand=Literal
-  | |   +-NumericLiteral[numeric_string=1,float_like=false]
-  | +-Equal
-  | | +-left_operand=AttributeReference[attribute_name=attr1]
-  | | +-right_operand=Literal
-  | |   +-NumericLiteral[numeric_string=1,float_like=false]
-  | +-GreaterOrEqual
-  | | +-left_operand=Add
-  | | | +-left_operand=AttributeReference[attribute_name=attr]
-  | | | +-right_operand=Literal
-  | | |   +-NumericLiteral[numeric_string=1,float_like=false]
-  | | +-right_operand=Literal
-  | |   +-NumericLiteral[numeric_string=1,float_like=false]
-  | +-LessOrEqual
-  | | +-left_operand=Subtract
-  | | | +-left_operand=AttributeReference[attribute_name=attr]
-  | | | +-right_operand=Literal
-  | | |   +-NumericLiteral[numeric_string=1,float_like=false]
-  | | +-right_operand=Literal
-  | |   +-NumericLiteral[numeric_string=1,float_like=false]
-  | +-Greater
-  | | +-left_operand=Add
-  | | | +-left_operand=AttributeReference[attribute_name=attr]
-  | | | +-right_operand=Literal
-  | | |   +-NumericLiteral[numeric_string=1,float_like=false]
-  | | +-right_operand=Literal
-  | |   +-NumericLiteral[numeric_string=1,float_like=false]
-  | +-Less
-  |   +-left_operand=Subtract
-  |   | +-left_operand=AttributeReference[attribute_name=attr]
-  |   | +-right_operand=Literal
-  |   |   +-NumericLiteral[numeric_string=1,float_like=false]
-  |   +-right_operand=Literal
-  |     +-NumericLiteral[numeric_string=1,float_like=false]
-  +-from_clause=
-    +-TableReference[table=test]
-==
-
-SELECT 1 FROM test WHERE attr BETWEEN 1 AND 2 AND attr BETWEEN 2 AND 1
---
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectList
-  | +-SelectListItem
-  |   +-Literal
-  |     +-NumericLiteral[numeric_string=1,float_like=false]
-  +-where_clause=And
-  | +-Between
-  | | +-check_operand=AttributeReference[attribute_name=attr]
-  | | +-lower_bound_operand=Literal
-  | | | +-NumericLiteral[numeric_string=1,float_like=false]
-  | | +-upper_bound_operand=Literal
-  | |   +-NumericLiteral[numeric_string=2,float_like=false]
-  | +-Between
-  |   +-check_operand=AttributeReference[attribute_name=attr]
-  |   +-lower_bound_operand=Literal
-  |   | +-NumericLiteral[numeric_string=2,float_like=false]
-  |   +-upper_bound_operand=Literal
-  |     +-NumericLiteral[numeric_string=1,float_like=false]
-  +-from_clause=
-    +-TableReference[table=test]
-==
-
-SELECT 1 FROM test WHERE attr NOT BETWEEN 1 AND 2
---
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectList
-  | +-SelectListItem
-  |   +-Literal
-  |     +-NumericLiteral[numeric_string=1,float_like=false]
-  +-where_clause=Not
-  | +-Between
-  |   +-check_operand=AttributeReference[attribute_name=attr]
-  |   +-lower_bound_operand=Literal
-  |   | +-NumericLiteral[numeric_string=1,float_like=false]
-  |   +-upper_bound_operand=Literal
-  |     +-NumericLiteral[numeric_string=2,float_like=false]
-  +-from_clause=
-    +-TableReference[table=test]
-==
-
-SELECT 1 FROM test ORDER BY attr, 1
---
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectList
-  | +-SelectListItem
-  |   +-Literal
-  |     +-NumericLiteral[numeric_string=1,float_like=false]
-  +-order_by=OrderBy
-  | +-OrderByItem[is_asc=true,nulls_first=false]
-  | | +-AttributeReference[attribute_name=attr]
-  | +-OrderByItem[is_asc=true,nulls_first=false]
-  |   +-Literal
-  |     +-NumericLiteral[numeric_string=1,float_like=false]
-  +-from_clause=
-    +-TableReference[table=test]
-==
-
-SELECT fun(attr)+1 FROM test GROUP BY fun()+fun(attr), attr1+attr2 HAVING attr1>1 AND fun(*)>1
---
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectList
-  | +-SelectListItem
-  |   +-Add
-  |     +-left_operand=FunctionCall[name=fun]
-  |     | +-AttributeReference[attribute_name=attr]
-  |     +-right_operand=Literal
-  |       +-NumericLiteral[numeric_string=1,float_like=false]
-  +-group_by=GroupBy
-  | +-Add
-  | | +-left_operand=FunctionCall[name=fun]
-  | | +-right_operand=FunctionCall[name=fun]
-  | |   +-AttributeReference[attribute_name=attr]
-  | +-Add
-  |   +-left_operand=AttributeReference[attribute_name=attr1]
-  |   +-right_operand=AttributeReference[attribute_name=attr2]
-  +-having=HAVING
-  | +-And
-  |   +-Greater
-  |   | +-left_operand=AttributeReference[attribute_name=attr1]
-  |   | +-right_operand=Literal
-  |   |   +-NumericLiteral[numeric_string=1,float_like=false]
-  |   +-Greater
-  |     +-left_operand=FunctionCall[name=fun,is_star=true]
-  |     +-right_operand=Literal
-  |       +-NumericLiteral[numeric_string=1,float_like=false]
-  +-from_clause=
-    +-TableReference[table=test]
-==
-
-# ORDER BY
-SELECT 1 FROM test ORDER BY 1 ASC,
-                            2 DESC,
-                            3 ASC NULLS FIRST,
-                            attr1 DESC NULLS LAST,
-                            attr1+1 NULLS FIRST,
-                            fun(attr)/2
---
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectList
-  | +-SelectListItem
-  |   +-Literal
-  |     +-NumericLiteral[numeric_string=1,float_like=false]
-  +-order_by=OrderBy
-  | +-OrderByItem[is_asc=true,nulls_first=false]
-  | | +-Literal
-  | |   +-NumericLiteral[numeric_string=1,float_like=false]
-  | +-OrderByItem[is_asc=false,nulls_first=true]
-  | | +-Literal
-  | |   +-NumericLiteral[numeric_string=2,float_like=false]
-  | +-OrderByItem[is_asc=true,nulls_first=true]
-  | | +-Literal
-  | |   +-NumericLiteral[numeric_string=3,float_like=false]
-  | +-OrderByItem[is_asc=false,nulls_first=false]
-  | | +-AttributeReference[attribute_name=attr1]
-  | +-OrderByItem[is_asc=true,nulls_first=true]
-  | | +-Add
-  | |   +-left_operand=AttributeReference[attribute_name=attr1]
-  | |   +-right_operand=Literal
-  | |     +-NumericLiteral[numeric_string=1,float_like=false]
-  | +-OrderByItem[is_asc=true,nulls_first=false]
-  |   +-Divide
-  |     +-left_operand=FunctionCall[name=fun]
-  |     | +-AttributeReference[attribute_name=attr]
-  |     +-right_operand=Literal
-  |       +-NumericLiteral[numeric_string=2,float_like=false]
-  +-from_clause=
-    +-TableReference[table=test]
-==
-
-# Limit
-SELECT 1 FROM test LIMIT 1
---
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectList
-  | +-SelectListItem
-  |   +-Literal
-  |     +-NumericLiteral[numeric_string=1,float_like=false]
-  +-limit=LIMIT
-  | +-NumericLiteral[numeric_string=1,float_like=false]
-  +-from_clause=
-    +-TableReference[table=test]
-==
-
-SELECT 1 FROM test LIMIT 1.1
---
-ERROR: LIMIT value must be an integer (1 : 26)
-SELECT 1 FROM test LIMIT 1.1
-                         ^
-==
-
-SELECT 1 FROM test LIMIT 0
---
-ERROR: LIMIT value must be positive (1 : 26)
-SELECT 1 FROM test LIMIT 0
-                         ^
-==
-
-SELECT 1 FROM test LIMIT -1
---
-ERROR: syntax error (1 : 26)
-SELECT 1 FROM test LIMIT -1
-                         ^
-==
-
-SELECT 1 FROM test LIMIT abc
---
-ERROR: syntax error (1 : 26)
-SELECT 1 FROM test LIMIT abc
-                         ^
-==
-
-# Priority
-SELECT 1 FROM test WITH PRIORITY 1
---
-SelectStatement
-+-select_query=Select
-| +-select_clause=SelectList
-| | +-SelectListItem
-| |   +-Literal
-| |     +-NumericLiteral[numeric_string=1,float_like=false]
-| +-from_clause=
-|   +-TableReference[table=test]
-+-priority=PRIORITY
-  +-NumericLiteral[numeric_string=1,float_like=false]
-==
-
-SELECT 1 FROM test WITH PRIORITY 1.1
---
-ERROR: PRIORITY value must be an integer (1 : 34)
-SELECT 1 FROM test WITH PRIORITY 1.1
-                                 ^
-==
-
-SELECT 1 FROM test WITH PRIORITY 0
---
-ERROR: PRIORITY value must be positive (1 : 34)
-SELECT 1 FROM test WITH PRIORITY 0
-                                 ^
-==
-
-SELECT 1 FROM test WITH PRIORITY -1
---
-ERROR: syntax error (1 : 34)
-SELECT 1 FROM test WITH PRIORITY -1
-                                 ^
-==
-
-SELECT 1 FROM test WITH PRIORITY abc
---
-ERROR: syntax error (1 : 34)
-SELECT 1 FROM test WITH PRIORITY abc
-                                 ^
-==
-
-#
-# Subqueries
-#
-
-# Subqueries in the FROM clause.
-SELECT * FROM test, (select * FROM test) AS a, (select * FROM test) a
---
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectStar
-  +-from_clause=
-    +-TableReference[table=test]
-    +-SubqueryTable
-    | +-table_signature=TableSignature[table_alias=a]
-    | +-SubqueryExpression
-    |   +-Select
-    |     +-select_clause=SelectStar
-    |     +-from_clause=
-    |       +-TableReference[table=test]
-    +-SubqueryTable
-      +-table_signature=TableSignature[table_alias=a]
-      +-SubqueryExpression
-        +-Select
-          +-select_clause=SelectStar
-          +-from_clause=
-            +-TableReference[table=test]
-==
-
-SELECT * FROM test, SELECT * FROM test
---
-ERROR: syntax error (1 : 21)
-SELECT * FROM test, SELECT * FROM test
-                    ^
-==
-
-SELECT * FROM (select * FROM (select * FROM (select * FROM test) a ) a ) a
---
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectStar
-  +-from_clause=
-    +-SubqueryTable
-      +-table_signature=TableSignature[table_alias=a]
-      +-SubqueryExpression
-        +-Select
-          +-select_clause=SelectStar
-          +-from_clause=
-            +-SubqueryTable
-              +-table_signature=TableSignature[table_alias=a]
-              +-SubqueryExpression
-                +-Select
-                  +-select_clause=SelectStar
-                  +-from_clause=
-                    +-SubqueryTable
-                      +-table_signature=TableSignature[table_alias=a]
-                      +-SubqueryExpression
-                        +-Select
-                          +-select_clause=SelectStar
-                          +-from_clause=
-                            +-TableReference[table=test]
-==
-
-# Subqueries are not supported yet in clauses other than the FROM clause.
-SELECT (select * FROM test) FROM test
---
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectList
-  | +-SelectListItem
-  |   +-SubqueryExpression
-  |     +-Select
-  |       +-select_clause=SelectStar
-  |       +-from_clause=
-  |         +-TableReference[table=test]
-  +-from_clause=
-    +-TableReference[table=test]
-==
-
-SELECT 1 FROM test WHERE 1 > (select 1 FROM test)
---
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectList
-  | +-SelectListItem
-  |   +-Literal
-  |     +-NumericLiteral[numeric_string=1,float_like=false]
-  +-where_clause=Greater
-  | +-left_operand=Literal
-  | | +-NumericLiteral[numeric_string=1,float_like=false]
-  | +-right_operand=SubqueryExpression
-  |   +-Select
-  |     +-select_clause=SelectList
-  |     | +-SelectListItem
-  |     |   +-Literal
-  |     |     +-NumericLiteral[numeric_string=1,float_like=false]
-  |     +-from_clause=
-  |       +-TableReference[table=test]
-  +-from_clause=
-    +-TableReference[table=test]
-==
-
-#
-# WITH clause
-#
-WITH a (col) AS (SELECT 1 FROM test GROUP BY a ORDER BY b LIMIT 1),
-     b (col1, col2, col3) AS (SELECT * FROM (SELECT * FROM test) a),
-     c AS (SELECT 1 FROM test)
-SELECT 1 FROM a, b, c, d
---
-SelectStatement
-+-select_query=Select
-| +-select_clause=SelectList
-| | +-SelectListItem
-| |   +-Literal
-| |     +-NumericLiteral[numeric_string=1,float_like=false]
-| +-from_clause=
-|   +-TableReference[table=a]
-|   +-TableReference[table=b]
-|   +-TableReference[table=c]
-|   +-TableReference[table=d]
-+-with_clause=
-  +-SubqueryTable
-  | +-table_signature=TableSignature[table_alias=a,columns=(col)]
-  | +-SubqueryExpression
-  |   +-Select
-  |     +-select_clause=SelectList
-  |     | +-SelectListItem
-  |     |   +-Literal
-  |     |     +-NumericLiteral[numeric_string=1,float_like=false]
-  |     +-group_by=GroupBy
-  |     | +-AttributeReference[attribute_name=a]
-  |     +-order_by=OrderBy
-  |     | +-OrderByItem[is_asc=true,nulls_first=false]
-  |     |   +-AttributeReference[attribute_name=b]
-  |     +-limit=LIMIT
-  |     | +-NumericLiteral[numeric_string=1,float_like=false]
-  |     +-from_clause=
-  |       +-TableReference[table=test]
-  +-SubqueryTable
-  | +-table_signature=TableSignature[table_alias=b,columns=(col1, col2, col3)]
-  | +-SubqueryExpression
-  |   +-Select
-  |     +-select_clause=SelectStar
-  |     +-from_clause=
-  |       +-SubqueryTable
-  |         +-table_signature=TableSignature[table_alias=a]
-  |         +-SubqueryExpression
-  |           +-Select
-  |             +-select_clause=SelectStar
-  |             +-from_clause=
-  |               +-TableReference[table=test]
-  +-SubqueryTable
-    +-table_signature=TableSignature[table_alias=c]
-    +-SubqueryExpression
-      +-Select
-        +-select_clause=SelectList
-        | +-SelectListItem
-        |   +-Literal
-        |     +-NumericLiteral[numeric_string=1,float_like=false]
-        +-from_clause=
-          +-TableReference[table=test]
-==
-
-WITH a AS (SELECT 1 FROM test)
-SELECT 1 FROM a
---
-SelectStatement
-+-select_query=Select
-| +-select_clause=SelectList
-| | +-SelectListItem
-| |   +-Literal
-| |     +-NumericLiteral[numeric_string=1,float_like=false]
-| +-from_clause=
-|   +-TableReference[table=a]
-+-with_clause=
-  +-SubqueryTable
-    +-table_signature=TableSignature[table_alias=a]
-    +-SubqueryExpression
-      +-Select
-        +-select_clause=SelectList
-        | +-SelectListItem
-        |   +-Literal
-        |     +-NumericLiteral[numeric_string=1,float_like=false]
-        +-from_clause=
-          +-TableReference[table=test]
-==
-
-# AS cannot be omitted.
-WITH a (SELECT 1 FROM test)
-SELECT 1 FROM a
---
-ERROR: syntax error (1 : 9)
-WITH a (SELECT 1 FROM test)
-        ^
-==
-
-WITH a AS (SELECT 1 FROM test)
---
-ERROR: syntax error (1 : 31)
-WITH a AS (SELECT 1 FROM test)
-                              ^
-==
-
-# The WITH query cannot have WITH.
-WITH a AS (with c SELECT 1 FROM test)
-SELECT 1 FROM test
---
-ERROR: syntax error (1 : 12)
-WITH a AS (with c SELECT 1 FROM test)
-           ^
-==
-
-WITH a AS (select 1 FROM test) b
-SELECT 1 FROM test
---
-ERROR: syntax error (1 : 32)
-WITH a AS (select 1 FROM test) b
-                               ^
-==
-
-# Missing comma.
-SELECT a AS (select 1 FROM test) b AS (SELECT 1 FROM test)
-SELECT 1 FROM test
---
-ERROR: syntax error (1 : 13)
-SELECT a AS (select 1 FROM test) b AS (SELEC...
-            ^
-==
-
-#
-# Literal values and types.
-#
-
-# Bool literal value is not supported yet.
-SELECT 1 FROM test WHERE TRUE
---
-ERROR: syntax error (1 : 26)
-SELECT 1 FROM test WHERE TRUE
-                         ^
-==
-
-SELECT 1 FROM test WHERE tb1 = TRUE
---
-ERROR: syntax error (1 : 32)
-SELECT 1 FROM test WHERE tb1 = TRUE
-                               ^
-==
-
-# FIXME(chasseur, qzeng): The result is wrong. Add support for hexadecimal literals.
-SELECT 0xfff FROM test
---
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectList
-  | +-SelectListItem[alias=xfff]
-  |   +-Literal
-  |     +-NumericLiteral[numeric_string=0,float_like=false]
-  +-from_clause=
-    +-TableReference[table=test]
-==
-
-SELECT x'fff' FROM test
---
-ERROR: syntax error (1 : 13)
-SELECT x'fff' FROM test
-            ^
-==
-
-SELECT 123e23, 123e-123, 123e-2+1, 123e-2*2, 123e-123,
-       1e100000000
-FROM test
---
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectList
-  | +-SelectListItem
-  | | +-Literal
-  | |   +-NumericLiteral[numeric_string=123e23,float_like=true]
-  | +-SelectListItem
-  | | +-Literal
-  | |   +-NumericLiteral[numeric_string=123e-123,float_like=true]
-  | +-SelectListItem
-  | | +-Add
-  | |   +-left_operand=Literal
-  | |   | +-NumericLiteral[numeric_string=123e-2,float_like=true]
-  | |   +-right_operand=Literal
-  | |     +-NumericLiteral[numeric_string=1,float_like=false]
-  | +-SelectListItem
-  | | +-Multiply
-  | |   +-left_operand=Literal
-  | |   | +-NumericLiteral[numeric_string=123e-2,float_like=true]
-  | |   +-right_operand=Literal
-  | |     +-NumericLiteral[numeric_string=2,float_like=false]
-  | +-SelectListItem
-  | | +-Literal
-  | |   +-NumericLiteral[numeric_string=123e-123,float_like=true]
-  | +-SelectListItem
-  |   +-Literal
-  |     +-NumericLiteral[numeric_string=1e100000000,float_like=true]
-  +-from_clause=
-    +-TableReference[table=test]
-==
-
-SELECT 9223372036854775805, 9223372036854775807, 9223372036854775809, -9223372036854775805,
-       -9223372036854775807, -9223372036854775809, 9223372036854775800.8, 1.123456789012345678901234567890,
-       -9223372036854775800.8, -1.123456789012345678901234567890
-FROM test
---
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectList
-  | +-SelectListItem
-  | | +-Literal
-  | |   +-NumericLiteral[numeric_string=9223372036854775805,float_like=false]
-  | +-SelectListItem
-  | | +-Literal
-  | |   +-NumericLiteral[numeric_string=9223372036854775807,float_like=false]
-  | +-SelectListItem
-  | | +-Literal
-  | |   +-NumericLiteral[numeric_string=9223372036854775809,float_like=false]
-  | +-SelectListItem
-  | | +-Literal
-  | |   +-NumericLiteral[numeric_string=-9223372036854775805,float_like=false]
-  | +-SelectListItem
-  | | +-Literal
-  | |   +-NumericLiteral[numeric_string=-9223372036854775807,float_like=false]
-  | +-SelectListItem
-  | | +-Literal
-  | |   +-NumericLiteral[numeric_string=-9223372036854775809,float_like=false]
-  | +-SelectListItem
-  | | +-Literal
-  | |   +-NumericLiteral[numeric_string=9223372036854775800.8,float_like=true]
-  | +-SelectListItem
-  | | +-Literal
-  | |   +-NumericLiteral[numeric_string=1.123456789012345678901234567890,
-  | |     float_like=true]
-  | +-SelectListItem
-  | | +-Literal
-  | |   +-NumericLiteral[numeric_string=-9223372036854775800.8,float_like=true]
-  | +-SelectListItem
-  |   +-Literal
-  |     +-NumericLiteral[numeric_string=-1.123456789012345678901234567890,
-  |       float_like=true]
-  +-from_clause=
-    +-TableReference[table=test]
-==
-
-# Escape characters.
-SELECT 1, e'$asdfg\'\'\"\"\t\r\n' FROM test WHERE char_col = e'\'asdfg\''
---
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectList
-  | +-SelectListItem
-  | | +-Literal
-  | |   +-NumericLiteral[numeric_string=1,float_like=false]
-  | +-SelectListItem
-  |   +-Literal
-  |     +-StringLiteral[value=$asdfg''""	
-]
-  +-where_clause=Equal
-  | +-left_operand=AttributeReference[attribute_name=char_col]
-  | +-right_operand=Literal
-  |   +-StringLiteral[value='asdfg']
-  +-from_clause=
-    +-TableReference[table=test]
-==
-
-# Double-quoted strings are identifiers, which do not need to be escaped.
-SELECT 1 "abc\n" FROM test
---
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectList
-  | +-SelectListItem[alias=abc\n]
-  |   +-Literal
-  |     +-NumericLiteral[numeric_string=1,float_like=false]
-  +-from_clause=
-    +-TableReference[table=test]
-==
-
-SELECT 1 "abc
-
-def
-" FROM test
---
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectList
-  | +-SelectListItem[alias=abc
-
-def
-]
-  |   +-Literal
-  |     +-NumericLiteral[numeric_string=1,float_like=false]
-  +-from_clause=
-    +-TableReference[table=test]
-==
-
-# Currently predicate is not treated as a regular scalar expression.
-SELECT 1 FROM test WHERE (1>1)=(1<1)
---
-ERROR: syntax error (1 : 31)
-SELECT 1 FROM test WHERE (1>1)=(1<1)
-                              ^
-==
-
-SELECT 1 """this IS a double-quoted string""", 2 "this IS NOT a double-quoted string" FROM test
---
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectList
-  | +-SelectListItem[alias="this IS a double-quoted string"]
-  | | +-Literal
-  | |   +-NumericLiteral[numeric_string=1,float_like=false]
-  | +-SelectListItem[alias=this IS NOT a double-quoted string]
-  |   +-Literal
-  |     +-NumericLiteral[numeric_string=2,float_like=false]
-  +-from_clause=
-    +-TableReference[table=test]
-==
-
-#
-# DateTime and Interval
-#
-
-SELECT '1998-12-01',
-       DATE '1998-12-01'
-FROM test
---
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectList
-  | +-SelectListItem
-  | | +-Literal
-  | |   +-StringLiteral[value=1998-12-01]
-  | +-SelectListItem
-  |   +-Literal
-  |     +-StringLiteral[value=1998-12-01,explicit_type=Date]
-  +-from_clause=
-    +-TableReference[table=test]
-==
-
-# Year before 1970.
-SELECT DATE '1960-12-12',
-       DATE '1901-12-14' FROM test
---
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectList
-  | +-SelectListItem
-  | | +-Literal
-  | |   +-StringLiteral[value=1960-12-12,explicit_type=Date]
-  | +-SelectListItem
-  |   +-Literal
-  |     +-StringLiteral[value=1901-12-14,explicit_type=Date]
-  +-from_clause=
-    +-TableReference[table=test]
-==
-
-SELECT DATE '1998-2-12', DATE '1998-12-2' FROM test
---
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectList
-  | +-SelectListItem
-  | | +-Literal
-  | |   +-StringLiteral[value=1998-2-12,explicit_type=Date]
-  | +-SelectListItem
-  |   +-Literal
-  |     +-StringLiteral[value=1998-12-2,explicit_type=Date]
-  +-from_clause=
-    +-TableReference[table=test]
-==
-
-SELECT DATE '+1921-12-12',
-       DATE '+10001-12-12'
-FROM test
---
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectList
-  | +-SelectListItem
-  | | +-Literal
-  | |   +-StringLiteral[value=+1921-12-12,explicit_type=Date]
-  | +-SelectListItem
-  |   +-Literal
-  |     +-StringLiteral[value=+10001-12-12,explicit_type=Date]
-  +-from_clause=
-    +-TableReference[table=test]
-==
-
-SELECT DATE 'a1998-12-12' FROM test
---
-ERROR: Failed to parse literal as specified type (1 : 25)
-SELECT DATE 'a1998-12-12' FROM test
-                        ^
-==
-
-SELECT DATE '1998-a12-b12' FROM test
---
-ERROR: Failed to parse literal as specified type (1 : 26)
-SELECT DATE '1998-a12-b12' FROM test
-                         ^
-==
-
-SELECT DATE '1998-+12-12' FROM test
---
-ERROR: Failed to parse literal as specified type (1 : 25)
-SELECT DATE '1998-+12-12' FROM test
-                        ^
-==
-
-SELECT DATE '1998-12-12abc' FROM test
---
-ERROR: Failed to parse literal as specified type (1 : 27)
-SELECT DATE '1998-12-12abc' FROM test
-                          ^
-==
-
-SELECT DATE '1998/12/12' FROM test
---
-ERROR: Failed to parse literal as specified type (1 : 24)
-SELECT DATE '1998/12/12' FROM test
-                       ^
-==
-
-SELECT DATE '1996-02-29',
-       DATE '1997-03-31',
-       DATE '1998-04-30' FROM test
---
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectList
-  | +-SelectListItem
-  | | +-Literal
-  | |   +-StringLiteral[value=1996-02-29,explicit_type=Date]
-  | +-SelectListItem
-  | | +-Literal
-  | |   +-StringLiteral[value=1997-03-31,explicit_type=Date]
-  | +-SelectListItem
-  |   +-Literal
-  |     +-StringLiteral[value=1998-04-30,explicit_type=Date]
-  +-from_clause=
-    +-TableReference[table=test]
-==
-
-SELECT DATE '1999-02-29' FROM test
---
-ERROR: Failed to parse literal as specified type (1 : 24)
-SELECT DATE '1999-02-29' FROM test
-                       ^
-==
-
-# Quickstep accepts time in the DATETIME type.
-SELECT DATETIME '2007-05-08 12:35:29',
-       DATETIME '2007-05-08 12:35:29.010'
-FROM test
---
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectList
-  | +-SelectListItem
-  | | +-Literal
-  | |   +-StringLiteral[value=2007-05-08 12:35:29,explicit_type=Datetime]
-  | +-SelectListItem
-  |   +-Literal
-  |     +-StringLiteral[value=2007-05-08 12:35:29.010,explicit_type=Datetime]
-  +-from_clause=
-    +-TableReference[table=test]
-==
-
-SELECT DATE '1999-04-31' FROM test
---
-ERROR: Failed to parse literal as specified type (1 : 24)
-SELECT DATE '1999-04-31' FROM test
-                       ^
-==
-
-SELECT 1 FROM test WHERE attr_date <= DATE '1998-12-01' - INTERVAL '96 day'
---
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectList
-  | +-SelectListItem
-  |   +-Literal
-  |     +-NumericLiteral[numeric_string=1,float_like=false]
-  +-where_clause=LessOrEqual
-  | +-left_operand=AttributeReference[attribute_name=attr_date]
-  | +-right_operand=Subtract
-  |   +-left_operand=Literal
-  |   | +-StringLiteral[value=1998-12-01,explicit_type=Date]
-  |   +-right_operand=Literal
-  |     +-StringLiteral[value=96 day,explicit_type=DatetimeInterval]
-  +-from_clause=
-    +-TableReference[table=test]
-==
-
-SELECT INTERVAL '1 us', INTERVAL '1 ms', INTERVAL '1 s', INTERVAL '1 minute',
-           INTERVAL '1 h', INTERVAL '1 day', INTERVAL '1 week',
-           INTERVAL '1 month', INTERVAL '1 year', INTERVAL '1 decade',
-           INTERVAL '1 century', INTERVAL '1 millennium',
-       DATETIME INTERVAL '1 us', DATETIME INTERVAL '1 ms',
-           DATETIME INTERVAL '1 s', DATETIME INTERVAL '1 minute',
-           DATETIME INTERVAL '1 h', DATETIME INTERVAL '1 day',
-           DATETIME INTERVAL '1 week', YEARMONTH INTERVAL '1 month',
-           YEARMONTH INTERVAL '1 year', YEARMONTH INTERVAL '1 decade',
-           YEARMONTH INTERVAL '1 century', YEARMONTH INTERVAL '1 millennium'
-FROM test
---
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectList
-  | +-SelectListItem
-  | | +-Literal
-  | |   +-StringLiteral[value=1 us,explicit_type=DatetimeInterval]
-  | +-SelectListItem
-  | | +-Literal
-  | |   +-StringLiteral[value=1 ms,explicit_type=DatetimeInterval]
-  | +-SelectListItem
-  | | +-Literal
-  | |   +-StringLiteral[value=1 s,explicit_type=DatetimeInterval]
-  | +-SelectListItem
-  | | +-Literal
-  | |   +-StringLiteral[value=1 minute,explicit_type=DatetimeInterval]
-  | +-SelectListItem
-  | | +-Literal
-  | |   +-StringLiteral[value=1 h,explicit_type=DatetimeInterval]
-  | +-SelectListItem
-  | | +-Literal
-  | |   +-StringLiteral[value=1 day,explicit_type=DatetimeInterval]
-  | +-SelectListItem
-  | | +-Literal
-  | |   +-StringLiteral[value=1 week,explicit_type=DatetimeInterval]
-  | +-SelectListItem
-  | | +-Literal
-  | |   +-StringLiteral[value=1 month,explicit_type=YearMonthInterval]
-  | +-SelectListItem
-  | | +-Literal
-  | |   +-StringLiteral[value=1 year,explicit_type=YearMonthInterval]
-  | +-SelectListItem
-  | | +-Literal
-  | |   +-StringLiteral[value=1 decade,explicit_type=YearMonthInterval]
-  | +-SelectListItem
-  | | +-Literal
-  | |   +-StringLiteral[value=1 century,explicit_type=YearMonthInterval]
-  | +-SelectListItem
-  | | +-Literal
-  | |   +-StringLiteral[value=1 millennium,explicit_type=YearMonthInterval]
-  | +-SelectListItem
-  | | +-Literal
-  | |   +-StringLiteral[value=1 us,explicit_type=DatetimeInterval]
-  | +-SelectListItem
-  | | +-Literal
-  | |   +-StringLiteral[value=1 ms,explicit_type=DatetimeInterval]
-  | +-SelectListItem
-  | | +-Literal
-  | |   +-StringLiteral[value=1 s,explicit_type=DatetimeInterval]
-  | +-SelectListItem
-  | | +-Literal
-  | |   +-StringLiteral[value=1 minute,explicit_type=DatetimeInterval]
-  | +-SelectListItem
-  | | +-Literal
-  | |   +-StringLiteral[value=1 h,explicit_type=DatetimeInterval]
-  | +-SelectListItem
-  | | +-Literal
-  | |   +-StringLiteral[value=1 day,explicit_type=DatetimeInterval]
-  | +-SelectListItem
-  | | +-Literal
-  | |   +-StringLiteral[value=1 week,explicit_type=DatetimeInterval]
-  | +-SelectListItem
-  | | +-Literal
-  | |   +-StringLiteral[value=1 month,explicit_type=YearMonthInterval]
-  | +-SelectListItem
-  | | +-Literal
-  | |   +-StringLiteral[value=1 year,explicit_type=YearMonthInterval]
-  | +-SelectListItem
-  | | +-Literal
-  | |   +-StringLiteral[value=1 decade,explicit_type=YearMonthInterval]
-  | +-SelectListItem
-  | | +-Literal
-  | |   +-StringLiteral[value=1 century,explicit_type=YearMonthInterval]
-  | +-SelectListItem
-  |   +-Literal
-  |     +-StringLiteral[value=1 millennium,explicit_type=YearMonthInterval]
-  +-from_clause=
-    +-TableReference[table=test]
-==
-
-SELECT INTERVAL '4 day' (1)
-FROM test
---
-ERROR: syntax error (1 : 25)
-SELECT INTERVAL '4 day' (1)
-                        ^
-==
-
-SELECT INTERVAL '2 moth' FROM test
---
-ERROR: Failed to parse literal as specified type (1 : 24)
-SELECT INTERVAL '2 moth' FROM test
-                       ^
-==
-
-SELECT INTERVAL '-3 year' FROM test
---
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectList
-  | +-SelectListItem
-  |   +-Literal
-  |     +-StringLiteral[value=-3 year,explicit_type=YearMonthInterval]
-  +-from_clause=
-    +-TableReference[table=test]
-==
-
-SELECT INTERVAL 'a 3 year' FROM test
---
-ERROR: Failed to parse literal as specified type (1 : 26)
-SELECT INTERVAL 'a 3 year' FROM test
-                         ^
-==
-
-SELECT INTERVAL '5-3 year to month' FROM test
---
-ERROR: Failed to parse literal as specified type (1 : 35)
-SELECT INTERVAL '5-3 year to month' FROM test
-                                  ^
-==
-
-SELECT INTERVAL '5-3 day to second' FROM test
---
-ERROR: Failed to parse literal as specified type (1 : 35)
-SELECT INTERVAL '5-3 day to second' FROM test
-                                  ^
-==
-
-#
-# Minus sign in arithmetic expressions is parsed as the subtraction
-# or negation operation, not as the notation of a negative value.
-#
-
-SELECT 1-1 FROM test
---
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectList
-  | +-SelectListItem
-  |   +-Subtract
-  |     +-left_operand=Literal
-  |     | +-NumericLiteral[numeric_string=1,float_like=false]
-  |     +-right_operand=Literal
-  |       +-NumericLiteral[numeric_string=1,float_like=false]
-  +-from_clause=
-    +-TableReference[table=test]
-==
-
-SELECT 1 - 1 FROM test
---
-[same as above]
-==
-
-SELECT 1--1 FROM test
---
-ERROR: syntax error (1 : 22)
-SELECT 1--1 FROM test
-                     ^
-==
-
-SELECT 1+-1 FROM test
---
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectList
-  | +-SelectListItem
-  |   +-Add
-  |     +-left_operand=Literal
-  |     | +-NumericLiteral[numeric_string=1,float_like=false]
-  |     +-right_operand=Literal
-  |       +-NumericLiteral[numeric_string=-1,float_like=false]
-  +-from_clause=
-    +-TableReference[table=test]
-==
-
-SELECT 1-1+-1 FROM test
---
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectList
-  | +-SelectListItem
-  |   +-Add
-  |     +-left_operand=Subtract
-  |     | +-left_operand=Literal
-  |     | | +-NumericLiteral[numeric_string=1,float_like=false]
-  |     | +-right_operand=Literal
-  |     |   +-NumericLiteral[numeric_string=1,float_like=false]
-  |     +-right_operand=Literal
-  |       +-NumericLiteral[numeric_string=-1,float_like=false]
-  +-from_clause=
-    +-TableReference[table=test]
-==
-
-SELECT 1+(-1) FROM test
---
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectList
-  | +-SelectListItem
-  |   +-Add
-  |     +-left_operand=Literal
-  |     | +-NumericLiteral[numeric_string=1,float_like=false]
-  |     +-right_operand=Literal
-  |       +-NumericLiteral[numeric_string=-1,float_like=false]
-  +-from_clause=
-    +-TableReference[table=test]
-==
-
-# Quit statement
-QUIT
---
-QuitStatement
-==
-
-# Literals with various explicit types.
-SELECT INT '1', LONG '1', FLOAT '1', DOUBLE '1', char(42) 'foo', varchar(42) 'bar' FROM test
---
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectList
-  | +-SelectListItem
-  | | +-Literal
-  | |   +-StringLiteral[value=1,explicit_type=Int]
-  | +-SelectListItem
-  | | +-Literal
-  | |   +-StringLiteral[value=1,explicit_type=Long]
-  | +-SelectListItem
-  | | +-Literal
-  | |   +-StringLiteral[value=1,explicit_type=Float]
-  | +-SelectListItem
-  | | +-Literal
-  | |   +-StringLiteral[value=1,explicit_type=Double]
-  | +-SelectListItem
-  | | +-Literal
-  | |   +-StringLiteral[value=foo,explicit_type=Char(42)]
-  | +-SelectListItem
-  |   +-Literal
-  |     +-StringLiteral[value=bar,explicit_type=VarChar(42)]
-  +-from_clause=
-    +-TableReference[table=test]
-==
-
-# Value needs to be quoted when giving an explicit type.
-SELECT INT 1 FROM test
---
-ERROR: syntax error (1 : 12)
-SELECT INT 1 FROM test
-           ^
-==
-
-# Explicit type that can't parse the supplied string.
-SELECT INT 'foo' FROM test
---
-ERROR: Failed to parse literal as specified type (1 : 16)
-SELECT INT 'foo' FROM test
-               ^
-==
-
-# Various floats that, while not in the canonical print format, are still
-# acceptable according to the SQL standard.
-SELECT 1. FROM test
---
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectList
-  | +-SelectListItem
-  |   +-Literal
-  |     +-NumericLiteral[numeric_string=1.,float_like=true]
-  +-from_clause=
-    +-TableReference[table=test]
-==
-
-SELECT .1 FROM test
---
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectList
-  | +-SelectListItem
-  |   +-Literal
-  |     +-NumericLiteral[numeric_string=.1,float_like=true]
-  +-from_clause=
-    +-TableReference[table=test]
-==
-
-SELECT 1.e1 FROM test
---
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectList
-  | +-SelectListItem
-  |   +-Literal
-  |     +-NumericLiteral[numeric_string=1.e1,float_like=true]
-  +-from_clause=
-    +-TableReference[table=test]
-==
-
-SELECT .1e1 FROM test
---
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectList
-  | +-SelectListItem
-  |   +-Literal
-  |     +-NumericLiteral[numeric_string=.1e1,float_like=true]
-  +-from_clause=
-    +-TableReference[table=test]
-==
-
-# EXISTS subquery
-SELECT i
-FROM generate_series(0, 100, 3) AS gs1(i)
-WHERE
-  EXISTS (
-    SELECT *
-    FROM generate_series(0, 100, 5) AS gs2(i)
-    WHERE gs1.i = gs2.i
-  )
-  AND NOT EXISTS (
-    SELECT *
-    FROM generate_series(0, 100, 10) AS gs3(i)
-    WHERE gs1.i = gs3.i
-  );
---
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectList
-  | +-SelectListItem
-  |   +-AttributeReference[attribute_name=i]
-  +-where_clause=And
-  | +-Exists
-  | | +-subquery=SubqueryExpression
-  | |   +-Select
-  | |     +-select_clause=SelectStar
-  | |     +-where_clause=Equal
-  | |     | +-left_operand=AttributeReference[attribute_name=i,relation_name=gs1]
-  | |     | +-right_operand=AttributeReference[attribute_name=i,
-  | |     |   relation_name=gs2]
-  | |     +-from_clause=
-  | |       +-TableGenerator
-  | |         +-FunctionCall[name=generate_series]
-  | |           +-Literal
-  | |           | +-NumericLiteral[numeric_string=0,float_like=false]
-  | |           +-Literal
-  | |           | +-NumericLiteral[numeric_string=100,float_like=false]
-  | |           +-Literal
-  | |             +-NumericLiteral[numeric_string=5,float_like=false]
-  | +-Not
-  |   +-Exists
-  |     +-subquery=SubqueryExpression
-  |       +-Select
-  |         +-select_clause=SelectStar
-  |         +-where_clause=Equal
-  |         | +-left_operand=AttributeReference[attribute_name=i,
-  |         | | relation_name=gs1]
-  |         | +-right_operand=AttributeReference[attribute_name=i,
-  |         |   relation_name=gs3]
-  |         +-from_clause=
-  |           +-TableGenerator
-  |             +-FunctionCall[name=generate_series]
-  |               +-Literal
-  |               | +-NumericLiteral[numeric_string=0,float_like=false]
-  |               +-Literal
-  |               | +-NumericLiteral[numeric_string=100,float_like=false]
-  |               +-Literal
-  |                 +-NumericLiteral[numeric_string=10,float_like=false]
-  +-from_clause=
-    +-TableGenerator
-      +-FunctionCall[name=generate_series]
-        +-Literal
-        | +-NumericLiteral[numeric_string=0,float_like=false]
-        +-Literal
-        | +-NumericLiteral[numeric_string=100,float_like=false]
-        +-Literal
-          +-NumericLiteral[numeric_string=3,float_like=false]
-==
-
-# CASE expressions.
-SELECT CASE col1%2
-           WHEN 1 THEN 'odd'
-           ELSE 'even'
-       END
-FROM test;
---
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectList
-  | +-SelectListItem
-  |   +-SimpleCaseExpression
-  |     +-case_operand=Modulo
-  |     | +-left_operand=AttributeReference[attribute_name=col1]
-  |     | +-right_operand=Literal
-  |     |   +-NumericLiteral[numeric_string=2,float_like=false]
-  |     +-else_result_expression=Literal
-  |     | +-StringLiteral[value=even]
-  |     +-when_clauses=
-  |       +-SimpleWhenClause
-  |         +-condition_operand=Literal
-  |         | +-NumericLiteral[numeric_string=1,float_like=false]
-  |         +-result_expression=Literal
-  |           +-StringLiteral[value=odd]
-  +-from_clause=
-    +-TableReference[table=test]
-==
-
-SELECT *
-FROM test
-WHERE CASE WHEN col1 > col2 THEN col3
-           ELSE col4
-      END > 0;
---
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectStar
-  +-where_clause=Greater
-  | +-left_operand=SearchedCaseExpression
-  | | +-else_result_expression=AttributeReference[attribute_name=col4]
-  | | +-when_clauses=
-  | |   +-SearchedWhenClause
-  | |     +-condition_predicate=Greater
-  | |     | +-left_operand=AttributeReference[attribute_name=col1]
-  | |     | +-right_operand=AttributeReference[attribute_name=col2]
-  | |     +-result_expression=AttributeReference[attribute_name=col3]
-  | +-right_operand=Literal
-  |   +-NumericLiteral[numeric_string=0,float_like=false]
-  +-from_clause=
-    +-TableReference[table=test]
-==
-
-SELECT
-  FUN(CASE col1
-        WHEN col2 + FUN(
-               CASE WHEN col1 < col2 THEN 0
-                    ELSE 1
-               END +
-               CASE WHEN col1 < col3 THEN 0
-                    ELSE 1
-               END
-             ) THEN 1
-        WHEN col3 THEN 2
-        ELSE 0
-      END + col4)
-FROM test;
---
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectList
-  | +-SelectListItem
-  |   +-FunctionCall[name=FUN]
-  |     +-Add
-  |       +-left_operand=SimpleCaseExpression
-  |       | +-case_operand=AttributeReference[attribute_name=col1]
-  |       | +-else_result_expression=Literal
-  |       | | +-NumericLiteral[numeric_string=0,float_like=false]
-  |       | +-when_clauses=
-  |       |   +-SimpleWhenClause
-  |       |   | +-condition_operand=Add
-  |       |   | | +-left_operand=AttributeReference[attribute_name=col2]
-  |       |   | | +-right_operand=FunctionCall[name=FUN]
-  |       |   | |   +-Add
-  |       |   | |     +-left_operand=SearchedCaseExpression
-  |       |   | |     | +-else_result_expression=Literal
-  |       |   | |     | | +-NumericLiteral[numeric_string=1,float_like=false]
-  |       |   | |     | +-when_clauses=
-  |       |   | |     |   +-SearchedWhenClause
-  |       |   | |     |     +-condition_predicate=Less
-  |       |   | |     |     | +-left_operand=AttributeReference[
-  |       |   | |     |     | | attribute_name=col1]
-  |       |   | |     |     | +-right_operand=AttributeReference[
-  |       |   | |     |     |   attribute_name=col2]
-  |       |   | |     |     +-result_expression=Literal
-  |       |   | |     |       +-NumericLiteral[numeric_string=0,float_like=false]
-  |       |   | |     +-right_operand=SearchedCaseExpression
-  |       |   | |       +-else_result_expression=Literal
-  |       |   | |       | +-NumericLiteral[numeric_string=1,float_like=false]
-  |       |   | |       +-when_clauses=
-  |       |   | |         +-SearchedWhenClause
-  |       |   | |           +-condition_predicate=Less
-  |       |   | |           | +-left_operand=AttributeReference[
-  |       |   | |           | | attribute_name=col1]
-  |       |   | |           | +-right_operand=AttributeReference[
-  |       |   | |           |   attribute_name=col3]
-  |       |   | |           +-result_expression=Literal
-  |       |   | |             +-NumericLiteral[numeric_string=0,float_like=false]
-  |       |   | +-result_expression=Literal
-  |       |   |   +-NumericLiteral[numeric_string=1,float_like=false]
-  |       |   +-SimpleWhenClause
-  |       |     +-condition_operand=AttributeReference[attribute_name=col3]
-  |       |     +-result_expression=Literal
-  |       |       +-NumericLiteral[numeric_string=2,float_like=false]
-  |       +-right_operand=AttributeReference[attribute_name=col4]
-  +-from_clause=
-    +-TableReference[table=test]
-==
-
-# IN predicate
-SELECT *
-FROM test
-WHERE col1 IN (1, 3, 5);
---
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectStar
-  +-where_clause=InValueList
-  | +-test_expression=AttributeReference[attribute_name=col1]
-  | +-value_list=
-  |   +-Literal
-  |   | +-NumericLiteral[numeric_string=1,float_like=false]
-  |   +-Literal
-  |   | +-NumericLiteral[numeric_string=3,float_like=false]
-  |   +-Literal
-  |     +-NumericLiteral[numeric_string=5,float_like=false]
-  +-from_clause=
-    +-TableReference[table=test]
-==
-
-SELECT *
-FROM test
-WHERE col1 IN (FUN(1),
-               col2+col3,
-               CASE WHEN col4 > 0 THEN col5 ELSE col6 END);
---
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectStar
-  +-where_clause=InValueList
-  | +-test_expression=AttributeReference[attribute_name=col1]
-  | +-value_list=
-  |   +-FunctionCall[name=FUN]
-  |   | +-Literal
-  |   |   +-NumericLiteral[numeric_string=1,float_like=false]
-  |   +-Add
-  |   | +-left_operand=AttributeReference[attribute_name=col2]
-  |   | +-right_operand=AttributeReference[attribute_name=col3]
-  |   +-SearchedCaseExpression
-  |     +-else_result_expression=AttributeReference[attribute_name=col6]
-  |     +-when_clauses=
-  |       +-SearchedWhenClause
-  |         +-condition_predicate=Greater
-  |         | +-left_operand=AttributeReference[attribute_name=col4]
-  |         | +-right_operand=Literal
-  |         |   +-NumericLiteral[numeric_string=0,float_like=false]
-  |         +-result_expression=AttributeReference[attribute_name=col5]
-  +-from_clause=
-    +-TableReference[table=test]
-==
-
-SELECT *
-FROM test
-WHERE col1 NOT IN (col1, col2 + col3);
---
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectStar
-  +-where_clause=Not
-  | +-InValueList
-  |   +-test_expression=AttributeReference[attribute_name=col1]
-  |   +-value_list=
-  |     +-AttributeReference[attribute_name=col1]
-  |     +-Add
-  |       +-left_operand=AttributeReference[attribute_name=col2]
-  |       +-right_operand=AttributeReference[attribute_name=col3]
-  +-from_clause=
-    +-TableReference[table=test]
-==
-
-SELECT *
-FROM test
-WHERE col1 IN (
-  SELECT SUM(col2+col3)
-  FROM bar
-  GROUP BY col4
-);
---
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectStar
-  +-where_clause=InTableQuery
-  | +-test_expression=AttributeReference[attribute_name=col1]
-  | +-table_query=SubqueryExpression
-  |   +-Select
-  |     +-select_clause=SelectList
-  |     | +-SelectListItem
-  |     |   +-FunctionCall[name=SUM]
-  |     |     +-Add
-  |     |       +-left_operand=AttributeReference[attribute_name=col2]
-  |     |       +-right_operand=AttributeReference[attribute_name=col3]
-  |     +-group_by=GroupBy
-  |     | +-AttributeReference[attribute_name=col4]
-  |     +-from_clause=
-  |       +-TableReference[table=bar]
-  +-from_clause=
-    +-TableReference[table=test]
-==
-
-SELECT *
-FROM test
-WHERE col1 NOT IN (
-  SELECT col2
-  FROM bar
-  WHERE col3 IN (col4, col5)
-);
---
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectStar
-  +-where_clause=Not
-  | +-InTableQuery
-  |   +-test_expression=AttributeReference[attribute_name=col1]
-  |   +-table_query=SubqueryExpression
-  |     +-Select
-  |       +-select_clause=SelectList
-  |       | +-SelectListItem
-  |       |   +-AttributeReference[attribute_name=col2]
-  |       +-where_clause=InValueList
-  |       | +-test_expression=AttributeReference[attribute_name=col3]
-  |       | +-value_list=
-  |       |   +-AttributeReference[attribute_name=col4]
-  |       |   +-AttributeReference[attribute_name=col5]
-  |       +-from_clause=
-  |         +-TableReference[table=bar]
-  +-from_clause=
-    +-TableReference[table=test]
-==
-
-SELECT avg(attr1) OVER w FROM test
-WINDOW w AS
-(PARTITION BY attr2, attr3
- ORDER BY attr4
- ROWS BETWEEN 3 PRECEDING AND 3 FOLLOWING)
---
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectList
-  | +-SelectListItem
-  |   +-FunctionCall[name=avg,window_name=w]
-  |     +-AttributeReference[attribute_name=attr1]
-  +-from_clause=
-  | +-TableReference[table=test]
-  +-window_list=
-    +-window[window_name=w]
-      +-frame_info=FrameInfo[frame_mode=row,num_preceding=3,num_following=3]
-      +-partition_by=
-      | +-AttributeReference[attribute_name=attr2]
-      | +-AttributeReference[attribute_name=attr3]
-      +-order_by=
-        +-OrderByItem[is_asc=true,nulls_first=false]
-          +-AttributeReference[attribute_name=attr4]
-==
-
-SELECT avg(attr1) OVER w FROM test
-WINDOW w AS
-(PARTITION BY attr2, attr3
- ORDER BY attr4 DESC NULLS FIRST, attr5 ASC NULLS LAST
- RANGE BETWEEN 3 PRECEDING AND CURRENT ROW)
---
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectList
-  | +-SelectListItem
-  |   +-FunctionCall[name=avg,window_name=w]
-  |     +-AttributeReference[attribute_name=attr1]
-  +-from_clause=
-  | +-TableReference[table=test]
-  +-window_list=
-    +-window[window_name=w]
-      +-frame_info=FrameInfo[frame_mode=range,num_preceding=3,num_following=0]
-      +-partition_by=
-      | +-AttributeReference[attribute_name=attr2]
-      | +-AttributeReference[attribute_name=attr3]
-      +-order_by=
-        +-OrderByItem[is_asc=false,nulls_first=true]
-        | +-AttributeReference[attribute_name=attr4]
-        +-OrderByItem[is_asc=true,nulls_first=false]
-          +-AttributeReference[attribute_name=attr5]
-==
-
-SELECT avg(attr1) OVER w1 AS avg1, sum(attr5) OVER w2 AS sum5 FROM test
-WINDOW w1 AS
-(PARTITION BY attr2, attr3
- ORDER BY attr4
- ROWS BETWEEN 3 PRECEDING AND 3 FOLLOWING)
-WINDOW w2 AS
-(PARTITION BY attr1
- ORDER BY attr6
- RANGE BETWEEN 2 PRECEDING AND CURRENT ROW)
---
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectList
-  | +-SelectListItem[alias=avg1]
-  | | +-FunctionCall[name=avg,window_name=w1]
-  | |   +-AttributeReference[attribute_name=attr1]
-  | +-SelectListItem[alias=sum5]
-  |   +-FunctionCall[name=sum,window_name=w2]
-  |     +-AttributeReference[attribute_name=attr5]
-  +-from_clause=
-  | +-TableReference[table=test]
-  +-window_list=
-    +-window[window_name=w1]
-    | +-frame_info=FrameInfo[frame_mode=row,num_preceding=3,num_following=3]
-    | +-partition_by=
-    | | +-AttributeReference[attribute_name=attr2]
-    | | +-AttributeReference[attribute_name=attr3]
-    | +-order_by=
-    |   +-OrderByItem[is_asc=true,nulls_first=false]
-    |     +-AttributeReference[attribute_name=attr4]
-    +-window[window_name=w2]
-      +-frame_info=FrameInfo[frame_mode=range,num_preceding=2,num_following=0]
-      +-partition_by=
-      | +-AttributeReference[attribute_name=attr1]
-      +-order_by=
-        +-OrderByItem[is_asc=true,nulls_first=false]
-          +-AttributeReference[attribute_name=attr6]
-==
-
-SELECT avg(attr1) OVER
-(PARTITION BY attr2, attr3
- ORDER BY attr4 DESC NULLS FIRST, attr5 ASC NULLS LAST
- RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW)
-FROM test
---
-SelectStatement
-+-select_query=Select
-  +-select_clause=SelectList
-  | +-SelectListItem
-  |   +-FunctionCall[name=avg]
-  |     +-AttributeReference[attribute_name=attr1]
-  |     +-window=window
-  |       +-frame_info=FrameInfo[frame_mode=range,num_preceding=-1,
-  |       | num_following=0]
-  |       +-partition_by=
-  |       | +-AttributeReference[attribute_name=attr2]
-  |       | +-AttributeReference[attribute_name=attr3]
-  |       +-order_by=
-  |         +-OrderByItem[is_asc=false,nulls_first=true]
-  |         | +-AttributeReference[attribute_name=attr4]
-  |         +-OrderByItem[is_asc=true,nulls_first=false]
-  |           +-AttributeReference[attribute_name=attr5]
-  +-from_clause=
-    +-TableReference[table=test]


[47/51] [abbrv] [partial] incubator-quickstep git commit: remove c++ files

Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/catalog/CatalogDatabase.hpp
----------------------------------------------------------------------
diff --git a/catalog/CatalogDatabase.hpp b/catalog/CatalogDatabase.hpp
deleted file mode 100644
index a0804a2..0000000
--- a/catalog/CatalogDatabase.hpp
+++ /dev/null
@@ -1,468 +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_CATALOG_CATALOG_DATABASE_HPP_
-#define QUICKSTEP_CATALOG_CATALOG_DATABASE_HPP_
-
-#include <exception>
-#include <string>
-#include <unordered_map>
-
-#include "catalog/Catalog.pb.h"
-#include "catalog/CatalogDatabaseLite.hpp"
-#include "catalog/CatalogRelation.hpp"
-#include "catalog/CatalogTypedefs.hpp"
-#include "storage/StorageConstants.hpp"
-#include "threading/Mutex.hpp"
-#include "threading/SharedMutex.hpp"
-#include "threading/SpinSharedMutex.hpp"
-#include "utility/Macros.hpp"
-#include "utility/PtrVector.hpp"
-#include "utility/StringUtil.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-class Catalog;
-class CatalogRelationSchema;
-
-/** \addtogroup Catalog
- *  @{
- */
-
-/**
- * @brief Exception thrown for a relation name collision.
- **/
-class RelationNameCollision : public std::exception {
- public:
-  /**
-   * @brief Constructor.
-   *
-   * @param db_name Name of the database in which the collision occurred.
-   * @param rel_name Name of the relation for which there was a collision.
-   **/
-  RelationNameCollision(const std::string &db_name, const std::string &rel_name)
-      : message_("RelationNameCollision: database ") {
-    message_.append(db_name);
-    message_.append(" already has a relation ");
-    message_.append(rel_name);
-  }
-
-  ~RelationNameCollision() throw() {
-  }
-
-  virtual const char* what() const throw() {
-    return message_.c_str();
-  }
-
- private:
-  std::string message_;
-};
-
-/**
- * @brief Exception thrown when a relation with the specified name can't be
- *        found.
- **/
-class RelationNameNotFound : public std::exception {
- public:
-  /**
-   * @brief Constructor.
-   *
-   * @param db_name Name of the database in which the exception occurred.
-   * @param rel_name The relation name which could not be found.
-   **/
-  RelationNameNotFound(const std::string &db_name, const std::string &rel_name)
-      : message_("RelationNameNotFound: database ") {
-    message_.append(db_name);
-    message_.append(" has no relation named ");
-    message_.append(rel_name);
-  }
-
-  ~RelationNameNotFound() throw() {
-  }
-
-  virtual const char* what() const throw() {
-    return message_.c_str();
-  }
-
- private:
-  std::string message_;
-};
-
-/**
- * @brief Exception thrown when a relation with the specified ID can't be found.
- **/
-class RelationIdNotFound : public std::exception {
- public:
-  /**
-   * @brief Constructor
-   *
-   * @param db_name Name of the database in which the exception occurred.
-   * @param id The relation ID which could not be found.
-   **/
-  RelationIdNotFound(const std::string &db_name, const relation_id id)
-      : message_("RelationIdNotFound: database ") {
-    message_.append(db_name);
-    message_.append(" has no relation with ID ");
-    message_.append(std::to_string(id));
-  }
-
-  ~RelationIdNotFound() throw() {
-  }
-
-  virtual const char* what() const throw() {
-    return message_.c_str();
-  }
-
- private:
-  std::string message_;
-};
-
-/**
- * @brief A single database in the catalog.
- **/
-class CatalogDatabase : public CatalogDatabaseLite {
- public:
-  typedef std::unordered_map<std::string, CatalogRelation*>::size_type size_type;
-  typedef PtrVector<CatalogRelation, true>::const_skip_iterator const_iterator;
-
-  enum class Status {
-    kConsistent = 0,
-    kPendingBlockDeletions
-  };
-
-  /**
-   * @brief Create a new database.
-   *
-   * @param parent The catalog this database belongs to.
-   * @param name This database's name.
-   * @param id This database's ID (defaults to -1, which means invalid/unset).
-   **/
-  CatalogDatabase(Catalog *parent, const std::string &name, const database_id id = -1)
-      : CatalogDatabaseLite(id),
-        parent_(parent),
-        name_(name),
-        status_(Status::kConsistent) {
-  }
-
-  /**
-   * @brief Reconstruct a database from its serialized Protocol Buffer form.
-   *
-   * @param proto The Protocol Buffer serialization of a database, previously
-   *        produced by getProto().
-   **/
-  explicit CatalogDatabase(const serialization::CatalogDatabase &proto);
-
-  /**
-   * @brief Check whether a serialization::CatalogDatabase is fully-formed and
-   *        all parts are valid.
-   *
-   * @param proto A serialized Protocol Buffer representation of a CatalogDatabase,
-   *        originally generated by getProto().
-   * @return Whether proto is fully-formed and valid.
-   **/
-  static bool ProtoIsValid(const serialization::CatalogDatabase &proto);
-
-  /**
-   * @brief Destructor which recursively destroys children.
-   **/
-  ~CatalogDatabase() override {
-  }
-
-  bool hasRelationWithId(const relation_id id) const override {
-    SpinSharedMutexSharedLock<false> lock(relations_mutex_);
-    return hasRelationWithIdUnsafe(id);
-  }
-
-  const CatalogRelationSchema& getRelationSchemaById(const relation_id id) const override {
-    SpinSharedMutexSharedLock<false> lock(relations_mutex_);
-    DCHECK(hasRelationWithIdUnsafe(id));
-    return rel_vec_[id];
-  }
-
-  /**
-   * @exception RelationIdNotFound No relation with the given ID exists.
-   **/
-  void dropRelationById(const relation_id id) override;
-
-  /**
-   * @brief Get the parent catalog.
-   *
-   * @return Parent catalog.
-   **/
-  const Catalog& getParent() const {
-    return *DCHECK_NOTNULL(parent_);
-  }
-
-  /**
-   * @brief Get a mutable pointer to the parent catalog.
-   *
-   * @return Parent catalog.
-   **/
-  Catalog* getParentMutable() {
-    return parent_;
-  }
-
-  /**
-   * @brief Get this database's name.
-   *
-   * @return This database's name.
-   **/
-  const std::string& getName() const {
-    return name_;
-  }
-
-  /**
-   * @brief Get this database's status.
-   *
-   * @return This database's status.
-   **/
-  Status status() const {
-    SpinSharedMutexSharedLock<false> lock(status_mutex_);
-    return status_;
-  }
-
-  /**
-   * @brief Whether this database is consistent.
-   *
-   * @return True if it is consistent. Otherwise, false.
-   **/
-  bool isStatusConsistent() const {
-    SpinSharedMutexSharedLock<false> lock(status_mutex_);
-    return status_ == Status::kConsistent;
-  }
-
-  /**
-   * @brief Set this database's status.
-   *
-   * @param status The status to set.
-   **/
-  void setStatus(const Status status) {
-    SpinSharedMutexExclusiveLock<false> lock(status_mutex_);
-    status_ = status;
-  }
-
-  /**
-   * @brief Check whether a relation with the given name exists. The search is case-insensitive.
-   *
-   * @param rel_name The name to check for.
-   * @return Whether the relation exists.
-   **/
-  bool hasRelationWithName(const std::string &rel_name) const {
-    SpinSharedMutexSharedLock<false> lock(relations_mutex_);
-    return hasRelationWithNameUnsafe(rel_name);
-  }
-
-  /**
-   * @brief Get a relation by name. The search is case-insensitive.
-   *
-   * @param rel_name The name to search for.
-   * @return The relation with the given name. NULL if the relation is not found.
-   **/
-  const CatalogRelation* getRelationByName(const std::string &rel_name) const;
-
-  /**
-   * @brief Get a mutable pointer to a relation by name. The search is case-insensitive.
-   *
-   * @param rel_name The name to search for.
-   * @return The relation with the given name. NULL if the relation is not found.
-   **/
-  CatalogRelation* getRelationByNameMutable(const std::string &rel_name);
-
-  /**
-   * @brief Get a relation by ID.
-   *
-   * @param id The id to search for.
-   * @return The relation with the given ID.
-   **/
-  const CatalogRelation* getRelationById(const relation_id id) const {
-    SpinSharedMutexSharedLock<false> lock(relations_mutex_);
-    if (hasRelationWithIdUnsafe(id)) {
-      return &rel_vec_[id];
-    } else {
-      return nullptr;
-    }
-  }
-
-  /**
-   * @brief Get a mutable pointer to a relation by ID.
-   *
-   * @param id The id to search for.
-   * @return The relation with the given ID.
-   **/
-  CatalogRelation* getRelationByIdMutable(const relation_id id) {
-    SpinSharedMutexSharedLock<false> lock(relations_mutex_);
-    if (hasRelationWithIdUnsafe(id)) {
-      return &(rel_vec_[id]);
-    } else {
-      return nullptr;
-    }
-  }
-
-  /**
-   * @brief Add a new relation to the database. If the relation already has an
-   *        ID and/or parent, it will be overwritten.
-   *
-   * @param new_rel The relation to be added.
-   * @exception RelationNameCollision A relation with the same name as new_rel
-   *            is already present in the database.
-   * @return The id assigned to the relation.
-   **/
-  relation_id addRelation(CatalogRelation *new_rel);
-
-  /**
-   * @brief Drop (delete) a relation by name.
-   *
-   * @param rel_name The name of the relation to drop.
-   * @exception RelationNameNotFound No relation with the given name exists.
-   **/
-  void dropRelationByName(const std::string &rel_name);
-
-  /**
-   * @brief Serialize the database as Protocol Buffer.
-   *
-   * @return The Protocol Buffer representation of the database.
-   **/
-  serialization::CatalogDatabase getProto() const;
-
-  /**
-   * @brief Get the number of child relations.
-   *
-   * @return The number of child relations.
-   **/
-  size_type size() const {
-    SpinSharedMutexSharedLock<false> lock(relations_mutex_);
-    return rel_map_.size();
-  }
-
-  /**
-   * @brief Get an iterator at the beginning of the child relations.
-   *
-   * @return An iterator on the first child relation.
-   **/
-  const_iterator begin() const {
-    SpinSharedMutexSharedLock<false> lock(relations_mutex_);
-    return rel_vec_.begin_skip();
-  }
-
-  /**
-   * @brief Get an iterator at one-past-the-end of the child relations.
-   *
-   * @return An iterator one-past-the-end of the child relations.
-   **/
-  const_iterator end() const {
-    SpinSharedMutexSharedLock<false> lock(relations_mutex_);
-    return rel_vec_.end_skip();
-  }
-
- private:
-  /**
-   * @brief Set the parent Catalog of this database. Used by Catalog (a friend
-   *        of this class) when adding a new database.
-   *
-   * @param parent The new parent for this CatalogDatabase.
-   **/
-  void setParent(Catalog *parent) {
-    parent_ = parent;
-  }
-
-  /**
-   * @brief Set the ID of this database. Used by Catalog (a friend of this
-   *        class) when adding a new database.
-   *
-   * @param id The new ID for this CatalogDatabase.
-   **/
-  void setID(const database_id id) {
-    id_ = id;
-  }
-
-  /**
-   * @brief Check whether a relation_id is within the range of IDs contained
-   *        in this CatalogDatabase.
-   *
-   * @param id The id to check.
-   * @return true if id is in range, false otherwise.
-   *
-   * @note The caller of this function should make it sure that it holds at
-   *       least a shared lock before calling this function.
-   *
-   **/
-  bool idInRange(const relation_id id) const {
-    return ((id >= 0)
-            && (static_cast<PtrVector<CatalogRelation>::size_type>(id) < rel_vec_.size()));
-  }
-
-  /**
-   * @brief Check whether a relation with the given name exists. The search is case-insensitive.
-   *
-   * @note This method assumes that the caller has already acquired the
-   *       necessary locks before invoking it.
-   *
-   * @param rel_name The name to check for.
-   * @return Whether the relation exists.
-   **/
-  inline bool hasRelationWithNameUnsafe(const std::string &rel_name) const {
-    return (rel_map_.find(ToLower(rel_name)) != rel_map_.end());
-  }
-
-  /**
-   * @brief Check whether a relation with the given id exists.
-   *
-   * @note This method assumes that the caller has already acquired the
-   *       necessary locks before invoking it.
-   *
-   * @param id The id to check for.
-   * @return Whether the relation exists.
-   **/
-  inline bool hasRelationWithIdUnsafe(const relation_id id) const {
-    return (idInRange(id) && !rel_vec_.elementIsNull(id));
-  }
-
-  Catalog *parent_;
-
-  // The database name.
-  const std::string name_;
-
-  // Indicate the status of this database (i.e., consistent or not).
-  Status status_;
-  alignas(kCacheLineBytes) mutable SpinSharedMutex<false> status_mutex_;
-
-  // A vector of relations. NULL if the relation has dropped from the database.
-  PtrVector<CatalogRelation, true> rel_vec_;
-
-  /**
-   * @brief Map from relation name to the pointer to the corresponding relation.
-   *        The relation name stored in the map is in lowercase characters.
-   */
-  std::unordered_map<std::string, CatalogRelation*> rel_map_;
-
-  // Concurrency protection for 'rel_vec_' and 'rel_map_'.
-  alignas(kCacheLineBytes) mutable SpinSharedMutex<false> relations_mutex_;
-
-  friend class Catalog;
-
-  DISALLOW_COPY_AND_ASSIGN(CatalogDatabase);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_CATALOG_CATALOG_DATABASE_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/catalog/CatalogDatabaseCache.cpp
----------------------------------------------------------------------
diff --git a/catalog/CatalogDatabaseCache.cpp b/catalog/CatalogDatabaseCache.cpp
deleted file mode 100644
index 7f7c495..0000000
--- a/catalog/CatalogDatabaseCache.cpp
+++ /dev/null
@@ -1,107 +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 "catalog/CatalogDatabaseCache.hpp"
-
-#include <memory>
-#include <unordered_map>
-#include <utility>
-#include <vector>
-
-#include "catalog/Catalog.pb.h"
-#include "catalog/CatalogRelationSchema.hpp"
-#include "catalog/CatalogTypedefs.hpp"
-#include "threading/Mutex.hpp"
-#include "threading/SpinSharedMutex.hpp"
-
-#include "glog/logging.h"
-
-using std::make_unique;
-using std::move;
-using std::vector;
-
-namespace quickstep {
-
-bool CatalogDatabaseCache::ProtoIsValid(const serialization::CatalogDatabase &proto) {
-  for (int i = 0; i < proto.relations_size(); ++i) {
-    if (!CatalogRelationSchema::ProtoIsValid(proto.relations(i))) {
-      return false;
-    }
-  }
-
-  return proto.null_relations_size() == 0;
-}
-
-CatalogDatabaseCache::CatalogDatabaseCache(const serialization::CatalogDatabase &proto) {
-  DCHECK(ProtoIsValid(proto))
-      << "Attempted to create CatalogDatabaseCache from an invalid proto description:\n"
-      << proto.DebugString();
-
-  for (int i = 0; i < proto.relations_size(); ++i) {
-    auto relation_schema = make_unique<const CatalogRelationSchema>(proto.relations(i));
-    rel_map_.emplace(relation_schema->getID(), move(relation_schema));
-  }
-}
-
-void CatalogDatabaseCache::update(const serialization::CatalogDatabase &proto) {
-  DCHECK(ProtoIsValid(proto))
-      << "Attempted to create CatalogDatabaseCache from an invalid proto description:\n"
-      << proto.DebugString();
-
-  vector<int> new_relation_schema_proto_indices;
-  {
-    SpinSharedMutexSharedLock<false> read_lock(relations_mutex_);
-    for (int i = 0; i < proto.relations_size(); ++i) {
-      const auto it = rel_map_.find(proto.relations(i).relation_id());
-      if (it == rel_map_.end()) {
-        new_relation_schema_proto_indices.push_back(i);
-      } else {
-        // TODO(quickstep-team): Support schema changes by adding the index of
-        // changed schema proto in 'changed_relation_schema_proto_indices'.
-      }
-    }
-  }
-
-  SpinSharedMutexExclusiveLock<false> write_lock(relations_mutex_);
-  for (const int i : new_relation_schema_proto_indices) {
-    const serialization::CatalogRelationSchema &proto_relation = proto.relations(i);
-    auto relation_schema = make_unique<const CatalogRelationSchema>(proto_relation);
-    rel_map_.emplace(proto_relation.relation_id(), move(relation_schema));
-  }
-
-  // TODO(quickstep-team): Reset the schema for the changes in the following
-  // steps for each index in 'changed_relation_schema_proto_indices':
-  // 1. Drop the blocks belonged to 'proto.relations(i).relation_id()' in the
-  //    buffer pool.
-  // 2. Reset the changed schema, while the scheduler ensures no queries will
-  //    load back the related blocks.
-  // 3. Signal the scheduler to accept new queries for the changed schema.
-}
-
-void CatalogDatabaseCache::dropRelationById(const relation_id id) {
-  SpinSharedMutexExclusiveLock<false> lock(relations_mutex_);
-  auto it = rel_map_.find(id);
-  if (it != rel_map_.end()) {
-    rel_map_.erase(it);
-  } else {
-    LOG(ERROR) << "Dropping a non-exist relation schema by id " << id;
-  }
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/catalog/CatalogDatabaseCache.hpp
----------------------------------------------------------------------
diff --git a/catalog/CatalogDatabaseCache.hpp b/catalog/CatalogDatabaseCache.hpp
deleted file mode 100644
index 88ca61d..0000000
--- a/catalog/CatalogDatabaseCache.hpp
+++ /dev/null
@@ -1,139 +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_CATALOG_CATALOG_DATABASE_CACHE_HPP_
-#define QUICKSTEP_CATALOG_CATALOG_DATABASE_CACHE_HPP_
-
-#include <cstddef>
-#include <memory>
-#include <unordered_map>
-#include <utility>
-
-#include "catalog/CatalogDatabaseLite.hpp"
-#include "catalog/CatalogTypedefs.hpp"
-#include "storage/StorageConstants.hpp"
-#include "threading/SharedMutex.hpp"
-#include "threading/SpinSharedMutex.hpp"
-#include "utility/Macros.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-class CatalogRelationSchema;
-
-namespace serialization { class CatalogDatabase; }
-
-/** \addtogroup Catalog
- *  @{
- */
-
-/**
- * @brief A database cache managed by Shiftboss in the distributed version.
- *        During the runtime, it contains all the referenced relation schemas
- *        to execute a query. For a SELECT query, the temporary query
- *        result relation will be dropped after the CLI finishes processing the
- *        result and notifies Shiftboss.
- *
- * @note A CatalogRelationSchema should be kept unless all associated blocks
- *       have been deleted.
- **/
-class CatalogDatabaseCache : public CatalogDatabaseLite {
- public:
-  /**
-   * @brief Constructor.
-   **/
-  CatalogDatabaseCache() {}
-
-  /**
-   * @brief Constructor. Reconstruct a database cache from its serialized
-   *        Protocol Buffer form.
-   *
-   * @param proto The Protocol Buffer serialization of a database, previously
-   *        produced by the optimizer.
-   **/
-  explicit CatalogDatabaseCache(const serialization::CatalogDatabase &proto);
-
-  /**
-   * @brief Destructor which recursively destroys children.
-   **/
-  ~CatalogDatabaseCache() override {
-  }
-
-  bool hasRelationWithId(const relation_id id) const override {
-    SpinSharedMutexSharedLock<false> lock(relations_mutex_);
-    return rel_map_.find(id) != rel_map_.end();
-  }
-
-  const CatalogRelationSchema& getRelationSchemaById(const relation_id id) const override {
-    SpinSharedMutexSharedLock<false> lock(relations_mutex_);
-    const auto cit = rel_map_.find(id);
-
-    DCHECK(cit != rel_map_.end());
-    return *(cit->second);
-  }
-
-  void dropRelationById(const relation_id id) override;
-
-  /**
-   * @brief Get the number of child relations.
-   *
-   * @return The number of child relations.
-   **/
-  std::size_t size() const {
-    SpinSharedMutexSharedLock<false> lock(relations_mutex_);
-    return rel_map_.size();
-  }
-
-  /**
-   * @brief Update the cache from its serialized Protocol Buffer form. If the
-   *        relation schema exists, it will be ignored.
-   *
-   * @param proto The Protocol Buffer serialization of a catalog cache,
-   *        previously produced in optimizer.
-   **/
-  void update(const serialization::CatalogDatabase &proto);
-
- private:
-  /**
-   * @brief Check whether a serialization::CatalogDatabase is fully-formed and
-   *        all parts are valid.
-   *
-   * @param proto A serialized Protocol Buffer representation of a CatalogDatabase,
-   *        originally generated by the optimizer.
-   * @return Whether proto is fully-formed and valid.
-   **/
-  static bool ProtoIsValid(const serialization::CatalogDatabase &proto);
-
-  /**
-   * @brief Map from relation id to the pointer to the corresponding relation schema.
-   */
-  std::unordered_map<relation_id, std::unique_ptr<const CatalogRelationSchema>> rel_map_;
-
-  // Concurrency protection for 'rel_map_'.
-  alignas(kCacheLineBytes) mutable SpinSharedMutex<false> relations_mutex_;
-
-  DISALLOW_COPY_AND_ASSIGN(CatalogDatabaseCache);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_CATALOG_CATALOG_DATABASE_CACHE_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/catalog/CatalogDatabaseLite.hpp
----------------------------------------------------------------------
diff --git a/catalog/CatalogDatabaseLite.hpp b/catalog/CatalogDatabaseLite.hpp
deleted file mode 100644
index 0c846a0..0000000
--- a/catalog/CatalogDatabaseLite.hpp
+++ /dev/null
@@ -1,104 +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_CATALOG_CATALOG_DATABASE_LITE_HPP_
-#define QUICKSTEP_CATALOG_CATALOG_DATABASE_LITE_HPP_
-
-#include "catalog/CatalogTypedefs.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-
-class CatalogRelationSchema;
-
-/** \addtogroup Catalog
- *  @{
- */
-
-/**
- * @brief A base class that the catalog database implements for both the master
- *        Catalog, and the CatalogCache in the distributed version.
- *
- * @note This class only contains virtual methods related to the relation id and
- *       CatalogRelationSchema.
- **/
-class CatalogDatabaseLite {
- public:
-  /**
-   * @brief Virtual destructor which recursively destroys children.
-   **/
-  virtual ~CatalogDatabaseLite() {
-  }
-
-  /**
-   * @brief Get this database's ID.
-   *
-   * @return This database's ID.
-   **/
-  database_id getID() const {
-    return id_;
-  }
-
-  /**
-   * @brief Check whether a relation with the given id exists.
-   *
-   * @param id The id to check for.
-   * @return Whether the relation exists.
-   **/
-  virtual bool hasRelationWithId(const relation_id id) const = 0;
-
-  /**
-   * @brief Get a relation schema by ID.
-   *
-   * @param id The id to search for.
-   * @return The relation schema with the given ID.
-   **/
-  virtual const CatalogRelationSchema& getRelationSchemaById(const relation_id id) const = 0;
-
-  /**
-   * @brief Drop (delete) a relation by id.
-   *
-   * @param id The ID of the relation to drop.
-   **/
-  virtual void dropRelationById(const relation_id id) = 0;
-
- protected:
-  /**
-   * @brief Create a new database.
-   *
-   * @param parent The catalog this database belongs to.
-   * @param name This database's name.
-   * @param id This database's ID (defaults to -1, which means invalid/unset).
-   **/
-  explicit CatalogDatabaseLite(const database_id id = -1)
-      : id_(id) {
-  }
-
-  // The database id in Catalog.
-  database_id id_;
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(CatalogDatabaseLite);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_CATALOG_CATALOG_DATABASE_LITE_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/catalog/CatalogErrors.hpp
----------------------------------------------------------------------
diff --git a/catalog/CatalogErrors.hpp b/catalog/CatalogErrors.hpp
deleted file mode 100644
index b156daa..0000000
--- a/catalog/CatalogErrors.hpp
+++ /dev/null
@@ -1,54 +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_CATALOG_CATALOG_ERRORS_HPP_
-#define QUICKSTEP_CATALOG_CATALOG_ERRORS_HPP_
-
-#include <exception>
-#include <string>
-
-namespace quickstep {
-
-/** \addtogroup Catalog
- *  @{
- */
-
-class CatalogIDOverflow : public std::exception {
- public:
-  explicit CatalogIDOverflow(const std::string &item_type)
-      : message_("CatalogIDOverflow: Exceeded the maximum number of ") {
-    message_.append(item_type);
-    message_.append("s in catalog.");
-  }
-
-  ~CatalogIDOverflow() throw() {}
-
-  virtual const char* what() const throw() {
-    return message_.c_str();
-  }
-
- private:
-  std::string message_;
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_CATALOG_CATALOG_ERRORS_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/catalog/CatalogModule.hpp
----------------------------------------------------------------------
diff --git a/catalog/CatalogModule.hpp b/catalog/CatalogModule.hpp
deleted file mode 100644
index e1ae851..0000000
--- a/catalog/CatalogModule.hpp
+++ /dev/null
@@ -1,25 +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 Catalog
- *
- * The database catalog, which contains information about all of the relations
- * in the database, their attributes, and the storage blocks which store their
- * data.
- **/

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/catalog/CatalogRelation.cpp
----------------------------------------------------------------------
diff --git a/catalog/CatalogRelation.cpp b/catalog/CatalogRelation.cpp
deleted file mode 100644
index c288532..0000000
--- a/catalog/CatalogRelation.cpp
+++ /dev/null
@@ -1,198 +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 "catalog/CatalogRelation.hpp"
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "catalog/Catalog.pb.h"
-#include "catalog/CatalogAttribute.hpp"
-#include "catalog/CatalogConfig.h"
-#include "catalog/CatalogRelationSchema.hpp"
-
-#ifdef QUICKSTEP_HAVE_LIBNUMA
-#include "catalog/NUMAPlacementScheme.hpp"
-#endif
-
-#include "catalog/PartitionScheme.hpp"
-#include "storage/StorageBlockInfo.hpp"
-#include "storage/StorageBlockLayout.hpp"
-#include "storage/StorageBlockLayout.pb.h"
-#include "threading/SpinSharedMutex.hpp"
-#include "utility/PtrVector.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-class Type;
-
-bool CatalogRelation::ProtoIsValid(const serialization::CatalogRelationSchema &proto) {
-  // Check that proto is fully initialized.
-  if (!CatalogRelationSchema::ProtoIsValid(proto) ||
-      !proto.HasExtension(serialization::CatalogRelation::default_layout)) {
-    return false;
-  }
-
-  // Check if the proto of the relation has a partition scheme.
-  if (proto.HasExtension(serialization::CatalogRelation::partition_scheme)) {
-    // Check if the partition scheme protobuf is valid.
-    if (!PartitionScheme::ProtoIsValid(
-            proto.GetExtension(serialization::CatalogRelation::partition_scheme))) {
-      return false;
-    }
-
-#ifdef QUICKSTEP_HAVE_LIBNUMA
-    // Check if the proto of the relation has a NUMA placement scheme.
-    if (proto.HasExtension(serialization::CatalogRelation::placement_scheme)) {
-      // Check if the NUMA placement scheme protobuf is valid.
-      if (!NUMAPlacementScheme::ProtoIsValid(
-              proto.GetExtension(serialization::CatalogRelation::placement_scheme))) {
-        return false;
-      }
-    }
-#endif
-  }
-
-  // Catalog Relation's proto is valid.
-  return true;
-}
-
-CatalogRelation::CatalogRelation(const serialization::CatalogRelationSchema &proto)
-    : CatalogRelationSchema(proto),
-      default_layout_(nullptr) {
-  DCHECK(ProtoIsValid(proto))
-      << "Attempted to create CatalogRelation from an invalid proto description:\n"
-      << proto.DebugString();
-
-  // Deserializing the partition scheme for the relation.
-  // This should be done after the attributes are added and before the
-  // blocks of the relation are added.
-  if (proto.HasExtension(serialization::CatalogRelation::partition_scheme)) {
-    const serialization::PartitionScheme &proto_partition_scheme =
-        proto.GetExtension(serialization::CatalogRelation::partition_scheme);
-
-    const attribute_id partition_attribute_id = proto_partition_scheme.header().partition_attribute_id();
-    DCHECK(hasAttributeWithId(partition_attribute_id));
-    const Type &attr_type = attr_vec_[partition_attribute_id].getType();
-
-    setPartitionScheme(PartitionScheme::ReconstructFromProto(proto_partition_scheme, attr_type));
-
-    // Deserializing the NUMA placement scheme for the relation.
-#ifdef QUICKSTEP_HAVE_LIBNUMA
-    if (proto.HasExtension(serialization::CatalogRelation::placement_scheme)) {
-      setNUMAPlacementScheme(
-          NUMAPlacementScheme::ReconstructFromProto(
-              proto.GetExtension(serialization::CatalogRelation::placement_scheme),
-              proto_partition_scheme.header().num_partitions()));
-    }
-#endif
-  }
-
-  const StorageBlockLayoutDescription &proto_default_layout =
-      proto.GetExtension(serialization::CatalogRelation::default_layout);
-  DCHECK(StorageBlockLayout::DescriptionIsValid(*this, proto_default_layout));
-
-  // Deserializing the index scheme defined for the relation, if any.
-  if (proto.HasExtension(serialization::CatalogRelation::index_scheme)) {
-    index_scheme_.reset(
-        IndexScheme::ReconstructFromProto(proto.GetExtension(serialization::CatalogRelation::index_scheme)));
-    // Ensure that indices present in the block layout are the same as in the index scheme.
-    const std::size_t num_indices_expected = index_scheme_->getNumIndices();
-    const std::size_t num_indices_checked = proto_default_layout.index_description_size();
-    DCHECK_EQ(num_indices_expected, num_indices_checked);
-    for (std::size_t i = 0; i < num_indices_checked; ++i) {
-      const IndexSubBlockDescription &description_checked = proto_default_layout.index_description(i);
-      DCHECK(index_scheme_->hasIndexWithDescription(description_checked))
-          << "Block layout defines some indices not present in the catalog";
-    }
-  }
-
-  // Deserializing the blocks of the relation.
-  for (int i = 0; i < proto.ExtensionSize(serialization::CatalogRelation::blocks); ++i) {
-    blocks_.emplace_back(static_cast<block_id>(proto.GetExtension(serialization::CatalogRelation::blocks, i)));
-  }
-
-  default_layout_.reset(new StorageBlockLayout(*this, proto_default_layout));
-
-  if (proto.HasExtension(serialization::CatalogRelation::statistics)) {
-    statistics_.reset(
-        new CatalogRelationStatistics(
-            proto.GetExtension(serialization::CatalogRelation::statistics)));
-  } else {
-    statistics_.reset(new CatalogRelationStatistics());
-  }
-}
-
-serialization::CatalogRelationSchema CatalogRelation::getProto() const {
-  serialization::CatalogRelationSchema proto = CatalogRelationSchema::getProto();
-
-  proto.MutableExtension(serialization::CatalogRelation::default_layout)
-      ->MergeFrom(getDefaultStorageBlockLayout().getDescription());
-
-  {
-    SpinSharedMutexSharedLock<false> lock(blocks_mutex_);
-    for (const block_id block : blocks_) {
-      proto.AddExtension(serialization::CatalogRelation::blocks, block);
-    }
-  }
-
-  if (hasIndexScheme()) {
-    proto.MutableExtension(serialization::CatalogRelation::index_scheme)->MergeFrom(index_scheme_->getProto());
-  }
-
-  // The partition scheme of the relation is stored in the protocol buffer format.
-  if (hasPartitionScheme()) {
-    proto.MutableExtension(serialization::CatalogRelation::partition_scheme)
-        ->MergeFrom(partition_scheme_->getProto());
-#ifdef QUICKSTEP_HAVE_LIBNUMA
-    if (hasNUMAPlacementScheme()) {
-      proto.MutableExtension(serialization::CatalogRelation::placement_scheme)
-          ->MergeFrom(placement_scheme_->getProto());
-    }
-#endif
-  }
-
-  proto.MutableExtension(serialization::CatalogRelation::statistics)
-      ->MergeFrom(statistics_->getProto());
-
-  return proto;
-}
-
-void CatalogRelation::setPartitionScheme(PartitionScheme* partition_scheme) {
-  DCHECK_EQ(0u, size_blocks());
-  partition_scheme_.reset(partition_scheme);
-}
-
-void CatalogRelation::setDefaultStorageBlockLayout(StorageBlockLayout *default_layout) {
-  DCHECK(&(default_layout->getRelation()) == this);
-  default_layout_.reset(default_layout);
-}
-
-const StorageBlockLayout& CatalogRelation::getDefaultStorageBlockLayout() const {
-  if (default_layout_ == nullptr) {
-    default_layout_.reset(StorageBlockLayout::GenerateDefaultLayout(*this, isVariableLength()));
-  }
-
-  return *default_layout_;
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/catalog/CatalogRelation.hpp
----------------------------------------------------------------------
diff --git a/catalog/CatalogRelation.hpp b/catalog/CatalogRelation.hpp
deleted file mode 100644
index c38e526..0000000
--- a/catalog/CatalogRelation.hpp
+++ /dev/null
@@ -1,438 +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_CATALOG_CATALOG_RELATION_HPP_
-#define QUICKSTEP_CATALOG_CATALOG_RELATION_HPP_
-
-#include <algorithm>
-#include <cstddef>
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "catalog/Catalog.pb.h"
-#include "catalog/CatalogConfig.h"
-#include "catalog/CatalogRelationSchema.hpp"
-#include "catalog/CatalogRelationStatistics.hpp"
-#include "catalog/CatalogTypedefs.hpp"
-#include "catalog/IndexScheme.hpp"
-
-#ifdef QUICKSTEP_HAVE_LIBNUMA
-#include "catalog/NUMAPlacementScheme.hpp"
-#endif  // QUICKSTEP_HAVE_LIBNUMA
-
-#include "catalog/PartitionScheme.hpp"
-#include "storage/StorageBlockInfo.hpp"
-#include "storage/StorageBlockLayout.hpp"
-#include "storage/StorageConstants.hpp"
-#include "threading/Mutex.hpp"
-#include "threading/SharedMutex.hpp"
-#include "threading/SpinSharedMutex.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-
-class CatalogDatabase;
-
-/** \addtogroup Catalog
- *  @{
- */
-
-/**
- * @brief A relation in a database. This augments the schema information in
- *        CatalogRelationSchema with information about physical StorageBlocks
- *        and their layouts.
- **/
-class CatalogRelation : public CatalogRelationSchema {
- public:
-  typedef CatalogRelationSchema::size_type size_type;
-  typedef CatalogRelationSchema::const_iterator const_iterator;
-
-  typedef std::vector<block_id>::size_type size_type_blocks;
-
-  /**
-   * @brief Create a new relation.
-   *
-   * @param parent The database this relation belongs to.
-   * @param name This relation's name.
-   * @param id This relation's ID (defaults to -1, which means invalid/unset).
-   * @param temporary Whether this relation is temporary (stores an
-   *        intermediate result during query processing).
-   **/
-  CatalogRelation(CatalogDatabase* parent,
-                  const std::string &name,
-                  const relation_id id = -1,
-                  bool temporary = false)
-      : CatalogRelationSchema(parent, name, id, temporary),
-        default_layout_(nullptr),
-        statistics_(new CatalogRelationStatistics()) {
-  }
-
-  /**
-   * @brief Reconstruct a relation from its serialized Protocol Buffer form.
-   *
-   * @param proto The Protocol Buffer serialization of a relation,
-   *        previously produced by getProto().
-   **/
-  explicit CatalogRelation(const serialization::CatalogRelationSchema &proto);
-
-  /**
-   * @brief Destructor which recursively destroys children.
-   **/
-  ~CatalogRelation() override {
-  }
-
-  serialization::CatalogRelationSchema getProto() const override;
-
-  /**
-   * @brief Check if a partition scheme is available for the relation.
-   *
-   * @return True if the relation has a partition scheme, false otherwise.
-   **/
-  bool hasPartitionScheme() const {
-    return partition_scheme_ != nullptr;
-  }
-
-  /**
-   * @brief Get the partition scheme of the catalog relation.
-   * @warning This is only safe if hasPartitionScheme() is true.
-   *
-   * @return A const reference to the partition scheme of the relation.
-   **/
-  const PartitionScheme& getPartitionScheme() const {
-    return *partition_scheme_;
-  }
-
-  /**
-   * @brief Set the partition scheme for the catalog relation.
-   * @warning This method should be called only once when a relation is
-   *          is first created.
-   *
-   * @param partition_scheme The partition scheme object for a relation, which
-   *        becomes owned by this relation.
-   **/
-  void setPartitionScheme(PartitionScheme* partition_scheme);
-
-  /**
-   * @brief Get a mutable partition scheme of the relation.
-   *
-   * @return A pointer to the partition scheme.
-   **/
-  PartitionScheme* getPartitionSchemeMutable() {
-    return partition_scheme_.get();
-  }
-
-  /**
-   * @brief Check if a NUMA placement scheme is available for the relation.
-   *
-   * @return True if the relation has a NUMA placement scheme, false otherwise.
-   **/
-  bool hasNUMAPlacementScheme() const {
-#ifdef QUICKSTEP_HAVE_LIBNUMA
-    return placement_scheme_ != nullptr;
-#else
-    return false;
-#endif  // QUICKSTEP_HAVE_LIBNUMA
-  }
-
-#ifdef QUICKSTEP_HAVE_LIBNUMA
-  /**
-   * @brief Get the NUMA placement scheme of the catalog relation.
-   * @warning This is only safe if hasNUMAPlacementScheme() is true.
-   *
-   * @return A const reference to the NUMA placement scheme of the relation.
-   **/
-  const NUMAPlacementScheme& getNUMAPlacementScheme() const {
-    return *placement_scheme_;
-  }
-
-  /**
-   * @brief Get a mutable NUMA placement scheme of the relation.
-   *
-   * @return A pointer to the NUMA placement scheme.
-   **/
-  NUMAPlacementScheme* getNUMAPlacementSchemeMutable() {
-    return placement_scheme_.get();
-  }
-
-  /**
-   * @brief Get the NUMA placement scheme of the relation.
-   *
-   * @return A pointer to a const NUMA placement scheme.
-   **/
-  const NUMAPlacementScheme* getNUMAPlacementSchemePtr() const {
-    return placement_scheme_.get();
-  }
-
-  /**
-   * @brief Set the NUMA placement scheme for the catalog relation.
-   *
-   * @param placement_scheme The NUMA placement scheme object for the relation,
-   *        which becomes owned by this relation.
-   **/
-  void setNUMAPlacementScheme(NUMAPlacementScheme *placement_scheme)  {
-    placement_scheme_.reset(placement_scheme);
-  }
-#endif  // QUICKSTEP_HAVE_LIBNUMA
-
-  /**
-   * @brief Check if an index scheme is available for the relation.
-   *
-   * @return True if the relation has a index scheme, false otherwise.
-   **/
-  bool hasIndexScheme() const {
-    return index_scheme_ != nullptr;
-  }
-
-  /**
-   * @brief Get the index scheme of the catalog relation.
-   * @warning This is only safe if hasIndexScheme() is true.
-   *
-   * @return A const reference to the index scheme of the relation.
-   **/
-  const IndexScheme& getIndexScheme() const {
-    return *index_scheme_;
-  }
-
-  /**
-   * @brief Get a mutable index scheme of the relation.
-   *
-   * @return A pointer to the index scheme.
-   **/
-  IndexScheme* getIndexSchemeMutable() {
-    return index_scheme_.get();
-  }
-
-  /**
-   * @brief Register a StorageBlock as belonging to this relation.
-   * @note Blocks are ordered in the same order they are added (preserving order
-   *       for full-table sorts).
-   *
-   * @param block the ID of the block to add.
-   **/
-  void addBlock(const block_id block) {
-    SpinSharedMutexExclusiveLock<false> lock(blocks_mutex_);
-    blocks_.emplace_back(block);
-  }
-
-  /**
-   * @brief Remove a StorageBlock from this relation (idempotent).
-   *
-   * @param block the ID of the block to remove.
-   **/
-  void removeBlock(const block_id block) {
-    SpinSharedMutexExclusiveLock<false> lock(blocks_mutex_);
-    std::vector<block_id>::iterator it = std::find(blocks_.begin(), blocks_.end(), block);
-    if (it != blocks_.end()) {
-      blocks_.erase(it);
-    }
-  }
-
-  /**
-   * @brief Remove all StorageBlocks from this relation.
-   **/
-  void clearBlocks() {
-    SpinSharedMutexExclusiveLock<false> lock(blocks_mutex_);
-    blocks_.clear();
-  }
-
-  /**
-   * @brief Check whether an index with the given exists or not.
-   *
-   * @param index_name Name of the index to be checked.
-   * @return Whether the index exists or not.
-   **/
-  bool hasIndexWithName(const std::string &index_name) const {
-    SpinSharedMutexSharedLock<false> lock(index_scheme_mutex_);
-    return index_scheme_ && index_scheme_->hasIndexWithName(index_name);
-  }
-
-  /**
-   * @brief Check whether an index with the given description
-   *        containing the same attribute id and index type
-   *        exists or not in the index map.
-   *
-   * @param index_descripton Index Description to check against.
-   * @return Whether a similar index description was already defined or not.
-   **/
-  bool hasIndexWithDescription(const IndexSubBlockDescription &index_description) const {
-    SpinSharedMutexSharedLock<false> lock(index_scheme_mutex_);
-    return index_scheme_ && index_scheme_->hasIndexWithDescription(index_description);
-  }
-
-  /**
-   * @brief Add an index to the index_map.
-   *
-   * @param index_name Name of the index to be added.
-   * @param index_description Corresponding description of the index.
-   * @return Whether the index was added successfully or not
-   **/
-  bool addIndex(const std::string &index_name,
-                IndexSubBlockDescription &&index_description) {  // NOLINT(whitespace/operators)
-    SpinSharedMutexExclusiveLock<false> lock(index_scheme_mutex_);
-    // Create an index_scheme, if it does not exist.
-    if (index_scheme_ == nullptr) {
-      index_scheme_.reset(new IndexScheme());
-    }
-
-    // Verify that index with the given name does not exist.
-    if (index_scheme_->hasIndexWithName(index_name)) {
-      return false;
-    }
-
-    // Verify that index with similar description does not exist.
-    if (index_scheme_->hasIndexWithDescription(index_description)) {
-      return false;
-    }
-
-    // Verify that the CatalogRelation has a valid layout.
-    // This check is also required for some unit tests on catalog.
-    if (default_layout_ == nullptr) {
-      // Calling this function initializes the default_layout_.
-      getDefaultStorageBlockLayout();
-    }
-
-    StorageBlockLayoutDescription *layout = default_layout_->getDescriptionMutable();
-    layout->add_index_description()->MergeFrom(index_description);
-    default_layout_->finalize();
-
-    // Update the index_scheme.
-    index_scheme_->addIndexMapEntry(index_name, std::move(index_description));
-
-    return true;  // Index added successfully, lock released.
-  }
-
-  /**
-   * @brief Check whether a serialization::CatalogRelation is fully-formed and
-   *        all parts are valid.
-   *
-   * @param proto A serialized Protocol Buffer representation of a relation,
-   *        originally generated by getProto().
-   * @return Whether proto is fully-formed and valid.
-   **/
-  static bool ProtoIsValid(const serialization::CatalogRelationSchema &proto);
-
-  /**
-   * @brief Get the number of child blocks.
-   *
-   * @return The number of child blocks.
-   **/
-  inline size_type_blocks size_blocks() const {
-    SpinSharedMutexSharedLock<false> lock(blocks_mutex_);
-    return blocks_.size();
-  }
-
-  /**
-   * @brief Get the current set of blocks belonging to this relation.
-   *
-   * @return The block_ids of blocks belonging to this relation at the moment
-   *         this method is called.
-   **/
-  inline std::vector<block_id> getBlocksSnapshot() const {
-    SpinSharedMutexSharedLock<false> lock(blocks_mutex_);
-    return std::vector<block_id>(blocks_.begin(), blocks_.end());
-  }
-
-  /**
-   * @brief Set the default StorageBlockLayout for this relation.
-   * @note Deletes the previous default layout, if any.
-   *
-   * @param default_layout The new default StorageBlockLayout for this
-   *        relation, which becomes owned by this relation.
-   **/
-  void setDefaultStorageBlockLayout(StorageBlockLayout *default_layout);
-
-  /**
-   * @brief Get this relation's default StorageBlockLayout.
-   * @note If no default has been set via setDefaultStorageBlockLayout(), then
-   *       one is created with StorageBlockLayout::generateDefaultLayout().
-   *
-   * @return The default StorageBlockLayout for this relation.
-   **/
-  const StorageBlockLayout& getDefaultStorageBlockLayout() const;
-
-  /**
-   * @brief Estimate the number of tuples in this relation.
-   * @warning This is currently implemented as a very dumb heuristic. Estimates
-   *          should be considered a rough "best guess" only.
-   *
-   * @return The estimated number of tuples in this relation.
-   **/
-  std::size_t estimateTupleCardinality() const {
-    return size_blocks()
-           * getDefaultStorageBlockLayout().estimateTuplesPerBlock();
-  }
-
-  /**
-   * @brief Get an immutable reference to the statistics of this catalog relation.
-   *
-   * @return A reference to the statistics of this catalog relation.
-   */
-  const CatalogRelationStatistics& getStatistics() const {
-    return *statistics_;
-  }
-
-  /**
-   * @brief Get a mutable pointer to the statistics of this catalog relation.
-   *
-   * @return A pointer to the statistics of this catalog relation.
-   */
-  CatalogRelationStatistics* getStatisticsMutable() {
-    return statistics_.get();
-  }
-
- private:
-  // A list of blocks belonged to the relation.
-  std::vector<block_id> blocks_;
-  // The mutex used to protect 'blocks_' from concurrent accesses.
-  mutable SpinSharedMutex<false> blocks_mutex_;
-
-  // The default layout for newly-created blocks.
-  mutable std::unique_ptr<StorageBlockLayout> default_layout_;
-
-  // Partition Scheme associated with the Catalog Relation.
-  // A relation may or may not have a Partition Scheme
-  // assosiated with it.
-  std::unique_ptr<PartitionScheme> partition_scheme_;
-
-  // Index scheme associated with this relation.
-  // Defines a set of indices defined for this relation.
-  std::unique_ptr<IndexScheme> index_scheme_;
-  // Mutex for locking the index scheme.
-  alignas(kCacheLineBytes) mutable SpinSharedMutex<false> index_scheme_mutex_;
-
-  std::unique_ptr<CatalogRelationStatistics> statistics_;
-
-#ifdef QUICKSTEP_HAVE_LIBNUMA
-  // NUMA placement scheme object which has the mapping between the partitions
-  // of the relation and the NUMA nodes/sockets. It also maintains a mapping
-  // between the blocks of the relation and the NUMA nodes..
-  std::unique_ptr<NUMAPlacementScheme> placement_scheme_;
-#endif  // QUICKSTEP_HAVE_LIBNUMA
-
-  friend class CatalogTest;
-
-  DISALLOW_COPY_AND_ASSIGN(CatalogRelation);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_CATALOG_CATALOG_RELATION_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/catalog/CatalogRelationSchema.cpp
----------------------------------------------------------------------
diff --git a/catalog/CatalogRelationSchema.cpp b/catalog/CatalogRelationSchema.cpp
deleted file mode 100644
index 5568cef..0000000
--- a/catalog/CatalogRelationSchema.cpp
+++ /dev/null
@@ -1,191 +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 "catalog/CatalogRelationSchema.hpp"
-
-#include <cstddef>
-#include <string>
-#include <unordered_map>
-#include <utility>
-
-#include "catalog/Catalog.pb.h"
-#include "catalog/CatalogAttribute.hpp"
-#include "catalog/CatalogErrors.hpp"
-#include "catalog/CatalogTypedefs.hpp"
-#include "types/Type.hpp"
-#include "utility/PtrVector.hpp"
-#include "utility/StringUtil.hpp"
-
-#include "glog/logging.h"
-
-using std::size_t;
-using std::string;
-using std::unordered_map;
-
-namespace quickstep {
-
-CatalogRelationSchema::CatalogRelationSchema(const serialization::CatalogRelationSchema &proto)
-    : parent_(nullptr),
-      id_(proto.relation_id()),
-      name_(proto.name()),
-      temporary_(proto.temporary()),
-      num_nullable_attributes_(0),
-      num_variable_length_attributes_(0),
-      max_byte_length_(0),
-      min_byte_length_(0),
-      estimated_byte_length_(0),
-      fixed_byte_length_(0),
-      max_variable_byte_length_(0),
-      min_variable_byte_length_(0),
-      min_variable_byte_length_excluding_nullable_(0),
-      estimated_variable_byte_length_(0),
-      max_byte_lengths_(proto.attributes_size()),
-      current_nullable_attribute_index_(-1),
-      current_variable_length_attribute_index_(-1) {
-  DCHECK(ProtoIsValid(proto))
-      << "Attempted to create CatalogRelationSchema from an invalid proto description:\n"
-      << proto.DebugString();
-
-  // Deserializing the attributes for the relation schema.
-  for (int i = 0; i < proto.attributes_size(); ++i) {
-    if (proto.attributes(i).IsInitialized()) {
-      addAttribute(new CatalogAttribute(proto.attributes(i)));
-    } else {
-      attr_vec_.push_back(nullptr);
-    }
-  }
-}
-
-bool CatalogRelationSchema::ProtoIsValid(const serialization::CatalogRelationSchema &proto) {
-  if (!proto.IsInitialized()
-      || proto.relation_id() == static_cast<relation_id>(-1)) {
-    return false;
-  }
-
-  for (int i = 0; i < proto.attributes_size(); ++i) {
-    if (!CatalogAttribute::ProtoIsValid(proto.attributes(i))) {
-      return false;
-    }
-  }
-
-  return true;
-}
-
-serialization::CatalogRelationSchema CatalogRelationSchema::getProto() const {
-  serialization::CatalogRelationSchema proto;
-
-  proto.set_relation_id(id_);
-  proto.set_name(name_);
-  proto.set_temporary(temporary_);
-
-  for (PtrVector<CatalogAttribute, true>::const_iterator it = attr_vec_.begin();
-       it != attr_vec_.end();
-       ++it) {
-    if (it.isNull()) {
-      proto.add_attributes();
-    } else {
-      proto.add_attributes()->MergeFrom(it->getProto());
-    }
-  }
-
-  return proto;
-}
-
-const CatalogAttribute* CatalogRelationSchema::getAttributeByName(
-    const string &attr_name) const {
-  unordered_map<string, CatalogAttribute*>::const_iterator it
-      = attr_map_.find(ToLower(attr_name));
-  if (it == attr_map_.end()) {
-    return nullptr;
-  } else {
-    return it->second;
-  }
-}
-
-CatalogAttribute* CatalogRelationSchema::getAttributeByNameMutable(
-    const string &attr_name) {
-  unordered_map<string, CatalogAttribute*>::const_iterator it
-      = attr_map_.find(ToLower(attr_name));
-  if (it == attr_map_.end()) {
-    return nullptr;
-  } else {
-    return it->second;
-  }
-}
-
-attribute_id CatalogRelationSchema::addAttribute(CatalogAttribute *new_attr) {
-  const string lower_attr_name = ToLower(new_attr->getName());
-  DCHECK(!hasAttributeWithName(lower_attr_name));
-
-  if (attr_vec_.size() > static_cast<size_t>(kCatalogMaxID)) {
-    throw CatalogIDOverflow("attribute");
-  } else {
-    attr_map_[lower_attr_name] = new_attr;
-    attr_vec_.push_back(new_attr);
-    new_attr->setParent(this);
-    new_attr->setID(static_cast<attribute_id>(attr_vec_.size() - 1));
-
-    const Type &attr_type = new_attr->getType();
-
-    if (attr_type.isVariableLength()) {
-      ++num_variable_length_attributes_;
-      variable_length_attribute_indices_.push_back(++current_variable_length_attribute_index_);
-
-      max_variable_byte_length_ += attr_type.maximumByteLength();
-      min_variable_byte_length_ += attr_type.minimumByteLength();
-      if (!attr_type.isNullable()) {
-        min_variable_byte_length_excluding_nullable_ += attr_type.minimumByteLength();
-      }
-      estimated_variable_byte_length_ += attr_type.estimateAverageByteLength();
-    } else {
-      variable_length_attribute_indices_.push_back(kInvalidCatalogId);
-
-      fixed_length_attribute_offsets_.resize(new_attr->getID() + 1, fixed_byte_length_);
-      fixed_byte_length_ += attr_type.maximumByteLength();
-    }
-    max_byte_length_ += attr_type.maximumByteLength();
-    min_byte_length_ += attr_type.minimumByteLength();
-    estimated_byte_length_ += attr_type.estimateAverageByteLength();
-
-    if (attr_type.isNullable()) {
-      ++num_nullable_attributes_;
-      nullable_attribute_indices_.push_back(++current_nullable_attribute_index_);
-    } else {
-      nullable_attribute_indices_.push_back(kInvalidCatalogId);
-    }
-
-    const attribute_id attr_id = new_attr->getID();
-    // Ensure that we will not overrun the vector by resizing and initializing
-    // new entries to zero.
-    max_byte_lengths_.resize(attr_id + 1, 0);
-    max_byte_lengths_[attr_id] = attr_type.maximumByteLength();
-
-    return attr_id;
-  }
-}
-
-attribute_id CatalogRelationSchema::getMaxAttributeId() const {
-  if (size() > 0) {
-    return attr_vec_.back().getID();
-  } else {
-    return -1;
-  }
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/catalog/CatalogRelationSchema.hpp
----------------------------------------------------------------------
diff --git a/catalog/CatalogRelationSchema.hpp b/catalog/CatalogRelationSchema.hpp
deleted file mode 100644
index d8b6128..0000000
--- a/catalog/CatalogRelationSchema.hpp
+++ /dev/null
@@ -1,545 +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_CATALOG_CATALOG_RELATION_SCHEMA_HPP_
-#define QUICKSTEP_CATALOG_CATALOG_RELATION_SCHEMA_HPP_
-
-#include <cstddef>
-#include <string>
-#include <unordered_map>
-#include <vector>
-
-#include "catalog/Catalog.pb.h"
-#include "catalog/CatalogAttribute.hpp"
-#include "catalog/CatalogTypedefs.hpp"
-#include "utility/Macros.hpp"
-#include "utility/PtrVector.hpp"
-#include "utility/StringUtil.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-class CatalogDatabase;
-
-/** \addtogroup Catalog
- *  @{
- */
-
-/**
- * @brief A relation in a database. This base class only includes information
- *        about the relation's schema. See also CatalogRelation, which augments
- *        this with additional information about physical blocks.
- **/
-class CatalogRelationSchema {
- public:
-  typedef std::unordered_map<std::string, CatalogAttribute*>::size_type size_type;
-  typedef PtrVector<CatalogAttribute, true>::const_skip_iterator const_iterator;
-
-  /**
-   * @brief Reconstruct a relation schema from its serialized Protocol Buffer
-   *        form.
-   *
-   * @param proto The Protocol Buffer serialization of a relation schema,
-   *        previously produced by getProto().
-   **/
-  explicit CatalogRelationSchema(const serialization::CatalogRelationSchema &proto);
-
-  /**
-   * @brief Destructor which recursively destroys children.
-   **/
-  virtual ~CatalogRelationSchema() {}
-
-  /**
-   * @brief Serialize the relation schema as Protocol Buffer.
-   *
-   * @return The Protocol Buffer representation of the relation schema.
-   **/
-  virtual serialization::CatalogRelationSchema getProto() const;
-
-  /**
-   * @brief Check whether a serialization::CatalogRelationSchema is fully-formed
-   *        and all parts are valid.
-   *
-   * @param proto A serialized Protocol Buffer representation of a relation
-   *        schema, originally generated by getProto().
-   * @return Whether proto is fully-formed and valid.
-   **/
-  static bool ProtoIsValid(const serialization::CatalogRelationSchema &proto);
-
-  /**
-   * @brief Get the parent database.
-   *
-   * @return Parent database.
-   **/
-  const CatalogDatabase& getParent() const {
-    return *parent_;
-  }
-
-  /**
-   * @brief Get a mutable pointer to the parent database.
-   *
-   * @return Parent database.
-   **/
-  CatalogDatabase* getParentMutable() {
-    return parent_;
-  }
-
-  /**
-   * @brief Get this relation's ID.
-   *
-   * @return This relation's ID.
-   **/
-  relation_id getID() const {
-    return id_;
-  }
-
-  /**
-   * @brief Get this relation's name.
-   *
-   * @return This relation's name.
-   **/
-  const std::string& getName() const {
-    return name_;
-  }
-
-  /**
-   * @brief Check whether this relation is temporary or permanent.
-   *
-   * @return True if this relation is temporary, false otherwise.
-   **/
-  bool isTemporary() const {
-    return temporary_;
-  }
-
-  /**
-   * @brief Check whether an attribute with the given name exists.
-   *
-   * @param attr_name The name to check for.
-   * @return Whether the attribute exists.
-   **/
-  bool hasAttributeWithName(const std::string &attr_name) const {
-    return (attr_map_.find(ToLower(attr_name)) != attr_map_.end());
-  }
-
-  /**
-   * @brief Check whether an attribute with the given id exists.
-   *
-   * @param id The id to check for.
-   * @return Whether the attribute exists.
-   **/
-  bool hasAttributeWithId(const attribute_id id) const {
-    return (idInRange(id) && !attr_vec_.elementIsNull(id));
-  }
-
-  /**
-   * @brief Get an attribute by name. The search is case-insensitive.
-   *
-   * @param attr_name The name to search for.
-   * @return The attribute with the given name. NULL if the attribute is not found.
-   **/
-  const CatalogAttribute* getAttributeByName(const std::string &attr_name) const;
-
-  /**
-   * @brief Get a mutable pointer to an attribute by name. The search is case-insensitive.
-   *
-   * @param attr_name The name to search for.
-   * @return The attribute with the given name. NULL if the attribute is not found.
-   **/
-  CatalogAttribute* getAttributeByNameMutable(const std::string &attr_name);
-
-  /**
-   * @brief Get an attribute by ID.
-   *
-   * @param id The id to search for.
-   * @return The attribute with the given ID.
-   **/
-  const CatalogAttribute* getAttributeById(const attribute_id id) const {
-    if (hasAttributeWithId(id)) {
-      return &attr_vec_[id];
-    } else {
-      return nullptr;
-    }
-  }
-
-  /**
-   * @brief Get a mutable pointer to an attribute by ID.
-   *
-   * @param id The id to search for.
-   * @return The attribute with the given ID.
-   * @exception AttributeIdNotFound No attribute with the given ID exists.
-   **/
-  CatalogAttribute* getAttributeByIdMutable(const attribute_id id) {
-    if (hasAttributeWithId(id)) {
-      return &(attr_vec_[id]);
-    } else {
-      return nullptr;
-    }
-  }
-
-  /**
-   * @brief Add a new attribute to the relation. If the attribute already has
-   *        an ID and/or parent, it will be overwritten.
-   *
-   * @param new_attr The attribute to be added.
-   * @return The id assigned to the attribute.
-   * @exception AttributeNameCollision An attribute with the same name as
-   *            new_attr is already present in the relation.
-   **/
-  attribute_id addAttribute(CatalogAttribute *new_attr);
-
-  /**
-   * @brief Check whether tuples of the relation are variable-length.
-   *
-   * @return Whether the relation is variable length (i.e. whether any child
-   *         attributes are variable length).
-   **/
-  bool isVariableLength() const {
-    return num_variable_length_attributes_ > 0;
-  }
-
-  /**
-   * @brief Check how many attributes of the relation are variable-length.
-   *
-   * @return The number of variable-length attributes in the relation.
-   **/
-  inline unsigned numVariableLengthAttributes() const {
-    return num_variable_length_attributes_;
-  }
-
-  /**
-   * @brief Get the index of a variable-length attribute among all the
-   *        variable-length attributes in this relation.
-   *
-   * @param id The id of the desired attribute.
-   * @return The attribute's index amongst all of the variable-length
-   *         attributes, or -1 if the attribute is fixed-length.
-   **/
-  inline int getVariableLengthAttributeIndex(const attribute_id id) const {
-    DCHECK(hasAttributeWithId(id));
-    return variable_length_attribute_indices_[id];
-  }
-
-  /**
-   * @brief Get the maximum length of tuples of this relation, in bytes.
-   *
-   * @return The maximum length of tuples of this relation, in bytes (equal to
-   *         getFixedByteLength() if relation is fixed-length).
-   **/
-  std::size_t getMaximumByteLength() const {
-    return max_byte_length_;
-  }
-
-  /**
-   * @brief Get the minimum length of tuples of this relation, in bytes.
-   *
-   * @return The minimum length of tuples of this relation, in bytes (equal
-   *         to getFixedByteLength() and getMaximumByteLength() if relation is
-   *         fixed-length).
-   **/
-  std::size_t getMinimumByteLength() const {
-    return min_byte_length_;
-  }
-
-  /**
-   * @brief Get the estimated average length of tuples of this relation, in
-   *        bytes.
-   *
-   * @return The estimated average length of tuples of this relation, in bytes
-   *         (equal to getFixedByteLength(), getMinimumByteLength(), and
-   *         getMaximumByteLength() if relation is fixed-length).
-   **/
-  std::size_t getEstimatedByteLength() const {
-    return estimated_byte_length_;
-  }
-
-  /**
-   * @brief Get the total length of the fixed-length attributes in this
-   *        relation, in bytes.
-   *
-   * @return The total length of fixed-length attributes in this relation, in
-   *         bytes.
-   **/
-  std::size_t getFixedByteLength() const {
-    return fixed_byte_length_;
-  }
-
-  /**
-   * @brief Get the total maximum length of the variable-length attributes of
-   *        this relation, in bytes.
-   *
-   * @return The total maximum length of the variable-length attributes of this
-   *         relation, in bytes (0 if the relation is fixed-length).
-   **/
-  std::size_t getMaximumVariableByteLength() const {
-    return max_variable_byte_length_;
-  }
-
-  /**
-   * @brief Get the total minimum length of the variable-length attributes of
-   *        this relation, in bytes.
-   *
-   * @return The total minimum length of the variable-length attributes of this
-   *         relation, in bytes (0 if the relation is fixed-length).
-   **/
-  std::size_t getMinimumVariableByteLength() const {
-    return min_variable_byte_length_;
-  }
-
-  /**
-   * @brief Get the total minimum length of the non-nullable variable-length
-   *        attributes of this relation, in bytes.
-   *
-   * @return The total minimum length of the non-nullable variable-length
-   *         attributes of this relation, in bytes (0 if the relation is
-   *         fixed-length).
-   **/
-  std::size_t getMinimumVariableByteLengthExcludingNullable() const {
-    return min_variable_byte_length_excluding_nullable_;
-  }
-
-  /**
-   * @brief Get the estimated average length of all the variable-length
-   *        attributes of this relation, in bytes.
-   *
-   * @return The total estimated average length of variable-length attributes
-   *         of this relation, in bytes (0 if the relation is fixed-length).
-   **/
-  std::size_t getEstimatedVariableByteLength() const {
-    return estimated_variable_byte_length_;
-  }
-
-  /**
-   * @brief Get the byte offset of a fixed-length attribute in this relation.
-   * @warning This method should only be called for attributes which are
-   *          fixed-length. For debug builds, this is checked with an assert.
-   *          For release builds, it is unchecked.
-   *
-   * @param id The id of the desired attribute.
-   * @return The byte-offset of the specified fixed-length attribute (as it
-   *         would be in a conventional row-store) in this relation.
-   **/
-  inline std::size_t getFixedLengthAttributeOffset(const attribute_id id) const {
-    DCHECK(hasAttributeWithId(id));
-    DCHECK_EQ(-1, variable_length_attribute_indices_[id]);
-    return fixed_length_attribute_offsets_[id];
-  }
-
-  /**
-   * @brief Check whether any attributes of the relation are nullable.
-   *
-   * @return Whether the relation has any nullable attributes.
-   **/
-  inline bool hasNullableAttributes() const {
-    return num_nullable_attributes_ > 0;
-  }
-
-  /**
-   * @brief Check how many attributes of the relation are nullable.
-   *
-   * @return The number of nullable attributes in the relation.
-   **/
-  inline unsigned numNullableAttributes() const {
-    return num_nullable_attributes_;
-  }
-
-  /**
-   * @brief Get the index of a nullable attribute among all the nullable
-   *        attributes in this relation.
-   *
-   * @param id The id of the desired attribute.
-   * @return The attribute's index amongst all of the nullable attributes
-   *         (intended for indexing into a NULL bitmap), or -1 if the attribute
-   *         is not nullable.
-   **/
-  inline int getNullableAttributeIndex(const attribute_id id) const {
-    DCHECK(hasAttributeWithId(id));
-    return nullable_attribute_indices_[id];
-  }
-
-  /**
-   * @brief Get the number of child attributes.
-   *
-   * @return The number of child attributes.
-   **/
-  size_type size() const {
-    return attr_map_.size();
-  }
-
-  /**
-   * @brief Determine whether the sequence of attribute IDs has gaps in it.
-   *
-   * @return Whether the sequence of attribute IDs has any gaps.
-   **/
-  bool gapsInAttributeSequence() const {
-    return (attr_map_.size() != attr_vec_.size());
-  }
-
-  /**
-   * @brief Get the highest attribute ID in this relation.
-   *
-   * @return The highest attribute ID in this relation (-1 if no attributes
-   *         exist).
-   **/
-  attribute_id getMaxAttributeId() const;
-
-  /**
-   * @brief Get an iterator at the beginning of the child attributes.
-   *
-   * @return An iterator on the first child attribute.
-   **/
-  inline const_iterator begin() const {
-    return attr_vec_.begin_skip();
-  }
-
-  /**
-   * @brief Get an iterator at one-past-the-end of the child attributes.
-   *
-   * @return An iterator one-past-the-end of the child attributes.
-   **/
-  inline const_iterator end() const {
-    return attr_vec_.end_skip();
-  }
-
-  /**
-   * @brief Get a vector of the maximum byte lengths for each attribute.
-   * @details An index in the vector corresponds with the attribute's id.
-   *
-   * @return A vector of the maximum byte lengths for each attribute.
-   */
-  const std::vector<std::size_t>& getMaximumAttributeByteLengths() const {
-    return max_byte_lengths_;
-  }
-
- protected:
-  /**
-   * @brief Create a new relation.
-   *
-   * @param parent The database this relation belongs to.
-   * @param name This relation's name.
-   * @param id This relation's ID (defaults to -1, which means invalid/unset).
-   * @param temporary Whether this relation is temporary (stores an
-   *        intermediate result during query processing).
-   **/
-  CatalogRelationSchema(CatalogDatabase* parent,
-                        const std::string &name,
-                        const relation_id id = -1,
-                        const bool temporary = false)
-      : parent_(parent),
-        id_(id),
-        name_(name),
-        temporary_(temporary),
-        num_nullable_attributes_(0),
-        num_variable_length_attributes_(0),
-        max_byte_length_(0),
-        min_byte_length_(0),
-        estimated_byte_length_(0),
-        fixed_byte_length_(0),
-        max_variable_byte_length_(0),
-        min_variable_byte_length_(0),
-        min_variable_byte_length_excluding_nullable_(0),
-        estimated_variable_byte_length_(0),
-        current_nullable_attribute_index_(-1),
-        current_variable_length_attribute_index_(-1) {
-  }
-
-  /**
-   * @brief Set the parent CatalogDatabase of this relation. Used by
-   *        CatalogDatabase (a friend of this class) when adding a new
-   *        relation.
-   *
-   * @param parent The new parent for this CatalogRelationSchema.
-   **/
-  void setParent(CatalogDatabase *parent) {
-    parent_ = parent;
-  }
-
-  /**
-   * @brief Set the ID of this relation. Used by CatalogDatabase (a friend of
-   *        this class) when adding a new relation.
-   *
-   * @param id The new ID for this CatalogRelationSchema.
-   **/
-  void setID(const relation_id id) {
-    id_ = id;
-  }
-
-  /**
-   * @brief Check whether an attribute_id is within the range of IDs contained
-   *        in this CatalogRelationSchema.
-   *
-   * @param id The id to check.
-   * @return true if id is in range, false otherwise.
-   **/
-  bool idInRange(const attribute_id id) const {
-    return ((id >= 0)
-            && (static_cast<PtrVector<CatalogAttribute>::size_type>(id) < attr_vec_.size()));
-  }
-
-  CatalogDatabase *parent_;
-
-  // The relation id in CatalogDatabase.
-  relation_id id_;
-
-  // The relation name.
-  const std::string name_;
-
-  // Whether a temporary relation.
-  const bool temporary_;
-
-  // A vector of attributes, and NULL if it has removed from the relation
-  // schema.
-  PtrVector<CatalogAttribute, true> attr_vec_;
-
-  // A map from a lower case attribute name to a pointer to the attribute.
-  std::unordered_map<std::string, CatalogAttribute*> attr_map_;
-
-  // These schema parameters are cached so we don't have to recalculate them
-  // every time.
-  unsigned num_nullable_attributes_;
-  unsigned num_variable_length_attributes_;
-  std::size_t max_byte_length_,
-              min_byte_length_,
-              estimated_byte_length_,
-              fixed_byte_length_,
-              max_variable_byte_length_,
-              min_variable_byte_length_,
-              min_variable_byte_length_excluding_nullable_,
-              estimated_variable_byte_length_;
-  std::vector<std::size_t> fixed_length_attribute_offsets_;
-  std::vector<std::size_t> max_byte_lengths_;
-
-  // Entries are -1 for non-nullable attributes.
-  std::vector<int> nullable_attribute_indices_;
-  int current_nullable_attribute_index_;
-
-  std::vector<int> variable_length_attribute_indices_;
-  int current_variable_length_attribute_index_;
-
- private:
-  friend class CatalogDatabase;
-
-  DISALLOW_COPY_AND_ASSIGN(CatalogRelationSchema);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_CATALOG_CATALOG_RELATION_SCHEMA_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/catalog/CatalogRelationStatistics.cpp
----------------------------------------------------------------------
diff --git a/catalog/CatalogRelationStatistics.cpp b/catalog/CatalogRelationStatistics.cpp
deleted file mode 100644
index 6a51570..0000000
--- a/catalog/CatalogRelationStatistics.cpp
+++ /dev/null
@@ -1,51 +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 "catalog/CatalogRelationStatistics.hpp"
-
-#include "catalog/Catalog.pb.h"
-
-namespace quickstep {
-
-CatalogRelationStatistics::CatalogRelationStatistics(
-    const serialization::CatalogRelationStatistics &proto) {
-  if (proto.has_num_tuples()) {
-    num_tuples_ = proto.num_tuples();
-  }
-  for (int i = 0; i < proto.num_distinct_values_map_size(); ++i) {
-    const auto &entry = proto.num_distinct_values_map(i);
-    num_distinct_values_map_.emplace(entry.attr_id(),
-                                     entry.num_distinct_values());
-  }
-}
-
-serialization::CatalogRelationStatistics CatalogRelationStatistics::getProto() const {
-  serialization::CatalogRelationStatistics proto;
-  if (num_tuples_ != 0) {
-    proto.set_num_tuples(num_tuples_);
-  }
-  for (const auto &pair : num_distinct_values_map_) {
-    auto entry = proto.add_num_distinct_values_map();
-    entry->set_attr_id(pair.first);
-    entry->set_num_distinct_values(pair.second);
-  }
-  return proto;
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/catalog/CatalogRelationStatistics.hpp
----------------------------------------------------------------------
diff --git a/catalog/CatalogRelationStatistics.hpp b/catalog/CatalogRelationStatistics.hpp
deleted file mode 100644
index f2056f3..0000000
--- a/catalog/CatalogRelationStatistics.hpp
+++ /dev/null
@@ -1,124 +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_CATALOG_CATALOG_RELATION_STATISTICS_HPP_
-#define QUICKSTEP_CATALOG_CATALOG_RELATION_STATISTICS_HPP_
-
-#include <cstddef>
-#include <unordered_map>
-#include <utility>
-
-#include "catalog/Catalog.pb.h"
-#include "catalog/CatalogTypedefs.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-
-/** \addtogroup Catalog
- *  @{
- */
-
-/**
- * @brief Statistics of a catalog relation. E.g. total number of tuples,
- *        number of distinct values for each column.
- **/
-class CatalogRelationStatistics {
- public:
-  /**
-   * @brief Constructor.
-   **/
-  CatalogRelationStatistics()
-      : num_tuples_(0) {}
-
-  /**
-   * @brief Reconstruct a CatalogRelationStatistics object from its serialized
-   *        Protocol Buffer form.
-   *
-   * @param proto The Protocol Buffer serialization of a CatalogRelationStatistics
-   *        object, previously produced by getProto().
-   **/
-  explicit CatalogRelationStatistics(const serialization::CatalogRelationStatistics &proto);
-
-  /**
-   * @brief Serialize the CatalogRelationStatistics object as Protocol Buffer.
-   *
-   * @return The Protocol Buffer representation of the CatalogRelationStatistics
-   *         object.
-   **/
-  serialization::CatalogRelationStatistics getProto() const;
-
-  /**
-   * @brief Set the number of tuples statistic.
-   *
-   * @param num_tuples The number of tuples statistic.
-   */
-  void setNumTuples(std::size_t num_tuples) {
-    num_tuples_ = num_tuples;
-  }
-
-  /**
-   * @brief Get the number of tuples statistic.
-   *
-   * @return The number of tuples. Returns 0 if the statistic is not set.
-   */
-  std::size_t getNumTuples() const {
-    return num_tuples_;
-  }
-
-  /**
-   * @brief Set the number of distinct values statistic for a column (catalog attribute).
-   *
-   * @param attr_id The id of the column.
-   * @param num_distinct_values The number of distinct values statistic.
-   */
-  void setNumDistinctValues(attribute_id attr_id, std::size_t num_distinct_values) {
-    num_distinct_values_map_[attr_id] = num_distinct_values;
-  }
-
-  /**
-   * @brief Get the number of distinct values statistic for a column (catalog attribute).
-   *
-   * @param The id of the column.
-   * @return The number of distinct values statistic for the column. Returns 0
-   *         if the statistic is not set.
-   */
-  std::size_t getNumDistinctValues(attribute_id attr_id) const {
-    const auto it = num_distinct_values_map_.find(attr_id);
-    if (it == num_distinct_values_map_.end()) {
-      return static_cast<std::size_t>(0);
-    } else {
-      return it->second;
-    }
-  }
-
- private:
-  // Total number of tuples in the relation.
-  std::size_t num_tuples_;
-
-  // Number of distinct values for each column.
-  std::unordered_map<attribute_id, std::size_t> num_distinct_values_map_;
-
-  DISALLOW_COPY_AND_ASSIGN(CatalogRelationStatistics);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_CATALOG_CATALOG_RELATION_STATISTICS_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/catalog/CatalogTypedefs.hpp
----------------------------------------------------------------------
diff --git a/catalog/CatalogTypedefs.hpp b/catalog/CatalogTypedefs.hpp
deleted file mode 100644
index 70bac84..0000000
--- a/catalog/CatalogTypedefs.hpp
+++ /dev/null
@@ -1,58 +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_CATALOG_CATALOG_TYPEDEFS_HPP_
-#define QUICKSTEP_CATALOG_CATALOG_TYPEDEFS_HPP_
-
-#include <climits>
-#include <cstddef>
-
-// In all cases, a negative value indicates an invalid/unset id, except for
-// partition_id.
-
-namespace quickstep {
-
-/** \addtogroup Catalog
- *  @{
- */
-
-typedef int database_id;
-typedef int relation_id;
-typedef int attribute_id;
-typedef std::size_t partition_id;
-typedef int numa_node_id;
-
-// This depends on all the above id types being typedefed to int, except for
-// partition_id.
-const int kCatalogMaxID = INT_MAX;
-
-// Catalog ids use negative values as invalid ids. Mark -1 as constant invalid
-// id for the catalog ids.
-constexpr int kInvalidCatalogId = -1;
-
-// Used to indicate no preference for a NUMA Node ID.
-constexpr numa_node_id kAnyNUMANodeID = -1;
-
-constexpr attribute_id kInvalidAttributeID = -1;
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_CATALOG_CATALOG_TYPEDEFS_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/catalog/IndexScheme.cpp
----------------------------------------------------------------------
diff --git a/catalog/IndexScheme.cpp b/catalog/IndexScheme.cpp
deleted file mode 100644
index c686c39..0000000
--- a/catalog/IndexScheme.cpp
+++ /dev/null
@@ -1,82 +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 "catalog/IndexScheme.hpp"
-
-#include <memory>
-#include <string>
-
-#include "catalog/Catalog.pb.h"
-#include "storage/IndexSubBlockDescriptionFactory.hpp"
-#include "storage/StorageBlockLayout.pb.h"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-bool IndexScheme::ProtoIsValid(const serialization::IndexScheme &proto) {
-  // Check that proto is fully initialized.
-  if (!proto.IsInitialized()) {
-    return false;
-  }
-
-  // Check that each index entry contains initialized valid index description.
-  for (int i = 0; i < proto.index_entries_size(); ++i) {
-    const serialization::IndexScheme_IndexEntry &index_entry = proto.index_entries(i);
-    if (!IndexSubBlockDescriptionFactory::ProtoIsValid(index_entry.index_description())) {
-      return false;
-    }
-  }
-  return true;
-}
-
-IndexScheme* IndexScheme::ReconstructFromProto(const serialization::IndexScheme &proto) {
-  DCHECK(ProtoIsValid(proto))
-    << "Attempted to create IndexScheme from an invalid proto description:\n"
-    << proto.DebugString();
-
-  std::unique_ptr<IndexScheme> index_scheme(new IndexScheme());
-
-  for (int index_num = 0; index_num < proto.index_entries_size(); ++index_num) {
-    const serialization::IndexScheme_IndexEntry &index_entry = proto.index_entries(index_num);
-    // Make sure that index with same name does not already exist.
-    DCHECK(index_scheme->index_map_.find(index_entry.index_name())
-           == index_scheme->index_map_.end())
-        << "Attempted to create IndexScheme from proto with duplicate index names.";
-    // Store the index_name and corresponding index description in map.
-    index_scheme->index_map_.emplace(index_entry.index_name(), index_entry.index_description());
-  }
-  return index_scheme.release();
-}
-
-serialization::IndexScheme IndexScheme::getProto() const {
-  serialization::IndexScheme proto;
-  // Set the entries of the index scheme.
-  for (auto cit = index_map_.cbegin(); cit != index_map_.cend(); ++cit) {
-    // Create an index entry.
-    serialization::IndexScheme_IndexEntry *index_entry = proto.add_index_entries();
-
-    // Populate the details of the index entry.
-    index_entry->set_index_name(cit->first);
-    index_entry->mutable_index_description()->MergeFrom(cit->second);
-  }
-  return proto;
-}
-
-}  // namespace quickstep



[26/51] [abbrv] [partial] incubator-quickstep git commit: remove c++ files

Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/parser/preprocessed/SqlLexer_gen.cpp
----------------------------------------------------------------------
diff --git a/parser/preprocessed/SqlLexer_gen.cpp b/parser/preprocessed/SqlLexer_gen.cpp
deleted file mode 100644
index c17e1a1..0000000
--- a/parser/preprocessed/SqlLexer_gen.cpp
+++ /dev/null
@@ -1,3579 +0,0 @@
-#line 2 "SqlLexer_gen.cpp"
-
-#line 4 "SqlLexer_gen.cpp"
-
-#define  YY_INT_ALIGNED short int
-
-/* A lexical scanner generated by flex */
-
-#define FLEX_SCANNER
-#define YY_FLEX_MAJOR_VERSION 2
-#define YY_FLEX_MINOR_VERSION 6
-#define YY_FLEX_SUBMINOR_VERSION 0
-#if YY_FLEX_SUBMINOR_VERSION > 0
-#define FLEX_BETA
-#endif
-
-/* First, we deal with  platform-specific or compiler-specific issues. */
-
-/* begin standard C headers. */
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-#include <stdlib.h>
-
-/* end standard C headers. */
-
-/* flex integer type definitions */
-
-#ifndef FLEXINT_H
-#define FLEXINT_H
-
-/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
-
-#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
-
-/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
- * if you want the limit (max/min) macros for int types. 
- */
-#ifndef __STDC_LIMIT_MACROS
-#define __STDC_LIMIT_MACROS 1
-#endif
-
-#include <inttypes.h>
-typedef int8_t flex_int8_t;
-typedef uint8_t flex_uint8_t;
-typedef int16_t flex_int16_t;
-typedef uint16_t flex_uint16_t;
-typedef int32_t flex_int32_t;
-typedef uint32_t flex_uint32_t;
-#else
-typedef signed char flex_int8_t;
-typedef short int flex_int16_t;
-typedef int flex_int32_t;
-typedef unsigned char flex_uint8_t; 
-typedef unsigned short int flex_uint16_t;
-typedef unsigned int flex_uint32_t;
-
-/* Limits of integral types. */
-#ifndef INT8_MIN
-#define INT8_MIN               (-128)
-#endif
-#ifndef INT16_MIN
-#define INT16_MIN              (-32767-1)
-#endif
-#ifndef INT32_MIN
-#define INT32_MIN              (-2147483647-1)
-#endif
-#ifndef INT8_MAX
-#define INT8_MAX               (127)
-#endif
-#ifndef INT16_MAX
-#define INT16_MAX              (32767)
-#endif
-#ifndef INT32_MAX
-#define INT32_MAX              (2147483647)
-#endif
-#ifndef UINT8_MAX
-#define UINT8_MAX              (255U)
-#endif
-#ifndef UINT16_MAX
-#define UINT16_MAX             (65535U)
-#endif
-#ifndef UINT32_MAX
-#define UINT32_MAX             (4294967295U)
-#endif
-
-#endif /* ! C99 */
-
-#endif /* ! FLEXINT_H */
-
-#ifdef __cplusplus
-
-/* The "const" storage-class-modifier is valid. */
-#define YY_USE_CONST
-
-#else	/* ! __cplusplus */
-
-/* C99 requires __STDC__ to be defined as 1. */
-#if defined (__STDC__)
-
-#define YY_USE_CONST
-
-#endif	/* defined (__STDC__) */
-#endif	/* ! __cplusplus */
-
-#ifdef YY_USE_CONST
-#define yyconst const
-#else
-#define yyconst
-#endif
-
-/* Returned upon end-of-file. */
-#define YY_NULL 0
-
-/* Promotes a possibly negative, possibly signed char to an unsigned
- * integer for use as an array index.  If the signed char is negative,
- * we want to instead treat it as an 8-bit unsigned char, hence the
- * double cast.
- */
-#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
-
-/* An opaque pointer. */
-#ifndef YY_TYPEDEF_YY_SCANNER_T
-#define YY_TYPEDEF_YY_SCANNER_T
-typedef void* yyscan_t;
-#endif
-
-/* For convenience, these vars (plus the bison vars far below)
-   are macros in the reentrant scanner. */
-#define yyin yyg->yyin_r
-#define yyout yyg->yyout_r
-#define yyextra yyg->yyextra_r
-#define yyleng yyg->yyleng_r
-#define yytext yyg->yytext_r
-#define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno)
-#define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column)
-#define yy_flex_debug yyg->yy_flex_debug_r
-
-/* Enter a start condition.  This macro really ought to take a parameter,
- * but we do it the disgusting crufty way forced on us by the ()-less
- * definition of BEGIN.
- */
-#define BEGIN yyg->yy_start = 1 + 2 *
-
-/* Translate the current start state into a value that can be later handed
- * to BEGIN to return to the state.  The YYSTATE alias is for lex
- * compatibility.
- */
-#define YY_START ((yyg->yy_start - 1) / 2)
-#define YYSTATE YY_START
-
-/* Action number for EOF rule of a given start state. */
-#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
-
-/* Special action meaning "start processing a new file". */
-#define YY_NEW_FILE quickstep_yyrestart(yyin ,yyscanner )
-
-#define YY_END_OF_BUFFER_CHAR 0
-
-/* Size of default input buffer. */
-#ifndef YY_BUF_SIZE
-#ifdef __ia64__
-/* On IA-64, the buffer size is 16k, not 8k.
- * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
- * Ditto for the __ia64__ case accordingly.
- */
-#define YY_BUF_SIZE 32768
-#else
-#define YY_BUF_SIZE 16384
-#endif /* __ia64__ */
-#endif
-
-/* The state buf must be large enough to hold one state per character in the main buffer.
- */
-#define YY_STATE_BUF_SIZE   ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
-
-#ifndef YY_TYPEDEF_YY_BUFFER_STATE
-#define YY_TYPEDEF_YY_BUFFER_STATE
-typedef struct yy_buffer_state *YY_BUFFER_STATE;
-#endif
-
-#ifndef YY_TYPEDEF_YY_SIZE_T
-#define YY_TYPEDEF_YY_SIZE_T
-typedef size_t yy_size_t;
-#endif
-
-#define EOB_ACT_CONTINUE_SCAN 0
-#define EOB_ACT_END_OF_FILE 1
-#define EOB_ACT_LAST_MATCH 2
-
-    /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires
-     *       access to the local variable yy_act. Since yyless() is a macro, it would break
-     *       existing scanners that call yyless() from OUTSIDE quickstep_yylex. 
-     *       One obvious solution it to make yy_act a global. I tried that, and saw
-     *       a 5% performance hit in a non-yylineno scanner, because yy_act is
-     *       normally declared as a register variable-- so it is not worth it.
-     */
-    #define  YY_LESS_LINENO(n) \
-            do { \
-                int yyl;\
-                for ( yyl = n; yyl < yyleng; ++yyl )\
-                    if ( yytext[yyl] == '\n' )\
-                        --yylineno;\
-            }while(0)
-    #define YY_LINENO_REWIND_TO(dst) \
-            do {\
-                const char *p;\
-                for ( p = yy_cp-1; p >= (dst); --p)\
-                    if ( *p == '\n' )\
-                        --yylineno;\
-            }while(0)
-    
-/* Return all but the first "n" matched characters back to the input stream. */
-#define yyless(n) \
-	do \
-		{ \
-		/* Undo effects of setting up yytext. */ \
-        int yyless_macro_arg = (n); \
-        YY_LESS_LINENO(yyless_macro_arg);\
-		*yy_cp = yyg->yy_hold_char; \
-		YY_RESTORE_YY_MORE_OFFSET \
-		yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
-		YY_DO_BEFORE_ACTION; /* set up yytext again */ \
-		} \
-	while ( 0 )
-
-#define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner )
-
-#ifndef YY_STRUCT_YY_BUFFER_STATE
-#define YY_STRUCT_YY_BUFFER_STATE
-struct yy_buffer_state
-	{
-	FILE *yy_input_file;
-
-	char *yy_ch_buf;		/* input buffer */
-	char *yy_buf_pos;		/* current position in input buffer */
-
-	/* Size of input buffer in bytes, not including room for EOB
-	 * characters.
-	 */
-	yy_size_t yy_buf_size;
-
-	/* Number of characters read into yy_ch_buf, not including EOB
-	 * characters.
-	 */
-	yy_size_t yy_n_chars;
-
-	/* Whether we "own" the buffer - i.e., we know we created it,
-	 * and can realloc() it to grow it, and should free() it to
-	 * delete it.
-	 */
-	int yy_is_our_buffer;
-
-	/* Whether this is an "interactive" input source; if so, and
-	 * if we're using stdio for input, then we want to use getc()
-	 * instead of fread(), to make sure we stop fetching input after
-	 * each newline.
-	 */
-	int yy_is_interactive;
-
-	/* Whether we're considered to be at the beginning of a line.
-	 * If so, '^' rules will be active on the next match, otherwise
-	 * not.
-	 */
-	int yy_at_bol;
-
-    int yy_bs_lineno; /**< The line count. */
-    int yy_bs_column; /**< The column count. */
-    
-	/* Whether to try to fill the input buffer when we reach the
-	 * end of it.
-	 */
-	int yy_fill_buffer;
-
-	int yy_buffer_status;
-
-#define YY_BUFFER_NEW 0
-#define YY_BUFFER_NORMAL 1
-	/* When an EOF's been seen but there's still some text to process
-	 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
-	 * shouldn't try reading from the input source any more.  We might
-	 * still have a bunch of tokens to match, though, because of
-	 * possible backing-up.
-	 *
-	 * When we actually see the EOF, we change the status to "new"
-	 * (via quickstep_yyrestart()), so that the user can continue scanning by
-	 * just pointing yyin at a new input file.
-	 */
-#define YY_BUFFER_EOF_PENDING 2
-
-	};
-#endif /* !YY_STRUCT_YY_BUFFER_STATE */
-
-/* We provide macros for accessing buffer states in case in the
- * future we want to put the buffer states in a more general
- * "scanner state".
- *
- * Returns the top of the stack, or NULL.
- */
-#define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \
-                          ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \
-                          : NULL)
-
-/* Same as previous macro, but useful when we know that the buffer stack is not
- * NULL or when we need an lvalue. For internal use only.
- */
-#define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top]
-
-void quickstep_yyrestart (FILE *input_file ,yyscan_t yyscanner );
-void quickstep_yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
-YY_BUFFER_STATE quickstep_yy_create_buffer (FILE *file,int size ,yyscan_t yyscanner );
-void quickstep_yy_delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
-void quickstep_yy_flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
-void quickstep_yypush_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
-void quickstep_yypop_buffer_state (yyscan_t yyscanner );
-
-static void quickstep_yyensure_buffer_stack (yyscan_t yyscanner );
-static void quickstep_yy_load_buffer_state (yyscan_t yyscanner );
-static void quickstep_yy_init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanner );
-
-#define YY_FLUSH_BUFFER quickstep_yy_flush_buffer(YY_CURRENT_BUFFER ,yyscanner)
-
-YY_BUFFER_STATE quickstep_yy_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner );
-YY_BUFFER_STATE quickstep_yy_scan_string (yyconst char *yy_str ,yyscan_t yyscanner );
-YY_BUFFER_STATE quickstep_yy_scan_bytes (yyconst char *bytes,yy_size_t len ,yyscan_t yyscanner );
-
-void *quickstep_yyalloc (yy_size_t ,yyscan_t yyscanner );
-void *quickstep_yyrealloc (void *,yy_size_t ,yyscan_t yyscanner );
-void quickstep_yyfree (void * ,yyscan_t yyscanner );
-
-#define yy_new_buffer quickstep_yy_create_buffer
-
-#define yy_set_interactive(is_interactive) \
-	{ \
-	if ( ! YY_CURRENT_BUFFER ){ \
-        quickstep_yyensure_buffer_stack (yyscanner); \
-		YY_CURRENT_BUFFER_LVALUE =    \
-            quickstep_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \
-	} \
-	YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
-	}
-
-#define yy_set_bol(at_bol) \
-	{ \
-	if ( ! YY_CURRENT_BUFFER ){\
-        quickstep_yyensure_buffer_stack (yyscanner); \
-		YY_CURRENT_BUFFER_LVALUE =    \
-            quickstep_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \
-	} \
-	YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
-	}
-
-#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
-
-/* Begin user sect3 */
-
-#define quickstep_yywrap(yyscanner) (/*CONSTCOND*/1)
-#define YY_SKIP_YYWRAP
-
-typedef unsigned char YY_CHAR;
-
-typedef int yy_state_type;
-
-#define yytext_ptr yytext_r
-
-static yy_state_type yy_get_previous_state (yyscan_t yyscanner );
-static yy_state_type yy_try_NUL_trans (yy_state_type current_state  ,yyscan_t yyscanner);
-static int yy_get_next_buffer (yyscan_t yyscanner );
-#if defined(__GNUC__) && __GNUC__ >= 3
-__attribute__((__noreturn__))
-#endif
-static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner );
-
-/* Done after the current pattern has been matched and before the
- * corresponding action - sets up yytext.
- */
-#define YY_DO_BEFORE_ACTION \
-	yyg->yytext_ptr = yy_bp; \
-	yyleng = (size_t) (yy_cp - yy_bp); \
-	yyg->yy_hold_char = *yy_cp; \
-	*yy_cp = '\0'; \
-	yyg->yy_c_buf_p = yy_cp;
-
-#define YY_NUM_RULES 161
-#define YY_END_OF_BUFFER 162
-/* This struct is not used in this scanner,
-   but its presence is necessary. */
-struct yy_trans_info
-	{
-	flex_int32_t yy_verify;
-	flex_int32_t yy_nxt;
-	};
-static yyconst flex_int16_t yy_accept[593] =
-    {   0,
-        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-        0,    0,  162,    2,    2,  160,  160,  159,  158,  160,
-      137,  133,  136,  133,  133,  156,  129,  126,  130,  155,
-      155,  155,  155,  155,  155,  155,  155,  155,  155,  155,
-      155,  155,  155,  155,  155,  155,  155,  155,  155,  155,
-      155,  155,  155,  155,  134,    4,    5,    5,    3,  152,
-      152,  149,  153,  153,  147,  154,  154,  151,    1,  159,
-      127,  157,  156,  156,  156,    0,  131,  128,  132,  155,
-      155,  155,  155,   10,  155,  155,  155,   22,  155,  155,
-      155,  155,  155,  155,  155,  155,  155,  155,  155,  135,
-
-      155,  155,  155,  155,  155,  155,  155,  155,  155,  155,
-      155,  155,  155,   60,   68,  155,  155,  155,  155,  155,
-      155,  155,  155,  155,  155,  155,   82,   83,  155,  155,
-      155,  155,  155,  155,  155,  155,  155,  155,  155,  155,
-      155,  155,  155,  155,  155,  155,  155,  155,  155,  155,
-      155,  155,  155,    4,    5,    3,  152,  148,  153,  146,
-      146,  138,  140,  141,  142,  143,  144,  145,  146,  154,
-      150,  157,  156,    0,  156,    6,    7,  155,    9,   11,
-      155,  155,   15,  155,  155,  155,  155,  155,  155,  155,
-      155,  155,  155,  155,   33,  155,  155,  155,  155,  155,
-
-      155,  155,  155,   44,  155,  155,  155,  155,  155,  155,
-      155,   52,  155,  155,  155,  155,  155,  155,  155,  155,
-      155,   64,  155,   70,  155,  155,  155,  155,  155,  155,
-      155,   78,  155,   81,  155,  155,  155,  155,  155,  155,
-      155,  155,  155,  155,  155,  155,  155,   99,  155,  155,
-      104,  105,  155,  155,  155,  155,  155,  155,  155,  155,
-      155,  155,  155,  155,  155,  155,  155,  155,  138,  140,
-      139,  155,  155,  155,  155,  155,  155,  155,   20,   23,
-      155,  155,  155,   28,  155,  155,  155,   31,  155,  155,
-      155,  155,   38,  155,  155,   42,   43,  155,  155,  155,
-
-      155,  155,  155,  155,  155,   54,   55,  155,   57,  155,
-       59,  155,  155,  155,  155,   67,   69,   71,   72,   73,
-      155,   75,  155,  155,   79,  155,  155,   86,  155,  155,
-      155,  155,  155,   93,  155,   95,  155,  155,  155,  101,
-      155,  155,  155,  155,  155,  155,  109,  110,  112,  155,
-      155,  155,  155,  155,  155,  155,  120,  155,  155,  123,
-      124,  138,  139,    8,  155,  155,  155,  155,  155,  155,
-      155,   25,  155,  155,  155,  155,  155,  155,  155,  155,
-      155,  155,  155,  155,  155,  155,  155,  155,   48,   49,
-       50,  155,  155,   56,  155,   61,   62,  155,  155,  155,
-
-       74,  155,   77,   80,   84,   85,  155,  155,  155,  155,
-      155,   94,  155,  155,   98,  155,  155,  155,  155,  155,
-      108,  155,  155,  155,  155,  155,  117,  155,  155,  121,
-      155,  155,  155,  155,   14,  155,  155,  155,  155,  155,
-       26,  155,   29,  155,  155,  155,  155,  155,   36,  155,
-      155,  155,   41,  155,   46,  155,  155,  155,   58,   63,
-      155,  155,   76,  155,  155,  155,  155,  155,  155,   97,
-      155,  102,  103,  155,  155,  155,  155,  155,  115,  116,
-      118,  155,  122,  155,  155,   13,  155,  155,  155,  155,
-      155,  155,   21,   30,  155,   34,   35,  155,  155,  155,
-
-      155,   47,  155,   53,   65,  155,  155,   89,  155,   91,
-      155,  155,  155,  155,  155,  155,  155,  155,  119,  155,
-      155,  155,  155,  155,  155,  155,  155,   32,  155,  155,
-       40,  155,  155,   66,  155,  155,   92,  155,  155,  106,
-      155,  155,  155,  155,  155,   12,  155,  155,  155,  155,
-       24,  155,   37,  155,  155,   51,   87,   90,  155,  155,
-      107,  111,  155,  114,  125,   16,  155,  155,  155,   27,
-       39,  155,   88,   96,  155,  155,  155,   18,   19,  155,
-      155,  113,  155,  155,  155,  155,  155,  100,  155,   45,
-       17,    0
-
-    } ;
-
-static yyconst YY_CHAR yy_ec[256] =
-    {   0,
-        1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
-        1,    1,    4,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    2,    5,    6,    1,    1,    7,    1,    8,    7,
-        7,    7,    9,    7,   10,   11,    7,   12,   12,   12,
-       12,   12,   12,   12,   12,   13,   13,   14,    7,   15,
-       16,   17,    1,    1,   18,   19,   20,   21,   22,   23,
-       24,   25,   26,   27,   28,   29,   30,   31,   32,   33,
-       34,   35,   36,   37,   38,   39,   40,   41,   42,   43,
-       44,   45,   44,    1,   46,    1,   47,   48,   49,   50,
-
-       51,   52,   53,   54,   55,   56,   57,   58,   59,   60,
-       61,   62,   63,   64,   65,   66,   67,   68,   69,   70,
-       71,   43,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1
-    } ;
-
-static yyconst YY_CHAR yy_meta[72] =
-    {   0,
-        1,    1,    2,    1,    1,    3,    1,    4,    1,    5,
-        5,    6,    6,    5,    1,    1,    1,    7,    7,    7,
-        7,    7,    7,    8,    8,    8,    8,    8,    8,    8,
-        8,    8,    8,    8,    8,    8,    8,    8,    8,    8,
-        8,    8,    8,    1,    9,   10,    7,    7,    7,    7,
-        7,    7,    8,    8,    8,    8,    8,    8,    8,    8,
-        8,    8,    8,    8,    8,    8,    8,    8,    8,    8,
-        8
-    } ;
-
-static yyconst flex_uint16_t yy_base[608] =
-    {   0,
-        0,    1,   46,    0,  117,  163,    2,    3,  128,  132,
-        6,   10,  211, 1312, 1312,    0, 1312,   13, 1312,  194,
-     1312, 1312, 1312,  194,    6,  130,    4, 1312,  170,  124,
-      161,  215,  170,  207,  265,   92,  167,  162,   96,  107,
-      223,  165,  162,  221,  274,   92,  284,  277,  315,  206,
-      128,  232,    0,  125, 1312,  152,    4,   19,    0,    0,
-        0,  143,    0,    0,  379,    0,    0,  144,    0,   22,
-     1312,    0,  292,  305,  335,   18, 1312, 1312, 1312,    0,
-      174,  264,  180,  186,  209,  271,  229,    0,  277,  333,
-      335,  312,  330,  317,  323,  338,  323,  333,  340, 1312,
-
-      339,  355,  357,  381,  370,  373,  377,  382,  380,  384,
-      383,  383,  383,  431,    0,  398,  383,  390,  406,  402,
-      403,  404,  425,  420,  431,  442,    0,  445,  432,  448,
-      436,  437,  451,  448,  444,  460,  452,  439,  489,  464,
-      468,  469,  468,  462,  455,  477,  501,  493,  489,  494,
-      502,  494,  510,  142,   29,    0,    0, 1312,    0, 1312,
-     1312,   22,   24, 1312, 1312, 1312, 1312, 1312,    0,    0,
-     1312,    0,  520,   26,   28,    0,    0,  508,    0,  512,
-      495,  510,  497,  530,  518,  506,  525,  508,  512,  509,
-      543,  530,  533,  550,    0,  547,  558,  556,  561,  546,
-
-      565,  552,  564,    0,  569,  552,  554,  556,  557,  576,
-      566,  576,  569,  571,  565,  579,  580,  573,  587,  597,
-      598,  604,  594,    0,  593,  594,  612,  613,  616,  603,
-      605,    0,  614,    0,  622,  623,  611,  610,  630,  631,
-      626,  615,  629,  628,  639,  640,  639,  631,  634,  656,
-        0,  654,  648,  659,  658,  670,  672,  668,  666,  665,
-      682,  670,  664,  683,  673,  684,  681,  674,   30,  125,
-        0,  675,  680,  692,  684,  694,  691,  690,    0,  704,
-      696,  695,  699,    0,  704,  707,  724,  710,  720,  714,
-      718,  726,  735,  732,  730,    0,    0,  727,  724,  744,
-
-      741,  727,  729,  735,  742,    0,    0,  736,    0,  741,
-        0,  732,  739,  742,  759,    0,    0,    0,    0,    0,
-      741,    0,  743,  757,  763,  765,  769,    0,  779,  786,
-      788,  795,  779,    0,  793,    0,  781,  776,  781,    0,
-      798,  789,  801,  793,  787,  803,    0,  790,    0,  805,
-      792,  793,  795,  811,  814,  813,    0,  818,  809,    0,
-      822,  136, 1312,    0,  836,  836,  825,  845,  835,  843,
-      852,    0,  842,  839,  853,  854,  846,  852,  861,  851,
-      860,  857,  853,  854,  866,  867,  854,  873,    0,    0,
-        0,  854,  872,    0,  874,    0,    0,  862,  888,  876,
-
-        0,  894,    0,    0,    0,    0,  883,  890,  903,  891,
-      903,    0,  908,  898,    0,  910,  912,  897,  909,  901,
-        0,  900,  902,  909,  919,  920,    0,  907,  928,    0,
-      907,  916,  925,  921,    0,  915,  921,  939,  942,  936,
-        0,  956,    0,  956,  942,  952,  955,  950,    0,  951,
-      968,  970,    0,   93,    0,  954,  966,  962,    0,    0,
-      959,  977,    0,  970,  961,  973,  958,  964,  973,    0,
-      976,    0,    0,  975,  983,  992,  994,  993,    0,    0,
-        0,  980,    0,  995, 1000,    0, 1006, 1004, 1007, 1011,
-     1020, 1019,    0,    0, 1024,    0,    0, 1025, 1022, 1012,
-
-     1014,    0, 1020,    0,    0, 1023, 1021,    0, 1023,    0,
-     1014, 1037, 1032, 1022, 1031, 1033, 1034, 1045,    0, 1031,
-     1046, 1041, 1040, 1051, 1052, 1055, 1063,    0, 1060, 1067,
-        0, 1063, 1079,    0, 1073, 1081,    0, 1084, 1077,    0,
-     1084, 1076, 1077, 1090, 1087,    0, 1090, 1093, 1087, 1095,
-        0, 1083,    0, 1097, 1087,    0, 1089,    0, 1090, 1102,
-        0,    0, 1101,    0,    0,    0, 1096, 1120, 1112,    0,
-        0, 1122,    0,    0, 1115, 1131, 1119,    0,    0, 1127,
-     1139,    0, 1136, 1139, 1129, 1143, 1130,    0, 1131,    0,
-        0, 1312, 1196, 1206, 1216, 1226, 1236, 1240, 1243, 1249,
-
-     1257, 1267, 1277, 1287, 1297, 1302, 1304
-    } ;
-
-static yyconst flex_int16_t yy_def[608] =
-    {   0,
-      593,  593,  592,    3,  594,  594,  595,  595,  596,  596,
-      597,  597,  592,  592,  592,  598,  592,  592,  592,  592,
-      592,  592,  592,  592,  592,  592,  592,  592,  592,  599,
-      599,  599,  599,  599,  599,  599,  599,  599,  599,  599,
-      599,  599,  599,  599,  599,  599,  599,  599,  599,  599,
-      599,  599,  599,  599,  592,  592,  592,  592,  600,  601,
-      601,  592,  602,  602,  603,  604,  604,  592,  598,  592,
-      592,  605,  592,  592,  592,  592,  592,  592,  592,  599,
-      599,  599,  599,  599,  599,  599,  599,  599,  599,  599,
-      599,  599,  599,  599,  599,  599,  599,  599,  599,  592,
-
-      599,  599,  599,  599,  599,  599,  599,  599,  599,  599,
-      599,  599,  599,  599,  599,  599,  599,  599,  599,  599,
-      599,  599,  599,  599,  599,  599,  599,  599,  599,  599,
-      599,  599,  599,  599,  599,  599,  599,  599,  599,  599,
-      599,  599,  599,  599,  599,  599,  599,  599,  599,  599,
-      599,  599,  599,  592,  592,  600,  601,  592,  602,  592,
-      592,  592,  592,  592,  592,  592,  592,  592,  606,  604,
-      592,  605,  592,  592,  592,  599,  599,  599,  599,  599,
-      599,  599,  599,  599,  599,  599,  599,  599,  599,  599,
-      599,  599,  599,  599,  599,  599,  599,  599,  599,  599,
-
-      599,  599,  599,  599,  599,  599,  599,  599,  599,  599,
-      599,  599,  599,  599,  599,  599,  599,  599,  599,  599,
-      599,  599,  599,  599,  599,  599,  599,  599,  599,  599,
-      599,  599,  599,  599,  599,  599,  599,  599,  599,  599,
-      599,  599,  599,  599,  599,  599,  599,  599,  599,  599,
-      599,  599,  599,  599,  599,  599,  599,  599,  599,  599,
-      599,  599,  599,  599,  599,  599,  599,  599,  592,  592,
-      607,  599,  599,  599,  599,  599,  599,  599,  599,  599,
-      599,  599,  599,  599,  599,  599,  599,  599,  599,  599,
-      599,  599,  599,  599,  599,  599,  599,  599,  599,  599,
-
-      599,  599,  599,  599,  599,  599,  599,  599,  599,  599,
-      599,  599,  599,  599,  599,  599,  599,  599,  599,  599,
-      599,  599,  599,  599,  599,  599,  599,  599,  599,  599,
-      599,  599,  599,  599,  599,  599,  599,  599,  599,  599,
-      599,  599,  599,  599,  599,  599,  599,  599,  599,  599,
-      599,  599,  599,  599,  599,  599,  599,  599,  599,  599,
-      599,  592,  592,  599,  599,  599,  599,  599,  599,  599,
-      599,  599,  599,  599,  599,  599,  599,  599,  599,  599,
-      599,  599,  599,  599,  599,  599,  599,  599,  599,  599,
-      599,  599,  599,  599,  599,  599,  599,  599,  599,  599,
-
-      599,  599,  599,  599,  599,  599,  599,  599,  599,  599,
-      599,  599,  599,  599,  599,  599,  599,  599,  599,  599,
-      599,  599,  599,  599,  599,  599,  599,  599,  599,  599,
-      599,  599,  599,  599,  599,  599,  599,  599,  599,  599,
-      599,  599,  599,  599,  599,  599,  599,  599,  599,  599,
-      599,  599,  599,  599,  599,  599,  599,  599,  599,  599,
-      599,  599,  599,  599,  599,  599,  599,  599,  599,  599,
-      599,  599,  599,  599,  599,  599,  599,  599,  599,  599,
-      599,  599,  599,  599,  599,  599,  599,  599,  599,  599,
-      599,  599,  599,  599,  599,  599,  599,  599,  599,  599,
-
-      599,  599,  599,  599,  599,  599,  599,  599,  599,  599,
-      599,  599,  599,  599,  599,  599,  599,  599,  599,  599,
-      599,  599,  599,  599,  599,  599,  599,  599,  599,  599,
-      599,  599,  599,  599,  599,  599,  599,  599,  599,  599,
-      599,  599,  599,  599,  599,  599,  599,  599,  599,  599,
-      599,  599,  599,  599,  599,  599,  599,  599,  599,  599,
-      599,  599,  599,  599,  599,  599,  599,  599,  599,  599,
-      599,  599,  599,  599,  599,  599,  599,  599,  599,  599,
-      599,  599,  599,  599,  599,  599,  599,  599,  599,  599,
-      599,    0,  592,  592,  592,  592,  592,  592,  592,  592,
-
-      592,  592,  592,  592,  592,  592,  592
-    } ;
-
-static yyconst flex_uint16_t yy_nxt[1384] =
-    {   0,
-      592,  592,   15,   15,   61,   61,  155,  155,   67,   62,
-       62,   68,   67,  592,   70,   68,   70,   73,   73,   77,
-       78,  155,  155,   70,  592,   70,  174,  174,  592,  175,
-      175,  155,  155,  269,  270,  270,  270,  175,  175,  175,
-      175,  362,  270,  592,   16,   16,   17,   18,   19,   18,
-       20,   21,   22,   23,   22,   24,   25,   26,   26,   17,
-       27,   28,   29,   30,   31,   32,   33,   34,   35,   36,
-       37,   38,   39,   40,   41,   42,   43,   44,   45,   46,
-       47,   48,   49,   50,   51,   52,   53,   54,   53,   55,
-       17,   17,   30,   31,   32,   33,   34,   35,   36,   37,
-
-       38,   39,   40,   41,   42,   43,   44,   45,   46,   47,
-       48,   49,   50,   51,   52,   53,   54,   17,   56,   57,
-       58,   17,   17,   17,   17,   17,  111,  116,  117,  134,
-       64,   17,   17,   17,   64,   62,  270,  270,  501,   62,
-       74,   75,   75,  154,   81,  150,  153,  270,  270,  171,
-      158,   76,   82,  154,   83,  111,  116,  117,  134,   84,
-       17,   17,   17,   17,   56,   57,   58,   17,   17,   17,
-       17,   17,   65,   81,  150,  153,   65,   17,   17,   17,
-       76,   82,   85,   83,  112,   79,   86,   95,   84,   87,
-      122,   96,  114,  124,  176,   97,  123,  115,  113,  125,
-
-      179,   98,   88,   72,   99,  180,   17,   17,   17,   71,
-      592,   85,  592,  112,  100,   86,   95,  592,   87,  122,
-       96,  114,  124,  176,   97,  123,  115,  113,  125,  179,
-       98,   88,   89,   99,  180,  101,  147,  102,  148,   90,
-      118,  149,  103,  126,  119,  181,   91,  104,  120,   92,
-       93,  127,   94,  592,  121,  128,  151,  152,  129,  130,
-      184,   89,  592,  592,  101,  147,  102,  148,   90,  118,
-      149,  103,  126,  119,  181,   91,  104,  120,   92,   93,
-      127,   94,  105,  121,  128,  151,  152,  129,  130,  184,
-      106,  131,  177,  107,  182,  132,  108,  592,  139,  109,
-
-      178,  135,  110,   73,   73,  136,  140,  183,  133,  137,
-      592,  105,  185,   76,  141,  138,  173,  173,  592,  106,
-      131,  177,  107,  182,  132,  108,   76,  139,  109,  178,
-      135,  110,  142,  191,  136,  140,  183,  133,  137,  143,
-      144,  185,   76,  141,  138,   74,   75,   75,  192,  145,
-      186,  193,  146,  592,  187,   76,   76,  196,  200,  194,
-      197,  142,  191,  188,  195,  189,  198,  190,  143,  144,
-      201,  202,  592,  199,  203,  204,  205,  192,  145,  186,
-      193,  146,  161,  187,  592,   76,  196,  200,  194,  197,
-      162,  163,  188,  195,  189,  198,  190,  164,  208,  201,
-
-      202,  165,  199,  203,  204,  205,  206,  209,  210,  166,
-      211,  213,  214,  167,  215,  168,  212,  207,  216,  169,
-      218,  217,  592,  223,  224,  225,  164,  208,  226,  227,
-      165,  228,  592,  229,  230,  206,  209,  210,  166,  211,
-      213,  214,  167,  215,  168,  212,  207,  216,  169,  218,
-      217,  219,  223,  224,  225,  231,  232,  226,  227,  233,
-      228,  220,  229,  230,  234,  235,  221,  222,  236,  237,
-      238,  239,  240,  242,  243,  247,  241,  244,  248,  592,
-      219,  252,  245,  246,  231,  232,  253,  254,  233,  255,
-      220,  256,  257,  234,  235,  221,  222,  236,  237,  238,
-
-      239,  240,  242,  243,  247,  241,  244,  248,  249,  258,
-      252,  245,  246,  261,  262,  253,  254,  250,  255,  259,
-      256,  257,  263,  265,  266,  251,  260,  268,  264,  272,
-      267,  173,  173,  273,  274,  275,  276,  249,  258,  279,
-      280,   76,  261,  262,  281,  282,  250,  283,  259,  277,
-      284,  263,  265,  266,  251,  260,  268,  264,  272,  267,
-      285,  278,  273,  274,  275,  276,  286,  287,  279,  280,
-       76,  288,  289,  281,  282,  290,  283,  291,  277,  284,
-      293,  292,  294,  295,  296,  297,  298,  299,  300,  285,
-      278,  301,  302,  303,  304,  286,  287,  305,  306,  307,
-
-      288,  289,  308,  309,  290,  310,  291,  311,  312,  293,
-      292,  294,  295,  296,  297,  298,  299,  300,  313,  314,
-      301,  302,  303,  304,  317,  315,  305,  306,  307,  318,
-      319,  308,  309,  320,  310,  316,  311,  312,  321,  322,
-      323,  324,  325,  326,  327,  328,  329,  313,  314,  330,
-      331,  334,  335,  317,  315,  332,  336,  333,  318,  319,
-      337,  338,  320,  339,  316,  342,  340,  321,  322,  323,
-      324,  325,  326,  327,  328,  329,  341,  343,  330,  331,
-      334,  335,  344,  345,  332,  336,  333,  346,  347,  337,
-      338,  348,  339,  349,  342,  340,  350,  351,  352,  353,
-
-      354,  355,  356,  357,  359,  360,  343,  358,  361,  364,
-      365,  344,  345,  366,  367,  368,  346,  347,  369,  370,
-      348,  371,  349,  372,  373,  350,  351,  352,  353,  354,
-      355,  356,  357,  359,  360,  374,  358,  361,  364,  365,
-      375,  376,  366,  367,  368,  377,  378,  369,  370,  379,
-      371,  380,  372,  373,  381,  382,  383,  384,  385,  386,
-      387,  388,  389,  390,  374,  391,  392,  393,  394,  375,
-      376,  395,  396,  397,  377,  378,  398,  401,  379,  402,
-      380,  403,  399,  381,  382,  383,  384,  385,  386,  387,
-      388,  389,  390,  400,  391,  392,  393,  394,  404,  405,
-
-      395,  396,  397,  406,  407,  398,  401,  408,  402,  409,
-      403,  399,  410,  411,  412,  413,  414,  415,  416,  417,
-      418,  419,  400,  420,  421,  422,  423,  404,  405,  424,
-      425,  426,  406,  407,  427,  428,  408,  429,  409,  430,
-      431,  410,  411,  412,  413,  414,  415,  416,  417,  418,
-      419,  432,  420,  421,  422,  423,  433,  434,  424,  425,
-      426,  435,  436,  427,  428,  439,  429,  437,  430,  431,
-      438,  440,  441,  442,  443,  444,  445,  446,  447,  448,
-      432,  449,  450,  451,  452,  433,  434,  453,  454,  455,
-      435,  436,  456,  457,  439,  458,  437,  459,  460,  438,
-
-      440,  441,  442,  443,  444,  445,  446,  447,  448,  461,
-      449,  450,  451,  452,  462,  463,  453,  454,  455,  464,
-      465,  456,  457,  466,  458,  467,  459,  460,  468,  469,
-      470,  471,  472,  473,  474,  475,  476,  477,  461,  478,
-      479,  480,  481,  462,  463,  482,  483,  484,  464,  465,
-      485,  486,  466,  487,  467,  488,  489,  468,  469,  470,
-      471,  472,  473,  474,  475,  476,  477,  490,  478,  479,
-      480,  481,  491,  492,  482,  483,  484,  493,  494,  485,
-      486,  495,  487,  496,  488,  489,  497,  498,  499,  500,
-      502,  503,  504,  505,  506,  507,  490,  508,  509,  510,
-
-      511,  491,  492,  512,  513,  514,  493,  494,  515,  516,
-      495,  517,  496,  518,  519,  497,  498,  499,  500,  502,
-      503,  504,  505,  506,  507,  520,  508,  509,  510,  511,
-      521,  522,  512,  513,  514,  523,  524,  515,  516,  525,
-      517,  526,  518,  519,  527,  528,  529,  530,  531,  532,
-      533,  534,  535,  536,  520,  537,  538,  539,  540,  521,
-      522,  541,  542,  543,  523,  524,  544,  545,  525,  546,
-      526,  547,  548,  527,  528,  529,  530,  531,  532,  533,
-      534,  535,  536,  549,  537,  538,  539,  540,  550,  551,
-      541,  542,  543,  552,  553,  544,  545,  554,  546,  555,
-
-      547,  548,  556,  557,  558,  559,  560,  561,  562,  563,
-      564,  565,  549,  566,  567,  568,  569,  550,  551,  570,
-      571,  572,  552,  553,  573,  574,  554,  575,  555,  576,
-      577,  556,  557,  558,  559,  560,  561,  562,  563,  564,
-      565,  578,  566,  567,  568,  569,  579,  580,  570,  571,
-      572,  581,  582,  573,  574,  583,  575,  584,  576,  577,
-      585,  586,  587,  588,  589,  590,  591,  592,  592,  592,
-      578,  592,  592,  592,  592,  579,  580,  592,  592,  592,
-      581,  582,  592,  592,  583,  592,  584,  592,  592,  585,
-      586,  587,  588,  589,  590,  591,   14,   14,   14,   14,
-
-       14,   14,   14,   14,   14,   14,   59,   59,   59,   59,
-       59,   59,   59,   59,   59,   59,   60,   60,   60,   60,
-       60,   60,   60,   60,   60,   60,   63,   63,   63,   63,
-       63,   63,   63,   63,   63,   63,   66,   66,   66,   66,
-       66,   66,   66,   66,   66,   66,   69,   69,   80,   80,
-       80,  592,   80,  156,  156,  156,  156,  157,  157,  157,
-      592,  157,  157,  157,  157,  157,  157,  159,  159,  159,
-      592,  159,  159,  159,  159,  592,  159,  160,  160,  160,
-      160,  160,  160,  160,  160,  160,  160,  170,  170,  592,
-      170,  170,  170,  170,  170,  170,  170,  172,  592,  172,
-
-      172,  172,  172,  172,  172,  172,  172,  271,  271,  363,
-      363,   13,  592,  592,  592,  592,  592,  592,  592,  592,
-      592,  592,  592,  592,  592,  592,  592,  592,  592,  592,
-      592,  592,  592,  592,  592,  592,  592,  592,  592,  592,
-      592,  592,  592,  592,  592,  592,  592,  592,  592,  592,
-      592,  592,  592,  592,  592,  592,  592,  592,  592,  592,
-      592,  592,  592,  592,  592,  592,  592,  592,  592,  592,
-      592,  592,  592,  592,  592,  592,  592,  592,  592,  592,
-      592,  592,  592
-    } ;
-
-static yyconst flex_int16_t yy_chk[1384] =
-    {   0,
-        0,    0,    1,    2,    7,    8,   57,   57,   11,    7,
-        8,   11,   12,    0,   18,   12,   18,   25,   25,   27,
-       27,   58,   58,   70,    0,   70,   76,   76,    0,   76,
-       76,  155,  155,  162,  162,  163,  163,  174,  174,  175,
-      175,  269,  269,    0,    1,    2,    3,    3,    3,    3,
-        3,    3,    3,    3,    3,    3,    3,    3,    3,    3,
-        3,    3,    3,    3,    3,    3,    3,    3,    3,    3,
-        3,    3,    3,    3,    3,    3,    3,    3,    3,    3,
-        3,    3,    3,    3,    3,    3,    3,    3,    3,    3,
-        3,    3,    3,    3,    3,    3,    3,    3,    3,    3,
-
-        3,    3,    3,    3,    3,    3,    3,    3,    3,    3,
-        3,    3,    3,    3,    3,    3,    3,    5,    5,    5,
-        5,    5,    5,    5,    5,    5,   36,   39,   40,   46,
-        9,    5,    5,    5,   10,    9,  270,  270,  454,   10,
-       26,   26,   26,  154,   30,   51,   54,  362,  362,   68,
-       62,   26,   30,   56,   30,   36,   39,   40,   46,   30,
-        5,    5,    5,    6,    6,    6,    6,    6,    6,    6,
-        6,    6,    9,   30,   51,   54,   10,    6,    6,    6,
-       26,   30,   31,   30,   37,   29,   31,   33,   30,   31,
-       42,   33,   38,   43,   81,   33,   42,   38,   37,   43,
-
-       83,   33,   31,   24,   33,   84,    6,    6,    6,   20,
-       13,   31,    0,   37,   34,   31,   33,    0,   31,   42,
-       33,   38,   43,   81,   33,   42,   38,   37,   43,   83,
-       33,   31,   32,   33,   84,   34,   50,   34,   50,   32,
-       41,   50,   34,   44,   41,   85,   32,   34,   41,   32,
-       32,   44,   32,    0,   41,   44,   52,   52,   44,   44,
-       87,   32,    0,    0,   34,   50,   34,   50,   32,   41,
-       50,   34,   44,   41,   85,   32,   34,   41,   32,   32,
-       44,   32,   35,   41,   44,   52,   52,   44,   44,   87,
-       35,   45,   82,   35,   86,   45,   35,    0,   48,   35,
-
-       82,   47,   35,   73,   73,   47,   48,   86,   45,   47,
-        0,   35,   89,   73,   48,   47,   74,   74,    0,   35,
-       45,   82,   35,   86,   45,   35,   74,   48,   35,   82,
-       47,   35,   49,   92,   47,   48,   86,   45,   47,   49,
-       49,   89,   73,   48,   47,   75,   75,   75,   93,   49,
-       90,   94,   49,    0,   90,   74,   75,   96,   97,   95,
-       96,   49,   92,   91,   95,   91,   96,   91,   49,   49,
-       98,   99,    0,   96,  101,  102,  103,   93,   49,   90,
-       94,   49,   65,   90,    0,   75,   96,   97,   95,   96,
-       65,   65,   91,   95,   91,   96,   91,   65,  105,   98,
-
-       99,   65,   96,  101,  102,  103,  104,  106,  107,   65,
-      108,  109,  110,   65,  111,   65,  108,  104,  112,   65,
-      113,  112,    0,  116,  117,  118,   65,  105,  119,  120,
-       65,  120,    0,  121,  122,  104,  106,  107,   65,  108,
-      109,  110,   65,  111,   65,  108,  104,  112,   65,  113,
-      112,  114,  116,  117,  118,  123,  124,  119,  120,  125,
-      120,  114,  121,  122,  126,  128,  114,  114,  129,  130,
-      131,  132,  133,  134,  135,  137,  133,  136,  138,    0,
-      114,  140,  136,  136,  123,  124,  141,  142,  125,  143,
-      114,  144,  145,  126,  128,  114,  114,  129,  130,  131,
-
-      132,  133,  134,  135,  137,  133,  136,  138,  139,  146,
-      140,  136,  136,  148,  149,  141,  142,  139,  143,  147,
-      144,  145,  150,  151,  152,  139,  147,  153,  150,  178,
-      152,  173,  173,  180,  181,  182,  183,  139,  146,  185,
-      186,  173,  148,  149,  187,  188,  139,  189,  147,  184,
-      190,  150,  151,  152,  139,  147,  153,  150,  178,  152,
-      191,  184,  180,  181,  182,  183,  192,  193,  185,  186,
-      173,  194,  196,  187,  188,  197,  189,  198,  184,  190,
-      199,  198,  200,  201,  202,  203,  205,  206,  207,  191,
-      184,  208,  209,  210,  211,  192,  193,  212,  213,  214,
-
-      194,  196,  215,  216,  197,  217,  198,  218,  219,  199,
-      198,  200,  201,  202,  203,  205,  206,  207,  220,  221,
-      208,  209,  210,  211,  223,  222,  212,  213,  214,  225,
-      226,  215,  216,  227,  217,  222,  218,  219,  228,  229,
-      230,  231,  233,  235,  236,  237,  238,  220,  221,  239,
-      240,  242,  243,  223,  222,  241,  244,  241,  225,  226,
-      245,  246,  227,  247,  222,  249,  248,  228,  229,  230,
-      231,  233,  235,  236,  237,  238,  248,  250,  239,  240,
-      242,  243,  252,  253,  241,  244,  241,  254,  255,  245,
-      246,  256,  247,  257,  249,  248,  258,  259,  260,  261,
-
-      262,  263,  264,  265,  266,  267,  250,  265,  268,  272,
-      273,  252,  253,  274,  275,  276,  254,  255,  277,  278,
-      256,  280,  257,  281,  282,  258,  259,  260,  261,  262,
-      263,  264,  265,  266,  267,  283,  265,  268,  272,  273,
-      285,  286,  274,  275,  276,  287,  288,  277,  278,  289,
-      280,  290,  281,  282,  291,  292,  293,  294,  295,  298,
-      299,  300,  301,  302,  283,  303,  304,  305,  308,  285,
-      286,  310,  312,  313,  287,  288,  314,  321,  289,  323,
-      290,  324,  315,  291,  292,  293,  294,  295,  298,  299,
-      300,  301,  302,  315,  303,  304,  305,  308,  325,  326,
-
-      310,  312,  313,  327,  329,  314,  321,  330,  323,  331,
-      324,  315,  332,  333,  335,  337,  338,  339,  341,  342,
-      343,  344,  315,  345,  346,  348,  350,  325,  326,  351,
-      352,  353,  327,  329,  354,  355,  330,  356,  331,  358,
-      359,  332,  333,  335,  337,  338,  339,  341,  342,  343,
-      344,  361,  345,  346,  348,  350,  365,  366,  351,  352,
-      353,  367,  368,  354,  355,  370,  356,  369,  358,  359,
-      369,  371,  373,  374,  375,  376,  377,  378,  379,  380,
-      361,  381,  382,  383,  384,  365,  366,  385,  386,  387,
-      367,  368,  388,  392,  370,  393,  369,  395,  398,  369,
-
-      371,  373,  374,  375,  376,  377,  378,  379,  380,  399,
-      381,  382,  383,  384,  400,  402,  385,  386,  387,  407,
-      408,  388,  392,  409,  393,  410,  395,  398,  411,  413,
-      414,  416,  417,  418,  419,  420,  422,  423,  399,  424,
-      425,  426,  428,  400,  402,  429,  431,  432,  407,  408,
-      433,  434,  409,  436,  410,  437,  438,  411,  413,  414,
-      416,  417,  418,  419,  420,  422,  423,  439,  424,  425,
-      426,  428,  440,  442,  429,  431,  432,  444,  445,  433,
-      434,  446,  436,  447,  437,  438,  448,  450,  451,  452,
-      456,  457,  458,  461,  462,  464,  439,  465,  466,  467,
-
-      468,  440,  442,  469,  471,  474,  444,  445,  475,  476,
-      446,  477,  447,  478,  482,  448,  450,  451,  452,  456,
-      457,  458,  461,  462,  464,  484,  465,  466,  467,  468,
-      485,  487,  469,  471,  474,  488,  489,  475,  476,  490,
-      477,  491,  478,  482,  492,  495,  498,  499,  500,  501,
-      503,  506,  507,  509,  484,  511,  512,  513,  514,  485,
-      487,  515,  516,  517,  488,  489,  518,  520,  490,  521,
-      491,  522,  523,  492,  495,  498,  499,  500,  501,  503,
-      506,  507,  509,  524,  511,  512,  513,  514,  525,  526,
-      515,  516,  517,  527,  529,  518,  520,  530,  521,  532,
-
-      522,  523,  533,  535,  536,  538,  539,  541,  542,  543,
-      544,  545,  524,  547,  548,  549,  550,  525,  526,  552,
-      554,  555,  527,  529,  557,  559,  530,  560,  532,  563,
-      567,  533,  535,  536,  538,  539,  541,  542,  543,  544,
-      545,  568,  547,  548,  549,  550,  569,  572,  552,  554,
-      555,  575,  576,  557,  559,  577,  560,  580,  563,  567,
-      581,  583,  584,  585,  586,  587,  589,    0,    0,    0,
-      568,    0,    0,    0,    0,  569,  572,    0,    0,    0,
-      575,  576,    0,    0,  577,    0,  580,    0,    0,  581,
-      583,  584,  585,  586,  587,  589,  593,  593,  593,  593,
-
-      593,  593,  593,  593,  593,  593,  594,  594,  594,  594,
-      594,  594,  594,  594,  594,  594,  595,  595,  595,  595,
-      595,  595,  595,  595,  595,  595,  596,  596,  596,  596,
-      596,  596,  596,  596,  596,  596,  597,  597,  597,  597,
-      597,  597,  597,  597,  597,  597,  598,  598,  599,  599,
-      599,    0,  599,  600,  600,  600,  600,  601,  601,  601,
-        0,  601,  601,  601,  601,  601,  601,  602,  602,  602,
-        0,  602,  602,  602,  602,    0,  602,  603,  603,  603,
-      603,  603,  603,  603,  603,  603,  603,  604,  604,    0,
-      604,  604,  604,  604,  604,  604,  604,  605,    0,  605,
-
-      605,  605,  605,  605,  605,  605,  605,  606,  606,  607,
-      607,  592,  592,  592,  592,  592,  592,  592,  592,  592,
-      592,  592,  592,  592,  592,  592,  592,  592,  592,  592,
-      592,  592,  592,  592,  592,  592,  592,  592,  592,  592,
-      592,  592,  592,  592,  592,  592,  592,  592,  592,  592,
-      592,  592,  592,  592,  592,  592,  592,  592,  592,  592,
-      592,  592,  592,  592,  592,  592,  592,  592,  592,  592,
-      592,  592,  592,  592,  592,  592,  592,  592,  592,  592,
-      592,  592,  592
-    } ;
-
-/* Table of booleans, true if rule could match eol. */
-static yyconst flex_int32_t yy_rule_can_match_eol[162] =
-    {   0,
-0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
-    0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 
-    0, 0,     };
-
-/* The intent behind this definition is that it'll catch
- * any uses of REJECT which flex missed.
- */
-#define REJECT reject_used_but_not_detected
-#define yymore() yymore_used_but_not_detected
-#define YY_MORE_ADJ 0
-#define YY_RESTORE_YY_MORE_OFFSET
-#line 1 "../SqlLexer.lpp"
-/**
- * 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.
- **/
-#define YY_NO_INPUT 1
-#define YY_NO_UNISTD_H 1
-#line 29 "../SqlLexer.lpp"
-#include <cstdio>
-#include <string>
-#include <vector>
-
-#include "parser/ParseJoinedTableReference.hpp"
-#include "parser/ParseLiteralValue.hpp"
-#include "utility/PtrList.hpp"
-#include "utility/PtrVector.hpp"
-
-namespace quickstep {
-
-class BinaryOperation;
-class Comparison;
-class ParseAssignment;
-class ParseAttribute;
-class ParseAttributeDefinition;
-class ParseBlockProperties;
-class ParseColumnConstraint;
-class ParseCommand;
-struct ParseCopyFromParams;
-class ParseDataType;
-class ParseExpression;
-struct ParseFrameInfo;
-class ParseFunctionCall;
-class ParseGroupBy;
-class ParseHaving;
-class ParseKeyIntegerValue;
-class ParseKeyStringValue;
-class ParseKeyStringList;
-class ParseKeyValue;
-class ParseLimit;
-class ParseOrderBy;
-class ParseOrderByItem;
-class ParsePartitionClause;
-class ParsePredicate;
-class ParsePriority;
-class ParseSample;
-class ParseScalarLiteral;
-class ParseSearchedWhenClause;
-class ParseSelect;
-class ParseSelectionClause;
-class ParseSelectionItem;
-class ParseSelectionItemScalar;
-class ParseSelectionList;
-class ParseSimpleTableReference;
-class ParseSimpleWhenClause;
-class ParseStringKeyLiteralValues;
-class ParseStatement;
-class ParseStatementCopyFrom;
-class ParseStatementCreateTable;
-class ParseStatementDelete;
-class ParseStatementDropTable;
-class ParseStatementInsert;
-class ParseStatementInsertTuple;
-class ParseStatementInsertSelection;
-class ParseStatementSelect;
-class ParseStatementQuit;
-class ParseStatementUpdate;
-class ParseSubqueryExpression;
-class ParseSubqueryTableReference;
-class ParseTableReference;
-class ParseTableReferenceSignature;
-class ParseWindow;
-class Type;
-class UnaryOperation;
-
-}  // namespace quickstep
-
-#include "parser/ParseString.hpp"
-#include "parser/SqlParser_gen.hpp"
-#include "parser/ParserUtil.hpp"
-
-#define YY_USER_ACTION                                    \
-  {                                                       \
-    yylloc->first_line = yylineno;                        \
-    yylloc->first_column = yycolumn;                      \
-    yycolumn += yyleng;                                   \
-  }
-
-/* FIXME(chasseur, qzeng): Add support for hexadecimal literals. */
-/**
- * These patterns are based on the SQL-2011 standard for syntax of numeric
- * literals (Part 2, Section 5.3 of the standard).
- **/
-
-
-
-
-
-#line 1093 "SqlLexer_gen.cpp"
-
-#define INITIAL 0
-#define CONDITION_SQL 1
-#define CONDITION_COMMAND 2
-#define CONDITION_STRING_SINGLE_QUOTED 3
-#define CONDITION_STRING_SINGLE_QUOTED_ESCAPED 4
-#define CONDITION_STRING_DOUBLE_QUOTED 5
-
-#ifndef YY_NO_UNISTD_H
-/* Special case for "unistd.h", since it is non-ANSI. We include it way
- * down here because we want the user's section 1 to have been scanned first.
- * The user has a chance to override it with an option.
- */
-#include <unistd.h>
-#endif
-
-#ifndef YY_EXTRA_TYPE
-#define YY_EXTRA_TYPE void *
-#endif
-
-/* Holds the entire state of the reentrant scanner. */
-struct yyguts_t
-    {
-
-    /* User-defined. Not touched by flex. */
-    YY_EXTRA_TYPE yyextra_r;
-
-    /* The rest are the same as the globals declared in the non-reentrant scanner. */
-    FILE *yyin_r, *yyout_r;
-    size_t yy_buffer_stack_top; /**< index of top of stack. */
-    size_t yy_buffer_stack_max; /**< capacity of stack. */
-    YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */
-    char yy_hold_char;
-    yy_size_t yy_n_chars;
-    yy_size_t yyleng_r;
-    char *yy_c_buf_p;
-    int yy_init;
-    int yy_start;
-    int yy_did_buffer_switch_on_eof;
-    int yy_start_stack_ptr;
-    int yy_start_stack_depth;
-    int *yy_start_stack;
-    yy_state_type yy_last_accepting_state;
-    char* yy_last_accepting_cpos;
-
-    int yylineno_r;
-    int yy_flex_debug_r;
-
-    char *yytext_r;
-    int yy_more_flag;
-    int yy_more_len;
-
-    YYSTYPE * yylval_r;
-
-    YYLTYPE * yylloc_r;
-
-    }; /* end struct yyguts_t */
-
-static int yy_init_globals (yyscan_t yyscanner );
-
-    /* This must go here because YYSTYPE and YYLTYPE are included
-     * from bison output in section 1.*/
-    #    define yylval yyg->yylval_r
-    
-    #    define yylloc yyg->yylloc_r
-    
-int quickstep_yylex_init (yyscan_t* scanner);
-
-int quickstep_yylex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner);
-
-/* Accessor methods to globals.
-   These are made visible to non-reentrant scanners for convenience. */
-
-int quickstep_yylex_destroy (yyscan_t yyscanner );
-
-int quickstep_yyget_debug (yyscan_t yyscanner );
-
-void quickstep_yyset_debug (int debug_flag ,yyscan_t yyscanner );
-
-YY_EXTRA_TYPE quickstep_yyget_extra (yyscan_t yyscanner );
-
-void quickstep_yyset_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner );
-
-FILE *quickstep_yyget_in (yyscan_t yyscanner );
-
-void quickstep_yyset_in  (FILE * _in_str ,yyscan_t yyscanner );
-
-FILE *quickstep_yyget_out (yyscan_t yyscanner );
-
-void quickstep_yyset_out  (FILE * _out_str ,yyscan_t yyscanner );
-
-yy_size_t quickstep_yyget_leng (yyscan_t yyscanner );
-
-char *quickstep_yyget_text (yyscan_t yyscanner );
-
-int quickstep_yyget_lineno (yyscan_t yyscanner );
-
-void quickstep_yyset_lineno (int _line_number ,yyscan_t yyscanner );
-
-int quickstep_yyget_column  (yyscan_t yyscanner );
-
-void quickstep_yyset_column (int _column_no ,yyscan_t yyscanner );
-
-YYSTYPE * quickstep_yyget_lval (yyscan_t yyscanner );
-
-void quickstep_yyset_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner );
-
-       YYLTYPE *quickstep_yyget_lloc (yyscan_t yyscanner );
-    
-        void quickstep_yyset_lloc (YYLTYPE * yylloc_param ,yyscan_t yyscanner );
-    
-/* Macros after this point can all be overridden by user definitions in
- * section 1.
- */
-
-#ifndef YY_SKIP_YYWRAP
-#ifdef __cplusplus
-extern "C" int quickstep_yywrap (yyscan_t yyscanner );
-#else
-extern int quickstep_yywrap (yyscan_t yyscanner );
-#endif
-#endif
-
-#ifndef YY_NO_UNPUT
-    
-#endif
-
-#ifndef yytext_ptr
-static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner);
-#endif
-
-#ifdef YY_NEED_STRLEN
-static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner);
-#endif
-
-#ifndef YY_NO_INPUT
-
-#ifdef __cplusplus
-static int yyinput (yyscan_t yyscanner );
-#else
-static int input (yyscan_t yyscanner );
-#endif
-
-#endif
-
-/* Amount of stuff to slurp up with each read. */
-#ifndef YY_READ_BUF_SIZE
-#ifdef __ia64__
-/* On IA-64, the buffer size is 16k, not 8k */
-#define YY_READ_BUF_SIZE 16384
-#else
-#define YY_READ_BUF_SIZE 8192
-#endif /* __ia64__ */
-#endif
-
-/* Copy whatever the last rule matched to the standard output. */
-#ifndef ECHO
-/* This used to be an fputs(), but since the string might contain NUL's,
- * we now use fwrite().
- */
-#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
-#endif
-
-/* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
- * is returned in "result".
- */
-#ifndef YY_INPUT
-#define YY_INPUT(buf,result,max_size) \
-	if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
-		{ \
-		int c = '*'; \
-		size_t n; \
-		for ( n = 0; n < max_size && \
-			     (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
-			buf[n] = (char) c; \
-		if ( c == '\n' ) \
-			buf[n++] = (char) c; \
-		if ( c == EOF && ferror( yyin ) ) \
-			YY_FATAL_ERROR( "input in flex scanner failed" ); \
-		result = n; \
-		} \
-	else \
-		{ \
-		errno=0; \
-		while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
-			{ \
-			if( errno != EINTR) \
-				{ \
-				YY_FATAL_ERROR( "input in flex scanner failed" ); \
-				break; \
-				} \
-			errno=0; \
-			clearerr(yyin); \
-			} \
-		}\
-\
-
-#endif
-
-/* No semi-colon after return; correct usage is to write "yyterminate();" -
- * we don't want an extra ';' after the "return" because that will cause
- * some compilers to complain about unreachable statements.
- */
-#ifndef yyterminate
-#define yyterminate() return YY_NULL
-#endif
-
-/* Number of entries by which start-condition stack grows. */
-#ifndef YY_START_STACK_INCR
-#define YY_START_STACK_INCR 25
-#endif
-
-/* Report a fatal error. */
-#ifndef YY_FATAL_ERROR
-#define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner)
-#endif
-
-/* end tables serialization structures and prototypes */
-
-/* Default declaration of generated scanner - a define so the user can
- * easily add parameters.
- */
-#ifndef YY_DECL
-#define YY_DECL_IS_OURS 1
-
-extern int quickstep_yylex \
-               (YYSTYPE * yylval_param,YYLTYPE * yylloc_param ,yyscan_t yyscanner);
-
-#define YY_DECL int quickstep_yylex \
-               (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner)
-#endif /* !YY_DECL */
-
-/* Code executed at the beginning of each rule, after yytext and yyleng
- * have been set up.
- */
-#ifndef YY_USER_ACTION
-#define YY_USER_ACTION
-#endif
-
-/* Code executed at the end of each rule. */
-#ifndef YY_BREAK
-#define YY_BREAK /*LINTED*/break;
-#endif
-
-#define YY_RULE_SETUP \
-	YY_USER_ACTION
-
-/** The main scanner function which does all the work.
- */
-YY_DECL
-{
-	yy_state_type yy_current_state;
-	char *yy_cp, *yy_bp;
-	int yy_act;
-    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
-    yylval = yylval_param;
-
-    yylloc = yylloc_param;
-
-	if ( !yyg->yy_init )
-		{
-		yyg->yy_init = 1;
-
-#ifdef YY_USER_INIT
-		YY_USER_INIT;
-#endif
-
-		if ( ! yyg->yy_start )
-			yyg->yy_start = 1;	/* first start state */
-
-		if ( ! yyin )
-			yyin = stdin;
-
-		if ( ! yyout )
-			yyout = stdout;
-
-		if ( ! YY_CURRENT_BUFFER ) {
-			quickstep_yyensure_buffer_stack (yyscanner);
-			YY_CURRENT_BUFFER_LVALUE =
-				quickstep_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
-		}
-
-		quickstep_yy_load_buffer_state(yyscanner );
-		}
-
-	{
-#line 131 "../SqlLexer.lpp"
-
-
-#line 1384 "SqlLexer_gen.cpp"
-
-	while ( /*CONSTCOND*/1 )		/* loops until end-of-file is reached */
-		{
-		yy_cp = yyg->yy_c_buf_p;
-
-		/* Support of yytext. */
-		*yy_cp = yyg->yy_hold_char;
-
-		/* yy_bp points to the position in yy_ch_buf of the start of
-		 * the current run.
-		 */
-		yy_bp = yy_cp;
-
-		yy_current_state = yyg->yy_start;
-yy_match:
-		do
-			{
-			YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
-			if ( yy_accept[yy_current_state] )
-				{
-				yyg->yy_last_accepting_state = yy_current_state;
-				yyg->yy_last_accepting_cpos = yy_cp;
-				}
-			while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
-				{
-				yy_current_state = (int) yy_def[yy_current_state];
-				if ( yy_current_state >= 593 )
-					yy_c = yy_meta[(unsigned int) yy_c];
-				}
-			yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
-			++yy_cp;
-			}
-		while ( yy_current_state != 592 );
-		yy_cp = yyg->yy_last_accepting_cpos;
-		yy_current_state = yyg->yy_last_accepting_state;
-
-yy_find_action:
-		yy_act = yy_accept[yy_current_state];
-
-		YY_DO_BEFORE_ACTION;
-
-		if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] )
-			{
-			yy_size_t yyl;
-			for ( yyl = 0; yyl < yyleng; ++yyl )
-				if ( yytext[yyl] == '\n' )
-					   
-    do{ yylineno++;
-        yycolumn=0;
-    }while(0)
-;
-			}
-
-do_action:	/* This label is used only to access EOF actions. */
-
-		switch ( yy_act )
-	{ /* beginning of action switch */
-			case 0: /* must back up */
-			/* undo the effects of YY_DO_BEFORE_ACTION */
-			*yy_cp = yyg->yy_hold_char;
-			yy_cp = yyg->yy_last_accepting_cpos;
-			yy_current_state = yyg->yy_last_accepting_state;
-			goto yy_find_action;
-
-case 1:
-YY_RULE_SETUP
-#line 134 "../SqlLexer.lpp"
-{
-    /* A forward slash character represents a system command. */
-    BEGIN(CONDITION_COMMAND);
-    yylval->string_value_ = new quickstep::ParseString(
-        yylloc->first_line, yylloc->first_column, std::string(yytext, yyleng));
-    return TOKEN_COMMAND;
-  }
-	YY_BREAK
-case 2:
-/* rule 2 can match eol */
-YY_RULE_SETUP
-#line 142 "../SqlLexer.lpp"
-{
-    /* This is a SQL command. Place the char back and process normally. */
-    yyless(0);
-    yycolumn--;
-    BEGIN(CONDITION_SQL);
-  }
-	YY_BREAK
-
-
-case 3:
-YY_RULE_SETUP
-#line 151 "../SqlLexer.lpp"
-{
-    /* This is a command argument. */
-    yylval->string_value_ = new quickstep::ParseString(
-        yylloc->first_line, yylloc->first_column, std::string(yytext, yyleng));
-    return TOKEN_COMMAND;
-  }
-	YY_BREAK
-case 4:
-YY_RULE_SETUP
-#line 158 "../SqlLexer.lpp"
-{
-    /* Ignore whitespace. */
-  }
-	YY_BREAK
-case 5:
-/* rule 5 can match eol */
-YY_RULE_SETUP
-#line 162 "../SqlLexer.lpp"
-{
-    /* Newline reverts the lexer to the initial state. */
-    yycolumn = 0;
-    BEGIN(INITIAL);
-    return '\n';
-  }
-	YY_BREAK
-
-
-case 6:
-YY_RULE_SETUP
-#line 171 "../SqlLexer.lpp"
-return TOKEN_ADD;
-	YY_BREAK
-case 7:
-YY_RULE_SETUP
-#line 172 "../SqlLexer.lpp"
-return TOKEN_ALL;
-	YY_BREAK
-case 8:
-YY_RULE_SETUP
-#line 173 "../SqlLexer.lpp"
-return TOKEN_ALTER;
-	YY_BREAK
-case 9:
-YY_RULE_SETUP
-#line 174 "../SqlLexer.lpp"
-return TOKEN_AND;
-	YY_BREAK
-case 10:
-YY_RULE_SETUP
-#line 175 "../SqlLexer.lpp"
-return TOKEN_AS;
-	YY_BREAK
-case 11:
-YY_RULE_SETUP
-#line 176 "../SqlLexer.lpp"
-return TOKEN_ASC;
-	YY_BREAK
-case 12:
-YY_RULE_SETUP
-#line 177 "../SqlLexer.lpp"
-return TOKEN_ASC;
-	YY_BREAK
-case 13:
-YY_RULE_SETUP
-#line 178 "../SqlLexer.lpp"
-return TOKEN_BETWEEN;
-	YY_BREAK
-case 14:
-YY_RULE_SETUP
-#line 179 "../SqlLexer.lpp"
-return TOKEN_BIGINT;
-	YY_BREAK
-case 15:
-YY_RULE_SETUP
-#line 180 "../SqlLexer.lpp"
-return TOKEN_BIT;
-	YY_BREAK
-case 16:
-YY_RULE_SETUP
-#line 181 "../SqlLexer.lpp"
-return TOKEN_BITWEAVING;
-	YY_BREAK
-case 17:
-YY_RULE_SETUP
-#line 182 "../SqlLexer.lpp"
-return TOKEN_BLOCKPROPERTIES;
-	YY_BREAK
-case 18:
-YY_RULE_SETUP
-#line 183 "../SqlLexer.lpp"
-return TOKEN_BLOCKSAMPLE;
-	YY_BREAK
-case 19:
-YY_RULE_SETUP
-#line 184 "../SqlLexer.lpp"
-return TOKEN_BLOOM_FILTER;
-	YY_BREAK
-case 20:
-YY_RULE_SETUP
-#line 185 "../SqlLexer.lpp"
-return TOKEN_CASE;
-	YY_BREAK
-case 21:
-YY_RULE_SETUP
-#line 186 "../SqlLexer.lpp"
-return TOKEN_CSB_TREE;
-	YY_BREAK
-case 22:
-YY_RULE_SETUP
-#line 187 "../SqlLexer.lpp"
-return TOKEN_BY;
-	YY_BREAK
-case 23:
-YY_RULE_SETUP
-#line 188 "../SqlLexer.lpp"
-return TOKEN_CHARACTER;
-	YY_BREAK
-case 24:
-YY_RULE_SETUP
-#line 189 "../SqlLexer.lpp"
-return TOKEN_CHARACTER;
-	YY_BREAK
-case 25:
-YY_RULE_SETUP
-#line 190 "../SqlLexer.lpp"
-return TOKEN_CHECK;
-	YY_BREAK
-case 26:
-YY_RULE_SETUP
-#line 191 "../SqlLexer.lpp"
-return TOKEN_COLUMN;
-	YY_BREAK
-case 27:
-YY_RULE_SETUP
-#line 192 "../SqlLexer.lpp"
-return TOKEN_CONSTRAINT;
-	YY_BREAK
-case 28:
-YY_RULE_SETUP
-#line 193 "../SqlLexer.lpp"
-return TOKEN_COPY;
-	YY_BREAK
-case 29:
-YY_RULE_SETUP
-#line 194 "../SqlLexer.lpp"
-return TOKEN_CREATE;
-	YY_BREAK
-case 30:
-YY_RULE_SETUP
-#line 195 "../SqlLexer.lpp"
-return TOKEN_CURRENT;
-	YY_BREAK
-case 31:
-YY_RULE_SETUP
-#line 196 "../SqlLexer.lpp"
-return TOKEN_DATE;
-	YY_BREAK
-case 32:
-YY_RULE_SETUP
-#line 197 "../SqlLexer.lpp"
-return TOKEN_DATETIME;
-	YY_BREAK
-case 33:
-YY_RULE_SETUP
-#line 198 "../SqlLexer.lpp"
-return TOKEN_DAY;
-	YY_BREAK
-case 34:
-YY_RULE_SETUP
-#line 199 "../SqlLexer.lpp"
-return TOKEN_DECIMAL;
-	YY_BREAK
-case 35:
-YY_RULE_SETUP
-#line 200 "../SqlLexer.lpp"
-return TOKEN_DEFAULT;
-	YY_BREAK
-case 36:
-YY_RULE_SETUP
-#line 201 "../SqlLexer.lpp"
-return TOKEN_DELETE;
-	YY_BREAK
-case 37:
-YY_RULE_SETUP
-#line 202 "../SqlLexer.lpp"
-return TOKEN_DELIMITER;
-	YY_BREAK
-case 38:
-YY_RULE_SETUP
-#line 203 "../SqlLexer.lpp"
-return TOKEN_DESC;
-	YY_BREAK
-case 39:
-YY_RULE_SETUP
-#line 204 "../SqlLexer.lpp"
-return TOKEN_DESC;
-	YY_BREAK
-case 40:
-YY_RULE_SETUP
-#line 205 "../SqlLexer.lpp"
-return TOKEN_DISTINCT;
-	YY_BREAK
-case 41:
-YY_RULE_SETUP
-#line 206 "../SqlLexer.lpp"
-return TOKEN_DOUBLE;
-	YY_BREAK
-case 42:
-YY_RULE_SETUP
-#line 207 "../SqlLexer.lpp"
-return TOKEN_DROP;
-	YY_BREAK
-case 43:
-YY_RULE_SETUP
-#line 208 "../SqlLexer.lpp"
-return TOKEN_ELSE;
-	YY_BREAK
-case 44:
-YY_RULE_SETUP
-#line 209 "../SqlLexer.lpp"
-return TOKEN_END;
-	YY_BREAK
-case 45:
-YY_RULE_SETUP
-#line 210 "../SqlLexer.lpp"
-return TOKEN_ESCAPE_STRINGS;
-	YY_BREAK
-case 46:
-YY_RULE_SETUP
-#line 211 "../SqlLexer.lpp"
-return TOKEN_EXISTS;
-	YY_BREAK
-case 47:
-YY_RULE_SETUP
-#line 212 "../SqlLexer.lpp"
-return TOKEN_EXTRACT;
-	YY_BREAK
-case 48:
-YY_RULE_SETUP
-#line 213 "../SqlLexer.lpp"
-return TOKEN_FALSE;
-	YY_BREAK
-case 49:
-YY_RULE_SETUP
-#line 214 "../SqlLexer.lpp"
-return TOKEN_FIRST;
-	YY_BREAK
-case 50:
-YY_RULE_SETUP
-#line 215 "../SqlLexer.lpp"
-return TOKEN_FLOAT;
-	YY_BREAK
-case 51:
-YY_RULE_SETUP
-#line 216 "../SqlLexer.lpp"
-return TOKEN_FOLLOWING;
-	YY_BREAK
-case 52:
-YY_RULE_SETUP
-#line 217 "../SqlLexer.lpp"
-return TOKEN_FOR;
-	YY_BREAK
-case 53:
-YY_RULE_SETUP
-#line 218 "../SqlLexer.lpp"
-return TOKEN_FOREIGN;
-	YY_BREAK
-case 54:
-YY_RULE_SETUP
-#line 219 "../SqlLexer.lpp"
-return TOKEN_FROM;
-	YY_BREAK
-case 55:
-YY_RULE_SETUP
-#line 220 "../SqlLexer.lpp"
-return TOKEN_FULL;
-	YY_BREAK
-case 56:
-YY_RULE_SETUP
-#line 221 "../SqlLexer.lpp"
-return TOKEN_GROUP;
-	YY_BREAK
-case 57:
-YY_RULE_SETUP
-#line 222 "../SqlLexer.lpp"
-return TOKEN_HASH;
-	YY_BREAK
-case 58:
-YY_RULE_SETUP
-#line 223 "../SqlLexer.lpp"
-return TOKEN_HAVING;
-	YY_BREAK
-case 59:
-YY_RULE_SETUP
-#line 224 "../SqlLexer.lpp"
-return TOKEN_HOUR;
-	YY_BREAK
-case 60:
-YY_RULE_SETUP
-#line 225 "../SqlLexer.lpp"
-return TOKEN_IN;
-	YY_BREAK
-case 61:
-YY_RULE_SETUP
-#line 226 "../SqlLexer.lpp"
-return TOKEN_INDEX;
-	YY_BREAK
-case 62:
-YY_RULE_SETUP
-#line 227 "../SqlLexer.lpp"
-return TOKEN_INNER;
-	YY_BREAK
-case 63:
-YY_RULE_SETUP
-#line 228 "../SqlLexer.lpp"
-return TOKEN_INSERT;
-	YY_BREAK
-case 64:
-YY_RULE_SETUP
-#line 229 "../SqlLexer.lpp"
-return TOKEN_INTEGER;
-	YY_BREAK
-case 65:
-YY_RULE_SETUP
-#line 230 "../SqlLexer.lpp"
-return TOKEN_INTEGER;
-	YY_BREAK
-case 66:
-YY_RULE_SETUP
-#line 231 "../SqlLexer.lpp"
-return TOKEN_INTERVAL;
-	YY_BREAK
-case 67:
-YY_RULE_SETUP
-#line 232 "../SqlLexer.lpp"
-return TOKEN_INTO;
-	YY_BREAK
-case 68:
-YY_RULE_SETUP
-#line 233 "../SqlLexer.lpp"
-return TOKEN_IS;
-	YY_BREAK
-case 69:
-YY_RULE_SETUP
-#line 234 "../SqlLexer.lpp"
-return TOKEN_JOIN;
-	YY_BREAK
-case 70:
-YY_RULE_SETUP
-#line 235 "../SqlLexer.lpp"
-return TOKEN_KEY;
-	YY_BREAK
-case 71:
-YY_RULE_SETUP
-#line 236 "../SqlLexer.lpp"
-return TOKEN_LAST;
-	YY_BREAK
-case 72:
-YY_RULE_SETUP
-#line 237 "../SqlLexer.lpp"
-return TOKEN_LEFT;
-	YY_BREAK
-case 73:
-YY_RULE_SETUP
-#line 238 "../SqlLexer.lpp"
-return TOKEN_LIKE;
-	YY_BREAK
-case 74:
-YY_RULE_SETUP
-#line 239 "../SqlLexer.lpp"
-return TOKEN_LIMIT;
-	YY_BREAK
-case 75:
-YY_RULE_SETUP
-#line 240 "../SqlLexer.lpp"
-return TOKEN_LONG;
-	YY_BREAK
-case 76:
-YY_RULE_SETUP
-#line 241 "../SqlLexer.lpp"
-return TOKEN_MINUTE;
-	YY_BREAK
-case 77:
-YY_RULE_SETUP
-#line 242 "../SqlLexer.lpp"
-return TOKEN_MONTH;
-	YY_BREAK
-case 78:
-YY_RULE_SETUP
-#line 243 "../SqlLexer.lpp"
-return TOKEN_NOT;
-	YY_BREAK
-case 79:
-YY_RULE_SETUP
-#line 244 "../SqlLexer.lpp"
-return TOKEN_NULL;
-	YY_BREAK
-case 80:
-YY_RULE_SETUP
-#line 245 "../SqlLexer.lpp"
-return TOKEN_NULLS;
-	YY_BREAK
-case 81:
-YY_RULE_SETUP
-#line 246 "../SqlLexer.lpp"
-return TOKEN_OFF;
-	YY_BREAK
-case 82:
-YY_RULE_SETUP
-#line 247 "../SqlLexer.lpp"
-return TOKEN_ON;
-	YY_BREAK
-case 83:
-YY_RULE_SETUP
-#line 248 "../SqlLexer.lpp"
-return TOKEN_OR;
-	YY_BREAK
-case 84:
-YY_RULE_SETUP
-#line 249 "../SqlLexer.lpp"
-return TOKEN_ORDER;
-	YY_BREAK
-case 85:
-YY_RULE_SETUP
-#line 250 "../SqlLexer.lpp"
-return TOKEN_OUTER;
-	YY_BREAK
-case 86:
-YY_RULE_SETUP
-#line 251 "../SqlLexer.lpp"
-return TOKEN_OVER;
-	YY_BREAK
-case 87:
-YY_RULE_SETUP
-#line 252 "../SqlLexer.lpp"
-return TOKEN_PARTITION;
-	YY_BREAK
-case 88:
-YY_RULE_SETUP
-#line 253 "../SqlLexer.lpp"
-return TOKEN_PARTITIONS;
-	YY_BREAK
-case 89:
-YY_RULE_SETUP
-#line 254 "../SqlLexer.lpp"
-return TOKEN_PERCENT;
-	YY_BREAK
-case 90:
-YY_RULE_SETUP
-#line 255 "../SqlLexer.lpp"
-return TOKEN_PRECEDING;
-	YY_BREAK
-case 91:
-YY_RULE_SETUP
-#line 256 "../SqlLexer.lpp"
-return TOKEN_PRIMARY;
-	YY_BREAK
-case 92:
-YY_RULE_SETUP
-#line 257 "../SqlLexer.lpp"
-return TOKEN_PRIORITY;
-	YY_BREAK
-case 93:
-YY_RULE_SETUP
-#line 258 "../SqlLexer.lpp"
-return TOKEN_QUIT;
-	YY_BREAK
-case 94:
-YY_RULE_SETUP
-#line 259 "../SqlLexer.lpp"
-return TOKEN_RANGE;
-	YY_BREAK
-case 95:
-YY_RULE_SETUP
-#line 260 "../SqlLexer.lpp"
-return TOKEN_REAL;
-	YY_BREAK
-case 96:
-YY_RULE_SETUP
-#line 261 "../SqlLexer.lpp"
-return TOKEN_REFERENCES;
-	YY_BREAK
-case 97:
-YY_RULE_SETUP
-#line 262 "../SqlLexer.lpp"
-return TOKEN_REGEXP;
-	YY_BREAK
-case 98:
-YY_RULE_SETUP
-#line 263 "../SqlLexer.lpp"
-return TOKEN_RIGHT;
-	YY_BREAK
-case 99:
-YY_RULE_SETUP
-#line 264 "../SqlLexer.lpp"
-return TOKEN_ROW;
-	YY_BREAK
-case 100:
-YY_RULE_SETUP
-#line 265 "../SqlLexer.lpp"
-return TOKEN_ROW_DELIMITER;
-	YY_BREAK
-case 101:
-YY_RULE_SETUP
-#line 266 "../SqlLexer.lpp"
-return TOKEN_ROWS;
-	YY_BREAK
-case 102:
-YY_RULE_SETUP
-#line 267 "../SqlLexer.lpp"
-return TOKEN_SECOND;
-	YY_BREAK
-case 103:
-YY_RULE_SETUP
-#line 268 "../SqlLexer.lpp"
-return TOKEN_SELECT;
-	YY_BREAK
-case 104:
-YY_RULE_SETUP
-#line 269 "../SqlLexer.lpp"
-return TOKEN_SET;
-	YY_BREAK
-case 105:
-YY_RULE_SETUP
-#line 270 "../SqlLexer.lpp"
-return TOKEN_SMA;
-	YY_BREAK
-case 106:
-YY_RULE_SETUP
-#line 271 "../SqlLexer.lpp"
-return TOKEN_SMALLINT;
-	YY_BREAK
-case 107:
-YY_RULE_SETUP
-#line 272 "../SqlLexer.lpp"
-return TOKEN_SUBSTRING;
-	YY_BREAK
-case 108:
-YY_RULE_SETUP
-#line 273 "../SqlLexer.lpp"
-return TOKEN_TABLE;
-	YY_BREAK
-case 109:
-YY_RULE_SETUP
-#line 274 "../SqlLexer.lpp"
-return TOKEN_THEN;
-	YY_BREAK
-case 110:
-YY_RULE_SETUP
-#line 275 "../SqlLexer.lpp"
-return TOKEN_TIME;
-	YY_BREAK
-case 111:
-YY_RULE_SETUP
-#line 276 "../SqlLexer.lpp"
-return TOKEN_TIMESTAMP;
-	YY_BREAK
-case 112:
-YY_RULE_SETUP
-#line 277 "../SqlLexer.lpp"
-return TOKEN_TRUE;
-	YY_BREAK
-case 113:
-YY_RULE_SETUP
-#line 278 "../SqlLexer.lpp"
-return TOKEN_TUPLESAMPLE;
-	YY_BREAK
-case 114:
-YY_RULE_SETUP
-#line 279 "../SqlLexer.lpp"
-return TOKEN_UNBOUNDED;
-	YY_BREAK
-case 115:
-YY_RULE_SETUP
-#line 280 "../SqlLexer.lpp"
-return TOKEN_UNIQUE;
-	YY_BREAK
-case 116:
-YY_RULE_SETUP
-#line 281 "../SqlLexer.lpp"
-return TOKEN_UPDATE;
-	YY_BREAK
-case 117:
-YY_RULE_SETUP
-#line 282 "../SqlLexer.lpp"
-return TOKEN_USING;
-	YY_BREAK
-case 118:
-YY_RULE_SETUP
-#line 283 "../SqlLexer.lpp"
-return TOKEN_VALUES;
-	YY_BREAK
-case 119:
-YY_RULE_SETUP
-#line 284 "../SqlLexer.lpp"
-return TOKEN_VARCHAR;
-	YY_BREAK
-case 120:
-YY_RULE_SETUP
-#line 285 "../SqlLexer.lpp"
-return TOKEN_WHEN;
-	YY_BREAK
-case 121:
-YY_RULE_SETUP
-#line 286 "../SqlLexer.lpp"
-return TOKEN_WHERE;
-	YY_BREAK
-case 122:
-YY_RULE_SETUP
-#line 287 "../SqlLexer.lpp"
-return TOKEN_WINDOW;
-	YY_BREAK
-case 123:
-YY_RULE_SETUP
-#line 288 "../SqlLexer.lpp"
-return TOKEN_WITH;
-	YY_BREAK
-case 124:
-YY_RULE_SETUP
-#line 289 "../SqlLexer.lpp"
-return TOKEN_YEAR;
-	YY_BREAK
-case 125:
-YY_RULE_SETUP
-#line 290 "../SqlLexer.lpp"
-return TOKEN_YEARMONTH;
-	YY_BREAK
-case 126:
-YY_RULE_SETUP
-#line 292 "../SqlLexer.lpp"
-return TOKEN_EQ;
-	YY_BREAK
-case 127:
-YY_RULE_SETUP
-#line 293 "../SqlLexer.lpp"
-return TOKEN_NEQ;
-	YY_BREAK
-case 128:
-YY_RULE_SETUP
-#line 294 "../SqlLexer.lpp"
-return TOKEN_NEQ;
-	YY_BREAK
-case 129:
-YY_RULE_SETUP
-#line 295 "../SqlLexer.lpp"
-return TOKEN_LT;
-	YY_BREAK
-case 130:
-YY_RULE_SETUP
-#line 296 "../SqlLexer.lpp"
-return TOKEN_GT;
-	YY_BREAK
-case 131:
-YY_RULE_SETUP
-#line 297 "../SqlLexer.lpp"
-return TOKEN_LEQ;
-	YY_BREAK
-case 132:
-YY_RULE_SETUP
-#line 298 "../SqlLexer.lpp"
-return TOKEN_GEQ;
-	YY_BREAK
-case 133:
-YY_RULE_SETUP
-#line 300 "../SqlLexer.lpp"
-return yytext[0];
-	YY_BREAK
-case 134:
-YY_RULE_SETUP
-#line 301 "../SqlLexer.lpp"
-return yytext[0];
-	YY_BREAK
-/**
-    * Quoted strings. Prefacing a string with an 'e' or 'E' causes escape
-    * sequences to be processed (as in PostgreSQL).
-    **/
-case 135:
-YY_RULE_SETUP
-#line 307 "../SqlLexer.lpp"
-{
-    yylval->string_value_ = new quickstep::ParseString(yylloc->first_line, yylloc->first_column);
-    BEGIN(CONDITION_STRING_SINGLE_QUOTED_ESCAPED);
-  }
-	YY_BREAK
-case 136:
-YY_RULE_SETUP
-#line 312 "../SqlLexer.lpp"
-{
-    yylval->string_value_ = new quickstep::ParseString(yylloc->first_line, yylloc->first_column);
-    BEGIN(CONDITION_STRING_SINGLE_QUOTED);
-  }
-	YY_BREAK
-case 137:
-YY_RULE_SETUP
-#line 317 "../SqlLexer.lpp"
-{
-    yylval->string_value_ = new quickstep::ParseString(yylloc->first_line, yylloc->first_column);
-    BEGIN(CONDITION_STRING_DOUBLE_QUOTED);
-  }
-	YY_BREAK
-/* CONDITION_SQL */
-/* Catch an unterminated string. */
-
-case YY_STATE_EOF(CONDITION_STRING_SINGLE_QUOTED):
-case YY_STATE_EOF(CONDITION_STRING_SINGLE_QUOTED_ESCAPED):
-case YY_STATE_EOF(CONDITION_STRING_DOUBLE_QUOTED):
-#line 326 "../SqlLexer.lpp"
-{
-    delete yylval->string_value_;
-    BEGIN(INITIAL);
-    quickstep_yyerror(NULL, yyscanner, NULL, "unterminated string");
-    return TOKEN_LEX_ERROR;
-  }
-	YY_BREAK
-
-/* Process escape sequences. */
-
-case 138:
-YY_RULE_SETUP
-#line 336 "../SqlLexer.lpp"
-{
-    /* Octal code */
-    unsigned int code;
-    std::sscanf(yytext + 1, "%o", &code);
-    if (code > 0xff) {
-      delete yylval->string_value_;
-      BEGIN(INITIAL);
-      quickstep_yyerror(NULL, yyscanner, NULL, "octal escape sequence out of 1-byte range");
-      return TOKEN_LEX_ERROR;
-    }
-    yylval->string_value_->push_back(code);
-  }
-	YY_BREAK
-case 139:
-YY_RULE_SETUP
-#line 348 "../SqlLexer.lpp"
-{
-    /* Hexadecimal code */
-    unsigned int code;
-    std::sscanf(yytext + 2, "%x", &code);
-    yylval->string_value_->push_back(code);
-  }
-	YY_BREAK
-case 140:
-YY_RULE_SETUP
-#line 354 "../SqlLexer.lpp"
-{
-    /* A numeric escape sequence that isn't correctly specified. */
-    delete yylval->string_value_;
-    BEGIN(INITIAL);
-    quickstep_yyerror(NULL, yyscanner, NULL, "bad numeric escape sequence (must be octal or hex)");
-    return TOKEN_LEX_ERROR;
-  }
-	YY_BREAK
-case 141:
-YY_RULE_SETUP
-#line 361 "../SqlLexer.lpp"
-{
-    /* Backspace */
-    yylval->string_value_->push_back('\b');
-  }
-	YY_BREAK
-case 142:
-YY_RULE_SETUP
-#line 365 "../SqlLexer.lpp"
-{
-    /* Form-feed */
-    yylval->string_value_->push_back('\f');
-  }
-	YY_BREAK
-case 143:
-YY_RULE_SETUP
-#line 369 "../SqlLexer.lpp"
-{
-    /* Newline */
-    yylval->string_value_->push_back('\n');
-  }
-	YY_BREAK
-case 144:
-YY_RULE_SETUP
-#line 373 "../SqlLexer.lpp"
-{
-    /* Carriage-return */
-    yylval->string_value_->push_back('\r');
-  }
-	YY_BREAK
-case 145:
-YY_RULE_SETUP
-#line 377 "../SqlLexer.lpp"
-{
-    /* Horizontal Tab */
-    yylval->string_value_->push_back('\t');
-  }
-	YY_BREAK
-case 146:
-/* rule 146 can match eol */
-YY_RULE_SETUP
-#line 381 "../SqlLexer.lpp"
-{
-    /* Any other character (including actual newline or carriage return) */
-    yylval->string_value_->push_back(yytext[1]);
-  }
-	YY_BREAK
-case 147:
-YY_RULE_SETUP
-#line 385 "../SqlLexer.lpp"
-{
-    /* This should only be encountered right before an EOF. */
-    delete yylval->string_value_;
-    BEGIN(INITIAL);
-    quickstep_yyerror(NULL, yyscanner, NULL, "unfinished escape sequence");
-    return TOKEN_LEX_ERROR;
-  }
-	YY_BREAK
-
-
-case 148:
-YY_RULE_SETUP
-#line 395 "../SqlLexer.lpp"
-{
-    /* Two quotes in a row become a single quote (this is specified by the SQL standard). */
-    yylval->string_value_->push_back('\'');
-  }
-	YY_BREAK
-case 149:
-YY_RULE_SETUP
-#line 399 "../SqlLexer.lpp"
-{
-    /* End string */
-    BEGIN(CONDITION_SQL);
-    return TOKEN_STRING_SINGLE_QUOTED;
-  }
-	YY_BREAK
-
-
-case 150:
-YY_RULE_SETUP
-#line 407 "../SqlLexer.lpp"
-{
-    /* Two quotes in a row become a single quote (this is specified by the SQL standard). */
-    yylval->string_value_->push_back('"');
-  }
-	YY_BREAK
-case 151:
-YY_RULE_SETUP
-#line 411 "../SqlLexer.lpp"
-{
-    /* End string */
-    BEGIN(CONDITION_SQL);
-    return TOKEN_STRING_DOUBLE_QUOTED;
-  }
-	YY_BREAK
-
-case 152:
-/* rule 152 can match eol */
-YY_RULE_SETUP
-#line 418 "../SqlLexer.lpp"
-{
-  /* Scan up to a quote. */
-  yylval->string_value_->append(yytext, yyleng);
-}
-	YY_BREAK
-case 153:
-/* rule 153 can match eol */
-YY_RULE_SETUP
-#line 423 "../SqlLexer.lpp"
-{
-  /* Scan up to a quote or escape sequence. */
-  yylval->string_value_->append(yytext, yyleng);
-}
-	YY_BREAK
-case 154:
-/* rule 154 can match eol */
-YY_RULE_SETUP
-#line 428 "../SqlLexer.lpp"
-{
-  /* Scan up to a quote. */
-  yylval->string_value_->append(yytext, yyleng);
-}
-	YY_BREAK
-
-case 155:
-YY_RULE_SETUP
-#line 434 "../SqlLexer.lpp"
-{
-    yylval->string_value_ = new quickstep::ParseString(
-        yylloc->first_line, yylloc->first_column, std::string(yytext, yyleng));
-    return TOKEN_NAME;
-  }
-	YY_BREAK
-case 156:
-YY_RULE_SETUP
-#line 440 "../SqlLexer.lpp"
-{
-    yylval->numeric_literal_value_ = new quickstep::NumericParseLiteralValue(
-        yylloc->first_line, yylloc->first_column, yytext);
-    return TOKEN_UNSIGNED_NUMVAL;
-  }
-	YY_BREAK
-case 157:
-YY_RULE_SETUP
-#line 446 "../SqlLexer.lpp"
-/* comment */
-	YY_BREAK
-case 158:
-/* rule 158 can match eol */
-YY_RULE_SETUP
-#line 448 "../SqlLexer.lpp"
-{ yycolumn = 0; }
-	YY_BREAK
-case 159:
-YY_RULE_SETUP
-#line 450 "../SqlLexer.lpp"
-; /* ignore white space */
-	YY_BREAK
-/* CONDITION_SQL */
-case YY_STATE_EOF(INITIAL):
-case YY_STATE_EOF(CONDITION_COMMAND):
-case YY_STATE_EOF(CONDITION_SQL):
-#line 454 "../SqlLexer.lpp"
-{
-  /* All conditions except for mutli-state string extracting conditions. */
-  BEGIN(INITIAL);
-  return TOKEN_EOF;
-}
-	YY_BREAK
-case 160:
-YY_RULE_SETUP
-#line 460 "../SqlLexer.lpp"
-{
-  BEGIN(INITIAL);
-  quickstep_yyerror(NULL, yyscanner, NULL, "illegal character");
-  return TOKEN_LEX_ERROR;
-}
-	YY_BREAK
-case 161:
-YY_RULE_SETUP
-#line 466 "../SqlLexer.lpp"
-YY_FATAL_ERROR( "flex scanner jammed" );
-	YY_BREAK
-#line 2416 "SqlLexer_gen.cpp"
-
-	case YY_END_OF_BUFFER:
-		{
-		/* Amount of text matched not including the EOB char. */
-		int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1;
-
-		/* Undo the effects of YY_DO_BEFORE_ACTION. */
-		*yy_cp = yyg->yy_hold_char;
-		YY_RESTORE_YY_MORE_OFFSET
-
-		if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
-			{
-			/* We're scanning a new file or input source.  It's
-			 * possible that this happened because the user
-			 * just pointed yyin at a new source and called
-			 * quickstep_yylex().  If so, then we have to assure
-			 * consistency between YY_CURRENT_BUFFER and our
-			 * globals.  Here is the right place to do so, because
-			 * this is the first action (other than possibly a
-			 * back-up) that will match for the new input source.
-			 */
-			yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
-			YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
-			YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
-			}
-
-		/* Note that here we test for yy_c_buf_p "<=" to the position
-		 * of the first EOB in the buffer, since yy_c_buf_p will
-		 * already have been incremented past the NUL character
-		 * (since all states make transitions on EOB to the
-		 * end-of-buffer state).  Contrast this with the test
-		 * in input().
-		 */
-		if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
-			{ /* This was really a NUL. */
-			yy_state_type yy_next_state;
-
-			yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text;
-
-			yy_current_state = yy_get_previous_state( yyscanner );
-
-			/* Okay, we're now positioned to make the NUL
-			 * transition.  We couldn't have
-			 * yy_get_previous_state() go ahead and do it
-			 * for us because it doesn't know how to deal
-			 * with the possibility of jamming (and we don't
-			 * want to build jamming into it because then it
-			 * will run more slowly).
-			 */
-
-			yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner);
-
-			yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
-
-			if ( yy_next_state )
-				{
-				/* Consume the NUL. */
-				yy_cp = ++yyg->yy_c_buf_p;
-				yy_current_state = yy_next_state;
-				goto yy_match;
-				}
-
-			else
-				{
-				yy_cp = yyg->yy_last_accepting_cpos;
-				yy_current_state = yyg->yy_last_accepting_state;
-				goto yy_find_action;
-				}
-			}
-
-		else switch ( yy_get_next_buffer( yyscanner ) )
-			{
-			case EOB_ACT_END_OF_FILE:
-				{
-				yyg->yy_did_buffer_switch_on_eof = 0;
-
-				if ( quickstep_yywrap(yyscanner ) )
-					{
-					/* Note: because we've taken care in
-					 * yy_get_next_buffer() to have set up
-					 * yytext, we can now set up
-					 * yy_c_buf_p so that if some total
-					 * hoser (like flex itself) wants to
-					 * call the scanner after we return the
-					 * YY_NULL, it'll still work - another
-					 * YY_NULL will get returned.
-					 */
-					yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ;
-
-					yy_act = YY_STATE_EOF(YY_START);
-					goto do_action;
-					}
-
-				else
-					{
-					if ( ! yyg->yy_did_buffer_switch_on_eof )
-						YY_NEW_FILE;
-					}
-				break;
-				}
-
-			case EOB_ACT_CONTINUE_SCAN:
-				yyg->yy_c_buf_p =
-					yyg->yytext_ptr + yy_amount_of_matched_text;
-
-				yy_current_state = yy_get_previous_state( yyscanner );
-
-				yy_cp = yyg->yy_c_buf_p;
-				yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
-				goto yy_match;
-
-			case EOB_ACT_LAST_MATCH:
-				yyg->yy_c_buf_p =
-				&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars];
-
-				yy_current_state = yy_get_previous_state( yyscanner );
-
-				yy_cp = yyg->yy_c_buf_p;
-				yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
-				goto yy_find_action;
-			}
-		break;
-		}
-
-	default:
-		YY_FATAL_ERROR(
-			"fatal flex scanner internal error--no action found" );
-	} /* end of action switch */
-		} /* end of scanning one token */
-	} /* end of user's declarations */
-} /* end of quickstep_yylex */
-
-/* yy_get_next_buffer - try to read in a new buffer
- *
- * Returns a code representing an action:
- *	EOB_ACT_LAST_MATCH -
- *	EOB_ACT_CONTINUE_SCAN - continue scanning from current position
- *	EOB_ACT_END_OF_FILE - end of file
- */
-static int yy_get_next_buffer (yyscan_t yyscanner)
-{
-    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-	char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
-	char *source = yyg->yytext_ptr;
-	yy_size_t number_to_move, i;
-	int ret_val;
-
-	if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] )
-		YY_FATAL_ERROR(
-		"fatal flex scanner internal error--end of buffer missed" );
-
-	if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
-		{ /* Don't try to fill the buffer, so this is an EOF. */
-		if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 )
-			{
-			/* We matched a single character, the EOB, so
-			 * treat this as a final EOF.
-			 */
-			return EOB_ACT_END_OF_FILE;
-			}
-
-		else
-			{
-			/* We matched some text prior to the EOB, first
-			 * process it.
-			 */
-			return EOB_ACT_LAST_MATCH;
-			}
-		}
-
-	/* Try to read more data. */
-
-	/* First move last chars to start of buffer. */
-	number_to_move = (yy_size_t) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1;
-
-	for ( i = 0; i < number_to_move; ++i )
-		*(dest++) = *(source++);
-
-	if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
-		/* don't do the read, it's not guaranteed to return an EOF,
-		 * just force an EOF
-		 */
-		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0;
-
-	else
-		{
-			yy_size_t num_to_read =
-			YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
-
-		while ( num_to_read <= 0 )
-			{ /* Not enough room in the buffer - grow it. */
-
-			/* just a shorter name for the current buffer */
-			YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
-
-			int yy_c_buf_p_offset =
-				(int) (yyg->yy_c_buf_p - b->yy_ch_buf);
-
-			if ( b->yy_is_our_buffer )
-				{
-				yy_size_t new_size = b->yy_buf_size * 2;
-
-				if ( new_size <= 0 )
-					b->yy_buf_size += b->yy_buf_size / 8;
-				else
-					b->yy_buf_size *= 2;
-
-				b->yy_ch_buf = (char *)
-					/* Include room in for 2 EOB chars. */
-					quickstep_yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ,yyscanner );
-				}
-			else
-				/* Can't grow it, we don't own it. */
-				b->yy_ch_buf = 0;
-
-			if ( ! b->yy_ch_buf )
-				YY_FATAL_ERROR(
-				"fatal error - scanner input buffer overflow" );
-
-			yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
-
-			num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
-						number_to_move - 1;
-
-			}
-
-		if ( num_to_read > YY_READ_BUF_SIZE )
-			num_to_read = YY_READ_BUF_SIZE;
-
-		/* Read in more data. */
-		YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
-			yyg->yy_n_chars, num_to_read );
-
-		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
-		}
-
-	if ( yyg->yy_n_chars == 0 )
-		{
-		if ( number_to_move == YY_MORE_ADJ )
-			{
-			ret_val = EOB_ACT_END_OF_FILE;
-			quickstep_yyrestart(yyin  ,yyscanner);
-			}
-
-		else
-			{
-			ret_val = EOB_ACT_LAST_MATCH;
-			YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
-				YY_BUFFER_EOF_PENDING;
-			}
-		}
-
-	else
-		ret_val = EOB_ACT_CONTINUE_SCAN;
-
-	if ((yy_size_t) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
-		/* Extend the array by 50%, plus the number we really need. */
-		yy_size_t new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1);
-		YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) quickstep_yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner );
-		if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
-			YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
-	}
-
-	yyg->yy_n_chars += number_to_move;
-	YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR;
-	YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
-
-	yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
-
-	return ret_val;
-}
-
-/* yy_get_previous_state - get the state just before the EOB char was reached */
-
-    static yy_state_type yy_get_previous_state (yyscan_t yyscanner)
-{
-	yy_state_type yy_current_state;
-	char *yy_cp;
-    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
-	yy_current_state = yyg->yy_start;
-
-	for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp )
-		{
-		YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
-		if ( yy_accept[yy_current_state] )
-			{
-			yyg->yy_last_accepting_state = yy_current_state;
-			yyg->yy_last_accepting_cpos = yy_cp;
-			}
-		while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
-			{
-			yy_current_state = (int) yy_def[yy_current_state];
-			if ( yy_current_state >= 593 )
-				yy_c = yy_meta[(unsigned int) yy_c];
-			}
-		yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
-		}
-
-	return yy_current_state;
-}
-
-/* yy_try_NUL_trans - try to make a transition on the NUL character
- *
- * synopsis
- *	next_state = yy_try_NUL_trans( current_state );
- */
-    static yy_state_type yy_try_NUL_trans  (yy_state_type yy_current_state , yyscan_t yyscanner)
-{
-	int yy_is_jam;
-    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */
-	char *yy_cp = yyg->yy_c_buf_p;
-
-	YY_CHAR yy_c = 1;
-	if ( yy_accept[yy_current_state] )
-		{
-		yyg->yy_last_accepting_state = yy_current_state;
-		yyg->yy_last_accepting_cpos = yy_cp;
-		}
-	while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
-		{
-		yy_current_state = (int) yy_def[yy_current_state];
-		if ( yy_current_state >= 593 )
-			yy_c = yy_meta[(unsigned int) yy_c];
-		}
-	yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
-	yy_is_jam = (yy_current_state == 592);
-
-	(void)yyg;
-	return yy_is_jam ? 0 : yy_current_state;
-}
-
-#ifndef YY_NO_UNPUT
-
-#endif
-
-#ifndef YY_NO_INPUT
-#ifdef __cplusplus
-    static int yyinput (yyscan_t yyscanner)
-#else
-    static int input  (yyscan_t yyscanner)
-#endif
-
-{
-	int c;
-    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
-	*yyg->yy_c_buf_p = yyg->yy_hold_char;
-
-	if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
-		{
-		/* yy_c_buf_p now points to the character we want to return.
-		 * If this occurs *before* the EOB characters, then it's a
-		 * valid NUL; if not, then we've hit the end of the buffer.
-		 */
-		if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
-			/* This was really a NUL. */
-			*yyg->yy_c_buf_p = '\0';
-
-		else
-			{ /* need more input */
-			yy_size_t offset = yyg->yy_c_buf_p - yyg->yytext_ptr;
-			++yyg->yy_c_buf_p;
-
-			switch ( yy_get_next_buffer( yyscanner ) )
-				{
-				case EOB_ACT_LAST_MATCH:
-					/* This happens because yy_g_n_b()
-					 * sees that we've accumulated a
-					 * token and flags that we need to
-					 * try matching the token before
-					 * proceeding.  But for input(),
-					 * there's no matching to consider.
-					 * So convert the EOB_ACT_LAST_MATCH
-					 * to EOB_ACT_END_OF_FILE.
-					 */
-
-					/* Reset buffer status. */
-					quickstep_yyrestart(yyin ,yyscanner);
-
-					/*FALLTHROUGH*/
-
-				case EOB_ACT_END_OF_FILE:
-					{
-					if ( quickstep_yywrap(yyscanner ) )
-						return EOF;
-
-					if ( ! yyg->yy_did_buffer_switch_on_eof )
-						YY_NEW_FILE;
-#ifdef __cplusplus
-					return yyinput(yyscanner);
-#else
-					return input(yyscanner);
-#endif
-					}
-
-				case EOB_ACT_CONTINUE_SCAN:
-					yyg->yy_c_buf_p = yyg->yytext_ptr + offset;
-					break;
-				}
-			}
-		}
-
-	c = *(unsigned char *) yyg->yy_c_buf_p;	/* cast for 8-bit char's */
-	*yyg->yy_c_buf_p = '\0';	/* preserve yytext */
-	yyg->yy_hold_char = *++yyg->yy_c_buf_p;
-
-	if ( c == '\n' )
-		   
-    do{ yylineno++;
-        yycolumn=0;
-    }while(0)
-;
-
-	return c;
-}
-#endif	/* ifndef YY_NO_INPUT */
-
-/** Immediately switch to a different input stream.
- * @param input_file A readable stream.
- * @param yyscanner The scanner object.
- * @note This function does not reset the start condition to @c INITIAL .
- */
-    void quickstep_yyrestart  (FILE * input_file , yyscan_t yyscanner)
-{
-    struct 

<TRUNCATED>


[36/51] [abbrv] [partial] incubator-quickstep git commit: remove c++ files

Posted by sp...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/predicate/ComparisonPredicate.hpp
----------------------------------------------------------------------
diff --git a/expressions/predicate/ComparisonPredicate.hpp b/expressions/predicate/ComparisonPredicate.hpp
deleted file mode 100644
index 9030857..0000000
--- a/expressions/predicate/ComparisonPredicate.hpp
+++ /dev/null
@@ -1,156 +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_EXPRESSIONS_PREDICATE_COMPARISON_PREDICATE_HPP_
-#define QUICKSTEP_EXPRESSIONS_PREDICATE_COMPARISON_PREDICATE_HPP_
-
-#include <memory>
-#include <utility>
-
-#include "catalog/CatalogTypedefs.hpp"
-#include "expressions/Expressions.pb.h"
-#include "expressions/predicate/Predicate.hpp"
-#include "expressions/scalar/Scalar.hpp"
-#include "storage/StorageBlockInfo.hpp"
-#include "types/operations/comparisons/Comparison.hpp"
-#include "utility/Macros.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-class TupleIdSequence;
-class ValueAccessor;
-
-struct SubBlocksReference;
-
-/** \addtogroup Expressions
- *  @{
- */
-
-/**
- * @brief A Predicate which is a comparison of two scalar values.
- **/
-class ComparisonPredicate : public Predicate {
- public:
-  /**
-   * @brief Constructor
-   *
-   * @param Comparison The comparison operation to be performed.
-   * @param left_operand The left argument of the comparison, becomes owned by
-   *        this ComparisonPredicate.
-   * @param right_operand The right argument of the comparison, becomes owned
-   *        by this ComparisonPredicate.
-   **/
-  ComparisonPredicate(const Comparison &comparison,
-                      Scalar *left_operand,
-                      Scalar *right_operand);
-
-  ~ComparisonPredicate() override {
-  }
-
-  serialization::Predicate getProto() const override;
-
-  Predicate* clone() const override;
-
-  PredicateType getPredicateType() const override {
-    return kComparison;
-  }
-
-  bool isAttributeLiteralComparisonPredicate() const override;
-
-  bool matchesForSingleTuple(const ValueAccessor &accessor,
-                             const tuple_id tuple) const override;
-
-  bool matchesForJoinedTuples(
-      const ValueAccessor &left_accessor,
-      const relation_id left_relation_id,
-      const tuple_id left_tuple_id,
-      const ValueAccessor &right_accessor,
-      const relation_id right_relation_id,
-      const tuple_id right_tuple_id) const override;
-
-  TupleIdSequence* getAllMatches(ValueAccessor *accessor,
-                                 const SubBlocksReference *sub_blocks_ref,
-                                 const TupleIdSequence *filter,
-                                 const TupleIdSequence *existence_map) const override;
-
-  bool hasStaticResult() const override {
-    return (fast_comparator_.get() == nullptr);
-  }
-
-  bool getStaticResult() const override;
-
-  /**
-   * @brief Get the comparison operation for this predicate.
-   *
-   * @return This predicate's comparison.
-   **/
-  const Comparison& getComparison() const {
-    return comparison_;
-  }
-
-  /**
-   * @brief Get the left operand of this comparison.
-   *
-   * @return This comparison's left operand.
-   **/
-  const Scalar& getLeftOperand() const {
-    DCHECK(left_operand_.get() != nullptr);
-    return *left_operand_;
-  }
-
-  /**
-   * @brief Get the right operand of this comparison.
-   *
-   * @return This comparison's right operand.
-   **/
-  const Scalar& getRightOperand() const {
-    DCHECK(right_operand_.get() != nullptr);
-    return *right_operand_;
-  }
-
-  /**
-   * @brief For an attribute-literal comparison, determine whether the
-   *        attribute is on the left and what its attribute_id is.
-   * @warning This is only usable if isAttributeLiteralComparisonPredicate() is
-   *          true.
-   *
-   * @return A pair: first is true if attribute is on the left, false if on the
-   *         right. second is the ID of the attribute.
-   **/
-  std::pair<bool, attribute_id> getAttributeFromAttributeLiteralComparison() const;
-
- private:
-  const Comparison &comparison_;
-  std::unique_ptr<Scalar> left_operand_;
-  std::unique_ptr<Scalar> right_operand_;
-  bool static_result_;
-  std::unique_ptr<UncheckedComparator> fast_comparator_;
-
-  void initHelper(bool own_children);
-
-  DISALLOW_COPY_AND_ASSIGN(ComparisonPredicate);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_EXPRESSIONS_PREDICATE_COMPARISON_PREDICATE_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/predicate/ConjunctionPredicate.cpp
----------------------------------------------------------------------
diff --git a/expressions/predicate/ConjunctionPredicate.cpp b/expressions/predicate/ConjunctionPredicate.cpp
deleted file mode 100644
index 4f5cc77..0000000
--- a/expressions/predicate/ConjunctionPredicate.cpp
+++ /dev/null
@@ -1,201 +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 "expressions/predicate/ConjunctionPredicate.hpp"
-
-#include <memory>
-
-#include "expressions/Expressions.pb.h"
-#include "expressions/predicate/Predicate.hpp"
-#include "storage/TupleIdSequence.hpp"
-#include "storage/ValueAccessor.hpp"
-#include "utility/PtrList.hpp"
-
-namespace quickstep {
-
-serialization::Predicate ConjunctionPredicate::getProto() const {
-  serialization::Predicate proto;
-  proto.set_predicate_type(serialization::Predicate::CONJUNCTION);
-
-  for (PtrList<Predicate>::const_iterator it = static_operand_list_.begin();
-       it != static_operand_list_.end();
-       ++it) {
-    proto.AddExtension(serialization::PredicateWithList::operands)->CopyFrom(it->getProto());
-  }
-
-  for (PtrList<Predicate>::const_iterator it = dynamic_operand_list_.begin();
-       it != dynamic_operand_list_.end();
-       ++it) {
-    proto.AddExtension(serialization::PredicateWithList::operands)->CopyFrom(it->getProto());
-  }
-
-  return proto;
-}
-
-Predicate* ConjunctionPredicate::clone() const {
-  ConjunctionPredicate *clone = new ConjunctionPredicate();
-
-  for (PtrList<Predicate>::const_iterator it = static_operand_list_.begin();
-       it != static_operand_list_.end();
-       ++it) {
-    clone->addPredicate(it->clone());
-  }
-
-  for (PtrList<Predicate>::const_iterator it = dynamic_operand_list_.begin();
-       it != dynamic_operand_list_.end();
-       ++it) {
-    clone->addPredicate(it->clone());
-  }
-
-  return clone;
-}
-
-bool ConjunctionPredicate::matchesForSingleTuple(const ValueAccessor &accessor,
-                                                 const tuple_id tuple) const {
-  if (has_static_result_) {
-    return static_result_;
-  } else {
-    for (PtrList<Predicate>::const_iterator it = dynamic_operand_list_.begin();
-         it != dynamic_operand_list_.end();
-         ++it) {
-      if (!it->matchesForSingleTuple(accessor, tuple)) {
-        return false;
-      }
-    }
-
-    return true;
-  }
-}
-
-bool ConjunctionPredicate::matchesForJoinedTuples(
-    const ValueAccessor &left_accessor,
-    const relation_id left_relation_id,
-    const tuple_id left_tuple_id,
-    const ValueAccessor &right_accessor,
-    const relation_id right_relation_id,
-    const tuple_id right_tuple_id) const {
-  if (has_static_result_) {
-    return static_result_;
-  } else {
-    for (PtrList<Predicate>::const_iterator it = dynamic_operand_list_.begin();
-         it != dynamic_operand_list_.end();
-         ++it) {
-      if (!it->matchesForJoinedTuples(left_accessor,
-                                      left_relation_id,
-                                      left_tuple_id,
-                                      right_accessor,
-                                      right_relation_id,
-                                      right_tuple_id)) {
-        return false;
-      }
-    }
-
-    return true;
-  }
-}
-
-TupleIdSequence* ConjunctionPredicate::getAllMatches(
-    ValueAccessor *accessor,
-    const SubBlocksReference *sub_blocks_ref,
-    const TupleIdSequence *filter,
-    const TupleIdSequence *existence_map) const {
-  if (has_static_result_) {
-    return GenerateSequenceForStaticResult(accessor, filter, existence_map, static_result_);
-  } else {
-    tuple_id end_pos = accessor->getEndPositionVirtual();
-
-    TupleIdSequence *current_filter = new TupleIdSequence(end_pos);
-    if (filter != nullptr) {
-      current_filter->assignFrom(*filter);
-    } else if (existence_map != nullptr) {
-      current_filter->assignFrom(*existence_map);
-    } else {
-      current_filter->setRange(0, end_pos, true);
-    }
-
-    for (PtrList<Predicate>::const_iterator it = dynamic_operand_list_.begin();
-         it != dynamic_operand_list_.end();
-         ++it) {
-      if (current_filter->empty()) {
-        break;
-      }
-      std::unique_ptr<TupleIdSequence> operand_result(it->getAllMatches(accessor,
-                                                                        sub_blocks_ref,
-                                                                        current_filter,
-                                                                        existence_map));
-      current_filter->intersectWith(*operand_result);
-    }
-
-    return current_filter;
-  }
-}
-
-void ConjunctionPredicate::addPredicate(Predicate *operand) {
-  if (operand->getPredicateType() == kConjunction) {
-    ConjunctionPredicate *conjunction_operand = static_cast<ConjunctionPredicate*>(operand);
-
-    PtrList<Predicate>::iterator checkpos;
-    if (static_operand_list_.empty()) {
-      static_operand_list_.splice(static_operand_list_.end(), conjunction_operand->static_operand_list_);
-      checkpos = static_operand_list_.begin();
-    } else {
-      checkpos = static_operand_list_.end();
-      --checkpos;
-      static_operand_list_.splice(static_operand_list_.end(), conjunction_operand->static_operand_list_);
-      ++checkpos;
-    }
-
-    while (checkpos != static_operand_list_.end()) {
-      processStaticOperand(*checkpos);
-      ++checkpos;
-    }
-
-    if (!conjunction_operand->dynamic_operand_list_.empty()) {
-      dynamic_operand_list_.splice(dynamic_operand_list_.end(), conjunction_operand->dynamic_operand_list_);
-      processDynamicOperand();
-    }
-
-    delete conjunction_operand;
-  } else {
-    if (operand->hasStaticResult()) {
-      static_operand_list_.push_back(operand);
-      processStaticOperand(*operand);
-    } else {
-      dynamic_operand_list_.push_back(operand);
-      processDynamicOperand();
-    }
-  }
-}
-
-void ConjunctionPredicate::processStaticOperand(const Predicate &operand) {
-  if (!operand.getStaticResult()) {
-    has_static_result_ = true;
-    static_result_ = false;
-  }
-}
-
-void ConjunctionPredicate::processDynamicOperand() {
-  if (has_static_result_) {
-    if (static_result_) {
-      has_static_result_ = false;
-    }
-  }
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/predicate/ConjunctionPredicate.hpp
----------------------------------------------------------------------
diff --git a/expressions/predicate/ConjunctionPredicate.hpp b/expressions/predicate/ConjunctionPredicate.hpp
deleted file mode 100644
index b24036a..0000000
--- a/expressions/predicate/ConjunctionPredicate.hpp
+++ /dev/null
@@ -1,97 +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_EXPRESSIONS_PREDICATE_CONJUNCTION_PREDICATE_HPP_
-#define QUICKSTEP_EXPRESSIONS_PREDICATE_CONJUNCTION_PREDICATE_HPP_
-
-#include "catalog/CatalogTypedefs.hpp"
-#include "expressions/Expressions.pb.h"
-#include "expressions/predicate/Predicate.hpp"
-#include "expressions/predicate/PredicateWithList.hpp"
-#include "storage/StorageBlockInfo.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-
-class TupleIdSequence;
-class ValueAccessor;
-
-struct SubBlocksReference;
-
-/** \addtogroup Expressions
- *  @{
- */
-
-/**
- * @brief A conjunction of other Predicates.
- **/
-class ConjunctionPredicate : public PredicateWithList {
- public:
-  /**
-   * @brief Constructor.
-   **/
-  ConjunctionPredicate()
-      : PredicateWithList() {
-  }
-
-  serialization::Predicate getProto() const override;
-
-  Predicate *clone() const override;
-
-  PredicateType getPredicateType() const override {
-    return kConjunction;
-  }
-
-  bool matchesForSingleTuple(const ValueAccessor &accessor,
-                             const tuple_id tuple) const override;
-
-  bool matchesForJoinedTuples(
-      const ValueAccessor &left_accessor,
-      const relation_id left_relation_id,
-      const tuple_id left_tuple_id,
-      const ValueAccessor &right_accessor,
-      const relation_id right_relation_id,
-      const tuple_id right_tuple_id) const override;
-
-  TupleIdSequence* getAllMatches(ValueAccessor *accessor,
-                                 const SubBlocksReference *sub_blocks_ref,
-                                 const TupleIdSequence *filter,
-                                 const TupleIdSequence *existence_map) const override;
-
-  /**
-   * @brief Add a predicate to this conjunction.
-   * @note If operand is another ConjunctionPredicate, it will be flattened
-   *       into this Predicate, rather than nested beneath it.
-   *
-   * @param operand The predicate to add, becomes owned by this Predicate.
-   **/
-  void addPredicate(Predicate *operand);
-
- private:
-  void processStaticOperand(const Predicate &operand);
-  void processDynamicOperand();
-
-  DISALLOW_COPY_AND_ASSIGN(ConjunctionPredicate);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_EXPRESSIONS_PREDICATE_CONJUNCTION_PREDICATE_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/predicate/DisjunctionPredicate.cpp
----------------------------------------------------------------------
diff --git a/expressions/predicate/DisjunctionPredicate.cpp b/expressions/predicate/DisjunctionPredicate.cpp
deleted file mode 100644
index e117c99..0000000
--- a/expressions/predicate/DisjunctionPredicate.cpp
+++ /dev/null
@@ -1,222 +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 "expressions/predicate/DisjunctionPredicate.hpp"
-
-#include <memory>
-
-#include "expressions/Expressions.pb.h"
-#include "expressions/predicate/Predicate.hpp"
-#include "storage/TupleIdSequence.hpp"
-#include "storage/ValueAccessor.hpp"
-#include "utility/PtrList.hpp"
-
-namespace quickstep {
-
-serialization::Predicate DisjunctionPredicate::getProto() const {
-  serialization::Predicate proto;
-  proto.set_predicate_type(serialization::Predicate::DISJUNCTION);
-
-  for (PtrList<Predicate>::const_iterator it(static_operand_list_.begin());
-       it != static_operand_list_.end();
-       ++it) {
-    proto.AddExtension(serialization::PredicateWithList::operands)->CopyFrom(it->getProto());
-  }
-
-  for (PtrList<Predicate>::const_iterator it(dynamic_operand_list_.begin());
-       it != dynamic_operand_list_.end();
-       ++it) {
-    proto.AddExtension(serialization::PredicateWithList::operands)->CopyFrom(it->getProto());
-  }
-
-  return proto;
-}
-
-Predicate* DisjunctionPredicate::clone() const {
-  DisjunctionPredicate *clone = new DisjunctionPredicate();
-
-  for (PtrList<Predicate>::const_iterator it = static_operand_list_.begin();
-       it != static_operand_list_.end();
-       ++it) {
-    clone->addPredicate(it->clone());
-  }
-
-  for (PtrList<Predicate>::const_iterator it = dynamic_operand_list_.begin();
-       it != dynamic_operand_list_.end();
-       ++it) {
-    clone->addPredicate(it->clone());
-  }
-
-  return clone;
-}
-
-bool DisjunctionPredicate::matchesForSingleTuple(const ValueAccessor &accessor,
-                                                 const tuple_id tuple) const {
-  if (has_static_result_) {
-    return static_result_;
-  } else {
-    for (PtrList<Predicate>::const_iterator it = dynamic_operand_list_.begin();
-         it != dynamic_operand_list_.end();
-         ++it) {
-      if (it->matchesForSingleTuple(accessor, tuple)) {
-        return true;
-      }
-    }
-
-    return false;
-  }
-}
-
-bool DisjunctionPredicate::matchesForJoinedTuples(
-    const ValueAccessor &left_accessor,
-    const relation_id left_relation_id,
-    const tuple_id left_tuple_id,
-    const ValueAccessor &right_accessor,
-    const relation_id right_relation_id,
-    const tuple_id right_tuple_id) const {
-  if (has_static_result_) {
-    return static_result_;
-  } else {
-    for (PtrList<Predicate>::const_iterator it = dynamic_operand_list_.begin();
-         it != dynamic_operand_list_.end();
-         ++it) {
-      if (it->matchesForJoinedTuples(left_accessor,
-                                     left_relation_id,
-                                     left_tuple_id,
-                                     right_accessor,
-                                     right_relation_id,
-                                     right_tuple_id)) {
-        return true;
-      }
-    }
-
-    return false;
-  }
-}
-
-TupleIdSequence* DisjunctionPredicate::getAllMatches(
-    ValueAccessor *accessor,
-    const SubBlocksReference *sub_blocks_ref,
-    const TupleIdSequence *filter,
-    const TupleIdSequence *existence_map) const {
-  if (has_static_result_) {
-    return GenerateSequenceForStaticResult(accessor, filter, existence_map, static_result_);
-  } else {
-    tuple_id end_pos = accessor->getEndPositionVirtual();
-    TupleIdSequence *union_result = new TupleIdSequence(end_pos);
-
-#ifdef QUICKSTEP_ENABLE_VECTOR_PREDICATE_SHORT_CIRCUIT
-    std::unique_ptr<TupleIdSequence> current_filter(new TupleIdSequence(end_pos));
-    if (filter != nullptr) {
-      current_filter->assignFrom(*filter);
-    } else if (existence_map != nullptr) {
-      current_filter->assignFrom(*existence_map);
-    } else {
-      current_filter->setRange(0, end_pos, true);
-    }
-#endif  // QUICKSTEP_ENABLE_VECTOR_PREDICATE_SHORT_CIRCUIT
-
-    for (PtrList<Predicate>::const_iterator it = dynamic_operand_list_.begin();
-         it != dynamic_operand_list_.end();
-         ++it) {
-#ifdef QUICKSTEP_ENABLE_VECTOR_PREDICATE_SHORT_CIRCUIT
-      std::unique_ptr<TupleIdSequence> operand_result(it->getAllMatches(accessor,
-                                                                        sub_blocks_ref,
-                                                                        current_filter.get(),
-                                                                        existence_map));
-#else
-      std::unique_ptr<TupleIdSequence> operand_result(it->getAllMatches(accessor,
-                                                                        sub_blocks_ref,
-                                                                        filter,
-                                                                        existence_map));
-#endif  // QUICKSTEP_ENABLE_VECTOR_PREDICATE_SHORT_CIRCUIT
-      union_result->unionWith(*operand_result);
-
-#ifdef QUICKSTEP_ENABLE_VECTOR_PREDICATE_SHORT_CIRCUIT
-      // Don't bother checking tuples which are already known to match some
-      // part of the union.
-      operand_result->invert();
-      current_filter->intersectWith(*operand_result);
-#endif  // QUICKSTEP_ENABLE_VECTOR_PREDICATE_SHORT_CIRCUIT
-    }
-
-    return union_result;
-  }
-}
-
-void DisjunctionPredicate::addPredicate(Predicate *operand) {
-  if (operand->getPredicateType() == kDisjunction) {
-    DisjunctionPredicate *disjunction_operand = static_cast<DisjunctionPredicate*>(operand);
-
-    PtrList<Predicate>::iterator checkpos;
-    if (static_operand_list_.empty()) {
-      static_operand_list_.splice(static_operand_list_.end(), disjunction_operand->static_operand_list_);
-      checkpos = static_operand_list_.begin();
-    } else {
-      checkpos = static_operand_list_.end();
-      --checkpos;
-      static_operand_list_.splice(static_operand_list_.end(), disjunction_operand->static_operand_list_);
-      ++checkpos;
-    }
-
-    while (checkpos != static_operand_list_.end()) {
-      processStaticOperand(*checkpos);
-      ++checkpos;
-    }
-
-    if (!disjunction_operand->dynamic_operand_list_.empty()) {
-      dynamic_operand_list_.splice(dynamic_operand_list_.end(), disjunction_operand->dynamic_operand_list_);
-      processDynamicOperand();
-    }
-
-    delete disjunction_operand;
-  } else {
-    if (operand->hasStaticResult()) {
-      static_operand_list_.push_back(operand);
-      processStaticOperand(*operand);
-    } else {
-      dynamic_operand_list_.push_back(operand);
-      processDynamicOperand();
-    }
-  }
-}
-
-void DisjunctionPredicate::processStaticOperand(const Predicate &operand) {
-  if (operand.getStaticResult()) {
-    has_static_result_ = true;
-    static_result_ = true;
-  } else if (fresh_) {
-    has_static_result_ = true;
-    static_result_ = false;
-  }
-
-  fresh_ = false;
-}
-
-void DisjunctionPredicate::processDynamicOperand() {
-  if (has_static_result_ && !static_result_) {
-    has_static_result_ = false;
-  } else if (fresh_) {
-    has_static_result_ = false;
-  }
-
-  fresh_ = false;
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/predicate/DisjunctionPredicate.hpp
----------------------------------------------------------------------
diff --git a/expressions/predicate/DisjunctionPredicate.hpp b/expressions/predicate/DisjunctionPredicate.hpp
deleted file mode 100644
index 2127573..0000000
--- a/expressions/predicate/DisjunctionPredicate.hpp
+++ /dev/null
@@ -1,99 +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_EXPRESSIONS_PREDICATE_DISJUNCTION_PREDICATE_HPP_
-#define QUICKSTEP_EXPRESSIONS_PREDICATE_DISJUNCTION_PREDICATE_HPP_
-
-#include "catalog/CatalogTypedefs.hpp"
-#include "expressions/Expressions.pb.h"
-#include "expressions/predicate/Predicate.hpp"
-#include "expressions/predicate/PredicateWithList.hpp"
-#include "storage/StorageBlockInfo.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-
-class TupleIdSequence;
-class ValueAccessor;
-
-struct SubBlocksReference;
-
-/** \addtogroup Expressions
- *  @{
- */
-
-/**
- * @brief A disjunction of other Predicates.
- **/
-class DisjunctionPredicate : public PredicateWithList {
- public:
-  /**
-   * @brief Constructor.
-   **/
-  DisjunctionPredicate()
-      : PredicateWithList(), fresh_(true) {
-  }
-
-  serialization::Predicate getProto() const override;
-
-  Predicate* clone() const override;
-
-  PredicateType getPredicateType() const override {
-    return kDisjunction;
-  }
-
-  bool matchesForSingleTuple(const ValueAccessor &accessor,
-                             const tuple_id tuple) const override;
-
-  bool matchesForJoinedTuples(
-      const ValueAccessor &left_accessor,
-      const relation_id left_relation_id,
-      const tuple_id left_tuple_id,
-      const ValueAccessor &right_accessor,
-      const relation_id right_relation_id,
-      const tuple_id right_tuple_id) const override;
-
-  TupleIdSequence* getAllMatches(ValueAccessor *accessor,
-                                 const SubBlocksReference *sub_blocks_ref,
-                                 const TupleIdSequence *filter,
-                                 const TupleIdSequence *existence_map) const override;
-
-  /**
-   * @brief Add a predicate to this disjunction.
-   * @note If operand is another DusjunctionPredicate, it will be flattened
-   *       into this Predicate, rather than nested beneath it.
-   *
-   * @param operand The predicate to add, becomes owned by this Predicate.
-   **/
-  void addPredicate(Predicate *operand);
-
- private:
-  void processStaticOperand(const Predicate &operand);
-  void processDynamicOperand();
-
-  bool fresh_;
-
-  DISALLOW_COPY_AND_ASSIGN(DisjunctionPredicate);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_EXPRESSIONS_PREDICATE_DISJUNCTION_PREDICATE_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/predicate/NegationPredicate.cpp
----------------------------------------------------------------------
diff --git a/expressions/predicate/NegationPredicate.cpp b/expressions/predicate/NegationPredicate.cpp
deleted file mode 100644
index bee1c8d..0000000
--- a/expressions/predicate/NegationPredicate.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 "expressions/predicate/NegationPredicate.hpp"
-
-#include "expressions/Expressions.pb.h"
-#include "expressions/predicate/Predicate.hpp"
-#include "storage/TupleIdSequence.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-
-class ValueAccessor;
-
-serialization::Predicate NegationPredicate::getProto() const {
-  serialization::Predicate proto;
-  proto.set_predicate_type(serialization::Predicate::NEGATION);
-  proto.MutableExtension(serialization::NegationPredicate::operand)->CopyFrom(operand_->getProto());
-
-  return proto;
-}
-
-Predicate* NegationPredicate::clone() const {
-  return new NegationPredicate(operand_->clone());
-}
-
-bool NegationPredicate::matchesForSingleTuple(const ValueAccessor &accessor,
-                                              const tuple_id tuple) const {
-  if (has_static_result_) {
-    return static_result_;
-  } else {
-    return !(operand_->matchesForSingleTuple(accessor, tuple));
-  }
-}
-
-bool NegationPredicate::matchesForJoinedTuples(
-    const ValueAccessor &left_accessor,
-    const relation_id left_relation_id,
-    const tuple_id left_tuple_id,
-    const ValueAccessor &right_accessor,
-    const relation_id right_relation_id,
-    const tuple_id right_tuple_id) const {
-  if (has_static_result_) {
-    return static_result_;
-  } else {
-    return !(operand_->matchesForJoinedTuples(left_accessor,
-                                              left_relation_id,
-                                              left_tuple_id,
-                                              right_accessor,
-                                              right_relation_id,
-                                              right_tuple_id));
-  }
-}
-
-TupleIdSequence* NegationPredicate::getAllMatches(
-    ValueAccessor *accessor,
-    const SubBlocksReference *sub_blocks_ref,
-    const TupleIdSequence *filter,
-    const TupleIdSequence *existence_map) const {
-  if (has_static_result_) {
-    return GenerateSequenceForStaticResult(accessor, filter, existence_map, static_result_);
-  } else {
-    TupleIdSequence *operand_matches = operand_->getAllMatches(accessor,
-                                                               sub_blocks_ref,
-                                                               filter,
-                                                               existence_map);
-
-    operand_matches->invert();
-    if (filter != nullptr) {
-      operand_matches->intersectWith(*filter);
-    }
-    if (existence_map != nullptr) {
-      operand_matches->intersectWith(*existence_map);
-    }
-    return operand_matches;
-  }
-}
-
-bool NegationPredicate::getStaticResult() const {
-  if (has_static_result_) {
-    return static_result_;
-  } else {
-    FATAL_ERROR("Called getStaticResult() on a predicate which has no static result");
-  }
-}
-
-void NegationPredicate::initHelper() {
-  if (operand_->hasStaticResult()) {
-    has_static_result_ = true;
-    static_result_ = !operand_->getStaticResult();
-  } else {
-    has_static_result_ = false;
-  }
-}
-
-Predicate* NegationPredicate::NegatePredicate(Predicate *operand) {
-  if (operand->getPredicateType() == kNegation) {
-    NegationPredicate *negation_operand = static_cast<NegationPredicate*>(operand);
-    Predicate *inner = negation_operand->operand_.release();
-    delete negation_operand;
-    return inner;
-  } else {
-    return new NegationPredicate(operand);
-  }
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/predicate/NegationPredicate.hpp
----------------------------------------------------------------------
diff --git a/expressions/predicate/NegationPredicate.hpp b/expressions/predicate/NegationPredicate.hpp
deleted file mode 100644
index 33c6df8..0000000
--- a/expressions/predicate/NegationPredicate.hpp
+++ /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.
- **/
-
-#ifndef QUICKSTEP_EXPRESSIONS_PREDICATE_NEGATION_PREDICATE_HPP_
-#define QUICKSTEP_EXPRESSIONS_PREDICATE_NEGATION_PREDICATE_HPP_
-
-#include <memory>
-
-#include "catalog/CatalogTypedefs.hpp"
-#include "expressions/Expressions.pb.h"
-#include "expressions/predicate/Predicate.hpp"
-#include "storage/StorageBlockInfo.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-
-class TupleIdSequence;
-class ValueAccessor;
-
-struct SubBlocksReference;
-
-/** \addtogroup Expressions
- *  @{
- */
-
-/**
- * @brief A negation of another Predicate.
- **/
-class NegationPredicate : public Predicate {
- public:
-  /**
-   * @brief Constructor.
-   * @note The static factory method NegatePredicate (which is able to simplify
-   *       away double-negations) should be used instead of this constructor in
-   *       most cases.
-   *
-   * @param operand The Predicate which will be negated, becomes owned by this
-   *        NegationPredicate.
-   **/
-  explicit NegationPredicate(Predicate *operand):
-    operand_(operand) {
-    initHelper();
-  }
-
-  /**
-   * @brief Destructor which also deletes the operand.
-   **/
-  ~NegationPredicate() override {
-  }
-
-  /**
-   * @brief Static method to obtain the negated form of a Predicate. This
-   *        should be used instead of invoking NegationPredicate's constructor,
-   *        as it allows double-negations to be simplified away.
-   *
-   * @param operand The Predicate to negate. Caller relinquishes ownership of
-   *        operand by calling this method.
-   * @return The negative of operand.
-   **/
-  static Predicate* NegatePredicate(Predicate *operand);
-
-  serialization::Predicate getProto() const override;
-
-  Predicate* clone() const override;
-
-  PredicateType getPredicateType() const override {
-    return kNegation;
-  }
-
-  bool matchesForSingleTuple(const ValueAccessor &accessor,
-                             const tuple_id tuple) const override;
-
-  bool matchesForJoinedTuples(
-      const ValueAccessor &left_accessor,
-      const relation_id left_relation_id,
-      const tuple_id left_tuple_id,
-      const ValueAccessor &right_accessor,
-      const relation_id right_relation_id,
-      const tuple_id right_tuple_id) const override;
-
-  TupleIdSequence* getAllMatches(ValueAccessor *accessor,
-                                 const SubBlocksReference *sub_blocks_ref,
-                                 const TupleIdSequence *filter,
-                                 const TupleIdSequence *existence_map) const override;
-
-  bool hasStaticResult() const override {
-    return has_static_result_;
-  }
-
-  bool getStaticResult() const override;
-
- private:
-  void initHelper();
-
-  std::unique_ptr<Predicate> operand_;
-
-  bool has_static_result_;
-  bool static_result_;
-
-  friend class PredicateTest;
-
-  DISALLOW_COPY_AND_ASSIGN(NegationPredicate);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_EXPRESSIONS_PREDICATE_NEGATION_PREDICATE_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/predicate/Predicate.cpp
----------------------------------------------------------------------
diff --git a/expressions/predicate/Predicate.cpp b/expressions/predicate/Predicate.cpp
deleted file mode 100644
index 006e8f1..0000000
--- a/expressions/predicate/Predicate.cpp
+++ /dev/null
@@ -1,60 +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 "expressions/predicate/Predicate.hpp"
-
-#include "storage/TupleIdSequence.hpp"
-#include "storage/ValueAccessor.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-
-const char *Predicate::kPredicateTypeNames[] = {
-  "True",
-  "False",
-  "Comparison",
-  "Negation",
-  "Conjunction",
-  "Disjunction"
-};
-
-bool Predicate::getStaticResult() const {
-  FATAL_ERROR("Called getStaticResult() on a predicate which has no static result");
-}
-
-TupleIdSequence* Predicate::GenerateSequenceForStaticResult(
-    ValueAccessor *accessor,
-    const TupleIdSequence *filter,
-    const TupleIdSequence *existence_map,
-    const bool static_result) {
-  TupleIdSequence *result = new TupleIdSequence(accessor->getEndPositionVirtual());
-  if (static_result) {
-    if (filter != nullptr) {
-      // '*filter' will always be a subset of '*existence_map'.
-      result->assignFrom(*filter);
-    } else if (existence_map != nullptr) {
-      result->assignFrom(*existence_map);
-    } else {
-      result->setRange(0, result->length(), true);
-    }
-  }
-  return result;
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/predicate/Predicate.hpp
----------------------------------------------------------------------
diff --git a/expressions/predicate/Predicate.hpp b/expressions/predicate/Predicate.hpp
deleted file mode 100644
index 5fb3ef5..0000000
--- a/expressions/predicate/Predicate.hpp
+++ /dev/null
@@ -1,208 +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_EXPRESSIONS_PREDICATE_PREDICATE_HPP_
-#define QUICKSTEP_EXPRESSIONS_PREDICATE_PREDICATE_HPP_
-
-#include "catalog/CatalogTypedefs.hpp"
-#include "expressions/Expressions.pb.h"
-#include "storage/StorageBlockInfo.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-
-class TupleIdSequence;
-class ValueAccessor;
-
-struct SubBlocksReference;
-
-/** \addtogroup Expressions
- *  @{
- */
-
-/**
- * @brief Base class for all predicates.
- **/
-class Predicate {
- public:
-  /**
-   * @brief The possible types of predicates.
-   **/
-  enum PredicateType {
-    kTrue = 0,
-    kFalse,
-    kComparison,
-    kNegation,
-    kConjunction,
-    kDisjunction,
-    kNumPredicateTypes  // Not a real PredicateType, exists for counting purposes.
-  };
-
-  /**
-   * @brief Strings naming the elements in PredicateType.
-   * @note String literals are defined out-of-line in Predicate.cpp
-   **/
-  static const char *kPredicateTypeNames[kNumPredicateTypes];
-
-  /**
-   * @brief Virtual destructor.
-   *
-   **/
-  virtual ~Predicate() {
-  }
-
-  /**
-   * @brief Serialize this predicate in Protocol Buffer form.
-   *
-   * @return The Protocol Buffer representation of this predicate object.
-   **/
-  virtual serialization::Predicate getProto() const = 0;
-
-  /**
-   * @brief Make a deep copy of this Predicate.
-   *
-   * @return A cloned copy of this Predicate.
-   **/
-  virtual Predicate* clone() const = 0;
-
-  /**
-   * @brief Get the type of this particular Predicate instance.
-   *
-   * @return The type of this Predicate.
-   **/
-  virtual PredicateType getPredicateType() const = 0;
-
-  /**
-   * @brief Check whether this predicate is a comparison of the form
-   *        'attribute comp literal' or 'literal comp attribute'.
-   **/
-  virtual bool isAttributeLiteralComparisonPredicate() const {
-    return false;
-  }
-
-  /**
-   * @brief Determine whether the given tuple in the given TupleStorageSubBlock
-   *        matches this predicate.
-   * @note This only works for predicates which can be evaluated on a single
-   *       table. Use matchesForJoinedTuples() to evaluate join predicates.
-   *
-   * @param accessor ValueAccessor that will be used to read the tuple to check
-   *        this Predicate on.
-   * @param tuple The ID of the tuple in tupleStore to check this Predicate on.
-   * @return Whether the specified tuple matches this predicate.
-   **/
-  virtual bool matchesForSingleTuple(const ValueAccessor &accessor,
-                                     const tuple_id tuple) const = 0;
-
-  /**
-   * @brief Determine whether this predicate matches for a given pair of joined
-   *        tuples.
-   *
-   * @param left_accessor The ValueAccessor that the first of the joined tuples
-   *        will be read from (this does NOT necessarily correspond to the left
-   *        operand of a binary operation).
-   * @param left_relation_id The ID of the relation that left_accessor provides
-   *        access to.
-   * @param left_tuple_id The ID of the tuple (the absolute position) from
-   *        left_accessor to evaluate this Predicate for.
-   * @param right_accessor The ValueAccessor that the second of the joined
-   *        tuples will be read from (this does NOT necessarily correspond to
-   *        the right operand of a binary operation).
-   * @param right_relation_id The ID of the relation that right_accessor
-   *        provides access to.
-   * @param right_tuple_id The ID of the tuple (the absolute position) from
-   *        right_accessor to evaluate this Predicate for.
-   * @return Whether this predicate is true for the given tuples.
-   **/
-  // TODO(chasseur): Add vectorized method for getting/filtering matches across
-  // a join all at once. In the general case, this might require materializing
-  // an expression across the cross product of all tuples in a pair of blocks
-  // (which could incur prohibitively high temporary memory costs), although
-  // there are plenty of common cases where this can be avoided (e.g. filtering
-  // a smallish set of matches from a hash-join by a residual predicate).
-  virtual bool matchesForJoinedTuples(
-      const ValueAccessor &left_accessor,
-      const relation_id left_relation_id,
-      const tuple_id left_tuple_id,
-      const ValueAccessor &right_accessor,
-      const relation_id right_relation_id,
-      const tuple_id right_tuple_id) const = 0;
-
-  /**
-   * @brief Determine whether this predicate is true for all tuples accessible
-   *        via a ValueAccessor.
-   *
-   * @param accessor A ValueAccessor which will be used to read attribute
-   *        values.
-   * @param sub_blocks_ref If non-NULL, contains references to the
-   *        TupleStorageSubBlock that produced accessor and any IndexSubBlocks
-   *        in the same StorageBlock. These sub-blocks may be used for
-   *        fast-path (non-scan) evaluation of parts of this predicate. May be
-   *        NULL, in which case scan-based evaluation is always used.
-   * @param filter If non-NULL, then only tuple IDs which are set in the
-   *        filter will be checked (all others will be assumed to be false).
-   * @param existence_map If non-NULL, this indicates which tuples actually
-   *        exist and are accessible via ValueAccessor (this is intended for
-   *        use with ValueAccessors that read values from non-packed
-   *        TupleStorageSubBlocks).
-   * @return The IDs of tuples accessible via accessor that match this
-   *         predicate.
-   **/
-  virtual TupleIdSequence* getAllMatches(ValueAccessor *accessor,
-                                         const SubBlocksReference *sub_blocks_ref,
-                                         const TupleIdSequence *filter,
-                                         const TupleIdSequence *existence_map) const = 0;
-
-  /**
-   * @brief Determine whether this predicate's result is static (i.e. whether
-   *        it can be evaluated completely independent of any tuples).
-   *
-   * @return Whether this predicate's result is static.
-   **/
-  virtual bool hasStaticResult() const {
-    return false;
-  }
-
-  /**
-   * @brief Determine whether this predicate's static result is true or false.
-   * @note hasStaticResult() should be called first to check whether this
-   *       Predicate actually has a static result.
-   *
-   * @return The static result of this predicate.
-   **/
-  virtual bool getStaticResult() const;
-
- protected:
-  Predicate() {
-  }
-
-  static TupleIdSequence* GenerateSequenceForStaticResult(ValueAccessor *accessor,
-                                                          const TupleIdSequence *filter,
-                                                          const TupleIdSequence *existence_map,
-                                                          const bool static_result);
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(Predicate);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_EXPRESSIONS_PREDICATE_PREDICATE_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/predicate/PredicateCost.hpp
----------------------------------------------------------------------
diff --git a/expressions/predicate/PredicateCost.hpp b/expressions/predicate/PredicateCost.hpp
deleted file mode 100644
index 60e6721..0000000
--- a/expressions/predicate/PredicateCost.hpp
+++ /dev/null
@@ -1,62 +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_EXPRESSIONS_PREDICATE_PREDICATE_COST_HPP_
-#define QUICKSTEP_EXPRESSIONS_PREDICATE_PREDICATE_COST_HPP_
-
-#include <cstdint>
-#include <limits>
-
-namespace quickstep {
-
-/**
- * @brief Represents a simple estimation of the cost to evaluate a
- *        ComparisonPredicate using a particular sub-block.
- **/
-typedef std::uint8_t predicate_cost_t;
-
-namespace predicate_cost {
-
-// TODO(chasseur): For now, these static constants define an order of
-// preference for different predicate-evaluation methods. In the future, we may
-// want to use statistics to get more accurate cost estimation.
-static constexpr predicate_cost_t kConstantTime = 0;
-static constexpr predicate_cost_t kBitWeavingVScan = 1;
-static constexpr predicate_cost_t kBitWeavingHScan = 2;
-static constexpr predicate_cost_t kBinarySearch = 3;
-static constexpr predicate_cost_t kTreeSearch = 4;
-static constexpr predicate_cost_t kCompressedColumnScan = 5;
-static constexpr predicate_cost_t kColumnScan = 6;
-static constexpr predicate_cost_t kCompressedRowScan = 7;
-static constexpr predicate_cost_t kRowScan = 8;
-static constexpr predicate_cost_t kInfinite = std::numeric_limits<predicate_cost_t>::max();
-
-}  // namespace predicate_cost
-
-/**
- * @brief Determine if a predicate_cost_t represents a simple scan on a
- *        TupleStorageSubBlock.
- **/
-inline bool PredicateCostIsSimpleScan(const predicate_cost_t cost) {
-  return (cost == predicate_cost::kRowScan) || (cost == predicate_cost::kColumnScan);
-}
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_EXPRESSIONS_PREDICATE_PREDICATE_COST_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/predicate/PredicateWithList.hpp
----------------------------------------------------------------------
diff --git a/expressions/predicate/PredicateWithList.hpp b/expressions/predicate/PredicateWithList.hpp
deleted file mode 100644
index b1bf7e5..0000000
--- a/expressions/predicate/PredicateWithList.hpp
+++ /dev/null
@@ -1,77 +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_EXPRESSIONS_PREDICATE_PREDICATE_WITH_LIST_HPP_
-#define QUICKSTEP_EXPRESSIONS_PREDICATE_PREDICATE_WITH_LIST_HPP_
-
-#include "expressions/predicate/Predicate.hpp"
-#include "utility/Macros.hpp"
-#include "utility/PtrList.hpp"
-
-namespace quickstep {
-
-/** \addtogroup Expressions
- *  @{
- */
-
-/**
- * @brief Abstract base class for conjunctions and disjunctions.
- **/
-class PredicateWithList : public Predicate {
- public:
-  PredicateWithList()
-      : has_static_result_(true), static_result_(true) {
-  }
-
-  /**
-   * @brief Destructor which also deletes all operands.
-   **/
-  virtual ~PredicateWithList() {
-  }
-
-  bool hasStaticResult() const override {
-    return has_static_result_;
-  }
-
-  bool getStaticResult() const override {
-    if (has_static_result_) {
-      return static_result_;
-    } else {
-      FATAL_ERROR("Called getStaticResult() on a predicate which has no static result");
-    }
-  }
-
- protected:
-  PtrList<Predicate> static_operand_list_;
-  PtrList<Predicate> dynamic_operand_list_;
-
-  bool has_static_result_;
-  bool static_result_;
-
- private:
-  friend class PredicateTest;
-
-  DISALLOW_COPY_AND_ASSIGN(PredicateWithList);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_EXPRESSIONS_PREDICATE_PREDICATE_WITH_LIST_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/predicate/TrivialPredicates.hpp
----------------------------------------------------------------------
diff --git a/expressions/predicate/TrivialPredicates.hpp b/expressions/predicate/TrivialPredicates.hpp
deleted file mode 100644
index 4e44976..0000000
--- a/expressions/predicate/TrivialPredicates.hpp
+++ /dev/null
@@ -1,167 +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_EXPRESSIONS_PREDICATE_TRIVIAL_PREDICATES_HPP_
-#define QUICKSTEP_EXPRESSIONS_PREDICATE_TRIVIAL_PREDICATES_HPP_
-
-#include "catalog/CatalogTypedefs.hpp"
-#include "expressions/Expressions.pb.h"
-#include "expressions/predicate/Predicate.hpp"
-#include "storage/StorageBlockInfo.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-
-class TupleIdSequence;
-class ValueAccessor;
-
-struct SubBlocksReference;
-
-/** \addtogroup Expressions
- *  @{
- */
-
-/**
- * @brief Base class for trivial predicates which always evaluate to the same value.
- **/
-class TrivialPredicate : public Predicate {
- public:
-  bool hasStaticResult() const override {
-    return true;
-  }
-
- protected:
-  TrivialPredicate() {
-  }
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(TrivialPredicate);
-};
-
-/**
- * @brief Predicate which always evaluates to true.
- **/
-class TruePredicate : public TrivialPredicate {
- public:
-  TruePredicate() {
-  }
-
-  serialization::Predicate getProto() const override {
-    serialization::Predicate proto;
-    proto.set_predicate_type(serialization::Predicate::TRUE);
-
-    return proto;
-  }
-
-  Predicate* clone() const override {
-    return new TruePredicate();
-  }
-
-  PredicateType getPredicateType() const override {
-    return kTrue;
-  }
-
-  bool matchesForSingleTuple(const ValueAccessor &accessor,
-                             const tuple_id tuple) const override {
-    return true;
-  }
-
-  bool matchesForJoinedTuples(
-      const ValueAccessor &left_accessor,
-      const relation_id left_relation_id,
-      const tuple_id left_tuple_id,
-      const ValueAccessor &right_accessor,
-      const relation_id right_relation_id,
-      const tuple_id right_tuple_id) const override {
-    return true;
-  }
-
-  TupleIdSequence* getAllMatches(ValueAccessor *accessor,
-                                 const SubBlocksReference *sub_blocks_ref,
-                                 const TupleIdSequence *filter,
-                                 const TupleIdSequence *existence_map) const override {
-    return GenerateSequenceForStaticResult(accessor, filter, existence_map, true);
-  }
-
-  bool getStaticResult() const override {
-    return true;
-  }
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(TruePredicate);
-};
-
-/**
- * @brief Predicate which always evaluates to false.
- **/
-class FalsePredicate : public TrivialPredicate {
- public:
-  FalsePredicate() {
-  }
-
-  serialization::Predicate getProto() const override {
-    serialization::Predicate proto;
-    proto.set_predicate_type(serialization::Predicate::FALSE);
-
-    return proto;
-  }
-
-  Predicate* clone() const override {
-    return new FalsePredicate();
-  }
-
-  PredicateType getPredicateType() const override {
-    return kFalse;
-  }
-
-  bool matchesForSingleTuple(const ValueAccessor &accessor,
-                             const tuple_id tuple) const override {
-    return false;
-  }
-
-  bool matchesForJoinedTuples(
-      const ValueAccessor &left_accessor,
-      const relation_id left_relation_id,
-      const tuple_id left_tuple_id,
-      const ValueAccessor &right_accessor,
-      const relation_id right_relation_id,
-      const tuple_id right_tuple_id) const override {
-    return false;
-  }
-
-  TupleIdSequence* getAllMatches(ValueAccessor *accessor,
-                                 const SubBlocksReference *sub_blocks_ref,
-                                 const TupleIdSequence *filter,
-                                 const TupleIdSequence *existence_map) const override {
-    return GenerateSequenceForStaticResult(accessor, filter, existence_map, false);
-  }
-
-  bool getStaticResult() const override {
-    return false;
-  }
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(FalsePredicate);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_EXPRESSIONS_PREDICATE_TRIVIAL_PREDICATES_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/predicate/tests/Predicate_unittest.cpp
----------------------------------------------------------------------
diff --git a/expressions/predicate/tests/Predicate_unittest.cpp b/expressions/predicate/tests/Predicate_unittest.cpp
deleted file mode 100644
index 3c2889d..0000000
--- a/expressions/predicate/tests/Predicate_unittest.cpp
+++ /dev/null
@@ -1,447 +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 <cstddef>
-#include <cstdint>
-#include <limits>
-#include <memory>
-#include <string>
-
-#include "catalog/CatalogAttribute.hpp"
-#include "catalog/CatalogDatabase.hpp"
-#include "catalog/CatalogRelation.hpp"
-#include "expressions/ExpressionFactories.hpp"
-#include "expressions/predicate/ComparisonPredicate.hpp"
-#include "expressions/predicate/ConjunctionPredicate.hpp"
-#include "expressions/predicate/DisjunctionPredicate.hpp"
-#include "expressions/predicate/NegationPredicate.hpp"
-#include "expressions/predicate/Predicate.hpp"
-#include "expressions/predicate/PredicateWithList.hpp"
-#include "expressions/predicate/TrivialPredicates.hpp"
-#include "expressions/scalar/Scalar.hpp"
-#include "expressions/scalar/ScalarAttribute.hpp"
-#include "expressions/scalar/ScalarBinaryExpression.hpp"
-#include "expressions/scalar/ScalarLiteral.hpp"
-#include "expressions/scalar/ScalarUnaryExpression.hpp"
-#include "types/DatetimeLit.hpp"
-#include "types/IntervalLit.hpp"
-#include "types/Type.hpp"
-#include "types/TypeFactory.hpp"
-#include "types/TypeID.hpp"
-#include "types/TypedValue.hpp"
-#include "types/operations/binary_operations/BinaryOperation.hpp"
-#include "types/operations/binary_operations/BinaryOperationID.hpp"
-#include "types/operations/comparisons/Comparison.hpp"
-#include "types/operations/comparisons/ComparisonFactory.hpp"
-#include "types/operations/comparisons/ComparisonID.hpp"
-#include "types/operations/unary_operations/UnaryOperation.hpp"
-#include "types/operations/unary_operations/UnaryOperationID.hpp"
-#include "utility/Macros.hpp"
-#include "utility/PtrList.hpp"
-
-#include "gtest/gtest.h"
-
-using std::int64_t;
-using std::numeric_limits;
-using std::size_t;
-using std::string;
-using std::unique_ptr;
-
-namespace quickstep {
-
-class PredicateTest : public ::testing::Test {
- protected:
-  virtual void SetUp() {
-    database_.reset(new CatalogDatabase(NULL, "database_"));
-
-    rel_numeric_ = createCatalogRelation("rel_numeric_");
-    attr_int_ = createCatalogAttribute(rel_numeric_, "attr_int", TypeFactory::GetType(kInt));
-    attr_long_ = createCatalogAttribute(rel_numeric_, "attr_long", TypeFactory::GetType(kLong));
-    attr_float_ = createCatalogAttribute(rel_numeric_, "attr_float", TypeFactory::GetType(kFloat));
-    attr_double_ = createCatalogAttribute(rel_numeric_, "attr_double", TypeFactory::GetType(kDouble));
-
-    rel_date_ = createCatalogRelation("rel_date_");
-    attr_datetime_ = createCatalogAttribute(rel_date_, "attr_datetime", TypeFactory::GetType(kDatetime));
-    attr_datetime_interval_ =
-        createCatalogAttribute(rel_date_, "attr_datetime_interval", TypeFactory::GetType(kDatetimeInterval));
-    attr_year_month_interval_ =
-        createCatalogAttribute(rel_date_, "attr_year_month_interval", TypeFactory::GetType(kYearMonthInterval));
-  }
-
-  void checkComparisonPredicateSerialization(const Comparison &comparison) {
-    checkPredicateSerialization(ComparisonPredicate(comparison, createScalarInt(9), createScalarInt(-1)));
-    checkPredicateSerialization(
-        ComparisonPredicate(comparison, createScalarInt(0), createScalarLong(static_cast<int64_t>(9))));
-    checkPredicateSerialization(
-        ComparisonPredicate(comparison, createScalarInt(4), createScalarFloat(static_cast<float>(1.2))));
-    checkPredicateSerialization(
-        ComparisonPredicate(comparison, createScalarInt(7), createScalarDouble(static_cast<double>(3.14))));
-
-    checkPredicateSerialization(
-        ComparisonPredicate(comparison, createScalarLong(static_cast<int64_t>(-10)), createScalarInt(8)));
-    checkPredicateSerialization(
-        ComparisonPredicate(comparison,
-                            createScalarLong(static_cast<int64_t>(9)),
-                            createScalarLong(static_cast<int64_t>(-9))));
-    checkPredicateSerialization(
-        ComparisonPredicate(comparison,
-                            createScalarLong(static_cast<int64_t>(-9)),
-                            createScalarFloat(static_cast<float>(1.2))));
-    checkPredicateSerialization(
-        ComparisonPredicate(comparison,
-                            createScalarLong(static_cast<int64_t>(9)),
-                            createScalarDouble(static_cast<double>(3.14))));
-
-    checkPredicateSerialization(
-        ComparisonPredicate(comparison, createScalarFloat(static_cast<float>(1.2)), createScalarInt(-1)));
-    checkPredicateSerialization(
-        ComparisonPredicate(comparison,
-                            createScalarFloat(static_cast<float>(1.2)),
-                            createScalarLong(static_cast<int64_t>(-9))));
-    checkPredicateSerialization(
-        ComparisonPredicate(comparison,
-                            createScalarFloat(static_cast<float>(1.2)),
-                            createScalarFloat(static_cast<float>(-3.6))));
-    checkPredicateSerialization(
-        ComparisonPredicate(comparison,
-                            createScalarFloat(static_cast<float>(-1.2)),
-                            createScalarDouble(static_cast<double>(3.14))));
-
-    checkPredicateSerialization(
-        ComparisonPredicate(comparison, createScalarDouble(static_cast<double>(3.14)), createScalarInt(6)));
-    checkPredicateSerialization(
-        ComparisonPredicate(comparison,
-                            createScalarDouble(static_cast<double>(3.14)),
-                            createScalarLong(static_cast<int64_t>(-9))));
-    checkPredicateSerialization(
-        ComparisonPredicate(comparison,
-                            createScalarDouble(static_cast<double>(-3.14)),
-                            createScalarFloat(static_cast<float>(1.2))));
-    checkPredicateSerialization(
-        ComparisonPredicate(comparison,
-                            createScalarDouble(static_cast<double>(3.14)),
-                            createScalarDouble(static_cast<double>(-3.14))));
-
-    checkPredicateSerialization(
-        ComparisonPredicate(comparison,
-                            createScalarDatetime(numeric_limits<int64_t>::max()),
-                            createScalarNull(TypeFactory::GetType(kDatetime,
-                                                                  true /* nullable */))));
-
-    checkPredicateSerialization(
-        ComparisonPredicate(comparison,
-                            createScalarDatetimeInterval(numeric_limits<int64_t>::min()),
-                            createScalarNull(TypeFactory::GetType(kDatetimeInterval,
-                                                                  true /* nullable */))));
-
-    checkPredicateSerialization(
-        ComparisonPredicate(comparison,
-                            createScalarYearMonthInterval(numeric_limits<int64_t>::max()),
-                            createScalarNull(TypeFactory::GetType(kYearMonthInterval,
-                                                                  true /* nullable */))));
-  }
-
-  void checkPredicateSerialization(const Predicate &predicate) {
-    unique_ptr<Predicate> predicate_from_proto(
-        PredicateFactory::ReconstructFromProto(predicate.getProto(), *database_));
-    comparePredicate(predicate, *predicate_from_proto);
-  }
-
-  CatalogRelation* createCatalogRelation(const std::string &name) {
-    return database_->getRelationByIdMutable(database_->addRelation(new CatalogRelation(NULL, name)));
-  }
-
-  const CatalogAttribute* createCatalogAttribute(CatalogRelation* rel, const std::string &name, const Type &type) {
-    rel->addAttribute(new CatalogAttribute(NULL, name, type));
-    return rel->getAttributeByName(name);
-  }
-
-  static Scalar* createScalarNull(const Type &type) {
-    return new ScalarLiteral(type.makeNullValue(), type);
-  }
-
-  static Scalar* createScalarInt(int int_literal) {
-    return new ScalarLiteral(TypedValue(int_literal),
-                             TypeFactory::GetType(kInt));
-  }
-
-  static Scalar* createScalarLong(int64_t long_literal) {
-    return new ScalarLiteral(TypedValue(long_literal),
-                             TypeFactory::GetType(kLong));
-  }
-
-  static Scalar* createScalarFloat(float float_literal) {
-    return new ScalarLiteral(TypedValue(float_literal),
-                             TypeFactory::GetType(kFloat));
-  }
-
-  static Scalar* createScalarDouble(double double_literal) {
-    return new ScalarLiteral(TypedValue(double_literal),
-                             TypeFactory::GetType(kDouble));
-  }
-
-  static Scalar* createScalarDatetime(int64_t tick) {
-    DatetimeLit datetime;
-    datetime.ticks = tick;
-    return new ScalarLiteral(TypedValue(datetime),
-                             TypeFactory::GetType(kDatetime));
-  }
-
-  static Scalar* createScalarDatetimeInterval(int64_t tick) {
-    DatetimeIntervalLit datetime_interval;
-    datetime_interval.interval_ticks = tick;
-    return new ScalarLiteral(TypedValue(datetime_interval),
-                             TypeFactory::GetType(kDatetimeInterval));
-  }
-
-  static Scalar* createScalarYearMonthInterval(int64_t month) {
-    YearMonthIntervalLit year_month_interval;
-    year_month_interval.months = month;
-    return new ScalarLiteral(TypedValue(year_month_interval),
-                             TypeFactory::GetType(kYearMonthInterval));
-  }
-
-  static void comparePredicatePtrList(const PtrList<Predicate> &expected, const PtrList<Predicate> &checked) {
-    ASSERT_EQ(expected.size(), checked.size());
-
-    for (PtrList<Predicate>::const_iterator it_expected = expected.begin(), it_checked = checked.begin();
-         it_expected != expected.end();
-         ++it_expected, ++it_checked) {
-      comparePredicate(*it_expected, *it_checked);
-    }
-  }
-
-  static void comparePredicate(const Predicate &expected, const Predicate &checked) {
-    ASSERT_EQ(expected.getPredicateType(), checked.getPredicateType());
-
-    switch (expected.getPredicateType()) {
-      case Predicate::kTrue:  // Fall through.
-      case Predicate::kFalse: {
-        break;
-      }
-      case Predicate::kComparison: {
-        EXPECT_TRUE(static_cast<const ComparisonPredicate&>(expected).getComparison().equals(
-                    static_cast<const ComparisonPredicate&>(checked).getComparison()));
-
-        compareScalar(static_cast<const ComparisonPredicate&>(expected).getLeftOperand(),
-                      static_cast<const ComparisonPredicate&>(checked).getLeftOperand());
-
-        compareScalar(static_cast<const ComparisonPredicate&>(expected).getRightOperand(),
-                      static_cast<const ComparisonPredicate&>(checked).getRightOperand());
-        break;
-      }
-      case Predicate::kNegation: {
-        EXPECT_EQ(expected.hasStaticResult(), checked.hasStaticResult());
-        if (expected.hasStaticResult()) {
-          EXPECT_EQ(expected.getStaticResult(), checked.getStaticResult());
-        }
-
-        comparePredicate(*static_cast<const NegationPredicate&>(expected).operand_,
-                         *static_cast<const NegationPredicate&>(checked).operand_);
-        break;
-      }
-      case Predicate::kConjunction:  // Fall through.
-      case Predicate::kDisjunction: {
-        EXPECT_EQ(expected.hasStaticResult(), checked.hasStaticResult());
-        if (expected.hasStaticResult()) {
-          EXPECT_EQ(expected.getStaticResult(), checked.getStaticResult());
-        }
-
-        comparePredicatePtrList(static_cast<const PredicateWithList&>(expected).static_operand_list_,
-                                static_cast<const PredicateWithList&>(checked).static_operand_list_);
-        comparePredicatePtrList(static_cast<const PredicateWithList&>(expected).dynamic_operand_list_,
-                                static_cast<const PredicateWithList&>(checked).dynamic_operand_list_);
-        break;
-      }
-      default:
-        FATAL_ERROR("checked is not a valid PredicateType in comparePredicate");
-    }
-  }
-
-  static void compareScalar(const Scalar &expected, const Scalar &checked) {
-    ASSERT_EQ(expected.getDataSource(), checked.getDataSource());
-    ASSERT_TRUE(expected.getType().equals(checked.getType()));
-
-    switch (expected.getDataSource()) {
-      case Scalar::kLiteral: {
-        compareTypedValue(expected.getType(), expected.getStaticValue(), checked.getStaticValue());
-        break;
-      }
-      case Scalar::kAttribute: {
-        compareCatalogAttribute(static_cast<const ScalarAttribute&>(expected).getAttribute(),
-                                static_cast<const ScalarAttribute&>(checked).getAttribute());
-        break;
-      }
-      case Scalar::kUnaryExpression: {
-        EXPECT_EQ(expected.hasStaticValue(), checked.hasStaticValue());
-        if (expected.hasStaticValue()) {
-          compareTypedValue(expected.getType(), expected.getStaticValue(), checked.getStaticValue());
-        }
-
-        EXPECT_EQ(static_cast<const ScalarUnaryExpression&>(expected).operation_.getUnaryOperationID(),
-                  static_cast<const ScalarUnaryExpression&>(checked).operation_.getUnaryOperationID());
-        compareScalar(*(static_cast<const ScalarUnaryExpression&>(expected).operand_),
-                      *(static_cast<const ScalarUnaryExpression&>(checked).operand_));
-        break;
-      }
-      case Scalar::kBinaryExpression: {
-        EXPECT_EQ(expected.hasStaticValue(), checked.hasStaticValue());
-        if (expected.hasStaticValue()) {
-          compareTypedValue(expected.getType(), expected.getStaticValue(), checked.getStaticValue());
-        }
-
-        EXPECT_EQ(static_cast<const ScalarBinaryExpression&>(expected).operation_.getBinaryOperationID(),
-                  static_cast<const ScalarBinaryExpression&>(checked).operation_.getBinaryOperationID());
-        compareScalar(*(static_cast<const ScalarBinaryExpression&>(expected).left_operand_),
-                      *(static_cast<const ScalarBinaryExpression&>(checked).left_operand_));
-        compareScalar(*(static_cast<const ScalarBinaryExpression&>(expected).right_operand_),
-                      *(static_cast<const ScalarBinaryExpression&>(checked).right_operand_));
-        break;
-      }
-      default:
-        FATAL_ERROR("checked is not a valid Scalar in compareScalar");
-    }
-  }
-
-  static void compareTypedValue(const Type &type,
-                                const TypedValue &expected,
-                                const TypedValue &checked) {
-    ASSERT_EQ(expected.isNull(), checked.isNull());
-
-    if (expected.isNull()) {
-      return;
-    }
-
-    switch (type.getTypeID()) {
-      case kInt:
-        EXPECT_EQ(expected.getLiteral<int>(), checked.getLiteral<int>());
-        break;
-      case kLong:
-        EXPECT_EQ(expected.getLiteral<int64_t>(), checked.getLiteral<int64_t>());
-        break;
-      case kFloat:
-        EXPECT_FLOAT_EQ(expected.getLiteral<float>(), checked.getLiteral<float>());
-        break;
-      case kDouble:
-        EXPECT_DOUBLE_EQ(expected.getLiteral<double>(), checked.getLiteral<double>());
-        break;
-      case kDatetime:
-        EXPECT_EQ(expected.getLiteral<DatetimeLit>(), checked.getLiteral<DatetimeLit>());
-        break;
-      case kDatetimeInterval:
-        EXPECT_EQ(expected.getLiteral<DatetimeIntervalLit>(), checked.getLiteral<DatetimeIntervalLit>());
-        break;
-      case kYearMonthInterval:
-        EXPECT_EQ(expected.getLiteral<YearMonthIntervalLit>(), checked.getLiteral<YearMonthIntervalLit>());
-        break;
-      case kChar:  // Fall through.
-      case kVarChar:
-        EXPECT_EQ(expected.getDataSize(), checked.getDataSize());
-        EXPECT_EQ(expected.getAsciiStringLength(), checked.getAsciiStringLength());
-        EXPECT_STREQ(static_cast<const char*>(expected.getDataPtr()),
-                     static_cast<const char*>(checked.getDataPtr()));
-        break;
-      default:
-        FATAL_ERROR("Unrecognized Type in compareTypedValue");
-    }
-  }
-
-  static void compareCatalogAttribute(const CatalogAttribute &expected, const CatalogAttribute &checked) {
-    EXPECT_EQ(expected.getID(), checked.getID());
-    EXPECT_EQ(expected.getName(), checked.getName());
-    EXPECT_TRUE(expected.getType().equals(checked.getType()));
-  }
-
-  unique_ptr<CatalogDatabase> database_;
-  // Both pointers below are owned by database_.
-  CatalogRelation *rel_numeric_, *rel_date_;
-  // All pointers below are owned by relations.
-  const CatalogAttribute *attr_int_, *attr_long_, *attr_float_, *attr_double_,
-      *attr_datetime_, *attr_datetime_interval_, *attr_year_month_interval_;
-};
-
-TEST_F(PredicateTest, TrivialPredicateSerializationTest) {
-  checkPredicateSerialization(TruePredicate());
-  checkPredicateSerialization(FalsePredicate());
-}
-
-TEST_F(PredicateTest, NegationPredicateSerializationTest) {
-  checkPredicateSerialization(NegationPredicate(new TruePredicate()));
-  checkPredicateSerialization(NegationPredicate(new FalsePredicate()));
-
-  checkPredicateSerialization(
-      NegationPredicate(new ComparisonPredicate(ComparisonFactory::GetComparison(ComparisonID::kEqual),
-                                                new ScalarAttribute(*attr_int_),
-                                                createScalarInt(-1))));
-  checkPredicateSerialization(
-      NegationPredicate(new ComparisonPredicate(ComparisonFactory::GetComparison(ComparisonID::kNotEqual),
-                                                new ScalarAttribute(*attr_long_),
-                                                createScalarLong(numeric_limits<int64_t>::max()))));
-  checkPredicateSerialization(
-      NegationPredicate(new ComparisonPredicate(ComparisonFactory::GetComparison(ComparisonID::kLess),
-                                                new ScalarAttribute(*attr_float_),
-                                                createScalarFloat(numeric_limits<float>::max()))));
-  checkPredicateSerialization(
-      NegationPredicate(new ComparisonPredicate(ComparisonFactory::GetComparison(ComparisonID::kLessOrEqual),
-                                                new ScalarAttribute(*attr_double_),
-                                                createScalarDouble(numeric_limits<double>::max()))));
-  checkPredicateSerialization(
-      NegationPredicate(new ComparisonPredicate(ComparisonFactory::GetComparison(ComparisonID::kGreater),
-                                                new ScalarAttribute(*attr_datetime_),
-                                                createScalarDatetime(numeric_limits<int64_t>::min()))));
-  checkPredicateSerialization(
-      NegationPredicate(new ComparisonPredicate(ComparisonFactory::GetComparison(ComparisonID::kGreaterOrEqual),
-                                                new ScalarAttribute(*attr_datetime_interval_),
-                                                createScalarDatetimeInterval(numeric_limits<int64_t>::min()))));
-}
-
-TEST_F(PredicateTest, ComparisonPredicateSerializationTest) {
-  checkComparisonPredicateSerialization(ComparisonFactory::GetComparison(ComparisonID::kEqual));
-  checkComparisonPredicateSerialization(ComparisonFactory::GetComparison(ComparisonID::kNotEqual));
-  checkComparisonPredicateSerialization(ComparisonFactory::GetComparison(ComparisonID::kLess));
-  checkComparisonPredicateSerialization(ComparisonFactory::GetComparison(ComparisonID::kLessOrEqual));
-  checkComparisonPredicateSerialization(ComparisonFactory::GetComparison(ComparisonID::kGreater));
-  checkComparisonPredicateSerialization(ComparisonFactory::GetComparison(ComparisonID::kGreaterOrEqual));
-}
-
-TEST_F(PredicateTest, ConjunctionPredicateSerializationTest) {
-  ConjunctionPredicate predicate;
-  predicate.addPredicate(new TruePredicate());
-  predicate.addPredicate(NegationPredicate::NegatePredicate(new FalsePredicate()));
-  predicate.addPredicate(NegationPredicate::NegatePredicate(
-      new ComparisonPredicate(ComparisonFactory::GetComparison(ComparisonID::kGreaterOrEqual),
-                              new ScalarAttribute(*attr_year_month_interval_),
-                              createScalarYearMonthInterval(numeric_limits<int64_t>::min()))));
-
-  checkPredicateSerialization(predicate);
-}
-
-TEST_F(PredicateTest, DisjunctionPredicateSerializationTest) {
-  DisjunctionPredicate predicate;
-  predicate.addPredicate(new FalsePredicate());
-  predicate.addPredicate(NegationPredicate::NegatePredicate(new TruePredicate()));
-  predicate.addPredicate(NegationPredicate::NegatePredicate(
-      new ComparisonPredicate(ComparisonFactory::GetComparison(ComparisonID::kLess),
-                              new ScalarAttribute(*attr_year_month_interval_),
-                              createScalarYearMonthInterval(numeric_limits<int64_t>::max()))));
-
-  checkPredicateSerialization(predicate);
-}
-
-}  // namespace quickstep