Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using Microsoft.Hadoop.MapReduce;
- namespace mapreduce {
- public class Program : HadoopJob<MyMapper> {
- static void Main(string[] args) {
- string[] input;
- if (args.Length < 2) {
- input = args;
- }
- else {
- input = new string[]
- {
- "1, a",
- "1, b",
- "2, c",
- "2, d",
- "3, e",
- "4, f"
- };
- }
- var output = StreamingUnit.Execute<MyMapper, MyReducer>(input);
- var result = output.Result.ToList();
- var mapperresult = output.MapperResult.ToList();
- }
- public override HadoopJobConfiguration Configure(ExecutorContext context) {
- HadoopJobConfiguration config = new HadoopJobConfiguration();
- config.InputPath ="input/SqrtJob";
- config.OutputFolder = "output/SqrtJob";
- return config;
- }
- }
- public class MyMapper : MapperBase {
- public override void Map(string inputLine, MapperContext context) {
- context.Log("mapper called. input=" + inputLine);
- context.IncrementCounter("mapInputs");
- context.EmitKeyValue("key!", "value!");
- }
- }
- public class MyReducer : ReducerCombinerBase {
- public override void Reduce(string key, IEnumerable<string> values, ReducerCombinerContext context) {
- throw new NotImplementedException();
- }
- }
- }
Add Comment
Please, Sign In to add comment