trafodion-codereview mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From DaveBirdsall <...@git.apache.org>
Subject [GitHub] incubator-trafodion pull request #624: [TRAFODION-2130] Incorrect subquery u...
Date Fri, 29 Jul 2016 21:37:53 GMT
Github user DaveBirdsall commented on a diff in the pull request:

    https://github.com/apache/incubator-trafodion/pull/624#discussion_r72864739
  
    --- Diff: core/sql/optimizer/NormRelExpr.cpp ---
    @@ -3044,14 +3044,23 @@ Join::pullUpGroupByTransformation()
     //             a copy of join as the child. The original tree has not changed.
     //             The predicates in the new groupBy and the new Join will have
     //             changed according to the comments above.
    +//
     ------------------------------------------------------------------------------*/
     GroupByAgg* Join::pullUpGroupByTransformation(NormWA& normWARef)
     {
       CollHeap *stmtHeap = CmpCommon::statementHeap() ;
     
    -  // Determine a set of unique columns for the left sub-tree
    +  // Determine a set of unique columns for the left sub-tree.
    +
    +  // Note: Scans and joins synthesize uniqueness constraints even for
    +  // columns that are not in the characteristic outputs. Other
    +  // operators such as groupby or union don't. We make use of these
    +  // extra uniqeness constraints here. Any needed columns not yet
    +  // added to the characteristic outputs will be added later, in
    +  // method getMoreOutputsIfPossible().
    +
       ValueIdSet leftUniqueCols ;
    -  if (NOT (child(0)-getGroupAttr()->findUniqueCols(leftUniqueCols)))
    +  if (NOT (child(0)->getGroupAttr()->findUniqueCols(leftUniqueCols)))
    --- End diff --
    
    In answer to @selvaganesang, it called getGroupAttr()->findUniqueCols(leftUniqueCols)
on "this", and subtracted that results (an NABoolean?) from the pointer child(0). That would
almost always be non-zero. So the NOT would render it zero, and the "if" would not be taken.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message