Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
oceanbase
miniob
提交
cd892de3
M
miniob
项目概览
oceanbase
/
miniob
大约 1 年 前同步成功
通知
74
Star
1521
Fork
537
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
分析
仓库
DevOps
项目成员
Pages
M
miniob
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Pages
分析
分析
仓库分析
DevOps
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
提交
体验新版 GitCode,发现更多精彩内容 >>
提交
cd892de3
编写于
7月 05, 2022
作者:
羽飞
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
use Field instead of FieldDesc in select_stmt
上级
bc28950a
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
11 addition
and
20 deletion
+11
-20
src/observer/sql/executor/execute_stage.cpp
src/observer/sql/executor/execute_stage.cpp
+2
-2
src/observer/sql/operator/project_operator.h
src/observer/sql/operator/project_operator.h
+1
-1
src/observer/sql/stmt/select_stmt.cpp
src/observer/sql/stmt/select_stmt.cpp
+5
-5
src/observer/sql/stmt/select_stmt.h
src/observer/sql/stmt/select_stmt.h
+3
-12
未找到文件。
src/observer/sql/executor/execute_stage.cpp
浏览文件 @
cd892de3
...
...
@@ -266,8 +266,8 @@ RC ExecuteStage::do_select(SQLStageEvent *sql_event)
pred_oper
.
add_child
(
&
table_scan_operator
);
ProjectOperator
project_oper
;
project_oper
.
add_child
(
&
pred_oper
);
for
(
const
Field
Desc
&
field
:
select_stmt
->
query_fields
())
{
project_oper
.
add_projection
(
field
.
table
_
,
field
.
field_meta_
);
for
(
const
Field
&
field
:
select_stmt
->
query_fields
())
{
project_oper
.
add_projection
(
field
.
table
(),
field
.
meta
()
);
}
rc
=
project_oper
.
open
();
if
(
rc
!=
RC
::
SUCCESS
)
{
...
...
src/observer/sql/operator/project_operator.h
浏览文件 @
cd892de3
...
...
@@ -25,7 +25,7 @@ public:
virtual
~
ProjectOperator
()
=
default
;
void
add_projection
(
const
Table
*
table
,
const
FieldMeta
*
field
);
// TODO how to handle the memory in tupleCellSpec?
void
add_projection
(
const
Table
*
table
,
const
FieldMeta
*
field
);
RC
open
()
override
;
RC
next
()
override
;
...
...
src/observer/sql/stmt/select_stmt.cpp
浏览文件 @
cd892de3
...
...
@@ -27,12 +27,12 @@ SelectStmt::~SelectStmt()
}
}
static
void
wildcard_fields
(
Table
*
table
,
std
::
vector
<
Field
Desc
>
&
field_metas
)
static
void
wildcard_fields
(
Table
*
table
,
std
::
vector
<
Field
>
&
field_metas
)
{
const
TableMeta
&
table_meta
=
table
->
table_meta
();
const
int
field_num
=
table_meta
.
field_num
();
for
(
int
i
=
table_meta
.
sys_field_num
();
i
<
field_num
;
i
++
)
{
field_metas
.
push_back
(
Field
Desc
(
table
,
table_meta
.
field
(
i
)));
field_metas
.
push_back
(
Field
(
table
,
table_meta
.
field
(
i
)));
}
}
...
...
@@ -64,7 +64,7 @@ RC SelectStmt::create(Db *db, const Selects &select_sql, Stmt *&stmt)
}
// collect query fields in `select` statement
std
::
vector
<
Field
Desc
>
query_fields
;
std
::
vector
<
Field
>
query_fields
;
for
(
int
i
=
select_sql
.
attr_num
-
1
;
i
>=
0
;
i
--
)
{
const
RelAttr
&
relation_attr
=
select_sql
.
attributes
[
i
];
...
...
@@ -102,7 +102,7 @@ RC SelectStmt::create(Db *db, const Selects &select_sql, Stmt *&stmt)
return
RC
::
SCHEMA_FIELD_MISSING
;
}
query_fields
.
push_back
(
Field
Desc
(
table
,
field_meta
));
query_fields
.
push_back
(
Field
(
table
,
field_meta
));
}
}
}
else
{
...
...
@@ -118,7 +118,7 @@ RC SelectStmt::create(Db *db, const Selects &select_sql, Stmt *&stmt)
return
RC
::
SCHEMA_FIELD_MISSING
;
}
query_fields
.
push_back
(
Field
Desc
(
table
,
field_meta
));
query_fields
.
push_back
(
Field
(
table
,
field_meta
));
}
}
...
...
src/observer/sql/stmt/select_stmt.h
浏览文件 @
cd892de3
...
...
@@ -18,22 +18,13 @@ See the Mulan PSL v2 for more details. */
#include "rc.h"
#include "sql/stmt/stmt.h"
#include "storage/common/field.h"
class
FieldMeta
;
class
FilterStmt
;
class
Db
;
class
Table
;
// TODO better to create a field class
struct
FieldDesc
{
Table
*
table_
=
nullptr
;
const
FieldMeta
*
field_meta_
=
nullptr
;
FieldDesc
()
=
default
;
FieldDesc
(
Table
*
table
,
const
FieldMeta
*
field_meta
)
:
table_
(
table
),
field_meta_
(
field_meta
)
{}
};
class
SelectStmt
:
public
Stmt
{
public:
...
...
@@ -47,11 +38,11 @@ public:
public:
const
std
::
vector
<
Table
*>
&
tables
()
const
{
return
tables_
;
}
const
std
::
vector
<
Field
Desc
>
&
query_fields
()
const
{
return
query_fields_
;
}
const
std
::
vector
<
Field
>
&
query_fields
()
const
{
return
query_fields_
;
}
FilterStmt
*
filter_stmt
()
const
{
return
filter_stmt_
;
}
private:
std
::
vector
<
Field
Desc
>
query_fields_
;
std
::
vector
<
Field
>
query_fields_
;
std
::
vector
<
Table
*>
tables_
;
FilterStmt
*
filter_stmt_
=
nullptr
;
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录