MiniOB 1
MiniOB is one mini database, helping developers to learn how database works.
载入中...
搜索中...
未找到
join_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 2021/6/10.
13//
14
15#pragma once
16
17#include "sql/parser/parse.h"
18#include "sql/operator/physical_operator.h"
19
26{
27public:
29 virtual ~NestedLoopJoinPhysicalOperator() = default;
30
31 PhysicalOperatorType type() const override
32 {
33 return PhysicalOperatorType::NESTED_LOOP_JOIN;
34 }
35
36 RC open(Trx *trx) override;
37 RC next() override;
38 RC close() override;
39 Tuple *current_tuple() override;
40
41private:
42 RC left_next();
43 RC right_next();
44
45private:
46 Trx *trx_ = nullptr;
47
50 PhysicalOperator *right_ = nullptr;
51 Tuple *left_tuple_ = nullptr;
52 Tuple *right_tuple_ = nullptr;
53 JoinedTuple joined_tuple_;
54 bool round_done_ = true;
55 bool right_closed_ = true;
56};
将两个tuple合并为一个tuple
Definition: tuple.h:380
最简单的两表(称为左表、右表)join算子
Definition: join_physical_operator.h:26
PhysicalOperator * left_
左表右表的真实对象是在PhysicalOperator::children_中,这里是为了写的时候更简单
Definition: join_physical_operator.h:49
bool right_closed_
右表遍历的一轮是否结束
Definition: join_physical_operator.h:55
RC right_next()
左表遍历下一条数据
Definition: join_physical_operator.cpp:104
Trx * trx_
右表遍历下一条数据,如果上一轮结束了就重新开始新的一轮
Definition: join_physical_operator.h:46
bool round_done_
当前关联的左右两个tuple
Definition: join_physical_operator.h:54
与LogicalOperator对应,物理算子描述执行计划将如何执行
Definition: physical_operator.h:57
事务接口
Definition: trx.h:142
元组的抽象描述
Definition: tuple.h:84
PhysicalOperatorType
物理算子类型
Definition: physical_operator.h:39