Class SubscriptionSnapshotTable
- All Implemented Interfaces:
com.fishlib.base.log.LogOutputAppendable
,NotificationQueue.Dependency
,Deflatable<Table>
,Table
,LivenessManager
,LivenessNode
,LivenessReferent
,LongSizedDataStructure
,DynamicNode
,DynamicTable
,NotificationStepReceiver
,NotificationStepSource
,SubscribableTable
,SystemicObject
,Serializable
public class SubscriptionSnapshotTable extends BaseTable implements SubscribableTable
- See Also:
- Serialized Form
-
Nested Class Summary
Nested classes/interfaces inherited from class com.illumon.iris.db.v2.BaseTable
BaseTable.CopyAttributeOperation, BaseTable.ListenerImpl, BaseTable.ShiftAwareListenerImpl, BaseTable.SwapListenerFactory<T extends SwapListenerBase>
Nested classes/interfaces inherited from interface com.illumon.iris.db.tables.Table
Table.AsOfMatchRule, Table.GroupStrategy, Table.RenameFunction
-
Field Summary
Fields inherited from class com.illumon.iris.db.v2.BaseTable
attributes, definition, description, PRINT_SERIALIZED_UPDATE_OVERLAPS, sharedAttributes
Fields inherited from interface com.illumon.iris.db.v2.NotificationStepReceiver
NULL_NOTIFICATION_STEP
Fields inherited from interface com.illumon.iris.db.tables.Table
ACL_ATTRIBUTE, ADD_ONLY_TABLE_ATTRIBUTE, COLUMN_DESCRIPTIONS_ATTRIBUTE, COLUMN_RENDERERS_ATTRIBUTE, CUSTOM_ACTIONS_ATTRIBUTE, DO_NOT_MAKE_REMOTE_ATTRIBUTE, EMPTY_SOURCE_TABLE_ATTRIBUTE, FILTERABLE_COLUMNS_ATTRIBUTE, HIERARCHICAL_CHILDREN_TABLE_MAP_ATTRIBUTE, HIERARCHICAL_SOURCE_INFO_ATTRIBUTE, HIERARCHICAL_SOURCE_TABLE_ATTRIBUTE, INPUT_TABLE_ATTRIBUTE, KEY_COLUMNS_ATTRIBUTE, LAYOUT_HINTS_ATTRIBUTE, MERGED_TABLE_ATTRIBUTE, NON_DISPLAY_TABLE, PLUGIN_NAME, PREDEFINED_ROLLUP_ATTRIBUTE, PREEMPTIVE_VIEWPORT_TYPE, PREPARED_RLL_ATTRIBUTE, PREVIEW_PARENT_TABLE, REVERSE_LOOKUP_ATTRIBUTE, ROLLUP_LEAF_ATTRIBUTE, SNAPSHOT_VIEWPORT_TYPE, SORTABLE_COLUMNS_ATTRIBUTE, SORTED_COLUMNS_ATTRIBUTE, SYSTEMIC_TABLE_ATTRIBUTE, TABLE_DESCRIPTION_ATTRIBUTE, TOTALS_TABLE_ATTRIBUTE, TREE_TABLE_FILTER_REVERSE_LOOKUP_ATTRIBUTE, UNIQUE_KEYS_ATTRIBUTE, UNTRACKED_LASTBY_TABLE_ATTRIBUTE, VIEWPORT_TYPE_ATTRIBUTE, ZERO_LENGTH_TABLE_ARRAY
-
Constructor Summary
Constructors Constructor Description SubscriptionSnapshotTable(com.fishlib.io.logger.Logger log, BaseTable originalTable, long updateInterval)
-
Method Summary
Modifier and Type Method Description Table
absSumBy(SelectColumn... groupByColumns)
Groups the data column according togroupByColumns
and computes the sum of the absolute values for the rest of the fieldsboolean
addSubscription(com.fishlib.net.api.CommandSender client, int handleId, BitSet columnsToSubscribe, boolean isViewport)
Add a subscription to this table.Table
aj(Table rightTable, MatchPair[] columnsToMatch, MatchPair[] columnsToAdd, Table.AsOfMatchRule asOfMatchRule)
Looks up the columns in the rightTable that meet the match conditions in the columnsToMatch list.Table
applyToAllBy(String formulaColumn, String columnParamName, SelectColumn... groupByColumns)
Groups data according to groupByColumns and applies formulaColumn to each of columns not altered by the grouping operation.Table
avgBy(SelectColumn... groupByColumns)
Groups the data column according togroupByColumns
and computes the average for the rest of the fieldsTable
by(AggregationStateFactory aggregationStateFactory, SelectColumn... groupByColumns)
TableMap
byExternal(boolean dropKeys, String... keyColumnNames)
Create aTableMap
from this table, keyed by the specified columns.Table
countBy(String countColumnName, SelectColumn... groupByColumns)
Table
dropColumns(String... columnNames)
void
dropReference()
Drop a previously-retained reference to this referent.Table
exactJoin(Table rightTable, MatchPair[] columnsToMatch, MatchPair[] columnsToAdd)
Identical to naturalJoin, but fail if the right side does not produce a match.Table
firstBy(SelectColumn... groupByColumns)
Groups the data column according togroupByColumns
and retrieves the first for the rest of the fieldsTable
flatten()
Creates a version of this table with a flat index (V2 only).DataColumn
getColumn(String columnName)
ColumnSource
getColumnSource(String sourceName)
Map<String,? extends ColumnSource>
getColumnSourceMap()
Collection<? extends ColumnSource>
getColumnSources()
Index
getIndex()
Object[]
getRecord(long rowNo, String... columnNames)
Table
getSubTable(Index index)
WeakReference<? extends LivenessReferent>
getWeakReference()
Get aWeakReference
to this referent.Table
head(long size)
Table
headBy(long nRows, String... groupByColumns)
Table
headPct(double percent)
Provides a head that selects a dynamic number of rows based on a percent.void
initializeTransientFieldsForLiveness()
Package-private forSerializable
sub-classes to use inreadObject
only.boolean
isFlat()
Return true if this table is guaranteed to be flat.boolean
isSnapshot()
True if this table is a snapshot table (as opposed to a preemptive updates table); used byRemoteQueryProcessor
to set the isSnapshot flag onExportedTableCreationMessage
messages, so that a client knows if it has an appropriate type of table for its viewport.Table
join(Table rightTable, MatchPair[] columnsToMatch, MatchPair[] columnsToAdd, int numRightBitsToReserve)
Perform a cross join with the right table.Table
lastBy(SelectColumn... groupByColumns)
Groups the data column according togroupByColumns
and retrieves the last for the rest of the fieldsTable
lazyUpdate(SelectColumn... columns)
Compute column formulas on demand.Table
leftJoin(Table rightTable, MatchPair[] columnsToMatch, MatchPair[] columnsToAdd)
Augments this table with array columns of right-hand side matches.void
markSystemic()
Mark this object as systemically important.Table
maxBy(SelectColumn... groupByColumns)
Groups the data column according togroupByColumns
and computes the max for the rest of the fieldsTable
medianBy(SelectColumn... groupByColumns)
Groups the data column according togroupByColumns
and computes the median for the rest of the fieldsTable
minBy(SelectColumn... groupByColumns)
Groups the data column according togroupByColumns
and computes the min for the rest of the fieldsTable
naturalJoin(Table rightTable, MatchPair[] columnsToMatch, MatchPair[] columnsToAdd)
Augment this table with zero or one row from the right table.protected void
onReferenceCountAtZero()
Callback method that will be invoked when the reference count returns to zero.Table
preemptiveSnapshotTable(long updateInterval)
Table
preemptiveUpdatesTable(long updateInterval)
Table
raj(Table rightTable, MatchPair[] columnsToMatch, MatchPair[] columnsToAdd, Table.AsOfMatchRule asOfMatchRule)
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.boolean
removeSubscription(com.fishlib.net.api.CommandSender client, int subscriptionId)
Remove a subscription.Table
renameColumns(MatchPair... pairs)
Table
reverse()
HierarchicalTable
rollup(ComboAggregateFactory comboAggregateFactory, boolean includeConstituents, SelectColumn... columns)
Table
select(SelectColumn... columns)
Table
selectDistinct(SelectColumn... columns)
void
setAttribute(String key, Object object)
Set the value of an attribute.Table
silent()
Return an identical table that suppresses all downstream notificationslong
size()
The size of this data structure.Table
slice(long firstPositionInclusive, long lastPositionExclusive)
Extracts a subset of a table by row position.Table
snapshot(Table rightTable, boolean doInitialSnapshot, String... stampColumns)
Snapshot "rightTable", triggered by "this" Table, and return a new Table as a result.Table
snapshotHistory(Table rightTable)
Table
snapshotIncremental(Table rightTable, boolean doInitialSnapshot, String... stampColumns)
Table
sort(SortPair... columnsToSortBy)
Table
stdBy(SelectColumn... groupByColumns)
Table
sumBy(SelectColumn... groupByColumns)
Groups the data column according togroupByColumns
and computes the sum for the rest of the fieldsTable
tail(long size)
Table
tailBy(long nRows, String... groupByColumns)
Table
tailPct(double percent)
HierarchicalTable
treeTable(String idColumn, String parentColumn)
Create a hierarchical tree table.boolean
tryManage(LivenessReferent referent)
Attempt to add the specified referent to this manager.boolean
tryRetainReference()
If this referent is "live", behave asLivenessReferent.retainReference()
and return true.Table
ungroup(boolean nullFill, String... columnsToUngroup)
Ungroups a table by converting arrays into columns.Table
update(SelectColumn... columns)
Table
updateBy(UpdateByControl control, Collection<UpdateByClause> operations, MatchPair... byColumns)
Create a table with the sameindex
as it's parent that will perform the specified set of row based operations to it.boolean
updateSubscription(com.fishlib.net.api.CommandSender client, int subscriptionId, BitSet newSubscribedColumns)
Update the subscription's columns.Table
updateView(SelectColumn... columns)
boolean
updateViewport(com.fishlib.net.api.CommandSender client, int subscriptionId, Index newViewPort)
Update the subscription's viewport (rows).boolean
updateViewportAndColumns(com.fishlib.net.api.CommandSender client, int subscriptionId, Index newViewPort, BitSet columnsToSubscribe)
Update the subscription's columns and viewport (rows).SelectValidationResult
validateSelect(SelectColumn... columns)
DO NOT USE -- this API is in flux and may change or disappear in the future.Table
varBy(SelectColumn... groupByColumns)
Groups the data column according togroupByColumns
and computes the variance for the rest of the fieldsTable
view(SelectColumn... columns)
Table
wavgBy(String weightColumn, SelectColumn... groupByColumns)
Groups the data column according togroupByColumns
and computes the weighted average using weightColumn for the rest of the fieldsTable
where(SelectFilter... filters)
Table
whereIn(Table rightTable, boolean inclusion, MatchPair... columnsToMatch)
Filters this table based on the set of values in the rightTable.Table
wouldMatch(WouldMatchPair... matchers)
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.Table
wsumBy(String weightColumn, SelectColumn... groupByColumns)
Groups the data column according togroupByColumns
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.Methods inherited from class com.illumon.iris.db.v2.BaseTable
addParentReference, append, awaitUpdate, awaitUpdate, clearSortingRestrictions, copy, copyAttributes, copyAttributes, createSwapListenerIfRefreshing, destroy, getAttribute, getAttributeNames, getAttributes, getDefinition, getDescription, getLastNotificationStep, getNotificationQueue, hasAttribute, initializeWithSnapshot, isAddOnly, isAddOnly, isFailed, isRefreshing, isSystemicObject, layoutHints, listenForDirectUpdates, listenForUpdates, listenForUpdates, notifyListeners, notifyListenersOnError, removeDirectUpdateListener, removeUpdateListener, removeUpdateListener, restrictSortTo, satisfied, setColumnRenderers, setLastNotificationStep, setRefreshing, setTotalsTable, shouldCopyAttribute, toString, withColumnDescription, withKeys, withTableDescription, withUniqueKeys
Methods inherited from class com.illumon.iris.db.util.liveness.LivenessArtifact
manageWithCurrentScope, unmanage, unmanage
Methods inherited from class com.illumon.util.referencecounting.ReferenceCounted
decrementReferenceCount, incrementReferenceCount, resetReferenceCount, tryDecrementReferenceCount, tryIncrementReferenceCount
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.illumon.iris.db.v2.DynamicTable
listenForUpdates, newModifiedColumnSet, newModifiedColumnSetIdentityTransformer, newModifiedColumnSetIdentityTransformer, newModifiedColumnSetTransformer, newModifiedColumnSetTransformer, newModifiedColumnSetTransformer, notifyListeners
Methods inherited from interface com.illumon.iris.db.util.liveness.LivenessManager
manage, tryManage
Methods inherited from interface com.illumon.iris.db.util.liveness.LivenessReferent
dropReference, getReferentDescription, getWeakReference, retainReference, tryRetainReference
Methods inherited from interface com.illumon.iris.db.tables.Table
absSumBy, absSumBy, absSumBy, aj, aj, aj, aj, aj, apply, applyToAllBy, applyToAllBy, applyToAllBy, avgBy, avgBy, avgBy, by, by, by, by, by, by, byExternal, byteColumnIterator, characterColumnIterator, close, coalesce, columnIterator, countBy, countBy, countBy, dateTimeColumnAsNanos, dateTimeColumnAsNanos, deflate, deflate, doubleColumnIterator, dropColumnFormats, dropColumns, exactJoin, exactJoin, exactJoin, exactJoin, firstBy, firstBy, firstBy, floatColumnIterator, formatColumns, formatColumnWhere, formatRowWhere, getAttributes, getColumn, getColumns, getColumnSource, getMeta, getViewPort, hasColumns, hasColumns, headBy, headBy, integerColumnIterator, isEmpty, isLive, join, join, join, join, join, join, join, join, join, lastBy, lastBy, lastBy, layoutHints, lazyUpdate, lazyUpdate, leftJoin, leftJoin, leftJoin, leftJoin, leftJoin, longColumnIterator, maxBy, maxBy, maxBy, medianBy, medianBy, medianBy, minBy, minBy, minBy, moveColumns, moveColumns, moveDownColumns, moveUpColumns, naturalJoin, naturalJoin, naturalJoin, naturalJoin, preemptiveSnapshotTable, raj, raj, raj, raj, raj, releaseCachedResources, renameAllColumns, renameColumns, renameColumns, rollup, rollup, rollup, rollup, rollup, rollup, rollup, select, select, select, selectDistinct, selectDistinct, selectDistinct, shortColumnIterator, sizeForInstrumentation, snapshot, snapshotIncremental, sort, sort, sortDescending, sortDescending, stdBy, stdBy, stdBy, subscribeToPreemptiveUpdates, sumBy, sumBy, sumBy, supportsPreemptiveSubscription, tailBy, tailBy, ungroup, ungroup, ungroup, ungroupAllBut, update, update, updateBy, updateBy, updateBy, updateBy, updateBy, updateView, updateView, validateSelect, varBy, varBy, varBy, view, view, wavgBy, wavgBy, wavgBy, where, where, where, whereIn, whereIn, whereIn, whereNotIn, whereNotIn, whereOneOf, whereOneOf, whereOneOf, withColumnDescription, wouldMatch, wsumBy, wsumBy, wsumBy
-
Constructor Details
-
SubscriptionSnapshotTable
public SubscriptionSnapshotTable(com.fishlib.io.logger.Logger log, BaseTable originalTable, long updateInterval)
-
-
Method Details
-
markSystemic
public void markSystemic()Description copied from interface:SystemicObject
Mark this object as systemically important.- Specified by:
markSystemic
in interfaceSystemicObject
- Overrides:
markSystemic
in classBaseTable
-
size
public long size()Description copied from interface:LongSizedDataStructure
The size of this data structure.- Specified by:
size
in interfaceLongSizedDataStructure
- Returns:
- The size
-
getIndex
-
getColumnSource
- Specified by:
getColumnSource
in interfaceTable
-
getColumnSourceMap
- Specified by:
getColumnSourceMap
in interfaceTable
-
getColumnSources
- Specified by:
getColumnSources
in interfaceTable
-
getColumn
-
getRecord
-
where
-
whereIn
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. -
getSubTable
- Specified by:
getSubTable
in interfaceTable
-
select
-
selectDistinct
- Specified by:
selectDistinct
in interfaceTable
-
update
-
lazyUpdate
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.
- Specified by:
lazyUpdate
in interfaceTable
- Parameters:
columns
- the columns to add- Returns:
- a new Table with the columns added; to be computed on demand
-
view
-
updateView
- Specified by:
updateView
in interfaceTable
-
validateSelect
Description copied from interface:Table
DO NOT USE -- this API is in flux and may change or disappear in the future.- Specified by:
validateSelect
in interfaceTable
-
dropColumns
- Specified by:
dropColumns
in interfaceTable
-
renameColumns
- Specified by:
renameColumns
in interfaceTable
-
slice
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. TheTable.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 toTable.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. -
head
-
tail
-
headPct
Description copied from interface:Table
Provides a head that selects a dynamic number of rows based on a percent. -
tailPct
-
leftJoin
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.
- Specified by:
leftJoin
in interfaceTable
- 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
-
exactJoin
Description copied from interface:Table
Identical to naturalJoin, but fail if the right side does not produce a match. -
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"- Specified by:
aj
in interfaceTable
- 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"
- Specified by:
raj
in interfaceTable
- 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
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.
- Specified by:
naturalJoin
in interfaceTable
- 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 rightTable, 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[])
.- Specified by:
join
in interfaceTable
- 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 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
-
by
-
headBy
-
tailBy
-
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 insideformulaColumn
.- Specified by:
applyToAllBy
in interfaceTable
- Parameters:
formulaColumn
- Formula applied to each columncolumnParamName
- The parameter name used as a placeholder for each columngroupByColumns
- The grouping columnsTable.by(SelectColumn[])
-
sumBy
Description copied from interface:Table
Groups the data column according togroupByColumns
and computes the sum for the rest of the fields- Specified by:
sumBy
in interfaceTable
- Parameters:
groupByColumns
- The grouping columnsTable.by(String...)
-
absSumBy
Description copied from interface:Table
Groups the data column according togroupByColumns
and computes the sum of the absolute values for the rest of the fields- Specified by:
absSumBy
in interfaceTable
- Parameters:
groupByColumns
- The grouping columnsTable.by(String...)
-
avgBy
Description copied from interface:Table
Groups the data column according togroupByColumns
and computes the average for the rest of the fields- Specified by:
avgBy
in interfaceTable
- Parameters:
groupByColumns
- The grouping columnsTable.by(String...)
-
wavgBy
Description copied from interface:Table
Groups the data column according togroupByColumns
and computes the weighted average using weightColumn for the rest of the fields- Specified by:
wavgBy
in interfaceTable
- Parameters:
weightColumn
- the column to use for the weightgroupByColumns
- The grouping columnsTable.by(String...)
-
wsumBy
Description copied from interface:Table
Groups the data column according togroupByColumns
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.- Specified by:
wsumBy
in interfaceTable
- Parameters:
weightColumn
- the column to use for the weightgroupByColumns
- The grouping columnsTable.by(String...)
-
stdBy
-
varBy
Description copied from interface:Table
Groups the data column according togroupByColumns
and computes the variance for the rest of the fields- Specified by:
varBy
in interfaceTable
- Parameters:
groupByColumns
- The grouping columnsTable.by(String...)
-
lastBy
Description copied from interface:Table
Groups the data column according togroupByColumns
and retrieves the last for the rest of the fields- Specified by:
lastBy
in interfaceTable
- Parameters:
groupByColumns
- The grouping columnsTable.by(String...)
-
firstBy
Description copied from interface:Table
Groups the data column according togroupByColumns
and retrieves the first for the rest of the fields- Specified by:
firstBy
in interfaceTable
- Parameters:
groupByColumns
- The grouping columnsTable.by(String...)
-
minBy
Description copied from interface:Table
Groups the data column according togroupByColumns
and computes the min for the rest of the fields- Specified by:
minBy
in interfaceTable
- Parameters:
groupByColumns
- The grouping columnsTable.by(String...)
-
maxBy
Description copied from interface:Table
Groups the data column according togroupByColumns
and computes the max for the rest of the fields- Specified by:
maxBy
in interfaceTable
- Parameters:
groupByColumns
- The grouping columnsTable.by(String...)
}
-
medianBy
Description copied from interface:Table
Groups the data column according togroupByColumns
and computes the median for the rest of the fields- Specified by:
medianBy
in interfaceTable
- Parameters:
groupByColumns
- The grouping columnsTable.by(String...)
}
-
countBy
-
ungroup
Description copied from interface:Table
Ungroups a table by converting arrays into columns.- Specified by:
ungroup
in interfaceTable
- 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.columnsToUngroup
- the columns to ungroup- Returns:
- the ungrouped table
-
byExternal
Description copied from interface:Table
Create aTableMap
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 acom.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 intableMap.get(1)
.- Specified by:
byExternal
in interfaceTable
- Parameters:
dropKeys
- if true, drop key columns in the output TableskeyColumnNames
- 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
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.- Specified by:
treeTable
in interfaceTable
- Parameters:
idColumn
- the name of a column containing a unique identifier for a particular row in the tableparentColumn
- 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
-
sort
-
reverse
-
wouldMatch
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 toTable.where(String...)
except that instead of selecting only rows that meet the criteria, new columns are added with the result of the comparison.- Specified by:
wouldMatch
in interfaceTable
- Returns:
- a table with new columns containing the filter result for each row.
-
snapshot
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.- Specified by:
snapshot
in interfaceTable
- Parameters:
rightTable
- The table to be snapshotteddoInitialSnapshot
- 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 rightTable, boolean doInitialSnapshot, String... stampColumns)- Specified by:
snapshotIncremental
in interfaceTable
-
snapshotHistory
- Specified by:
snapshotHistory
in interfaceTable
-
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. -
flatten
Description copied from interface:Table
Creates a version of this table with a flat index (V2 only). -
preemptiveUpdatesTable
- Specified by:
preemptiveUpdatesTable
in interfaceTable
-
preemptiveSnapshotTable
- Specified by:
preemptiveSnapshotTable
in interfaceTable
-
updateBy
public Table updateBy(@NotNull UpdateByControl control, @NotNull Collection<UpdateByClause> operations, 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 toTable.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. -
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...)
orTable.snapshotIncremental(Table, String...)
- Specified by:
silent
in interfaceDynamicTable
- Returns:
- a new
Table
that does not propagate updates downstream.
-
addSubscription
public boolean addSubscription(com.fishlib.net.api.CommandSender client, int handleId, BitSet columnsToSubscribe, boolean isViewport)Description copied from interface:SubscribableTable
Add a subscription to this table.- Specified by:
addSubscription
in interfaceSubscribableTable
- Parameters:
client
- the client requesting the subscription, used to uniquely identify he handleId and send deltas, snapshots and responseshandleId
- the ID of our subscriptioncolumnsToSubscribe
- the bitset of columns to subscribe toisViewport
- true if the subscription is a viewport, false if it is a full subscription- Returns:
- true if the subscription was added
-
updateSubscription
public boolean updateSubscription(com.fishlib.net.api.CommandSender client, int subscriptionId, BitSet newSubscribedColumns)Description copied from interface:SubscribableTable
Update the subscription's columns.- Specified by:
updateSubscription
in interfaceSubscribableTable
- Parameters:
client
- the client requesting the subscription, used to send deltas, snapshots and responsessubscriptionId
- the ID of our subscriptionnewSubscribedColumns
- the bitset of columns to subscribe to- Returns:
- true if the subscription was found and updated
-
updateViewport
public boolean updateViewport(com.fishlib.net.api.CommandSender client, int subscriptionId, Index newViewPort)Description copied from interface:SubscribableTable
Update the subscription's viewport (rows).- Specified by:
updateViewport
in interfaceSubscribableTable
- Parameters:
client
- the client requesting the subscription, used to send deltas, snapshots and responsessubscriptionId
- the ID of our subscriptionnewViewPort
- the index representing which rows to subscribe to (in position space)- Returns:
- true if the subscription was found and updated
-
updateViewportAndColumns
public boolean updateViewportAndColumns(com.fishlib.net.api.CommandSender client, int subscriptionId, Index newViewPort, BitSet columnsToSubscribe)Description copied from interface:SubscribableTable
Update the subscription's columns and viewport (rows).- Specified by:
updateViewportAndColumns
in interfaceSubscribableTable
- Parameters:
client
- the client requesting the subscription, used to send deltas, snapshots and responsessubscriptionId
- the ID of our subscriptionnewViewPort
- the index representing which rows to subscribe to (in position space)columnsToSubscribe
- the bitset of columns to subscribe to- Returns:
- true if the subscription was found and updated
-
removeSubscription
public boolean removeSubscription(com.fishlib.net.api.CommandSender client, int subscriptionId)Description copied from interface:SubscribableTable
Remove a subscription.- Specified by:
removeSubscription
in interfaceSubscribableTable
- Parameters:
client
- the client requesting the subscription, used to send responsessubscriptionId
- the ID of our subscription- Returns:
- true if the subscription was found and updated
-
isSnapshot
public boolean isSnapshot()Description copied from interface:SubscribableTable
True if this table is a snapshot table (as opposed to a preemptive updates table); used byRemoteQueryProcessor
to set the isSnapshot flag onExportedTableCreationMessage
messages, so that a client knows if it has an appropriate type of table for its viewport.- Specified by:
isSnapshot
in interfaceSubscribableTable
- Returns:
- true if this is a subscription snapshot table.
-
setAttribute
Description copied from interface:Table
Set the value of an attribute.- Specified by:
setAttribute
in interfaceTable
- Overrides:
setAttribute
in classBaseTable
- Parameters:
key
- the name of the attributeobject
- the value
-
initializeTransientFieldsForLiveness
Package-private forSerializable
sub-classes to use inreadObject
only. Public to allow unit tests in another package to work around mock issues where the constructor is never invoked. -
tryRetainReference
public final boolean tryRetainReference()Description copied from interface:LivenessReferent
If this referent is "live", behave asLivenessReferent.retainReference()
and return true. Otherwise, returns false rather than throwing an exception.- Specified by:
tryRetainReference
in interfaceLivenessReferent
- Returns:
- True if this referent was retained, false otherwise
-
dropReference
public final void dropReference()Description copied from interface:LivenessReferent
Drop a previously-retained reference to this referent.- Specified by:
dropReference
in interfaceLivenessReferent
-
getWeakReference
Description copied from interface:LivenessReferent
Get aWeakReference
to this referent. This may be cached, or newly created.- Specified by:
getWeakReference
in interfaceLivenessReferent
- Returns:
- A new or cached reference to this referent
-
tryManage
Description copied from interface:LivenessManager
Attempt to add the specified referent to this manager.- Specified by:
tryManage
in interfaceLivenessManager
- Parameters:
referent
- The referent to add- Returns:
- Whether the referent was in fact added
-
onReferenceCountAtZero
protected final void onReferenceCountAtZero()Description copied from class:ReferenceCounted
Callback method that will be invoked when the reference count returns to zero.- Specified by:
onReferenceCountAtZero
in classReferenceCounted
-