Return-Path: Delivered-To: apmail-couchdb-dev-archive@www.apache.org Received: (qmail 74513 invoked from network); 5 Jun 2009 05:47:43 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 5 Jun 2009 05:47:43 -0000 Received: (qmail 32364 invoked by uid 500); 5 Jun 2009 05:47:55 -0000 Delivered-To: apmail-couchdb-dev-archive@couchdb.apache.org Received: (qmail 32287 invoked by uid 500); 5 Jun 2009 05:47:54 -0000 Mailing-List: contact dev-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list dev@couchdb.apache.org Received: (qmail 32277 invoked by uid 99); 5 Jun 2009 05:47:54 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 05 Jun 2009 05:47:54 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of jchris@gmail.com designates 209.85.220.211 as permitted sender) Received: from [209.85.220.211] (HELO mail-fx0-f211.google.com) (209.85.220.211) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 05 Jun 2009 05:47:43 +0000 Received: by fxm7 with SMTP id 7so1448704fxm.11 for ; Thu, 04 Jun 2009 22:47:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:date :x-google-sender-auth:message-id:subject:from:to:content-type :content-transfer-encoding; bh=u5Cb+z33C0eCv8YPp0Z/hOcmJHh+LYFX/1emr8ePjhk=; b=Nza/DC61aLPgw6tVt+xPYduWWgVeVOlPg5jIvx4zObcEGtTyGDJX1XSK3eqttfTZBG Rj1kA8yMy+qNDT5HPZSayGRPHqIff4/Lv/d8375VqgLGrL6owAUoi4qEnR9kRAv2Lyov L3tYsQ1KPTwJbzphBSPGmWpL0oTiHUR+0Mr30= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:date:x-google-sender-auth:message-id:subject :from:to:content-type:content-transfer-encoding; b=xW+CYg8vOfLTOr8rEilZLrt+jgFH4xngdE2Rvjd/AQOX1y8gNBa7P1skTSu1JYQhkC /jl76aKW+pUrZgkbxupneTe14c/lLH1Lm8BMg140R++r0f+oZSoEsnYbOlC+SKu+saSv agjmvPrpLZR2rd7p6HIPd4Z4FuFkRPx/fVRjw= MIME-Version: 1.0 Sender: jchris@gmail.com Received: by 10.204.116.212 with SMTP id n20mr2787910bkq.138.1244180841486; Thu, 04 Jun 2009 22:47:21 -0700 (PDT) Date: Thu, 4 Jun 2009 22:47:21 -0700 X-Google-Sender-Auth: b3eb3f49581af55f Message-ID: Subject: chaining map reduce in hovercraft From: Chris Anderson To: dev@couchdb.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org I finally got around to writing my map reduce copier. it's still basic, but what do you think? I want to put it into trunk as an http call, like: POST /_snapshot_view with JSON {"src":"/srcdb/_design/app/_view/reduce_count", "group_level":2, "target":"/targetdb"} Chainable map reduce seems to be one of the most popular requests on the survey we took, so hopefully this will make the heavy-data crew happy. There is an implementation here: http://github.com/jchris/hovercraft/commit/34b44527b660a740858cc71aa2c8326747465e31#L0R290 What this does is take the results you'd get from query your reduce view with group=true, and copy them to a new database. Basically you end up with a database full of docs that look like: { "key":[2009,2,14], "value": 511 } Since they are docs sitting in another CouchDB, you can use more ordinary CouchDB Map Reduce views on that database to do things like sort by value, so you can for instance sort tags by popularity, or days by user activity, etc. Chris -- Chris Anderson http://jchrisa.net http://couch.io