MiniOB 1
MiniOB is one mini database, helping developers to learn how database works.
载入中...
搜索中...
未找到
logical_operator.h
1/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
2miniob is licensed under Mulan PSL v2.
3You can use this software according to the terms and conditions of the Mulan PSL v2.
4You may obtain a copy of Mulan PSL v2 at:
5 http://license.coscl.org.cn/MulanPSL2
6THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
7EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
8MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
9See the Mulan PSL v2 for more details. */
10
11//
12// Created by Wangyunlai on 2022/12/07.
13//
14
15#pragma once
16
17#include "sql/expr/expression.h"
18#include "sql/operator/operator_node.h"
19#include "common/lang/unordered_set.h"
20
32enum class LogicalOperatorType
33{
34 CALC,
35 TABLE_GET,
36 PREDICATE,
37 PROJECTION,
38 JOIN,
39 INSERT,
40 DELETE,
41 EXPLAIN,
42 GROUP_BY,
43};
44
50{
51public:
52 LogicalOperator() = default;
53 virtual ~LogicalOperator();
54
55 virtual LogicalOperatorType type() const = 0;
56
57 bool is_physical() const override { return false; }
58 bool is_logical() const override { return true; }
59
60 void add_child(unique_ptr<LogicalOperator> oper);
61 void add_expressions(unique_ptr<Expression> expr);
62 auto children() -> vector<unique_ptr<LogicalOperator>> &{ return children_; }
63 auto expressions() -> vector<unique_ptr<Expression>> &{ return expressions_; }
64 static bool can_generate_vectorized_operator(const LogicalOperatorType &type);
65 // TODO: used by cascade optimizer, tmp function, need to be remove
66 void generate_general_child();
67
68protected:
69 vector<unique_ptr<LogicalOperator>> children_;
70
73 vector<unique_ptr<Expression>> expressions_;
74};
逻辑算子描述当前执行计划要做什么
Definition: logical_operator.h:50
vector< unique_ptr< LogicalOperator > > children_
子算子
Definition: logical_operator.h:69
bool is_physical() const override
Definition: logical_operator.h:57
bool is_logical() const override
Definition: logical_operator.h:58
Definition: operator_node.h:69