reduce(reduceContext)
Description |
Runs when the reduce entry point is triggered. The reduce function's logic is applied to each key and its list of values. Each call processes one key and its values, then runs again for the next set. Data is provided to the reduce stage by one of the following:
For information about the context object provided to this entry point, see reduceContext. |
Returns |
Void |
Since |
2015.2 |
Parameters
Parameter |
Type |
Required / Optional |
Description |
---|---|---|---|
Object |
Required |
Object that has:
For a description of each property in this object, see reduceContext Object Members. |
Errors
When an error is thrown, the job's behavior depends on the retryCount setting.
If the function restarts for a key-value pair it already tried to process, you can see any past errors in reduceContext.errors.
In the summary stage, you can review all reduce stage errors by using reduceSummary.errors.
Syntax
The following code snippet shows the syntax for this member. It's not a functional example. For a complete script example, see SuiteScript 2.x Map/Reduce Script Code Samples.
...
function reduce(context)
{
context.write({
key: context.key ,
value: context.values.length
});
}
...