Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
EdgeInputFormat |
|
| 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 org.apache.hadoop.io.Writable; | |
22 | import org.apache.hadoop.io.WritableComparable; | |
23 | import org.apache.hadoop.mapreduce.InputSplit; | |
24 | import org.apache.hadoop.mapreduce.TaskAttemptContext; | |
25 | ||
26 | import java.io.IOException; | |
27 | ||
28 | /** | |
29 | * Input format for reading single edges. Provides access to | |
30 | * ImmutableClassesGiraphConfiguration. | |
31 | * | |
32 | * It's guaranteed that whatever parameters are set in the configuration are | |
33 | * also going to be available in all method arguments related to this input | |
34 | * format (context in getSplits and createEdgeReader; methods invoked on | |
35 | * EdgeReader). So if backing input format relies on some parameters from | |
36 | * configuration, you can safely set them for example in | |
37 | * {@link #setConf(org.apache.giraph.conf.ImmutableClassesGiraphConfiguration)}. | |
38 | * | |
39 | * @param <I> Vertex id | |
40 | * @param <E> Edge data | |
41 | */ | |
42 | 0 | public abstract class EdgeInputFormat<I extends WritableComparable, |
43 | E extends Writable> extends GiraphInputFormat<I, Writable, E> { | |
44 | /** | |
45 | * Create an edge reader for a given split. The framework will call | |
46 | * {@link EdgeReader#initialize(InputSplit, TaskAttemptContext)} before | |
47 | * the split is used. | |
48 | * | |
49 | * @param split the split to be read | |
50 | * @param context the information about the task | |
51 | * @return a new record reader | |
52 | * @throws IOException | |
53 | */ | |
54 | public abstract EdgeReader<I, E> createEdgeReader( | |
55 | InputSplit split, | |
56 | TaskAttemptContext context) throws IOException; | |
57 | } |