Class FunctionGeneratedTableFactory

java.lang.Object
io.deephaven.engine.table.impl.util.FunctionGeneratedTableFactory

public class FunctionGeneratedTableFactory extends Object
An abstract table that represents the result of a function.

The table will run by regenerating the full values (using the tableGenerator Function passed in). The resultant table's values are copied into the result table and appropriate listener notifications are fired.

All the rows in the output table are modified on every tick, even if no actual changes occurred. The output table also has a contiguous RowSet.

The generator function must produce a V2 table, and the table definition must not change between invocations.

If you are transforming a table, you should generally prefer to use the regular table operations as opposed to this factory, because they are capable of performing some operations incrementally. However, for small tables this might prove to require less development effort.

  • Method Summary

    Modifier and Type
    Method
    Description
    static Table
    create(@NotNull Supplier<Table> tableGenerator, int refreshIntervalMs)
    Create a table that refreshes based on the value of your function, automatically called every refreshIntervalMs.
    static Table
    create(@NotNull Supplier<Table> tableGenerator, @NotNull Table... sourceTables)
    Create a table that refreshes based on the value of your function, automatically called in a dependency-respecting way when at least one of the sourceTables tick.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • create

      public static Table create(@NotNull @NotNull Supplier<Table> tableGenerator, int refreshIntervalMs)
      Create a table that refreshes based on the value of your function, automatically called every refreshIntervalMs.
      Parameters:
      tableGenerator - a function returning a table to copy into the output table
      Returns:
      a ticking table (assuming sourceTables have been specified) generated by tableGenerator
    • create

      public static Table create(@NotNull @NotNull Supplier<Table> tableGenerator, @NotNull @NotNull Table... sourceTables)
      Create a table that refreshes based on the value of your function, automatically called in a dependency-respecting way when at least one of the sourceTables tick.

      Note that the tableGenerator may access data in the sourceTables but should not perform further table operations on them without careful handling. Table operations may be memoized, and it is possible that a table operation will return a table created by a previous invocation of the same operation. Since that result will not have been included in the sourceTables, it's not automatically treated as a dependency for purposes of determining when it's safe to invoke tableGenerator, allowing races to exist between accessing the operation result and that result's own update processing. It's best to include all dependencies directly in sourceTables, or only compute on-demand inputs under a LivenessScope.

      Parameters:
      tableGenerator - a function returning a table to copy into the output table
      sourceTables - The query engine does not know the details of your function inputs. If you are dependent on a ticking table tables in your tableGenerator function, you can add it to this list so that the function will be recomputed on each tick.
      Returns:
      a ticking table (assuming sourceTables have been specified) generated by tableGenerator