Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lihongda1002
oceanbase
提交
b0969035
O
oceanbase
项目概览
lihongda1002
/
oceanbase
与 Fork 源项目一致
Fork自
oceanbase / oceanbase
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
oceanbase
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
b0969035
编写于
11月 04, 2022
作者:
O
obdev
提交者:
wangzelin.wzl
11月 04, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[bugfix] fix serveral rewrite bugs
上级
d0cd76cc
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
61 addition
and
8 deletion
+61
-8
src/sql/resolver/expr/ob_expr_relation_analyzer.cpp
src/sql/resolver/expr/ob_expr_relation_analyzer.cpp
+1
-2
src/sql/rewrite/ob_transform_predicate_move_around.cpp
src/sql/rewrite/ob_transform_predicate_move_around.cpp
+54
-4
src/sql/rewrite/ob_transform_predicate_move_around.h
src/sql/rewrite/ob_transform_predicate_move_around.h
+6
-1
src/sql/rewrite/ob_transform_where_subquery_pullup.cpp
src/sql/rewrite/ob_transform_where_subquery_pullup.cpp
+0
-1
未找到文件。
src/sql/resolver/expr/ob_expr_relation_analyzer.cpp
浏览文件 @
b0969035
...
...
@@ -90,8 +90,7 @@ int ObExprRelationAnalyzer::visit_expr(ObRawExpr &expr, int32_t stmt_level)
LOG_WARN
(
"param expr is null"
,
K
(
ret
),
K
(
param
),
K
(
i
),
K
(
expr
));
}
else
if
(
OB_FAIL
(
SMART_CALL
(
visit_expr
(
*
param
,
stmt_level
))))
{
LOG_WARN
(
"failed to visit param"
,
K
(
ret
));
}
else
if
(
!
expr
.
is_query_ref_expr
()
&&
OB_FAIL
(
expr
.
get_expr_levels
().
add_members
(
param
->
get_expr_levels
())))
{
}
else
if
(
OB_FAIL
(
expr
.
get_expr_levels
().
add_members
(
param
->
get_expr_levels
())))
{
LOG_WARN
(
"failed to add expr levels"
,
K
(
ret
));
}
else
if
(
!
param
->
get_expr_levels
().
has_member
(
stmt_level
))
{
// skip
...
...
src/sql/rewrite/ob_transform_predicate_move_around.cpp
浏览文件 @
b0969035
...
...
@@ -2084,6 +2084,58 @@ int ObTransformPredicateMoveAround::pushdown_into_semi_info(ObDMLStmt *stmt,
return
ret
;
}
int
ObTransformPredicateMoveAround
::
extract_semi_right_table_filter
(
ObDMLStmt
*
stmt
,
SemiInfo
*
semi_info
,
ObIArray
<
ObRawExpr
*>
&
right_filters
)
{
int
ret
=
OB_SUCCESS
;
ObSqlBitSet
<>
right_table_set
;
if
(
OB_ISNULL
(
stmt
)
||
OB_ISNULL
(
semi_info
))
{
ret
=
OB_ERR_UNEXPECTED
;
LOG_WARN
(
"params have null"
,
K
(
ret
),
K
(
stmt
),
K
(
semi_info
));
}
else
if
(
OB_FAIL
(
stmt
->
get_table_rel_ids
(
semi_info
->
right_table_id_
,
right_table_set
)))
{
LOG_WARN
(
"failed to get right table set"
,
K
(
ret
));
}
for
(
int64_t
i
=
0
;
OB_SUCC
(
ret
)
&&
i
<
semi_info
->
semi_conditions_
.
count
();
++
i
)
{
ObRawExpr
*
expr
=
semi_info
->
semi_conditions_
.
at
(
i
);
bool
has
=
false
;
if
(
OB_ISNULL
(
expr
))
{
ret
=
OB_ERR_UNEXPECTED
;
LOG_WARN
(
"source expr shoud not be null"
,
K
(
ret
));
}
else
if
(
expr
->
get_relation_ids
().
is_empty
())
{
// do nothing
}
else
if
(
!
right_table_set
.
is_superset2
(
expr
->
get_relation_ids
()))
{
/* do nothing */
}
else
if
(
OB_FAIL
(
check_has_shared_query_ref
(
expr
,
has
)))
{
LOG_WARN
(
"failed to check has shared query ref"
,
K
(
ret
));
}
else
if
(
has
)
{
// do nothing
}
else
if
(
OB_FAIL
(
right_filters
.
push_back
(
expr
)))
{
LOG_WARN
(
"failed to push back column expr"
,
K
(
ret
));
}
}
return
ret
;
}
int
ObTransformPredicateMoveAround
::
check_has_shared_query_ref
(
ObRawExpr
*
expr
,
bool
&
has
)
{
int
ret
=
OB_SUCCESS
;
if
(
OB_ISNULL
(
expr
))
{
ret
=
OB_ERR_UNEXPECTED
;
LOG_WARN
(
"expr is null"
,
K
(
ret
),
K
(
expr
));
}
else
if
(
expr
->
is_query_ref_expr
()
&&
expr
->
get_ref_count
()
>
1
)
{
has
=
true
;
}
else
if
(
expr
->
has_flag
(
CNT_SUB_QUERY
))
{
for
(
int64_t
i
=
0
;
OB_SUCC
(
ret
)
&&
!
has
&&
i
<
expr
->
get_param_count
();
++
i
)
{
if
(
OB_FAIL
(
SMART_CALL
(
check_has_shared_query_ref
(
expr
->
get_param_expr
(
i
),
has
))))
{
LOG_WARN
(
"failed to check has shared query ref"
,
K
(
ret
));
}
}
}
return
ret
;
}
// pushdown right table filter in semi condition:
// 1. if right table is a basic table, create a generate table.
// 2. pushdown the right table filters into the generate table.
...
...
@@ -2104,8 +2156,7 @@ int ObTransformPredicateMoveAround::pushdown_semi_info_right_filter(ObDMLStmt *s
}
else
if
(
OB_ISNULL
(
right_table
=
stmt
->
get_table_item_by_id
(
semi_info
->
right_table_id_
)))
{
ret
=
OB_ERR_UNEXPECTED
;
LOG_WARN
(
"unexpected null"
,
K
(
ret
),
K
(
right_table
));
}
else
if
(
OB_FAIL
(
ObTransformUtils
::
extract_table_exprs
(
*
stmt
,
semi_info
->
semi_conditions_
,
*
right_table
,
right_filters
)))
{
}
else
if
(
OB_FAIL
(
extract_semi_right_table_filter
(
stmt
,
semi_info
,
right_filters
)))
{
LOG_WARN
(
"failed to extract table exprs"
,
K
(
ret
));
}
else
if
(
right_filters
.
empty
())
{
// do nothing
...
...
@@ -2117,8 +2168,7 @@ int ObTransformPredicateMoveAround::pushdown_semi_info_right_filter(ObDMLStmt *s
LOG_WARN
(
"failed to create view with table"
,
K
(
ret
));
}
else
if
(
FALSE_IT
(
right_filters
.
reuse
()))
{
// do nothing
}
else
if
(
OB_FAIL
(
ObTransformUtils
::
extract_table_exprs
(
*
stmt
,
semi_info
->
semi_conditions_
,
*
right_table
,
right_filters
)))
{
}
else
if
(
OB_FAIL
(
extract_semi_right_table_filter
(
stmt
,
semi_info
,
right_filters
)))
{
LOG_WARN
(
"failed to extract table exprs"
,
K
(
ret
));
}
...
...
src/sql/rewrite/ob_transform_predicate_move_around.h
浏览文件 @
b0969035
...
...
@@ -195,6 +195,11 @@ private:
ObTransformerCtx
*
ctx
,
SemiInfo
*
semi_info
);
int
check_has_shared_query_ref
(
ObRawExpr
*
expr
,
bool
&
has
);
int
extract_semi_right_table_filter
(
ObDMLStmt
*
stmt
,
SemiInfo
*
semi_info
,
ObIArray
<
ObRawExpr
*>
&
right_filters
);
int
pushdown_into_table
(
ObDMLStmt
*
stmt
,
TableItem
*
table
,
ObIArray
<
ObRawExpr
*>
&
pullup_preds
,
...
...
src/sql/rewrite/ob_transform_where_subquery_pullup.cpp
浏览文件 @
b0969035
...
...
@@ -342,7 +342,6 @@ int ObWhereSubQueryPullup::check_basic_validity(ObDMLStmt *stmt,
int
ret
=
OB_SUCCESS
;
bool
&
is_valid
=
trans_param
.
can_be_transform_
;
ObSelectStmt
*
subquery
=
trans_param
.
subquery_
;
bool
check_status
=
false
;
if
(
OB_ISNULL
(
expr
)
||
OB_ISNULL
(
stmt
)
||
OB_ISNULL
(
subquery
))
{
ret
=
OB_ERR_UNEXPECTED
;
LOG_WARN
(
"NULL pointer error"
,
K
(
ret
),
K
(
expr
),
K
(
stmt
),
K
(
subquery
));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录