Example usage for org.apache.hadoop.mapreduce Mapper Mapper

List of usage examples for org.apache.hadoop.mapreduce Mapper Mapper

Introduction

In this page you can find the example usage for org.apache.hadoop.mapreduce Mapper Mapper.

Prototype

Mapper

Source Link

Usage

From source file:com.asakusafw.runtime.compatibility.hadoop1.JobCompatibilityHadoop1.java

License:Apache License

@Override
public <KEYIN, VALUEIN, KEYOUT, VALUEOUT> Mapper<KEYIN, VALUEIN, KEYOUT, VALUEOUT>.Context newMapperContext(
        Configuration configuration, TaskAttemptID id, RecordReader<KEYIN, VALUEIN> reader,
        RecordWriter<KEYOUT, VALUEOUT> writer, OutputCommitter committer, InputSplit split)
        throws IOException, InterruptedException {
    Mapper<KEYIN, VALUEIN, KEYOUT, VALUEOUT> mapper = new Mapper<>();
    return mapper.new Context(configuration, id, reader, writer, committer, new MockStatusReporter(), split);
}

From source file:com.avira.couchdoop.AppTest.java

License:Apache License

@Before
public void setUp() {
    // Setup mapper.
    Mapper<LongWritable, Text, LongWritable, Text> mapper = new Mapper<LongWritable, Text, LongWritable, Text>();
    mapDriver = MapDriver.newMapDriver(mapper);

    // Setup combiner.
    Reducer<LongWritable, Text, LongWritable, Text> combiner = new Reducer<LongWritable, Text, LongWritable, Text>();
    combineDriver = ReduceDriver.newReduceDriver(combiner);

    // Setup reducer.
    Reducer<LongWritable, Text, LongWritable, Text> reducer = new Reducer<LongWritable, Text, LongWritable, Text>();
    reduceDriver = ReduceDriver.newReduceDriver(reducer);

    // Setup MapReduce job.
    mrDriver = MapReduceDriver.newMapReduceDriver(mapper, reducer, combiner);
}

From source file:com.toddbodnar.simpleHive.subQueries.printString.java

@Override
public Mapper getMapper() {
    return new Mapper();
}

From source file:org.apache.jena.hadoop.rdf.mapreduce.characteristics.CharacteristicSetReducerTest.java

License:Apache License

@Override
protected final Mapper<CharacteristicSetWritable, CharacteristicSetWritable, CharacteristicSetWritable, CharacteristicSetWritable> getMapperInstance() {
    // Identity mapper
    return new Mapper<CharacteristicSetWritable, CharacteristicSetWritable, CharacteristicSetWritable, CharacteristicSetWritable>();
}

From source file:org.springframework.hadoop.mapreduce.ExpressionEvaluatingMapperTests.java

License:Apache License

private Mapper<Writable, Writable, Writable, Writable>.Context getContextForWritingToMap(
        final Map<Writable, Writable> map) throws Exception {
    Mapper<IntWritable, Text, Text, IntWritable> dummy = new Mapper<IntWritable, Text, Text, IntWritable>();
    @SuppressWarnings("rawtypes")
    Mapper.Context other = dummy.new Context(new Configuration(), new TaskAttemptID(), null, null, null, null,
            null) {/*from   w  w  w.j ava  2  s .  co m*/
        @Override
        public void write(Text key, IntWritable value) throws IOException, InterruptedException {
            map.put(key, value);
        }
    };
    @SuppressWarnings("unchecked")
    Mapper<Writable, Writable, Writable, Writable>.Context context = other;
    return context;
}

From source file:org.springframework.hadoop.test.GenericConfiguration.java

License:Apache License

@Bean
@Override/*  w  w w .j a  v a  2 s .co  m*/
public Mapper<?, ?, ?, ?> mapper() {
    return new Mapper<Writable, Writable, Writable, Writable>() {
        private Text word = new Text();

        private IntWritable one = new IntWritable(1);

        protected void map(Writable key, Writable value, Context context)
                throws IOException, InterruptedException {
            StringTokenizer itr = new StringTokenizer(value.toString());
            while (itr.hasMoreTokens()) {
                word.set(itr.nextToken());
                context.write(word, one);
            }
        }
    };
}

From source file:org.springframework.hadoop.test.StatelessConfiguration.java

License:Apache License

@Bean
@Override//from w  w w  .  j a  v  a2  s .co  m
public Mapper<?, ?, ?, ?> mapper() {
    return new Mapper<Object, Text, Text, IntWritable>() {
        protected void map(Object key, Text value, Context context) throws IOException, InterruptedException {
            StringTokenizer itr = new StringTokenizer(value.toString());
            while (itr.hasMoreTokens()) {
                Text word = new Text(itr.nextToken());
                context.write(word, new IntWritable(1));
            }
        }
    };
}

From source file:org.springframework.hadoop.test.VanillaConfiguration.java

License:Apache License

@Bean
@Override// ww w . ja  v a2s .co m
public Mapper<?, ?, ?, ?> mapper() {
    return new Mapper<Object, Text, Text, IntWritable>() {
        private Text word = new Text();

        private IntWritable one = new IntWritable(1);

        protected void map(Object key, Text value, Context context) throws IOException, InterruptedException {
            StringTokenizer itr = new StringTokenizer(value.toString());
            while (itr.hasMoreTokens()) {
                word.set(itr.nextToken());
                context.write(word, one);
            }
        }
    };
}