diff options
| author | vitya-smirnov <[email protected]> | 2025-09-03 16:23:37 +0300 |
|---|---|---|
| committer | vitya-smirnov <[email protected]> | 2025-09-03 16:53:40 +0300 |
| commit | 1a6fddffd17953f4ed4d20de9fdd5c010166acd1 (patch) | |
| tree | 1f90d4097dccbfa041bc9ef3ce695e75f51a3ed3 /yql/essentials/sql/v1/sql_expression.cpp | |
| parent | db0b30ed142b14352bba1fb6e67768928da20d49 (diff) | |
YQL-20189: Track warnings as errors
There was an issue that a query with warnings
as errors passed translation.
commit_hash:890d18853380b5ad669e9684553cdb6991827cff
Diffstat (limited to 'yql/essentials/sql/v1/sql_expression.cpp')
| -rw-r--r-- | yql/essentials/sql/v1/sql_expression.cpp | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/yql/essentials/sql/v1/sql_expression.cpp b/yql/essentials/sql/v1/sql_expression.cpp index bceda17f2eb..9876371f27d 100644 --- a/yql/essentials/sql/v1/sql_expression.cpp +++ b/yql/essentials/sql/v1/sql_expression.cpp @@ -1233,7 +1233,9 @@ TNodePtr TSqlExpression::LambdaRule(const TRule_lambda& rule) { TVector<TString> argNames; for (const auto& arg : args) { argNames.push_back(arg.Name); - PopNamedNode(arg.Name); + if (!PopNamedNode(arg.Name)) { + return {}; + } } if (!ret) { return {}; @@ -1659,7 +1661,9 @@ bool TSqlExpression::SqlLambdaExprBody(TContext& ctx, const TRule_lambda_body& n } for (const auto& name : localNames) { - PopNamedNode(name); + if (!PopNamedNode(name)) { + return false; + } } if (!nodeExpr) { @@ -1903,7 +1907,12 @@ TNodePtr TSqlExpression::SubExpr(const TRule_xor_subexpr& node, const TTrailingQ } if (!Ctx_.PragmaRegexUseRe2) { - Ctx_.Warning(pos, TIssuesIds::CORE_LEGACY_REGEX_ENGINE) << "Legacy regex engine works incorrectly with unicode. Use PRAGMA RegexUseRe2='true';"; + if (!Ctx_.Warning(pos, TIssuesIds::CORE_LEGACY_REGEX_ENGINE, [](auto& out) { + out << "Legacy regex engine works incorrectly with unicode. " + << "Use PRAGMA RegexUseRe2='true';"; + })) { + return nullptr; + } } const auto& matcher = Ctx_.PragmaRegexUseRe2 ? @@ -1957,7 +1966,11 @@ TNodePtr TSqlExpression::SubExpr(const TRule_xor_subexpr& node, const TTrailingQ if (altCase == TRule_cond_expr::TAlt3::TBlock1::kAlt4 && !cond.GetAlt_cond_expr3().GetBlock1().GetAlt4().HasBlock1()) { - Ctx_.Warning(Ctx_.Pos(), TIssuesIds::YQL_MISSING_IS_BEFORE_NOT_NULL) << "Missing IS keyword before NOT NULL"; + if (!Ctx_.Warning(Ctx_.Pos(), TIssuesIds::YQL_MISSING_IS_BEFORE_NOT_NULL, [](auto& out) { + out << "Missing IS keyword before NOT NULL"; + })) { + return {}; + } } auto isNull = BuildIsNullOp(pos, res); @@ -1978,8 +1991,11 @@ TNodePtr TSqlExpression::SubExpr(const TRule_xor_subexpr& node, const TTrailingQ const bool oneArgNull = left->IsNull() || right->IsNull(); if (res->IsNull() || bothArgNull || (symmetric && oneArgNull)) { - Ctx_.Warning(pos, TIssuesIds::YQL_OPERATION_WILL_RETURN_NULL) - << "BETWEEN operation will return NULL here"; + if (!Ctx_.Warning(pos, TIssuesIds::YQL_OPERATION_WILL_RETURN_NULL, [](auto& out) { + out << "BETWEEN operation will return NULL here"; + })) { + return {}; + } } auto buildSubexpr = [&](const TNodePtr& left, const TNodePtr& right) { |
