Do not report ERROR when sample rate equals 100
This commit is contained in:
@ -121,7 +121,6 @@ int ObExprMinus::calc_result_type2(ObExprResType &type,
|
||||
} else if (is_oracle && type.get_precision() > OB_MAX_NUMBER_PRECISION) {
|
||||
type1.set_calc_type(ObNumberType);
|
||||
type2.set_calc_type(ObNumberType);
|
||||
type.set_number();
|
||||
} else {
|
||||
if (ObRawExprUtils::decimal_int_need_cast(type1.get_accuracy(), type.get_accuracy()) ||
|
||||
ObRawExprUtils::decimal_int_need_cast(type2.get_accuracy(), type.get_accuracy())) {
|
||||
@ -643,7 +642,6 @@ int ObExprMinus::cg_expr(ObExprCGCtx &op_cg_ctx,
|
||||
LOG_WARN("child is null", K(ret), K(rt_expr.args_[0]), K(rt_expr.args_[1]));
|
||||
} else {
|
||||
rt_expr.eval_func_ = NULL;
|
||||
rt_expr.may_not_need_raw_check_ = false;
|
||||
const ObObjType left_type = rt_expr.args_[0]->datum_meta_.type_;
|
||||
const ObObjType right_type = rt_expr.args_[1]->datum_meta_.type_;
|
||||
const ObObjType result_type = rt_expr.datum_meta_.type_;
|
||||
@ -652,20 +650,15 @@ int ObExprMinus::cg_expr(ObExprCGCtx &op_cg_ctx,
|
||||
|
||||
switch (result_type) {
|
||||
case ObIntType:
|
||||
rt_expr.may_not_need_raw_check_ = true;
|
||||
SET_MINUS_FUNC_PTR(minus_int_int);
|
||||
rt_expr.eval_vector_func_ = minus_int_int_vector;
|
||||
break;
|
||||
case ObUInt64Type:
|
||||
if (ObIntTC == left_tc && ObUIntTC == right_tc) {
|
||||
SET_MINUS_FUNC_PTR(minus_int_uint);
|
||||
rt_expr.eval_vector_func_ = minus_int_uint_vector;
|
||||
} else if (ObUIntTC == left_tc && ObIntTC == right_tc) {
|
||||
SET_MINUS_FUNC_PTR(minus_uint_int);
|
||||
rt_expr.eval_vector_func_ = minus_uint_int_vector;
|
||||
} else if (ObUIntTC == left_tc && ObUIntTC == right_tc) {
|
||||
SET_MINUS_FUNC_PTR(minus_uint_uint);
|
||||
rt_expr.eval_vector_func_ = minus_uint_uint_vector;
|
||||
}
|
||||
break;
|
||||
case ObIntervalYMType:
|
||||
@ -712,11 +705,9 @@ int ObExprMinus::cg_expr(ObExprCGCtx &op_cg_ctx,
|
||||
break;
|
||||
case ObFloatType:
|
||||
SET_MINUS_FUNC_PTR(minus_float_float);
|
||||
rt_expr.eval_vector_func_ = minus_float_float_vector;
|
||||
break;
|
||||
case ObDoubleType:
|
||||
SET_MINUS_FUNC_PTR(minus_double_double);
|
||||
rt_expr.eval_vector_func_ = minus_double_double_vector;
|
||||
break;
|
||||
case ObUNumberType:
|
||||
case ObNumberType:
|
||||
@ -726,15 +717,12 @@ int ObExprMinus::cg_expr(ObExprCGCtx &op_cg_ctx,
|
||||
switch (get_decimalint_type(rt_expr.args_[0]->datum_meta_.precision_)) {
|
||||
case DECIMAL_INT_32:
|
||||
SET_MINUS_FUNC_PTR(minus_decimalint32_oracle);
|
||||
rt_expr.eval_vector_func_ = minus_decimalint32_oracle_vector;
|
||||
break;
|
||||
case DECIMAL_INT_64:
|
||||
SET_MINUS_FUNC_PTR(minus_decimalint64_oracle);
|
||||
rt_expr.eval_vector_func_ = minus_decimalint64_oracle_vector;
|
||||
break;
|
||||
case DECIMAL_INT_128:
|
||||
SET_MINUS_FUNC_PTR(minus_decimalint128_oracle);
|
||||
rt_expr.eval_vector_func_ = minus_decimalint128_oracle_vector;
|
||||
break;
|
||||
default:
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
@ -743,34 +731,27 @@ int ObExprMinus::cg_expr(ObExprCGCtx &op_cg_ctx,
|
||||
}
|
||||
} else {
|
||||
SET_MINUS_FUNC_PTR(minus_number_number);
|
||||
rt_expr.eval_vector_func_ = minus_number_number_vector;
|
||||
}
|
||||
break;
|
||||
case ObDecimalIntType:
|
||||
switch (get_decimalint_type(rt_expr.datum_meta_.precision_)) {
|
||||
case DECIMAL_INT_32:
|
||||
SET_MINUS_FUNC_PTR(minus_decimalint32);
|
||||
rt_expr.eval_vector_func_ = minus_decimalint32_vector;
|
||||
break;
|
||||
case DECIMAL_INT_64:
|
||||
SET_MINUS_FUNC_PTR(minus_decimalint64);
|
||||
rt_expr.eval_vector_func_ = minus_decimalint64_vector;
|
||||
break;
|
||||
case DECIMAL_INT_128:
|
||||
SET_MINUS_FUNC_PTR(minus_decimalint128);
|
||||
rt_expr.eval_vector_func_ = minus_decimalint128_vector;
|
||||
break;
|
||||
case DECIMAL_INT_256:
|
||||
SET_MINUS_FUNC_PTR(minus_decimalint256);
|
||||
rt_expr.eval_vector_func_ = minus_decimalint256_vector;
|
||||
break;
|
||||
case DECIMAL_INT_512:
|
||||
if (rt_expr.datum_meta_.precision_ < OB_MAX_DECIMAL_POSSIBLE_PRECISION) {
|
||||
SET_MINUS_FUNC_PTR(minus_decimalint512);
|
||||
rt_expr.eval_vector_func_ = minus_decimalint512_vector;
|
||||
} else {
|
||||
SET_MINUS_FUNC_PTR(minus_decimalint512_with_check);
|
||||
rt_expr.eval_vector_func_ = minus_decimalint512_with_check_vector;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@ -826,12 +807,6 @@ int ObExprMinus::minus_int_int_batch(BATCH_EVAL_FUNC_ARG_DECL)
|
||||
return def_batch_arith_op<ObArithOpWrap<ObIntIntBatchMinusRaw>>(BATCH_EVAL_FUNC_ARG_LIST);
|
||||
}
|
||||
|
||||
int ObExprMinus::minus_int_int_vector(VECTOR_EVAL_FUNC_ARG_DECL)
|
||||
{
|
||||
return def_fixed_len_vector_arith_op<ObVectorArithOpWrap<ObIntIntBatchMinusRaw>>(VECTOR_EVAL_FUNC_ARG_LIST);
|
||||
}
|
||||
|
||||
|
||||
struct ObIntUIntBatchMinusRaw : public ObArithOpRawType<uint64_t, int64_t, uint64_t>
|
||||
{
|
||||
static void raw_op(uint64_t &res, const int64_t l, const uint64_t r)
|
||||
@ -867,12 +842,6 @@ int ObExprMinus::minus_int_uint_batch(BATCH_EVAL_FUNC_ARG_DECL)
|
||||
return def_batch_arith_op<ObArithOpWrap<ObIntUIntBatchMinusRaw>>(BATCH_EVAL_FUNC_ARG_LIST);
|
||||
}
|
||||
|
||||
int ObExprMinus::minus_int_uint_vector(VECTOR_EVAL_FUNC_ARG_DECL)
|
||||
{
|
||||
return def_fixed_len_vector_arith_op<ObVectorArithOpWrap<ObIntUIntBatchMinusRaw>>(
|
||||
VECTOR_EVAL_FUNC_ARG_LIST);
|
||||
}
|
||||
|
||||
struct ObUIntUIntBatchMinusRaw : public ObArithOpRawType<uint64_t, uint64_t, uint64_t>
|
||||
{
|
||||
static void raw_op(uint64_t &res, const uint64_t l, const uint64_t r)
|
||||
@ -908,12 +877,6 @@ int ObExprMinus::minus_uint_uint_batch(BATCH_EVAL_FUNC_ARG_DECL)
|
||||
return def_batch_arith_op<ObArithOpWrap<ObUIntUIntBatchMinusRaw>>(BATCH_EVAL_FUNC_ARG_LIST);
|
||||
}
|
||||
|
||||
int ObExprMinus::minus_uint_uint_vector(VECTOR_EVAL_FUNC_ARG_DECL)
|
||||
{
|
||||
return def_fixed_len_vector_arith_op<ObVectorArithOpWrap<ObUIntUIntBatchMinusRaw>>(
|
||||
VECTOR_EVAL_FUNC_ARG_LIST);
|
||||
}
|
||||
|
||||
struct ObUIntIntBatchMinusRaw : public ObArithOpRawType<uint64_t, uint64_t, int64_t>
|
||||
{
|
||||
static void raw_op(uint64_t &res, const uint64_t l, const int64_t r)
|
||||
@ -949,12 +912,6 @@ int ObExprMinus::minus_uint_int_batch(BATCH_EVAL_FUNC_ARG_DECL)
|
||||
return def_batch_arith_op<ObArithOpWrap<ObUIntIntBatchMinusRaw>>(BATCH_EVAL_FUNC_ARG_LIST);
|
||||
}
|
||||
|
||||
int ObExprMinus::minus_uint_int_vector(VECTOR_EVAL_FUNC_ARG_DECL)
|
||||
{
|
||||
return def_fixed_len_vector_arith_op<ObVectorArithOpWrap<ObUIntIntBatchMinusRaw>>(
|
||||
VECTOR_EVAL_FUNC_ARG_LIST);
|
||||
}
|
||||
|
||||
struct ObFloatBatchMinusRawNoCheck : public ObArithOpRawType<float, float, float>
|
||||
{
|
||||
static void raw_op(float &res, const float l, const float r)
|
||||
@ -1003,15 +960,6 @@ int ObExprMinus::minus_float_float_batch(BATCH_EVAL_FUNC_ARG_DECL)
|
||||
: def_batch_arith_op<ObArithOpWrap<ObFloatBatchMinusRawWithCheck>>(BATCH_EVAL_FUNC_ARG_LIST);
|
||||
}
|
||||
|
||||
int ObExprMinus::minus_float_float_vector(VECTOR_EVAL_FUNC_ARG_DECL)
|
||||
{
|
||||
return lib::is_oracle_mode() ?
|
||||
def_fixed_len_vector_arith_op<ObVectorArithOpWrap<ObFloatBatchMinusRawNoCheck>>(
|
||||
VECTOR_EVAL_FUNC_ARG_LIST) :
|
||||
def_fixed_len_vector_arith_op<ObVectorArithOpWrap<ObFloatBatchMinusRawWithCheck>>(
|
||||
VECTOR_EVAL_FUNC_ARG_LIST);
|
||||
}
|
||||
|
||||
struct ObDoubleBatchMinusRawNoCheck : public ObArithOpRawType<double, double, double>
|
||||
{
|
||||
static void raw_op(double &res, const double l, const double r)
|
||||
@ -1060,15 +1008,6 @@ int ObExprMinus::minus_double_double_batch(BATCH_EVAL_FUNC_ARG_DECL)
|
||||
: def_batch_arith_op<ObArithOpWrap<ObDoubleBatchMinusRawWithCheck>>(BATCH_EVAL_FUNC_ARG_LIST);
|
||||
}
|
||||
|
||||
int ObExprMinus::minus_double_double_vector(VECTOR_EVAL_FUNC_ARG_DECL)
|
||||
{
|
||||
return lib::is_oracle_mode() || T_OP_AGG_MINUS == expr.type_ ?
|
||||
def_fixed_len_vector_arith_op<ObVectorArithOpWrap<ObDoubleBatchMinusRawNoCheck>>(
|
||||
VECTOR_EVAL_FUNC_ARG_LIST) :
|
||||
def_fixed_len_vector_arith_op<ObVectorArithOpWrap<ObDoubleBatchMinusRawWithCheck>>(
|
||||
VECTOR_EVAL_FUNC_ARG_LIST);
|
||||
}
|
||||
|
||||
struct ObNumberMinusFunc
|
||||
{
|
||||
int operator()(ObDatum &res, const ObDatum &l, const ObDatum &r) const
|
||||
@ -1156,26 +1095,6 @@ int ObExprMinus::minus_number_number_batch(BATCH_EVAL_FUNC_ARG_DECL)
|
||||
return ret;
|
||||
}
|
||||
|
||||
struct NmbTryFastMinusOp
|
||||
{
|
||||
OB_INLINE bool operator()(ObNumber &l_num, ObNumber &r_num, uint32_t *res_digit,
|
||||
ObNumberDesc &res_desc)
|
||||
{
|
||||
return ObNumber::try_fast_minus(l_num, r_num, res_digit, res_desc);
|
||||
}
|
||||
OB_INLINE int operator()(const ObNumber &left, const ObNumber &right, ObNumber &value,
|
||||
ObIAllocator &allocator)
|
||||
{
|
||||
return ObNumber::sub_v3(left, right, value, allocator);
|
||||
}
|
||||
};
|
||||
|
||||
int ObExprMinus::minus_number_number_vector(VECTOR_EVAL_FUNC_ARG_DECL)
|
||||
{
|
||||
NmbTryFastMinusOp op;
|
||||
return def_number_vector_arith_op(VECTOR_EVAL_FUNC_ARG_LIST, op);
|
||||
}
|
||||
|
||||
struct ObIntervalYMIntervalYMMinusFunc
|
||||
{
|
||||
int operator()(ObDatum &res, const ObDatum &l, const ObDatum &r) const
|
||||
@ -1705,13 +1624,8 @@ int ObExprMinus::minus_decimal##TYPE(EVAL_FUNC_ARG_DECL) \
|
||||
int ObExprMinus::minus_decimal##TYPE##_batch(BATCH_EVAL_FUNC_ARG_DECL) \
|
||||
{ \
|
||||
return def_batch_arith_op<ObArithOpWrap<ObDecimalIntBatchMinusRaw<TYPE##_t>>>(BATCH_EVAL_FUNC_ARG_LIST); \
|
||||
} \
|
||||
int ObExprMinus::minus_decimal##TYPE##_vector(VECTOR_EVAL_FUNC_ARG_DECL) \
|
||||
{ \
|
||||
return def_fixed_len_vector_arith_op<ObVectorArithOpWrap<ObDecimalIntBatchMinusRaw<TYPE##_t>>>(VECTOR_EVAL_FUNC_ARG_LIST); \
|
||||
}
|
||||
|
||||
|
||||
DECINC_MINUS_EVAL_FUNC_DECL(int32)
|
||||
DECINC_MINUS_EVAL_FUNC_DECL(int64)
|
||||
DECINC_MINUS_EVAL_FUNC_DECL(int128)
|
||||
@ -1728,12 +1642,6 @@ int ObExprMinus::minus_decimalint512_with_check_batch(BATCH_EVAL_FUNC_ARG_DECL)
|
||||
return def_batch_arith_op<ObArithOpWrap<ObDecimalIntBatchMinusRawWithCheck>>(BATCH_EVAL_FUNC_ARG_LIST);
|
||||
}
|
||||
|
||||
int ObExprMinus::minus_decimalint512_with_check_vector(VECTOR_EVAL_FUNC_ARG_DECL)
|
||||
{
|
||||
return def_fixed_len_vector_arith_op<ObVectorArithOpWrap<ObDecimalIntBatchMinusRawWithCheck>>(
|
||||
VECTOR_EVAL_FUNC_ARG_LIST);
|
||||
}
|
||||
|
||||
#undef DECINC_MINUS_EVAL_FUNC_DECL
|
||||
|
||||
template<typename T>
|
||||
@ -1755,27 +1663,6 @@ struct ObDecimalOracleMinusFunc
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct ObDecimalOracleVectorMinusFunc
|
||||
{
|
||||
template <typename ResVector, typename LeftVector, typename RightVector>
|
||||
int operator()(ResVector &res_vec, const LeftVector &l_vec, const RightVector &r_vec,
|
||||
const int64_t idx, const int64_t scale, ObNumStackOnceAlloc &alloc) const
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
const T res_int = *reinterpret_cast<const T *>(l_vec.get_payload(idx))
|
||||
- *reinterpret_cast<const T *>(r_vec.get_payload(idx));
|
||||
number::ObNumber res_num;
|
||||
if (OB_FAIL(wide::to_number(res_int, scale, alloc, res_num))) {
|
||||
LOG_WARN("fail to cast decima int to number", K(ret), K(scale));
|
||||
} else {
|
||||
res_vec.set_number(idx, res_num);
|
||||
alloc.free(); // for batch function reuse alloc
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
};
|
||||
|
||||
#define DECINC_MINUS_EVAL_FUNC_ORA_DECL(TYPE) \
|
||||
int ObExprMinus::minus_decimal##TYPE##_oracle(EVAL_FUNC_ARG_DECL) \
|
||||
{ \
|
||||
@ -1788,12 +1675,6 @@ int ObExprMinus::minus_decimal##TYPE##_oracle_batch(BATCH_EVAL_FUNC_ARG_DECL)
|
||||
ObNumStackOnceAlloc tmp_alloc; \
|
||||
const int64_t scale = expr.args_[0]->datum_meta_.scale_; \
|
||||
return def_batch_arith_op_by_datum_func<ObDecimalOracleMinusFunc<TYPE##_t>>(BATCH_EVAL_FUNC_ARG_LIST, scale, tmp_alloc); \
|
||||
} \
|
||||
int ObExprMinus::minus_decimal##TYPE##_oracle_vector(VECTOR_EVAL_FUNC_ARG_DECL) \
|
||||
{ \
|
||||
ObNumStackOnceAlloc tmp_alloc; \
|
||||
const int64_t scale = expr.args_[0]->datum_meta_.scale_; \
|
||||
return def_fixed_len_vector_arith_op_func<ObDecimalOracleVectorMinusFunc<TYPE##_t>>(VECTOR_EVAL_FUNC_ARG_LIST, scale, tmp_alloc); \
|
||||
}
|
||||
|
||||
DECINC_MINUS_EVAL_FUNC_ORA_DECL(int32)
|
||||
|
||||
Reference in New Issue
Block a user