[ 
https://issues.apache.org/jira/browse/TRAFODION-2901?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16494283#comment-16494283
 ] 

ASF GitHub Bot commented on TRAFODION-2901:
-------------------------------------------

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.


> using sequence to do upsert get wrong number of rows after several times
> ------------------------------------------------------------------------
>
>                 Key: TRAFODION-2901
>                 URL: https://issues.apache.org/jira/browse/TRAFODION-2901
>             Project: Apache Trafodion
>          Issue Type: Bug
>            Reporter: liu ming
>            Assignee: Gu Haiyan
>            Priority: Major
>
> create table test_seq
> (id  LARGEINT not null
> ) primary key(id)
>   SALT USING 48 PARTITIONS
>  ATTRIBUTES ALIGNED FORMAT
>   HBASE_OPTIONS
>   (
>     DATA_BLOCK_ENCODING = 'FAST_DIFF',
>     MEMSTORE_FLUSH_SIZE = '1073741824'
>   );
> create sequence seq1;
> upsert into test_seq select seqnum(seq1, next) from dual;
> upsert into test_seq select seqnum(seq1, next) from test_seq; 
> upsert into test_seq select seqnum(seq1, next) from test_seq;
> upsert into test_seq select seqnum(seq1, next) from test_seq;
> upsert into test_seq select seqnum(seq1, next) from test_seq;
> upsert into test_seq select seqnum(seq1, next) from test_seq;
> upsert into test_seq select seqnum(seq1, next) from test_seq;
> upsert into test_seq select seqnum(seq1, next) from test_seq;
> upsert into test_seq select seqnum(seq1, next) from test_seq;
> --- 130 row(s) inserted.
> Should be 128 rows



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to