mapContext.write(options)
Method Description |
Writes the key-value pairs to be passed to the shuffle and then the reduce stage. If your script includes both a map and a reduce function, you must use this method so that the reduce function is invoked. |
Returns |
Void |
Since |
2015.2 |
Parameters
The options parameter is a JavaScript object.
Parameter |
Type |
Required / Optional |
Description |
---|---|---|---|
options.key |
String or object. However, note that if you provide an object, the system calls JSON.stringify() on your input. |
required |
The key to write |
options.value |
required |
The value to write |
Syntax
The following code snippet shows the syntax for this member. It is not a functional example. For a complete script example, see Map/Reduce Script Samples.
...
function map(context)
{
for (var i = 0; context.value && i < context.value.length; i++)
if (context.value[i] !=== ' ' && !PUNCTUATION_REGEXP.test(context.value[i]))
{
context.write({
key: context.value[i],
value: 1
});
}
}
...