Package io.deephaven.processor
Interface ObjectProcessor<T>
- Type Parameters:
T
- the object type
public interface ObjectProcessor<T>
An interface for processing data from one or more input objects into output chunks on a 1-to-1 input record to output
row basis.
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
An abstraction overObjectProcessor
that provides the same logical object processor for different input types. -
Method Summary
Modifier and TypeMethodDescriptionstatic ChunkType
static <T> ObjectProcessor<T>
Creates a "no-operation" object processor that ignores the input object chunk.default int
The number of outputs.The logical output typesthis
instance processes.void
processAll
(ObjectChunk<? extends T, ?> in, List<WritableChunk<?>> out) Processesin
intoout
by appendingin.size()
values to each chunk.static <T> ObjectProcessor<T>
rowLimited
(ObjectProcessor<T> delegate, int rowLimit) Creates or returns a row-limited implementation.static <T> ObjectProcessor<T>
strict
(ObjectProcessor<T> delegate) Creates or returns an implementation that adds strict safety checks arounddelegate
processAll(ObjectChunk, List)
.
-
Method Details
-
strict
Creates or returns an implementation that adds strict safety checks arounddelegate
processAll(ObjectChunk, List)
. The may be useful for development or debugging purposes.- Type Parameters:
T
- the object type- Parameters:
delegate
- the delegate- Returns:
- the strict implementation
-
rowLimited
Creates or returns a row-limited implementation. Ifdelegate
has already been limited more thanrowLimit
,delegate
is returned. Otherwise, a row-limited implementation is created that wrapsdelegate
and invokesdelegate#processAll
withrowLimit
sizedout
chunks, except for the last invocation which may have size less-thanrowLimit
.Adding a row-limit may be useful in cases where the input objects are "wide". By limiting the number of rows considered at any given time, there may be better opportunity for read caching.
Callers should typically have knowledge of the
delegate
implementation; for example, in cases where thedelegate
implementation already processes data in a row-oriented fashion, adding a row-limit here introduces extraneous overhead.- Type Parameters:
T
- the object type- Parameters:
delegate
- the delegaterowLimit
- the row limit- Returns:
- the row-limited processor
-
noop
Creates a "no-operation" object processor that ignores the input object chunk. IffillWithNullValue
istrue
, duringprocessAll
fillWithNullValue
will be invoked on each output chunk; otherwise, the output chunk contents will not be modified. In either case, the processing will increment the output chunks sizes.- Type Parameters:
T
- the object type- Parameters:
outputTypes
- the output typesfillWithNullValue
- if the output chunks should be filled with the appropriate null value- Returns:
- the no-op object processor
-
chunkType
The relationship betweenoutput types
and theprocessAll out param
Chunk.getChunkType()
.Type
ChunkType
ByteType
ChunkType.Byte
ShortType
ChunkType.Short
IntType
ChunkType.Int
LongType
ChunkType.Long
FloatType
ChunkType.Float
DoubleType
ChunkType.Double
CharType
ChunkType.Char
BooleanType
ChunkType.Byte
(notChunkType.Boolean
)BoxedType
Same as BoxedType.primitiveType()
would yield.InstantType
ChunkType.Long
(io.deephaven.time.DateTimeUtils#epochNanos(Instant))All other GenericType
ChunkType.Object
-
outputSize
default int outputSize()The number of outputs. Equivalent tooutputTypes().size()
.- Returns:
- the number of outputs
-
outputTypes
The logical output typesthis
instance processes. The size and types correspond to the expected size andchunk types
forprocessAll(ObjectChunk, List)
as specified bychunkType(Type)
.- Returns:
- the output types
-
processAll
Processesin
intoout
by appendingin.size()
values to each chunk. The size of eachout
chunk will be incremented byin.size()
. Implementations are free to process the data in a row-oriented, column-oriented, or mix-oriented fashion.in
,out
, and the elements ofout
are owned by the caller; implementations should not keep references to these. Implementations may copy references fromin
into the elements ofout
; for example, if the input typeT
isbyte[]
, implementations may copy that reference intoout
. In general, implementations should document the references they may copy fromin
intoout
.If an exception is thrown the output chunks will be in an unspecified state for all rows after their initial size.
- Parameters:
in
- the input objectsout
- the output chunks as specified byoutputTypes()
; each chunk must have remaining capacity of at leastin.size()
-