Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Metz
oceanbase
提交
336c46df
O
oceanbase
项目概览
Metz
/
oceanbase
与 Fork 源项目一致
Fork自
oceanbase / oceanbase
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
oceanbase
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
336c46df
编写于
5月 05, 2022
作者:
O
obdev
提交者:
wangzelin.wzl
5月 05, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[CP] fix join elimination bug
上级
7d150eca
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
22 addition
and
22 deletion
+22
-22
src/sql/rewrite/ob_transform_join_elimination.cpp
src/sql/rewrite/ob_transform_join_elimination.cpp
+12
-14
src/sql/rewrite/ob_transform_utils.cpp
src/sql/rewrite/ob_transform_utils.cpp
+9
-7
src/sql/rewrite/ob_transform_utils.h
src/sql/rewrite/ob_transform_utils.h
+1
-1
未找到文件。
src/sql/rewrite/ob_transform_join_elimination.cpp
浏览文件 @
336c46df
...
...
@@ -2074,22 +2074,20 @@ int ObTransformJoinElimination::trans_column_expr(ObDMLStmt* stmt, ObRawExpr* ex
{
int
ret
=
OB_SUCCESS
;
new_expr
=
NULL
;
bool
is_nullable
=
false
;
if
(
OB_ISNULL
(
stmt
)
||
OB_ISNULL
(
expr
)
||
OB_ISNULL
(
ctx_
))
{
LOG_WARN
(
"param has null"
,
K
(
ret
));
LOG_WARN
(
"param has null"
,
K
(
ret
),
K
(
stmt
),
K
(
expr
),
K
(
ctx_
));
}
else
if
(
OB_FAIL
(
ObTransformUtils
::
check_expr_nullable
(
stmt
,
expr
,
is_nullable
,
ObTransformUtils
::
NULLABLE_SCOPE
::
NS_FROM
)))
{
LOG_WARN
(
"failed to check whether expr is nullable"
,
K
(
ret
));
}
else
if
(
!
is_nullable
)
{
if
(
OB_FAIL
(
ObRawExprUtils
::
build_const_bool_expr
(
ctx_
->
expr_factory_
,
new_expr
,
true
)))
{
LOG_WARN
(
"build true expr failed"
,
K
(
ret
));
}
else
{
/*do nothing*/
}
}
else
{
bool
is_nullable
=
false
;
if
(
OB_FAIL
(
ObTransformUtils
::
check_expr_nullable
(
stmt
,
expr
,
is_nullable
)))
{
LOG_WARN
(
"failed to check whether expr is nullable"
,
K
(
ret
));
}
else
if
(
!
is_nullable
)
{
if
(
OB_FAIL
(
ObRawExprUtils
::
build_const_bool_expr
(
ctx_
->
expr_factory_
,
new_expr
,
true
)))
{
LOG_WARN
(
"build true expr failed"
,
K
(
ret
));
}
else
{
/*do nothing*/
}
}
else
{
if
(
OB_FAIL
(
ObRawExprUtils
::
build_is_not_null_expr
(
*
ctx_
->
expr_factory_
,
expr
,
new_expr
)))
{
LOG_WARN
(
"build is not null expr failed"
,
K
(
ret
));
}
else
{
/*do nothing*/
}
if
(
OB_FAIL
(
ObRawExprUtils
::
build_is_not_null_expr
(
*
ctx_
->
expr_factory_
,
expr
,
new_expr
)))
{
LOG_WARN
(
"build is not null expr failed"
,
K
(
ret
));
}
else
{
/*do nothing*/
}
}
return
ret
;
...
...
src/sql/rewrite/ob_transform_utils.cpp
浏览文件 @
336c46df
...
...
@@ -1743,7 +1743,7 @@ int ObTransformUtils::find_not_null_expr(ObDMLStmt& stmt, ObRawExpr*& not_null_e
// 1. check is there null rejecting condition
// 2. check is nullable column, and is not the right table of outer join
int
ObTransformUtils
::
check_expr_nullable
(
ObDMLStmt
*
stmt
,
ObRawExpr
*
expr
,
bool
&
is_nullable
)
int
ObTransformUtils
::
check_expr_nullable
(
ObDMLStmt
*
stmt
,
ObRawExpr
*
expr
,
bool
&
is_nullable
,
int
nullable_scope
/* = ObTransformUtils::NULLABLE_SCOPE::NS_WHERE */
)
{
int
ret
=
OB_SUCCESS
;
is_nullable
=
true
;
...
...
@@ -1757,12 +1757,14 @@ int ObTransformUtils::check_expr_nullable(ObDMLStmt* stmt, ObRawExpr* expr, bool
LOG_WARN
(
"failed to check is not null column"
,
K
(
ret
));
}
else
if
(
not_null_col
)
{
is_nullable
=
false
;
}
else
if
(
OB_FAIL
(
stmt
->
get_equal_set_conditions
(
valid_conds
,
true
,
SCOPE_WHERE
)))
{
LOG_WARN
(
"failed to get equal set conditions"
,
K
(
ret
));
}
else
if
(
OB_FAIL
(
has_null_reject_condition
(
valid_conds
,
expr
,
has_null_reject
)))
{
LOG_WARN
(
"failed to check has null reject condition"
,
K
(
ret
));
}
else
if
(
has_null_reject
)
{
is_nullable
=
false
;
}
else
if
(
nullable_scope
>=
ObTransformUtils
::
NULLABLE_SCOPE
::
NS_WHERE
)
{
if
(
OB_FAIL
(
stmt
->
get_equal_set_conditions
(
valid_conds
,
true
,
SCOPE_WHERE
)))
{
LOG_WARN
(
"failed to get equal set conditions"
,
K
(
ret
));
}
else
if
(
OB_FAIL
(
has_null_reject_condition
(
valid_conds
,
expr
,
has_null_reject
)))
{
LOG_WARN
(
"failed to check has null reject condition"
,
K
(
ret
));
}
else
if
(
has_null_reject
)
{
is_nullable
=
false
;
}
}
return
ret
;
}
...
...
src/sql/rewrite/ob_transform_utils.h
浏览文件 @
336c46df
...
...
@@ -242,7 +242,7 @@ public:
static
int
find_not_null_expr
(
ObDMLStmt
&
stmt
,
ObRawExpr
*&
not_null_expr
,
bool
&
is_valid
);
static
int
check_expr_nullable
(
ObDMLStmt
*
stmt
,
ObRawExpr
*
expr
,
bool
&
is_nullable
);
static
int
check_expr_nullable
(
ObDMLStmt
*
stmt
,
ObRawExpr
*
expr
,
bool
&
is_nullable
,
int
nullable_scope
=
ObTransformUtils
::
NULLABLE_SCOPE
::
NS_WHERE
);
static
int
check_is_not_null_column
(
const
ObDMLStmt
*
stmt
,
const
ObRawExpr
*
expr
,
bool
&
col_not_null
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录