Has anyone ever attempted to do 'chunking' in a ma...
# suitescript
d
Has anyone ever attempted to do 'chunking' in a map/reduce by using the
mapContext.key
with a modulus function as the
mapContext.write
key ?
mapContext.write({key: (+mapContext.key % 100), value: 'some value'  })
even better
mapContext.write({key: Math.floor (+mapContext.key/100), value: 'some value'  })
w
Don't see why it shouldn't work. Got any issues with it? I generate JE-lines in map with all the JE-body data as a stringyfied JSON as the key and let shuffle group them for the reduce stages so all lines with a common body gets grouped together.
s
in general this should be pretty common since it's a key feature of the MR model.
what you use to collect data into reduce is application dependent, but I would think it doesn't matter as long as it fits your use case.
d
Fair enough ... great place to bounce off ideas
s
speaking of ideas, I was pondering why your
/100
idea is 'even better' than the modulo idea?