Vignesh Raghunathan created ASTERIXDB-1632:
----------------------------------------------

             Summary: Query having subquery referring to with clause returns 
incorrect results
                 Key: ASTERIXDB-1632
                 URL: https://issues.apache.org/jira/browse/ASTERIXDB-1632
             Project: Apache AsterixDB
          Issue Type: Bug
         Environment: Master branch with latest commit 2b95d9ac95aa6f4dd847
            Reporter: Vignesh Raghunathan


To reproduce the issue, run the following sqlpp statements:

{code}
drop dataverse sampdb if exists;
create dataverse sampdb;
use sampdb;

drop dataset samptable if exists;
drop type samptabletype if exists;

create type samptabletype as closed {
  id: int8
};

create dataset samptable(samptabletype) primary key id;

insert into samptable ({'id' : 1});
insert into samptable ({'id' : 2});
insert into samptable ({'id' : 3});

with samptab as (
select id from samptable
)
select st1.id 
from samptab st1
where st1.id > (select value avg(st2.id) from samptab st2);
{code}

The query doesn't return {id:3}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to