On Feb 22, 2008, at 11:34 PM, ma qiang wrote:

Hi all,
I have a program need to use two reduce fucntions, who can tell me why?
    Thank you!

I assume you mean that your map functions decide which kind of reduce to send each key/value to. (The other possibility is that you want to have all of the key/value pairs sent to both kinds of reduces.)

You could if you have to, although I would think you are better off in most cases doing two jobs. (The map phase rarely dominates and reducing the amount of data in the shuffle would probably make things run faster.)

One approach would divide the reduces (in half?) and have an extra tag field in the key that says which kind of reduce to send it to. The partition function would then pick a reduce in the right range based on the tag. You would probably also want to have an output format that was aware of the split and wrote the outputs to a different place depending on the kind of reduce it is. So it isn't impossible, but it would be complicated...

-- Owen

Reply via email to