Is there reasoning in a standard M/R script, to no...
# suitescript
s
Is there reasoning in a standard M/R script, to not start with reduce without map in design first? Reduce has 5K units instead of map which has 1K units after the getInput stage, and without map stage, the reduce will execute meaning by changing the entry point you earn 5 times the execution units?
b
Doesnt really matter
If you know that you will need both map and reduce, then starting at map allows you to build the first stage first
s
i just mean given you dont know the real limit, after getInputStage isn't it always better to go through Reduce first instead of Map just for the 5k > 1k argmuent on the Reduce > Map? I mean in terms of the design
Or is there real reason to usually finish at map without going to reduce?
what i mean is given the first pic and then the second pic, essentially any script (albeit maybe poorly optimsied essentially by redefining your entry point you gain 5x execution units from Map -> Reduce?
from the rules given isn't it almost intuitive to always go getInputData -> Reduce and then use Map whenever necessary?
b
Depends on your ability to plan ahead
If you dont need both, then using reduce first will work great
If you do need both, then doing map first will avoid rewriting the reduce to a map
Doing the map first may also allow you to avoid dooming yourself by making a reduce that uses too many point to be changed into a map
s
Curious, has anyone actually needed more than 1k governance units in their map or even reduce phase of an M/R script? Frequently, I am modifying just a single record or performing one action in a map or reduce phase, so I don’t think I would even come close to that limit.
s
@scottvonduhn yup, we've had clients where there is intercompany sales order / po / fulfillment and receipt done automated, and per item line we have to do that, so that's an easy perhaps 40 units per line and the main SO could have many lines Or just journals with similar records created even custom records at 2 units per record, talking about journals with thousand of lines
b
you are supposed to set it up so that each search row represents a line, so that the value passed to a map represents one record
if that fails, you do the separation instead in the map and do the work in the reduce
that way you dont need to worry about how many lines a transaction has
1