bugfix: array_cast

This commit is contained in:
greatpi
2025-02-07 05:19:07 +00:00
committed by ob-robot
parent a379e540c2
commit 4e570df127
3 changed files with 9 additions and 15 deletions

View File

@ -392,6 +392,7 @@ int ObArrayCastUtils::add_json_node_to_array(common::ObIAllocator &alloc, ObJson
LOG_WARN("not supported", K(ret));
break;
}
case ObUFloatType:
case ObFloatType: {
double val;
ObArrayFixedSize<float> *dst_arr = static_cast<ObArrayFixedSize<float> *>(dst);
@ -404,6 +405,7 @@ int ObArrayCastUtils::add_json_node_to_array(common::ObIAllocator &alloc, ObJson
}
break;
}
case ObUDoubleType:
case ObDoubleType: {
double val;
ObArrayFixedSize<double> *dst_arr = static_cast<ObArrayFixedSize<double> *>(dst);

View File

@ -65,21 +65,13 @@ int ObExprMinus::calc_result_type2(ObExprResType &type,
if (type1.is_collection_sql_type() && type2.is_collection_sql_type()) {
ObSQLSessionInfo *session = const_cast<ObSQLSessionInfo *>(type_ctx.get_session());
ObExecContext *exec_ctx = OB_ISNULL(session) ? NULL : session->get_cur_exec_ctx();
if (type1.get_subschema_id() != type2.get_subschema_id()) {
ObExprResType coll_calc_type = type;
if (OB_FAIL(ObExprResultTypeUtil::get_array_calc_type(exec_ctx, type1, type2, coll_calc_type))) {
LOG_WARN("failed to check array compatibilty", K(ret));
} else {
type1.set_calc_meta(coll_calc_type);
type2.set_calc_meta(coll_calc_type);
type.set_collection(coll_calc_type.get_subschema_id());
}
ObExprResType coll_calc_type = type;
if (OB_FAIL(ObExprResultTypeUtil::get_array_calc_type(exec_ctx, type1, type2, coll_calc_type))) {
LOG_WARN("failed to check array compatibilty", K(ret));
} else {
// subschem id in calc_meta is set to uint16_max in ObArithExprOperator::calc_result_type2
// set real subschema id to calc_meta from meta
type1.set_calc_meta(type1);
type2.set_calc_meta(type2);
type.set_collection(type1.get_subschema_id());
type1.set_calc_meta(coll_calc_type);
type2.set_calc_meta(coll_calc_type);
type.set_collection(coll_calc_type.get_subschema_id());
}
} else {
// only support vector/array/varchar - vector/array/varchar now // array and varchar need cast to array(float)

View File

@ -3609,7 +3609,7 @@ int ObRawExprDeduceType::set_array_agg_result_type(ObAggFunRawExpr &expr,
ret = OB_ERR_UNEXPECTED;
LOG_WARN("internal order expr is null", K(ret));
} else if (order_expr->get_result_type().get_type() == ObCollectionSQLType) {
ret = OB_NOT_SUPPORTED;
ret = OB_ERR_INVALID_TYPE_FOR_OP;
LOG_WARN("array type used for sorting isn't supported", K(ret));
}
}