[CP] fix bug about timestampdiff and timestampadd

This commit is contained in:
obdev
2023-04-13 08:33:02 +00:00
committed by ob-robot
parent 1723a953cc
commit 0442dd622b
3 changed files with 11 additions and 14 deletions

View File

@ -200,8 +200,8 @@ int ObExprTimeStampDiff::eval_timestamp_diff(const ObExpr &expr, ObEvalCtx &ctx,
} else {
int64_t res_int = 0;
bool is_null = false;
if (OB_FAIL(calc(res_int, is_null, u->get_int(), l->get_timestamp(),
r->get_timestamp(), session->get_timezone_info()))) {
if (OB_FAIL(calc(res_int, is_null, u->get_int(), l->get_datetime(),
r->get_datetime(), session->get_timezone_info()))) {
LOG_WARN("calc failed", K(ret));
} else if (is_null) {
res.set_null();
@ -220,8 +220,8 @@ int ObExprTimeStampDiff::cg_expr(ObExprCGCtx &ctx, const ObRawExpr &raw_expr,
UNUSED(raw_expr);
CK(3 == rt_expr.arg_cnt_);
CK(ObIntType == rt_expr.args_[0]->datum_meta_.type_ &&
ObTimestampType == rt_expr.args_[1]->datum_meta_.type_ &&
ObTimestampType == rt_expr.args_[2]->datum_meta_.type_);
ObDateTimeType == rt_expr.args_[1]->datum_meta_.type_ &&
ObDateTimeType == rt_expr.args_[2]->datum_meta_.type_);
OX(rt_expr.eval_func_ = eval_timestamp_diff);
return ret;
}