MiniOB 1
MiniOB is one mini database, helping developers to learn how database works.
载入中...
搜索中...
未找到
table_get_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#pragma once
15
16#include "sql/operator/logical_operator.h"
17#include "storage/field/field.h"
18#include "common/types.h"
19
26{
27public:
28 TableGetLogicalOperator(Table *table, ReadWriteMode mode);
29 virtual ~TableGetLogicalOperator() = default;
30
31 LogicalOperatorType type() const override { return LogicalOperatorType::TABLE_GET; }
32
33 OpType get_op_type() const override { return OpType::LOGICALGET; }
34
35 virtual uint64_t hash() const override { return 0; }
36
37 virtual bool operator==(const OperatorNode &other) const override { return false; }
38
39 unique_ptr<LogicalProperty> find_log_prop(const vector<LogicalProperty *> &log_props) override;
40
41 Table *table() const { return table_; }
42 ReadWriteMode read_write_mode() const { return mode_; }
43
44 void set_predicates(vector<unique_ptr<Expression>> &&exprs);
45 auto predicates() -> vector<unique_ptr<Expression>> & { return predicates_; }
46
47private:
48 Table *table_ = nullptr;
49 ReadWriteMode mode_ = ReadWriteMode::READ_WRITE;
50
51 // 与当前表相关的过滤操作,可以尝试在遍历数据时执行
52 // 这里的表达式都是比较简单的比较运算,并且左右两边都是取字段表达式或值表达式
53 // 不包含复杂的表达式运算,比如加减乘除、或者conjunction expression
54 // 如果有多个表达式,他们的关系都是 AND
55 vector<unique_ptr<Expression>> predicates_;
56};
逻辑算子描述当前执行计划要做什么
Definition: logical_operator.h:50
Definition: operator_node.h:69
表示从表中获取数据的算子
Definition: table_get_logical_operator.h:26
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: table_get_logical_operator.cpp:28
virtual uint64_t hash() const override
Definition: table_get_logical_operator.h:35
OpType get_op_type() const override
Definition: table_get_logical_operator.h:33
Definition: table.h:42