T - object type representing input datapublic abstract class AbstractTextFilesFirehoseFactory<T> extends Object implements FiniteFirehoseFactory<StringInputRowParser,T>
connect(StringInputRowParser, File) implementation for its subclasses.| Constructor and Description |
|---|
AbstractTextFilesFirehoseFactory() |
| Modifier and Type | Method and Description |
|---|---|
Firehose |
connect(StringInputRowParser firehoseParser,
File temporaryDirectory)
Initialization method that connects up the fire hose.
|
int |
getNumSplits()
Returns number of splits returned by
FiniteFirehoseFactory.getSplits(). |
List<T> |
getObjects() |
Stream<InputSplit<T>> |
getSplits()
Returns a
Stream for InputSplits. |
protected void |
initializeObjectsIfNeeded() |
protected abstract Collection<T> |
initObjects()
Initialize objects to be read by this firehose.
|
protected abstract InputStream |
openObjectStream(T object)
Open an input stream from the given object.
|
protected abstract InputStream |
wrapObjectStream(T object,
InputStream stream)
Wrap the given input stream if needed.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitisSplittable, withSplitconnectpublic Firehose connect(StringInputRowParser firehoseParser, File temporaryDirectory) throws IOException
FirehoseFactoryPrefetchableTextFilesFirehoseFactory may use a temporary
directory to cache data in it.connect in interface FirehoseFactory<StringInputRowParser>firehoseParser - an input row parsertemporaryDirectory - a directory where temporary files are storedIOExceptionprotected void initializeObjectsIfNeeded()
throws IOException
IOExceptionpublic Stream<InputSplit<T>> getSplits() throws IOException
FiniteFirehoseFactoryStream for InputSplits. In parallel batch indexing, each InputSplit is processed
by a sub task.
Listing splits may cause high overhead in some implementations. In this case, InputSplits should be listed
lazily so that the listing overhead could be amortized.getSplits in interface FiniteFirehoseFactory<StringInputRowParser,T>IOExceptionpublic int getNumSplits()
throws IOException
FiniteFirehoseFactoryFiniteFirehoseFactory.getSplits().getNumSplits in interface FiniteFirehoseFactory<StringInputRowParser,T>IOExceptionprotected abstract Collection<T> initObjects() throws IOException
connect(StringInputRowParser, File) is called.IOExceptionprotected abstract InputStream openObjectStream(T object) throws IOException
wrapObjectStream(Object, InputStream).object - an object to be readIOExceptionprotected abstract InputStream wrapObjectStream(T object, InputStream stream) throws IOException
object - an input objectstream - a stream for the objectIOExceptionCopyright © 2011–2018 The Apache Software Foundation. All rights reserved.