Class FileBasedSegmentWriter
- java.lang.Object
-
- org.apache.pinot.plugin.segmentwriter.filebased.FileBasedSegmentWriter
-
- All Implemented Interfaces:
Closeable,AutoCloseable,SegmentWriter
@NotThreadSafe public class FileBasedSegmentWriter extends Object implements SegmentWriter
ASegmentWriterimplementation that uses a local file as a buffer to collectGenericRow. TheGenericRoware written to the buffer as AVRO records.
-
-
Constructor Summary
Constructors Constructor Description FileBasedSegmentWriter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()voidcollect(GenericRow row)URIflush()Creates one Pinot segment using theGenericRows collected in the AVRO file buffer, at the outputDirUri as specified in the tableConfig->batchConfigs.voidinit(TableConfig tableConfig, Schema schema)voidinit(TableConfig tableConfig, Schema schema, Map<String,String> batchConfigOverride)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.pinot.spi.ingestion.segment.writer.SegmentWriter
collect
-
-
-
-
Method Detail
-
init
public void init(TableConfig tableConfig, Schema schema) throws Exception
- Specified by:
initin interfaceSegmentWriter- Throws:
Exception
-
init
public void init(TableConfig tableConfig, Schema schema, Map<String,String> batchConfigOverride) throws Exception
- Specified by:
initin interfaceSegmentWriter- Throws:
Exception
-
collect
public void collect(GenericRow row) throws IOException
- Specified by:
collectin interfaceSegmentWriter- Throws:
IOException
-
flush
public URI flush() throws IOException
Creates one Pinot segment using theGenericRows collected in the AVRO file buffer, at the outputDirUri as specified in the tableConfig->batchConfigs. Successful invocation of this method means that theGenericRows collected so far, are now available in the Pinot segment and not available in the buffer anymore. Successful completion of segment will return the segment URI. The buffer will be reset and ready to accept further records viacollect()If an exception is thrown, the buffer will not be reset and so,flush()can be invoked repeatedly in a retry loop. If a successful invocation is not achieved,close()followed byinitwill have to be called in order to reset the buffer and resume record writing.- Specified by:
flushin interfaceSegmentWriter- Returns:
- URI of the generated segment
- Throws:
IOException
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
-