patch 4.0
This commit is contained in:
@ -16,20 +16,25 @@
|
||||
#include "lib/ob_name_def.h"
|
||||
#include "sql/session/ob_sql_session_info.h"
|
||||
|
||||
namespace oceanbase {
|
||||
namespace oceanbase
|
||||
{
|
||||
using namespace common;
|
||||
namespace sql {
|
||||
namespace sql
|
||||
{
|
||||
|
||||
ObExprSysExtractUtc::ObExprSysExtractUtc(ObIAllocator& alloc)
|
||||
ObExprSysExtractUtc::ObExprSysExtractUtc(ObIAllocator &alloc)
|
||||
: ObFuncExprOperator(alloc, T_FUN_SYS_SYS_EXTRACT_UTC, N_SYS_EXTRACT_UTC, 1, NOT_ROW_DIMENSION)
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
int ObExprSysExtractUtc::calc_result_type1(
|
||||
ObExprResType& type, ObExprResType& input, common::ObExprTypeCtx& type_ctx) const
|
||||
int ObExprSysExtractUtc::calc_result_type1(ObExprResType &type,
|
||||
ObExprResType &input,
|
||||
common::ObExprTypeCtx &type_ctx) const
|
||||
{
|
||||
UNUSED(type_ctx);
|
||||
int ret = common::OB_SUCCESS;
|
||||
if (OB_UNLIKELY(!input.get_obj_meta().is_otimestamp_type() && !input.is_null())) {
|
||||
if (OB_UNLIKELY(!input.get_obj_meta().is_otimestamp_type()
|
||||
&& !input.is_null())) {
|
||||
ret = common::OB_ERR_INVALID_TYPE_FOR_ARGUMENT;
|
||||
|
||||
LOG_WARN("invalid type", K(input.get_type()));
|
||||
@ -41,28 +46,11 @@ int ObExprSysExtractUtc::calc_result_type1(
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObExprSysExtractUtc::calc_result1(common::ObObj& result, const common::ObObj& input, ObExprCtx& expr_ctx) const
|
||||
int ObExprSysExtractUtc::calc_sys_extract_utc(const ObExpr &expr, ObEvalCtx &ctx,
|
||||
ObDatum &res)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (OB_UNLIKELY(input.is_null())) {
|
||||
result.set_null();
|
||||
} else if (OB_UNLIKELY(!input.is_timestamp_tz())) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("input is not timestamp tz", K(input), K(ret));
|
||||
} else {
|
||||
ObOTimestampData tmp_res = input.get_otimestamp_value();
|
||||
tmp_res.time_ctx_.tz_desc_ = 0;
|
||||
tmp_res.time_ctx_.store_tz_id_ = 0;
|
||||
result.set_timestamp_nano(tmp_res);
|
||||
}
|
||||
UNUSED(expr_ctx);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObExprSysExtractUtc::calc_sys_extract_utc(const ObExpr& expr, ObEvalCtx& ctx, ObDatum& res)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObDatum* in = NULL;
|
||||
ObDatum *in = NULL;
|
||||
if (OB_FAIL(expr.eval_param_value(ctx, in))) {
|
||||
LOG_WARN("eval param failed", K(ret));
|
||||
} else if (in->is_null()) {
|
||||
@ -76,7 +64,8 @@ int ObExprSysExtractUtc::calc_sys_extract_utc(const ObExpr& expr, ObEvalCtx& ctx
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObExprSysExtractUtc::cg_expr(ObExprCGCtx& expr_cg_ctx, const ObRawExpr& raw_expr, ObExpr& rt_expr) const
|
||||
int ObExprSysExtractUtc::cg_expr(ObExprCGCtx &expr_cg_ctx, const ObRawExpr &raw_expr,
|
||||
ObExpr &rt_expr) const
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
UNUSED(expr_cg_ctx);
|
||||
@ -84,5 +73,5 @@ int ObExprSysExtractUtc::cg_expr(ObExprCGCtx& expr_cg_ctx, const ObRawExpr& raw_
|
||||
rt_expr.eval_func_ = calc_sys_extract_utc;
|
||||
return ret;
|
||||
}
|
||||
} // namespace sql
|
||||
} // namespace oceanbase
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user