[CP] [to #53656926] fix table.col.member_access & table.col.member_func()
This commit is contained in:
parent
520e2423ff
commit
53c4c7a438
@ -719,7 +719,7 @@ int ObAllVirtualProxyPartitionInfo::build_check_str_to_raw_expr_(
|
||||
}
|
||||
}
|
||||
if (OB_FAIL(ret)) {
|
||||
} else if (OB_FAIL(q_name.access_idents_.at(0).sys_func_expr_->check_param_num())) {
|
||||
} else if (OB_FAIL(q_name.access_idents_.at(0).check_param_num())) {
|
||||
LOG_WARN("check param_num failed", KR(ret));
|
||||
} else if (OB_FAIL(sql::ObRawExprUtils::replace_ref_column(
|
||||
check_expr, q_name.ref_expr_, sys_func))) {
|
||||
|
@ -11718,7 +11718,7 @@ int ObPLResolver::resolve_qualified_name(ObQualifiedName &q_name,
|
||||
OZ (replace_udf_param_expr(q_name, columns, real_exprs));
|
||||
if (OB_FAIL(ret)) {
|
||||
} else if (q_name.is_sys_func()) {
|
||||
if (OB_FAIL(q_name.access_idents_.at(0).sys_func_expr_->check_param_num())) {
|
||||
if (OB_FAIL(q_name.access_idents_.at(0).check_param_num())) {
|
||||
LOG_WARN("sys func param number not match", K(ret));
|
||||
} else {
|
||||
expr = static_cast<ObRawExpr *>(q_name.access_idents_.at(0).sys_func_expr_);
|
||||
@ -14005,6 +14005,10 @@ int ObPLResolver::resolve_construct(ObObjAccessIdent &access_ident,
|
||||
ObRawExpr* expr = NULL;
|
||||
const ObUserDefinedType *user_type = NULL;
|
||||
ObObjAccessIdx access_idx;
|
||||
if (!access_ident.is_pl_udf()) {
|
||||
ret = OB_ERR_UNDEFINED;
|
||||
LOG_WARN("object is not a procedure or is undefined", K(ret), K(access_ident));
|
||||
}
|
||||
OV (access_ident.is_pl_udf(), OB_ERR_UNEXPECTED, K(access_ident));
|
||||
OZ (ns.get_pl_data_type_by_id(user_type_id, user_type));
|
||||
CK (OB_NOT_NULL(user_type));
|
||||
@ -14436,9 +14440,20 @@ int ObPLResolver::resolve_access_ident(ObObjAccessIdent &access_ident, // 当前
|
||||
if (OB_FAIL(ret)) {
|
||||
} else if ((ObPLExternalNS::LOCAL_TYPE == type || ObPLExternalNS::PKG_TYPE == type || ObPLExternalNS::UDT_NS == type)
|
||||
&& (is_routine || (access_ident.has_brackets_))) {
|
||||
OZ (resolve_construct(access_ident, ns, access_idxs, var_index, func),
|
||||
K(is_routine), K(is_resolve_rowtype), K(type),
|
||||
K(pl_data_type), K(var_index), K(access_ident), K(access_idxs));
|
||||
if (ObPLExternalNS::PKG_TYPE == type || ObPLExternalNS::UDT_NS == type) {
|
||||
OZ (resolve_routine(access_ident, ns, access_idxs, func));
|
||||
if (OB_FAIL(ret)) {
|
||||
ret = OB_SUCCESS;
|
||||
ob_reset_tsi_warning_buffer();
|
||||
OZ (resolve_construct(access_ident, ns, access_idxs, var_index, func),
|
||||
K(is_routine), K(is_resolve_rowtype), K(type),
|
||||
K(pl_data_type), K(var_index), K(access_ident), K(access_idxs));
|
||||
}
|
||||
} else {
|
||||
OZ (resolve_construct(access_ident, ns, access_idxs, var_index, func),
|
||||
K(is_routine), K(is_resolve_rowtype), K(type),
|
||||
K(pl_data_type), K(var_index), K(access_ident), K(access_idxs));
|
||||
}
|
||||
} else if (ObPLExternalNS::INVALID_VAR == type
|
||||
|| (ObPLExternalNS::SELF_ATTRIBUTE == type)
|
||||
|| (ObPLExternalNS::LOCAL_VAR == type && is_routine)
|
||||
@ -14461,8 +14476,7 @@ int ObPLResolver::resolve_access_ident(ObObjAccessIdent &access_ident, // 当前
|
||||
access_ident.access_name_,
|
||||
pl_data_type,
|
||||
var_index);
|
||||
if (ObPLExternalNS::PKG_VAR == type
|
||||
&& cnt > 0) {
|
||||
if (ObPLExternalNS::PKG_VAR == type && cnt > 0) {
|
||||
if (ObObjAccessIdx::IS_PKG_NS == access_idxs.at(cnt - 1).access_type_
|
||||
&& access_ident.has_brackets_
|
||||
&& access_ident.params_.count() == 0) {
|
||||
@ -14472,7 +14486,6 @@ int ObPLResolver::resolve_access_ident(ObObjAccessIdent &access_ident, // 当前
|
||||
ret = OB_ERR_NOT_FUNC_NAME;
|
||||
LOG_USER_ERROR(OB_ERR_NOT_FUNC_NAME, object_name.string().length(), object_name.string().ptr());
|
||||
}
|
||||
|
||||
}
|
||||
OZ (build_access_idx_sys_func(parent_id, access_idx));
|
||||
OZ (access_idxs.push_back(access_idx), K(access_idx));
|
||||
|
@ -1373,19 +1373,22 @@ int ObSql::handle_pl_prepare(const ObString &sql,
|
||||
pl_prepare_ctx.is_dynamic_sql_ ? DYNAMIC_SQL_MODE :
|
||||
sess.is_for_trigger_package() ? TRIGGER_MODE : STD_MODE;
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
context.is_dynamic_sql_ = pl_prepare_ctx.is_dynamic_sql_;
|
||||
context.is_dbms_sql_ = pl_prepare_ctx.is_dbms_sql_;
|
||||
context.is_cursor_ = pl_prepare_ctx.is_cursor_;
|
||||
context.secondary_namespace_ = pl_prepare_ctx.secondary_ns_;
|
||||
context.session_info_ = &sess;
|
||||
context.disable_privilege_check_ = OB_SYS_TENANT_ID == sess.get_priv_tenant_id()
|
||||
? PRIV_CHECK_FLAG_DISABLE
|
||||
: PRIV_CHECK_FLAG_IN_PL;
|
||||
context.exec_type_ = PLSql;
|
||||
context.is_prepare_protocol_ = true;
|
||||
context.is_prepare_stage_ = true;
|
||||
context.is_dynamic_sql_ = pl_prepare_ctx.is_dynamic_sql_;
|
||||
context.is_dbms_sql_ = pl_prepare_ctx.is_dbms_sql_;
|
||||
context.is_cursor_ = pl_prepare_ctx.is_cursor_;
|
||||
context.secondary_namespace_ = pl_prepare_ctx.secondary_ns_;
|
||||
context.session_info_ = &sess;
|
||||
context.disable_privilege_check_ = OB_SYS_TENANT_ID == sess.get_priv_tenant_id()
|
||||
? PRIV_CHECK_FLAG_DISABLE
|
||||
: PRIV_CHECK_FLAG_IN_PL;
|
||||
context.exec_type_ = PLSql;
|
||||
context.is_prepare_protocol_ = true;
|
||||
context.is_prepare_stage_ = true;
|
||||
|
||||
if (OB_FAIL(ob_write_string(allocator, sess.get_current_query_string(), cur_query))) {
|
||||
LOG_WARN("failed to write string", K(ret));
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
WITH_CONTEXT(pl_prepare_result.mem_context_) {
|
||||
ObResultSet &result = *pl_prepare_result.result_set_;
|
||||
@ -1401,8 +1404,6 @@ int ObSql::handle_pl_prepare(const ObString &sql,
|
||||
} else if (FALSE_IT(context.schema_guard_ = &schema_guard)) {
|
||||
} else if (OB_FAIL(init_result_set(context, result))) {
|
||||
LOG_WARN("failed to init result set", K(ret));
|
||||
} else if (OB_FAIL(ob_write_string(allocator, sess.get_current_query_string(), cur_query))) {
|
||||
LOG_WARN("failed to write string", K(ret));
|
||||
} else if (OB_FAIL(sess.store_query_string(sql))) {
|
||||
LOG_WARN("store query string fail", K(ret));
|
||||
} else if (OB_FAIL(parser.parse(sql, parse_result, parse_mode,
|
||||
@ -1480,10 +1481,11 @@ int ObSql::handle_pl_prepare(const ObString &sql,
|
||||
// do nothing
|
||||
} else if (OB_FAIL(ob_write_string(allocator, normalized_sql, result.get_stmt_ps_sql(), true))) {
|
||||
LOG_WARN("failed to write string", K(trimed_stmt), K(ret));
|
||||
} else if (OB_FAIL(sess.store_query_string(cur_query))) {
|
||||
LOG_WARN("failed to store query string", K(ret));
|
||||
} else {
|
||||
// do nothing
|
||||
}
|
||||
int tmp_ret = OB_SUCCESS;
|
||||
if ((tmp_ret = sess.store_query_string(cur_query)) != OB_SUCCESS) {
|
||||
LOG_WARN("failed to store query string", K(ret), K(tmp_ret));
|
||||
ret = OB_SUCCESS == ret ? tmp_ret : ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2526,6 +2526,90 @@ int ObDMLResolver::resolve_basic_column_item(const TableItem &table_item,
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObDMLResolver::replace_col_ref_prefix(ObQualifiedName &col_ref, uint64_t idx, ObQualifiedName &q_name, bool &try_success)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
|
||||
ObRawExpr* col_ref_expr = NULL;
|
||||
|
||||
if (col_ref.tbl_name_.empty()) {
|
||||
// do nothing ...
|
||||
} else if (OB_FAIL(resolve_column_ref_expr(col_ref, col_ref_expr))) {
|
||||
LOG_WARN("try get udt col ref failed", K(ret), K(col_ref), KPC(col_ref_expr));
|
||||
// should not return error if not found
|
||||
ret = OB_SUCCESS;
|
||||
} else if (OB_ISNULL(col_ref_expr)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("col ref expr is null", K(ret), KPC(col_ref_expr));
|
||||
} else if (col_ref_expr->is_column_ref_expr()
|
||||
&& !(static_cast<ObColumnRefRawExpr *>(col_ref_expr))->is_from_alias_table()
|
||||
&& OB_NOT_NULL(params_.query_ctx_)
|
||||
&& params_.query_ctx_->available_tb_id_ > (static_cast<ObColumnRefRawExpr *>(col_ref_expr))->get_table_id()) {
|
||||
// Oracle Compatible :
|
||||
// To reference an attribute or method of a table element,
|
||||
// you must give the table an alias and use the alias to qualify the reference to the attribute or method.
|
||||
ret = OB_ERR_BAD_FIELD_ERROR;
|
||||
LOG_WARN("column access with table name has not alias", K(ret), K(col_ref), KPC(col_ref_expr));
|
||||
} else if (OB_FAIL(ObRawExprUtils::implict_cast_sql_udt_to_pl_udt(params_.expr_factory_, params_.session_info_, col_ref_expr))) {
|
||||
LOG_WARN("try add implict cast above sql udt col ref failed", K(ret), K(col_ref), K(col_ref_expr));
|
||||
} else if (col_ref_expr->get_result_type().is_ext()
|
||||
|| col_ref_expr->get_result_type().is_user_defined_sql_type()
|
||||
|| col_ref_expr->get_result_type().is_geometry()) {
|
||||
col_ref.ref_expr_= q_name.ref_expr_;
|
||||
col_ref.access_idents_.reset();
|
||||
if (OB_FAIL(col_ref.access_idents_.push_back(ObObjAccessIdent(ObString("UDT_REF"), OB_INVALID_INDEX)))) {
|
||||
LOG_WARN("push back col ref ident failed", K(ret));
|
||||
} else {
|
||||
for (int64_t i = idx + 1; OB_SUCC(ret) && i < q_name.access_idents_.count(); i++) {
|
||||
if (OB_FAIL(col_ref.access_idents_.push_back(q_name.access_idents_.at(i)))) {
|
||||
LOG_WARN("push back udt member function failed", K(ret), K(i), K(q_name.access_idents_.at(i)));
|
||||
}
|
||||
}
|
||||
if (OB_SUCC(ret)) {
|
||||
col_ref.access_idents_.at(0).type_ = SYS_FUNC;
|
||||
col_ref.access_idents_.at(0).sys_func_expr_ = col_ref_expr;
|
||||
q_name = col_ref;
|
||||
q_name.database_name_.reset();
|
||||
q_name.tbl_name_.reset();
|
||||
q_name.col_name_.reset();
|
||||
try_success = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObDMLResolver::replace_col_ref_prefix(ObQualifiedName &q_name)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
int64_t idx = 2;
|
||||
bool try_success = false;
|
||||
while (OB_SUCC(ret) && idx >= 0) {
|
||||
if (idx >= (q_name.access_idents_.count() - 1) || q_name.access_idents_.at(idx).has_brackets_) {
|
||||
idx--;
|
||||
} else {
|
||||
ObQualifiedName col_ref;
|
||||
for (int64_t i = 0; OB_SUCC(ret) && i <= idx; ++i) {
|
||||
if (OB_FAIL(col_ref.access_idents_.push_back(q_name.access_idents_.at(i)))) {
|
||||
LOG_WARN("failed to push back", K(ret), K(q_name), K(col_ref), K(i), K(idx));
|
||||
}
|
||||
}
|
||||
if (OB_FAIL(ret)) {
|
||||
} else if (FALSE_IT(col_ref.ref_expr_ = q_name.ref_expr_)) {
|
||||
} else if (FALSE_IT(col_ref.format_qualified_name())) {
|
||||
} else if (OB_FAIL(replace_col_ref_prefix(col_ref, idx, q_name, try_success))) {
|
||||
LOG_WARN("failed to try col qname", K(ret), K(q_name), K(col_ref), K(idx));
|
||||
} else if (try_success) {
|
||||
break;
|
||||
} else {
|
||||
idx--;
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
int ObDMLResolver::resolve_columns(ObRawExpr *&expr, ObArray<ObQualifiedName> &columns)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
@ -2537,7 +2621,7 @@ int ObDMLResolver::resolve_columns(ObRawExpr *&expr, ObArray<ObQualifiedName> &c
|
||||
ObRawExpr* real_ref_expr = NULL;
|
||||
params_.is_column_ref_ = expr->is_column_ref_expr();
|
||||
|
||||
if (OB_FAIL(replace_col_udt_qname(q_name))) {
|
||||
if (OB_FAIL(replace_col_ref_prefix(q_name))) {
|
||||
LOG_WARN("replace col udt qname failed", K(ret), K(q_name));
|
||||
} else if (OB_FAIL(resolve_qualified_identifier(q_name, columns, real_exprs, real_ref_expr))) {
|
||||
LOG_WARN_IGNORE_COL_NOTFOUND(ret, "resolve column ref expr failed", K(ret), K(q_name));
|
||||
@ -2645,13 +2729,13 @@ int ObDMLResolver::resolve_qualified_identifier(ObQualifiedName &q_name,
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("get unexpected null", K(ret), KP(stmt_));
|
||||
} else if (q_name.is_sys_func()) {
|
||||
if (OB_FAIL(q_name.access_idents_.at(0).sys_func_expr_->check_param_num())) {
|
||||
if (OB_FAIL(q_name.access_idents_.at(0).check_param_num())) {
|
||||
LOG_WARN("sys func param number not match", K(ret));
|
||||
} else {
|
||||
real_ref_expr = static_cast<ObRawExpr *>(q_name.access_idents_.at(0).sys_func_expr_);
|
||||
is_external = (T_FUN_PL_GET_CURSOR_ATTR == real_ref_expr->get_expr_type());
|
||||
}
|
||||
} else if (q_name.is_pl_udf() || q_name.is_pl_var()) {
|
||||
} else if (q_name.is_pl_udf() || q_name.is_pl_var() || q_name.is_col_ref_access()) {
|
||||
is_external = true;
|
||||
if (OB_FAIL(resolve_external_name(q_name, columns, real_exprs, real_ref_expr))) {
|
||||
LOG_WARN("resolve column ref expr failed", K(ret), K(q_name));
|
||||
|
@ -330,6 +330,8 @@ protected:
|
||||
int check_expr_param(const ObRawExpr &expr);
|
||||
int check_col_param_on_expr(ObRawExpr *expr);
|
||||
int resolve_columns_field_list_first(ObRawExpr *&expr, ObArray<ObQualifiedName> &columns, ObSelectStmt* sel_stmt);
|
||||
int replace_col_ref_prefix(ObQualifiedName &col_ref, uint64_t idx, ObQualifiedName &q_name, bool &try_success);
|
||||
int replace_col_ref_prefix(ObQualifiedName &q_name);
|
||||
int resolve_columns(ObRawExpr *&expr, common::ObArray<ObQualifiedName> &columns);
|
||||
int resolve_qualified_identifier(ObQualifiedName &q_name,
|
||||
ObIArray<ObQualifiedName> &columns,
|
||||
|
@ -92,6 +92,22 @@ int ObRawExprFactory::create_raw_expr<ObOpRawExpr>(ObItemType expr_type, ObOpRaw
|
||||
#undef GENERATE_CASE
|
||||
#undef GENERATE_DEFAULT
|
||||
|
||||
void ObQualifiedName::format_qualified_name()
|
||||
{
|
||||
if (access_idents_.count() == 1) {
|
||||
col_name_ = access_idents_.at(0).access_name_;
|
||||
}
|
||||
if (access_idents_.count() == 2) {
|
||||
tbl_name_ = access_idents_.at(0).access_name_;
|
||||
col_name_ = access_idents_.at(1).access_name_;
|
||||
}
|
||||
if (access_idents_.count() == 3) {
|
||||
database_name_ = access_idents_.at(0).access_name_;
|
||||
tbl_name_ = access_idents_.at(1).access_name_;
|
||||
col_name_ = access_idents_.at(2).access_name_;
|
||||
}
|
||||
}
|
||||
|
||||
void ObQualifiedName::format_qualified_name(ObNameCaseMode mode)
|
||||
{
|
||||
UNUSED(mode); //TODO: @ryan.ly @yuming.wyc
|
||||
@ -124,6 +140,13 @@ int ObQualifiedName::replace_access_ident_params(ObRawExpr *from, ObRawExpr *to)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObObjAccessIdent::check_param_num() const
|
||||
{
|
||||
return (ObRawExpr::EXPR_SYS_FUNC == sys_func_expr_->get_expr_class())
|
||||
? static_cast<ObSysFunRawExpr*>(sys_func_expr_)->check_param_num()
|
||||
: OB_SUCCESS;
|
||||
}
|
||||
|
||||
int ObObjAccessIdent::extract_params(int64_t level, common::ObIArray<ObRawExpr*> ¶ms) const
|
||||
{
|
||||
int ret = common::OB_SUCCESS;
|
||||
|
@ -1111,13 +1111,15 @@ public:
|
||||
int extract_params(int64_t level, common::ObIArray<ObRawExpr*> ¶ms) const;
|
||||
int replace_params(ObRawExpr *from, ObRawExpr *to);
|
||||
|
||||
int check_param_num() const;
|
||||
|
||||
TO_STRING_KV(K_(access_name), K_(access_index), K_(type), K_(params));
|
||||
|
||||
AccessNameType type_;
|
||||
common::ObString access_name_;
|
||||
int64_t access_index_;
|
||||
ObUDFInfo udf_info_;
|
||||
ObSysFunRawExpr *sys_func_expr_;
|
||||
ObRawExpr *sys_func_expr_;
|
||||
//a.f(x,y)(m,n)里的x、y、m、n都是f的参数,但是x、y的param_level_是0,m、n是1
|
||||
common::ObSEArray<std::pair<ObRawExpr*, int64_t>, 4, common::ModulePageAllocator, true> params_;
|
||||
bool has_brackets_; // may has empty (), record it.
|
||||
@ -1163,6 +1165,7 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
void format_qualified_name();
|
||||
void format_qualified_name(common::ObNameCaseMode mode);
|
||||
inline bool is_unknown() const
|
||||
{
|
||||
@ -1179,6 +1182,10 @@ public:
|
||||
{
|
||||
return 1 == access_idents_.count() && access_idents_.at(0).is_sys_func();
|
||||
}
|
||||
inline bool is_col_ref_access() const
|
||||
{
|
||||
return 1 < access_idents_.count() && access_idents_.at(0).is_sys_func();
|
||||
}
|
||||
inline bool is_pl_udf() const
|
||||
{
|
||||
bool bret = !access_idents_.empty()
|
||||
|
@ -2241,7 +2241,7 @@ int ObRawExprResolverImpl::resolve_func_node_of_obj_access_idents(const ParseNod
|
||||
OZ (process_fun_sys_node(&func_node, func_expr));
|
||||
}
|
||||
CK (OB_NOT_NULL(func_expr));
|
||||
OX (access_ident.sys_func_expr_ = static_cast<ObSysFunRawExpr *>(func_expr));
|
||||
OX (access_ident.sys_func_expr_ = func_expr);
|
||||
for (int64_t i = 0; OB_SUCC(ret) && i < func_expr->get_param_count(); ++i) {
|
||||
std::pair<ObRawExpr*, int64_t> param(func_expr->get_param_expr(i), 0);
|
||||
OZ (access_ident.params_.push_back(param));
|
||||
|
@ -2375,7 +2375,7 @@ int ObRawExprUtils::build_generated_column_expr(ObRawExprFactory &expr_factory,
|
||||
for (int64_t i = 0; OB_SUCC(ret) && i < ref_sys_exprs.count(); ++i) {
|
||||
OZ (ObRawExprUtils::replace_ref_column(sys_func, ref_sys_exprs.at(i).first, ref_sys_exprs.at(i).second));
|
||||
}
|
||||
OZ (q_name.access_idents_.at(0).sys_func_expr_->check_param_num());
|
||||
OZ (q_name.access_idents_.at(0).check_param_num());
|
||||
OZ (ObRawExprUtils::replace_ref_column(expr, q_name.ref_expr_, sys_func));
|
||||
OZ (ref_sys_exprs.push_back(std::pair<ObRawExpr*, ObRawExpr*>(q_name.ref_expr_, sys_func)));
|
||||
} else if (q_name.is_pl_udf()) {
|
||||
|
@ -3184,14 +3184,10 @@ int ObResolverUtils::resolve_columns_for_const_expr(ObRawExpr *&expr, ObArray<Ob
|
||||
for (int64_t i = 0; OB_SUCC(ret) && i < columns.count(); i++) {
|
||||
ObQualifiedName &q_name = columns.at(i);
|
||||
if (q_name.is_sys_func()) {
|
||||
ObSysFunRawExpr *sys_func_expr = q_name.access_idents_.at(0).sys_func_expr_;
|
||||
if (OB_ISNULL(sys_func_expr)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("sys expr is null", K(ret));
|
||||
} else if (OB_FAIL(sys_func_expr->check_param_num())) {
|
||||
if (OB_FAIL(q_name.access_idents_.at(0).check_param_num())) {
|
||||
LOG_WARN("sys func check param failed", K(ret));
|
||||
} else {
|
||||
real_ref_expr = sys_func_expr;
|
||||
real_ref_expr = q_name.access_idents_.at(0).sys_func_expr_;
|
||||
}
|
||||
} else if (q_name.is_pl_udf()) {
|
||||
if (OB_FAIL(ObResolverUtils::resolve_external_symbol(*resolve_params.allocator_,
|
||||
@ -4287,32 +4283,26 @@ int ObResolverUtils::resolve_columns_for_partition_range_value_expr(ObRawExpr *&
|
||||
for (int64_t i = 0; OB_SUCC(ret) && i < columns.count(); i++) {
|
||||
ObQualifiedName &q_name = columns.at(i);
|
||||
if (q_name.is_sys_func()) {
|
||||
ObSysFunRawExpr *sys_func_expr = q_name.access_idents_.at(0).sys_func_expr_;
|
||||
if (OB_ISNULL(sys_func_expr)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("sys expr is null", K(ret));
|
||||
} else {
|
||||
ObRawExpr *real_ref_expr = static_cast<ObRawExpr *>(sys_func_expr);
|
||||
for (int64_t j = 0; OB_SUCC(ret) && j < real_sys_exprs.count(); ++j) {
|
||||
if (OB_FAIL(ObRawExprUtils::replace_ref_column(real_ref_expr,
|
||||
real_sys_exprs.at(j).first,
|
||||
real_sys_exprs.at(j).second))) {
|
||||
LOG_WARN("failed to replace ref column", K(ret));
|
||||
}
|
||||
}
|
||||
if (OB_FAIL(ret)) {
|
||||
// do nothing
|
||||
} else if (OB_FAIL(sys_func_expr->check_param_num())) {
|
||||
LOG_WARN("faield to check param num", K(ret));
|
||||
} else if (OB_FAIL(ObRawExprUtils::replace_ref_column(expr,
|
||||
q_name.ref_expr_,
|
||||
real_ref_expr))) {
|
||||
ObRawExpr *real_ref_expr = q_name.access_idents_.at(0).sys_func_expr_;
|
||||
for (int64_t j = 0; OB_SUCC(ret) && j < real_sys_exprs.count(); ++j) {
|
||||
if (OB_FAIL(ObRawExprUtils::replace_ref_column(real_ref_expr,
|
||||
real_sys_exprs.at(j).first,
|
||||
real_sys_exprs.at(j).second))) {
|
||||
LOG_WARN("failed to replace ref column", K(ret));
|
||||
} else if (OB_FAIL(real_sys_exprs.push_back(
|
||||
std::pair<ObRawExpr*, ObRawExpr*>(q_name.ref_expr_, real_ref_expr)))) {
|
||||
LOG_WARN("failed to push back pari exprs", K(ret));
|
||||
}
|
||||
}
|
||||
if (OB_FAIL(ret)) {
|
||||
// do nothing
|
||||
} else if (OB_FAIL(q_name.access_idents_.at(0).check_param_num())) {
|
||||
LOG_WARN("faield to check param num", K(ret));
|
||||
} else if (OB_FAIL(ObRawExprUtils::replace_ref_column(expr,
|
||||
q_name.ref_expr_,
|
||||
real_ref_expr))) {
|
||||
LOG_WARN("failed to replace ref column", K(ret));
|
||||
} else if (OB_FAIL(real_sys_exprs.push_back(
|
||||
std::pair<ObRawExpr*, ObRawExpr*>(q_name.ref_expr_, real_ref_expr)))) {
|
||||
LOG_WARN("failed to push back pari exprs", K(ret));
|
||||
}
|
||||
} else {
|
||||
if (OB_FAIL(log_err_msg_for_partition_value(q_name))) {
|
||||
LOG_WARN("log error msg for range value expr faield", K(ret));
|
||||
@ -4422,15 +4412,13 @@ int ObResolverUtils::resolve_columns_for_partition_expr(ObRawExpr *&expr,
|
||||
const ObQualifiedName &q_name = columns.at(i);
|
||||
ObRawExpr *real_ref_expr = NULL;
|
||||
if (q_name.is_sys_func()) {
|
||||
ObSysFunRawExpr *sys_func_expr = q_name.access_idents_.at(0).sys_func_expr_;
|
||||
CK (OB_NOT_NULL(sys_func_expr));
|
||||
if (OB_SUCC(ret)) {
|
||||
real_ref_expr = static_cast<ObRawExpr*>(sys_func_expr);
|
||||
real_ref_expr = q_name.access_idents_.at(0).sys_func_expr_;
|
||||
for (int64_t i = 0; OB_SUCC(ret) && i < real_sys_exprs.count(); ++i) {
|
||||
OZ (ObRawExprUtils::replace_ref_column(real_ref_expr, real_sys_exprs.at(i).first, real_sys_exprs.at(i).second));
|
||||
}
|
||||
|
||||
OZ (sys_func_expr->check_param_num());
|
||||
OZ (q_name.access_idents_.at(0).check_param_num());
|
||||
OZ (ObRawExprUtils::replace_ref_column(expr, q_name.ref_expr_, real_ref_expr));
|
||||
OZ (real_sys_exprs.push_back(std::pair<ObRawExpr*, ObRawExpr*>(q_name.ref_expr_, real_ref_expr)));
|
||||
}
|
||||
@ -5250,7 +5238,7 @@ int ObResolverUtils::resolve_default_expr_v2_column_expr(ObResolverParams ¶m
|
||||
} else if (OB_ISNULL(q_name.access_idents_.at(0).sys_func_expr_)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("NULL ptr", K(ret));
|
||||
} else if (OB_FAIL(q_name.access_idents_.at(0).sys_func_expr_->check_param_num())) {
|
||||
} else if (OB_FAIL(q_name.access_idents_.at(0).check_param_num())) {
|
||||
LOG_WARN("sys func param number not match", K(ret));
|
||||
} else {
|
||||
real_ref_expr = static_cast<ObRawExpr *>(q_name.access_idents_.at(0).sys_func_expr_);
|
||||
@ -5347,7 +5335,7 @@ int ObResolverUtils::resolve_check_constraint_expr(
|
||||
for (int64_t i = 0; OB_SUCC(ret) && i < ref_sys_exprs.count(); ++i) {
|
||||
OZ (ObRawExprUtils::replace_ref_column(sys_func, ref_sys_exprs.at(i).first, ref_sys_exprs.at(i).second));
|
||||
}
|
||||
OZ (q_name.access_idents_.at(0).sys_func_expr_->check_param_num());
|
||||
OZ (q_name.access_idents_.at(0).check_param_num());
|
||||
OZ (ObRawExprUtils::replace_ref_column(expr, q_name.ref_expr_, sys_func));
|
||||
OZ (ref_sys_exprs.push_back(std::pair<ObRawExpr*, ObRawExpr*>(q_name.ref_expr_, sys_func)));
|
||||
} else if (q_name.database_name_.length() > 0 || q_name.tbl_name_.length() > 0) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user