Thanks to visit codestin.com
Credit goes to github.com

Skip to content

odd join behavior #572

@sggraham32

Description

@sggraham32

Set up: include the attached file in a webapp subdirectory called testfeed that was included in the ql.io discuss forum in a post by me with the same subject line.

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"
}

]

The data is really the same in both situations, I would expect the result of the select statement to be the same too.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions