Hey all: trying my hand at my first map/reduce scr...
# suitescript
j
Hey all: trying my hand at my first map/reduce script. Is there a way to explicitly specify/set the key values in the getInputData step? I'm planning to read in a CSV file, and I want the first column to be my key values (so that it will appropriately deal with them in the shuffle stage). The only examples I can find either auto-number the key or output a search with record internal IDs as the key.
j
If you return a regular javascript object, the property names are your context.key and the property values are your context.value
c
shuffle doesn't happen until after map so you'd load your CSV data into some array of object data in the get input stage and in the map phase, determine your key -> value pair, then shuffle occurs and then reduce for each key -> pair you created in the map phase from the object array from get input stage
e
M/R have a special File Streaming API for processing CSV
If you return an
N/file.File
reference from
getInputData
, then
map
will be passed one text line of the file at a time
c
Either one