Coverage Report - org.apache.giraph.io.internal.WrappedMappingInputFormat
 
Classes in this File Line Coverage Branch Coverage Complexity
WrappedMappingInputFormat
0%
0/14
N/A
0
 
 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.internal;
 20  
 
 21  
 import org.apache.giraph.io.MappingInputFormat;
 22  
 import org.apache.giraph.io.MappingReader;
 23  
 import org.apache.giraph.job.HadoopUtils;
 24  
 import org.apache.hadoop.conf.Configuration;
 25  
 import org.apache.hadoop.io.Writable;
 26  
 import org.apache.hadoop.io.WritableComparable;
 27  
 import org.apache.hadoop.mapreduce.InputSplit;
 28  
 import org.apache.hadoop.mapreduce.JobContext;
 29  
 import org.apache.hadoop.mapreduce.TaskAttemptContext;
 30  
 
 31  
 import java.io.DataInput;
 32  
 import java.io.DataOutput;
 33  
 import java.io.IOException;
 34  
 import java.util.List;
 35  
 
 36  
 /**
 37  
  * For internal use only.
 38  
  *
 39  
  * Wraps user set {@link org.apache.giraph.io.VertexInputFormat} to make
 40  
  * sure proper configuration parameters are passed around, that user can set
 41  
  * parameters in configuration and they will be available in other methods
 42  
  * related to this format.
 43  
  *
 44  
  * @param <I> vertexId type
 45  
  * @param <V> vertexValue type
 46  
  * @param <E> edgeValue type
 47  
  * @param <B> mappingTarget type
 48  
  */
 49  
 public class WrappedMappingInputFormat<I extends WritableComparable,
 50  
   V extends Writable, E extends Writable, B extends Writable>
 51  
   extends MappingInputFormat<I, V, E, B> {
 52  
   /** originalInputFormat to wrap over */
 53  
   private MappingInputFormat<I, V, E, B> originalInputFormat;
 54  
 
 55  
   /**
 56  
    * Constructor
 57  
    *
 58  
    * @param mappingInputFormat original mappingInputFormat
 59  
    */
 60  
   public WrappedMappingInputFormat(
 61  0
       MappingInputFormat<I, V, E, B> mappingInputFormat) {
 62  0
     originalInputFormat = mappingInputFormat;
 63  0
   }
 64  
 
 65  
   @Override
 66  
   public void checkInputSpecs(Configuration conf) {
 67  0
     originalInputFormat.checkInputSpecs(conf);
 68  0
   }
 69  
 
 70  
   @Override
 71  
   public List<InputSplit> getSplits(JobContext context, int minSplitCountHint)
 72  
     throws IOException, InterruptedException {
 73  0
     return originalInputFormat.getSplits(
 74  0
         HadoopUtils.makeJobContext(getConf(), context),
 75  
         minSplitCountHint);
 76  
   }
 77  
 
 78  
   @Override
 79  
   public MappingReader<I, V, E, B> createMappingReader(InputSplit split,
 80  
     TaskAttemptContext context) throws IOException {
 81  0
     final MappingReader<I, V, E, B> mappingReader = originalInputFormat
 82  0
         .createMappingReader(split,
 83  0
             HadoopUtils.makeTaskAttemptContext(getConf(), context));
 84  0
     return new WrappedMappingReader<>(mappingReader, getConf());
 85  
   }
 86  
 
 87  
 
 88  
   @Override
 89  
   public void writeInputSplit(InputSplit inputSplit,
 90  
     DataOutput dataOutput) throws IOException {
 91  0
     originalInputFormat.writeInputSplit(inputSplit, dataOutput);
 92  0
   }
 93  
 
 94  
   @Override
 95  
   public InputSplit readInputSplit(
 96  
     DataInput dataInput) throws IOException, ClassNotFoundException {
 97  0
     return originalInputFormat.readInputSplit(dataInput);
 98  
   }
 99  
 }