Class QueryTable

All Implemented Interfaces:
com.fishlib.base.log.LogOutputAppendable, NotificationQueue.Dependency, Deflatable<Table>, Table, LivenessManager, LivenessNode, LivenessReferent, LongSizedDataStructure, DynamicNode, DynamicTable, NotificationStepReceiver, NotificationStepSource, SystemicObject, Serializable
Direct Known Subclasses:
ConnectionAwareRemoteTable, HierarchicalTable, InitialSnapshotTable, InMemoryTable, LiveQueryTable, QueryReplayGroupedTable, QueryTable.FilteredTable, ReplayTable, TimeTable, UpdatableTable

public class QueryTable extends BaseTable
Primary coalesced table implementation.
See Also:
  • Field Details

    • modifiedColumnSet

      protected transient ModifiedColumnSet modifiedColumnSet
    • USE_UNTRACKED_LASTBY_FOR_AUTOMATED_FILTERS

      public static boolean USE_UNTRACKED_LASTBY_FOR_AUTOMATED_FILTERS
    • USE_CHUNKED_CROSS_JOIN

      @VisibleForTesting public static boolean USE_CHUNKED_CROSS_JOIN
  • Constructor Details

    • QueryTable

      public QueryTable(Index index, Map<String,? extends ColumnSource> columns)
    • QueryTable

      public QueryTable(TableDefinition definition, Index index, Map<String,? extends ColumnSource> columns)
      Creates a new abstract table, reusing a definition but creating a new column source map.
      Parameters:
      definition - the definition to use for this table
      index - the index of the new table
      columns - the column source map for the table, which will be copied into a new column source map
  • Method Details

    • getIndex

      public Index getIndex()
    • size

      public long size()
      Description copied from interface: LongSizedDataStructure
      The size of this data structure.
      Returns:
      The size
    • getColumnSource

      public ColumnSource getColumnSource(String sourceName)
    • getColumnSourceMap

      public Map<String,ColumnSource> getColumnSourceMap()
    • getColumnSources

      public Collection<? extends ColumnSource> getColumnSources()
    • getColumn

      public DataColumn getColumn(String columnName)
    • getDataIndex

      @InternalUseOnly @Nullable public Table getDataIndex(String... keyColumns)
      Get the Data Index for the specified set of key columns, if one exists.
      Parameters:
      keyColumns - the set of key columns.
      Returns:
      the Data Index table, or null if there was none.
      ImplNote:
      This is an experimental feature and the interface is subject to change.
    • setDataIndexProvider

      @InternalUseOnly public void setDataIndexProvider(@Nullable DataIndexProvider provider)
      Set the provider to use to read Data Indices.
      Parameters:
      provider - the provider to set. May be null.
      ImplNote:
      This is an experimental feature and the interface is subject to change.
    • newModifiedColumnSet

      public ModifiedColumnSet newModifiedColumnSet(String... columnNames)
      Description copied from interface: DynamicTable
      Retrieve the ModifiedColumnSet that will be used when propagating updates from this table.
      Parameters:
      columnNames - the columns that should belong to the resulting set.
      Returns:
      the resulting ModifiedColumnSet for the given columnNames
    • getModifiedColumnSetForUpdates

      public ModifiedColumnSet getModifiedColumnSetForUpdates()
      Producers of tables should use the modified column set embedded within the table for their result. You must not mutate the result of this method if you are not generating the updates for this table. Callers should not rely on the dirty state of this modified column set.
      Returns:
      the modified column set for this table
    • newModifiedColumnSetTransformer

      public ModifiedColumnSet.Transformer newModifiedColumnSetTransformer(String[] columnNames, ModifiedColumnSet[] columnSets)
      Description copied from interface: DynamicTable
      Create a ModifiedColumnSet.Transformer that can be used to propagate dirty columns from this table to listeners of the table used to construct columnSets. It is an error if columnNames and columnSets are not the same length. The transformer will mark columnSets[i] as dirty if the column represented by columnNames[i] is dirty.
      Parameters:
      columnNames - the source columns
      columnSets - the destination columns in the convenient ModifiedColumnSet form
      Returns:
      a transformer that knows the dirty details
    • newModifiedColumnSetIdentityTransformer

      public ModifiedColumnSet.Transformer newModifiedColumnSetIdentityTransformer(Map<String,ColumnSource> newColumns)
      Description copied from interface: DynamicTable
      Create a transformer that uses an identity mapping from one ColumnSourceMap to another. The two CSMs must have equivalent column names and column ordering.
      Parameters:
      newColumns - the column source map for result table
      Returns:
      a simple Transformer that makes a cheap, but CSM compatible copy
    • newModifiedColumnSetIdentityTransformer

      public ModifiedColumnSet.Transformer newModifiedColumnSetIdentityTransformer(DynamicTable other)
      Description copied from interface: DynamicTable
      Create a transformer that uses an identity mapping from one DynamicTable to another. The two tables must have equivalent column names and column ordering.
      Parameters:
      other - the result table
      Returns:
      a simple Transformer that makes a cheap, but CSM compatible copy
    • getRecord

      public Object[] getRecord(long rowNo, String... columnNames)
      Description copied from interface: Table
      Returns an object array populated with the column values at the specified rowNo. The ordering of columns in the object array is based on the columnNames array provided or by default the column ordering is based on TableDefinition.
      Parameters:
      rowNo - The row whose values are needed. This should be a value between 0 and (table.size() - 1)
      columnNames - Optional parameter of column names whose values are needed in the returned object array
    • preemptiveUpdatesTable

      public Table preemptiveUpdatesTable(long updateInterval)
    • preemptiveUpdatesTable

      @VisibleForTesting public Table preemptiveUpdatesTable(long updateInterval, LiveTableRegistrar errorRegistrar, com.fishlib.io.sched.Scheduler scheduler, Runnable onGetSnapshot)
    • preemptiveSnapshotTable

      public Table preemptiveSnapshotTable(long updateInterval)
    • byExternal

      public LocalTableMap byExternal(boolean dropKeys, String... keyColumnNames)
      Description copied from interface: Table
      Create a TableMap from this table, keyed by the specified columns.

      The returned TableMap contains each row in this table in exactly one of the tables within the map. If you have exactly one key column the TableMap is keyed by the value in that column. If you have zero key columns, then the TableMap is keyed by com.fishlib.datastructures.util.SmartKey.EMPTY (and will contain this table as the value). If you have multiple key columns, then the TableMap is keyed by a com.fishlib.datastructures.util.SmartKey. The SmartKey will have one value for each of your column values, in the order specified by keyColumnNames.

      For example if you have a Table keyed by a String column named USym, and a DBDateTime column named Expiry; a value could be retrieved from the TableMap with tableMap.get(new SmartKey("SPY";, DBTimeUtils.convertDateTime("2020-06-19T16:15:00 NY"))). For a table with an Integer column named Bucket, you simply use the desired value as in tableMap.get(1).

      Parameters:
      dropKeys - if true, drop key columns in the output Tables
      keyColumnNames - the name of the key columns to use.
      Returns:
      a TableMap keyed by keyColumnNames
    • rollup

      public HierarchicalTable rollup(ComboAggregateFactory comboAggregateFactory, boolean includeConstituents, SelectColumn... columns)
    • treeTable

      public HierarchicalTable treeTable(String idColumn, String parentColumn)
      Description copied from interface: Table
      Create a hierarchical tree table. The structure of the table is encoded by an "id" and a "parent" column. The id column should represent a unique identifier for a given row, and the parent column indicates which row is the parent for a given row. Rows that have a null parent, are shown in the main table. It is possible for rows to be "orphaned", if their parent reference is non-null and does not exist in the table.
      Parameters:
      idColumn - the name of a column containing a unique identifier for a particular row in the table
      parentColumn - the name of a column containing the parent's identifier, null for elements that are part of the root table
      Returns:
      a hierarchical table grouped according to the parentColumn
    • slice

      public Table slice(long firstPositionInclusive, long lastPositionExclusive)
      Description copied from interface: Table
      Extracts a subset of a table by row position. If both firstPosition and lastPosition are positive, then the rows are counted from the beginning of the table. The firstPosition is inclusive, and the lastPosition is exclusive. The Table.head(long)(N) call is equivalent to slice(0, N). The firstPosition must be less than or equal to the lastPosition. If firstPosition is positive and lastPosition is negative, then the firstRow is counted from the beginning of the table, inclusively. The lastPosition is counted from the end of the table. For example, slice(1, -1) includes all rows but the first and last. If the lastPosition would be before the firstRow, the result is an emptyTable. If firstPosition is negative, and lastPosition is zero, then the firstRow is counted from the end of the table, and the end of the slice is the size of the table. slice(-N, 0) is equivalent to Table.tail(long)(N). If the firstPosition is nega tive and the lastPosition is negative, they are both counted from the end of the table. For example, slice(-2, -1) returns the second to last row of the table.
      Parameters:
      firstPositionInclusive - the first position to include in the result
      lastPositionExclusive - the last position to include in the result
      Returns:
      a new Table, which is the request subset of rows from the original table
    • head

      public Table head(long size)
    • tail

      public Table tail(long size)
    • headPct

      public Table headPct(double percent)
      Description copied from interface: Table
      Provides a head that selects a dynamic number of rows based on a percent.
      Parameters:
      percent - the fraction of the table to return (0..1), the number of rows will be rounded up. For example if there are 3 rows, headPct(50) returns the first two rows.
    • tailPct

      public Table tailPct(double percent)
    • leftJoin

      public Table leftJoin(Table table, MatchPair[] columnsToMatch, MatchPair[] columnsToAdd)
      Description copied from interface: Table
      Augments this table with array columns of right-hand side matches.

      The leftJoin() method returns the exact rows of the leftTable. The data joined in from the rightTable are grouped into arrays of data. When no right-hand side data is found, the right hand columns are null.

      Parameters:
      table - The right side table on the join.
      columnsToMatch - An array of match pair conditions ("leftColumn=rightColumn" or "columnFoundInBoth")
      columnsToAdd - An array of the columns from the right side be added to the left side as a result of the match. If empty, then all columns from the right table are added to the result.
      Returns:
      a new table joined according to the specification in columnsToMatch and columnsToAdd
    • exactJoin

      public Table exactJoin(Table table, MatchPair[] columnsToMatch, MatchPair[] columnsToAdd)
      Description copied from interface: Table
      Identical to naturalJoin, but fail if the right side does not produce a match.
    • lastBy

      public Table lastBy(SelectColumn... selectColumns)
      Description copied from interface: Table
      Groups the data column according to groupByColumns and retrieves the last for the rest of the fields
      Parameters:
      selectColumns - The grouping columns Table.by(String...)
    • firstBy

      public Table firstBy(SelectColumn... selectColumns)
      Description copied from interface: Table
      Groups the data column according to groupByColumns and retrieves the first for the rest of the fields
      Parameters:
      selectColumns - The grouping columns Table.by(String...)
    • minBy

      public Table minBy(SelectColumn... selectColumns)
      Description copied from interface: Table
      Groups the data column according to groupByColumns and computes the min for the rest of the fields
      Parameters:
      selectColumns - The grouping columns Table.by(String...)
    • maxBy

      public Table maxBy(SelectColumn... selectColumns)
      Description copied from interface: Table
      Groups the data column according to groupByColumns and computes the max for the rest of the fields
      Parameters:
      selectColumns - The grouping columns Table.by(String...) }
    • medianBy

      public Table medianBy(SelectColumn... selectColumns)
      Description copied from interface: Table
      Groups the data column according to groupByColumns and computes the median for the rest of the fields
      Parameters:
      selectColumns - The grouping columns Table.by(String...) }
    • countBy

      public Table countBy(String countColumnName, SelectColumn... groupByColumns)
    • by

      public Table by(AggregationStateFactory inputAggregationStateFactory, SelectColumn... groupByColumns)
    • headBy

      public Table headBy(long nRows, String... groupByColumns)
    • tailBy

      public Table tailBy(long nRows, String... groupByColumns)
    • applyToAllBy

      public Table applyToAllBy(String formulaColumn, String columnParamName, SelectColumn... groupByColumns)
      Description copied from interface: Table
      Groups data according to groupByColumns and applies formulaColumn to each of columns not altered by the grouping operation. columnParamName is used as place-holder for the name of each column inside formulaColumn.
      Parameters:
      formulaColumn - Formula applied to each column
      columnParamName - The parameter name used as a placeholder for each column
      groupByColumns - The grouping columns Table.by(SelectColumn[])
    • sumBy

      public Table sumBy(SelectColumn... groupByColumns)
      Description copied from interface: Table
      Groups the data column according to groupByColumns and computes the sum for the rest of the fields
      Parameters:
      groupByColumns - The grouping columns Table.by(String...)
    • absSumBy

      public Table absSumBy(SelectColumn... groupByColumns)
      Description copied from interface: Table
      Groups the data column according to groupByColumns and computes the sum of the absolute values for the rest of the fields
      Parameters:
      groupByColumns - The grouping columns Table.by(String...)
    • avgBy

      public Table avgBy(SelectColumn... groupByColumns)
      Description copied from interface: Table
      Groups the data column according to groupByColumns and computes the average for the rest of the fields
      Parameters:
      groupByColumns - The grouping columns Table.by(String...)
    • wavgBy

      public Table wavgBy(String weightColumn, SelectColumn... groupByColumns)
      Description copied from interface: Table
      Groups the data column according to groupByColumns and computes the weighted average using weightColumn for the rest of the fields
      Parameters:
      weightColumn - the column to use for the weight
      groupByColumns - The grouping columns Table.by(String...)
    • wsumBy

      public Table wsumBy(String weightColumn, SelectColumn... groupByColumns)
      Description copied from interface: Table
      Groups the data column according to groupByColumns and computes the weighted sum using weightColumn for the rest of the fields If the weight column is a floating point type, all result columns will be doubles. If the weight column is an integral type, all integral input columns will have long results and all floating point input columns will have double results.
      Parameters:
      weightColumn - the column to use for the weight
      groupByColumns - The grouping columns Table.by(String...)
    • stdBy

      public Table stdBy(SelectColumn... groupByColumns)
    • varBy

      public Table varBy(SelectColumn... groupByColumns)
      Description copied from interface: Table
      Groups the data column according to groupByColumns and computes the variance for the rest of the fields
      Parameters:
      groupByColumns - The grouping columns Table.by(String...)
    • where

      public Table where(SelectFilter... filters)
    • whereIn

      public Table whereIn(Table rightTable, boolean inclusion, MatchPair... columnsToMatch)
      Description copied from interface: Table
      Filters this table based on the set of values in the rightTable. Note that when the right table ticks, all of the rows in the left table are going to be re-evaluated, thus the intention is that the right table is fairly slow moving compared with the left table.
      Parameters:
      rightTable - the filtering table.
      inclusion - whether things included in rightTable should be passed through (they are exluded if false)
      columnsToMatch - the columns to match between the two tables
      Returns:
      a new table filtered on right table
    • flatten

      public Table flatten()
      Description copied from interface: Table
      Creates a version of this table with a flat index (V2 only).
    • setFlat

      protected void setFlat()
    • isFlat

      public boolean isFlat()
      Description copied from interface: Table
      Return true if this table is guaranteed to be flat. The index of a flat table will be from 0...numRows-1.
    • releaseCachedResources

      public void releaseCachedResources()
      Description copied from interface: Table
      Attempt to release cached resources held by this table. Unlike Table.close(), this must not render the table unusable for subsequent read operations. Implementations should be sure to call super.releaseCachedResources().
    • select

      public Table select(SelectColumn... selectColumns)
    • update

      public Table update(SelectColumn... selectColumns)
    • validateSelect

      public SelectValidationResult validateSelect(SelectColumn... selectColumns)
      This does a certain amount of validation and can be used to get confidence that the formulas are valid. If it is not valid, you will get an exception. Positive test (should pass validation): "X = 12", "Y = X + 1") Negative test (should fail validation): "X = 12", "Y = Z + 1")
    • view

      public Table view(SelectColumn... viewColumns)
    • updateView

      public Table updateView(SelectColumn... viewColumns)
    • lazyUpdate

      public Table lazyUpdate(SelectColumn... selectColumns)
      Description copied from interface: Table
      Compute column formulas on demand.

      Lazy update defers computation until required for a set of values, and caches the results for a set of input values. This uses less RAM than an update statement when you have a smaller set of unique values. Less computation than an updateView is needed, because the results are saved in a cache.

      If you have many unique values, you should instead use an update statement, which will have more memory efficient structures. Values are never removed from the lazyUpdate cache, so it should be used judiciously on a ticking table.

      Parameters:
      selectColumns - the columns to add
      Returns:
      a new Table with the columns added; to be computed on demand
    • dropColumns

      public Table dropColumns(String... columnNames)
    • renameColumns

      public Table renameColumns(MatchPair... pairs)
    • aj

      public Table aj(Table rightTable, MatchPair[] columnsToMatch, MatchPair[] columnsToAdd, Table.AsOfMatchRule asOfMatchRule)
      Description copied from interface: Table
      Looks up the columns in the rightTable that meet the match conditions in the columnsToMatch list. Matching is done exactly for the first n-1 columns and via a binary search for the last match pair. The columns of the original table are returned intact, together with the columns from rightTable defined in a comma separated list "columnsToAdd"
      Parameters:
      rightTable - The right side table on the join.
      columnsToMatch - A comma separated list of match conditions ("leftColumn=rightColumn" or "columnFoundInBoth")
      columnsToAdd - A comma separated list with the columns from the left side that need to be added to the right side as a result of the match.
      Returns:
      a new table joined according to the specification in columnsToMatch and columnsToAdd
    • raj

      public Table raj(Table rightTable, MatchPair[] columnsToMatch, MatchPair[] columnsToAdd, Table.AsOfMatchRule asOfMatchRule)
      Description copied from interface: Table
      Just like .aj(), but the matching on the last column is in reverse order, so that you find the row after the given timestamp instead of the row before.

      Looks up the columns in the rightTable that meet the match conditions in the columnsToMatch list. Matching is done exactly for the first n-1 columns and via a binary search for the last match pair. The columns of the original table are returned intact, together with the columns from rightTable defined in a comma separated list "columnsToAdd"

      Parameters:
      rightTable - The right side table on the join.
      columnsToMatch - A comma separated list of match conditions ("leftColumn=rightColumn" or "columnFoundInBoth")
      columnsToAdd - A comma separated list with the columns from the left side that need to be added to the right side as a result of the match.
      Returns:
      a new table joined according to the specification in columnsToMatch and columnsToAdd
    • naturalJoin

      public Table naturalJoin(Table rightTable, MatchPair[] columnsToMatch, MatchPair[] columnsToAdd)
      Description copied from interface: Table
      Augment this table with zero or one row from the right table.

      The result is somewhat like an Excel vlookup or SQL leftJoin.

      • The leftTable always retains the same number of rows and the same columns with which it started.
      • If there are no matching values for a row, the appended cell(s) from the rightTable will contain NULL values.
      • The right side table can only have one row for each key of the join. If duplicate rows exist on the right side, then the operation's initialization or update results in an error.

      When columnsToMatch is empty, then no join keys are used. If there is a row in the right table, it is joined to all rows of the left table. If there are no rows in the right table, then the right columns are null. If there are multiple rows in the right table then there is an error.

      Parameters:
      rightTable - The right side table on the join.
      columnsToMatch - An array of match pair conditions ("leftColumn=rightColumn" or "columnFoundInBoth")
      columnsToAdd - An array of the columns from the right side be added to the left side as a result of the match. If empty, then all columns from the right table are added to the result.
      Returns:
      a new table joined according to the specification in columnsToMatch and columnsToAdd
    • join

      public Table join(Table rightTableCandidate, MatchPair[] columnsToMatch, MatchPair[] columnsToAdd, int numRightBitsToReserve)
      Description copied from interface: Table
      Perform a cross join with the right table.

      Returns a table that is the cartesian product of left rows X right rows, with one column for each of the left table's columns, and one column corresponding to each of the right table's columns that are included in the columnsToAdd argument. The rows are ordered first by the left table then by the right table. If columnsToMatch is non-empty then the product is filtered by the supplied match conditions.

      To efficiently produce updates, the bits that represent a key for a given row are split into two. Unless specified, join reserves 16 bits to represent a right row. When there are too few bits to represent all of the right rows for a given aggregation group the table will shift a bit from the left side to the right side. The default of 16 bits was carefully chosen because it results in an efficient implementation to process live updates.

      An OutOfKeySpaceException is thrown when the total number of bits needed to express the result table exceeds that needed to represent Long.MAX_VALUE. There are a few work arounds: - If the left table is sparse, consider flattening the left table. - If there are no key-columns and the right table is sparse, consider flattening the right table. - If the maximum size of a right table's group is small, you can reserve fewer bits by setting numRightBitsToReserve on initialization.

      Note: If you can prove that a given group has at most one right-row then you should prefer using Table.naturalJoin(com.illumon.iris.db.tables.Table, com.illumon.iris.db.tables.select.MatchPair[], com.illumon.iris.db.tables.select.MatchPair[]).

      Parameters:
      rightTableCandidate - The right side table on the join.
      columnsToMatch - An array of match pair conditions ("leftColumn=rightColumn" or "columnFoundInBoth")
      columnsToAdd - An array of the columns from the right side that need to be added to the left side as a result of the match.
      numRightBitsToReserve - The number of bits to reserve for rightTable groups.
      Returns:
      a new table joined according to the specification in columnsToMatch and columnsToAdd
    • snapshotHistory

      public Table snapshotHistory(Table rightTable)
    • silent

      public Table silent()
      Description copied from interface: DynamicTable

      Return an identical table that suppresses all downstream notifications

      WARNING: Use this feature responsibly. Even though updates are suppressed, that does not imply that the underlying column sources are necessarily static, and so reading data from the table may not be consistent. A safer approach is to use Table.snapshot(Table, String...) or Table.snapshotIncremental(Table, String...)

      Returns:
      a new Table that does not propagate updates downstream.
    • snapshot

      public Table snapshot(Table rightTable, boolean doInitialSnapshot, String... stampColumns)
      Description copied from interface: Table
      Snapshot "rightTable", triggered by "this" Table, and return a new Table as a result. "this" Table is the triggering table, i.e. the table whose change events cause a new snapshot to be taken. The result table includes a "snapshot key" which is a subset (possibly all) of this Table's columns. The remaining columns in the result table come from "rightTable", the table being snapshotted.
      Parameters:
      rightTable - The table to be snapshotted
      doInitialSnapshot - Take the first snapshot now (otherwise wait for a change event)
      stampColumns - The columns forming the "snapshot key", i.e. some subset of this Table's columns to be included in the result at snapshot time. As a special case, an empty stampColumns is taken to mean "include all columns".
      Returns:
      The result table
    • snapshotIncremental

      public Table snapshotIncremental(Table tableToSnapshotRaw, boolean doInitialSnapshot, String... stampColumns)
    • sort

      public Table sort(SortPair... sortPairs)
    • reverse

      public Table reverse()
      The reverse operation returns a new table that is the same as the original table, but the first row is last, and the last row is first. This is an internal API to be used by .raj(), but is accessible for unit tests.
      Returns:
      the reversed table
    • ungroup

      public Table ungroup(boolean nullFill, String... columnsToUngroupBy)
      Description copied from interface: Table
      Ungroups a table by converting arrays into columns.
      Parameters:
      nullFill - indicates if the ungrouped table should allow disparate sized arrays filling shorter columns with null values. If set to false, then all arrays should be the same length.
      columnsToUngroupBy - the columns to ungroup
      Returns:
      the ungrouped table
    • selectDistinct

      public Table selectDistinct(SelectColumn... columns)
    • getSubTable

      public QueryTable getSubTable(Index index)
    • getSubTable

      public QueryTable getSubTable(@NotNull Index index, @Nullable ModifiedColumnSet resultModifiedColumnSet, @Nullable Map<String,Object> attributes, @NotNull Object... parents)
      Get a table using the same column sources and definition as this table. This table will not tick on it's own, you must also establish an appropriate listener to update its index and propagate modifications. This function is intended to be used for composing alternative engine operations, in particular Table.byExternal(String...). No nugget is opened for this table, to prevent operations that call this repeatedly from having an inordinate performance penalty. If you require a nugget, you must create it in the enclosing operation.
      Parameters:
      index - the initial index
      resultModifiedColumnSet - the result modified column set
      parents - the parent references for the result table
      Returns:
      a new table with the desired index
    • copy

      public Table copy()
      Copies this table, but with a new set of attributes.
      Overrides:
      copy in class BaseTable
      Returns:
      an identical table; but with a new set of attributes
    • copy

      public Table copy(boolean copyAttributes)
    • updateBy

      public Table updateBy(@NotNull UpdateByControl control, @NotNull Collection<UpdateByClause> ops, @NotNull MatchPair... byColumns)
      Description copied from interface: Table

      Create a table with the same index as it's parent that will perform the specified set of row based operations to it. As opposed to Table.update(String...) these operations are more restricted but are capable of processing state between rows. This operation will group the table by the specified set of keys if provided before applying the operation.

      ops - the operations to apply to the table.
      byColumns - the columns to group by before applying.
      Returns:
      a table with the same index, with the specified operations applied to each group defined by the byColumns
    • setMemoizeResults

      @VisibleForTesting public static boolean setMemoizeResults(boolean memoizeResults)
      For unit tests, provide a method to turn memoization on or off.
      Parameters:
      memoizeResults - should results be memoized?
      Returns:
      the prior value
    • memoizeResult

      public <R> R memoizeResult(MemoizedOperationKey memoKey, Supplier<R> operation)
      Saves a weak reference to the result of the given operation.
      Parameters:
      memoKey - a complete description of the operation, if null no memoization is performed
      operation - a supplier for the result
      Returns:
      either the cached or newly generated result
    • apply

      public <R> R apply(com.fishlib.base.Function.Unary<R,Table> function)
      Description copied from interface: Table
      Applies a function to this table.

      This is useful if you have a reference to a table, or a proxy; but not the database and want to run a series of operations against the table without each individual operation resulting in an RMI.

      Type Parameters:
      R - the return type of function
      Parameters:
      function - the function to run, its single argument will be this table
      Returns:
      the return value of function
    • wouldMatch

      public Table wouldMatch(WouldMatchPair... matchers)
      Description copied from interface: Table
      A table operation that applies the supplied predicate to each row in the table and produces columns containing the pass/fail result of the predicate application. This is similar to Table.where(String...) except that instead of selecting only rows that meet the criteria, new columns are added with the result of the comparison.
      Returns:
      a table with new columns containing the filter result for each row.
    • disableParallelWhereForThread

      public static SafeCloseable disableParallelWhereForThread()
    • disableWriteReplace

      public static SafeCloseable disableWriteReplace()
    • enableWriteReplace

      @TestUseOnly public static SafeCloseable enableWriteReplace()