public class FrameChannelHashPartitioner extends Object implements FrameProcessor<Long>
FrameType.ROW_BASED
, and input signature must be the same as output signature.
This processor hashes each row using BaseState.xxHash64(long, long, long)
with a seed of HASH_SEED
.Constructor and Description |
---|
FrameChannelHashPartitioner(List<ReadableFrameChannel> inputChannels,
List<WritableFrameChannel> outputChannels,
FrameReader frameReader,
int keyFieldCount,
FrameWriterFactory frameWriterFactory) |
Modifier and Type | Method and Description |
---|---|
void |
cleanup()
Closes resources used by this worker.
|
List<ReadableFrameChannel> |
inputChannels()
List of input channels.
|
List<WritableFrameChannel> |
outputChannels()
List of output channels.
|
ReturnOrAwait<Long> |
runIncrementally(it.unimi.dsi.fastutil.ints.IntSet readableInputs)
Runs some of the algorithm, without blocking, and either returns a value or a set of input channels
to wait for.
|
public FrameChannelHashPartitioner(List<ReadableFrameChannel> inputChannels, List<WritableFrameChannel> outputChannels, FrameReader frameReader, int keyFieldCount, FrameWriterFactory frameWriterFactory)
public List<ReadableFrameChannel> inputChannels()
FrameProcessor
readableInputs
set
provided to FrameProcessor.runIncrementally(it.unimi.dsi.fastutil.ints.IntSet)
.inputChannels
in interface FrameProcessor<Long>
public List<WritableFrameChannel> outputChannels()
FrameProcessor
outputChannels
in interface FrameProcessor<Long>
public ReturnOrAwait<Long> runIncrementally(it.unimi.dsi.fastutil.ints.IntSet readableInputs) throws IOException
FrameProcessor
FrameProcessorExecutor.runFully(org.apache.druid.frame.processor.FrameProcessor<T>, java.lang.String)
when all output channels are
writable. Therefore, it is guaranteed that each output channel can accept at least one frame.
This method must not read more than one frame from each readable input channel, and must not write more than one
frame to each output channel.runIncrementally
in interface FrameProcessor<Long>
readableInputs
- channels from FrameProcessor.inputChannels()
that are either finished or ready to read.
That is: either ReadableFrameChannel.isFinished()
or
ReadableFrameChannel.canRead()
are true.IOException
public void cleanup() throws IOException
FrameProcessor
Closeable.close()
. This interface does not extend Closeable, in order to
make it easier to find all places where cleanup happens. (Static analysis tools can lose the thread when Closeables
are closed in generic ways.)
Implementations typically call ReadableFrameChannel.close()
and
WritableFrameChannel.close()
on all input and output channels, as well as releasing any additional
resources that may be held, such as FrameWriter
.
In cases of cancellation, this method may be called even if FrameProcessor.runIncrementally(it.unimi.dsi.fastutil.ints.IntSet)
has not yet returned a
result via ReturnOrAwait.returnObject(T)
.cleanup
in interface FrameProcessor<Long>
IOException
Copyright © 2011–2023 The Apache Software Foundation. All rights reserved.