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:34 UTC
[11/51] [abbrv] [partial] incubator-quickstep git commit: remove c++
files
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/expressions/BinaryExpression.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/BinaryExpression.cpp b/query_optimizer/expressions/BinaryExpression.cpp
deleted file mode 100644
index 446dd55..0000000
--- a/query_optimizer/expressions/BinaryExpression.cpp
+++ /dev/null
@@ -1,120 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- **/
-
-#include "query_optimizer/expressions/BinaryExpression.hpp"
-
-#include <string>
-#include <unordered_map>
-#include <vector>
-
-#include "expressions/scalar/ScalarBinaryExpression.hpp"
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "query_optimizer/expressions/ExprId.hpp"
-#include "query_optimizer/expressions/Expression.hpp"
-#include "query_optimizer/expressions/PatternMatcher.hpp"
-#include "types/operations/binary_operations/BinaryOperation.hpp"
-#include "types/operations/binary_operations/BinaryOperationID.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-class Type;
-
-namespace optimizer {
-namespace expressions {
-
-BinaryExpression::BinaryExpression(const BinaryOperation &operation,
- const ScalarPtr &left,
- const ScalarPtr &right)
- : operation_(operation), left_(left), right_(right) {
- DCHECK(operation_.canApplyToTypes(left_->getValueType(),
- right_->getValueType()))
- << toString();
- addChild(left_);
- addChild(right_);
-}
-
-std::string BinaryExpression::getName() const {
- switch (operation_.getBinaryOperationID()) {
- case BinaryOperationID::kAdd:
- return "Add";
- case BinaryOperationID::kSubtract:
- return "Subtract";
- case BinaryOperationID::kMultiply:
- return "Multiply";
- case BinaryOperationID::kDivide:
- return "Divide";
- case BinaryOperationID::kModulo:
- return "Modulo";
- default:
- LOG(FATAL) << "Unknown binary operation";
- }
-}
-
-const Type &BinaryExpression::getValueType() const {
- return *operation_.resultTypeForArgumentTypes(left_->getValueType(),
- right_->getValueType());
-}
-
-ExpressionPtr BinaryExpression::copyWithNewChildren(
- const std::vector<ExpressionPtr> &new_children) const {
- DCHECK_EQ(new_children.size(), children().size());
- DCHECK(SomeScalar::Matches(new_children[0]));
- DCHECK(SomeScalar::Matches(new_children[1]));
- return BinaryExpression::Create(
- operation_,
- std::static_pointer_cast<const Scalar>(new_children[0]),
- std::static_pointer_cast<const Scalar>(new_children[1]));
-}
-
-std::vector<AttributeReferencePtr> BinaryExpression::getReferencedAttributes() const {
- std::vector<AttributeReferencePtr> referenced_attributes =
- left_->getReferencedAttributes();
- const std::vector<AttributeReferencePtr> referenced_attributes_by_right_operand =
- right_->getReferencedAttributes();
- referenced_attributes.insert(referenced_attributes.end(),
- referenced_attributes_by_right_operand.begin(),
- referenced_attributes_by_right_operand.end());
- return referenced_attributes;
-}
-
-::quickstep::Scalar *BinaryExpression::concretize(
- const std::unordered_map<ExprId, const CatalogAttribute*> &substitution_map) const {
- return new ::quickstep::ScalarBinaryExpression(
- operation_,
- left_->concretize(substitution_map),
- right_->concretize(substitution_map));
-}
-
-void BinaryExpression::getFieldStringItems(
- std::vector<std::string> *inline_field_names,
- std::vector<std::string> *inline_field_values,
- std::vector<std::string> *non_container_child_field_names,
- std::vector<OptimizerTreeBaseNodePtr> *non_container_child_fields,
- std::vector<std::string> *container_child_field_names,
- std::vector<std::vector<OptimizerTreeBaseNodePtr>> *container_child_fields) const {
- container_child_field_names->push_back("");
- container_child_fields->push_back({left_, right_});
-}
-
-} // namespace expressions
-} // namespace optimizer
-} // namespace quickstep
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/expressions/BinaryExpression.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/BinaryExpression.hpp b/query_optimizer/expressions/BinaryExpression.hpp
deleted file mode 100644
index 9b11ed1..0000000
--- a/query_optimizer/expressions/BinaryExpression.hpp
+++ /dev/null
@@ -1,127 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- **/
-
-#ifndef QUICKSTEP_QUERY_OPTIMIZER_EXPRESSIONS_BINARY_EXPRESSION_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_EXPRESSIONS_BINARY_EXPRESSION_HPP_
-
-#include <memory>
-#include <string>
-#include <unordered_map>
-#include <vector>
-
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "query_optimizer/expressions/ExprId.hpp"
-#include "query_optimizer/expressions/Expression.hpp"
-#include "query_optimizer/expressions/ExpressionType.hpp"
-#include "query_optimizer/expressions/Scalar.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-
-class BinaryOperation;
-class CatalogAttribute;
-class Type;
-
-namespace optimizer {
-namespace expressions {
-
-/** \addtogroup OptimizerExpressions
- * @{
- */
-
-class BinaryExpression;
-typedef std::shared_ptr<const BinaryExpression> BinaryExpressionPtr;
-
-/**
- * @brief Applies a binary operator to two scalar expressions and returns a
- * scalar value.
- */
-class BinaryExpression : public Scalar {
- public:
- ExpressionType getExpressionType() const override {
- return ExpressionType::kBinaryExpression;
- }
-
- std::string getName() const override;
-
- const Type& getValueType() const override;
-
- bool isConstant() const override {
- return left_->isConstant() && right_->isConstant();
- }
-
- /**
- * @return The binary operation.
- */
- const BinaryOperation& operation() const { return operation_; }
-
- /**
- * @return The left operand.
- */
- const ScalarPtr& left() const { return left_; }
-
- /**
- * @return The right operand.
- */
- const ScalarPtr& right() const { return right_; }
-
- ExpressionPtr copyWithNewChildren(
- const std::vector<ExpressionPtr> &new_children) const override;
-
- std::vector<AttributeReferencePtr> getReferencedAttributes() const override;
-
- ::quickstep::Scalar* concretize(
- const std::unordered_map<ExprId, const CatalogAttribute*> &substitution_map) const override;
-
- static BinaryExpressionPtr Create(const BinaryOperation &operation,
- const ScalarPtr &left,
- const ScalarPtr &right) {
- return BinaryExpressionPtr(new BinaryExpression(operation, left, right));
- }
-
- protected:
- void getFieldStringItems(
- std::vector<std::string> *inline_field_names,
- std::vector<std::string> *inline_field_values,
- std::vector<std::string> *non_container_child_field_names,
- std::vector<OptimizerTreeBaseNodePtr> *non_container_child_fields,
- std::vector<std::string> *container_child_field_names,
- std::vector<std::vector<OptimizerTreeBaseNodePtr>> *container_child_fields) const override;
-
- private:
- BinaryExpression(const BinaryOperation &operation,
- const ScalarPtr &left,
- const ScalarPtr &right);
-
- const BinaryOperation &operation_;
-
- ScalarPtr left_;
- ScalarPtr right_;
-
- DISALLOW_COPY_AND_ASSIGN(BinaryExpression);
-};
-
-/** @} */
-
-} // namespace expressions
-} // namespace optimizer
-} // namespace quickstep
-
-#endif /* QUICKSTEP_QUERY_OPTIMIZER_EXPRESSIONS_BINARY_EXPRESSION_HPP_ */
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/expressions/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/CMakeLists.txt b/query_optimizer/expressions/CMakeLists.txt
deleted file mode 100644
index 35fac90..0000000
--- a/query_optimizer/expressions/CMakeLists.txt
+++ /dev/null
@@ -1,348 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Declare micro-libs:
-add_library(quickstep_queryoptimizer_expressions_AggregateFunction AggregateFunction.cpp AggregateFunction.hpp)
-add_library(quickstep_queryoptimizer_expressions_Alias Alias.cpp Alias.hpp)
-add_library(quickstep_queryoptimizer_expressions_AttributeReference AttributeReference.cpp AttributeReference.hpp)
-add_library(quickstep_queryoptimizer_expressions_BinaryExpression BinaryExpression.cpp BinaryExpression.hpp)
-add_library(quickstep_queryoptimizer_expressions_Cast Cast.cpp Cast.hpp)
-add_library(quickstep_queryoptimizer_expressions_ComparisonExpression ComparisonExpression.cpp
- ComparisonExpression.hpp)
-add_library(quickstep_queryoptimizer_expressions_Exists Exists.cpp Exists.hpp)
-add_library(quickstep_queryoptimizer_expressions_Expression ../../empty_src.cpp Expression.hpp)
-add_library(quickstep_queryoptimizer_expressions_ExpressionType ../../empty_src.cpp ExpressionType.hpp)
-add_library(quickstep_queryoptimizer_expressions_ExprId ../../empty_src.cpp ExprId.hpp)
-add_library(quickstep_queryoptimizer_expressions_ExpressionUtil ExpressionUtil.cpp ExpressionUtil.hpp)
-add_library(quickstep_queryoptimizer_expressions_InTableQuery InTableQuery.cpp InTableQuery.hpp)
-add_library(quickstep_queryoptimizer_expressions_InValueList InValueList.cpp InValueList.hpp)
-add_library(quickstep_queryoptimizer_expressions_LogicalAnd LogicalAnd.cpp LogicalAnd.hpp)
-add_library(quickstep_queryoptimizer_expressions_LogicalNot LogicalNot.cpp LogicalNot.hpp)
-add_library(quickstep_queryoptimizer_expressions_LogicalOr LogicalOr.cpp LogicalOr.hpp)
-add_library(quickstep_queryoptimizer_expressions_NamedExpression NamedExpression.cpp NamedExpression.hpp)
-add_library(quickstep_queryoptimizer_expressions_PatternMatcher ../../empty_src.cpp PatternMatcher.hpp)
-add_library(quickstep_queryoptimizer_expressions_Predicate ../../empty_src.cpp Predicate.hpp)
-add_library(quickstep_queryoptimizer_expressions_PredicateLiteral PredicateLiteral.cpp PredicateLiteral.hpp)
-add_library(quickstep_queryoptimizer_expressions_Scalar ../../empty_src.cpp Scalar.hpp)
-add_library(quickstep_queryoptimizer_expressions_ScalarLiteral ScalarLiteral.cpp ScalarLiteral.hpp)
-add_library(quickstep_queryoptimizer_expressions_SearchedCase SearchedCase.cpp SearchedCase.hpp)
-add_library(quickstep_queryoptimizer_expressions_SimpleCase SimpleCase.cpp SimpleCase.hpp)
-add_library(quickstep_queryoptimizer_expressions_SubqueryExpression SubqueryExpression.cpp SubqueryExpression.hpp)
-add_library(quickstep_queryoptimizer_expressions_UnaryExpression UnaryExpression.cpp UnaryExpression.hpp)
-add_library(quickstep_queryoptimizer_expressions_WindowAggregateFunction WindowAggregateFunction.cpp WindowAggregateFunction.hpp)
-
-# Link dependencies:
-target_link_libraries(quickstep_queryoptimizer_expressions_AggregateFunction
- glog
- quickstep_expressions_aggregation_AggregateFunction
- quickstep_queryoptimizer_OptimizerTree
- quickstep_queryoptimizer_expressions_AttributeReference
- quickstep_queryoptimizer_expressions_Expression
- quickstep_queryoptimizer_expressions_ExpressionType
- quickstep_queryoptimizer_expressions_PatternMatcher
- quickstep_queryoptimizer_expressions_Scalar
- quickstep_types_Type
- quickstep_utility_Cast
- quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_expressions_Alias
- glog
- quickstep_catalog_CatalogTypedefs
- quickstep_queryoptimizer_OptimizerTree
- quickstep_queryoptimizer_expressions_AttributeReference
- quickstep_queryoptimizer_expressions_ExprId
- quickstep_queryoptimizer_expressions_Expression
- quickstep_queryoptimizer_expressions_ExpressionType
- quickstep_queryoptimizer_expressions_NamedExpression
- quickstep_queryoptimizer_expressions_PatternMatcher
- quickstep_queryoptimizer_expressions_Scalar
- quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_expressions_AttributeReference
- glog
- quickstep_catalog_CatalogTypedefs
- quickstep_expressions_scalar_ScalarAttribute
- quickstep_queryoptimizer_expressions_ExprId
- quickstep_queryoptimizer_expressions_Expression
- quickstep_queryoptimizer_expressions_ExpressionType
- quickstep_queryoptimizer_expressions_NamedExpression
- quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_expressions_BinaryExpression
- glog
- quickstep_expressions_scalar_ScalarBinaryExpression
- quickstep_queryoptimizer_OptimizerTree
- quickstep_queryoptimizer_expressions_AttributeReference
- quickstep_queryoptimizer_expressions_ExprId
- quickstep_queryoptimizer_expressions_Expression
- quickstep_queryoptimizer_expressions_ExpressionType
- quickstep_queryoptimizer_expressions_PatternMatcher
- quickstep_queryoptimizer_expressions_Scalar
- quickstep_types_operations_binaryoperations_BinaryOperation
- quickstep_types_operations_binaryoperations_BinaryOperationID
- quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_expressions_Cast
- glog
- quickstep_expressions_scalar_Scalar
- quickstep_expressions_scalar_ScalarUnaryExpression
- quickstep_queryoptimizer_OptimizerTree
- quickstep_queryoptimizer_expressions_AttributeReference
- quickstep_queryoptimizer_expressions_ExprId
- quickstep_queryoptimizer_expressions_Expression
- quickstep_queryoptimizer_expressions_ExpressionType
- quickstep_queryoptimizer_expressions_PatternMatcher
- quickstep_queryoptimizer_expressions_Scalar
- quickstep_types_Type
- quickstep_types_operations_unaryoperations_NumericCastOperation
- quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_expressions_ComparisonExpression
- glog
- quickstep_expressions_predicate_ComparisonPredicate
- quickstep_queryoptimizer_OptimizerTree
- quickstep_queryoptimizer_expressions_AttributeReference
- quickstep_queryoptimizer_expressions_ExprId
- quickstep_queryoptimizer_expressions_Expression
- quickstep_queryoptimizer_expressions_ExpressionType
- quickstep_queryoptimizer_expressions_PatternMatcher
- quickstep_queryoptimizer_expressions_Predicate
- quickstep_queryoptimizer_expressions_Scalar
- quickstep_types_operations_comparisons_Comparison
- quickstep_types_operations_comparisons_ComparisonID
- quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_expressions_Exists
- quickstep_queryoptimizer_OptimizerTree
- quickstep_queryoptimizer_expressions_AttributeReference
- quickstep_queryoptimizer_expressions_ExprId
- quickstep_queryoptimizer_expressions_Expression
- quickstep_queryoptimizer_expressions_ExpressionType
- quickstep_queryoptimizer_expressions_Predicate
- quickstep_queryoptimizer_expressions_SubqueryExpression
- quickstep_utility_Macros
- glog)
-target_link_libraries(quickstep_queryoptimizer_expressions_Expression
- quickstep_queryoptimizer_OptimizerTree
- quickstep_queryoptimizer_expressions_ExpressionType
- quickstep_types_Type
- quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_expressions_ExpressionUtil
- glog
- quickstep_queryoptimizer_expressions_AttributeReference
- quickstep_queryoptimizer_expressions_ExprId
- quickstep_queryoptimizer_expressions_NamedExpression
- quickstep_queryoptimizer_expressions_PatternMatcher)
-target_link_libraries(quickstep_queryoptimizer_expressions_InTableQuery
- quickstep_queryoptimizer_OptimizerTree
- quickstep_queryoptimizer_expressions_AttributeReference
- quickstep_queryoptimizer_expressions_ExprId
- quickstep_queryoptimizer_expressions_Expression
- quickstep_queryoptimizer_expressions_ExpressionType
- quickstep_queryoptimizer_expressions_Predicate
- quickstep_queryoptimizer_expressions_Scalar
- quickstep_queryoptimizer_expressions_SubqueryExpression
- quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_expressions_InValueList
- quickstep_queryoptimizer_OptimizerTree
- quickstep_expressions_predicate_DisjunctionPredicate
- quickstep_expressions_predicate_Predicate
- quickstep_queryoptimizer_expressions_AttributeReference
- quickstep_queryoptimizer_expressions_ComparisonExpression
- quickstep_queryoptimizer_expressions_ExprId
- quickstep_queryoptimizer_expressions_Expression
- quickstep_queryoptimizer_expressions_ExpressionType
- quickstep_queryoptimizer_expressions_Predicate
- quickstep_queryoptimizer_expressions_Scalar
- quickstep_types_operations_comparisons_ComparisonFactory
- quickstep_types_operations_comparisons_ComparisonID
- quickstep_utility_Cast
- quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_expressions_LogicalAnd
- glog
- quickstep_expressions_predicate_ConjunctionPredicate
- quickstep_expressions_predicate_TrivialPredicates
- quickstep_queryoptimizer_OptimizerTree
- quickstep_queryoptimizer_expressions_AttributeReference
- quickstep_queryoptimizer_expressions_ExprId
- quickstep_queryoptimizer_expressions_Expression
- quickstep_queryoptimizer_expressions_ExpressionType
- quickstep_queryoptimizer_expressions_PatternMatcher
- quickstep_queryoptimizer_expressions_Predicate
- quickstep_queryoptimizer_expressions_PredicateLiteral
- quickstep_utility_Cast
- quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_expressions_LogicalNot
- glog
- quickstep_expressions_predicate_NegationPredicate
- quickstep_queryoptimizer_OptimizerTree
- quickstep_queryoptimizer_expressions_AttributeReference
- quickstep_queryoptimizer_expressions_ExprId
- quickstep_queryoptimizer_expressions_Expression
- quickstep_queryoptimizer_expressions_ExpressionType
- quickstep_queryoptimizer_expressions_PatternMatcher
- quickstep_queryoptimizer_expressions_Predicate
- quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_expressions_LogicalOr
- glog
- quickstep_expressions_predicate_DisjunctionPredicate
- quickstep_expressions_predicate_TrivialPredicates
- quickstep_queryoptimizer_OptimizerTree
- quickstep_queryoptimizer_expressions_AttributeReference
- quickstep_queryoptimizer_expressions_ExprId
- quickstep_queryoptimizer_expressions_Expression
- quickstep_queryoptimizer_expressions_ExpressionType
- quickstep_queryoptimizer_expressions_PatternMatcher
- quickstep_queryoptimizer_expressions_Predicate
- quickstep_queryoptimizer_expressions_PredicateLiteral
- quickstep_utility_Cast
- quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_expressions_NamedExpression
- quickstep_queryoptimizer_OptimizerTree
- quickstep_queryoptimizer_expressions_ExprId
- quickstep_queryoptimizer_expressions_Scalar
- quickstep_types_Type
- quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_expressions_PatternMatcher
- quickstep_queryoptimizer_expressions_ExpressionType)
-target_link_libraries(quickstep_queryoptimizer_expressions_Predicate
- quickstep_queryoptimizer_expressions_ExprId
- quickstep_queryoptimizer_expressions_Expression
- quickstep_types_Type
- quickstep_types_TypeFactory
- quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_expressions_PredicateLiteral
- glog
- quickstep_expressions_predicate_TrivialPredicates
- quickstep_queryoptimizer_OptimizerTree
- quickstep_queryoptimizer_expressions_AttributeReference
- quickstep_queryoptimizer_expressions_ExprId
- quickstep_queryoptimizer_expressions_Expression
- quickstep_queryoptimizer_expressions_ExpressionType
- quickstep_queryoptimizer_expressions_Predicate
- quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_expressions_Scalar
- glog
- quickstep_queryoptimizer_expressions_ExprId
- quickstep_queryoptimizer_expressions_Expression
- quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_expressions_ScalarLiteral
- glog
- quickstep_expressions_scalar_ScalarLiteral
- quickstep_queryoptimizer_OptimizerTree
- quickstep_queryoptimizer_expressions_AttributeReference
- quickstep_queryoptimizer_expressions_ExprId
- quickstep_queryoptimizer_expressions_Expression
- quickstep_queryoptimizer_expressions_ExpressionType
- quickstep_queryoptimizer_expressions_Scalar
- quickstep_types_Type
- quickstep_types_TypedValue
- quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_expressions_SearchedCase
- quickstep_expressions_predicate_Predicate
- quickstep_expressions_scalar_Scalar
- quickstep_expressions_scalar_ScalarCaseExpression
- quickstep_expressions_scalar_ScalarLiteral
- quickstep_queryoptimizer_OptimizerTree
- quickstep_queryoptimizer_expressions_AttributeReference
- quickstep_queryoptimizer_expressions_ExprId
- quickstep_queryoptimizer_expressions_Expression
- quickstep_queryoptimizer_expressions_ExpressionType
- quickstep_queryoptimizer_expressions_Predicate
- quickstep_queryoptimizer_expressions_Scalar
- quickstep_types_Type
- quickstep_utility_Cast
- quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_expressions_SimpleCase
- quickstep_expressions_predicate_Predicate
- quickstep_expressions_scalar_Scalar
- quickstep_expressions_scalar_ScalarCaseExpression
- quickstep_expressions_scalar_ScalarLiteral
- quickstep_queryoptimizer_OptimizerTree
- quickstep_queryoptimizer_expressions_AttributeReference
- quickstep_queryoptimizer_expressions_ComparisonExpression
- quickstep_queryoptimizer_expressions_ExprId
- quickstep_queryoptimizer_expressions_Expression
- quickstep_queryoptimizer_expressions_ExpressionType
- quickstep_queryoptimizer_expressions_Predicate
- quickstep_queryoptimizer_expressions_Scalar
- quickstep_types_Type
- quickstep_types_operations_comparisons_ComparisonFactory
- quickstep_types_operations_comparisons_ComparisonID
- quickstep_utility_Cast
- quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_expressions_SubqueryExpression
- glog
- quickstep_queryoptimizer_OptimizerTree
- quickstep_queryoptimizer_expressions_AttributeReference
- quickstep_queryoptimizer_expressions_ExprId
- quickstep_queryoptimizer_expressions_Expression
- quickstep_queryoptimizer_expressions_ExpressionType
- quickstep_queryoptimizer_expressions_Scalar
- quickstep_queryoptimizer_logical_Logical
- quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_expressions_UnaryExpression
- glog
- quickstep_expressions_scalar_ScalarUnaryExpression
- quickstep_queryoptimizer_OptimizerTree
- quickstep_queryoptimizer_expressions_AttributeReference
- quickstep_queryoptimizer_expressions_ExprId
- quickstep_queryoptimizer_expressions_Expression
- quickstep_queryoptimizer_expressions_ExpressionType
- quickstep_queryoptimizer_expressions_PatternMatcher
- quickstep_queryoptimizer_expressions_Scalar
- quickstep_types_operations_unaryoperations_UnaryOperation
- quickstep_types_operations_unaryoperations_UnaryOperationID
- quickstep_utility_Macros)
-target_link_libraries(quickstep_queryoptimizer_expressions_WindowAggregateFunction
- glog
- quickstep_expressions_windowaggregation_WindowAggregateFunction
- quickstep_queryoptimizer_OptimizerTree
- quickstep_queryoptimizer_expressions_AttributeReference
- quickstep_queryoptimizer_expressions_Expression
- quickstep_queryoptimizer_expressions_ExpressionType
- quickstep_queryoptimizer_expressions_PatternMatcher
- quickstep_queryoptimizer_expressions_Scalar
- quickstep_types_Type
- quickstep_utility_Cast
- quickstep_utility_Macros)
-
-
-# Module all-in-one library:
-add_library(quickstep_queryoptimizer_expressions ../../empty_src.cpp OptimizerExpressionsModule.hpp)
-target_link_libraries(quickstep_queryoptimizer_expressions
- quickstep_queryoptimizer_expressions_AggregateFunction
- quickstep_queryoptimizer_expressions_Alias
- quickstep_queryoptimizer_expressions_AttributeReference
- quickstep_queryoptimizer_expressions_BinaryExpression
- quickstep_queryoptimizer_expressions_Cast
- quickstep_queryoptimizer_expressions_ComparisonExpression
- quickstep_queryoptimizer_expressions_Exists
- quickstep_queryoptimizer_expressions_Expression
- quickstep_queryoptimizer_expressions_ExpressionType
- quickstep_queryoptimizer_expressions_ExprId
- quickstep_queryoptimizer_expressions_ExpressionUtil
- quickstep_queryoptimizer_expressions_InTableQuery
- quickstep_queryoptimizer_expressions_InValueList
- quickstep_queryoptimizer_expressions_LogicalAnd
- quickstep_queryoptimizer_expressions_LogicalNot
- quickstep_queryoptimizer_expressions_LogicalOr
- quickstep_queryoptimizer_expressions_NamedExpression
- quickstep_queryoptimizer_expressions_PatternMatcher
- quickstep_queryoptimizer_expressions_Predicate
- quickstep_queryoptimizer_expressions_PredicateLiteral
- quickstep_queryoptimizer_expressions_Scalar
- quickstep_queryoptimizer_expressions_ScalarLiteral
- quickstep_queryoptimizer_expressions_SearchedCase
- quickstep_queryoptimizer_expressions_SimpleCase
- quickstep_queryoptimizer_expressions_SubqueryExpression
- quickstep_queryoptimizer_expressions_UnaryExpression
- quickstep_queryoptimizer_expressions_WindowAggregateFunction)
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/expressions/Cast.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/Cast.cpp b/query_optimizer/expressions/Cast.cpp
deleted file mode 100644
index c0813c5..0000000
--- a/query_optimizer/expressions/Cast.cpp
+++ /dev/null
@@ -1,74 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- **/
-
-#include "query_optimizer/expressions/Cast.hpp"
-
-#include <string>
-#include <unordered_map>
-#include <vector>
-
-#include "expressions/scalar/Scalar.hpp"
-#include "expressions/scalar/ScalarUnaryExpression.hpp"
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "query_optimizer/expressions/ExprId.hpp"
-#include "query_optimizer/expressions/Expression.hpp"
-#include "query_optimizer/expressions/PatternMatcher.hpp"
-#include "query_optimizer/expressions/Scalar.hpp"
-#include "types/Type.hpp"
-#include "types/operations/unary_operations/NumericCastOperation.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-namespace optimizer {
-namespace expressions {
-
-ExpressionPtr Cast::copyWithNewChildren(
- const std::vector<ExpressionPtr> &new_children) const {
- DCHECK_EQ(getNumChildren(), new_children.size());
- ScalarPtr scalar;
- CHECK(SomeScalar::MatchesWithConditionalCast(new_children[0], &scalar))
- << new_children[0]->toString();
- return Create(scalar, target_type_);
-}
-
-::quickstep::Scalar *Cast::concretize(
- const std::unordered_map<ExprId, const CatalogAttribute*> &substitution_map) const {
- return new ::quickstep::ScalarUnaryExpression(::quickstep::NumericCastOperation::Instance(target_type_),
- operand_->concretize(substitution_map));
-}
-
-void Cast::getFieldStringItems(
- std::vector<std::string> *inline_field_names,
- std::vector<std::string> *inline_field_values,
- std::vector<std::string> *non_container_child_field_names,
- std::vector<OptimizerTreeBaseNodePtr> *non_container_child_fields,
- std::vector<std::string> *container_child_field_names,
- std::vector<std::vector<OptimizerTreeBaseNodePtr>> *container_child_fields) const {
- inline_field_names->push_back("target_type");
- inline_field_values->push_back(target_type_.getName());
-
- non_container_child_field_names->push_back("operand");
- non_container_child_fields->push_back(operand_);
-}
-
-} // namespace expressions
-} // namespace optimizer
-} // namespace quickstep
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/expressions/Cast.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/Cast.hpp b/query_optimizer/expressions/Cast.hpp
deleted file mode 100644
index ac5bd02..0000000
--- a/query_optimizer/expressions/Cast.hpp
+++ /dev/null
@@ -1,121 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- **/
-
-#ifndef QUICKSTEP_QUERY_OPTIMIZER_EXPRESSIONS_CAST_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_EXPRESSIONS_CAST_HPP_
-
-#include <memory>
-#include <string>
-#include <unordered_map>
-#include <vector>
-
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "query_optimizer/expressions/ExprId.hpp"
-#include "query_optimizer/expressions/Expression.hpp"
-#include "query_optimizer/expressions/ExpressionType.hpp"
-#include "query_optimizer/expressions/Scalar.hpp"
-#include "utility/Macros.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-class CatalogAttribute;
-class Type;
-
-namespace optimizer {
-namespace expressions {
-
-/** \addtogroup OptimizerExpressions
- * @{
- */
-
-class Cast;
-typedef std::shared_ptr<const Cast> CastPtr;
-
-/**
- * @brief Converts a value of a type to another type.
- */
-class Cast : public Scalar {
- public:
- ExpressionType getExpressionType() const override { return ExpressionType::kCast; }
-
- std::string getName() const override { return "Cast"; }
-
- const Type& getValueType() const override { return target_type_; }
-
- bool isConstant() const override { return operand_->isConstant(); }
-
- /**
- * @return The expression to be coerced.
- */
- const ScalarPtr& operand() const { return operand_; }
-
- std::vector<AttributeReferencePtr> getReferencedAttributes() const override {
- return operand_->getReferencedAttributes();
- }
-
- ExpressionPtr copyWithNewChildren(
- const std::vector<ExpressionPtr> &new_children) const override;
-
- ::quickstep::Scalar* concretize(
- const std::unordered_map<ExprId, const CatalogAttribute*> &substitution_map) const override;
-
- /**
- * @brief Creates a Cast expression that converts \p operand to \p target_type.
- *
- * @param operand The input expression to be coerced.
- * @param target_type The target type that the expression is converted to.
- * @return A Cast expression.
- */
- static CastPtr Create(const ScalarPtr &operand, const Type &target_type) {
- return CastPtr(new Cast(operand, target_type));
- }
-
- protected:
- void getFieldStringItems(
- std::vector<std::string> *inline_field_names,
- std::vector<std::string> *inline_field_values,
- std::vector<std::string> *non_container_child_field_names,
- std::vector<OptimizerTreeBaseNodePtr> *non_container_child_fields,
- std::vector<std::string> *container_child_field_names,
- std::vector<std::vector<OptimizerTreeBaseNodePtr>> *container_child_fields) const override;
-
- private:
- Cast(const ScalarPtr &operand, const Type &target_type)
- : operand_(operand),
- target_type_(target_type) {
- addChild(operand);
- DCHECK(target_type.isCoercibleFrom(operand->getValueType()));
- }
-
- ScalarPtr operand_;
- const Type &target_type_;
-
- DISALLOW_COPY_AND_ASSIGN(Cast);
-};
-
-/** @} */
-
-} // namespace expressions
-} // namespace optimizer
-} // namespace quickstep
-
-#endif /* QUICKSTEP_QUERY_OPTIMIZER_EXPRESSIONS_CAST_HPP_ */
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/expressions/ComparisonExpression.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/ComparisonExpression.cpp b/query_optimizer/expressions/ComparisonExpression.cpp
deleted file mode 100644
index 8d93794..0000000
--- a/query_optimizer/expressions/ComparisonExpression.cpp
+++ /dev/null
@@ -1,105 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- **/
-
-#include "query_optimizer/expressions/ComparisonExpression.hpp"
-
-#include <string>
-#include <unordered_map>
-#include <vector>
-
-#include "expressions/predicate/ComparisonPredicate.hpp"
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "query_optimizer/expressions/ExprId.hpp"
-#include "query_optimizer/expressions/Expression.hpp"
-#include "query_optimizer/expressions/PatternMatcher.hpp"
-#include "query_optimizer/expressions/Scalar.hpp"
-#include "types/operations/comparisons/Comparison.hpp"
-#include "types/operations/comparisons/ComparisonID.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-namespace optimizer {
-namespace expressions {
-
-ComparisonExpression::ComparisonExpression(const Comparison &comparison,
- const ScalarPtr &left,
- const ScalarPtr &right)
- : comparison_(comparison), left_(left), right_(right) {
- DCHECK(comparison_.canCompareTypes(left->getValueType(),
- right->getValueType()));
- addChild(left_);
- addChild(right_);
-}
-
-std::string ComparisonExpression::getName() const {
- return comparison_.getName();
-}
-
-bool ComparisonExpression::isEqualityComparisonPredicate() const {
- return comparison_.getComparisonID() == ComparisonID::kEqual;
-}
-
-ExpressionPtr ComparisonExpression::copyWithNewChildren(
- const std::vector<ExpressionPtr> &new_children) const {
- DCHECK_EQ(new_children.size(), children().size());
- ScalarPtr left_operand;
- ScalarPtr right_operand;
- CHECK(SomeScalar::MatchesWithConditionalCast(new_children[0], &left_operand));
- CHECK(SomeScalar::MatchesWithConditionalCast(new_children[1], &right_operand));
- return ComparisonExpression::Create(comparison_, left_operand, right_operand);
-}
-
-std::vector<AttributeReferencePtr>
-ComparisonExpression::getReferencedAttributes() const {
- std::vector<AttributeReferencePtr> referenced_attributes =
- left_->getReferencedAttributes();
- const std::vector<AttributeReferencePtr> referenced_attributes_by_right_operand =
- right_->getReferencedAttributes();
- referenced_attributes.insert(referenced_attributes.end(),
- referenced_attributes_by_right_operand.begin(),
- referenced_attributes_by_right_operand.end());
- return referenced_attributes;
-}
-
-::quickstep::Predicate* ComparisonExpression::concretize(
- const std::unordered_map<ExprId, const CatalogAttribute*> &substitution_map) const {
- return new ::quickstep::ComparisonPredicate(
- comparison_,
- left_->concretize(substitution_map),
- right_->concretize(substitution_map));
-}
-
-void ComparisonExpression::getFieldStringItems(
- std::vector<std::string> *inline_field_names,
- std::vector<std::string> *inline_field_values,
- std::vector<std::string> *non_container_child_field_names,
- std::vector<OptimizerTreeBaseNodePtr> *non_container_child_fields,
- std::vector<std::string> *container_child_field_names,
- std::vector<std::vector<OptimizerTreeBaseNodePtr>> *container_child_fields) const {
- non_container_child_field_names->push_back("");
- non_container_child_field_names->push_back("");
- non_container_child_fields->push_back(left_);
- non_container_child_fields->push_back(right_);
-}
-
-} // namespace expressions
-} // namespace optimizer
-} // namespace quickstep
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/expressions/ComparisonExpression.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/ComparisonExpression.hpp b/query_optimizer/expressions/ComparisonExpression.hpp
deleted file mode 100644
index 011e04e..0000000
--- a/query_optimizer/expressions/ComparisonExpression.hpp
+++ /dev/null
@@ -1,136 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- **/
-
-#ifndef QUICKSTEP_QUERY_OPTIMIZER_EXPRESSIONS_COMPARISON_EXPRESSION_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_EXPRESSIONS_COMPARISON_EXPRESSION_HPP_
-
-#include <memory>
-#include <string>
-#include <unordered_map>
-#include <vector>
-
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "query_optimizer/expressions/ExprId.hpp"
-#include "query_optimizer/expressions/Expression.hpp"
-#include "query_optimizer/expressions/ExpressionType.hpp"
-#include "query_optimizer/expressions/Predicate.hpp"
-#include "query_optimizer/expressions/Scalar.hpp"
-#include "utility/Macros.hpp"
-
-namespace quickstep {
-
-class CatalogAttribute;
-class Comparison;
-class Predicate;
-
-namespace optimizer {
-namespace expressions {
-
-/** \addtogroup OptimizerExpressions
- * @{
- */
-
-class ComparisonExpression;
-typedef std::shared_ptr<const ComparisonExpression> ComparisonExpressionPtr;
-
-/**
- * @brief Applies a comparison operator to two scalar expressions and returns a
- * bool value.
- */
-class ComparisonExpression : public Predicate {
- public:
- ExpressionType getExpressionType() const override {
- return ExpressionType::kComparisonExpression;
- }
-
- bool isConstant() const override {
- return left_->isConstant() && right_->isConstant();
- }
-
- std::string getName() const override;
-
- /**
- * @return The comparison operator.
- */
- const Comparison& comparison() const { return comparison_; }
-
- /**
- * @return The left operand.
- */
- const ScalarPtr& left() const { return left_; }
-
- /**
- * @return The right operand.
- */
- const ScalarPtr& right() const { return right_; }
-
- bool isEqualityComparisonPredicate() const;
-
- ExpressionPtr copyWithNewChildren(
- const std::vector<ExpressionPtr> &new_children) const override;
-
- std::vector<AttributeReferencePtr> getReferencedAttributes() const override;
-
- ::quickstep::Predicate* concretize(
- const std::unordered_map<ExprId, const CatalogAttribute*> &substitution_map) const override;
-
- /**
- * @brief Creates an immutable ComparisonExpression.
- *
- * @param comparison The comparison operator.
- * @param left The left operand.
- * @param right The right operand.
- * @return An immutable ComparisonExpression.
- */
- static ComparisonExpressionPtr Create(const Comparison &comparison,
- const ScalarPtr &left,
- const ScalarPtr &right) {
- return ComparisonExpressionPtr(
- new ComparisonExpression(comparison, left, right));
- }
-
- protected:
- void getFieldStringItems(
- std::vector<std::string> *inline_field_names,
- std::vector<std::string> *inline_field_values,
- std::vector<std::string> *non_container_child_field_names,
- std::vector<OptimizerTreeBaseNodePtr> *non_container_child_fields,
- std::vector<std::string> *container_child_field_names,
- std::vector<std::vector<OptimizerTreeBaseNodePtr>> *container_child_fields) const override;
-
- private:
- ComparisonExpression(const Comparison &comparison,
- const ScalarPtr &left,
- const ScalarPtr &right);
-
- const Comparison &comparison_;
- ScalarPtr left_;
- ScalarPtr right_;
-
- DISALLOW_COPY_AND_ASSIGN(ComparisonExpression);
-};
-
-/** @} */
-
-} // namespace expressions
-} // namespace optimizer
-} // namespace quickstep
-
-#endif /* QUICKSTEP_QUERY_OPTIMIZER_EXPRESSIONS_COMPARISON_EXPRESSION_HPP_ */
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/expressions/Exists.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/Exists.cpp b/query_optimizer/expressions/Exists.cpp
deleted file mode 100644
index a7b0201..0000000
--- a/query_optimizer/expressions/Exists.cpp
+++ /dev/null
@@ -1,57 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- **/
-
-#include "query_optimizer/expressions/Exists.hpp"
-
-#include <vector>
-#include <string>
-
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/ExprId.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-class CatalogAttribute;
-class Predicate;
-
-namespace optimizer {
-namespace expressions {
-
-::quickstep::Predicate* Exists::concretize(
- const std::unordered_map<ExprId, const CatalogAttribute*> &substitution_map) const {
- LOG(FATAL) << "Exists predicate should not be concretized";
- return nullptr;
-}
-
-void Exists::getFieldStringItems(
- std::vector<std::string> *inline_field_names,
- std::vector<std::string> *inline_field_values,
- std::vector<std::string> *non_container_child_field_names,
- std::vector<OptimizerTreeBaseNodePtr> *non_container_child_fields,
- std::vector<std::string> *container_child_field_names,
- std::vector<std::vector<OptimizerTreeBaseNodePtr>> *container_child_fields) const {
- non_container_child_field_names->push_back("exists_subquery");
- non_container_child_fields->push_back(exists_subquery_);
-}
-
-} // namespace expressions
-} // namespace optimizer
-} // namespace quickstep
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/expressions/Exists.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/Exists.hpp b/query_optimizer/expressions/Exists.hpp
deleted file mode 100644
index 0b75de5..0000000
--- a/query_optimizer/expressions/Exists.hpp
+++ /dev/null
@@ -1,128 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- **/
-
-#ifndef QUICKSTEP_QUERY_OPTIMIZER_EXPRESSIONS_EXISTS_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_EXPRESSIONS_EXISTS_HPP_
-
-#include <memory>
-#include <string>
-#include <unordered_map>
-#include <vector>
-
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "query_optimizer/expressions/ExprId.hpp"
-#include "query_optimizer/expressions/Expression.hpp"
-#include "query_optimizer/expressions/ExpressionType.hpp"
-#include "query_optimizer/expressions/Predicate.hpp"
-#include "query_optimizer/expressions/SubqueryExpression.hpp"
-#include "utility/Macros.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-class CatalogAttribute;
-class Predicate;
-
-namespace optimizer {
-namespace expressions {
-
-/** \addtogroup OptimizerExpressions
- * @{
- */
-
-class Exists;
-typedef std::shared_ptr<const Exists> ExistsPtr;
-
-/**
- * @brief EXISTS predicate expression.
- */
-class Exists : public Predicate {
- public:
- ExpressionType getExpressionType() const override {
- return ExpressionType::kExists;
- }
-
- std::string getName() const override {
- return "Exists";
- }
-
- bool isConstant() const override {
- return false;
- }
-
- /**
- * @return The subquery expression for this EXISTS predicate.
- */
- const SubqueryExpressionPtr& exists_subquery() const {
- return exists_subquery_;
- }
-
- ExpressionPtr copyWithNewChildren(
- const std::vector<ExpressionPtr> &new_children) const override {
- DCHECK_EQ(1u, new_children.size());
- return Create(std::static_pointer_cast<const SubqueryExpression>(new_children[0]));
- }
-
- std::vector<AttributeReferencePtr> getReferencedAttributes() const override {
- return {};
- }
-
- ::quickstep::Predicate* concretize(
- const std::unordered_map<ExprId, const CatalogAttribute*> &substitution_map) const override;
-
- /**
- * @brief Create an Exists predicate expression.
- *
- * @param exists_subquery The subquery expression for this EXISTS predicate.
- * @return An immutable Exists expression node.
- */
- static ExistsPtr Create(const SubqueryExpressionPtr &exists_subquery) {
- return ExistsPtr(new Exists(exists_subquery));
- }
-
- protected:
- void getFieldStringItems(
- std::vector<std::string> *inline_field_names,
- std::vector<std::string> *inline_field_values,
- std::vector<std::string> *non_container_child_field_names,
- std::vector<OptimizerTreeBaseNodePtr> *non_container_child_fields,
- std::vector<std::string> *container_child_field_names,
- std::vector<std::vector<OptimizerTreeBaseNodePtr>> *container_child_fields) const override;
-
- private:
- explicit Exists(const SubqueryExpressionPtr &exists_subquery)
- : exists_subquery_(exists_subquery) {
- addChild(exists_subquery_);
- }
-
- SubqueryExpressionPtr exists_subquery_;
-
- DISALLOW_COPY_AND_ASSIGN(Exists);
-};
-
-/** @} */
-
-} // namespace expressions
-} // namespace optimizer
-} // namespace quickstep
-
-
-#endif /* QUICKSTEP_QUERY_OPTIMIZER_EXPRESSIONS_EXISTS_HPP_ */
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/expressions/ExprId.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/ExprId.hpp b/query_optimizer/expressions/ExprId.hpp
deleted file mode 100644
index be5dd6a..0000000
--- a/query_optimizer/expressions/ExprId.hpp
+++ /dev/null
@@ -1,42 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- **/
-
-#ifndef QUICKSTEP_QUERY_OPTIMIZER__EXPRESSIONS_EXPR_ID_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER__EXPRESSIONS_EXPR_ID_HPP_
-
-namespace quickstep {
-namespace optimizer {
-namespace expressions {
-
-/** \addtogroup OptimizerExpressions
- * @{
- */
-
-/**
- * @brief Expression ID for a named expression.
- */
-typedef int ExprId;
-
-/** @} */
-
-} // namespace expressions
-} // namespace optimizer
-} // namespace quickstep
-
-#endif /* QUICKSTEP_QUERY_OPTIMIZER__EXPRESSIONS_EXPR_ID_HPP_ */
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/expressions/Expression.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/Expression.hpp b/query_optimizer/expressions/Expression.hpp
deleted file mode 100644
index 7127047..0000000
--- a/query_optimizer/expressions/Expression.hpp
+++ /dev/null
@@ -1,96 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- **/
-
-#ifndef QUICKSTEP_QUERY_OPTIMIZER_EXPRESSIONS_EXPRESSION_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_EXPRESSIONS_EXPRESSION_HPP_
-
-#include <memory>
-#include <map>
-#include <vector>
-
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/ExpressionType.hpp"
-#include "types/Type.hpp"
-#include "utility/Macros.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-namespace optimizer {
-namespace expressions {
-
-/** \addtogroup OptimizerExpressions
- * @{
- */
-
-class AttributeReference;
-class Expression;
-
-typedef std::shared_ptr<const Expression> ExpressionPtr;
-
-/**
- * @brief Base class for all expressions in the query optimizer.
- */
-class Expression : public OptimizerTree<Expression> {
- public:
- /**
- * @brief Destructor.
- */
- ~Expression() override {}
-
- /**
- * @brief Returns the expression type.
- *
- * @return ExpressionType of this expression.
- */
- virtual ExpressionType getExpressionType() const = 0;
-
- /**
- * @brief Returns the type of the output.
- *
- * @return The type of the output.
- */
- virtual const Type& getValueType() const = 0;
-
- /**
- * @brief Returns AttributeReferences referenced by this expression.
- *
- * @return A vector of AttributeReference referenced by this expression.
- */
- virtual std::vector<std::shared_ptr<const AttributeReference>> getReferencedAttributes() const = 0;
-
- /**
- * @return True if this expression is constant.
- */
- virtual bool isConstant() const = 0;
-
- protected:
- Expression() {}
-
- private:
- DISALLOW_COPY_AND_ASSIGN(Expression);
-};
-
-/** @} */
-
-} // namespace expressions
-} // namespace optimizer
-} // namespace quickstep
-
-#endif /* QUICKSTEP_QUERY_OPTIMIZER_EXPRESSIONS_EXPRESSION_HPP_ */
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/expressions/ExpressionType.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/ExpressionType.hpp b/query_optimizer/expressions/ExpressionType.hpp
deleted file mode 100644
index 5008f1d..0000000
--- a/query_optimizer/expressions/ExpressionType.hpp
+++ /dev/null
@@ -1,62 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- **/
-
-#ifndef QUICKSTEP_QUERY_OPTIMIZER_EXPRESSIONS_EXPRESSION_TYPE_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_EXPRESSIONS_EXPRESSION_TYPE_HPP_
-
-namespace quickstep {
-namespace optimizer {
-namespace expressions {
-
-/** \addtogroup OptimizerExpressions
- * @{
- */
-
-/**
- * @brief Optimizer expression types.
- **/
-enum class ExpressionType {
- kAggregateFunction,
- kAlias,
- kAttributeReference,
- kBinaryExpression,
- kCast,
- kComparisonExpression,
- kExists,
- kInTableQuery,
- kInValueList,
- kLogicalAnd,
- kLogicalOr,
- kLogicalNot,
- kPredicateLiteral,
- kScalarLiteral,
- kSearchedCase,
- kSimpleCase,
- kSubqueryExpression,
- kUnaryExpression,
- kWindowAggregateFunction
-};
-
-/** @} */
-
-} // namespace expressions
-} // namespace optimizer
-} // namespace quickstep
-
-#endif /* QUICKSTEP_QUERY_OPTIMIZER_EXPRESSIONS_EXPRESSION_TYPE_HPP_ */
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/expressions/ExpressionUtil.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/ExpressionUtil.cpp b/query_optimizer/expressions/ExpressionUtil.cpp
deleted file mode 100644
index c9541ef..0000000
--- a/query_optimizer/expressions/ExpressionUtil.cpp
+++ /dev/null
@@ -1,73 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- **/
-
-#include "query_optimizer/expressions/ExpressionUtil.hpp"
-
-#include <vector>
-
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "query_optimizer/expressions/NamedExpression.hpp"
-
-namespace quickstep {
-namespace optimizer {
-namespace expressions {
-
-AttributeReferencePtr ToRef(const NamedExpressionPtr &expression) {
- return AttributeReference::Create(expression->id(),
- expression->attribute_name(),
- expression->attribute_alias(),
- expression->relation_name(),
- expression->getValueType(),
- AttributeReferenceScope::kLocal);
-}
-
-std::vector<AttributeReferencePtr> GetNullableAttributeVector(
- const std::vector<AttributeReferencePtr> &attributes) {
- std::vector<AttributeReferencePtr> nullable_attributes;
- for (const auto &attr : attributes) {
- if (!attr->getValueType().isNullable()) {
- nullable_attributes.emplace_back(
- AttributeReference::Create(attr->id(),
- attr->attribute_name(),
- attr->attribute_alias(),
- attr->relation_name(),
- attr->getValueType().getNullableVersion(),
- attr->scope()));
- } else {
- nullable_attributes.emplace_back(attr);
- }
- }
- return nullable_attributes;
-}
-
-std::vector<AttributeReferencePtr> GetAttributeReferencesWithinScope(
- const std::vector<AttributeReferencePtr> &attributes,
- const AttributeReferenceScope scope) {
- std::vector<AttributeReferencePtr> filtered_attributes;
- for (const auto &attr_it : attributes) {
- if (attr_it->scope() == scope) {
- filtered_attributes.emplace_back(attr_it);
- }
- }
- return filtered_attributes;
-}
-
-} // namespace expressions
-} // namespace optimizer
-} // namespace quickstep
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/expressions/ExpressionUtil.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/ExpressionUtil.hpp b/query_optimizer/expressions/ExpressionUtil.hpp
deleted file mode 100644
index 422d5ab..0000000
--- a/query_optimizer/expressions/ExpressionUtil.hpp
+++ /dev/null
@@ -1,243 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- **/
-
-#ifndef QUICKSTEP_QUERY_OPTIMIZER_EXPRESSIONS_EXPRESSION_UTIL_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_EXPRESSIONS_EXPRESSION_UTIL_HPP_
-
-#include <cstddef>
-#include <functional>
-#include <memory>
-#include <unordered_set>
-#include <vector>
-
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "query_optimizer/expressions/ExprId.hpp"
-#include "query_optimizer/expressions/NamedExpression.hpp"
-#include "query_optimizer/expressions/PatternMatcher.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-namespace optimizer {
-namespace expressions {
-
-/** \addtogroup OptimizerExpressions
- * @{
- */
-
-/**
- * @brief ExprID comparator for two named expressions.
- */
-struct NamedExpressionCompare {
- inline bool operator()(const NamedExpressionPtr &lhs,
- const NamedExpressionPtr &rhs) const {
- return lhs->id() < rhs->id();
- }
-};
-
-/**
- * @brief Implements the equal function for named expressions.
- */
-struct NamedExpressionEqual {
- inline bool operator()(const NamedExpressionPtr &lhs,
- const NamedExpressionPtr &rhs) const {
- return lhs->id() == rhs->id();
- }
-};
-
-/**
- * @brief Implements the function function for named expressions.
- */
-struct NamedExpressionHash {
- inline std::size_t operator()(const NamedExpressionPtr &named_expr) const {
- return std::hash<expressions::ExprId>()(named_expr->id());
- }
-};
-
-typedef std::unordered_set<NamedExpressionPtr, NamedExpressionHash, NamedExpressionEqual> UnorderedNamedExpressionSet;
-typedef std::unordered_set<AttributeReferencePtr, NamedExpressionHash, NamedExpressionEqual> UnorderedAttributeSet;
-
-/**
- * @brief Checks whether \p expression_to_check is contained by \p expressions.
- *
- * @param expressions A list of expressions to be checked with.
- * @param expression_to_check The expression that is to be checked if it is in
- * \p expressions.
- * @return True if \p expression_to_check is contained by \p expressions.
- */
-template <class NamedExpressionType1, class NamedExpressionType2>
-bool ContainsExpression(
- const std::vector<std::shared_ptr<const NamedExpressionType1>> &expressions,
- const std::shared_ptr<const NamedExpressionType2> &expression_to_check) {
- for (const std::shared_ptr<const NamedExpressionType1> &expression :
- expressions) {
- if (expression->equals(expression_to_check)) {
- return true;
- }
- }
- return false;
-}
-
-/**
- * @brief Checks whether expr_id equals any expression's id in \p expressions.
- *
- * @param expressions A list of expressions to be checked with.
- * @param expr_id The ExprId that is to be checked if it is in \p expressions.
- * @return True if \p expr_id is contained by \p expressions.
- */
-template <class NamedExpressionType>
-bool ContainsExprId(
- const std::vector<std::shared_ptr<const NamedExpressionType>> &expressions,
- const ExprId expr_id) {
- for (const std::shared_ptr<const NamedExpressionType> &expression : expressions) {
- if (expression->id() == expr_id) {
- return true;
- }
- }
- return false;
-}
-
-/**
- * @brief Checks whether \p left is a subset of \p right.
- *
- * @param left The left operand of the subset operator (i.e. the one that may be
- * a subset).
- * @param right The right operand of the subset operator (i.e. the one that may
- * contain the other operand).
- * @return True if \p left is a subset of \p right.
- */
-template <class NamedExpressionType>
-bool SubsetOfExpressions(
- const std::vector<std::shared_ptr<const NamedExpressionType>> &left,
- const std::vector<std::shared_ptr<const NamedExpressionType>> &right) {
- UnorderedNamedExpressionSet supset(right.begin(), right.end());
- for (const std::shared_ptr<const NamedExpressionType> &expr : left) {
- if (supset.find(expr) == supset.end()) {
- return false;
- }
- }
- return true;
-}
-
-/**
- * @brief Make a copy of the input attribute vector with each attribute's type
- * converted as nullable.
- *
- * @param attributes The input attribute vector.
- * @return The nullable copy of the input attribute vector.
- */
-std::vector<AttributeReferencePtr> GetNullableAttributeVector(
- const std::vector<AttributeReferencePtr> &attributes);
-
-/**
- * @brief Returns a reference to this named expression.
- *
- * @return An AttributeReference of this named expression.
- */
-AttributeReferencePtr ToRef(const NamedExpressionPtr &expression);
-
-/**
- * @brief Given a vector of expressions and a vector of attributes, return a
- * bool vector that indicates whether each expression is refering to
- * ANY attribute in the attribute vector.
- *
- * @param expressions The vector of expressions to be checked.
- * @param attributes The vector of attributes to be checked.
- * @return A vector of bools indicating whether each expression is refering to
- * any attribute in the attribute vector. Note that the length of this
- * bool vector equals the length of \p expressions.
- */
-template <class NamedExpressionType>
-std::vector<bool> MarkExpressionsReferingAnyAttribute(
- const std::vector<std::shared_ptr<const NamedExpressionType>> &expressions,
- const std::vector<AttributeReferencePtr> &attributes) {
- std::vector<bool> matches;
- UnorderedAttributeSet attr_set(attributes.begin(), attributes.end());
- for (std::size_t i = 0; i < expressions.size(); ++i) {
- for (const auto referenced_attr : expressions[i]->getReferencedAttributes()) {
- if (attr_set.find(referenced_attr) != attr_set.end()) {
- matches.emplace_back(true);
- } else {
- matches.emplace_back(false);
- }
- }
- }
- return matches;
-}
-
-/**
- * @brief Filter a vector of AttributeReferencePtr to get those which are in
- * the specified scope.
- *
- * @param attributes The vector of AttributeReferencePtr to be filtered.
- * @param scope The specified reference scope.
- *
- * @return A vector of AttributeReferencePtr within the specified scope.
- */
-std::vector<AttributeReferencePtr> GetAttributeReferencesWithinScope(
- const std::vector<AttributeReferencePtr> &attributes,
- const AttributeReferenceScope scope);
-
-/**
- * @brief Creates a list of AttributeReferences from a list of NamedExpressions
- * with each AttributeReference referencing a distinct NamedExpression.
- * The input and the output have 1:1 matching.
- *
- * @param expressions A list of NamedExpressions to be converted to
- * AttributeReferences.
- * @return AttributeReferences for the NamedExpressions.
- */
-template <class NamedExpressionType>
-std::vector<AttributeReferencePtr> ToRefVector(
- const std::vector<std::shared_ptr<const NamedExpressionType>> &expressions) {
- std::vector<AttributeReferencePtr> cast_expressions;
- for (const std::shared_ptr<const NamedExpressionType> &expression :
- expressions) {
- cast_expressions.push_back(ToRef(expression));
- }
- return cast_expressions;
-}
-
-/**
- * @brief Casts a list of Expressions to a list of NamedExpressions.
- *
- * @param expressions A list of expressions to be cast to NamedExpression. The
- * expressions must be of type NamedExpression.
- * @return A list of casted NamedExpressions.
- */
-template <class ExpressionType>
-std::vector<NamedExpressionPtr> ToNamedExpressions(
- const std::vector<std::shared_ptr<const ExpressionType>> &expressions) {
- std::vector<NamedExpressionPtr> cast_expressions;
- for (const std::shared_ptr<const ExpressionType> &expression : expressions) {
- NamedExpressionPtr cast_expression;
- CHECK(SomeNamedExpression::MatchesWithConditionalCast(expression, &cast_expression))
- << expression->toString();
- cast_expressions.push_back(cast_expression);
- }
- return cast_expressions;
-}
-
-/** @} */
-
-} // namespace expressions
-} // namespace optimizer
-} // namespace quickstep
-
-#endif /* QUICKSTEP_QUERY_OPTIMIZER_EXPRESSIONS_EXPRESSION_UTIL_HPP_ */
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/expressions/InTableQuery.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/InTableQuery.cpp b/query_optimizer/expressions/InTableQuery.cpp
deleted file mode 100644
index 7122664..0000000
--- a/query_optimizer/expressions/InTableQuery.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- **/
-
-#include "query_optimizer/expressions/InTableQuery.hpp"
-
-#include <string>
-#include <vector>
-
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/ExprId.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-namespace optimizer {
-namespace expressions {
-
-::quickstep::Predicate* InTableQuery::concretize(
- const std::unordered_map<ExprId, const CatalogAttribute*> &substitution_map) const {
- LOG(FATAL) << "InTableQuery predicate should not be concretized";
-}
-
-void InTableQuery::getFieldStringItems(
- std::vector<std::string> *inline_field_names,
- std::vector<std::string> *inline_field_values,
- std::vector<std::string> *non_container_child_field_names,
- std::vector<OptimizerTreeBaseNodePtr> *non_container_child_fields,
- std::vector<std::string> *container_child_field_names,
- std::vector<std::vector<OptimizerTreeBaseNodePtr>> *container_child_fields) const {
- non_container_child_field_names->push_back("test_expression");
- non_container_child_fields->push_back(test_expression_);
-
- non_container_child_field_names->push_back("table_query");
- non_container_child_fields->push_back(table_query_);
-}
-
-} // namespace expressions
-} // namespace optimizer
-} // namespace quickstep
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/expressions/InTableQuery.hpp
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/InTableQuery.hpp b/query_optimizer/expressions/InTableQuery.hpp
deleted file mode 100644
index 8e6d0e7..0000000
--- a/query_optimizer/expressions/InTableQuery.hpp
+++ /dev/null
@@ -1,145 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- **/
-
-#ifndef QUICKSTEP_QUERY_OPTIMIZER_EXPRESSIONS_IN_TABLE_QUERY_HPP_
-#define QUICKSTEP_QUERY_OPTIMIZER_EXPRESSIONS_IN_TABLE_QUERY_HPP_
-
-#include <memory>
-#include <string>
-#include <unordered_map>
-#include <vector>
-
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/AttributeReference.hpp"
-#include "query_optimizer/expressions/ExprId.hpp"
-#include "query_optimizer/expressions/Expression.hpp"
-#include "query_optimizer/expressions/ExpressionType.hpp"
-#include "query_optimizer/expressions/Predicate.hpp"
-#include "query_optimizer/expressions/Scalar.hpp"
-#include "query_optimizer/expressions/SubqueryExpression.hpp"
-#include "utility/Macros.hpp"
-
-#include "glog/logging.h"
-
-namespace quickstep {
-
-class CatalogAttribute;
-class Predicate;
-
-namespace optimizer {
-namespace expressions {
-
-/** \addtogroup OptimizerExpressions
- * @{
- */
-
-class InTableQuery;
-typedef std::shared_ptr<const InTableQuery> InTableQueryPtr;
-
-/**
- * @brief IN predicate with a subquery.
- */
-class InTableQuery : public Predicate {
- public:
- ExpressionType getExpressionType() const override {
- return ExpressionType::kInTableQuery;
- }
-
- std::string getName() const override {
- return "InTableQuery";
- }
-
- bool isConstant() const override {
- return false;
- }
-
- /**
- * @return The expression to test with the result of the table subquery.
- */
- const ScalarPtr& test_expression() const {
- return test_expression_;
- }
-
- /**
- * @return The table subquery that returns a single column to search for
- * the value of the test expression.
- */
- const SubqueryExpressionPtr& table_query() const {
- return table_query_;
- }
-
- ExpressionPtr copyWithNewChildren(
- const std::vector<ExpressionPtr> &new_children) const override {
- DCHECK_EQ(2u, new_children.size());
- return Create(std::static_pointer_cast<const Scalar>(new_children[0]),
- std::static_pointer_cast<const SubqueryExpression>(new_children[1]));
- }
-
- std::vector<AttributeReferencePtr> getReferencedAttributes() const override {
- return {};
- }
-
- ::quickstep::Predicate* concretize(
- const std::unordered_map<ExprId, const CatalogAttribute*> &substitution_map) const override;
-
- /**
- * @brief Create an IN predicate with a subquery.
- *
- * @param test_expression The expression to test with the result of a table subquery.
- * @param table_query The table subquery that returns a single column to search for
- * the value of the test expression.
- *
- * @return An immutable IN predicate node.
- */
- static InTableQueryPtr Create(const ScalarPtr &test_expression,
- const SubqueryExpressionPtr &table_query) {
- return InTableQueryPtr(new InTableQuery(test_expression, table_query));
- }
-
- protected:
- void getFieldStringItems(
- std::vector<std::string> *inline_field_names,
- std::vector<std::string> *inline_field_values,
- std::vector<std::string> *non_container_child_field_names,
- std::vector<OptimizerTreeBaseNodePtr> *non_container_child_fields,
- std::vector<std::string> *container_child_field_names,
- std::vector<std::vector<OptimizerTreeBaseNodePtr>> *container_child_fields) const override;
-
- private:
- InTableQuery(const ScalarPtr &test_expression,
- const SubqueryExpressionPtr &table_query)
- : test_expression_(test_expression),
- table_query_(table_query) {
- addChild(test_expression_);
- addChild(table_query_);
- }
-
- ScalarPtr test_expression_;
- SubqueryExpressionPtr table_query_;
-
- DISALLOW_COPY_AND_ASSIGN(InTableQuery);
-};
-
-/** @} */
-
-} // namespace expressions
-} // namespace optimizer
-} // namespace quickstep
-
-#endif // QUICKSTEP_QUERY_OPTIMIZER_EXPRESSIONS_IN_TABLE_QUERY_HPP_
http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/156290a4/query_optimizer/expressions/InValueList.cpp
----------------------------------------------------------------------
diff --git a/query_optimizer/expressions/InValueList.cpp b/query_optimizer/expressions/InValueList.cpp
deleted file mode 100644
index 0451db7..0000000
--- a/query_optimizer/expressions/InValueList.cpp
+++ /dev/null
@@ -1,74 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- **/
-
-#include "query_optimizer/expressions/InValueList.hpp"
-
-#include <string>
-#include <vector>
-
-#include "expressions/predicate/DisjunctionPredicate.hpp"
-#include "expressions/predicate/Predicate.hpp"
-#include "query_optimizer/OptimizerTree.hpp"
-#include "query_optimizer/expressions/ComparisonExpression.hpp"
-#include "query_optimizer/expressions/ExprId.hpp"
-#include "query_optimizer/expressions/Predicate.hpp"
-#include "query_optimizer/expressions/Scalar.hpp"
-#include "types/operations/comparisons/ComparisonID.hpp"
-#include "types/operations/comparisons/ComparisonFactory.hpp"
-#include "utility/Cast.hpp"
-
-namespace quickstep {
-namespace optimizer {
-namespace expressions {
-
-::quickstep::Predicate* InValueList::concretize(
- const std::unordered_map<ExprId, const CatalogAttribute*> &substitution_map) const {
- std::unique_ptr<quickstep::DisjunctionPredicate>
- disjunction_predicate(new quickstep::DisjunctionPredicate());
- for (const ScalarPtr &match_expression : match_expressions_) {
- const PredicatePtr match_predicate =
- ComparisonExpression::Create(
- quickstep::ComparisonFactory::GetComparison(quickstep::ComparisonID::kEqual),
- test_expression_,
- match_expression);
-
- disjunction_predicate->addPredicate(
- match_predicate->concretize(substitution_map));
- }
- return disjunction_predicate.release();
-}
-
-void InValueList::getFieldStringItems(
- std::vector<std::string> *inline_field_names,
- std::vector<std::string> *inline_field_values,
- std::vector<std::string> *non_container_child_field_names,
- std::vector<OptimizerTreeBaseNodePtr> *non_container_child_fields,
- std::vector<std::string> *container_child_field_names,
- std::vector<std::vector<OptimizerTreeBaseNodePtr>> *container_child_fields) const {
- non_container_child_field_names->push_back("test_expression");
- non_container_child_fields->push_back(test_expression_);
-
- container_child_field_names->push_back("match_expressions");
- container_child_fields->push_back(
- CastSharedPtrVector<OptimizerTreeBase>(match_expressions_));
-}
-
-} // namespace expressions
-} // namespace optimizer
-} // namespace quickstep