From user-return-3485-apmail-couchdb-user-archive=couchdb.apache.org@couchdb.apache.org Wed Feb 11 20:09:17 2009 Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 24379 invoked from network); 11 Feb 2009 20:09:17 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 11 Feb 2009 20:09:17 -0000 Received: (qmail 23152 invoked by uid 500); 11 Feb 2009 20:09:15 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 23122 invoked by uid 500); 11 Feb 2009 20:09:15 -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 23111 invoked by uid 99); 11 Feb 2009 20:09:15 -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 12:09:15 -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: domain of b.candler@pobox.com designates 207.106.133.19 as permitted sender) Received: from [207.106.133.19] (HELO sasl.smtp.pobox.com) (207.106.133.19) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 11 Feb 2009 20:09:06 +0000 Received: from localhost.localdomain (unknown [127.0.0.1]) by a-sasl-fastnet.sasl.smtp.pobox.com (Postfix) with ESMTP id CA3E098A3C; Wed, 11 Feb 2009 15:08:42 -0500 (EST) Received: from mappit (unknown [80.45.95.114]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by a-sasl-fastnet.sasl.smtp.pobox.com (Postfix) with ESMTPSA id 33FAE98A3A; Wed, 11 Feb 2009 15:08:40 -0500 (EST) Received: from brian by mappit with local (Exim 4.69) (envelope-from ) id 1LXLNv-0007wu-Id; Wed, 11 Feb 2009 20:08:39 +0000 Date: Wed, 11 Feb 2009 20:08:39 +0000 From: Brian Candler To: James Marca Cc: user@couchdb.apache.org Subject: Re: how do I do different reduce operations on the same map Message-ID: <20090211200839.GC30213@uk.tiscali.com> References: <20090210223158.GJ30795@translab.its.uci.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090210223158.GJ30795@translab.its.uci.edu> User-Agent: Mutt/1.5.17+20080114 (2008-01-14) X-Pobox-Relay-ID: C7CF8DB8-F877-11DD-AEAE-8B21C92D7133-28021239!a-sasl-fastnet.pobox.com X-Virus-Checked: Checked by ClamAV on apache.org 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