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 Summary
Modifier and Type Method Description static Table
assertAppendOnly(Table table)
Asserts that thetable
is append-only.static Table
assertAppendOnly(String description, Table table)
Asserts that thetable
is append-only.static Table
assertSorted(Table table, String column, SortingOrder order)
Asserts that thetable
is sorted by the given column.static Table
assertSorted(String description, Table table, 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:
- The provided
table
.
-
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:
- The provided
table
.
-
assertSorted
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:
- The provided
table
.
-
assertSorted
public static Table assertSorted(String description, @NotNull Table table, @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:
- The provided
table
.
-