MiniOB 1
MiniOB is one mini database, helping developers to learn how database works.
载入中...
搜索中...
未找到
explain_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/12/27.
13//
14
15#pragma once
16
17#include "sql/operator/physical_operator.h"
18
24{
25public:
26 ExplainPhysicalOperator() = default;
27 virtual ~ExplainPhysicalOperator() = default;
28
29 PhysicalOperatorType type() const override { return PhysicalOperatorType::EXPLAIN; }
30
31 OpType get_op_type() const override { return OpType::EXPLAIN; }
32
33 double calculate_cost(LogicalProperty *prop, const vector<LogicalProperty *> &child_log_props, CostModel *cm) override
34 {
35 return 0.0;
36 }
37
38 RC open(Trx *trx) override;
39 RC next() override;
40 RC next(Chunk &chunk) override;
41 RC close() override;
42 Tuple *current_tuple() override;
43
44 RC tuple_schema(TupleSchema &schema) const override
45 {
46 schema.append_cell("Query Plan");
47 return RC::SUCCESS;
48 }
49
50private:
51 void generate_physical_plan();
52
53private:
54 string physical_plan_;
55 ValueListTuple tuple_;
56};
A Chunk represents a set of columns.
Definition: chunk.h:23
cost model in cost-based optimization(CBO)
Definition: cost_model.h:19
Explain物理算子
Definition: explain_physical_operator.h:24
OpType get_op_type() const override
Definition: explain_physical_operator.h:31
double calculate_cost(LogicalProperty *prop, const vector< LogicalProperty * > &child_log_props, CostModel *cm) override
Calculates the cost of a logical operation.
Definition: explain_physical_operator.h:33
Logical Property, such as the cardinality of logical operator
Definition: property.h:20
与LogicalOperator对应,物理算子描述执行计划将如何执行
Definition: physical_operator.h:63
事务接口
Definition: trx.h:141
元组的结构,包含哪些字段(这里成为Cell),每个字段的说明
Definition: tuple.h:48
元组的抽象描述
Definition: tuple.h:66
一些常量值组成的TupleTODO 使用单独文件
Definition: tuple.h:312
PhysicalOperatorType
物理算子类型
Definition: physical_operator.h:36