trafodion-codereview mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From andyyangcn <...@git.apache.org>
Subject [GitHub] trafodion pull request #1543: [TRAFODION 3047] Cannot get right result using...
Date Tue, 08 May 2018 02:30:20 GMT
Github user andyyangcn commented on a diff in the pull request:

    https://github.com/apache/trafodion/pull/1543#discussion_r186602771
  
    --- Diff: core/sql/optimizer/RelExpr.cpp ---
    @@ -7880,11 +7880,17 @@ NABoolean GroupByAgg::tryToPullUpPredicatesInPreCodeGen(
           else
             pulledPredicates += tempPulledPreds;
     
    +      // just remove pulled up predicates from char. input
    +      ValueIdSet newInputs(getGroupAttr()->getCharacteristicInputs());
    +      myLocalExpr += selectionPred();
    +      myLocalExpr -= tempPulledPreds;
    +      myLocalExpr.weedOutUnreferenced(newInputs);
    --- End diff --
    
    Dave, you can use the follow SQLs to reproduce this issue.
    
    create table dom(area_id varchar(50), type_cd varchar(4));
    create table dic(area_id varchar(50) );
    CREATE TABLE CODE
      (
        LANG_CD  VARCHAR(10)
      , UP_CD_ID VARCHAR(50)
      , CD_ID    VARCHAR(50)
      , CD_NM    VARCHAR(100)
      );
    insert into dom values('12345678', '0003');
    insert into dic values('12345678');
    insert into code values('zh_CN','6023', '0003', 'level code');
    prepare s1 from SELECT  (SELECT 'Y'
             FROM dual
             WHERE EXISTS (SELECT 1
                             FROM dic
                            WHERE area_id = dom.area_id)) impact_yn
    
             , (SELECT cd_nm
                  FROM code
                 WHERE lang_cd = 'zh_CN'
                   AND up_cd_id = '6023'
                   AND cd_id = dom.type_cd) dic_gbn_nm
    FROM dom
    WHERE dom.area_id = ?
          AND dom.type_cd = '0003';
          
          
    execute s1 using '12345678';



---

Mime
View raw message