(from Kian Win and the UCSD SQL++ gang)
While running some new experiments on AsterixDB 0.8.6, we encountered an
interesting behavior that is reminiscent of outer-joins / outer-correlates.
A. Surprising behavior
Query:
use dataverse experiments;
create type sType as closed{b : int32};
create dataset s(sType) primary key b;
insert into dataset s ({ "b" : 1});
insert into dataset s ({ "b" : 3});
for $x in {{ {"a":1},{"a":2} }}
for $y in (
for $z in dataset s where $x.a=$z.b
return $z.b
)
return {"x":$x,"y":$y}
Output :
{ "x": { "a": 1 }, "y": 1 }
{ "x": { "a": 2 }, "y": null }
B. Expected behavior
Query:
for $x in {{ {"a":1},{"a":2} }}
for $y in (
for $z in {{ {"b":1},{"b":3} }} where $x.a=$z.b
return $z.b
)
return {"x":$x,"y":$y}
Output:
{ "x": { "a": 1 }, "y": 1 }
In Scenario A, tuple 2 is retained even when the correlated condition fails and
y is null-padded, which reminds one of a SQL outer-join.
NOTE: Scenerio B is right, Scenerio A is a bug.
Original issue reported on code.google.com by dtab...@gmail.com on 2 Feb 2015 at 7:13
Original issue reported on code.google.com by
dtab...@gmail.com
on 2 Feb 2015 at 7:13