Interface SegmentWriter
-
- All Superinterfaces:
AutoCloseable,Closeable
public interface SegmentWriter extends Closeable
An interface to collect records and create a Pinot segment. This interface helps abstract out details regarding segment generation from the caller.
-
-
Method Summary
Modifier and Type Method Description voidcollect(GenericRow row)Collects a singleGenericRowinto a buffer.default voidcollect(GenericRow[] rowBatch)Collects a batch ofGenericRows into a buffer.URIflush()Creates one Pinot segment using theGenericRows collected in the buffer, at the outputDirUri as specified in the tableConfig->batchConfigs.voidinit(TableConfig tableConfig, Schema schema)voidinit(TableConfig tableConfig, Schema schema, Map<String,String> batchConfigOverride)Initializes theSegmentWriterwith provided tableConfig and Pinot schema.
-
-
-
Method Detail
-
init
void init(TableConfig tableConfig, Schema schema) throws Exception
- Throws:
Exception- See Also:
init(TableConfig, Schema, Map)
-
init
void init(TableConfig tableConfig, Schema schema, Map<String,String> batchConfigOverride) throws Exception
Initializes theSegmentWriterwith provided tableConfig and Pinot schema.- Parameters:
tableConfig- The table config for the segmentschema- The Pinot schema for the tablebatchConfigOverride- The config override on top of tableConfig- Throws:
Exception
-
collect
void collect(GenericRow row) throws Exception
Collects a singleGenericRowinto a buffer. This row is not available in the segment until aflush()is invoked.- Throws:
Exception
-
collect
default void collect(GenericRow[] rowBatch) throws Exception
Collects a batch ofGenericRows into a buffer. These rows are not available in the segment until aflush()is invoked.- Throws:
Exception
-
flush
URI flush() throws Exception
Creates one Pinot segment using theGenericRows collected in the 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.- Returns:
- URI of the generated segment
- Throws:
Exception
-
-