namhnguyen / asterixdb

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

Semantically equivalent FLWOR expressions involving dataset lookup; one executes fine, other fails with NPE during compilation #828

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago

[NOTE]: I am experiencing this issue in context of feed ingestion, but 
simplifying/reducing the problem here for ease in reproducing it without 
needing to setup feeds.  

We execute the following statements.
=====================
create dataverse test;
use dataverse test;

create type account as open{
id: int32,
sum:int32
}

create dataset Accounts(account)
primary key id;

insert into dataset Accounts(
{"id": 1, "sum":100})
insert into dataset Accounts(
{"id": 2, "sum":150})
====================

Next, we write two equivalent FLWOR expressions. 
TYPE A 
for $x in range(1,2)
let $z := (for $y in dataset Accounts where $y.id=$x return $y)
return {"x":$x, "z":$z}

TYPE B
for $x in range(1,2)
return(
let $z:=(for $y in dataset Accounts where $y.id=$x return $y)
return {"x":$x, "z":$z})

What is the expected output? 

Expected Output:
Both forms should return identical (correct) result (shown below):
{ "x": 1, "z": [ { "id": 1, "sum": 100 } ] }
{ "x": 2, "z": [ { "id": 2, "sum": 150 } ] }

What do you see instead?
TYPE A works fine but its equivalent TYPE B gives an NPE (see attached file)

Original issue reported on code.google.com by RamanGro...@gmail.com on 20 Nov 2014 at 11:05

GoogleCodeExporter commented 9 years ago

Original comment by RamanGro...@gmail.com on 20 Nov 2014 at 11:06

Attachments: