blob: bef51e9ae08792d38331bcb21e1ec9b000b9c860 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hadoop.mapreduce;
import com.yahoo.vespa.hadoop.mapreduce.util.VespaConfiguration;
import com.yahoo.vespa.hadoop.mapreduce.util.VespaCounters;
import org.apache.hadoop.mapreduce.*;
import java.io.IOException;
import java.util.Properties;
/**
* An output specification for writing to Vespa instances in a Map-Reduce job.
* Mainly returns an instance of a {@link VespaRecordWriter} that does the
* actual feeding to Vespa.
*
* @author lesters
*/
@SuppressWarnings("rawtypes")
public class VespaOutputFormat extends OutputFormat {
final Properties configOverride;
public VespaOutputFormat() {
super();
this.configOverride = null;
}
public VespaOutputFormat(Properties configOverride) {
super();
this.configOverride = configOverride;
}
@Override
public RecordWriter getRecordWriter(TaskAttemptContext context) throws IOException, InterruptedException {
VespaCounters counters = VespaCounters.get(context);
VespaConfiguration configuration = VespaConfiguration.get(context.getConfiguration(), configOverride);
return new VespaRecordWriter(configuration, counters);
}
@Override
public OutputCommitter getOutputCommitter(TaskAttemptContext taskAttemptContext) throws IOException, InterruptedException {
return new VespaOutputCommitter();
}
@Override
public void checkOutputSpecs(JobContext jobContext) throws IOException, InterruptedException {
}
}
|