Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
oceanbase
miniob
提交
d9972831
M
miniob
项目概览
oceanbase
/
miniob
1 年多 前同步成功
通知
74
Star
1521
Fork
537
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
分析
仓库
DevOps
项目成员
Pages
M
miniob
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Pages
分析
分析
仓库分析
DevOps
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
提交
提交
d9972831
编写于
7月 03, 2022
作者:
羽飞
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
move operators to operator directory
上级
5f4ea56d
变更
24
隐藏空白更改
内联
并排
Showing
24 changed file
with
16 addition
and
568 deletion
+16
-568
src/observer/sql/executor/execute_stage.cpp
src/observer/sql/executor/execute_stage.cpp
+4
-4
src/observer/sql/executor/execution_node.cpp.bak
src/observer/sql/executor/execution_node.cpp.bak
+0
-54
src/observer/sql/executor/execution_node.h
src/observer/sql/executor/execution_node.h
+0
-50
src/observer/sql/executor/predicate.cpp
src/observer/sql/executor/predicate.cpp
+0
-17
src/observer/sql/executor/predicate.h
src/observer/sql/executor/predicate.h
+0
-27
src/observer/sql/executor/tuple.cpp.bak
src/observer/sql/executor/tuple.cpp.bak
+0
-265
src/observer/sql/executor/tuple.h
src/observer/sql/executor/tuple.h
+0
-1
src/observer/sql/executor/value.cpp
src/observer/sql/executor/value.cpp
+0
-9
src/observer/sql/executor/value.h
src/observer/sql/executor/value.h
+0
-103
src/observer/sql/operator/delete_operator.cpp
src/observer/sql/operator/delete_operator.cpp
+1
-1
src/observer/sql/operator/delete_operator.h
src/observer/sql/operator/delete_operator.h
+1
-1
src/observer/sql/operator/insert_operator.cpp
src/observer/sql/operator/insert_operator.cpp
+1
-1
src/observer/sql/operator/insert_operator.h
src/observer/sql/operator/insert_operator.h
+1
-2
src/observer/sql/operator/join_operator.cpp.bak
src/observer/sql/operator/join_operator.cpp.bak
+1
-1
src/observer/sql/operator/join_operator.h
src/observer/sql/operator/join_operator.h
+1
-1
src/observer/sql/operator/operator.h
src/observer/sql/operator/operator.h
+0
-0
src/observer/sql/operator/predicate_operator.cpp
src/observer/sql/operator/predicate_operator.cpp
+1
-1
src/observer/sql/operator/predicate_operator.h
src/observer/sql/operator/predicate_operator.h
+1
-1
src/observer/sql/operator/project_operator.cpp
src/observer/sql/operator/project_operator.cpp
+1
-1
src/observer/sql/operator/project_operator.h
src/observer/sql/operator/project_operator.h
+1
-1
src/observer/sql/operator/table_scan_operator.cpp
src/observer/sql/operator/table_scan_operator.cpp
+1
-2
src/observer/sql/operator/table_scan_operator.h
src/observer/sql/operator/table_scan_operator.h
+1
-3
src/observer/storage/common/record.cpp
src/observer/storage/common/record.cpp
+0
-12
src/observer/storage/common/record.h
src/observer/storage/common/record.h
+0
-10
未找到文件。
src/observer/sql/executor/execute_stage.cpp
浏览文件 @
d9972831
...
...
@@ -26,10 +26,10 @@ See the Mulan PSL v2 for more details. */
#include "event/sql_event.h"
#include "event/session_event.h"
#include "sql/executor/tuple.h"
#include "sql/
execu
tor/table_scan_operator.h"
#include "sql/
execu
tor/predicate_operator.h"
#include "sql/
execu
tor/delete_operator.h"
#include "sql/
execu
tor/project_operator.h"
#include "sql/
opera
tor/table_scan_operator.h"
#include "sql/
opera
tor/predicate_operator.h"
#include "sql/
opera
tor/delete_operator.h"
#include "sql/
opera
tor/project_operator.h"
#include "sql/stmt/stmt.h"
#include "sql/stmt/select_stmt.h"
#include "sql/stmt/update_stmt.h"
...
...
src/observer/sql/executor/execution_node.cpp.bak
已删除
100644 → 0
浏览文件 @
5f4ea56d
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details. */
//
// Created by Meiyi & Wangyunlai on 2021/5/14.
//
#include "sql/executor/execution_node.h"
#include "storage/common/table.h"
#include "common/log/log.h"
SelectExeNode::SelectExeNode() : table_(nullptr)
{}
SelectExeNode::~SelectExeNode()
{
for (DefaultConditionFilter *&filter : condition_filters_) {
delete filter;
}
condition_filters_.clear();
}
RC SelectExeNode::init(
Trx *trx, Table *table, TupleSchema &&tuple_schema, std::vector<DefaultConditionFilter *> &&condition_filters)
{
trx_ = trx;
table_ = table;
tuple_schema_ = tuple_schema;
condition_filters_ = std::move(condition_filters);
return RC::SUCCESS;
}
void record_reader(const char *data, void *context)
{
TupleRecordConverter *converter = (TupleRecordConverter *)context;
converter->add_record(data);
}
RC SelectExeNode::execute(TupleSet &tuple_set)
{
CompositeConditionFilter condition_filter;
condition_filter.init((const ConditionFilter **)condition_filters_.data(), condition_filters_.size());
tuple_set.clear();
tuple_set.set_schema(tuple_schema_);
TupleRecordConverter converter(table_, tuple_set);
return table_->scan_record(trx_, &condition_filter, -1, (void *)&converter, record_reader);
}
\ No newline at end of file
src/observer/sql/executor/execution_node.h
已删除
100644 → 0
浏览文件 @
5f4ea56d
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details. */
//
// Created by Meiyi & Wangyunlai on 2021/5/13.
//
#ifndef __OBSERVER_SQL_EXECUTOR_EXECUTION_NODE_H_
#define __OBSERVER_SQL_EXECUTOR_EXECUTION_NODE_H_
#include <vector>
#include "storage/common/condition_filter.h"
#include "sql/executor/tuple.h"
class
Table
;
class
Trx
;
class
ExecutionNode
{
public:
ExecutionNode
()
=
default
;
virtual
~
ExecutionNode
()
=
default
;
virtual
RC
execute
(
TupleSet
&
tuple_set
)
=
0
;
};
class
SelectExeNode
:
public
ExecutionNode
{
public:
SelectExeNode
();
virtual
~
SelectExeNode
();
RC
init
(
Trx
*
trx
,
Table
*
table
,
TupleSchema
&&
tuple_schema
,
std
::
vector
<
DefaultConditionFilter
*>
&&
condition_filters
);
RC
execute
(
TupleSet
&
tuple_set
)
override
;
private:
Trx
*
trx_
=
nullptr
;
Table
*
table_
;
TupleSchema
tuple_schema_
;
std
::
vector
<
DefaultConditionFilter
*>
condition_filters_
;
};
#endif //__OBSERVER_SQL_EXECUTOR_EXECUTION_NODE_H_
src/observer/sql/executor/predicate.cpp
已删除
100644 → 0
浏览文件 @
5f4ea56d
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details. */
//
// Created by WangYunlai on 2021/6/9.
//
#include "sql/executor/predicate.h"
src/observer/sql/executor/predicate.h
已删除
100644 → 0
浏览文件 @
5f4ea56d
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details. */
//
// Created by WangYunlai on 2021/6/10.
//
#pragma once
class
Predicate
{
public:
Predicate
()
{}
virtual
~
Predicate
()
=
default
;
private:
};
src/observer/sql/executor/tuple.cpp.bak
已删除
100644 → 0
浏览文件 @
5f4ea56d
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details. */
//
// Created by Meiyi & Wangyunlai on 2021/5/14.
//
#include "sql/executor/tuple.h"
#include "storage/common/table.h"
#include "common/log/log.h"
Tuple::Tuple(const Tuple &other)
{
LOG_PANIC("Copy constructor of tuple is not supported");
exit(1);
}
Tuple::Tuple(Tuple &&other) noexcept : values_(std::move(other.values_))
{}
Tuple &Tuple::operator=(Tuple &&other) noexcept
{
if (&other == this) {
return *this;
}
values_.clear();
values_.swap(other.values_);
return *this;
}
Tuple::~Tuple()
{}
// add (Value && value)
void Tuple::add(TupleValue *value)
{
values_.emplace_back(value);
}
void Tuple::add(const std::shared_ptr<TupleValue> &other)
{
values_.emplace_back(other);
}
void Tuple::add(int value)
{
add(new IntValue(value));
}
void Tuple::add(float value)
{
add(new FloatValue(value));
}
void Tuple::add(const char *s, int len)
{
add(new StringValue(s, len));
}
////////////////////////////////////////////////////////////////////////////////
std::string TupleField::to_string() const
{
return std::string(table_name_) + "." + field_name_ + std::to_string(type_);
}
////////////////////////////////////////////////////////////////////////////////
void TupleSchema::from_table(const Table *table, TupleSchema &schema)
{
const char *table_name = table->name();
const TableMeta &table_meta = table->table_meta();
const int field_num = table_meta.field_num();
for (int i = 0; i < field_num; i++) {
const FieldMeta *field_meta = table_meta.field(i);
if (field_meta->visible()) {
schema.add(field_meta->type(), table_name, field_meta->name());
}
}
}
void TupleSchema::add(AttrType type, const char *table_name, const char *field_name)
{
fields_.emplace_back(type, table_name, field_name);
}
void TupleSchema::add_if_not_exists(AttrType type, const char *table_name, const char *field_name)
{
for (const auto &field : fields_) {
if (0 == strcmp(field.table_name(), table_name) && 0 == strcmp(field.field_name(), field_name)) {
return;
}
}
add(type, table_name, field_name);
}
void TupleSchema::append(const TupleSchema &other)
{
fields_.reserve(fields_.size() + other.fields_.size());
for (const auto &field : other.fields_) {
fields_.emplace_back(field);
}
}
int TupleSchema::index_of_field(const char *table_name, const char *field_name) const
{
const int size = fields_.size();
for (int i = 0; i < size; i++) {
const TupleField &field = fields_[i];
if (0 == strcmp(field.table_name(), table_name) && 0 == strcmp(field.field_name(), field_name)) {
return i;
}
}
return -1;
}
void TupleSchema::print(std::ostream &os) const
{
if (fields_.empty()) {
os << "No schema";
return;
}
// 判断有多张表还是只有一张表
std::set<std::string> table_names;
for (const auto &field : fields_) {
table_names.insert(field.table_name());
}
for (std::vector<TupleField>::const_iterator iter = fields_.begin(), end = --fields_.end(); iter != end; ++iter) {
if (table_names.size() > 1) {
os << iter->table_name() << ".";
}
os << iter->field_name() << " | ";
}
if (table_names.size() > 1) {
os << fields_.back().table_name() << ".";
}
os << fields_.back().field_name() << std::endl;
}
/////////////////////////////////////////////////////////////////////////////
TupleSet::TupleSet(TupleSet &&other) : tuples_(std::move(other.tuples_)), schema_(other.schema_)
{
other.schema_.clear();
}
TupleSet &TupleSet::operator=(TupleSet &&other)
{
if (this == &other) {
return *this;
}
schema_.clear();
schema_.append(other.schema_);
other.schema_.clear();
tuples_.clear();
tuples_.swap(other.tuples_);
return *this;
}
void TupleSet::add(Tuple &&tuple)
{
tuples_.emplace_back(std::move(tuple));
}
void TupleSet::clear()
{
tuples_.clear();
schema_.clear();
}
void TupleSet::print(std::ostream &os) const
{
if (schema_.fields().empty()) {
LOG_WARN("Got empty schema");
return;
}
schema_.print(os);
for (const Tuple &item : tuples_) {
const std::vector<std::shared_ptr<TupleValue>> &values = item.values();
for (std::vector<std::shared_ptr<TupleValue>>::const_iterator iter = values.begin(), end = --values.end();
iter != end;
++iter) {
(*iter)->to_string(os);
os << " | ";
}
values.back()->to_string(os);
os << std::endl;
}
}
void TupleSet::set_schema(const TupleSchema &schema)
{
schema_ = schema;
}
const TupleSchema &TupleSet::get_schema() const
{
return schema_;
}
bool TupleSet::is_empty() const
{
return tuples_.empty();
}
int TupleSet::size() const
{
return tuples_.size();
}
const Tuple &TupleSet::get(int index) const
{
return tuples_[index];
}
const std::vector<Tuple> &TupleSet::tuples() const
{
return tuples_;
}
/////////////////////////////////////////////////////////////////////////////
TupleRecordConverter::TupleRecordConverter(Table *table, TupleSet &tuple_set) : table_(table), tuple_set_(tuple_set)
{}
void TupleRecordConverter::add_record(const char *record)
{
const TupleSchema &schema = tuple_set_.schema();
Tuple tuple;
const TableMeta &table_meta = table_->table_meta();
for (const TupleField &field : schema.fields()) {
const FieldMeta *field_meta = table_meta.field(field.field_name());
assert(field_meta != nullptr);
switch (field_meta->type()) {
case INTS: {
int value = *(int *)(record + field_meta->offset());
tuple.add(value);
} break;
case FLOATS: {
float value = *(float *)(record + field_meta->offset());
tuple.add(value);
} break;
case CHARS: {
const char *s = record + field_meta->offset(); // 现在当做Cstring来处理
tuple.add(s, strlen(s));
} break;
default: {
LOG_PANIC("Unsupported field type. type=%d", field_meta->type());
}
}
}
tuple_set_.add(std::move(tuple));
}
src/observer/sql/executor/tuple.h
浏览文件 @
d9972831
...
...
@@ -19,7 +19,6 @@ See the Mulan PSL v2 for more details. */
#include "common/log/log.h"
#include "sql/parser/parse.h"
#include "sql/executor/value.h"
#include "storage/common/field.h"
#include "storage/common/record.h"
...
...
src/observer/sql/executor/value.cpp
已删除
100644 → 0
浏览文件 @
5f4ea56d
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details. */
src/observer/sql/executor/value.h
已删除
100644 → 0
浏览文件 @
5f4ea56d
/* Copyright (c) 2021 Xie Meiyi(xiemeiyi@hust.edu.cn) and OceanBase and/or its affiliates. All rights reserved.
miniob is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details. */
//
// Created by Meiyi & Wangyunlai on 2021/5/14.
//
#ifndef __OBSERVER_SQL_EXECUTOR_VALUE_H_
#define __OBSERVER_SQL_EXECUTOR_VALUE_H_
#include <string.h>
#include <string>
#include <ostream>
class
TupleValue
{
public:
TupleValue
()
=
default
;
virtual
~
TupleValue
()
=
default
;
virtual
void
to_string
(
std
::
ostream
&
os
)
const
=
0
;
virtual
int
compare
(
const
TupleValue
&
other
)
const
=
0
;
private:
};
class
IntValue
:
public
TupleValue
{
public:
explicit
IntValue
(
int
value
)
:
value_
(
value
)
{}
void
to_string
(
std
::
ostream
&
os
)
const
override
{
os
<<
value_
;
}
int
compare
(
const
TupleValue
&
other
)
const
override
{
const
IntValue
&
int_other
=
(
const
IntValue
&
)
other
;
return
value_
-
int_other
.
value_
;
}
private:
int
value_
;
};
class
FloatValue
:
public
TupleValue
{
public:
explicit
FloatValue
(
float
value
)
:
value_
(
value
)
{}
void
to_string
(
std
::
ostream
&
os
)
const
override
{
os
<<
value_
;
}
int
compare
(
const
TupleValue
&
other
)
const
override
{
const
FloatValue
&
float_other
=
(
const
FloatValue
&
)
other
;
float
result
=
value_
-
float_other
.
value_
;
if
(
result
>
0
)
{
// 浮点数没有考虑精度问题
return
1
;
}
if
(
result
<
0
)
{
return
-
1
;
}
return
0
;
}
private:
float
value_
;
};
class
StringValue
:
public
TupleValue
{
public:
StringValue
(
const
char
*
value
,
int
len
)
:
value_
(
value
,
len
)
{}
explicit
StringValue
(
const
char
*
value
)
:
value_
(
value
)
{}
void
to_string
(
std
::
ostream
&
os
)
const
override
{
os
<<
value_
;
}
int
compare
(
const
TupleValue
&
other
)
const
override
{
const
StringValue
&
string_other
=
(
const
StringValue
&
)
other
;
return
strcmp
(
value_
.
c_str
(),
string_other
.
value_
.
c_str
());
}
private:
std
::
string
value_
;
};
#endif //__OBSERVER_SQL_EXECUTOR_VALUE_H_
src/observer/sql/
execu
tor/delete_operator.cpp
→
src/observer/sql/
opera
tor/delete_operator.cpp
浏览文件 @
d9972831
...
...
@@ -13,7 +13,7 @@ See the Mulan PSL v2 for more details. */
//
#include "common/log/log.h"
#include "sql/
execu
tor/delete_operator.h"
#include "sql/
opera
tor/delete_operator.h"
#include "storage/common/record.h"
#include "storage/common/table.h"
#include "sql/stmt/delete_stmt.h"
...
...
src/observer/sql/
execu
tor/delete_operator.h
→
src/observer/sql/
opera
tor/delete_operator.h
浏览文件 @
d9972831
...
...
@@ -14,7 +14,7 @@ See the Mulan PSL v2 for more details. */
#pragma once
#include "sql/
execu
tor/operator.h"
#include "sql/
opera
tor/operator.h"
#include "rc.h"
class
DeleteStmt
;
...
...
src/observer/sql/
execu
tor/insert_operator.cpp
→
src/observer/sql/
opera
tor/insert_operator.cpp
浏览文件 @
d9972831
...
...
@@ -12,7 +12,7 @@ See the Mulan PSL v2 for more details. */
// Created by WangYunlai on 2021/6/9.
//
#include "sql/
execu
tor/insert_operator.h"
#include "sql/
opera
tor/insert_operator.h"
#include "sql/stmt/insert_stmt.h"
#include "storage/common/table.h"
#include "rc.h"
...
...
src/observer/sql/
execu
tor/insert_operator.h
→
src/observer/sql/
opera
tor/insert_operator.h
浏览文件 @
d9972831
...
...
@@ -14,8 +14,7 @@ See the Mulan PSL v2 for more details. */
#pragma once
#include "common/seda/stage.h"
#include "sql/executor/operator.h"
#include "sql/operator/operator.h"
#include "sql/parser/parse.h"
#include "rc.h"
...
...
src/observer/sql/
execu
tor/join_operator.cpp.bak
→
src/observer/sql/
opera
tor/join_operator.cpp.bak
浏览文件 @
d9972831
...
...
@@ -12,7 +12,7 @@ See the Mulan PSL v2 for more details. */
// Created by WangYunlai on 2021/6/10.
//
#include "sql/
execu
tor/join_operator.h"
#include "sql/
opera
tor/join_operator.h"
RC JoinOperator::open()
{
...
...
src/observer/sql/
execu
tor/join_operator.h
→
src/observer/sql/
opera
tor/join_operator.h
浏览文件 @
d9972831
...
...
@@ -15,7 +15,7 @@ See the Mulan PSL v2 for more details. */
#pragma once
#include "sql/parser/parse.h"
#include "sql/
execu
tor/operator.h"
#include "sql/
opera
tor/operator.h"
#include "rc.h"
class
JoinPredicate
;
...
...
src/observer/sql/
execu
tor/operator.h
→
src/observer/sql/
opera
tor/operator.h
浏览文件 @
d9972831
文件已移动
src/observer/sql/
execu
tor/predicate_operator.cpp
→
src/observer/sql/
opera
tor/predicate_operator.cpp
浏览文件 @
d9972831
...
...
@@ -13,7 +13,7 @@ See the Mulan PSL v2 for more details. */
//
#include "common/log/log.h"
#include "sql/
execu
tor/predicate_operator.h"
#include "sql/
opera
tor/predicate_operator.h"
#include "storage/common/record.h"
#include "sql/stmt/filter_stmt.h"
#include "storage/common/field.h"
...
...
src/observer/sql/
execu
tor/predicate_operator.h
→
src/observer/sql/
opera
tor/predicate_operator.h
浏览文件 @
d9972831
...
...
@@ -14,7 +14,7 @@ See the Mulan PSL v2 for more details. */
#pragma once
#include "sql/
execu
tor/operator.h"
#include "sql/
opera
tor/operator.h"
class
FilterStmt
;
class
PredicateOperator
:
public
Operator
...
...
src/observer/sql/
execu
tor/project_operator.cpp
→
src/observer/sql/
opera
tor/project_operator.cpp
浏览文件 @
d9972831
...
...
@@ -13,7 +13,7 @@ See the Mulan PSL v2 for more details. */
//
#include "common/log/log.h"
#include "sql/
execu
tor/project_operator.h"
#include "sql/
opera
tor/project_operator.h"
#include "storage/common/record.h"
#include "storage/common/table.h"
...
...
src/observer/sql/
execu
tor/project_operator.h
→
src/observer/sql/
opera
tor/project_operator.h
浏览文件 @
d9972831
...
...
@@ -14,7 +14,7 @@ See the Mulan PSL v2 for more details. */
#pragma once
#include "sql/
execu
tor/operator.h"
#include "sql/
opera
tor/operator.h"
#include "rc.h"
class
ProjectOperator
:
public
Operator
...
...
src/observer/sql/
execu
tor/table_scan_operator.cpp
→
src/observer/sql/
opera
tor/table_scan_operator.cpp
浏览文件 @
d9972831
...
...
@@ -12,7 +12,7 @@ See the Mulan PSL v2 for more details. */
// Created by WangYunlai on 2021/6/9.
//
#include "sql/
execu
tor/table_scan_operator.h"
#include "sql/
opera
tor/table_scan_operator.h"
#include "storage/common/table.h"
#include "rc.h"
...
...
@@ -33,7 +33,6 @@ RC TableScanOperator::next()
}
RC
rc
=
record_scanner_
.
next
(
current_record_
);
current_record_
.
set_fields
(
table_
->
table_meta
().
field_metas
());
return
rc
;
}
...
...
src/observer/sql/
execu
tor/table_scan_operator.h
→
src/observer/sql/
opera
tor/table_scan_operator.h
浏览文件 @
d9972831
...
...
@@ -14,13 +14,11 @@ See the Mulan PSL v2 for more details. */
#pragma once
#include "sql/executor/predicate.h"
#include "sql/executor/operator.h"
#include "sql/operator/operator.h"
#include "storage/common/record_manager.h"
#include "rc.h"
class
Table
;
class
Predicate
;
class
TableScanOperator
:
public
Operator
{
...
...
src/observer/storage/common/record.cpp
浏览文件 @
d9972831
...
...
@@ -2,15 +2,3 @@
#include "storage/common/field.h"
#include "common/log/log.h"
#include "rc.h"
RC
Record
::
set_field_value
(
const
Value
&
value
,
int
index
)
{
// TODO
return
RC
::
UNIMPLENMENT
;
}
RC
Record
::
set_field_values
(
const
Value
*
values
,
int
value_num
,
int
start_index
)
{
// TODO
return
RC
::
UNIMPLENMENT
;
}
src/observer/storage/common/record.h
浏览文件 @
d9972831
...
...
@@ -91,22 +91,12 @@ public:
char
*
data
()
{
return
this
->
data_
;
}
const
char
*
data
()
const
{
return
this
->
data_
;
}
void
set_fields
(
const
std
::
vector
<
FieldMeta
>
*
fields
)
{
this
->
fields_
=
fields
;
}
const
std
::
vector
<
FieldMeta
>
*
field_metas
()
const
{
return
fields_
;
}
RC
field_at
(
int
index
,
Field
&
field
)
const
;
int
field_amount
()
const
{
return
fields_
->
size
();}
void
set_rid
(
const
RID
&
rid
)
{
this
->
rid_
=
rid
;
}
void
set_rid
(
const
PageNum
page_num
,
const
SlotNum
slot_num
)
{
this
->
rid_
.
page_num
=
page_num
;
this
->
rid_
.
slot_num
=
slot_num
;
}
RID
&
rid
()
{
return
rid_
;
}
const
RID
&
rid
()
const
{
return
rid_
;
};
RC
set_field_value
(
const
Value
&
value
,
int
index
);
RC
set_field_values
(
const
Value
*
values
,
int
value_num
,
int
start_index
);
private:
const
std
::
vector
<
FieldMeta
>
*
fields_
=
nullptr
;
RID
rid_
;
// the data buffer
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录