trafodion-codereview mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From DaveBirdsall <>
Subject [GitHub] trafodion pull request #1558: [TRAFODION-3066] Fix bug that causes 2053 warn...
Date Wed, 09 May 2018 23:23:39 GMT
GitHub user DaveBirdsall opened a pull request:

    [TRAFODION-3066] Fix bug that causes 2053 warning on deeply nested subqueries

    When a query has at least three levels of subquery, and when the subqueries are transformed
from semi-joins to inner-joins, we may see an Optimizer assertion failure warning (2053) when
preparing the query. This bug has been there for a long time but is more likely now due to
the changes in
    The problem is that when transforming a semi-join to an inner-join + group by, the new
GroupByAgg node was getting its GroupAttributes as a copy of the child node. If the child
node happened to also be a Join (as would happen with nested subqueries), the numJoinedTables_
field for the GroupByAgg's GroupAttributes would remain 2 or more. If during optimization,
the GroupByOnJoinRule fired, pushing the GroupByAgg down, we end up with another Join expression
in the same group. But having numJoinedTables_ being 2 or more in that Group would allow the
LeftShiftJoinRule to fire, with the result that we might get multiple GroupBy criteria in
the same join backbone. The Analysis.cpp module does not expect this expansion of the join
back bone, and raises the assertion, which results in the 2053 warning.
    The fix is that when Join::transformSemiJoin creates the new GroupByAgg node, it must
reset numJoinedTables_ in its new GroupAttributes object to 1.

You can merge this pull request into a Git repository by running:

    $ git pull Trafodion3066

Alternatively you can review and apply these changes as the patch at:

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #1558
commit 3d54d5ac8ab797335e32bd6bbefff4150452bd15
Author: Dave Birdsall <dbirdsall@...>
Date:   2018-05-09T23:15:17Z

    [TRAFODION-3066] Fix bug that causes 2053 warning on deeply nested subqueries



View raw message