Skip to content

ReQL proposal: make match polymorphic on streams #2026

Closed

Description

@coffeemug

Instead of typing

r.table('wiki_articles')('text')
 .group(r.row.downcase().split().map(function(row) { return row.match('[a-zA-Z]+')('str')}),
        { multi:true })
 .count()
 .orderBy(r.desc('reduction'))

I'd like to type

r.table('wiki_articles')('text')
 .group(r.row.downcase().split().match('[a-zA-Z]+')('str'),
        { multi:true })
 .count()
 .orderBy(r.desc('reduction'))

It would be really really really nice if we could do this for 1.12 because we have to present a GMR example.

Activity

  1. added this to the 1.12 milestone on Feb 26, 2014
  2. coffeemug commented on Feb 26, 2014

    @coffeemug
    ContributorAuthor

    Also, I realize I'm really breaking the rules here by asking to discuss this for 1.12. I just think that making this example amazing is worth it.

  3. mlucy commented on Feb 26, 2014

    @mlucy
    Member

    Currently our rule is that functions which take objects are polymorphic on streams of objects. We could extend this rule to apply to function which take strings, too, but I'm not 100% sure that's a good idea.

    As an aside, is there a reason why we've settled on this word counting thing as our canonical mapreduce example? It's:

    • Complicated (try explaining even the second query to people).
    • Awkward (this is the third time someone has proposed changing ReQL's semantics just to support it).
    • Not a normal use-case.

    Why not do something simple like:

    r.table('games').group('user').avg('score')

    That shows off the feature, and is a much more common type of query.

  4. mlucy commented on Feb 26, 2014

    @mlucy
    Member

    To clarify, these are the three:

    The more I think about it, the more this seems bad. This example is basically arbitrary.

  5. coffeemug commented on Feb 26, 2014

    @coffeemug
    ContributorAuthor

    I see what you mean. Let's leave this be for the moment, I think we should deal with #2024 first. Also, I don't think #2024 is about the word frequency example at all. I think that's what we always want (and I think we might be speaking past each other about what it actually means :))

  6. coffeemug commented on Feb 27, 2014

    @coffeemug
    ContributorAuthor

    Moving to polish for now. Let's discuss this after we address the rest of recent GMR issues.

  7. modified the milestones: , 1.12 on Feb 27, 2014
  8. srh commented on Mar 5, 2014

    @srh
    Contributor

    This code example makes no sense. What does .match('[a-zA-Z]+')('str') do? .match(...) returns an array, generally, so what does ('str') mean?

  9. neumino commented on Mar 5, 2014

    @neumino
    Member

    match returns an object, and the str attribute is the string that was matched.
    I guess @coffeemug just wanted to remove words with accents and non usual characters.

  10. srh commented on Mar 5, 2014

    @srh
    Contributor

    Okay, there exists some documentation somewhere that says it returns an array? That I read while in a delirious state last night. (And what is "'str'" supposed to mean, is that some sort of abbreviation for stromboli?)

  11. neumino commented on Mar 5, 2014

    @neumino
    Member

    The docs for match are wrong -- rethinkdb/docs#179

  12. mlucy commented on Mar 13, 2014

    @mlucy
    Member

    @coffeemug -- how are you feeling about this now? I'd be happy to bump this to backlog or drop it entirely.

  13. coffeemug commented on Mar 14, 2014

    @coffeemug
    ContributorAuthor

    I've lost my zeal for this issue. Dispose of it as you see fit.

  14. modified the milestones: backlog, on Mar 17, 2014
  15. mlucy commented on Mar 17, 2014

    @mlucy
    Member

    Bumping to backlog; I don't want to start considering exceptions to our "only object operations are polymorphic on arrays" rule this close to the release.

  16. coffeemug commented on Jun 23, 2014

    @coffeemug
    ContributorAuthor

    Closing in favor of #2578.

  17. modified the milestones: duplicate, backlog on Jun 23, 2014
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