MiniOB 1
MiniOB is one mini database, helping developers to learn how database works.
载入中...
搜索中...
未找到
project_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/08.
13//
14
15#pragma once
16
17#include <vector>
18#include <memory>
19
20#include "sql/operator/logical_operator.h"
21#include "sql/expr/expression.h"
22#include "storage/field/field.h"
23
30{
31public:
32 ProjectLogicalOperator(const std::vector<Field> &fields);
33 virtual ~ProjectLogicalOperator() = default;
34
35 LogicalOperatorType type() const override
36 {
37 return LogicalOperatorType::PROJECTION;
38 }
39
40 std::vector<std::unique_ptr<Expression>> &expressions()
41 {
42 return expressions_;
43 }
44 const std::vector<std::unique_ptr<Expression>> &expressions() const
45 {
46 return expressions_;
47 }
48 const std::vector<Field> &fields() const
49 {
50 return fields_;
51 }
52
53private:
58 std::vector<Field> fields_;
59};
逻辑算子描述当前执行计划要做什么
Definition: logical_operator.h:50
project 表示投影运算
Definition: project_logical_operator.h:30
std::vector< Field > fields_
投影映射的字段名称 并不是所有的select都会查看表字段,也可能是常量数字、字符串, 或者是执行某个函数。所以这里应该是表达式Expression。 不过现在简单处理,就使用字段来描述
Definition: project_logical_operator.h:58