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

    
https://github.com/apache/incubator-trafodion/pull/1009#discussion_r106193976
  
    --- Diff: core/sql/regress/seabase/EXPECTED031 ---
    @@ -888,6 +960,143 @@ CREATE INDEX T031T1I1 ON TRAFODION.SCH.T031T1
     
     --- SQL operation complete.
     >>
    +>>-- purgedata of table with delimited name
    +>>drop table if exists "tT";
    +
    +--- SQL operation complete.
    +>>create table "tT" (a int);
    +
    +--- SQL operation complete.
    +>>purgedata "tT";
    +
    +--- SQL operation complete.
    +>>
    +>>-- group by rollup would sometimes crash compiler.
    +>>drop table if exists mytable;
    +
    +--- SQL operation complete.
    +>>create table mytable(a char(10), b char(10), c int, d int);
    +
    +--- SQL operation complete.
    +>>insert into mytable values
    ++>('A1', 'B1', 1, 1),
    ++>('A1', 'B1', 1, 2),
    ++>('A1', 'B1', 2, 3),
    ++>('A1', 'B1', 2, 4),
    ++>('A1', 'B2', 3, 5),
    ++>('A1', 'B2', 3, 6),
    ++>('A1', 'B2', 4, 7),
    ++>('A1', 'B2', 4, 8),
    ++>('A2', 'B3', 5, 9),
    ++>('A2', 'B3', 5, 10),
    ++>('A2', 'B3', 6, 11),
    ++>('A2', 'B3', 6, 12),
    ++>('A2', 'B4', 7, 13),
    ++>('A2', 'B4', 7, 14),
    ++>('A2', 'B4', 8, 15),
    ++>('A2', 'B4', 8, 16);
    +
    +--- 16 row(s) inserted.
    +>>select a, b, c, sum(d) as newcol from mytable where a in ('A1') 
    ++>  group by(a, b, c);
    +
    +A           B           C            NEWCOL              
    +----------  ----------  -----------  --------------------
    +
    +A1          B1                    1                     3
    +A1          B2                    3                    11
    +A1          B2                    4                    15
    +A1          B1                    2                     7
    +
    +--- 4 row(s) selected.
    +>>select a, b, c, sum(d) as newcol from mytable where d > 5 
    ++>  group by rollup(a, b, c);
    +
    +A           B           C            NEWCOL              
    +----------  ----------  -----------  --------------------
    +
    +A1          B2                    3                     6
    +A1          B2                    4                    15
    +A1          B2                    ?                    21
    +A1          ?                     ?                    21
    +A2          B3                    5                    19
    +A2          B3                    6                    23
    +A2          B3                    ?                    42
    +A2          B4                    7                    27
    +A2          B4                    8                    31
    +A2          B4                    ?                    58
    +A2          ?                     ?                   100
    +?           ?                     ?                   121
    +
    +--- 12 row(s) selected.
    +>>select a, b, c, sum(d) as newcol from mytable where a in ('A1') 
    ++>  group by rollup(a, b, c);
    +
    +A           B           C            NEWCOL              
    +----------  ----------  -----------  --------------------
    +
    +A1          B1                    1                     3
    +A1          B1                    2                     7
    +A1          B1                    ?                    10
    +A1          B2                    3                    11
    +A1          B2                    4                    15
    +A1          B2                    ?                    26
    +A1          B3                    5                    19
    +A1          B3                    6                    23
    +A1          B3                    ?                    42
    +A1          B4                    7                    27
    +A1          B4                    8                    31
    +A1          B4                    ?                    58
    +A1          ?                     ?                   136
    +A1          ?                     ?                   136
    --- End diff --
    
    You are right, this is an existing bug. 
    For a statement of the form:
      select a, sum(a) from t where a = 1 group by rollup (a)
    the VEG transformation replaces the 'a' in select list with '1' and
    that causes that column to not return a null('?') as part of the
    final rollup group. We probably need to have VEG transformation
    use the column 'a' instead of '1'.
    Will file a separate jira for this case.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to