Interface Aggregator<R,T>

All Superinterfaces:
AutoCloseable, Closeable

public interface Aggregator<R,T> extends Closeable
Interface which processes groups of rows into aggregate results.
See Also:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static interface 
    Is called to generate a new Aggregator instance for every query against the target table.
  • Method Summary

    Modifier and Type
    Method
    Description
    accumulate(R source)
    Called for each source row in the group, other than the first one.
    begin(R source)
    Called for the first source row in the group.
    default void
    Is called when this Aggregator instance is no longer needed.
    finish(T target)
    Called produce an aggregate result for the current group.
  • Method Details

    • begin

      R begin(R source) throws IOException
      Called for the first source row in the group.
      Parameters:
      source - never null
      Returns:
      the next source row instance to use, or null if it was kept by the aggregator
      Throws:
      IOException
    • accumulate

      R accumulate(R source) throws IOException
      Called for each source row in the group, other than the first one.
      Parameters:
      source - never null
      Returns:
      the next source row instance to use, or null if it was kept by the aggregator
      Throws:
      IOException
    • finish

      T finish(T target) throws IOException
      Called produce an aggregate result for the current group. This method is expected to assign the appropriate target column values, except for the primary key. The primary key columns are assigned automatically by the caller.
      Parameters:
      target - never null; all columns are initially unset
      Returns:
      null if filtered out
      Throws:
      IOException
    • close

      default void close() throws IOException
      Is called when this Aggregator instance is no longer needed.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Throws:
      IOException