Set up: include the attached file in a webapp subdirectory called testfeed.
I initially wrote a simple join between the atom:feed and the mapping info, using a script variable to contain the map:
mapping = [
{
"name" : "A",
"user" : "engineering"
},
{
"name" : "B",
"user" : "pre-sales"
}
];
create table test.feed on select get from "http://localhost:8080/testfeed/test.xml" resultset "atom:feed.atom:entry";
select test.atom:content.vsc:Thing.vsc:displayName as t:displayName,
umap.name as umap_name,
test.atom:content.vsc:Thing.inst:p1 as t:p1,
umap.user as user
from test.feed as test, mapping as umap
where umap.name = test.atom:content.vsc:Thing.vsc:displayName;The response is what I expected:
[
{
"t:displayName": "A",
"umap_name": "A",
"t:p1": "A property1",
"user": "engineering"
},
{
"t:displayName": "B",
"umap_name": "B",
"t:p1": "B property1",
"user": "pre-sales"
}
]
When
I converted the script to instead pull the mapping file in from an http
call (to the same data contained in a file in the /testfeed webapp called user-map.json), I
get different join results:
create table mapping on select get from "http://localhost:8080/testfeed/user-map.json" ;The exact same select statement seems to create a union instead of a join:
[
{
"t:displayName": "A",
"umap_name": "A",
"t:p1": "A property1",
"user": "engineering"
},
{
"t:displayName": "A",
"umap_name": "B",
"t:p1": "A property1",
"user": "pre-sales"
},
{
"t:displayName": "B",
"umap_name": "A",
"t:p1": "B property1",
"user": "engineering"
},
{
"t:displayName": "B",
"umap_name": "B",
"t:p1": "B property1",
"user": "pre-sales"
},
{
"t:displayName": "C",
"umap_name": "A",
"t:p1": "C property1",
"user": "engineering"
},
{
"t:displayName": "C",
"umap_name": "B",
"t:p1": "C property1",
"user": "pre-sales"
}
]What am I missing that would explain why these two scripts give different results?
thanks in advance
sgg