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
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceAn abstraction overObjectProcessorthat provides the same logical object processor for different input types. -
Method Summary
Modifier and TypeMethodDescriptionstatic ChunkTypestatic <T> ObjectProcessor<T>Creates a "no-operation" object processor that ignores the input object chunk.default intThe number of outputs.The logical output typesthisinstance processes.voidprocessAll(ObjectChunk<? extends T, ?> in, List<WritableChunk<?>> out) Processesinintooutby 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 arounddelegateprocessAll(ObjectChunk, List).
-
Method Details
-
strict
Creates or returns an implementation that adds strict safety checks arounddelegateprocessAll(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. Ifdelegatehas already been limited more thanrowLimit,delegateis returned. Otherwise, a row-limited implementation is created that wrapsdelegateand invokesdelegate#processAllwithrowLimitsizedoutchunks, 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
delegateimplementation; for example, in cases where thedelegateimplementation 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. IffillWithNullValueistrue, duringprocessAllfillWithNullValuewill 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 typesand theprocessAll out paramChunk.getChunkType().TypeChunkTypeByteTypeChunkType.ByteShortTypeChunkType.ShortIntTypeChunkType.IntLongTypeChunkType.LongFloatTypeChunkType.FloatDoubleTypeChunkType.DoubleCharTypeChunkType.CharBooleanTypeChunkType.Byte(notChunkType.Boolean)BoxedTypeSame as BoxedType.primitiveType()would yield.InstantTypeChunkType.Long(io.deephaven.time.DateTimeUtils#epochNanos(Instant))All other GenericTypeChunkType.Object -
outputSize
default int outputSize()The number of outputs. Equivalent tooutputTypes().size().- Returns:
- the number of outputs
-
outputTypes
The logical output typesthisinstance processes. The size and types correspond to the expected size andchunk typesforprocessAll(ObjectChunk, List)as specified bychunkType(Type).- Returns:
- the output types
-
processAll
Processesinintooutby appendingin.size()values to each chunk. The size of eachoutchunk 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 ofoutare owned by the caller; implementations should not keep references to these. Implementations may copy references fromininto the elements ofout; for example, if the input typeTisbyte[], implementations may copy that reference intoout. In general, implementations should document the references they may copy frominintoout.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()
-