Skip to content

Semi-proposal: support more NoSQLy joins #1168

Closed

Description

@coffeemug

Currently our joins completely model SQL joins and return proper cross products. The resulting data can be painful for people to manipulate. However, we have the opportunity to make join operations more nosql-y -- instead of returning a cross product we can give the option to take all the rows from the right table, concat them into an array, and merge the array into the relevant row in the left table. This would be much nicer for users to manipulate.

We don't have to do it soon, so putting it in backlog for now. We can do it along with #1152 when we get around to it.

Activity

  1. wmrowan commented on Jul 12, 2013

    @wmrowan
    Contributor

    So this behavior?

    r.table(left_table).map(
       lambda left: left.merge({'matching_rows':
          r.table(right_table).get_all(left[attr])
       })
    )
  2. neumino commented on Jul 12, 2013

    @neumino
    Member

    I'm in favor for adding such method, not that because it's hard (or ugly) to use an inner query but because people will naturally look for eqJoin/innerJoin/outerJoin to do it, and they will end up doing non efficient queries.

    One of the problem of using an inner query is that people have to manually coerce to an array, which is not an obvious thing to do.

  3. jdoliner commented on Jul 12, 2013

    @jdoliner
    Contributor

    This has the serious downside that it makes it very easy for people to write queries which work on their test data but fail once they get a larger dataset because they construct oversized arrays. This is arguably a problem in #1096 but I think people generally understand that aggregation can be memory intensive. Common aggregations like word counting already exhibit similar performance. My sense is that people generally expect joins to be scalable (something we highlight heavily in our marketing) and it would be really confusing if joins suddenly started failing in your production environment and you had to rewrite your code to use the other join syntax. I'd just prefer not to have such a fundamental operation be vulnerable to this. Also with the syntax in #1096 this is fairly straightforward to do, you just say:

    join.group_by("left", r.rows("right"))

    really isn't that bad but I think it makes it a lot more obvious that this could potentially be a memory intensive operation.

  4. coffeemug commented on Jul 18, 2014

    @coffeemug
    ContributorAuthor

    Closing in favor of #2720.

  5. modified the milestones: outdated, , moved on Jul 18, 2014
  6. modified the milestones: duplicate, moved on Jul 19, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions