trafodion-codereview mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zellerh <>
Subject [GitHub] incubator-trafodion pull request #739: [TRAFODION-2159] Outputs not promoted...
Date Mon, 03 Oct 2016 21:14:08 GMT
Github user zellerh commented on a diff in the pull request:
    --- Diff: core/sql/optimizer/NormRelExpr.cpp ---
    @@ -3958,9 +3963,12 @@ GroupByAgg* Join::moveUpGroupByTransformation(const GroupByAgg*
       GroupByAgg *moveUpGrby;
       ValueIdSet emptySet ;
       GroupByAgg *movedUpGrbyTail = (GroupByAgg*) topGrby;
    +  GroupByAgg *subQGrby = NULL;
       RelExpr * joinRightChild = child(1)->castToRelExpr();
       CollHeap *stmtHeap = CmpCommon::statementHeap() ;
    +  if (((RelExpr*)topGrby->child(0))->getOperatorType() == REL_GROUPBY)
    --- End diff --
    This fix may be ok, but I find it very confusing and think that future readers of this
code may be confused as well. I think most of us would expect the parent of the join to be
passed in here. May I suggest to fix this bug in the caller, Join::semanticQueryOptimizeNode()?
When I look at that code, the problem is immediately obvious, it doesn't always pass the parent
node of the join to moveUpGroupByTransformation.
    Some possible solutions for a fix, you may find a better one:
    - Change topGrby parameter to `RelExpr *pointerToMyParent` and change the caller to pass
in the correct pointer to the parent.
    - Change topGrby parameter to `ExprGroupId &locationOfPointerToMe` and let the caller
pass that in.
    - Get rid of the "topGrby" parameter and return the topmost of the moved-up groupbys (or
the join, if none was moved up). Then let the caller hook up that result of the transformation
at the right place.

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