Vignesh Raghunathan created ASTERIXDB-1712:
----------------------------------------------

             Summary: Can't select fields if query contains union all clause 
with select * in from clause
                 Key: ASTERIXDB-1712
                 URL: https://issues.apache.org/jira/browse/ASTERIXDB-1712
             Project: Apache AsterixDB
          Issue Type: Bug
            Reporter: Vignesh Raghunathan


Consider the following sql++ statements:

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

create type samptabletype as closed {
  id: int8
};

create dataset samptable1(samptabletype) primary key id;

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

create dataset samptable2(samptabletype) primary key id;

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

select *
from 
(select * from samptable1
union all
select * from samptable2
) tab1;
{code}

The result is:

{code}
{ "tab1": { "samptable2": { "id": 1 } } }
{ "tab1": { "samptable2": { "id": 2 } } }
{ "tab1": { "samptable1": { "id": 1 } } }
{ "tab1": { "samptable1": { "id": 2 } } }
{ "tab1": { "samptable2": { "id": 3 } } }
{ "tab1": { "samptable1": { "id": 3 } } }
{code}

However, there is no way to express the following query to display only ids:

select tab1.samptable(1/2 ??).id 
from 
(select * from samptable1
union all
select * from samptable2
) tab1;



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

Reply via email to