[FEAT MERGE]4_1_sql_feature
Co-authored-by: leslieyuchen <leslieyuchen@gmail.com> Co-authored-by: Charles0429 <xiezhenjiang@gmail.com> Co-authored-by: raywill <hustos@gmail.com>
This commit is contained in:
@ -60,18 +60,13 @@ int ObAnyValueChecker::visit(ObVarRawExpr &expr)
|
||||
return OB_SUCCESS;
|
||||
}
|
||||
|
||||
int ObAnyValueChecker::visit(ObOpPseudoColumnRawExpr &)
|
||||
int ObAnyValueChecker::visit(ObOpPseudoColumnRawExpr &expr)
|
||||
{
|
||||
return OB_SUCCESS;
|
||||
}
|
||||
|
||||
int ObAnyValueChecker::visit(ObQueryRefRawExpr &expr)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
const ObSelectStmt *ref_stmt = expr.get_ref_stmt();
|
||||
if (OB_FAIL(check_select_stmt(ref_stmt))) {
|
||||
LOG_WARN("failed to check select stmt", K(ret));
|
||||
}
|
||||
return OB_SUCCESS;
|
||||
}
|
||||
|
||||
@ -123,50 +118,6 @@ int ObAnyValueChecker::visit(ObPseudoColumnRawExpr &expr)
|
||||
return OB_SUCCESS;
|
||||
}
|
||||
|
||||
int ObAnyValueChecker::check_select_stmt(const ObSelectStmt *ref_stmt)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
bool ref_query = false;
|
||||
LOG_DEBUG("check any value start stmt", K(ret));
|
||||
|
||||
if (OB_ISNULL(ref_stmt)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("ref_stmt should not be NULL", K(ret));
|
||||
} else if (OB_FAIL(ObTransformUtils::is_ref_outer_block_relation(ref_stmt, ref_stmt->get_current_level(), ref_query))) {
|
||||
LOG_WARN("failed to get ref stmt", K(ret));
|
||||
} else if (!ref_query) {
|
||||
// non ref query
|
||||
} else {
|
||||
int32_t ignore_scope = 0;
|
||||
if (ref_stmt->is_order_siblings()) {
|
||||
ignore_scope |= RelExprCheckerBase::ORDER_SCOPE;
|
||||
}
|
||||
ObArray<ObRawExpr*> relation_expr_pointers;
|
||||
if (OB_FAIL(ref_stmt->get_relation_exprs(relation_expr_pointers, ignore_scope))) {
|
||||
LOG_WARN("get stmt relation exprs fail", K(ret));
|
||||
}
|
||||
|
||||
for (int64_t i = 0; OB_SUCC(ret) && i < relation_expr_pointers.count(); ++i) {
|
||||
ObRawExpr *expr = relation_expr_pointers.at(i);
|
||||
if (OB_ISNULL(expr)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("expr in relation_expr_pointers is null", K(i), K(relation_expr_pointers));
|
||||
} else if (OB_FAIL(expr->preorder_accept(*this))) {
|
||||
LOG_WARN("fail to check group by", K(i), K(ret));
|
||||
}
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
const ObIArray<ObSelectStmt*> &child_stmts = ref_stmt->get_set_query();
|
||||
for (int64_t i = 0; OB_SUCC(ret) && i < child_stmts.count(); ++i) {
|
||||
ret = check_select_stmt(child_stmts.at(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
LOG_DEBUG("check any value end stmt", K(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObAnyValueChecker::check_any_value(const ObRawExpr *expr, const ObColumnRefRawExpr * undefined_column)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
|
||||
Reference in New Issue
Block a user