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:46:04 UTC

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

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