shamim8888 / asterixdb

Automatically exported from code.google.com/p/asterixdb
0 stars 0 forks source link

Return a nested record #882

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Consider a record that has a nested record "kids" that includes fields like 
"name" and "age". The system will return $r.kids.name, but fails to return 
$r.kids. The results are randomly scrambled data.

What steps will reproduce the problem?
1. Use the following queries:

drop dataverse TinyCollege if exists;
create dataverse TinyCollege;
use dataverse TinyCollege;

create type MentorType as open {
    name:string
}

create type StaffType as open {
        name: string,
        office: string,
        employment: interval,
        mentor: MentorType
}
create dataset Staff(StaffType)
primary key name;

insert into dataset Staff ({"name":"Alex", "office":"A", 
"employment":interval-from-date(date("2003-01-01"), date("2008-01-01")), 
"mentor":{"name":"Agent K", "status":"unknown"}, 
"kids":{"name":"Joe","age":13}});
insert into dataset Staff ({"name":"Frank", "office":"A", 
"employment":interval-from-date(date("2004-01-01"), date("2009-01-01")), 
"mentor":{"name":"Agent K", "status":"unknown"}, 
"kids":{"name":"Wrae","age":10}});
insert into dataset Staff ({"name":"Henry", "office":"C", 
"employment":interval-from-date(date("2003-01-01"), date("2008-01-01")), 
"mentor":{"name":"Agent K", "status":"unknown"}});
insert into dataset Staff ({"name":"Mary", "office":"B", 
"employment":interval-from-date(date("2006-01-01"), date("2010-01-01")), 
"mentor":{"name":"Agent K", "status":"unknown"}, 
"kids":{"name":"Jill","age":11}});
insert into dataset Staff ({"name":"Vicky", "office":"D", 
"employment":interval-from-date(date("2001-01-01"), date("2010-01-01")), 
"mentor":{"name":"Agent K", "status":"unknown"}});

for $f in dataset TinyCollege.Staff
return $f.kids;

2.
3.

What is the expected output? What do you see instead?
Expected:
[ null, 
null,
{"name":"Joe","age":13},
{"name":"Wrae","age":10},
{"name":"Jill","age":11}
]

Result:
A list of five values with two nulls. The three records have random results 
(changes each time I run the query).

Please use labels and text to provide additional information.

Original issue reported on code.google.com by ecarm...@ucr.edu on 15 May 2015 at 4:40

GoogleCodeExporter commented 8 years ago
I notice if you just do this query:

for $f in dataset TinyCollege.Staff
return $f;

It gives an error as well:
No printer for type INTERVAL [NotImplementedException]

I think this is unrelated though so I'm filing it as a second bug.

This bug seems to only happen when retrieving a nested record that is at the 
top level right?

Original comment by sjaco...@ucr.edu on 15 May 2015 at 4:53

GoogleCodeExporter commented 8 years ago
The issue involves all level of the nested fields except the root. (not just 
the top level)

Original comment by ecarm...@ucr.edu on 15 May 2015 at 5:08

GoogleCodeExporter commented 8 years ago
I fixed a concurrency issue on my branch that may have fixed this issue. Still 
testing.

Original comment by ecarm...@ucr.edu on 5 Jun 2015 at 4:21