Github user DaveBirdsall commented on a diff in the pull request:

    https://github.com/apache/trafodion/pull/1581#discussion_r191576581
  
    --- Diff: core/sql/optimizer/RelExpr.cpp ---
    @@ -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())
    --- End diff --
    
    I don't understand this code path. If cur_output is empty, that means that 
the "for" loop did not find a ValueId to add to it. In particular. "atLeastOne" 
has its initial value, which I think is the null ValueId, 0. This "if" would 
cause us to add the null ValueId to child(0)'s characteristic outputs, which 
does not sound correct to me.


---

Reply via email to