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:56 UTC

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

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