Class TableAssertions
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 Summary
Modifier and TypeMethodDescriptionstatic Table
assertAppendOnly
(@NotNull Table table) Asserts that thetable
is append-only.static Table
assertAppendOnly
(String description, @NotNull Table table) Asserts that thetable
is append-only.static Table
assertSorted
(@NotNull Table table, @NotNull String column, SortingOrder order) Asserts that thetable
is sorted by the given column.static Table
assertSorted
(String description, @NotNull Table table, @NotNull String column, SortingOrder order) Asserts that thetable
is sorted by the given column.
-
Method Details
-
assertAppendOnly
Asserts that thetable
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
Asserts that thetable
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 thetable
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 tocolumn
- 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 thetable
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 tocolumn
- 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
-