Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 77649 invoked from network); 12 Feb 2009 01:33:02 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 12 Feb 2009 01:33:02 -0000 Received: (qmail 16655 invoked by uid 500); 12 Feb 2009 01:33:00 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 16619 invoked by uid 500); 12 Feb 2009 01:33:00 -0000 Mailing-List: contact user-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@couchdb.apache.org Delivered-To: mailing list user@couchdb.apache.org Received: (qmail 16607 invoked by uid 99); 12 Feb 2009 01:33:00 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 11 Feb 2009 17:33:00 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [128.200.36.30] (HELO translab.its.uci.edu) (128.200.36.30) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 12 Feb 2009 01:32:52 +0000 Received: from translab.its.uci.edu (localhost.localdomain [127.0.0.1]) by translab.its.uci.edu (8.13.1/8.12.10) with ESMTP id n1C1WPjF029375 for ; Wed, 11 Feb 2009 17:32:25 -0800 Received: (from jmarca@localhost) by translab.its.uci.edu (8.13.1/8.13.1/Submit) id n1C1WPb1029374 for user@couchdb.apache.org; Wed, 11 Feb 2009 17:32:25 -0800 Date: Wed, 11 Feb 2009 17:32:25 -0800 From: James Marca To: user@couchdb.apache.org Subject: Re: how do I do different reduce operations on the same map Message-ID: <20090212013225.GQ26851@translab.its.uci.edu> Mail-Followup-To: user@couchdb.apache.org References: <20090210223158.GJ30795@translab.its.uci.edu> <20090211200839.GC30213@uk.tiscali.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090211200839.GC30213@uk.tiscali.com> User-Agent: Mutt/1.4.1i X-ITS-MailScanner: Found to be clean X-ITS-MailScanner-From: jmarca@translab.its.uci.edu X-ITS-Spam-Status: No X-Virus-Checked: Checked by ClamAV on apache.org On Wed, Feb 11, 2009 at 08:08:39PM +0000, Brian Candler wrote: > On Tue, Feb 10, 2009 at 02:31:58PM -0800, James Marca wrote: > > I have a situation where I want to run two different reduce functions > > on the output of a single map function. Like suppose I want one > > reduce function to get the count of all objects in each group (for > > example, documents with or without attachments), and another reduce to > > compute some other aggregate, like the average and standard deviation > > of a value, (like the average size of attached documents). (Yes, I > > know this is a stupid example, as the averaging reduce function will > > also have the count, but my real case is too complicated to write > > easily). > > I believe reduce values are any JSON object, so perhaps you could reduce to > an array of values, e.g. [count, total, sum_of_squares] > > The final calculation of average and SD could then be left to the client I'll have to think about what that means. I've got mean/sd, etc handled in a reduce, but I was wondering about doing other things with the same map. I am analyzing data from detectors for a year, with most of the detectors reporting every 30 seconds. So I want to say things like "the average, std. dev, min and max for X on Tuesday between 8:05 and 8:10 was [...]" That's one map/reduce run. But there might be other things we want to look at, so I was wondering whether it was worth it to optimize a single map now (given the size of the data) rather than adding more maps later. James -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.