Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v2.2.3 bug] - Duplicate output when @rid doesn't exists #218

Closed
dastoori opened this issue Nov 14, 2016 · 7 comments
Closed

[v2.2.3 bug] - Duplicate output when @rid doesn't exists #218

dastoori opened this issue Nov 14, 2016 · 7 comments
Assignees
Labels

Comments

@dastoori
Copy link

I've recently updated orientjs to 2.2.3 and noticed that in some case it returns duplicate records.

Example:

/* schema */
create class Team extends V;
create property Team.name String;

create class Player extends V;
create property Player.name String;

create class TeamHasPlayer extends E;

/* data */
create vertex Team set name = 'TeamA';
create vertex Player set name = 'Player1';
create vertex Player set name = 'Player2';

create edge TeamHasPlayer from (select from Team) to (select from Player);

Following queries return two records and both of them are the same (notice the @rid field):

// match query
db.query(`
  Match { class: Team, as: team }.out("TeamHasPlayer") {as: player}
  return team.name as team, player.name as player
`).then(res => {
  console.log(res);
});

// output
[ { '@type': 'd',
    team: 'TeamA',
    player: 'Player2',
    '@rid': { [String: '#-1:-1'] cluster: -1, position: -1 },
    '@version': 0 },
  { '@type': 'd',
    team: 'TeamA',
    player: 'Player2',
    '@rid': { [String: '#-1:-1'] cluster: -1, position: -1 },
    '@version': 0 } ]

another example:

// select query
db.select('expand(out("TeamHasPlayer").include("name"))')
  .from('Team')
  .all()
  .then(res => {
    console.log(res);
  });

// output
[ { '@type': 'd',
    name: 'Player2',
    '@rid': { [String: '#-1:-1'] cluster: -1, position: -1 },
    '@version': 0 },
  { '@type': 'd',
    name: 'Player2',
    '@rid': { [String: '#-1:-1'] cluster: -1, position: -1 },
    '@version': 0 } ]

When i add @rid to include(), it returns the correct output:

// query
db.select('expand(out("TeamHasPlayer").include("@rid", "name"))')
  .from('Team')
  .all()
  .then(res => {
    console.log(res);
  });

// output
[ { '@class': 'Player',
    '@type': 'd',
    name: 'Player2',
    '@rid': { [String: '#42:0'] cluster: 42, position: 0 },
    '@version': 0 },
  { '@class': 'Player',
    '@type': 'd',
    name: 'Player1',
    '@rid': { [String: '#41:0'] cluster: 41, position: 0 },
    '@version': 0 } ]

The above queries are works perfectly in v2.2.2
i'm using orientdb 2.2.12

@luigidellaquila luigidellaquila self-assigned this Nov 15, 2016
@luigidellaquila
Copy link
Member

Hi @dastoori

This seems to be a regression in the SQL executor, I'm checking it

Thanks

Luigi

@luigidellaquila
Copy link
Member

Hi @dastoori

I tried to replicate this problem on 2.2.12 but I could not manage to do it.

Do you have a sample dataset to replicate it?

Thanks

Luigi

@dastoori
Copy link
Author

This is my sample dataset (from my first comment):

/* schema */
create class Team extends V;
create property Team.name String;

create class Player extends V;
create property Player.name String;

create class TeamHasPlayer extends E;

/* data */
create vertex Team set name = 'TeamA';
create vertex Player set name = 'Player1';
create vertex Player set name = 'Player2';

create edge TeamHasPlayer from (select from Team) to (select from Player);

The query outputs has no problem in "OrientDB Studio" (2.2.7 and 2.2.12) or "OrientJS v2.2.2", but when i install npm install [email protected] it returns duplicate records.

@luigidellaquila
Copy link
Member

Ok, got it.
Reassigning it to @maggiolo00

Thanks

Luigi

@wolf4ood
Copy link
Member

@dastoori

thanks opening this issue i've fixed it
i've added also a regression test

@wolf4ood
Copy link
Member

@dastoori

i'm waiting for travis then i will release 2.2.4 on NPM

@wolf4ood
Copy link
Member

@dastoori

just released 2.2.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants