Fix invalid precision of const int expr
This commit is contained in:
parent
4fe0b05c36
commit
aed2c173e2
@ -7373,6 +7373,19 @@ int ObAggregateProcessor::get_wm_concat_result(const ObAggrInfo &aggr_info,
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int get_param_int_val(ObExpr *expr, ObDatum *datum, int64_t &val)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (expr->obj_meta_.is_integer_type()) {
|
||||
val = datum->get_int();
|
||||
} else if (expr->obj_meta_.is_decimal_int()) {
|
||||
ret = ObExprUtil::trunc_decint2int64(datum->get_decimal_int(), datum->get_int_bytes(),
|
||||
expr->datum_meta_.scale_, val);
|
||||
} else if (expr->obj_meta_.is_number()) {
|
||||
ret = ObExprUtil::trunc_num2int64(*datum, val);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
int ObAggregateProcessor::init_topk_fre_histogram_item(
|
||||
const ObAggrInfo &aggr_info,
|
||||
ObTopKFrequencyHistograms *topk_fre_hist)
|
||||
@ -7407,18 +7420,16 @@ int ObAggregateProcessor::init_topk_fre_histogram_item(
|
||||
OB_ISNULL(item_size_result)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("get unexpected null", K(ret), K(window_size_result), K(item_size_result));
|
||||
} else if (OB_FAIL(ObExprUtil::get_int_param_val(
|
||||
window_size_result, aggr_info.window_size_param_expr_->obj_meta_.is_decimal_int(),
|
||||
window_size))
|
||||
|| OB_FAIL(ObExprUtil::get_int_param_val(
|
||||
item_size_result, aggr_info.item_size_param_expr_->obj_meta_.is_decimal_int(),
|
||||
item_size))
|
||||
|| (aggr_info.max_disuse_param_expr_ != NULL && OB_FAIL(ObExprUtil::get_int_param_val(
|
||||
max_disuse_cnt_result, aggr_info.max_disuse_param_expr_->obj_meta_.is_decimal_int(),
|
||||
max_disuse_cnt)))) {
|
||||
} else if (OB_FAIL(get_param_int_val(aggr_info.window_size_param_expr_, window_size_result,
|
||||
window_size))
|
||||
|| OB_FAIL(get_param_int_val(aggr_info.item_size_param_expr_,
|
||||
item_size_result, item_size))
|
||||
|| (aggr_info.max_disuse_param_expr_ != NULL
|
||||
&& OB_FAIL(get_param_int_val(aggr_info.max_disuse_param_expr_,
|
||||
max_disuse_cnt_result, max_disuse_cnt)))) {
|
||||
LOG_WARN("failed to get int param val", K(*window_size_result), K(window_size),
|
||||
K(*item_size_result), K(item_size),
|
||||
KPC(max_disuse_cnt_result), K(max_disuse_cnt), K(ret));
|
||||
KPC(max_disuse_cnt_result), K(max_disuse_cnt), K(ret));;
|
||||
} else {
|
||||
topk_fre_hist->set_window_size(window_size);
|
||||
topk_fre_hist->set_item_size(item_size);
|
||||
|
@ -5661,8 +5661,10 @@ int ObRawExprUtils::build_const_int_expr(ObRawExprFactory &expr_factory, ObObjTy
|
||||
LOG_WARN("failed to extract expr info", K(ret));
|
||||
} else {
|
||||
ObObj obj;
|
||||
ObAccuracy int_acc = ObAccuracy::DDL_DEFAULT_ACCURACY[type];
|
||||
obj.set_int(type, int_value);
|
||||
c_expr->set_value(obj);
|
||||
c_expr->set_accuracy(int_acc);
|
||||
expr = c_expr;
|
||||
}
|
||||
return ret;
|
||||
@ -5676,8 +5678,10 @@ int ObRawExprUtils::build_const_uint_expr(ObRawExprFactory &expr_factory, ObObjT
|
||||
LOG_WARN("fail to create const raw c_expr", K(ret));
|
||||
} else {
|
||||
ObObj obj;
|
||||
ObAccuracy int_acc = ObAccuracy::DDL_DEFAULT_ACCURACY[type];
|
||||
obj.set_uint(type, uint_value);
|
||||
c_expr->set_value(obj);
|
||||
c_expr->set_accuracy(int_acc);
|
||||
expr = c_expr;
|
||||
}
|
||||
return ret;
|
||||
|
@ -26,8 +26,8 @@ Query Plan
|
||||
===============================================
|
||||
Outputs & filters:
|
||||
-------------------------------------
|
||||
0 - output([INTERNAL_FUNCTION(t1.c1, 1, t2.c1, cast(1, BIGINT(20, 0)))]), filter(nil), rowset=16
|
||||
1 - output([INTERNAL_FUNCTION(t1.c1, 1, t2.c1, cast(1, BIGINT(20, 0)))]), filter(nil), rowset=16
|
||||
0 - output([INTERNAL_FUNCTION(t1.c1, 1, t2.c1, 1)]), filter(nil), rowset=16
|
||||
1 - output([INTERNAL_FUNCTION(t1.c1, 1, t2.c1, 1)]), filter(nil), rowset=16
|
||||
dop=3
|
||||
2 - output([t1.c1], [t2.c1]), filter(nil), rowset=16
|
||||
equal_conds([t1.c1 = t2.c1]), other_conds(nil)
|
||||
|
Loading…
x
Reference in New Issue
Block a user