couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tom McNulty <>
Subject Reduce Assumptions
Date Sun, 29 Mar 2009 01:38:24 GMT

Can we assume that values sent to the reduce functions, are sorted in  
the order of their associated keys? From my experiments it appears to  
be true, but is this likely to change in the future?

Incase I'm not asking the right question, here's what I'm trying to do.

my map function produces output like:

[X, Y, 0]  -> Object_A
[X, Y, 1]  -> Object_B1
[X, Y, 1]  -> Object_B1
[X, Y, 1]  -> Object_B1
[Z, Q, 0] ....

Here I apply group_level=2, and use a ranged query ( [X, 0] to [X,  
[] ] )  since Y >= 0

Now during the reduce phase, I combine together Object_A's and  
associated Object_B's. Can I assume that the first of the values sent  
to 'reduce' is Object_A? Furthermore, if a rereduce is required, will  
the first 'rereduced' value be the 'left most' object produced during  
the previous reduction.  In other words, does the reduce function fold  
left over it's input data?

Thanks for reading this,

- Tom

View raw message