From af4fb1e2a31f01eda1975b7182b7c8630107107c Mon Sep 17 00:00:00 2001 From: David Sisson Date: Mon, 29 Jan 2024 20:22:02 -0800 Subject: [PATCH] Tidy fixes. --- .../parser/SubstraitPlanRelationVisitor.cpp | 15 ++++++++------- .../SubstraitPlanSubqueryRelationVisitor.cpp | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/substrait/textplan/parser/SubstraitPlanRelationVisitor.cpp b/src/substrait/textplan/parser/SubstraitPlanRelationVisitor.cpp index d7aeb10c..51525404 100644 --- a/src/substrait/textplan/parser/SubstraitPlanRelationVisitor.cpp +++ b/src/substrait/textplan/parser/SubstraitPlanRelationVisitor.cpp @@ -828,7 +828,7 @@ std::any SubstraitPlanRelationVisitor::visitRelationEmit( ctx->getStart(), "Emits do not make sense for this kind of relation."); return defaultResult(); } - typedef std::pair intPair; + using intPair = std::pair; auto [stepsOut, fieldReference] = ANY_CAST(intPair, result); if (stepsOut > 0) { errorListener_->addError( @@ -2123,12 +2123,13 @@ bool SubstraitPlanRelationVisitor::hasSubquery( if (auto* funcUseCtx = dynamic_cast( ctx)) { - for (auto* expr : funcUseCtx->expression()) { - if (hasSubquery(expr)) { - return true; - } - } - return false; + const auto& expressions = funcUseCtx->expression(); + return any_of( + expressions.begin(), + expressions.end(), + [&](SubstraitPlanParser::ExpressionContext* expr) { + return hasSubquery(expr); + }); } else if ( auto* constantCtx = dynamic_cast(ctx)) { diff --git a/src/substrait/textplan/parser/SubstraitPlanSubqueryRelationVisitor.cpp b/src/substrait/textplan/parser/SubstraitPlanSubqueryRelationVisitor.cpp index 717cc2b7..1b483a52 100644 --- a/src/substrait/textplan/parser/SubstraitPlanSubqueryRelationVisitor.cpp +++ b/src/substrait/textplan/parser/SubstraitPlanSubqueryRelationVisitor.cpp @@ -880,7 +880,7 @@ std::any SubstraitPlanSubqueryRelationVisitor::visitRelationEmit( ctx->getStart(), "Emits do not make sense for this kind of relation."); return defaultResult(); } - typedef std::pair intPair; + using intPair = std::pair; auto [stepsOut, fieldReference] = ANY_CAST(intPair, result); if (stepsOut > 0) { errorListener_->addError(