Is it possible to express JOIN and GROUP in Riak?
mark at basho.com
Thu Mar 1 13:25:31 EST 2012
Sean Cribbs gave a presentation last year at Strage Loop wherein he
talked about going from SQL -> Riak MapReduce.
Specifically, there is some info on doing the equivalent of JOIN and
GROUP (and others) starting around slide #24.
Hope that helps.
On Mon, Feb 20, 2012 at 5:53 AM, Sergei Tulentsev
<sergei.tulentsev at gmail.com> wrote:
> Let's say, I have events and users. I want to group events by properties of
> users. In SQL it looks like this:
> SELECT u.gender,
> COUNT(e.id) ecount,
> SUM(e.event_value) esum
> FROM sn_users u
> JOIN daily_events e on e.sn_user_id = u.sn_id
> GROUP BY u.gender, u.age, u.nfr, u.nafr, e.event_id;
> I understand that link walking with mapreduce may help me with this.
> However, all examples of link walking I've seen so far substitute the
> original document. That is, if I were to link-walk event document I'd get a
> bunch of users, without events.
> How it ideally should be (in my imagination).
> - Links are walked on event documents and corresponding users are embedded
> into events.
> - Map function now acts on a "joined" document and can emit appropriate
> - Reduce - nothing fancy here.
> Is it possible at all?
> Best regards,
> Sergei Tulentsev
> riak-users mailing list
> riak-users at lists.basho.com
More information about the riak-users