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.
  • Method Details

    • strict

      static <T> ObjectProcessor<T> strict(ObjectProcessor<T> delegate)
      Creates or returns an implementation that adds strict safety checks around delegate 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

      static <T> ObjectProcessor<T> rowLimited(ObjectProcessor<T> delegate, int rowLimit)
      Creates or returns a row-limited implementation. If delegate has already been limited more than rowLimit, delegate is returned. Otherwise, a row-limited implementation is created that wraps delegate and invokes delegate#processAll with rowLimit sized out chunks, except for the last invocation which may have size less-than rowLimit.

      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 the delegate 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 delegate
      rowLimit - the row limit
      Returns:
      the row-limited processor
    • noop

      static <T> ObjectProcessor<T> noop(List<Type<?>> outputTypes, boolean fillWithNullValue)
      Creates a "no-operation" object processor that ignores the input object chunk. If fillWithNullValue is true, during processAll 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 types
      fillWithNullValue - if the output chunks should be filled with the appropriate null value
      Returns:
      the no-op object processor
    • chunkType

      static ChunkType chunkType(Type<?> type)
    • outputTypes

      List<Type<?>> outputTypes()
      The logical output types this instance processes. The size and types correspond to the expected size and chunk types for processAll(ObjectChunk, List) as specified by chunkType(Type).
      Returns:
      the output types
    • processAll

      void processAll(ObjectChunk<? extends T,?> in, List<WritableChunk<?>> out)
      Processes in into out by appending in.size() values to each chunk. The size of each out chunk will be incremented by in.size(). Implementations are free to process the data in a row-oriented, column-oriented, or mix-oriented fashion. in, out, and the elements of out are owned by the caller; implementations should not keep references to these. Implementations may copy references from in into the elements of out; for example, if the input type T is byte[], implementations may copy that reference into out. In general, implementations should document the references they may copy from in into out.

      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 objects
      out - the output chunks as specified by outputTypes(); each chunk must have remaining capacity of at least in.size()