Interface IMapper
MapReduce mapper interface generates a set of intermediate key-value pairs for further refining and extraction of the data.
Namespace:
Assembly: Alachisoft.NCache.Runtime.dll
Syntax
public interface IMapper : IDisposable
Map(Object, Object, IOutputMap)
For every key-value pair input, Map method is executed, to get a more specific and meaningful data.
Declaration
void Map(object key, object value, IOutputMap context)
Parameters
Type | Name | Description |
---|---|---|
System.Object | key | Key value of cache Entry. |
System.Object | value | Value for the key |
IOutputMap | context | Emitted output value for each key-value pair |
Examples
Following example demonstrate the usage of Map.
string[] parsedline;
string line;
public void Map(Object key, Object value, IOutputMap context)
{
line = value.ToString();
parsedline = line.Split(' ');
for (int i = parsedline.Length; i>=0; i++)
{
context.Emit(parsedline[i], 1);
}
}