public class RandomSampleLoader extends SampleLoader
Modifier and Type | Field and Description |
---|---|
protected int |
nextSampleIdx |
loader, numSamples
Constructor and Description |
---|
RandomSampleLoader(java.lang.String funcSpec,
java.lang.String ns)
Construct with a class of loader to use.
|
Modifier and Type | Method and Description |
---|---|
Tuple |
getNext()
Allocate a buffer for numSamples elements, populate it with the
first numSamples tuples, and continue scanning rest of the input.
|
void |
prepareToRead(org.apache.hadoop.mapreduce.RecordReader reader,
PigSplit split)
Initializes LoadFunc for reading data.
|
computeSamples, getInputFormat, getLoadCaster, getNumSamples, relativeToAbsolutePath, setLocation, setNumSamples, setUDFContextSignature, skipNext
getAbsolutePath, getCacheFiles, getPathStrings, getShipFiles, join, warn
public RandomSampleLoader(java.lang.String funcSpec, java.lang.String ns)
funcSpec
- func spec of the loader to use.ns
- Number of samples per map to collect.
Arguments are passed as strings instead of actual types (FuncSpec, int)
because FuncSpec only supports string arguments to
UDF constructors.public Tuple getNext() throws java.io.IOException
getNext
in class LoadFunc
java.io.IOException
- if there is an exception while retrieving the next
tuplepublic void prepareToRead(org.apache.hadoop.mapreduce.RecordReader reader, PigSplit split) throws java.io.IOException
LoadFunc
prepareToRead
in class SampleLoader
reader
- RecordReader
to be used by this instance of the LoadFuncsplit
- The input PigSplit
to processjava.io.IOException
- if there is an exception during initializationCopyright © 2007-2017 The Apache Software Foundation