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

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

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/scalar/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/expressions/scalar/CMakeLists.txt b/expressions/scalar/CMakeLists.txt
deleted file mode 100644
index 8f509da..0000000
--- a/expressions/scalar/CMakeLists.txt
+++ /dev/null
@@ -1,181 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Declare micro-libs:
-add_library(quickstep_expressions_scalar_Scalar Scalar.cpp Scalar.hpp)
-add_library(quickstep_expressions_scalar_ScalarAttribute
-            ScalarAttribute.cpp
-            ScalarAttribute.hpp)
-add_library(quickstep_expressions_scalar_ScalarBinaryExpression
-            ScalarBinaryExpression.cpp
-            ScalarBinaryExpression.hpp)
-add_library(quickstep_expressions_scalar_ScalarCaseExpression
-            ScalarCaseExpression.cpp
-            ScalarCaseExpression.hpp)
-add_library(quickstep_expressions_scalar_ScalarLiteral
-            ScalarLiteral.cpp
-            ScalarLiteral.hpp)
-add_library(quickstep_expressions_scalar_ScalarUnaryExpression
-            ScalarUnaryExpression.cpp
-            ScalarUnaryExpression.hpp)
-
-# Link dependencies:
-target_link_libraries(quickstep_expressions_scalar_Scalar
-                      quickstep_catalog_CatalogTypedefs
-                      quickstep_expressions_Expressions_proto
-                      quickstep_storage_StorageBlockInfo
-                      quickstep_types_TypedValue
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_expressions_scalar_ScalarAttribute
-                      quickstep_catalog_CatalogAttribute
-                      quickstep_catalog_CatalogRelationSchema
-                      quickstep_catalog_CatalogTypedefs
-                      quickstep_expressions_Expressions_proto
-                      quickstep_expressions_scalar_Scalar
-                      quickstep_storage_StorageBlockInfo
-                      quickstep_storage_ValueAccessor
-                      quickstep_storage_ValueAccessorUtil
-                      quickstep_types_Type
-                      quickstep_types_TypedValue
-                      quickstep_types_containers_ColumnVector
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_expressions_scalar_ScalarBinaryExpression
-                      quickstep_catalog_CatalogTypedefs
-                      quickstep_expressions_Expressions_proto
-                      quickstep_expressions_scalar_Scalar
-                      quickstep_storage_StorageBlockInfo
-                      quickstep_storage_ValueAccessor
-                      quickstep_types_Type
-                      quickstep_types_TypeErrors
-                      quickstep_types_TypedValue
-                      quickstep_types_containers_ColumnVector
-                      quickstep_types_operations_Operation_proto
-                      quickstep_types_operations_binaryoperations_BinaryOperation
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_expressions_scalar_ScalarCaseExpression
-                      quickstep_catalog_CatalogTypedefs
-                      quickstep_expressions_Expressions_proto
-                      quickstep_expressions_predicate_Predicate
-                      quickstep_expressions_scalar_Scalar
-                      quickstep_storage_StorageBlockInfo
-                      quickstep_storage_TupleIdSequence
-                      quickstep_storage_ValueAccessor
-                      quickstep_storage_ValueAccessorUtil
-                      quickstep_types_Type
-                      quickstep_types_Type_proto
-                      quickstep_types_TypedValue
-                      quickstep_types_containers_ColumnVector
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_expressions_scalar_ScalarLiteral
-                      quickstep_catalog_CatalogTypedefs
-                      quickstep_expressions_Expressions_proto
-                      quickstep_expressions_scalar_Scalar
-                      quickstep_storage_StorageBlockInfo
-                      quickstep_storage_ValueAccessor
-                      quickstep_types_Type
-                      quickstep_types_Type_proto
-                      quickstep_types_TypedValue
-                      quickstep_types_TypedValue_proto
-                      quickstep_types_containers_ColumnVector
-                      quickstep_utility_Macros)
-target_link_libraries(quickstep_expressions_scalar_ScalarUnaryExpression
-                      quickstep_catalog_CatalogTypedefs
-                      quickstep_expressions_Expressions_proto
-                      quickstep_expressions_scalar_Scalar
-                      quickstep_storage_StorageBlockInfo
-                      quickstep_storage_ValueAccessor
-                      quickstep_types_Type
-                      quickstep_types_TypeErrors
-                      quickstep_types_TypedValue
-                      quickstep_types_containers_ColumnVector
-                      quickstep_types_operations_Operation_proto
-                      quickstep_types_operations_unaryoperations_UnaryOperation
-                      quickstep_utility_Macros)
-
-# Submodule all-in-one library:
-add_library(quickstep_expressions_scalar ../../empty_src.cpp)
-target_link_libraries(quickstep_expressions_scalar
-                      quickstep_expressions_scalar_Scalar
-                      quickstep_expressions_scalar_ScalarAttribute
-                      quickstep_expressions_scalar_ScalarBinaryExpression
-                      quickstep_expressions_scalar_ScalarCaseExpression
-                      quickstep_expressions_scalar_ScalarLiteral
-                      quickstep_expressions_scalar_ScalarUnaryExpression)
-
-# Tests:
-add_executable(ScalarCaseExpression_unittest
-               "${CMAKE_CURRENT_SOURCE_DIR}/tests/ScalarCaseExpression_unittest.cpp")
-target_link_libraries(ScalarCaseExpression_unittest
-                      gtest
-                      gtest_main
-                      quickstep_catalog_CatalogAttribute
-                      quickstep_catalog_CatalogRelation
-                      quickstep_catalog_CatalogRelationSchema
-                      quickstep_expressions_predicate_ComparisonPredicate
-                      quickstep_expressions_predicate_ConjunctionPredicate
-                      quickstep_expressions_predicate_DisjunctionPredicate
-                      quickstep_expressions_predicate_Predicate
-                      quickstep_expressions_scalar_Scalar
-                      quickstep_expressions_scalar_ScalarAttribute
-                      quickstep_expressions_scalar_ScalarBinaryExpression
-                      quickstep_expressions_scalar_ScalarCaseExpression
-                      quickstep_expressions_scalar_ScalarLiteral
-                      quickstep_expressions_scalar_ScalarUnaryExpression
-                      quickstep_storage_StorageBlockInfo
-                      quickstep_storage_TupleIdSequence
-                      quickstep_storage_ValueAccessor
-                      quickstep_types_TypeFactory
-                      quickstep_types_TypeID
-                      quickstep_types_TypedValue
-                      quickstep_types_containers_ColumnVector
-                      quickstep_types_containers_ColumnVectorsValueAccessor
-                      quickstep_types_operations_binaryoperations_BinaryOperationFactory
-                      quickstep_types_operations_binaryoperations_BinaryOperationID
-                      quickstep_types_operations_comparisons_ComparisonFactory
-                      quickstep_types_operations_comparisons_ComparisonID
-                      quickstep_types_operations_unaryoperations_UnaryOperationFactory
-                      quickstep_types_operations_unaryoperations_UnaryOperationID)
-add_test(ScalarCaseExpression_unittest ScalarCaseExpression_unittest)
-
-add_executable(Scalar_unittest "${CMAKE_CURRENT_SOURCE_DIR}/tests/Scalar_unittest.cpp")
-target_link_libraries(Scalar_unittest
-                      gtest
-                      gtest_main
-                      quickstep_catalog_CatalogAttribute
-                      quickstep_catalog_CatalogDatabase
-                      quickstep_catalog_CatalogRelation
-                      quickstep_expressions_ExpressionFactories
-                      quickstep_expressions_scalar_Scalar
-                      quickstep_expressions_scalar_ScalarAttribute
-                      quickstep_expressions_scalar_ScalarBinaryExpression
-                      quickstep_expressions_scalar_ScalarLiteral
-                      quickstep_expressions_scalar_ScalarUnaryExpression
-                      quickstep_types_DatetimeLit
-                      quickstep_types_IntervalLit
-                      quickstep_types_Type
-                      quickstep_types_TypeFactory
-                      quickstep_types_TypeID
-                      quickstep_types_TypedValue
-                      quickstep_types_operations_binaryoperations_BinaryOperation
-                      quickstep_types_operations_binaryoperations_BinaryOperationFactory
-                      quickstep_types_operations_binaryoperations_BinaryOperationID
-                      quickstep_types_operations_unaryoperations_NumericCastOperation
-                      quickstep_types_operations_unaryoperations_UnaryOperation
-                      quickstep_types_operations_unaryoperations_UnaryOperationFactory
-                      quickstep_types_operations_unaryoperations_UnaryOperationID
-                      quickstep_utility_Macros)
-add_test(Scalar_unittest Scalar_unittest)

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/scalar/Scalar.cpp
----------------------------------------------------------------------
diff --git a/expressions/scalar/Scalar.cpp b/expressions/scalar/Scalar.cpp
deleted file mode 100644
index a1c436c..0000000
--- a/expressions/scalar/Scalar.cpp
+++ /dev/null
@@ -1,38 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- **/
-
-#include "expressions/scalar/Scalar.hpp"
-
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-
-const char *Scalar::kScalarDataSourceNames[] = {
-  "Literal",
-  "Attribute",
-  "UnaryExpression",
-  "BinaryExpression",
-  "SimpleCase"
-};
-
-const TypedValue& Scalar::getStaticValue() const {
-  FATAL_ERROR("Called getStaticValue() on a Scalar which does not have a static value");
-}
-
-}  // namespace quickstep

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

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/scalar/ScalarAttribute.cpp
----------------------------------------------------------------------
diff --git a/expressions/scalar/ScalarAttribute.cpp b/expressions/scalar/ScalarAttribute.cpp
deleted file mode 100644
index cc42084..0000000
--- a/expressions/scalar/ScalarAttribute.cpp
+++ /dev/null
@@ -1,214 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- **/
-
-#include "expressions/scalar/ScalarAttribute.hpp"
-
-#include <utility>
-#include <vector>
-
-#include "catalog/CatalogAttribute.hpp"
-#include "catalog/CatalogRelationSchema.hpp"
-#include "catalog/CatalogTypedefs.hpp"
-#include "expressions/Expressions.pb.h"
-#include "storage/StorageBlockInfo.hpp"
-#include "storage/ValueAccessor.hpp"
-#include "storage/ValueAccessorUtil.hpp"
-#include "types/Type.hpp"
-#include "types/TypedValue.hpp"
-#include "types/containers/ColumnVector.hpp"
-#include "utility/Macros.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-ScalarAttribute::ScalarAttribute(const CatalogAttribute &attribute)
-    : Scalar(attribute.getType()),
-      attribute_(attribute) {
-}
-
-serialization::Scalar ScalarAttribute::getProto() const {
-  serialization::Scalar proto;
-  proto.set_data_source(serialization::Scalar::ATTRIBUTE);
-  proto.SetExtension(serialization::ScalarAttribute::relation_id, attribute_.getParent().getID());
-  proto.SetExtension(serialization::ScalarAttribute::attribute_id, attribute_.getID());
-
-  return proto;
-}
-
-Scalar* ScalarAttribute::clone() const {
-  return new ScalarAttribute(attribute_);
-}
-
-TypedValue ScalarAttribute::getValueForSingleTuple(const ValueAccessor &accessor,
-                                                   const tuple_id tuple) const {
-  return accessor.getTypedValueAtAbsolutePositionVirtual(attribute_.getID(), tuple);
-}
-
-TypedValue ScalarAttribute::getValueForJoinedTuples(
-    const ValueAccessor &left_accessor,
-    const relation_id left_relation_id,
-    const tuple_id left_tuple_id,
-    const ValueAccessor &right_accessor,
-    const relation_id right_relation_id,
-    const tuple_id right_tuple_id) const {
-  // FIXME(chasseur): This can get confused and break for self-joins.
-  DCHECK((attribute_.getParent().getID() == left_relation_id)
-         || (attribute_.getParent().getID() == right_relation_id));
-  if (attribute_.getParent().getID() == left_relation_id) {
-    return left_accessor.getTypedValueAtAbsolutePositionVirtual(attribute_.getID(),
-                                                                left_tuple_id);
-  } else {
-    return right_accessor.getTypedValueAtAbsolutePositionVirtual(attribute_.getID(),
-                                                                 right_tuple_id);
-  }
-}
-
-attribute_id ScalarAttribute::getAttributeIdForValueAccessor() const {
-  return attribute_.getID();
-}
-
-relation_id ScalarAttribute::getRelationIdForValueAccessor() const {
-  return attribute_.getParent().getID();
-}
-
-ColumnVector* ScalarAttribute::getAllValues(ValueAccessor *accessor,
-                                            const SubBlocksReference *sub_blocks_ref) const {
-  const attribute_id attr_id = attribute_.getID();
-  const Type &result_type = attribute_.getType();
-  return InvokeOnValueAccessorMaybeTupleIdSequenceAdapter(
-      accessor,
-      [&attr_id, &result_type](auto *accessor) -> ColumnVector* {  // NOLINT(build/c++11)
-    if (NativeColumnVector::UsableForType(result_type)) {
-      NativeColumnVector *result = new NativeColumnVector(result_type,
-                                                          accessor->getNumTuples());
-      accessor->beginIteration();
-      if (result_type.isNullable()) {
-        if (accessor->isColumnAccessorSupported()) {
-          // If ColumnAccessor is supported on the underlying accessor, we have a fast strided
-          // column accessor available for the iteration on the underlying block.
-          // Since the attributes can be null, ColumnAccessor template takes a 'true' argument.
-          std::unique_ptr<const ColumnAccessor<true>>
-              column_accessor(accessor->template getColumnAccessor<true>(attr_id));
-          while (accessor->next()) {
-            const void *value = column_accessor->getUntypedValue();  // Fast strided access.
-            if (value == nullptr) {
-              result->appendNullValue();
-            } else {
-              result->appendUntypedValue(value);
-            }
-          }
-        } else {
-          while (accessor->next()) {
-            const void *value = accessor->template getUntypedValue<true>(attr_id);
-            if (value == nullptr) {
-              result->appendNullValue();
-            } else {
-              result->appendUntypedValue(value);
-            }
-          }
-        }
-      } else {
-        if (accessor->isColumnAccessorSupported()) {
-          // Since the attributes cannot be null, ColumnAccessor template takes a 'false' argument.
-          std::unique_ptr<const ColumnAccessor<false>>
-              column_accessor(accessor->template getColumnAccessor<false>(attr_id));
-          while (accessor->next()) {
-            result->appendUntypedValue(column_accessor->getUntypedValue());  // Fast strided access.
-          }
-        } else {
-          while (accessor->next()) {
-            result->appendUntypedValue(
-                accessor->template getUntypedValue<false>(attr_id));
-          }
-        }
-      }
-      return result;
-    } else {
-      IndirectColumnVector *result = new IndirectColumnVector(result_type,
-                                                              accessor->getNumTuples());
-      accessor->beginIteration();
-      while (accessor->next()) {
-        result->appendTypedValue(accessor->getTypedValue(attr_id));
-      }
-      return result;
-    }
-  });
-}
-
-ColumnVector* ScalarAttribute::getAllValuesForJoin(
-    const relation_id left_relation_id,
-    ValueAccessor *left_accessor,
-    const relation_id right_relation_id,
-    ValueAccessor *right_accessor,
-    const std::vector<std::pair<tuple_id, tuple_id>> &joined_tuple_ids) const {
-  DCHECK((attribute_.getParent().getID() == left_relation_id)
-         || (attribute_.getParent().getID() == right_relation_id));
-
-  const attribute_id attr_id = attribute_.getID();
-  const Type &result_type = attribute_.getType();
-
-  const bool using_left_relation = (attribute_.getParent().getID() == left_relation_id);
-  ValueAccessor *accessor = using_left_relation ? left_accessor
-                                                : right_accessor;
-
-  return InvokeOnAnyValueAccessor(
-      accessor,
-      [&joined_tuple_ids,
-       &attr_id,
-       &result_type,
-       &using_left_relation](auto *accessor) -> ColumnVector* {  // NOLINT(build/c++11)
-    if (NativeColumnVector::UsableForType(result_type)) {
-      NativeColumnVector *result = new NativeColumnVector(result_type,
-                                                          joined_tuple_ids.size());
-      if (result_type.isNullable()) {
-        for (const std::pair<tuple_id, tuple_id> &joined_pair : joined_tuple_ids) {
-          const void *value = accessor->template getUntypedValueAtAbsolutePosition<true>(
-              attr_id,
-              using_left_relation ? joined_pair.first : joined_pair.second);
-          if (value == nullptr) {
-            result->appendNullValue();
-          } else {
-            result->appendUntypedValue(value);
-          }
-        }
-      } else {
-        for (const std::pair<tuple_id, tuple_id> &joined_pair : joined_tuple_ids) {
-          result->appendUntypedValue(
-              accessor->template getUntypedValueAtAbsolutePosition<false>(
-                  attr_id,
-                  using_left_relation ? joined_pair.first : joined_pair.second));
-        }
-      }
-      return result;
-    } else {
-      IndirectColumnVector *result = new IndirectColumnVector(result_type,
-                                                              joined_tuple_ids.size());
-      for (const std::pair<tuple_id, tuple_id> &joined_pair : joined_tuple_ids) {
-        result->appendTypedValue(
-              accessor->getTypedValueAtAbsolutePosition(
-                  attr_id,
-                  using_left_relation ? joined_pair.first : joined_pair.second));
-      }
-      return result;
-    }
-  });
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/scalar/ScalarAttribute.hpp
----------------------------------------------------------------------
diff --git a/expressions/scalar/ScalarAttribute.hpp b/expressions/scalar/ScalarAttribute.hpp
deleted file mode 100644
index c6a41df..0000000
--- a/expressions/scalar/ScalarAttribute.hpp
+++ /dev/null
@@ -1,105 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- **/
-
-#ifndef QUICKSTEP_EXPRESSIONS_SCALAR_SCALAR_ATTRIBUTE_HPP_
-#define QUICKSTEP_EXPRESSIONS_SCALAR_SCALAR_ATTRIBUTE_HPP_
-
-#include <utility>
-#include <vector>
-
-#include "catalog/CatalogTypedefs.hpp"
-#include "expressions/Expressions.pb.h"
-#include "expressions/scalar/Scalar.hpp"
-#include "storage/StorageBlockInfo.hpp"
-#include "types/TypedValue.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-
-class CatalogAttribute;
-class ColumnVector;
-class ValueAccessor;
-
-struct SubBlocksReference;
-
-/** \addtogroup Expressions
- *  @{
- */
-
-/**
- * @brief Scalars which are attribute values from tuples.
- **/
-class ScalarAttribute : public Scalar {
- public:
-  /**
-   * @brief Constructor.
-   *
-   * @param attribute The attribute to use.
-   **/
-  explicit ScalarAttribute(const CatalogAttribute &attribute);
-
-  serialization::Scalar getProto() const override;
-
-  Scalar* clone() const override;
-
-  ScalarDataSource getDataSource() const override {
-    return kAttribute;
-  }
-
-  TypedValue getValueForSingleTuple(const ValueAccessor &accessor,
-                                    const tuple_id tuple) const override;
-
-  TypedValue getValueForJoinedTuples(
-      const ValueAccessor &left_accessor,
-      const relation_id left_relation_id,
-      const tuple_id left_tuple_id,
-      const ValueAccessor &right_accessor,
-      const relation_id right_relation_id,
-      const tuple_id right_tuple_id) const override;
-
-  attribute_id getAttributeIdForValueAccessor() const override;
-
-  relation_id getRelationIdForValueAccessor() const override;
-
-  ColumnVector* getAllValues(ValueAccessor *accessor,
-                             const SubBlocksReference *sub_blocks_ref) const override;
-
-  ColumnVector* getAllValuesForJoin(
-      const relation_id left_relation_id,
-      ValueAccessor *left_accessor,
-      const relation_id right_relation_id,
-      ValueAccessor *right_accessor,
-      const std::vector<std::pair<tuple_id, tuple_id>> &joined_tuple_ids) const override;
-
-  const CatalogAttribute& getAttribute() const {
-    return attribute_;
-  }
-
- protected:
-  const CatalogAttribute &attribute_;
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(ScalarAttribute);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_EXPRESSIONS_SCALAR_SCALAR_ATTRIBUTE_HPP_

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/scalar/ScalarBinaryExpression.cpp
----------------------------------------------------------------------
diff --git a/expressions/scalar/ScalarBinaryExpression.cpp b/expressions/scalar/ScalarBinaryExpression.cpp
deleted file mode 100644
index 5fe6cde..0000000
--- a/expressions/scalar/ScalarBinaryExpression.cpp
+++ /dev/null
@@ -1,377 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- **/
-
-#include "expressions/scalar/ScalarBinaryExpression.hpp"
-
-#include <memory>
-#include <string>
-#include <utility>
-#include <vector>
-
-#include "catalog/CatalogTypedefs.hpp"
-#include "expressions/Expressions.pb.h"
-#include "storage/ValueAccessor.hpp"
-#include "types/Type.hpp"
-#include "types/TypeErrors.hpp"
-#include "types/TypedValue.hpp"
-#include "types/containers/ColumnVector.hpp"
-#include "types/operations/Operation.pb.h"
-#include "types/operations/binary_operations/BinaryOperation.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-ScalarBinaryExpression::ScalarBinaryExpression(const BinaryOperation &operation,
-                                               Scalar *left_operand,
-                                               Scalar *right_operand)
-    : Scalar(*operation.resultTypeForArgumentTypes(left_operand->getType(),
-                                                   right_operand->getType())),
-      operation_(operation),
-      left_operand_(left_operand),
-      right_operand_(right_operand) {
-  initHelper(false);
-}
-
-serialization::Scalar ScalarBinaryExpression::getProto() const {
-  serialization::Scalar proto;
-  proto.set_data_source(serialization::Scalar::BINARY_EXPRESSION);
-  proto.MutableExtension(serialization::ScalarBinaryExpression::operation)->CopyFrom(operation_.getProto());
-  proto.MutableExtension(serialization::ScalarBinaryExpression::left_operand)->CopyFrom(left_operand_->getProto());
-  proto.MutableExtension(serialization::ScalarBinaryExpression::right_operand)->CopyFrom(right_operand_->getProto());
-
-  return proto;
-}
-
-Scalar* ScalarBinaryExpression::clone() const {
-  return new ScalarBinaryExpression(operation_,
-                                    left_operand_->clone(),
-                                    right_operand_->clone());
-}
-
-TypedValue ScalarBinaryExpression::getValueForSingleTuple(const ValueAccessor &accessor,
-                                                          const tuple_id tuple) const {
-  if (fast_operator_.get() == nullptr) {
-    return static_value_.makeReferenceToThis();
-  } else {
-    return fast_operator_->applyToTypedValues(left_operand_->getValueForSingleTuple(accessor, tuple),
-                                              right_operand_->getValueForSingleTuple(accessor, tuple));
-  }
-}
-
-TypedValue ScalarBinaryExpression::getValueForJoinedTuples(
-    const ValueAccessor &left_accessor,
-    const relation_id left_relation_id,
-    const tuple_id left_tuple_id,
-    const ValueAccessor &right_accessor,
-    const relation_id right_relation_id,
-    const tuple_id right_tuple_id) const {
-  if (fast_operator_.get() == nullptr) {
-    return static_value_.makeReferenceToThis();
-  } else {
-    return fast_operator_->applyToTypedValues(
-        left_operand_->getValueForJoinedTuples(left_accessor,
-                                               left_relation_id,
-                                               left_tuple_id,
-                                               right_accessor,
-                                               right_relation_id,
-                                               right_tuple_id),
-        right_operand_->getValueForJoinedTuples(left_accessor,
-                                                left_relation_id,
-                                                left_tuple_id,
-                                                right_accessor,
-                                                right_relation_id,
-                                                right_tuple_id));
-  }
-}
-
-ColumnVector* ScalarBinaryExpression::getAllValues(
-    ValueAccessor *accessor,
-    const SubBlocksReference *sub_blocks_ref) const {
-  if (fast_operator_.get() == nullptr) {
-    return ColumnVector::MakeVectorOfValue(getType(),
-                                           static_value_,
-                                           accessor->getNumTuplesVirtual());
-  } else {
-    // NOTE(chasseur): We don't check if BOTH operands have a static value,
-    // because if they did then this expression would also have a static value
-    // handled in the case above.
-    if (left_operand_->hasStaticValue()) {
-#ifdef QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_SELECTION
-      const attribute_id right_operand_attr_id
-          = right_operand_->getAttributeIdForValueAccessor();
-      if (right_operand_attr_id != -1) {
-        return fast_operator_->applyToStaticValueAndValueAccessor(
-            left_operand_->getStaticValue(),
-            accessor,
-            right_operand_attr_id);
-      }
-#endif  // QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_SELECTION
-
-      std::unique_ptr<ColumnVector> right_result(
-          right_operand_->getAllValues(accessor, sub_blocks_ref));
-      return fast_operator_->applyToStaticValueAndColumnVector(
-          left_operand_->getStaticValue(),
-          *right_result);
-    } else if (right_operand_->hasStaticValue()) {
-#ifdef QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_SELECTION
-      const attribute_id left_operand_attr_id
-          = left_operand_->getAttributeIdForValueAccessor();
-      if (left_operand_attr_id != -1) {
-        return fast_operator_->applyToValueAccessorAndStaticValue(
-            accessor,
-            left_operand_attr_id,
-            right_operand_->getStaticValue());
-      }
-#endif  // QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_SELECTION
-
-      std::unique_ptr<ColumnVector> left_result(
-          left_operand_->getAllValues(accessor, sub_blocks_ref));
-      return fast_operator_->applyToColumnVectorAndStaticValue(
-          *left_result,
-          right_operand_->getStaticValue());
-    } else {
-#ifdef QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_SELECTION
-      const attribute_id left_operand_attr_id
-          = left_operand_->getAttributeIdForValueAccessor();
-      const attribute_id right_operand_attr_id
-          = right_operand_->getAttributeIdForValueAccessor();
-
-      if (left_operand_attr_id != -1) {
-        if (right_operand_attr_id != -1) {
-          return fast_operator_->applyToSingleValueAccessor(accessor,
-                                                            left_operand_attr_id,
-                                                            right_operand_attr_id);
-        } else {
-          std::unique_ptr<ColumnVector> right_result(
-              right_operand_->getAllValues(accessor, sub_blocks_ref));
-          return fast_operator_->applyToValueAccessorAndColumnVector(accessor,
-                                                                     left_operand_attr_id,
-                                                                     *right_result);
-        }
-      } else if (right_operand_attr_id != -1) {
-        std::unique_ptr<ColumnVector> left_result(
-            left_operand_->getAllValues(accessor, sub_blocks_ref));
-        return fast_operator_->applyToColumnVectorAndValueAccessor(*left_result,
-                                                                   accessor,
-                                                                   right_operand_attr_id);
-      }
-#endif  // QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_SELECTION
-
-      std::unique_ptr<ColumnVector> left_result(
-          left_operand_->getAllValues(accessor, sub_blocks_ref));
-      std::unique_ptr<ColumnVector> right_result(
-          right_operand_->getAllValues(accessor, sub_blocks_ref));
-      return fast_operator_->applyToColumnVectors(*left_result, *right_result);
-    }
-  }
-}
-
-ColumnVector* ScalarBinaryExpression::getAllValuesForJoin(
-    const relation_id left_relation_id,
-    ValueAccessor *left_accessor,
-    const relation_id right_relation_id,
-    ValueAccessor *right_accessor,
-    const std::vector<std::pair<tuple_id, tuple_id>> &joined_tuple_ids) const {
-  if (fast_operator_.get() == nullptr) {
-    return ColumnVector::MakeVectorOfValue(getType(),
-                                           static_value_,
-                                           joined_tuple_ids.size());
-  } else {
-    if (left_operand_->hasStaticValue()) {
-#ifdef QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_JOIN
-      const attribute_id right_operand_attr_id
-          = right_operand_->getAttributeIdForValueAccessor();
-      if (right_operand_attr_id != -1) {
-        const relation_id right_operand_relation_id
-            = right_operand_->getRelationIdForValueAccessor();
-        DCHECK_NE(right_operand_relation_id, -1);
-        DCHECK((right_operand_relation_id == left_relation_id)
-               || (right_operand_relation_id == right_relation_id));
-        const bool using_left_relation = (right_operand_relation_id == left_relation_id);
-        ValueAccessor *right_operand_accessor = using_left_relation ? left_accessor
-                                                                    : right_accessor;
-        return fast_operator_->applyToStaticValueAndValueAccessorForJoin(
-            left_operand_->getStaticValue(),
-            right_operand_accessor,
-            using_left_relation,
-            right_operand_attr_id,
-            joined_tuple_ids);
-      }
-#endif  // QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_JOIN
-
-      std::unique_ptr<ColumnVector> right_result(
-          right_operand_->getAllValuesForJoin(left_relation_id,
-                                              left_accessor,
-                                              right_relation_id,
-                                              right_accessor,
-                                              joined_tuple_ids));
-      return fast_operator_->applyToStaticValueAndColumnVector(
-          left_operand_->getStaticValue(),
-          *right_result);
-    } else if (right_operand_->hasStaticValue()) {
-#ifdef QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_JOIN
-      const attribute_id left_operand_attr_id
-          = left_operand_->getAttributeIdForValueAccessor();
-      if (left_operand_attr_id != -1) {
-        const relation_id left_operand_relation_id
-            = left_operand_->getRelationIdForValueAccessor();
-        DCHECK_NE(left_operand_relation_id, -1);
-        DCHECK((left_operand_relation_id == left_relation_id)
-               || (left_operand_relation_id == right_relation_id));
-        const bool using_left_relation = (left_operand_relation_id == left_relation_id);
-        ValueAccessor *left_operand_accessor = using_left_relation ? left_accessor
-                                                                   : right_accessor;
-        return fast_operator_->applyToValueAccessorAndStaticValueForJoin(
-            left_operand_accessor,
-            using_left_relation,
-            left_operand_attr_id,
-            right_operand_->getStaticValue(),
-            joined_tuple_ids);
-      }
-#endif  // QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_JOIN
-
-      std::unique_ptr<ColumnVector> left_result(
-          left_operand_->getAllValuesForJoin(left_relation_id,
-                                             left_accessor,
-                                             right_relation_id,
-                                             right_accessor,
-                                             joined_tuple_ids));
-      return fast_operator_->applyToColumnVectorAndStaticValue(
-          *left_result,
-          right_operand_->getStaticValue());
-    } else {
-#ifdef QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_JOIN
-      const attribute_id left_operand_attr_id
-          = left_operand_->getAttributeIdForValueAccessor();
-      const attribute_id right_operand_attr_id
-          = right_operand_->getAttributeIdForValueAccessor();
-      if (left_operand_attr_id != -1) {
-        const relation_id left_operand_relation_id
-            = left_operand_->getRelationIdForValueAccessor();
-        DCHECK_NE(left_operand_relation_id, -1);
-        DCHECK((left_operand_relation_id == left_relation_id)
-               || (left_operand_relation_id == right_relation_id));
-        const bool using_left_relation_for_left_operand
-            = (left_operand_relation_id == left_relation_id);
-        ValueAccessor *left_operand_accessor = using_left_relation_for_left_operand ? left_accessor
-                                                                                    : right_accessor;
-
-#ifdef QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_JOIN_WITH_BINARY_EXPRESSIONS
-        if (right_operand_attr_id != -1) {
-          const relation_id right_operand_relation_id
-              = right_operand_->getRelationIdForValueAccessor();
-          DCHECK_NE(right_operand_relation_id, -1);
-          DCHECK((right_operand_relation_id == left_relation_id)
-                 || (right_operand_relation_id == right_relation_id));
-          const bool using_left_relation_for_right_operand
-              = (right_operand_relation_id == left_relation_id);
-          ValueAccessor *right_operand_accessor = using_left_relation_for_right_operand ? left_accessor
-                                                                                        : right_accessor;
-          return fast_operator_->applyToValueAccessorsForJoin(left_operand_accessor,
-                                                              using_left_relation_for_left_operand,
-                                                              left_operand_attr_id,
-                                                              right_operand_accessor,
-                                                              using_left_relation_for_right_operand,
-                                                              right_operand_attr_id,
-                                                              joined_tuple_ids);
-        }
-#endif  // QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_JOIN_WITH_BINARY_EXPRESSIONS
-        std::unique_ptr<ColumnVector> right_result(
-            right_operand_->getAllValuesForJoin(left_relation_id,
-                                                left_accessor,
-                                                right_relation_id,
-                                                right_accessor,
-                                                joined_tuple_ids));
-
-        return fast_operator_->applyToValueAccessorAndColumnVectorForJoin(
-            left_operand_accessor,
-            using_left_relation_for_left_operand,
-            left_operand_attr_id,
-            *right_result,
-            joined_tuple_ids);
-      } else if (right_operand_attr_id != -1) {
-        const relation_id right_operand_relation_id
-            = right_operand_->getRelationIdForValueAccessor();
-        DCHECK_NE(right_operand_relation_id, -1);
-        DCHECK((right_operand_relation_id == left_relation_id)
-               || (right_operand_relation_id == right_relation_id));
-        const bool using_left_relation_for_right_operand
-            = (right_operand_relation_id == left_relation_id);
-        ValueAccessor *right_operand_accessor = using_left_relation_for_right_operand ? left_accessor
-                                                                                      : right_accessor;
-
-        std::unique_ptr<ColumnVector> left_result(
-            left_operand_->getAllValuesForJoin(left_relation_id,
-                                               left_accessor,
-                                               right_relation_id,
-                                               right_accessor,
-                                               joined_tuple_ids));
-        return fast_operator_->applyToColumnVectorAndValueAccessorForJoin(
-            *left_result,
-            right_operand_accessor,
-            using_left_relation_for_right_operand,
-            right_operand_attr_id,
-            joined_tuple_ids);
-      }
-#endif  // QUICKSTEP_ENABLE_VECTOR_COPY_ELISION_JOIN
-
-      std::unique_ptr<ColumnVector> left_result(
-          left_operand_->getAllValuesForJoin(left_relation_id,
-                                             left_accessor,
-                                             right_relation_id,
-                                             right_accessor,
-                                             joined_tuple_ids));
-      std::unique_ptr<ColumnVector> right_result(
-          right_operand_->getAllValuesForJoin(left_relation_id,
-                                              left_accessor,
-                                              right_relation_id,
-                                              right_accessor,
-                                              joined_tuple_ids));
-      return fast_operator_->applyToColumnVectors(*left_result, *right_result);
-    }
-  }
-}
-
-void ScalarBinaryExpression::initHelper(bool own_children) {
-  if (operation_.canApplyToTypes(left_operand_->getType(), right_operand_->getType())) {
-    if (left_operand_->hasStaticValue() && right_operand_->hasStaticValue()) {
-      static_value_ = operation_.applyToChecked(left_operand_->getStaticValue(),
-                                                left_operand_->getType(),
-                                                right_operand_->getStaticValue(),
-                                                right_operand_->getType());
-    } else {
-      fast_operator_.reset(operation_.makeUncheckedBinaryOperatorForTypes(left_operand_->getType(),
-                                                                           right_operand_->getType()));
-    }
-  } else {
-    const Type &left_operand_type = left_operand_->getType();
-    const Type &right_operand_type = right_operand_->getType();
-    if (!own_children) {
-      left_operand_.release();
-      right_operand_.release();
-    }
-    throw OperationInapplicableToType(operation_.getName(),
-                                      2,
-                                      left_operand_type.getName().c_str(),
-                                      right_operand_type.getName().c_str());
-  }
-}
-
-}  // namespace quickstep

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/scalar/ScalarBinaryExpression.hpp
----------------------------------------------------------------------
diff --git a/expressions/scalar/ScalarBinaryExpression.hpp b/expressions/scalar/ScalarBinaryExpression.hpp
deleted file mode 100644
index c84792a..0000000
--- a/expressions/scalar/ScalarBinaryExpression.hpp
+++ /dev/null
@@ -1,130 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- **/
-
-#ifndef QUICKSTEP_EXPRESSIONS_SCALAR_SCALAR_BINARY_EXPRESSION_HPP_
-#define QUICKSTEP_EXPRESSIONS_SCALAR_SCALAR_BINARY_EXPRESSION_HPP_
-
-#include <memory>
-#include <utility>
-#include <vector>
-
-#include "catalog/CatalogTypedefs.hpp"
-#include "expressions/Expressions.pb.h"
-#include "expressions/scalar/Scalar.hpp"
-#include "storage/StorageBlockInfo.hpp"
-#include "types/TypedValue.hpp"
-#include "types/operations/binary_operations/BinaryOperation.hpp"
-#include "utility/Macros.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-class ColumnVector;
-class ValueAccessor;
-
-struct SubBlocksReference;
-
-/** \addtogroup Expressions
- *  @{
- */
-
-/**
- * @brief Expressions which are based on a BinaryOperation.
- **/
-class ScalarBinaryExpression : public Scalar {
- public:
-  /**
-   * @brief Constructor.
-   *
-   * @param operation The binary operation to be performed.
-   * @param left_operand The left argument of the operation, which this
-   *        ScalarBinaryExpression takes ownership of.
-   * @param right_operand The right argument of the operation, which this
-   *        ScalarBinaryExpression takes ownership of.
-   **/
-  ScalarBinaryExpression(const BinaryOperation &operation,
-                         Scalar *left_operand,
-                         Scalar *right_operand);
-
-  /**
-   * @brief Destructor
-   **/
-  ~ScalarBinaryExpression() override {
-  }
-
-  serialization::Scalar getProto() const override;
-
-  Scalar* clone() const override;
-
-  ScalarDataSource getDataSource() const override {
-    return kBinaryExpression;
-  }
-
-  TypedValue getValueForSingleTuple(const ValueAccessor &accessor,
-                                    const tuple_id tuple) const override;
-
-  TypedValue getValueForJoinedTuples(
-      const ValueAccessor &left_accessor,
-      const relation_id left_relation_id,
-      const tuple_id left_tuple_id,
-      const ValueAccessor &right_accessor,
-      const relation_id right_relation_id,
-      const tuple_id right_tuple_id) const override;
-
-  bool hasStaticValue() const override {
-    return fast_operator_.get() == nullptr;
-  }
-
-  const TypedValue& getStaticValue() const override {
-    DCHECK(hasStaticValue());
-    return static_value_;
-  }
-
-  ColumnVector* getAllValues(ValueAccessor *accessor,
-                             const SubBlocksReference *sub_blocks_ref) const override;
-
-  ColumnVector* getAllValuesForJoin(
-      const relation_id left_relation_id,
-      ValueAccessor *left_accessor,
-      const relation_id right_relation_id,
-      ValueAccessor *right_accessor,
-      const std::vector<std::pair<tuple_id, tuple_id>> &joined_tuple_ids) const override;
-
- private:
-  void initHelper(bool own_children);
-
-  const BinaryOperation &operation_;
-
-  std::unique_ptr<Scalar> left_operand_;
-  std::unique_ptr<Scalar> right_operand_;
-  TypedValue static_value_;
-  std::unique_ptr<UncheckedBinaryOperator> fast_operator_;
-
-  friend class PredicateTest;
-  friend class ScalarTest;
-
-  DISALLOW_COPY_AND_ASSIGN(ScalarBinaryExpression);
-};
-
-/** @} */
-
-}  // namespace quickstep
-
-#endif  // QUICKSTEP_EXPRESSIONS_SCALAR_SCALAR_BINARY_EXPRESSION_HPP_

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

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

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/expressions/scalar/ScalarLiteral.cpp
----------------------------------------------------------------------
diff --git a/expressions/scalar/ScalarLiteral.cpp b/expressions/scalar/ScalarLiteral.cpp
deleted file mode 100644
index 48b5574..0000000
--- a/expressions/scalar/ScalarLiteral.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- **/
-
-#include "expressions/scalar/ScalarLiteral.hpp"
-
-#include <utility>
-#include <vector>
-
-#include "expressions/Expressions.pb.h"
-#include "storage/ValueAccessor.hpp"
-#include "types/Type.hpp"
-#include "types/Type.pb.h"
-#include "types/TypedValue.hpp"
-#include "types/TypedValue.pb.h"
-#include "types/containers/ColumnVector.hpp"
-
-namespace quickstep {
-
-serialization::Scalar ScalarLiteral::getProto() const {
-  serialization::Scalar proto;
-  proto.set_data_source(serialization::Scalar::LITERAL);
-  proto.MutableExtension(serialization::ScalarLiteral::literal)
-      ->CopyFrom(internal_literal_.getProto());
-  proto.MutableExtension(serialization::ScalarLiteral::literal_type)
-      ->CopyFrom(type_.getProto());
-
-  return proto;
-}
-
-Scalar* ScalarLiteral::clone() const {
-  return new ScalarLiteral(internal_literal_, type_);
-}
-
-ColumnVector* ScalarLiteral::getAllValues(
-    ValueAccessor *accessor,
-    const SubBlocksReference *sub_blocks_ref) const {
-  return ColumnVector::MakeVectorOfValue(
-      type_,
-      internal_literal_,
-      accessor->getNumTuplesVirtual());
-}
-
-ColumnVector* ScalarLiteral::getAllValuesForJoin(
-    const relation_id left_relation_id,
-    ValueAccessor *left_accessor,
-    const relation_id right_relation_id,
-    ValueAccessor *right_accessor,
-    const std::vector<std::pair<tuple_id, tuple_id>> &joined_tuple_ids) const {
-  return ColumnVector::MakeVectorOfValue(type_,
-                                         internal_literal_,
-                                         joined_tuple_ids.size());
-}
-
-}  // namespace quickstep