Class RowWriterBase<TSlot>
Provides the parallel serialization pipeline used by generated row writers.
public abstract class RowWriterBase<TSlot> : IDisposable where TSlot : class
Type Parameters
TSlotThe generated row-buffer slot type.
- Inheritance
-
RowWriterBase<TSlot>
- Implements
- Derived
- Inherited Members
Remarks
This unstable API supports Plank-generated code and is not intended for direct use by applications. Row submission is single-producer; it must not overlap completion, reset, or disposal.
Constructors
RowWriterBase(IParquetWriteSource, ParquetFilePath, ParquetSchema, uint, ParquetWriterOptions)
Initializes a rolling pipeline used by a generated row writer.
protected RowWriterBase(IParquetWriteSource file, ParquetFilePath filePath, ParquetSchema schema, uint maxParallelism, ParquetWriterOptions options)
Parameters
fileIParquetWriteSourceThe reusable destination used for each produced file.
filePathParquetFilePathSelects the path of each produced file.
schemaParquetSchemaThe generated Parquet schema.
maxParallelismuintThe maximum number of serialization workers.
optionsParquetWriterOptionsThe Parquet writer options.
RowWriterBase(Stream, ParquetSchema, uint, ParquetWriterOptions)
Initializes the pipeline used by a generated row writer.
protected RowWriterBase(Stream stream, ParquetSchema schema, uint maxParallelism, ParquetWriterOptions options)
Parameters
streamStreamThe destination stream.
schemaParquetSchemaThe generated Parquet schema.
maxParallelismuintThe maximum number of serialization workers.
optionsParquetWriterOptionsThe Parquet writer options.
Properties
WorkerThreadNamePrefix
Gets the name prefix used for serialization worker threads.
protected virtual string WorkerThreadNamePrefix { get; }
Property Value
Methods
Complete(TSlot, bool)
Completes the current serialization cycle and closes the Parquet file.
protected void Complete(TSlot activeSlot, bool hasRows)
Parameters
activeSlotTSlotThe generated writer's active slot.
hasRowsboolWhether the active slot contains rows to write.
CreateSlot(ParquetWriter)
Creates a generated row-buffer slot.
protected abstract TSlot CreateSlot(ParquetWriter writer)
Parameters
writerParquetWriterThe destination Parquet writer.
Returns
- TSlot
A new buffer slot.
Dispose()
Aborts the pipeline and releases its persistent workers, pooled buffers, and destination.
public void Dispose()
Remarks
Disposing does not complete the Parquet file. Call the generated writer's Complete() method before
disposal to commit a valid file. Once disposed, the writer cannot be reused.
EnqueueAndTakeFree(TSlot)
Queues a filled slot and obtains the next writable slot.
protected TSlot EnqueueAndTakeFree(TSlot slot)
Parameters
slotTSlotThe filled slot to queue.
Returns
- TSlot
The next writable slot.
InitializeSlots()
Creates the generated slots and starts serialization workers.
protected void InitializeSlots()
OnSlotWritten(TSlot)
Handles successful writing of a generated slot.
protected virtual void OnSlotWritten(TSlot slot)
Parameters
slotTSlotThe slot that was written.
ResetPipeline(Stream)
Resets a completed generated row-writer pipeline to a new destination stream.
protected void ResetPipeline(Stream stream)
Parameters
streamStreamThe new destination stream.
ResetSlotForReuse(TSlot)
Resets a generated slot before it is reused.
protected abstract void ResetSlotForReuse(TSlot slot)
Parameters
slotTSlotThe slot to reset.
SerializeSlot(TSlot)
Serializes a generated row-buffer slot.
protected abstract void SerializeSlot(TSlot slot)
Parameters
slotTSlotThe slot to serialize.
TakeInitialSlot()
Takes the first slot used by a generated writer.
protected TSlot TakeInitialSlot()
Returns
- TSlot
The first writable slot.
ThrowIfDisposed()
Throws if this writer has been disposed.
protected void ThrowIfDisposed()
ThrowIfFaulted()
Rethrows a failure reported by a serialization worker.
protected void ThrowIfFaulted()
WriteSerializedSlot(TSlot, RowGroupWriter)
Writes a serialized slot to a row group.
protected abstract void WriteSerializedSlot(TSlot slot, RowGroupWriter rowGroupWriter)
Parameters
slotTSlotThe serialized slot.
rowGroupWriterRowGroupWriterThe destination row-group writer.