org.apache.pig.impl.builtin
Class PoissonSampleLoader

java.lang.Object
  extended by org.apache.pig.impl.builtin.SampleLoader
      extended by org.apache.pig.impl.builtin.PoissonSampleLoader
All Implemented Interfaces:
LoadFunc

public class PoissonSampleLoader
extends SampleLoader

Currently skipInterval is similar to the randomsampleloader. However, if we were to use an uniform distribution, we could precompute the intervals and read it from a file.


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.pig.LoadFunc
LoadFunc.RequiredField, LoadFunc.RequiredFieldList, LoadFunc.RequiredFieldResponse
 
Field Summary
 
Fields inherited from class org.apache.pig.impl.builtin.SampleLoader
loader, numSamples, skipInterval
 
Constructor Summary
PoissonSampleLoader(String funcSpec, String ns)
           
 
Method Summary
 void computeSamples(ArrayList<Pair<FileSpec,Boolean>> inputs, PigContext pc)
          Computes the number of samples for the loader
 LoadFunc.RequiredFieldResponse fieldsToRead(LoadFunc.RequiredFieldList requiredFields)
          Indicate to the loader fields that will be needed.
 void setNumSamples(int n)
           
 
Methods inherited from class org.apache.pig.impl.builtin.SampleLoader
bindTo, bytesToBag, bytesToCharArray, bytesToDouble, bytesToFloat, bytesToInteger, bytesToLong, bytesToMap, bytesToTuple, determineSchema, getNext, getNumSamples
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PoissonSampleLoader

public PoissonSampleLoader(String funcSpec,
                           String ns)
Method Detail

setNumSamples

public void setNumSamples(int n)
Overrides:
setNumSamples in class SampleLoader

computeSamples

public void computeSamples(ArrayList<Pair<FileSpec,Boolean>> inputs,
                           PigContext pc)
                    throws ExecException
Computes the number of samples for the loader

Overrides:
computeSamples in class SampleLoader
Parameters:
inputs - : Set to pig inputs
pc - : PigContext object
Throws:
ExecException

fieldsToRead

public LoadFunc.RequiredFieldResponse fieldsToRead(LoadFunc.RequiredFieldList requiredFields)
                                            throws FrontendException
Description copied from interface: LoadFunc
Indicate to the loader fields that will be needed. This can be useful for loaders that access data that is stored in a columnar format where indicating columns to be accessed a head of time will save scans. If the loader function cannot make use of this information, it is free to ignore it.

Specified by:
fieldsToRead in interface LoadFunc
Overrides:
fieldsToRead in class SampleLoader
Parameters:
requiredFields - RequiredFieldList indicating which columns will be needed.
Throws:
FrontendException


Copyright © ${year} The Apache Software Foundation