提交 b1581e36 编写于 作者: B br0 提交者: wangzelin.wzl

[WhiteScan] Fix some white scan errors

上级 875865e0
......@@ -403,7 +403,6 @@ int ObExprDiv::div_interval(
res.set_scale(ObAccuracy::MAX_ACCURACY2[ORACLE_MODE][res.get_type()].get_scale());
UNUSED(calc_scale);
return ret;
return ret;
}
const ObScale ObExprDiv::DIV_CALC_SCALE = 9;
......
......@@ -574,15 +574,18 @@ int ObExprFuncPartHash::calc_oracle_vt_part_id(ObTaskExecutorCtx& task_exec_ctx,
} else {
ObString ip = objs_stack[0].get_string();
number::ObNumber port_num;
objs_stack[1].get_number(port_num);
int32_t port = atoi(port_num.format());
ObAddr addr;
addr.set_ip_addr(ip, port);
int64_t part_id = OB_INVALID_ID;
if (OB_FAIL(task_exec_ctx.calc_virtual_partition_id(table_id, addr, part_id))) {
LOG_WARN("calculate virtual table partition id failed", K(table_id), K(addr));
if (OB_FAIL(objs_stack[1].get_number(port_num))) {
LOG_WARN("Get port_number failed.", K(ret));
} else {
result.set_int(part_id);
int32_t port = atoi(port_num.format());
ObAddr addr;
addr.set_ip_addr(ip, port);
int64_t part_id = OB_INVALID_ID;
if (OB_FAIL(task_exec_ctx.calc_virtual_partition_id(table_id, addr, part_id))) {
LOG_WARN("calculate virtual table partition id failed", K(table_id), K(addr));
} else {
result.set_int(part_id);
}
}
}
return ret;
......
......@@ -182,6 +182,7 @@ class ObExprInOrNotIn : public ObVectorExprOperator {
public:
ObExprInCtx()
: ObExprOperatorCtx(),
row_dimension_(-1),
right_has_null(false),
hash_func_buff_(NULL),
funcs_ptr_set(false),
......
......@@ -45,61 +45,56 @@ int ObExprBaseLeastGreatest::calc_result_typeN_oracle(
ret = OB_INVALID_ARGUMENT;
LOG_WARN("types is null or param_num is wrong", K(types), K(param_num), K(ret));
} else {
if (OB_ISNULL(types) || OB_UNLIKELY(param_num < 1)) {
ret = OB_INVALID_ARGUMENT;
LOG_WARN("types is null or param_num is wrong", K(types), K(param_num), K(ret));
ObExprResType& first_type = types[0];
type = first_type;
if (ObIntTC == first_type.get_type_class() || ObUIntTC == first_type.get_type_class() ||
ObNumberTC == first_type.get_type_class()) {
type.set_type(ObNumberType);
type.set_calc_type(ObNumberType);
type.set_scale(ORA_NUMBER_SCALE_UNKNOWN_YET);
type.set_precision(PRECISION_UNKNOWN_YET);
} else if (ObLongTextType == type.get_type()) {
ret = OB_ERR_INVALID_TYPE_FOR_OP;
LOG_WARN("lob type parameter not expected", K(ret));
} else {
ObExprResType& first_type = types[0];
type = first_type;
if (ObIntTC == first_type.get_type_class() || ObUIntTC == first_type.get_type_class() ||
ObNumberTC == first_type.get_type_class()) {
type.set_type(ObNumberType);
type.set_calc_type(ObNumberType);
type.set_scale(ORA_NUMBER_SCALE_UNKNOWN_YET);
type.set_precision(PRECISION_UNKNOWN_YET);
} else if (ObLongTextType == type.get_type()) {
ret = OB_ERR_INVALID_TYPE_FOR_OP;
LOG_WARN("lob type parameter not expected", K(ret));
} else {
type.set_type(first_type.get_type());
type.set_calc_type(first_type.get_type());
}
if (ObStringTC == type.get_type_class()) {
int64_t max_length = 0;
int64_t all_char = 0;
for (int64_t i = 0; OB_SUCC(ret) && i < param_num; i++) {
int64_t item_length = 0;
if (ObStringTC == types[i].get_type_class() || ObLongTextType == types[i].get_type()) {
item_length = types[i].get_length();
if (LS_CHAR == types[i].get_length_semantics()) {
item_length = item_length * 4;
all_char++;
}
} else if (ObNumberTC == types[i].get_type_class() || ObIntTC == types[i].get_type_class() ||
ObUIntTC == types[i].get_type_class()) {
item_length = number::ObNumber::MAX_PRECISION - number::ObNumber::MIN_SCALE;
} else if (ObOTimestampTC == types[i].get_type_class() || ObFloatTC == types[i].get_type_class() ||
ObDoubleTC == types[i].get_type_class() || ObNullTC == types[i].get_type_class()) {
item_length = 40;
} else if (ObDateTimeTC == types[i].get_type_class()) {
item_length = 19;
} else {
ret = OB_NOT_SUPPORTED;
LOG_WARN("unsupported type", K(ret), K(types[i]), K(types[i].get_type_class()));
}
type.set_type(first_type.get_type());
type.set_calc_type(first_type.get_type());
}
if (OB_SUCC(ret)) {
max_length = MAX(max_length, item_length);
if (ObStringTC == type.get_type_class()) {
int64_t max_length = 0;
int64_t all_char = 0;
for (int64_t i = 0; OB_SUCC(ret) && i < param_num; i++) {
int64_t item_length = 0;
if (ObStringTC == types[i].get_type_class() || ObLongTextType == types[i].get_type()) {
item_length = types[i].get_length();
if (LS_CHAR == types[i].get_length_semantics()) {
item_length = item_length * 4;
all_char++;
}
} else if (ObNumberTC == types[i].get_type_class() || ObIntTC == types[i].get_type_class() ||
ObUIntTC == types[i].get_type_class()) {
item_length = number::ObNumber::MAX_PRECISION - number::ObNumber::MIN_SCALE;
} else if (ObOTimestampTC == types[i].get_type_class() || ObFloatTC == types[i].get_type_class() ||
ObDoubleTC == types[i].get_type_class() || ObNullTC == types[i].get_type_class()) {
item_length = 40;
} else if (ObDateTimeTC == types[i].get_type_class()) {
item_length = 19;
} else {
ret = OB_NOT_SUPPORTED;
LOG_WARN("unsupported type", K(ret), K(types[i]), K(types[i].get_type_class()));
}
if (OB_SUCC(ret)) {
if (all_char == param_num) {
type.set_length(static_cast<ObLength>(max_length / 4));
type.set_length_semantics(LS_CHAR);
} else {
type.set_length(static_cast<ObLength>(max_length));
}
max_length = MAX(max_length, item_length);
}
}
if (OB_SUCC(ret)) {
if (all_char == param_num) {
type.set_length(static_cast<ObLength>(max_length / 4));
type.set_length_semantics(LS_CHAR);
} else {
type.set_length(static_cast<ObLength>(max_length));
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册