MiniOB 1
MiniOB is one mini database, helping developers to learn how database works.
载入中...
搜索中...
未找到
index_scan_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/07/08.
13//
14
15#pragma once
16
17#include "sql/expr/tuple.h"
18#include "sql/operator/physical_operator.h"
19#include "storage/record/record_manager.h"
20
26{
27public:
28 IndexScanPhysicalOperator(Table *table, Index *index, ReadWriteMode mode, const Value *left_value,
29 bool left_inclusive, const Value *right_value, bool right_inclusive);
30
31 virtual ~IndexScanPhysicalOperator() = default;
32
33 PhysicalOperatorType type() const override { return PhysicalOperatorType::INDEX_SCAN; }
34
35 string param() const override;
36
37 RC open(Trx *trx) override;
38 RC next() override;
39 RC close() override;
40
41 Tuple *current_tuple() override;
42
43 void set_predicates(vector<unique_ptr<Expression>> &&exprs);
44
45private:
46 // 与TableScanPhysicalOperator代码相同,可以优化
47 RC filter(RowTuple &tuple, bool &result);
48
49private:
50 Trx *trx_ = nullptr;
51 Table *table_ = nullptr;
52 Index *index_ = nullptr;
53 ReadWriteMode mode_ = ReadWriteMode::READ_WRITE;
54 IndexScanner *index_scanner_ = nullptr;
55
56 Record current_record_;
57 RowTuple tuple_;
58
59 Value left_value_;
60 Value right_value_;
61 bool left_inclusive_ = false;
62 bool right_inclusive_ = false;
63
64 vector<unique_ptr<Expression>> predicates_;
65};
索引扫描物理算子
Definition: index_scan_physical_operator.h:26
索引扫描器
Definition: index.h:104
索引基类
Definition: index.h:38
与LogicalOperator对应,物理算子描述执行计划将如何执行
Definition: physical_operator.h:63
表示一个记录
Definition: record.h:101
一行数据的元组
Definition: tuple.h:159
Definition: table.h:42
事务接口
Definition: trx.h:141
元组的抽象描述
Definition: tuple.h:66
属性的值
Definition: value.h:30
PhysicalOperatorType
物理算子类型
Definition: physical_operator.h:36