Repository: trafodion Updated Branches: refs/heads/master 0a2ed369d -> c0a125ed3
[TRAFODION-2901] Self-reference Holloween problem fix Project: http://git-wip-us.apache.org/repos/asf/trafodion/repo Commit: http://git-wip-us.apache.org/repos/asf/trafodion/commit/c8c5bce5 Tree: http://git-wip-us.apache.org/repos/asf/trafodion/tree/c8c5bce5 Diff: http://git-wip-us.apache.org/repos/asf/trafodion/diff/c8c5bce5 Branch: refs/heads/master Commit: c8c5bce5baf23c131aa622c6ca6672daa0eb2318 Parents: b04bfda Author: Guhaiyan <[email protected]> Authored: Mon May 28 01:40:27 2018 +0000 Committer: Guhaiyan <[email protected]> Committed: Mon May 28 01:40:27 2018 +0000 ---------------------------------------------------------------------- core/sql/optimizer/RelExpr.cpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafodion/blob/c8c5bce5/core/sql/optimizer/RelExpr.cpp ---------------------------------------------------------------------- diff --git a/core/sql/optimizer/RelExpr.cpp b/core/sql/optimizer/RelExpr.cpp index ea4495a..edad4dd 100644 --- a/core/sql/optimizer/RelExpr.cpp +++ b/core/sql/optimizer/RelExpr.cpp @@ -13331,6 +13331,10 @@ void GenericUpdate::pushdownCoveredExpr(const ValueIdSet &outputExpr, localExprs += *setOfValuesReqdByParent ; localExprs += exprsInDerivedClasses_; + ValueIdSet original_output; + if (avoidHalloween() && child(0) && child(0)->getGroupAttr()) + original_output = child(0)->getGroupAttr()->getCharacteristicOutputs(); + // --------------------------------------------------------------------- // Check which expressions can be evaluated by my child. // Modify the Group Attributes of those children who inherit some of @@ -13341,6 +13345,33 @@ void GenericUpdate::pushdownCoveredExpr(const ValueIdSet &outputExpr, newExternalInputs, predicatesOnParent, &localExprs); + + if (avoidHalloween() && child(0) && child(0)->getGroupAttr()) + { + ValueIdSet cur_output = child(0)->getGroupAttr()->getCharacteristicOutputs(); + if (cur_output.isEmpty()) + { + ValueId exprId; + ValueId atLeastOne; + + for (exprId = original_output.init(); + original_output.next(exprId); + original_output.advance(exprId)) + { + atLeastOne = exprId; + if (!(exprId.getItemExpr()->doesExprEvaluateToConstant(FALSE, TRUE))) + { + child(0)->getGroupAttr()->addCharacteristicOutputs(exprId); + break; + } + } + cur_output = child(0)->getGroupAttr()->getCharacteristicOutputs(); + if (cur_output.isEmpty()) + { + child(0)->getGroupAttr()->addCharacteristicOutputs(atLeastOne); + } + } + } } /*
