public class RandomSampleLoader extends SampleLoader
Modifier and Type | Field and Description |
---|---|
protected int |
nextSampleIdx |
loader, numSamples
Constructor and Description |
---|
RandomSampleLoader(String funcSpec,
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(String funcSpec, 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 IOException
getNext
in class LoadFunc
IOException
- if there is an exception while retrieving the next
tuplepublic void prepareToRead(org.apache.hadoop.mapreduce.RecordReader reader, PigSplit split) throws IOException
LoadFunc
prepareToRead
in class SampleLoader
reader
- RecordReader
to be used by this instance of the LoadFuncsplit
- The input PigSplit
to processIOException
- if there is an exception during initializationCopyright © 2007-2017 The Apache Software Foundation