Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
VertexInputFormat |
|
| 1.0;1 |
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; | |
20 | ||
21 | import java.io.IOException; | |
22 | ||
23 | import org.apache.hadoop.io.Writable; | |
24 | import org.apache.hadoop.io.WritableComparable; | |
25 | import org.apache.hadoop.mapreduce.InputSplit; | |
26 | import org.apache.hadoop.mapreduce.TaskAttemptContext; | |
27 | ||
28 | /** | |
29 | * Use this to load data for a BSP application. Note that the InputSplit must | |
30 | * also implement Writable. The InputSplits will determine the partitioning of | |
31 | * vertices across the mappers, so keep that in consideration when implementing | |
32 | * getSplits(). Provides access to ImmutableClassesGiraphConfiguration. | |
33 | * | |
34 | * It's guaranteed that whatever parameters are set in the configuration are | |
35 | * also going to be available in all method arguments related to this input | |
36 | * format (context in getSplits and createVertexReader; methods invoked on | |
37 | * VertexReader). So if backing input format relies on some parameters from | |
38 | * configuration, you can safely set them for example in | |
39 | * {@link #setConf(org.apache.giraph.conf.ImmutableClassesGiraphConfiguration)}. | |
40 | * | |
41 | * @param <I> Vertex id | |
42 | * @param <V> Vertex value | |
43 | * @param <E> Edge value | |
44 | */ | |
45 | @SuppressWarnings("rawtypes") | |
46 | 0 | public abstract class VertexInputFormat<I extends WritableComparable, |
47 | V extends Writable, E extends Writable> extends GiraphInputFormat<I, V, E> { | |
48 | /** | |
49 | * Create a vertex reader for a given split. Guaranteed to have been | |
50 | * configured with setConf() prior to use. The framework will also call | |
51 | * {@link VertexReader#initialize(InputSplit, TaskAttemptContext)} before | |
52 | * the split is used. | |
53 | * | |
54 | * @param split the split to be read | |
55 | * @param context the information about the task | |
56 | * @return a new record reader | |
57 | * @throws IOException | |
58 | */ | |
59 | public abstract VertexReader<I, V, E> createVertexReader( | |
60 | InputSplit split, | |
61 | TaskAttemptContext context) throws IOException; | |
62 | } |