17#include "sql/operator/logical_operator.h"
30 LogicalOperatorType type()
const override {
return LogicalOperatorType::JOIN; }
32 OpType
get_op_type()
const override {
return OpType::LOGICALINNERJOIN; }
34 unique_ptr<LogicalProperty>
find_log_prop(
const vector<LogicalProperty *> &log_props)
override
36 if (log_props.size() != 2) {
42 int card = left_log_prop->get_card() * right_log_prop->get_card();
43 for (
auto &predicate : join_predicates_) {
44 if (predicate->type() != ExprType::COMPARISON) {
48 auto &left = pred_expr->left();
49 auto &right = pred_expr->right();
50 if (pred_expr->comp() == CompOp::EQUAL_TO && left->type() == ExprType::FIELD &&
51 right->type() == ExprType::FIELD) {
52 card /= std::max(std::max(left_log_prop->get_card(), right_log_prop->get_card()), 1);
55 return make_unique<LogicalProperty>(card);
59 std::vector<unique_ptr<Expression>> join_predicates_;
比较表达式
Definition: expression.h:294
连接算子
Definition: join_logical_operator.h:25
OpType get_op_type() const override
Definition: join_logical_operator.h:32
unique_ptr< LogicalProperty > find_log_prop(const vector< LogicalProperty * > &log_props) override
Generate the logical property of the operator node using the input logical properties.
Definition: join_logical_operator.h:34
逻辑算子描述当前执行计划要做什么
Definition: logical_operator.h:50
Logical Property, such as the cardinality of logical operator
Definition: property.h:20