How to configure Map/Reduce so that my Map functio...
# suitescript
d
How to configure Map/Reduce so that my Map function runs parallely?
s
In your script deployment, set the concurrency limit higher than 1
d
Thanks
s
Though, keep in mind that you are only setting an upper allowed limit. Netsuite will determine how many queues to assign to the Map phase.
d
I am trying to write the push below array as value for reduce stage i am not able the get values in reduce stage, when i retrieve context.values; i am facing an error unexpected u or unexpected L var x = [{"CUSID":"31","TN":"CUSTINVC204","AMT":"321.58","DD":"","TD":"1/14/2019","TT":"Invoice","DISC_AMT":"","ALT_NAME":null,"PAR_CUS":"000001 GOODYEAR EDI CUSTOMER ONLY"},{"CUSID":"31","TN":"CUSTINVC216","AMT":"233.68","DD":"","TD":"1/15/2019","TT":"Invoice","DISC_AMT":"","ALT_NAME":null,"PAR_CUS":"000001 GOODYEAR EDI CUSTOMER ONLY"},{"CUSID":"31","TN":"CUSTINVC222","AMT":"100.00","DD":"","TD":"1/15/2019","TT":"Invoice","DISC_AMT":"","ALT_NAME":null,"PAR_CUS":"000001 GOODYEAR EDI CUSTOMER ONLY"},{"CUSID":"31","TN":"CUSTINVC223","AMT":"100.00","DD":"","TD":"1/15/2019","TT":"Invoice","DISC_AMT":"","ALT_NAME":null,"PAR_CUS":"000001 GOODYEAR EDI CUSTOMER ONLY"}]
s
I'd probably need a little more context. Are you writing array x from your Map phase, to be processed in the Reduce phase? Or is x the array you are receiving in the Reduce phase's context.values ?
Each element in Reduce's context.values will always be a string. If you are writing an object or array as the value in the Map phase, you need to deserialize the values using JSON.parse, to convert them back into an object or array.
d
while using JSON.parse i am facing an issue Unexpected u or Unexpected L @scottvonduhn
x is the array of Objects i am trying get in reduce phase.
s
I'd need to see the code for the reduce phase where it's doing the JSON.parse
Make sure you are parsing each individual element, not the entire values array