Fix udt bugs

This commit is contained in:
xianyu-w
2023-01-12 04:41:53 +00:00
committed by ob-robot
parent d6d16b62f1
commit 87e368c52f
44 changed files with 203 additions and 84 deletions

View File

@ -1243,13 +1243,15 @@ int ObResultSet::ExternalRetrieveInfo::build(
int ret = OB_SUCCESS;
OZ (build_into_exprs(stmt, ns, is_dynamic_sql));
if (OB_SUCC(ret)) {
if (OB_ISNULL(stmt.get_query_ctx())) {
ObSchemaGetterGuard *schema_guard = NULL;
if (OB_ISNULL(stmt.get_query_ctx()) ||
OB_ISNULL(schema_guard = stmt.get_query_ctx()->sql_schema_guard_.get_schema_guard())) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("query_ctx is null", K(ret));
} else if (param_info.empty() && into_exprs_.empty()) {
if (stmt.is_dml_stmt()) {
OZ (ObSQLUtils::reconstruct_sql(allocator_, &stmt, stmt.get_query_ctx()->get_sql_stmt(),
session_info.create_obj_print_params()));
schema_guard, session_info.create_obj_print_params()));
} else {
// other stmt do not need reconstruct.
}
@ -1258,7 +1260,7 @@ int ObResultSet::ExternalRetrieveInfo::build(
OZ (recount_dynamic_param_info(param_info));
}
OZ (ObSQLUtils::reconstruct_sql(allocator_, &stmt, stmt.get_query_ctx()->get_sql_stmt(),
session_info.create_obj_print_params()));
schema_guard, session_info.create_obj_print_params()));
/*
* stmt里的?是按照表达式resolve的顺序编号的,这个顺序在prepare阶段需要依赖的
* 但是route_sql里的?需要按照入参在符号表里的下标进行编号,这个编号是proxy做路由的时候依赖的,所以这里要改掉stmt里QUESTIONMARK的值
@ -1286,7 +1288,7 @@ int ObResultSet::ExternalRetrieveInfo::build(
}
}
OZ (ObSQLUtils::reconstruct_sql(allocator_, &stmt, route_sql_,
session_info.create_obj_print_params()));
schema_guard, session_info.create_obj_print_params()));
}
}
LOG_INFO("reconstruct sql:", K(stmt.get_query_ctx()->get_prepare_param_count()),