patch 4.0
This commit is contained in:
@ -14,7 +14,7 @@
|
||||
#include "ob_expr_tanh.h"
|
||||
#include "sql/engine/expr/ob_expr_util.h"
|
||||
#include "share/object/ob_obj_cast.h"
|
||||
#include "sql/parser/ob_item_type.h"
|
||||
#include "objit/common/ob_item_type.h"
|
||||
//#include "sql/engine/expr/ob_expr_promotion_util.h"
|
||||
#include "sql/session/ob_sql_session_info.h"
|
||||
#include <math.h>
|
||||
@ -22,45 +22,30 @@
|
||||
using namespace oceanbase::common;
|
||||
using namespace oceanbase::sql;
|
||||
|
||||
namespace oceanbase {
|
||||
namespace sql {
|
||||
ObExprTanh::ObExprTanh(ObIAllocator& alloc) : ObFuncExprOperator(alloc, T_FUN_SYS_TANH, N_TANH, 1, NOT_ROW_DIMENSION)
|
||||
{}
|
||||
namespace oceanbase
|
||||
{
|
||||
namespace sql
|
||||
{
|
||||
ObExprTanh::ObExprTanh(ObIAllocator &alloc)
|
||||
: ObFuncExprOperator(alloc, T_FUN_SYS_TANH, N_TANH, 1, NOT_ROW_DIMENSION)
|
||||
{
|
||||
}
|
||||
|
||||
ObExprTanh::~ObExprTanh()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
int ObExprTanh::calc_result_type1(ObExprResType& type, ObExprResType& type1, common::ObExprTypeCtx& type_ctx) const
|
||||
int ObExprTanh::calc_result_type1(ObExprResType &type,
|
||||
ObExprResType &type1,
|
||||
common::ObExprTypeCtx &type_ctx) const
|
||||
{
|
||||
return calc_trig_function_result_type1(type, type1, type_ctx);
|
||||
}
|
||||
|
||||
int ObExprTanh::calc_result1(ObObj& result, const ObObj& obj, ObExprCtx& expr_ctx) const
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (OB_UNLIKELY(OB_ISNULL(expr_ctx.calc_buf_))) {
|
||||
ret = OB_NOT_INIT;
|
||||
LOG_WARN("varchar buffer not init", K(ret));
|
||||
} else if (OB_UNLIKELY(obj.is_null())) {
|
||||
result.set_null();
|
||||
} else if (obj.is_number()) {
|
||||
number::ObNumber res_nmb;
|
||||
if (OB_FAIL(obj.get_number().tanh(res_nmb, *(expr_ctx.calc_buf_)))) {
|
||||
LOG_WARN("fail to calc tanh", K(obj), K(ret), K(res_nmb));
|
||||
} else {
|
||||
result.set_number(res_nmb);
|
||||
}
|
||||
} else if (obj.is_double()) {
|
||||
double arg = obj.get_double();
|
||||
double res = tanh(arg);
|
||||
result.set_double(res);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
DEF_CALC_TRIGONOMETRIC_EXPR(tanh, false, OB_SUCCESS);
|
||||
|
||||
int ObExprTanh::cg_expr(ObExprCGCtx& expr_cg_ctx, const ObRawExpr& raw_expr, ObExpr& rt_expr) const
|
||||
int ObExprTanh::cg_expr(ObExprCGCtx &expr_cg_ctx, const ObRawExpr &raw_expr,
|
||||
ObExpr &rt_expr) const
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
UNUSED(expr_cg_ctx);
|
||||
@ -69,5 +54,5 @@ int ObExprTanh::cg_expr(ObExprCGCtx& expr_cg_ctx, const ObRawExpr& raw_expr, ObE
|
||||
return ret;
|
||||
}
|
||||
|
||||
} // namespace sql
|
||||
} // namespace oceanbase
|
||||
} //namespace sql
|
||||
} //namespace oceanbase
|
||||
|
||||
Reference in New Issue
Block a user