Merge branch 'column_store'

Co-authored-by: wangt1xiuyi <13547954130@163.com>
Co-authored-by: yangqise7en <877793735@qq.com>
Co-authored-by: Zach41 <zach_41@163.com>
This commit is contained in:
chaser-ch
2023-10-31 15:39:20 +00:00
committed by ob-robot
parent 4057fbc4ae
commit 566e920620
1375 changed files with 239147 additions and 56014 deletions

View File

@ -1107,7 +1107,9 @@ int ObIntSysVar::check_update_type(const ObSetVar &set_var, const ObObj &val)
if (true == set_var.is_set_default_
|| (0 != (flags_ & ObSysVarFlag::NULLABLE) && ObNullType == val.get_type())) {
// do nothing
} else if (false == ob_is_integer_type(val.get_type()) && ObNumberType != val.get_type()) {
} else if (false == ob_is_integer_type(val.get_type())
&& ObNumberType != val.get_type()
&& ObDecimalIntType != val.get_type()) {
ret = OB_ERR_WRONG_TYPE_FOR_VAR;
LOG_WARN("wrong type for var", K(ret), K(val));
}
@ -1136,6 +1138,17 @@ int ObIntSysVar::do_check_and_convert(ObExecContext &ctx,
return ret;
}
#define CHECK_DECIMAL_INT_VALID(TYPE) \
case sizeof(TYPE##_t): { \
const TYPE##_t &l = *(decint->TYPE##_v_); \
const TYPE##_t r = get_scale_factor<TYPE##_t>(scale); \
is_in_val_valid = ((l % r) == 0); \
if (is_in_val_valid) { \
div_res_val.from(l / r); \
} \
break; \
}
int ObIntSysVar::do_convert(ObExecContext &ctx,
const common::ObObj &in_val,
common::ObObj &out_val,
@ -1175,6 +1188,47 @@ int ObIntSysVar::do_convert(ObExecContext &ctx,
ret = OB_ERR_WRONG_TYPE_FOR_VAR;
LOG_WARN("wrong type for int variables", K(ret), K(in_val));
}
} else if (ObDecimalIntType == in_val.get_type()) {
bool is_in_val_valid = false;
const ObDecimalInt *decint = in_val.get_decimal_int();
const int32_t int_bytes = in_val.get_int_bytes();
const int16_t scale = in_val.get_scale();
ObDecimalIntBuilder div_res_val;
switch (int_bytes) {
CHECK_DECIMAL_INT_VALID(int32)
CHECK_DECIMAL_INT_VALID(int64)
CHECK_DECIMAL_INT_VALID(int128)
CHECK_DECIMAL_INT_VALID(int256)
CHECK_DECIMAL_INT_VALID(int512)
default: {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("int_bytes is unexpected", K(ret), K(int_bytes));
break;
}
}
if (OB_SUCC(ret)) {
if (is_in_val_valid) {
int64_t tmp_int = 0;
uint64_t tmp_uint = 0;
if (OB_FAIL(wide::check_range_valid_int64(div_res_val.get_decimal_int(),
div_res_val.get_int_bytes(), is_in_val_valid, tmp_int))) {
LOG_WARN("check_range_valid_int64 failed", K(ret), K(div_res_val.get_int_bytes()));
} else if (is_in_val_valid) {
tmp_obj.set_int(tmp_int);
} else if (OB_FAIL(wide::check_range_valid_uint64(div_res_val.get_decimal_int(),
div_res_val.get_int_bytes(), is_in_val_valid, tmp_uint))) {
LOG_WARN("check_range_valid_uint64 failed", K(ret), K(div_res_val.get_int_bytes()));
} else if (is_in_val_valid) {
tmp_obj.set_uint64(tmp_uint);
} else {
ret = OB_ERR_WRONG_TYPE_FOR_VAR;
LOG_WARN("wrong type for int variables", K(ret), K(in_val), K(int_bytes), K(scale));
}
} else {
ret = OB_ERR_WRONG_TYPE_FOR_VAR;
LOG_WARN("wrong type for int variables", K(ret), K(in_val), K(int_bytes), K(scale));
}
}
} else {
tmp_obj = in_val;
}
@ -1221,6 +1275,7 @@ int ObIntSysVar::do_convert(ObExecContext &ctx,
}
return ret;
}
#undef CHECK_DECIMAL_INT_VALID
int ObStrictRangeIntSysVar::do_check_and_convert(ObExecContext &ctx,
const ObSetVar &set_var,