Skip to content

Chaining multiple joins returns wrong results #1793

Closed

Description

@coffeemug

Chaining two eqJoin commands, returns the wrong output:

r.tableCreate('senders');
r.tableCreate('receivers');
r.tableCreate('messages');

r.table('senders').insert({id: 1, sender: 'Sender One'});
r.table('receivers').insert({id: 1, receiver: 'Receiver One'});
r.table('messages').insert([{
    senderId: 1,
    receiverId: 1,
    msg: 'Message One'
}, {
    senderId: 1,
    receiverId: 1,
    msg: 'Message Two'
}, {
    senderId: 1,
    receiverId: 1,
    msg: 'Message Three'
}]);


// returns tree rows, as expected
r.table('messages')
    .eqJoin('senderId', r.table('senders'))
    .without({right: {id: true}})
    .zip()

// returns only one row
r.table('messages')
    .eqJoin('senderId', r.table('senders'))
    .without({right: {id: true}})
    .zip()
    .eqJoin('receiverId', r.table('receivers'))
    .without({right: {id: true}})
    .zip()

Interestingly, coercing to an array in the middle, returns the right output:

// returns three rows as expected
r.table('messages')
    .eqJoin('senderId', r.table('senders'))
    .without({right: {id: true}})
    .zip()
    .coerceTo('array')
    .eqJoin('receiverId', r.table('receivers'))
    .without({right: {id: true}})
    .zip()

Activity

  1. ghost assigned on Dec 20, 2013
  2. mlucy commented on Jan 9, 2014

    @mlucy
    Member

    I've tracked this down; the cause was very similar to the cause of #1796, except it was happening in the eager code. It's surprising our tests didn't catch it (I'm adding one that will now).

  3. mlucy commented on Jan 9, 2014

    @mlucy
    Member

    This is in review 1115 by @Tryneus .

  4. mlucy commented on Jan 10, 2014

    @mlucy
    Member

    This is in next and v1.11.x .

  5. mlucy commented on Jan 10, 2014

    @mlucy
    Member

    @AtnNn -- think we're ready for a point release?

  6. AtnNn commented on Jan 10, 2014

    @AtnNn
    Member

    @mlucy Thanks! Looks like we are ready for a point release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions