Class TableAssertions

java.lang.Object
io.deephaven.engine.table.impl.verify.TableAssertions

public class TableAssertions extends Object
Assert properties of a table.

The table assertions verify that a table meets certain properties. Presently, that the table is add only and that it is sorted by a particular column. The desired property is verified on the initial table, and if the table is refreshing then a listener is attached to ensure that the property remains true.

The returned table may have attributes set which allow the query engine to more efficiently perform downstream operations.

  • Method Details

    • assertAppendOnly

      public static Table assertAppendOnly(@NotNull @NotNull Table table)
      Asserts that the table is append-only. If its rows are ever modified or removed, the query will crash.

      This can be used to ensure the safety and stability of stateful operations.

      Parameters:
      table - The table to apply the assertion to
      Returns:
      table, or a copy with the appropriate assertion applied
    • assertAppendOnly

      public static Table assertAppendOnly(String description, @NotNull @NotNull Table table)
      Asserts that the table is append-only. If its rows are ever modified or removed, the query will crash.

      This can be used to ensure the safety and stability of stateful operations.

      Parameters:
      description - An optional description which will be included in the exception message if the assertion is violated.
      table - The table to apply the assertion to
      Returns:
      table, or a copy with the appropriate assertion applied
    • assertSorted

      public static Table assertSorted(@NotNull @NotNull Table table, @NotNull @NotNull String column, SortingOrder order)
      Asserts that the table is sorted by the given column.

      This allows range filters to utilize binary search instead of a linear scan of the table for the given column.

      Parameters:
      table - The table to apply the assertion to
      column - The column that the table is sorted by.
      order - Whether the column is ascending or descending.
      Returns:
      table, or a copy with the appropriate assertion applied
    • assertSorted

      public static Table assertSorted(String description, @NotNull @NotNull Table table, @NotNull @NotNull String column, SortingOrder order)
      Asserts that the table is sorted by the given column.

      This allows range filters to utilize binary search instead of a linear scan of the table for the given column.

      Parameters:
      description - An optional description which will be included in the exception message if the assertion is violated.
      table - The table to apply the assertion to
      column - The column that the table is sorted by.
      order - Whether the column is ascending or descending.
      Returns:
      table, or a copy with the appropriate assertion applied