Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Metz
oceanbase
提交
13350748
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看板
提交
13350748
编写于
4月 11, 2022
作者:
X
xy0
提交者:
LINGuanRen
4月 11, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix timediff bug
上级
e5910e45
变更
2
展开全部
隐藏空白更改
内联
并排
Showing
2 changed file
with
294 addition
and
293 deletion
+294
-293
deps/oblib/src/lib/timezone/ob_time_convert.cpp
deps/oblib/src/lib/timezone/ob_time_convert.cpp
+282
-281
src/sql/engine/expr/ob_expr_time_diff.cpp
src/sql/engine/expr/ob_expr_time_diff.cpp
+12
-12
未找到文件。
deps/oblib/src/lib/timezone/ob_time_convert.cpp
浏览文件 @
13350748
此差异已折叠。
点击以展开。
src/sql/engine/expr/ob_expr_time_diff.cpp
浏览文件 @
13350748
...
@@ -24,20 +24,20 @@ namespace oceanbase {
...
@@ -24,20 +24,20 @@ namespace oceanbase {
using
namespace
common
;
using
namespace
common
;
namespace
sql
{
namespace
sql
{
ObExprTimeDiff
::
ObExprTimeDiff
(
ObIAllocator
&
alloc
)
ObExprTimeDiff
::
ObExprTimeDiff
(
ObIAllocator
&
alloc
)
:
ObFuncExprOperator
(
alloc
,
T_FUN_SYS_TIME_DIFF
,
N_TIME_DIFF
,
2
,
NOT_ROW_DIMENSION
)
:
ObFuncExprOperator
(
alloc
,
T_FUN_SYS_TIME_DIFF
,
N_TIME_DIFF
,
2
,
NOT_ROW_DIMENSION
)
{}
{}
ObExprTimeDiff
::~
ObExprTimeDiff
()
ObExprTimeDiff
::~
ObExprTimeDiff
()
{}
{}
int
ObExprTimeDiff
::
calc_result2
(
ObObj
&
result
,
const
ObObj
&
left
,
const
ObObj
&
right
,
ObExprCtx
&
expr_ctx
)
const
int
ObExprTimeDiff
::
calc_result2
(
ObObj
&
result
,
const
ObObj
&
left
,
const
ObObj
&
right
,
ObExprCtx
&
expr_ctx
)
const
{
{
EXPR_DEFINE_CAST_CTX
(
expr_ctx
,
CM_NONE
);
EXPR_DEFINE_CAST_CTX
(
expr_ctx
,
CM_NONE
);
return
calc
(
result
,
left
,
right
,
cast_ctx
);
return
calc
(
result
,
left
,
right
,
cast_ctx
);
}
}
int
ObExprTimeDiff
::
get_diff_value_with_ob_time
(
ObTime
&
ot1
,
ObTime
&
ot2
,
const
ObTimeZoneInfo
*
tz_info
,
int64_t
&
diff
)
int
ObExprTimeDiff
::
get_diff_value_with_ob_time
(
ObTime
&
ot1
,
ObTime
&
ot2
,
const
ObTimeZoneInfo
*
tz_info
,
int64_t
&
diff
)
{
{
int
ret
=
OB_SUCCESS
;
int
ret
=
OB_SUCCESS
;
int64_t
value1
=
0
;
int64_t
value1
=
0
;
...
@@ -63,7 +63,7 @@ int ObExprTimeDiff::get_diff_value_with_ob_time(ObTime& ot1, ObTime& ot2, const
...
@@ -63,7 +63,7 @@ int ObExprTimeDiff::get_diff_value_with_ob_time(ObTime& ot1, ObTime& ot2, const
return
ret
;
return
ret
;
}
}
int
ObExprTimeDiff
::
get_diff_value
(
const
ObObj
&
obj1
,
const
ObObj
&
obj2
,
const
ObTimeZoneInfo
*
tz_info
,
int64_t
&
diff
)
int
ObExprTimeDiff
::
get_diff_value
(
const
ObObj
&
obj1
,
const
ObObj
&
obj2
,
const
ObTimeZoneInfo
*
tz_info
,
int64_t
&
diff
)
{
{
int
ret
=
OB_INVALID_DATE_VALUE
;
int
ret
=
OB_INVALID_DATE_VALUE
;
ObTime
ot1
;
ObTime
ot1
;
...
@@ -77,7 +77,7 @@ int ObExprTimeDiff::get_diff_value(const ObObj& obj1, const ObObj& obj2, const O
...
@@ -77,7 +77,7 @@ int ObExprTimeDiff::get_diff_value(const ObObj& obj1, const ObObj& obj2, const O
return
ret
;
return
ret
;
}
}
int
ObExprTimeDiff
::
calc
(
ObObj
&
result
,
const
ObObj
&
left
,
const
ObObj
&
right
,
ObCastCtx
&
cast_ctx
)
int
ObExprTimeDiff
::
calc
(
ObObj
&
result
,
const
ObObj
&
left
,
const
ObObj
&
right
,
ObCastCtx
&
cast_ctx
)
{
{
int
ret
=
OB_SUCCESS
;
int
ret
=
OB_SUCCESS
;
int64_t
int64_diff
=
0
;
int64_t
int64_diff
=
0
;
...
@@ -99,7 +99,7 @@ int ObExprTimeDiff::calc(ObObj& result, const ObObj& left, const ObObj& right, O
...
@@ -99,7 +99,7 @@ int ObExprTimeDiff::calc(ObObj& result, const ObObj& left, const ObObj& right, O
return
ret
;
return
ret
;
}
}
int
ObExprTimeDiff
::
cg_expr
(
ObExprCGCtx
&
op_cg_ctx
,
const
ObRawExpr
&
raw_expr
,
ObExpr
&
rt_expr
)
const
int
ObExprTimeDiff
::
cg_expr
(
ObExprCGCtx
&
op_cg_ctx
,
const
ObRawExpr
&
raw_expr
,
ObExpr
&
rt_expr
)
const
{
{
UNUSED
(
op_cg_ctx
);
UNUSED
(
op_cg_ctx
);
UNUSED
(
raw_expr
);
UNUSED
(
raw_expr
);
...
@@ -116,13 +116,13 @@ int ObExprTimeDiff::cg_expr(ObExprCGCtx& op_cg_ctx, const ObRawExpr& raw_expr, O
...
@@ -116,13 +116,13 @@ int ObExprTimeDiff::cg_expr(ObExprCGCtx& op_cg_ctx, const ObRawExpr& raw_expr, O
return
ret
;
return
ret
;
}
}
int
ObExprTimeDiff
::
calc_timediff
(
const
ObExpr
&
expr
,
ObEvalCtx
&
ctx
,
ObDatum
&
expr_datum
)
int
ObExprTimeDiff
::
calc_timediff
(
const
ObExpr
&
expr
,
ObEvalCtx
&
ctx
,
ObDatum
&
expr_datum
)
{
{
int
ret
=
OB_SUCCESS
;
int
ret
=
OB_SUCCESS
;
bool
calc_param_failure
=
false
;
bool
calc_param_failure
=
false
;
ObDatum
*
param_datum1
=
NULL
;
ObDatum
*
param_datum1
=
NULL
;
ObDatum
*
param_datum2
=
NULL
;
ObDatum
*
param_datum2
=
NULL
;
const
ObSQLSessionInfo
*
session
=
NULL
;
const
ObSQLSessionInfo
*
session
=
NULL
;
if
(
OB_ISNULL
(
session
=
ctx
.
exec_ctx_
.
get_my_session
()))
{
if
(
OB_ISNULL
(
session
=
ctx
.
exec_ctx_
.
get_my_session
()))
{
ret
=
OB_ERR_UNEXPECTED
;
ret
=
OB_ERR_UNEXPECTED
;
LOG_WARN
(
"session is null"
,
K
(
ret
));
LOG_WARN
(
"session is null"
,
K
(
ret
));
...
@@ -133,8 +133,8 @@ int ObExprTimeDiff::calc_timediff(const ObExpr& expr, ObEvalCtx& ctx, ObDatum& e
...
@@ -133,8 +133,8 @@ int ObExprTimeDiff::calc_timediff(const ObExpr& expr, ObEvalCtx& ctx, ObDatum& e
expr_datum
.
set_null
();
expr_datum
.
set_null
();
}
else
{
}
else
{
int64_t
int64_diff
=
0
;
int64_t
int64_diff
=
0
;
ObTime
ot1
;
ObTime
ot1
(
DT_TYPE_TIME
)
;
ObTime
ot2
;
ObTime
ot2
(
DT_TYPE_TIME
)
;
if
(
OB_FAIL
(
ob_datum_to_ob_time_without_date
(
if
(
OB_FAIL
(
ob_datum_to_ob_time_without_date
(
*
param_datum1
,
expr
.
args_
[
0
]
->
datum_meta_
.
type_
,
get_timezone_info
(
session
),
ot1
)))
{
*
param_datum1
,
expr
.
args_
[
0
]
->
datum_meta_
.
type_
,
get_timezone_info
(
session
),
ot1
)))
{
LOG_WARN
(
"cast the first param failed"
,
K
(
ret
));
LOG_WARN
(
"cast the first param failed"
,
K
(
ret
));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录