MiniOB 1
MiniOB is one mini database, helping developers to learn how database works.
载入中...
搜索中...
未找到
physical_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/6/7.
13//
14
15#pragma once
16
17#include "common/sys/rc.h"
18#include "sql/expr/tuple.h"
19#include "sql/operator/operator_node.h"
20
21class Record;
22class TupleCellSpec;
23class Trx;
24
36{
37 TABLE_SCAN,
38 TABLE_SCAN_VEC,
39 INDEX_SCAN,
40 NESTED_LOOP_JOIN,
41 HASH_JOIN,
42 EXPLAIN,
43 PREDICATE,
44 PREDICATE_VEC,
45 PROJECT,
46 PROJECT_VEC,
47 CALC,
48 STRING_LIST,
49 DELETE,
50 INSERT,
51 SCALAR_GROUP_BY,
52 HASH_GROUP_BY,
53 GROUP_BY_VEC,
54 AGGREGATE_VEC,
55 EXPR_VEC,
56};
57
63{
64public:
65 PhysicalOperator() = default;
66
67 virtual ~PhysicalOperator() = default;
68
72 virtual string name() const;
73 virtual string param() const;
74
75 bool is_physical() const override { return true; }
76 bool is_logical() const override { return false; }
77
78 virtual PhysicalOperatorType type() const = 0;
79
80 virtual RC open(Trx *trx) = 0;
81 virtual RC next() { return RC::UNIMPLEMENTED; }
82 virtual RC next(Chunk &chunk) { return RC::UNIMPLEMENTED; }
83 virtual RC close() = 0;
84
85 virtual Tuple *current_tuple() { return nullptr; }
86
87 virtual RC tuple_schema(TupleSchema &schema) const { return RC::UNIMPLEMENTED; }
88
89 void add_child(unique_ptr<PhysicalOperator> oper) { children_.emplace_back(std::move(oper)); }
90
91 vector<unique_ptr<PhysicalOperator>> &children() { return children_; }
92
93protected:
94 vector<unique_ptr<PhysicalOperator>> children_;
95};
A Chunk represents a set of columns.
Definition: chunk.h:23
Definition: operator_node.h:69
与LogicalOperator对应,物理算子描述执行计划将如何执行
Definition: physical_operator.h:63
bool is_physical() const override
Definition: physical_operator.h:75
bool is_logical() const override
Definition: physical_operator.h:76
virtual string name() const
Definition: physical_operator.cpp:41
表示一个记录
Definition: record.h:101
事务接口
Definition: trx.h:141
Definition: tuple_cell.h:20
元组的结构,包含哪些字段(这里成为Cell),每个字段的说明
Definition: tuple.h:48
元组的抽象描述
Definition: tuple.h:66
PhysicalOperatorType
物理算子类型
Definition: physical_operator.h:36