trafodion-codereview mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sureshsubbiah <>
Subject [GitHub] incubator-trafodion pull request #657: [TRAFODION-2159] Unnest correlated su...
Date Wed, 17 Aug 2016 21:53:40 GMT
Github user sureshsubbiah commented on a diff in the pull request:
    --- Diff: core/sql/optimizer/NormRelExpr.cpp ---
    @@ -2404,8 +2412,13 @@ void Join::createAFilterGrandChildIfNeeded(NormWA & normWARef)
       if (doNotUnnest == FALSE)
    -    if (oldRightGrandChild->selectionPred().getReferencedPredicates
    -                                        (outerReferences, nonLocalPreds))
    +    oldRightGrandChild->selectionPred().getReferencedPredicates
    +      (outerReferences, nonLocalPreds) ;
    +    if (nestedAggInSubQ)
    +      subQGby->selectionPred().getReferencedPredicates
    +	(outerReferences, nonLocalPreds);
    +    if (!nonLocalPreds.isEmpty())
    --- End diff --
    I think for a groupby by the time we get past the binder the having clause is the same
as the where clause. In other words the predicate is kept in selectionPred() of RelExpr base
class. It is applied at the end of the work method before a result row is sent to parent.
From a SQL syntax point of view this works for HAVING, since now the selectionPred() can reference
aggregates evaluated in this GB.

If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at or file a JIRA ticket
with INFRA.

View raw message