org.apache.pig
Interface LoadFunc

All Known Subinterfaces:
ReversibleLoadStoreFunc
All Known Implementing Classes:
BinaryStorage, BinStorage, PigStorage, RandomSampleLoader, TextLoader

public interface LoadFunc


Method Summary
 void bindTo(String fileName, BufferedPositionedInputStream is, long offset, long end)
          Specifies a portion of an InputStream to read tuples.
 Tuple getNext()
          Retrieves the next tuple to be processed.
 

Method Detail

bindTo

void bindTo(String fileName,
            BufferedPositionedInputStream is,
            long offset,
            long end)
            throws IOException
Specifies a portion of an InputStream to read tuples. Because the starting and ending offsets may not be on record boundaries it is up to the implementor to deal with figuring out the actual starting and ending offsets in such a way that an arbitrarily sliced up file will be processed in its entirety.

A common way of handling slices in the middle of records is to start at the given offset and, if the offset is not zero, skip to the end of the first record (which may be a partial record) before reading tuples. Reading continues until a tuple has been read that ends at an offset past the ending offset.

The load function should not do any buffering on the input stream. Buffering will cause the offsets returned by is.getPos() to be unreliable.

Parameters:
fileName - the name of the file to be read
is - the stream representing the file to be processed, and which can also provide its position.
offset - the offset to start reading tuples.
end - the ending offset for reading.
Throws:
IOException

getNext

Tuple getNext()
              throws IOException
Retrieves the next tuple to be processed.

Returns:
the next tuple to be processed or null if there are no more tuples to be processed.
Throws:
IOException


Copyright © ${year} The Apache Software Foundation