blob: 39d5e316de3d0ce0419bca676b9a364e9bbd5c34 [file] [log] [blame]
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
**/
#ifndef QUICKSTEP_QUERY_OPTIMIZER_PHYSICAL_BINARY_JOIN_HPP_
#define QUICKSTEP_QUERY_OPTIMIZER_PHYSICAL_BINARY_JOIN_HPP_
#include <memory>
#include <string>
#include <vector>
#include "query_optimizer/OptimizerTree.hpp"
#include "query_optimizer/expressions/NamedExpression.hpp"
#include "query_optimizer/physical/Join.hpp"
#include "query_optimizer/physical/Physical.hpp"
#include "utility/Macros.hpp"
namespace quickstep {
namespace optimizer {
namespace physical {
/** \addtogroup OptimizerPhysical
* @{
*/
class BinaryJoin;
typedef std::shared_ptr<const BinaryJoin> BinaryJoinPtr;
struct PartitionSchemeHeader;
/**
* @brief Base class for binary join nodes.
*/
class BinaryJoin : public Join {
public:
/**
* @brief Destructor.
*/
~BinaryJoin() override {}
/**
* @return The left operand.
*/
const PhysicalPtr& left() const { return left_; }
/**
* @return The right operand.
*/
const PhysicalPtr& right() const { return right_; }
protected:
/**
* @brief Constructor.
*
* @param left The left operand.
* @param right The right operand.
* @param project_expressions The project expressions.
* @param has_repartition Whether this node has repartition.
* @param partition_scheme_header The optional output partition scheme header.
*/
BinaryJoin(const PhysicalPtr &left,
const PhysicalPtr &right,
const std::vector<expressions::NamedExpressionPtr> &project_expressions,
const bool has_repartition = false,
PartitionSchemeHeader *partition_scheme_header = nullptr)
: Join(project_expressions, has_repartition, partition_scheme_header),
left_(left),
right_(right) {
addChild(left_);
addChild(right_);
}
void getFieldStringItems(
std::vector<std::string> *inline_field_names,
std::vector<std::string> *inline_field_values,
std::vector<std::string> *non_container_child_field_names,
std::vector<OptimizerTreeBaseNodePtr> *non_container_child_fields,
std::vector<std::string> *container_child_field_names,
std::vector<std::vector<OptimizerTreeBaseNodePtr>> *container_child_fields) const override;
private:
PhysicalPtr left_;
PhysicalPtr right_;
DISALLOW_COPY_AND_ASSIGN(BinaryJoin);
};
/** @} */
} // namespace physical
} // namespace optimizer
} // namespace quickstep
#endif /* QUICKSTEP_QUERY_OPTIMIZER_PHYSICAL_BINARY_JOIN_HPP_ */