[CP] sync bugfix.fix sanity json pl type coredump, fix treat expr in pl coredump
This commit is contained in:
@ -97,7 +97,7 @@ int ObExprJsonLength::calc(ObEvalCtx &ctx, const ObDatum &data1, ObDatumMeta met
|
||||
// handle data2(path text)
|
||||
if (OB_SUCC(ret) && OB_LIKELY(!is_null)) {
|
||||
if (OB_ISNULL(data2)) { // have no path
|
||||
res_len = j_base->element_count();
|
||||
res_len = j_base->member_count();
|
||||
} else { // handle json path
|
||||
ObObjType type2 = meta2.type_;
|
||||
if (type2 == ObNullType) { // null should display "NULL"
|
||||
@ -116,7 +116,7 @@ int ObExprJsonLength::calc(ObEvalCtx &ctx, const ObDatum &data1, ObDatumMeta met
|
||||
} else if (hit.size() != 1) { // not found node by path, display "NULL"
|
||||
is_null = true;
|
||||
} else {
|
||||
res_len = hit[0]->element_count();
|
||||
res_len = hit[0]->member_count();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -68,13 +68,9 @@ int ObExprLeft::calc_result_type2(ObExprResType &type,
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObSQLSessionInfo *session = const_cast<ObSQLSessionInfo *>(type_ctx.get_session());
|
||||
ObExecContext *exec_ctx = nullptr;
|
||||
if (OB_ISNULL(session)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("session is NULL", K(ret));
|
||||
} else if (OB_ISNULL(exec_ctx = session->get_cur_exec_ctx())) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("exec context is NULL", K(ret));
|
||||
} else if (session->is_varparams_sql_prepare()) {
|
||||
// the ps prepare stage does not do type deduction, and directly gives a default type.
|
||||
type.set_char();
|
||||
|
||||
@ -110,7 +110,11 @@ static int treat_as_json_udt(const ObExpr &expr, ObEvalCtx &ctx, common::ObIAllo
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("get json doc is null", K(ret), K(jsontype));
|
||||
} else {
|
||||
if (OB_FAIL(pl::ObPlJsonUtil::transform_JsonBase_2_PLJsonType(ctx.exec_ctx_, json_doc, new_jsontype))) {
|
||||
ObJsonNode * json_node_copy = nullptr;
|
||||
if (OB_ISNULL(json_node_copy = json_doc->clone(&ctx.exec_ctx_.get_allocator()))) {
|
||||
ret = OB_ALLOCATE_MEMORY_FAILED;
|
||||
LOG_WARN("failed to clone json node", K(ret));
|
||||
} else if (OB_FAIL(pl::ObPlJsonUtil::transform_JsonBase_2_PLJsonType(ctx.exec_ctx_, json_node_copy, new_jsontype))) {
|
||||
LOG_WARN("failed to transfrom ObJsonNode to ObPLJsonBaseType", K(ret));
|
||||
} else if(OB_ISNULL(new_jsontype)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
|
||||
@ -1079,6 +1079,14 @@ int ObRawExprUtils::resolve_udf_param_exprs(ObResolverParams ¶ms,
|
||||
CK (OB_NOT_NULL(iparam));
|
||||
OX (mode = static_cast<pl::ObPLRoutineParamMode>(iparam->get_mode()));
|
||||
if (OB_SUCC(ret)) {
|
||||
#ifdef OB_BUILD_ORACLE_PL
|
||||
if (iparam->is_nocopy_param()
|
||||
&& pl::ObPLRoutineParamMode::PL_PARAM_INOUT == mode
|
||||
&& OB_NOT_NULL(udf_raw_expr->get_param_expr(i))
|
||||
&& pl::ObPlJsonUtil::is_pl_jsontype(udf_raw_expr->get_param_expr(i)->get_udt_id())) {
|
||||
OZ (udf_raw_expr->add_param_desc(ObUDFParamDesc()));
|
||||
} else
|
||||
#endif
|
||||
if (pl::ObPLRoutineParamMode::PL_PARAM_OUT == mode
|
||||
|| pl::ObPLRoutineParamMode::PL_PARAM_INOUT == mode) {
|
||||
ObRawExpr* iexpr = udf_raw_expr->get_param_expr(i);
|
||||
|
||||
Reference in New Issue
Block a user