Rework based on Hans' comments
Project: http://git-wip-us.apache.org/repos/asf/trafodion/repo Commit: http://git-wip-us.apache.org/repos/asf/trafodion/commit/1400b7ed Tree: http://git-wip-us.apache.org/repos/asf/trafodion/tree/1400b7ed Diff: http://git-wip-us.apache.org/repos/asf/trafodion/diff/1400b7ed Branch: refs/heads/master Commit: 1400b7ed292f3b53a1d83c3ad868bfdefa47e74b Parents: 2f2714d Author: Dave Birdsall <[email protected]> Authored: Tue Feb 27 18:30:39 2018 +0000 Committer: Dave Birdsall <[email protected]> Committed: Tue Feb 27 18:30:39 2018 +0000 ---------------------------------------------------------------------- core/sql/optimizer/BindRelExpr.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafodion/blob/1400b7ed/core/sql/optimizer/BindRelExpr.cpp ---------------------------------------------------------------------- diff --git a/core/sql/optimizer/BindRelExpr.cpp b/core/sql/optimizer/BindRelExpr.cpp index f78d6fb..4b4d39c 100644 --- a/core/sql/optimizer/BindRelExpr.cpp +++ b/core/sql/optimizer/BindRelExpr.cpp @@ -6094,10 +6094,10 @@ RelExpr *RelRoot::bindNode(BindWA *bindWA) if (prevScope) inRowSubquery = prevScope->context()->inRowSubquery(); - NABoolean GroupByAggNodeAdded = FALSE; + NABoolean groupByAggNodeAdded = FALSE; if (inRowSubquery && (CmpCommon::getDefault(COMP_BOOL_137) == DF_OFF)) // force adding one row aggregates in the [last 0] case - GroupByAggNodeAdded = addOneRowAggregates(bindWA, + groupByAggNodeAdded = addOneRowAggregates(bindWA, getFirstNRows() == -2 /* [last 0] case */); returnedRoot = @@ -6690,7 +6690,7 @@ RelExpr *RelRoot::bindNode(BindWA *bindWA) // to force the aggregates to become NULL. Adding a one-row // aggregate group on top of the scalar aggregate, with the FirstN // node in between them does the trick. - if (GroupByAggNodeAdded && + if (groupByAggNodeAdded && ( (getFirstNRows() == 1) || // [first 1] or [any 1] (getFirstNRows() == -2) || // [last 0] (getFirstNRows() == -3) ) ) // [last 1] @@ -6698,9 +6698,9 @@ RelExpr *RelRoot::bindNode(BindWA *bindWA) nodeToInsertUnder = child(0); CMPASSERT(nodeToInsertUnder->getOperatorType() == REL_GROUPBY); } - else if (!GroupByAggNodeAdded && (getFirstNRows() == -2)) // [last 0] + else if (!groupByAggNodeAdded && (getFirstNRows() == -2)) // [last 0] { - CMPASSERT(GroupByAggNodeAdded); // a GroupByAgg should have been forced + CMPASSERT(groupByAggNodeAdded); // a GroupByAgg should have been forced } else // a case where we can throw the [first/any/last N] away {
