Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
GeneratedVertexInputFormat |
|
| 1.5;1.5 |
1 | /* | |
2 | * Licensed to the Apache Software Foundation (ASF) under one | |
3 | * or more contributor license agreements. See the NOTICE file | |
4 | * distributed with this work for additional information | |
5 | * regarding copyright ownership. The ASF licenses this file | |
6 | * to you under the Apache License, Version 2.0 (the | |
7 | * "License"); you may not use this file except in compliance | |
8 | * with the License. You may obtain a copy of the License at | |
9 | * | |
10 | * http://www.apache.org/licenses/LICENSE-2.0 | |
11 | * | |
12 | * Unless required by applicable law or agreed to in writing, software | |
13 | * distributed under the License is distributed on an "AS IS" BASIS, | |
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
15 | * See the License for the specific language governing permissions and | |
16 | * limitations under the License. | |
17 | */ | |
18 | ||
19 | package org.apache.giraph.io.formats; | |
20 | ||
21 | import org.apache.giraph.bsp.BspInputSplit; | |
22 | import org.apache.giraph.io.VertexInputFormat; | |
23 | import org.apache.hadoop.conf.Configuration; | |
24 | import org.apache.hadoop.io.Writable; | |
25 | import org.apache.hadoop.io.WritableComparable; | |
26 | import org.apache.hadoop.mapreduce.InputSplit; | |
27 | import org.apache.hadoop.mapreduce.JobContext; | |
28 | ||
29 | import java.io.IOException; | |
30 | import java.util.ArrayList; | |
31 | import java.util.List; | |
32 | ||
33 | /** | |
34 | * This VertexInputFormat is meant for testing/debugging. It simply generates | |
35 | * some vertex data that can be consumed by test applications. | |
36 | * | |
37 | * @param <I> Vertex id | |
38 | * @param <V> Vertex data | |
39 | * @param <E> Edge data | |
40 | */ | |
41 | @SuppressWarnings("rawtypes") | |
42 | 0 | public abstract class GeneratedVertexInputFormat< |
43 | I extends WritableComparable, V extends Writable, E extends Writable> | |
44 | extends VertexInputFormat<I, V, E> { | |
45 | 0 | @Override public void checkInputSpecs(Configuration conf) { } |
46 | ||
47 | @Override | |
48 | public List<InputSplit> getSplits(JobContext context, int minSplitCountHint) | |
49 | throws IOException, InterruptedException { | |
50 | // This is meaningless, the VertexReader will generate all the test | |
51 | // data. | |
52 | 0 | List<InputSplit> inputSplitList = new ArrayList<InputSplit>(); |
53 | 0 | for (int i = 0; i < minSplitCountHint; ++i) { |
54 | 0 | inputSplitList.add(new BspInputSplit(i, minSplitCountHint)); |
55 | } | |
56 | 0 | return inputSplitList; |
57 | } | |
58 | } |