patch 4.0
This commit is contained in:
@ -19,43 +19,22 @@
|
||||
|
||||
using namespace oceanbase::sql;
|
||||
using namespace oceanbase::common;
|
||||
namespace oceanbase {
|
||||
namespace sql {
|
||||
|
||||
ObExprBitNeg::ObExprBitNeg(ObIAllocator& alloc)
|
||||
: ObBitwiseExprOperator(alloc, T_OP_BIT_NEG, N_BIT_NEG, 1, NOT_ROW_DIMENSION)
|
||||
{}
|
||||
|
||||
int ObExprBitNeg::calc_result1(ObObj& res, const ObObj& obj1, ObExprCtx& expr_ctx) const
|
||||
namespace oceanbase
|
||||
{
|
||||
namespace sql
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (OB_ISNULL(expr_ctx.calc_buf_)) {
|
||||
ret = OB_NOT_INIT;
|
||||
LOG_WARN("buf not init", K(ret));
|
||||
} else if (obj1.is_null()) {
|
||||
res.set_null();
|
||||
} else {
|
||||
uint64_t uint64_v1 = 0;
|
||||
if (OB_SUCC(ret)) {
|
||||
const bool is_round = true;
|
||||
if (OB_FAIL(ObBitwiseExprOperator::get_uint64(obj1, expr_ctx, is_round, uint64_v1))) {
|
||||
LOG_WARN("fail to get uint64_t", K(obj1), K(ret));
|
||||
} else {
|
||||
uint64_t bit_neg_res = ~uint64_v1;
|
||||
res.set_uint64(bit_neg_res);
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObExprBitNeg::calc_bitneg_expr(const ObExpr& expr, ObEvalCtx& ctx, ObDatum& res_datum)
|
||||
ObExprBitNeg::ObExprBitNeg(ObIAllocator &alloc)
|
||||
: ObBitwiseExprOperator(alloc, T_OP_BIT_NEG, N_BIT_NEG, 1, NOT_ROW_DIMENSION) {}
|
||||
|
||||
int ObExprBitNeg::calc_bitneg_expr(const ObExpr &expr, ObEvalCtx &ctx,
|
||||
ObDatum& res_datum)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
uint64_t uint_val = 0;
|
||||
ObDatum* child_res = NULL;
|
||||
ObDatum *child_res = NULL;
|
||||
ObCastMode cast_mode = CM_NONE;
|
||||
void* get_uint_func = NULL;
|
||||
void *get_uint_func = NULL;
|
||||
if (OB_UNLIKELY(1 != expr.arg_cnt_)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("invalid arg cnt", K(ret), K(expr.arg_cnt_));
|
||||
@ -65,9 +44,11 @@ int ObExprBitNeg::calc_bitneg_expr(const ObExpr& expr, ObEvalCtx& ctx, ObDatum&
|
||||
res_datum.set_null();
|
||||
} else if (OB_FAIL(choose_get_int_func(expr.args_[0]->datum_meta_.type_, get_uint_func))) {
|
||||
LOG_WARN("choose_get_int_func failed", K(ret), K(expr.args_[0]->datum_meta_));
|
||||
} else if (OB_FAIL(ObSQLUtils::get_default_cast_mode(false, 0, ctx.exec_ctx_.get_my_session(), cast_mode))) {
|
||||
} else if (OB_FAIL(ObSQLUtils::get_default_cast_mode(false, 0,
|
||||
ctx.exec_ctx_.get_my_session(), cast_mode))) {
|
||||
LOG_WARN("get_default_cast_mode failed", K(ret));
|
||||
} else if (OB_FAIL((reinterpret_cast<GetUIntFunc>(get_uint_func)(*child_res, true, uint_val, cast_mode)))) {
|
||||
} else if (OB_FAIL((reinterpret_cast<GetUIntFunc>(get_uint_func)(*child_res, true,
|
||||
uint_val, cast_mode)))) {
|
||||
LOG_WARN("get uint from datum failed", K(ret), K(*child_res), K(cast_mode));
|
||||
} else {
|
||||
res_datum.set_uint(~uint_val);
|
||||
@ -75,7 +56,8 @@ int ObExprBitNeg::calc_bitneg_expr(const ObExpr& expr, ObEvalCtx& ctx, ObDatum&
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObExprBitNeg::cg_expr(ObExprCGCtx& expr_cg_ctx, const ObRawExpr& raw_expr, ObExpr& rt_expr) const
|
||||
int ObExprBitNeg::cg_expr(ObExprCGCtx &expr_cg_ctx, const ObRawExpr &raw_expr,
|
||||
ObExpr &rt_expr) const
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
const BitOperator op = BIT_NEG;
|
||||
@ -87,5 +69,5 @@ int ObExprBitNeg::cg_expr(ObExprCGCtx& expr_cg_ctx, const ObRawExpr& raw_expr, O
|
||||
|
||||
return ret;
|
||||
}
|
||||
} // namespace sql
|
||||
} // namespace oceanbase
|
||||
}//end of ns sql
|
||||
}//end of ns oceanbase
|
||||
|
||||
Reference in New Issue
Block a user