Class TableAssertions

java.lang.Object
com.illumon.iris.db.tables.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 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:
      The provided table.
    • assertAppendOnly

      public static Table assertAppendOnly​(String description, @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:
      The provided table.
    • assertSorted

      public static Table assertSorted​(@NotNull Table table, @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:
      The provided table.
    • assertSorted

      public static Table assertSorted​(String description, @NotNull Table table, @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:
      The provided table.