diff --git a/src/sql/executor/ob_task.cpp b/src/sql/executor/ob_task.cpp index 4e3bb62d7..76e5af9a0 100644 --- a/src/sql/executor/ob_task.cpp +++ b/src/sql/executor/ob_task.cpp @@ -307,15 +307,21 @@ OB_DEF_SERIALIZE(ObRemoteTask) int ret = OB_SUCCESS; int64_t tenant_id = OB_INVALID_ID; ParamStore *ps_params = nullptr; + ParamStore empty_param_store; //for serialize ObObjParam' param_meta_ int64_t param_meta_count = 0; if (OB_ISNULL(remote_sql_info_) || OB_ISNULL(session_info_) - || OB_ISNULL(ps_params = remote_sql_info_->ps_params_)) { + || OB_ISNULL(remote_sql_info_->ps_params_)) { ret = OB_NOT_INIT; LOG_WARN("remote task not init", K(ret), K_(remote_sql_info), K_(session_info), K(ps_params)); } else { tenant_id = session_info_->get_effective_tenant_id(); + if (!remote_sql_info_->use_ps_) { + ps_params = &empty_param_store; + } else { + ps_params = remote_sql_info_->ps_params_; + } param_meta_count = ps_params->count(); } LST_DO_CODE(OB_UNIS_ENCODE, @@ -348,13 +354,19 @@ OB_DEF_SERIALIZE_SIZE(ObRemoteTask) { int64_t len = 0; ParamStore *ps_params = nullptr; + ParamStore empty_param_store; int64_t param_meta_count = 0; if (OB_ISNULL(remote_sql_info_) || OB_ISNULL(session_info_) - || OB_ISNULL(ps_params = remote_sql_info_->ps_params_)) { + || OB_ISNULL(remote_sql_info_->ps_params_)) { LOG_WARN_RET(OB_NOT_INIT, "remote task not init", K_(remote_sql_info), K_(session_info), K(ps_params)); } else { int64_t tenant_id = session_info_->get_effective_tenant_id(); + if (!remote_sql_info_->use_ps_) { + ps_params = &empty_param_store; + } else { + ps_params = remote_sql_info_->ps_params_; + } LST_DO_CODE(OB_UNIS_ADD_LEN, tenant_schema_version_, sys_schema_version_, diff --git a/src/sql/ob_sql.cpp b/src/sql/ob_sql.cpp index 5dc3003b4..cacd8fcc3 100644 --- a/src/sql/ob_sql.cpp +++ b/src/sql/ob_sql.cpp @@ -775,8 +775,7 @@ int ObSql::fill_select_result_set(ObResultSet &result_set, ObSqlCtx *context, co } else if (lib::is_oracle_mode() && expr->is_column_ref_expr() && static_cast(expr)->is_xml_column()) { // xmltype is supported, do nothing - } else if (NULL == context->secondary_namespace_ // pl resolve - && NULL == context->session_info_->get_pl_context()) { // pl execute + } else { is_ext_field = true; field.type_.set_collation_type(CS_TYPE_BINARY); field.type_.set_collation_level(CS_LEVEL_IMPLICIT); @@ -787,10 +786,13 @@ int ObSql::fill_select_result_set(ObResultSet &result_set, ObSqlCtx *context, co } else { field.charsetnr_ = static_cast(expr->get_collation_type()); } - if (OB_FAIL(get_composite_type_field_name(*context->schema_guard_, - expr->get_result_type().get_udt_id(), - composite_field_name))) { - LOG_WARN("get record member name fail.", K(ret), K(composite_field_name)); + if (NULL == context->secondary_namespace_ // pl resolve + && NULL == context->session_info_->get_pl_context()) { + if (OB_FAIL(get_composite_type_field_name(*context->schema_guard_, + expr->get_result_type().get_udt_id(), + composite_field_name))) { + LOG_WARN("get record member name fail.", K(ret), K(composite_field_name)); + } } } } @@ -1690,7 +1692,7 @@ int ObSql::handle_sql_execute(const ObString &sql, if (OB_SUCC(ret) && !context.is_text_ps_mode_) { if (OB_FAIL(after_get_plan(pc_ctx, *session, result.get_physical_plan(), - result.get_is_from_plan_cache(), ¶ms, pc_ctx.exec_ctx_.get_min_cluster_version()))) { + result.get_is_from_plan_cache(), (mode == PC_PS_MODE || mode == PC_PL_MODE) ? ¶ms : nullptr, pc_ctx.exec_ctx_.get_min_cluster_version()))) { LOG_WARN("fail to handle after get plan", K(ret)); } } @@ -1767,7 +1769,7 @@ int ObSql::handle_pl_execute(const ObString &sql, LOG_WARN("failed to set timeout for pl", K(ret)); } else if (OB_FAIL(session.store_query_string(sql))) { LOG_WARN("store query string fail", K(ret)); - } else if (OB_FAIL(handle_sql_execute(sql, context, result, params, PC_PL_MODE))) { + } else if (OB_FAIL(handle_sql_execute(sql, context, result, params, is_prepare_protocol ? PC_PL_MODE : PC_TEXT_MODE))) { LOG_WARN("failed to handle sql execute", K(ret)); } else { result.get_session().set_exec_min_cluster_version(); @@ -4848,7 +4850,6 @@ int ObSql::after_get_plan(ObPlanCacheCtx &pc_ctx, pctx->get_remote_sql_info().ps_param_cnt_ = static_cast(param_store.count()); } else { //没有进plan cache,并且是文本协议,在远端再走一次文本解析 - param_store.reset(); //走文本协议不需要携带参数,清空掉 pctx->get_remote_sql_info().use_ps_ = false; pctx->get_remote_sql_info().is_batched_stmt_ = pc_ctx.sql_ctx_.multi_stmt_item_.is_batched_multi_stmt();