org.apache.hadoop.mapreduce.lib.input
Class SequenceFileInputFilter.PercentFilter

java.lang.Object
  extended by org.apache.hadoop.mapreduce.lib.input.SequenceFileInputFilter.FilterBase
      extended by org.apache.hadoop.mapreduce.lib.input.SequenceFileInputFilter.PercentFilter
All Implemented Interfaces:
Configurable, SequenceFileInputFilter.Filter
Enclosing class:
SequenceFileInputFilter<K,V>

public static class SequenceFileInputFilter.PercentFilter
extends SequenceFileInputFilter.FilterBase

This class returns a percentage of records The percentage is determined by a filtering frequency f using the criteria record# % f == 0. For example, if the frequency is 10, one out of 10 records is returned.


Constructor Summary
SequenceFileInputFilter.PercentFilter()
           
 
Method Summary
 boolean accept(Object key)
          Filtering method If record# % frequency==0, return true; otherwise return false
 void setConf(Configuration conf)
          configure the filter by checking the configuration
static void setFrequency(Configuration conf, int frequency)
          set the frequency and stores it in conf
 
Methods inherited from class org.apache.hadoop.mapreduce.lib.input.SequenceFileInputFilter.FilterBase
getConf
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SequenceFileInputFilter.PercentFilter

public SequenceFileInputFilter.PercentFilter()
Method Detail

setFrequency

public static void setFrequency(Configuration conf,
                                int frequency)
set the frequency and stores it in conf

Parameters:
conf - configuration
frequency - filtering frequencey

setConf

public void setConf(Configuration conf)
configure the filter by checking the configuration

Parameters:
conf - configuration

accept

public boolean accept(Object key)
Filtering method If record# % frequency==0, return true; otherwise return false

Parameters:
key - record key
Returns:
true if a record is accepted; return false otherwise
See Also:
SequenceFileInputFilter.Filter.accept(Object)


Copyright © 2009 The Apache Software Foundation