Map/Reduce scripts have four stages: Get (Load) Input Data, Map, Reduce, and Summarize. Each stage has different governance considerations.
1. Get (Load) Input Data Stage
- This stage fetches data to process in the script (e.g., search results, JSON data, file parsing).
- Governance Considerations:
search.create().run().each()→ 10 units per recordsearch.lookupFields()→ 1 unit per recordrecord.load()→ Depends on the record type (typically 10+ units)file.load()→ 10 units per file
2. Map Stage
- This stage processes each record individually and outputs key-value pairs.
- Governance Considerations:
record.load()→ 10+ units per recordrecord.submitFields()→ 20 unitsrecord.delete()→ 20 unitssearch.lookupFields()→ 1 unit
3. Reduce Stage
- This stage consolidates data based on the key-value pairs produced in the Map Stage.
4. Summarize Stage
- This stage logs results, errors, and performs any final processing after Map/Reduce execution.