reduceContext.key

Property Description

When the map/reduce process includes a map stage, the reduce keys are the keys written by mapContext.write(options).

When the map stage is skipped, the reduce keys are provided by the getInputData stage:

  • If the input type is an array, the key is the index of the element.

  • If the input type is an object, the key is the key in the object.

  • If the input type is a result set, the key is the internal ID of the result.

Note:

Each key cannot exceed 4000 bytes.

Type

string

Since

2015.2

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 reduce(context)
{
    context.write({
        key: context.key , 
        value: context.values.length 
    }); 
}
... 

        

Related Topics

reduceContext
reduceContext.isRestarted
reduceContext.executionNo
reduceContext.errors
reduceContext.values
reduceContext.write(options)

General Notices