@reptar Think about approaching this from the bottom up, this is not going to be a single Map Reduce pass considering how many levels deep you need to go(Assembly within Assemblies etc…) you may even consider using multiple Map Reduces.
• Define Assemblies components(only non- assemblies) costs and make sure any member of any assembly have a cost defined(updated, whatnot).
• Find Assemblies without any other Assembly as a component and update those to have a cost(custom field maybe).
• Keep moving up.
Again, I don’t think you can pull this off with a single Map Reduce execution, you are going to need one if not multiple Map Reduces, and you may need to monitor governance and re-kick the same Map Reduce from itself.
Your report will be also a nightmare if you have to present every single assembly cost including the nested one, only from a visual perspective of how to show the data/report is complex.
But still your first pass or Map Reduce is essential, once you have every non-assembly component cost updated then those are re-usable across every single Assembly you need to calculate cost, you will only need to consider components quantities.