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

    https://github.com/apache/trafodion/pull/1581#discussion_r191980234
  
    --- 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 --
    
    Thank for the comment. I think your concern about the empty original_output 
seems reasonable. After binder, the original characteristic output for Scan 
consists of getTableDesc()->getColumnList() and 
getTableDesc()->hbaseAttrList(). But it is hard to decide what happened to the 
output during transformer. So there may be possibility  that the characteristic 
output for Scan becomes empty after transform, and I am not quite sure about 
that.
    
    So I think the simplest way is taking 
child(0)->getTableDescForExpr()->getColumnList() as the output source picked 
from, instead of original_output in the PR. In this way, the source output will 
never be empty.


---

Reply via email to