Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
天地威能
oceanbase
提交
f34a588a
O
oceanbase
项目概览
天地威能
/
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
f34a588a
编写于
11月 25, 2022
作者:
W
wjhh2008
提交者:
wangzelin.wzl
11月 25, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix rewrite bug: replace column with const value
上级
fe0de4b0
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
19 addition
and
28 deletion
+19
-28
src/share/object/ob_obj_cast.h
src/share/object/ob_obj_cast.h
+2
-0
src/sql/engine/expr/ob_expr_cast.cpp
src/sql/engine/expr/ob_expr_cast.cpp
+3
-1
src/sql/rewrite/ob_transform_join_elimination.cpp
src/sql/rewrite/ob_transform_join_elimination.cpp
+5
-11
src/sql/rewrite/ob_transform_left_join_to_anti.cpp
src/sql/rewrite/ob_transform_left_join_to_anti.cpp
+9
-16
未找到文件。
src/share/object/ob_obj_cast.h
浏览文件 @
f34a588a
...
...
@@ -45,6 +45,7 @@ namespace common
#define CM_SET_MIN_IF_OVERFLOW (1ULL << 9)
#define CM_ERROR_ON_SCALE_OVER (1ULL << 10)
#define CM_TO_COLUMN_CS_LEVEL (1ULL << 52)
#define CM_ERROR_FOR_DIVISION_BY_ZERO (1ULL << 53)
#define CM_NO_ZERO_IN_DATE (1ULL << 54) // reserve
#define CM_NO_ZERO_DATE (1ULL << 55)
...
...
@@ -99,6 +100,7 @@ typedef uint64_t ObCastMode;
#define CM_IS_SET_MIN_IF_OVERFLOW(mode) ((CM_SET_MIN_IF_OVERFLOW & (mode)) != 0)
#define CM_IS_ERROR_ON_SCALE_OVER(mode) ((CM_ERROR_ON_SCALE_OVER & (mode)) != 0)
#define CM_IS_JSON_VALUE(mode) CM_IS_ERROR_ON_SCALE_OVER(mode)
#define CM_IS_TO_COLUMN_CS_LEVEL(mode) ((CM_TO_COLUMN_CS_LEVEL & (mode)) != 0)
struct
ObObjCastParams
{
...
...
src/sql/engine/expr/ob_expr_cast.cpp
浏览文件 @
f34a588a
...
...
@@ -294,6 +294,7 @@ int ObExprCast::calc_result_type2(ObExprResType &type,
ObRawExpr
*
cast_raw_expr
=
NULL
;
const
sql
::
ObSQLSessionInfo
*
session
=
NULL
;
bool
is_explicit_cast
=
false
;
bool
is_to_column_cs_level
=
false
;
if
(
OB_ISNULL
(
session
=
type_ctx
.
get_session
())
||
OB_ISNULL
(
cast_raw_expr
=
get_raw_expr
()))
{
ret
=
OB_ERR_UNEXPECTED
;
...
...
@@ -310,6 +311,7 @@ int ObExprCast::calc_result_type2(ObExprResType &type,
"dst"
,
ob_obj_type_str
(
dst_type
.
get_type
()));
}
else
if
(
FALSE_IT
(
is_explicit_cast
=
CM_IS_EXPLICIT_CAST
(
cast_raw_expr
->
get_extra
())))
{
// check cast supported in cast_map but not support here.
}
else
if
(
FALSE_IT
(
is_to_column_cs_level
=
CM_IS_TO_COLUMN_CS_LEVEL
(
cast_raw_expr
->
get_extra
())))
{
}
else
if
(
!
check_cast_allowed
(
type1
.
get_type
(),
type1
.
get_collation_type
(),
dst_type
.
get_type
(),
dst_type
.
get_collation_type
(),
is_explicit_cast
))
{
...
...
@@ -355,7 +357,7 @@ int ObExprCast::calc_result_type2(ObExprResType &type,
type1
.
set_calc_type
(
get_calc_cast_type
(
type1
.
get_type
(),
dst_type
.
get_type
()));
int32_t
length
=
0
;
if
(
ob_is_string_or_lob_type
(
dst_type
.
get_type
())
||
ob_is_raw
(
dst_type
.
get_type
())
||
ob_is_json
(
dst_type
.
get_type
()))
{
type
.
set_collation_level
(
is_explicit_cast
type
.
set_collation_level
(
(
is_explicit_cast
||
is_to_column_cs_level
)
?
CS_LEVEL_IMPLICIT
:
type1
.
get_collation_level
());
int32_t
len
=
dst_type
.
get_length
();
...
...
src/sql/rewrite/ob_transform_join_elimination.cpp
浏览文件 @
f34a588a
...
...
@@ -1054,22 +1054,16 @@ int ObTransformJoinElimination::do_eliminate_left_outer_join(ObDMLStmt *stmt,
LOG_WARN
(
"get unexpected null"
,
K
(
ret
));
}
else
if
(
OB_FAIL
(
ObRawExprUtils
::
build_null_expr
(
*
ctx_
->
expr_factory_
,
to_expr
)))
{
LOG_WARN
(
"failed to create new raw expr"
,
K
(
ret
));
}
else
if
(
OB_FAIL
(
ObSQLUtils
::
get_default_cast_mode
(
tru
e
,
/* explicit_cast */
}
else
if
(
OB_FAIL
(
ObSQLUtils
::
get_default_cast_mode
(
fals
e
,
/* explicit_cast */
0
,
/* result_flag */
ctx_
->
session_info_
,
cm
)))
{
ctx_
->
session_info_
,
cm
)))
{
LOG_WARN
(
"fail to get default cast mode"
,
K
(
ret
));
}
else
if
(
is_mysql_mode
()
&&
OB_FAIL
(
ObRawExprUtils
::
create_cast_expr
(
*
ctx_
->
expr_factory_
,
}
else
if
(
OB_FAIL
(
ObRawExprUtils
::
create_cast_expr
(
*
ctx_
->
expr_factory_
,
to_expr
,
from_expr
->
get_result_type
(),
cast_expr
,
ctx_
->
session_info_
,
false
,
cm
)))
{
LOG_WARN
(
"failed to cast expr"
,
K
(
ret
),
K
(
*
from_expr
),
K
(
*
to_expr
));
}
else
if
(
is_oracle_mode
()
&&
OB_FAIL
(
ObRawExprUtils
::
create_cast_expr
(
*
ctx_
->
expr_factory_
,
to_expr
,
from_expr
->
get_result_type
(),
cast_expr
,
ctx_
->
session_info_
)))
{
false
,
cm
|
CM_TO_COLUMN_CS_LEVEL
)))
{
LOG_WARN
(
"failed to cast expr"
,
K
(
ret
),
K
(
*
from_expr
),
K
(
*
to_expr
));
}
else
if
(
OB_ISNULL
(
cast_expr
))
{
ret
=
OB_ERR_UNEXPECTED
;
...
...
src/sql/rewrite/ob_transform_left_join_to_anti.cpp
浏览文件 @
f34a588a
...
...
@@ -313,22 +313,15 @@ int ObTransformLeftJoinToAnti::trans_stmt_to_anti(ObDMLStmt *stmt, const JoinedT
}
else
if
(
OB_FAIL
(
ObRawExprUtils
::
build_null_expr
(
*
ctx_
->
expr_factory_
,
to_expr
)))
{
LOG_WARN
(
"failed to build null expr"
,
K
(
ret
));
}
else
if
(
OB_FAIL
(
ObSQLUtils
::
get_default_cast_mode
(
tru
e
,
/* explicit_cast */
}
else
if
(
OB_FAIL
(
ObSQLUtils
::
get_default_cast_mode
(
fals
e
,
/* explicit_cast */
0
,
/* result_flag */
ctx_
->
session_info_
,
cm
)))
{
LOG_WARN
(
"fail to get default cast mode"
,
K
(
ret
));
}
else
if
(
is_mysql_mode
()
&&
OB_FAIL
(
ObRawExprUtils
::
create_cast_expr
(
*
ctx_
->
expr_factory_
,
}
else
if
(
OB_FAIL
(
ObRawExprUtils
::
create_cast_expr
(
*
ctx_
->
expr_factory_
,
to_expr
,
from_expr
->
get_result_type
(),
cast_expr
,
ctx_
->
session_info_
,
false
,
cm
)))
{
LOG_WARN
(
"failed to cast expr"
,
K
(
ret
),
K
(
*
from_expr
),
K
(
*
to_expr
));
}
else
if
(
is_oracle_mode
()
&&
OB_FAIL
(
ObRawExprUtils
::
create_cast_expr
(
*
ctx_
->
expr_factory_
,
to_expr
,
from_expr
->
get_result_type
(),
cast_expr
,
ctx_
->
session_info_
)))
{
false
,
cm
|
CM_TO_COLUMN_CS_LEVEL
)))
{
LOG_WARN
(
"failed to cast expr"
,
K
(
ret
),
K
(
*
from_expr
),
K
(
*
to_expr
));
}
else
if
(
OB_ISNULL
(
to_expr
=
cast_expr
))
{
ret
=
OB_ERR_UNEXPECTED
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录