[WhiteScan] Fix some white scan errors

This commit is contained in:
br0
2021-09-17 19:24:43 +08:00
committed by wangzelin.wzl
parent 875865e081
commit b1581e364b
4 changed files with 57 additions and 59 deletions

View File

@ -403,7 +403,6 @@ int ObExprDiv::div_interval(
res.set_scale(ObAccuracy::MAX_ACCURACY2[ORACLE_MODE][res.get_type()].get_scale()); res.set_scale(ObAccuracy::MAX_ACCURACY2[ORACLE_MODE][res.get_type()].get_scale());
UNUSED(calc_scale); UNUSED(calc_scale);
return ret; return ret;
return ret;
} }
const ObScale ObExprDiv::DIV_CALC_SCALE = 9; const ObScale ObExprDiv::DIV_CALC_SCALE = 9;

View File

@ -574,15 +574,18 @@ int ObExprFuncPartHash::calc_oracle_vt_part_id(ObTaskExecutorCtx& task_exec_ctx,
} else { } else {
ObString ip = objs_stack[0].get_string(); ObString ip = objs_stack[0].get_string();
number::ObNumber port_num; number::ObNumber port_num;
objs_stack[1].get_number(port_num); if (OB_FAIL(objs_stack[1].get_number(port_num))) {
int32_t port = atoi(port_num.format()); LOG_WARN("Get port_number failed.", K(ret));
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 { } 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; return ret;

View File

@ -182,6 +182,7 @@ class ObExprInOrNotIn : public ObVectorExprOperator {
public: public:
ObExprInCtx() ObExprInCtx()
: ObExprOperatorCtx(), : ObExprOperatorCtx(),
row_dimension_(-1),
right_has_null(false), right_has_null(false),
hash_func_buff_(NULL), hash_func_buff_(NULL),
funcs_ptr_set(false), funcs_ptr_set(false),

View File

@ -45,61 +45,56 @@ int ObExprBaseLeastGreatest::calc_result_typeN_oracle(
ret = OB_INVALID_ARGUMENT; ret = OB_INVALID_ARGUMENT;
LOG_WARN("types is null or param_num is wrong", K(types), K(param_num), K(ret)); LOG_WARN("types is null or param_num is wrong", K(types), K(param_num), K(ret));
} else { } else {
if (OB_ISNULL(types) || OB_UNLIKELY(param_num < 1)) { ObExprResType& first_type = types[0];
ret = OB_INVALID_ARGUMENT; type = first_type;
LOG_WARN("types is null or param_num is wrong", K(types), K(param_num), K(ret)); 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 { } else {
ObExprResType& first_type = types[0]; type.set_type(first_type.get_type());
type = first_type; type.set_calc_type(first_type.get_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()) { if (ObStringTC == type.get_type_class()) {
int64_t max_length = 0; int64_t max_length = 0;
int64_t all_char = 0; int64_t all_char = 0;
for (int64_t i = 0; OB_SUCC(ret) && i < param_num; i++) { for (int64_t i = 0; OB_SUCC(ret) && i < param_num; i++) {
int64_t item_length = 0; int64_t item_length = 0;
if (ObStringTC == types[i].get_type_class() || ObLongTextType == types[i].get_type()) { if (ObStringTC == types[i].get_type_class() || ObLongTextType == types[i].get_type()) {
item_length = types[i].get_length(); item_length = types[i].get_length();
if (LS_CHAR == types[i].get_length_semantics()) { if (LS_CHAR == types[i].get_length_semantics()) {
item_length = item_length * 4; item_length = item_length * 4;
all_char++; 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)) {
max_length = MAX(max_length, item_length);
} }
} 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 (OB_SUCC(ret)) {
if (all_char == param_num) { max_length = MAX(max_length, item_length);
type.set_length(static_cast<ObLength>(max_length / 4)); }
type.set_length_semantics(LS_CHAR); }
} else { if (OB_SUCC(ret)) {
type.set_length(static_cast<ObLength>(max_length)); 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));
} }
} }
} }