Package org.apache.druid.frame.processor
Class PartitionedOutputChannel
java.lang.Object
org.apache.druid.frame.processor.PartitionedOutputChannel
A channel which can contain multiple partitions of data. It is used by
SuperSorter currently to write multiple
partitions on the same channel. The readable channel provided to the caller is an instance of
PartitionedReadableFrameChannel which allows the caller to open a readable channel for the desired partition.-
Method Summary
Modifier and TypeMethodDescriptionvoidRemoves the reference to thewritableChannelandframeMemoryAllocatorfrom the object, making it more efficientReturns the memory allocator for the writable channel.Returns the partitioned readable channel supplier of this pair.Returns the writable channel of this pair.static PartitionedOutputChannelpair(WritableFrameChannel writableChannel, MemoryAllocator frameMemoryAllocator, Supplier<PartitionedReadableFrameChannel> readableChannelSupplier) Creates a partitioned output channel pair.readOnly()Returns a read-only version of this instance.
-
Method Details
-
pair
public static PartitionedOutputChannel pair(WritableFrameChannel writableChannel, MemoryAllocator frameMemoryAllocator, Supplier<PartitionedReadableFrameChannel> readableChannelSupplier) Creates a partitioned output channel pair.- Parameters:
writableChannel- writable channel for producerframeMemoryAllocator- memory allocator for producer to use while writing frames to the channelreadableChannelSupplier- partitioned readable channel for consumer. May be called multiple times, so you should wrap this inSuppliers.memoize(com.google.common.base.Supplier<T>)if needed.
-
getWritableChannel
Returns the writable channel of this pair. The producer writes to this channel. Throws ISE if the output channel is read only. -
getFrameMemoryAllocator
Returns the memory allocator for the writable channel. The producer uses this to generate frames for the channel. Throws ISE if the output channel is read only. -
getReadableChannelSupplier
Returns the partitioned readable channel supplier of this pair. The consumer reads from this channel. -
mapWritableChannel
public PartitionedOutputChannel mapWritableChannel(Function<WritableFrameChannel, WritableFrameChannel> mapFn) -
readOnly
Returns a read-only version of this instance. Read-only versions have neithergetWritableChannel()norgetFrameMemoryAllocator(), and therefore require substantially less memory. -
convertToReadOnly
public void convertToReadOnly()Removes the reference to thewritableChannelandframeMemoryAllocatorfrom the object, making it more efficient
-