From 75c6144a7351f38ae8ef3cd88814c98d96bfd41f Mon Sep 17 00:00:00 2001 From: obdev Date: Thu, 8 Dec 2022 08:09:04 +0000 Subject: [PATCH] fix adjust_subquery_list bug --- .../aggregate/ob_aggregate_function.cpp | 1 - src/sql/resolver/dml/ob_dml_stmt.cpp | 19 ++++++++++++++++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/sql/engine/aggregate/ob_aggregate_function.cpp b/src/sql/engine/aggregate/ob_aggregate_function.cpp index 44b4fdf184..51de31602f 100644 --- a/src/sql/engine/aggregate/ob_aggregate_function.cpp +++ b/src/sql/engine/aggregate/ob_aggregate_function.cpp @@ -2832,7 +2832,6 @@ int ObAggregateFunction::get_result(ObNewRow &row, const common::ObTimeZoneInfo } } } - LOG_DEBUG("get result row", K(row)); return ret; } diff --git a/src/sql/resolver/dml/ob_dml_stmt.cpp b/src/sql/resolver/dml/ob_dml_stmt.cpp index c35a62a60b..806854c9a1 100644 --- a/src/sql/resolver/dml/ob_dml_stmt.cpp +++ b/src/sql/resolver/dml/ob_dml_stmt.cpp @@ -3615,9 +3615,22 @@ int ObDMLStmt::adjust_subquery_list() ObSEArray relation_exprs; if (OB_FAIL(get_relation_exprs(relation_exprs))) { LOG_WARN("failed to get relation exprs", K(ret)); - } else if (FALSE_IT(subquery_exprs_.reset())) { - } else if (OB_FAIL(ObTransformUtils::extract_query_ref_expr(relation_exprs, subquery_exprs_))) { - LOG_WARN("failed to extract query ref expr", K(ret)); + } else { + subquery_exprs_.reset(); + ObRawExpr *expr = NULL; + // extract query ref expr will use flag, call extract_info first + for (int64_t i = 0; OB_SUCC(ret) && i < relation_exprs.count(); ++i) { + if (OB_ISNULL(expr = relation_exprs.at(i))) { + ret = OB_ERR_UNEXPECTED; + LOG_WARN("unexpected expr", K(ret)); + } else if (OB_FAIL(expr->extract_info())) { + LOG_WARN("failed to extract info", K(*expr)); + } + } + + if (OB_SUCC(ret) && OB_FAIL(ObTransformUtils::extract_query_ref_expr(relation_exprs, subquery_exprs_))) { + LOG_WARN("failed to extract query ref expr", K(ret)); + } } return ret; } -- GitLab