MiniOB
1
MiniOB is one mini database, helping developers to learn how database works.
载入中...
搜索中...
未找到
src
observer
sql
operator
index_scan_physical_operator.h
1
/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
2
miniob is licensed under Mulan PSL v2.
3
You can use this software according to the terms and conditions of the Mulan PSL v2.
4
You may obtain a copy of Mulan PSL v2 at:
5
http://license.coscl.org.cn/MulanPSL2
6
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
7
EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
8
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
9
See 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/operator/physical_operator.h"
18
#include "sql/expr/tuple.h"
19
#include "storage/record/record_manager.h"
20
25
class
IndexScanPhysicalOperator
:
public
PhysicalOperator
26
{
27
public
:
28
IndexScanPhysicalOperator
(
Table
*table,
Index
*index,
bool
readonly,
29
const
Value
*left_value,
bool
left_inclusive,
30
const
Value
*right_value,
bool
right_inclusive);
31
32
virtual
~IndexScanPhysicalOperator
() =
default
;
33
34
PhysicalOperatorType
type()
const override
35
{
36
return
PhysicalOperatorType::INDEX_SCAN;
37
}
38
39
std::string param()
const override
;
40
41
RC open(
Trx
*trx)
override
;
42
RC next()
override
;
43
RC close()
override
;
44
45
Tuple
*current_tuple()
override
;
46
47
void
set_predicates(std::vector<std::unique_ptr<Expression>> &&exprs);
48
49
private
:
50
// 与TableScanPhysicalOperator代码相同,可以优化
51
RC filter(
RowTuple
&tuple,
bool
&result);
52
53
private
:
54
Trx
* trx_ =
nullptr
;
55
Table
*table_ =
nullptr
;
56
Index
*index_ =
nullptr
;
57
bool
readonly_ =
false
;
58
IndexScanner
*index_scanner_ =
nullptr
;
59
RecordFileHandler
*record_handler_ =
nullptr
;
60
61
RecordPageHandler
record_page_handler_;
62
Record
current_record_;
63
RowTuple
tuple_;
64
65
Value
left_value_;
66
Value
right_value_;
67
bool
left_inclusive_ =
false
;
68
bool
right_inclusive_ =
false
;
69
70
std::vector<std::unique_ptr<Expression>> predicates_;
71
};
IndexScanPhysicalOperator
索引扫描物理算子
Definition:
index_scan_physical_operator.h:26
IndexScanner
索引扫描器
Definition:
index.h:96
Index
索引基类
Definition:
index.h:38
PhysicalOperator
与LogicalOperator对应,物理算子描述执行计划将如何执行
Definition:
physical_operator.h:57
RecordFileHandler
管理整个文件中记录的增删改查
Definition:
record_manager.h:245
RecordPageHandler
负责处理一个页面中各种操作,比如插入记录、删除记录或者查找记录
Definition:
record_manager.h:125
Record
表示一个记录 当前的记录都是连续存放的空间(内存或磁盘上)。 为了提高访问的效率,record通常直接记录指向页面上的内存,但是需要保证访问这种数据时,拿着锁资源。 为了方便,也提供了复制内存的方法。可...
Definition:
record.h:92
RowTuple
一行数据的元组
Definition:
tuple.h:137
Table
表
Definition:
table.h:37
Trx
事务接口
Definition:
trx.h:142
Tuple
元组的抽象描述
Definition:
tuple.h:84
Value
属性的值
Definition:
value.h:40
PhysicalOperatorType
PhysicalOperatorType
物理算子类型
Definition:
physical_operator.h:39
制作者
1.9.5