[ARRAY] fix case_when with array type_deduce bug
This commit is contained in:
parent
304a78f0dd
commit
63157365a4
1
deps/oblib/src/lib/udt/ob_array_type.h
vendored
1
deps/oblib/src/lib/udt/ob_array_type.h
vendored
@ -817,6 +817,7 @@ public :
|
||||
uint32_t cardinality() const { return this->length_; }
|
||||
ArrayFormat get_format() const { return ArrayFormat::Vector; }
|
||||
int push_back(float value);
|
||||
bool is_null(uint32_t idx) const { return false; }
|
||||
void set_scale(ObScale scale) { UNUSED(scale); }
|
||||
int print(const ObCollectionTypeBase *elem_type, ObStringBuffer &format_str,
|
||||
uint32_t begin = 0, uint32_t print_size = 0) const;
|
||||
|
@ -1407,7 +1407,7 @@ int ObExprOperator::aggregate_result_type_for_merge(
|
||||
LOG_WARN("aggregate_user_defined_sql_type fail", K(ret));
|
||||
}
|
||||
} else if (ob_is_collection_sql_type(res_type)) {
|
||||
if (OB_FAIL(aggregate_collection_sql_type(type, types, param_num))) {
|
||||
if (OB_FAIL(aggregate_collection_sql_type(type_ctx, type, types, param_num))) {
|
||||
LOG_WARN("aggregate_collection_sql_type fail", K(ret));
|
||||
}
|
||||
}
|
||||
@ -1757,6 +1757,7 @@ int ObExprOperator::aggregate_user_defined_sql_type(
|
||||
}
|
||||
|
||||
int ObExprOperator::aggregate_collection_sql_type(
|
||||
common::ObExprTypeCtx &type_ctx,
|
||||
ObExprResType &type,
|
||||
const ObExprResType *types,
|
||||
int64_t param_num)
|
||||
@ -1766,12 +1767,23 @@ int ObExprOperator::aggregate_collection_sql_type(
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("types is null or param_num is wrong", K(types), K(param_num), K(ret));
|
||||
} else {
|
||||
bool found = false;
|
||||
for (int64_t i = 0; ! found && i < param_num && OB_SUCC(ret); ++i) {
|
||||
ObSQLSessionInfo *session = const_cast<ObSQLSessionInfo *>(type_ctx.get_session());
|
||||
ObExecContext *exec_ctx = session->get_cur_exec_ctx();
|
||||
bool first = true;
|
||||
for (int64_t i = 0; i < param_num && OB_SUCC(ret); ++i) {
|
||||
if (ob_is_collection_sql_type(types[i].get_type())) {
|
||||
found = true;
|
||||
// choose the first collection subschema id now
|
||||
type.set_subschema_id(types[i].get_subschema_id());
|
||||
if (first) {
|
||||
// choose the first collection subschema id now
|
||||
type.set_subschema_id(types[i].get_subschema_id());
|
||||
first = false;
|
||||
} else {
|
||||
ObExprResType coll_calc_type;
|
||||
if (OB_FAIL(ObExprResultTypeUtil::get_array_calc_type(exec_ctx, type, types[i], coll_calc_type))) {
|
||||
LOG_WARN("failed to check array compatibilty", K(ret));
|
||||
} else {
|
||||
type.set_subschema_id(coll_calc_type.get_subschema_id());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -661,6 +661,7 @@ public:
|
||||
const ObExprResType *types,
|
||||
int64_t param_num);
|
||||
static int aggregate_collection_sql_type(
|
||||
common::ObExprTypeCtx &type_ctx,
|
||||
ObExprResType &type,
|
||||
const ObExprResType *types,
|
||||
int64_t param_num);
|
||||
|
Loading…
x
Reference in New Issue
Block a user