Steve Carlin created CALCITE-7421:
-------------------------------------

             Summary: Decorrelation query issue with rollup
                 Key: CALCITE-7421
                 URL: https://issues.apache.org/jira/browse/CALCITE-7421
             Project: Calcite
          Issue Type: Bug
    Affects Versions: 1.42.0
            Reporter: Steve Carlin


Ok, so I think this is a bug.  I'm not too familiar with the Calcite test 
framework to try to repro it there yet, but I can repro it with a couple of 
steps on my database which I can detail here:



 
{code:java}
create table tbl1 (col1 int, join_col int);
insert into tbl1 values (1, 1);
create table tbl2 (col1 int, join_col int, extra_rollup_col int);
insert into tbl2 values (2, 2, 2);
select col1 from tbl1 a
where exists
 (select col1 from tbl2 b
  where a.join_col = b.join_col
  group by rollup(col1, extra_rollup_col))
{code}
 

 

If I use version 1.41, it returns 0 rows which is what I expect.

When I use 1.42.0-SNAPSHOT, it is returning 1 row.

I think it has to do with the following lines?
[https://github.com/apache/calcite/blob/main/core/src/main/java/org/apache/calcite/sql2rel/RelDecorrelator.java#L845-L849]

If I comment out these lines, the query works as expected in my database.

Thanks!


 

 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to