Class HierarchicalTable
- All Implemented Interfaces:
com.fishlib.base.log.LogOutputAppendable,NotificationQueue.Dependency,Deflatable<Table>,Table,LivenessManager,LivenessNode,LivenessReferent,LongSizedDataStructure,DynamicNode,DynamicTable,NotificationStepReceiver,NotificationStepSource,SystemicObject,Serializable
Table which are not valid to perform
on Hierarchical tables (Table.treeTable(String, String) and Table.rollup(ComboAggregateFactory, String...)).- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.illumon.iris.db.v2.QueryTable
QueryTable.FilteredTable, QueryTable.MemoizableOperation, QueryTable.OperationNested 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.QueryTable
modifiedColumnSet, USE_CHUNKED_CROSS_JOIN, USE_UNTRACKED_LASTBY_FOR_AUTOMATED_FILTERSFields inherited from class com.illumon.iris.db.v2.BaseTable
attributes, definition, description, PRINT_SERIALIZED_UPDATE_OVERLAPS, sharedAttributesFields inherited from interface com.illumon.iris.db.v2.NotificationStepReceiver
NULL_NOTIFICATION_STEPFields 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 -
Method Summary
Modifier and TypeMethodDescriptionabsSumBy(SelectColumn... groupByColumns) Groups the data column according togroupByColumnsand computes the sum of the absolute values for the rest of the fieldsaj(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.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.avgBy(SelectColumn... groupByColumns) Groups the data column according togroupByColumnsand computes the average for the rest of the fieldsby(AggregationStateFactory aggregationStateFactory, SelectColumn... groupByColumns) byExternal(boolean dropKeys, String... keyColumnNames) Create aTableMapfrom this table, keyed by the specified columns.copy(boolean copyAttributes) countBy(String countColumnName, SelectColumn... groupByColumns) dropColumns(String... columnNames) Identical to naturalJoin, but fail if the right side does not produce a match.firstBy(SelectColumn... groupByColumns) Groups the data column according togroupByColumnsand retrieves the first for the rest of the fieldsflatten()Creates a version of this table with a flat index (V2 only).formatColumns(String... columnFormats) getInfo()Get theHierarchicalTableInfoassociated with this table.Get the table that is the root of the hierarchyGet the table on which this hierarchical table was created from.getSubTable(Index index) head(long size) headPct(double percent) Provides a head that selects a dynamic number of rows based on a percent.join(Table rightTable, MatchPair[] columnsToMatch, MatchPair[] columnsToAdd, int numRightBitsToReserve) Perform a cross join with the right table.lastBy(SelectColumn... groupByColumns) Groups the data column according togroupByColumnsand retrieves the last for the rest of the fieldslazyUpdate(SelectColumn... columns) Compute column formulas on demand.Augments this table with array columns of right-hand side matches.maxBy(SelectColumn[] selectColumns) Groups the data column according togroupByColumnsand computes the max for the rest of the fieldsmedianBy(SelectColumn[] selectColumns) Groups the data column according togroupByColumnsand computes the median for the rest of the fieldsminBy(SelectColumn[] selectColumns) Groups the data column according togroupByColumnsand computes the min for the rest of the fieldsnaturalJoin(Table rightTable, MatchPair[] columnsToMatch, MatchPair[] columnsToAdd) Augment this table with zero or one row from the right table.preemptiveSnapshotTable(long updateInterval) preemptiveUpdatesTable(long updateInterval) 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.renameColumns(MatchPair... pairs) 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.rollup(ComboAggregateFactory comboAggregateFactory, SelectColumn... columns) Create a rollup table.select(SelectColumn... selectColumns) selectDistinct(SelectColumn... columns) slice(long firstRowInclusive, long lastRowExclusive) Extracts a subset of a table by row position.Snapshot "rightTable", triggered by "this" Table, and return a new Table as a result.snapshotHistory(Table rightTable) snapshotIncremental(Table rightTable, boolean doInitialSnapshot, String... stampColumns) stdBy(SelectColumn... groupByColumns) sumBy(SelectColumn... groupByColumns) Groups the data column according togroupByColumnsand computes the sum for the rest of the fieldstail(long size) tailPct(double percent) Create a hierarchical tree table.Ungroups a table by converting arrays into columns.update(SelectColumn... columns) updateView(SelectColumn... columns) varBy(SelectColumn... groupByColumns) Groups the data column according togroupByColumnsand computes the variance for the rest of the fieldsview(SelectColumn... columns) wavgBy(String weightColumn, SelectColumn... groupByColumns) Groups the data column according togroupByColumnsand computes the weighted average using weightColumn for the rest of the fieldswhere(SelectFilter... filters) Filters this table based on the set of values in the rightTable.withFlatFilterColumns(String... columns) Create a shallow copy of this table that will apply filters to the specified columns at each level, instead of filtering the base table and re-treeing.Methods inherited from class com.illumon.iris.db.v2.QueryTable
apply, copy, disableParallelWhereForThread, disableWriteReplace, enableWriteReplace, getColumn, getColumnSource, getColumnSourceMap, getColumnSources, getDataIndex, getIndex, getModifiedColumnSetForUpdates, getRecord, getSubTable, isFlat, memoizeResult, newModifiedColumnSet, newModifiedColumnSetIdentityTransformer, newModifiedColumnSetIdentityTransformer, newModifiedColumnSetTransformer, preemptiveUpdatesTable, releaseCachedResources, rollup, setDataIndexProvider, setFlat, setMemoizeResults, silent, size, updateBy, validateSelect, wouldMatch, wsumByMethods inherited from class com.illumon.iris.db.v2.BaseTable
addParentReference, append, awaitUpdate, awaitUpdate, clearSortingRestrictions, copyAttributes, copyAttributes, createSwapListenerIfRefreshing, destroy, getAttribute, getAttributeNames, getAttributes, getDefinition, getDescription, getLastNotificationStep, getNotificationQueue, hasAttribute, initializeWithSnapshot, isAddOnly, isAddOnly, isFailed, isRefreshing, isSystemicObject, layoutHints, listenForDirectUpdates, listenForUpdates, listenForUpdates, markSystemic, notifyListeners, notifyListenersOnError, removeDirectUpdateListener, removeUpdateListener, removeUpdateListener, restrictSortTo, satisfied, setAttribute, setColumnRenderers, setLastNotificationStep, setRefreshing, setTotalsTable, shouldCopyAttribute, toString, withColumnDescription, withKeys, withTableDescription, withUniqueKeysMethods inherited from class com.illumon.iris.db.util.liveness.LivenessArtifact
manageWithCurrentScope, unmanage, unmanageMethods inherited from class com.illumon.iris.db.util.liveness.ReferenceCountedLivenessNode
dropReference, getWeakReference, initializeTransientFieldsForLiveness, onReferenceCountAtZero, tryManage, tryRetainReferenceMethods inherited from class com.illumon.util.referencecounting.ReferenceCounted
decrementReferenceCount, incrementReferenceCount, resetReferenceCount, tryDecrementReferenceCount, tryIncrementReferenceCountMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.illumon.iris.db.v2.DynamicTable
listenForUpdates, newModifiedColumnSetTransformer, newModifiedColumnSetTransformer, notifyListenersMethods inherited from interface com.illumon.iris.db.util.liveness.LivenessManager
manage, tryManageMethods inherited from interface com.illumon.iris.db.util.liveness.LivenessReferent
dropReference, getReferentDescription, getWeakReference, retainReference, tryRetainReferenceMethods inherited from interface com.illumon.iris.db.util.LongSizedDataStructure
intSize, intSizeMethods inherited from interface com.illumon.iris.db.tables.Table
absSumBy, absSumBy, absSumBy, aj, aj, aj, aj, aj, 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, 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, renameAllColumns, renameColumns, renameColumns, 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
-
Method Details
-
getInfo
Get theHierarchicalTableInfoassociated with this table.- Returns:
- the info for this table
-
getSourceTable
Get the table on which this hierarchical table was created from.- Returns:
- the source table
-
withFlatFilterColumns
Create a shallow copy of this table that will apply filters to the specified columns at each level, instead of filtering the base table and re-treeing.- Parameters:
columns- the columns to filter flat.- Returns:
- a copy of this table that will filter the specified columns per level.
-
copy
- Overrides:
copyin classQueryTable
-
getRawRootTable
Get the table that is the root of the hierarchy- Returns:
- the root of the hierarchy
-
formatColumns
-
sort
- Specified by:
sortin interfaceTable- Overrides:
sortin classQueryTable
-
slice
Description copied from interface:TableExtracts 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.- Specified by:
slicein interfaceTable- Overrides:
slicein classQueryTable- Parameters:
firstRowInclusive- the first position to include in the resultlastRowExclusive- the last position to include in the result- Returns:
- a new Table, which is the request subset of rows from the original table
-
head
- Specified by:
headin interfaceTable- Overrides:
headin classQueryTable
-
tail
- Specified by:
tailin interfaceTable- Overrides:
tailin classQueryTable
-
leftJoin
Description copied from interface:TableAugments 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:
leftJoinin interfaceTable- Overrides:
leftJoinin classQueryTable- 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
Description copied from interface:TableIdentical to naturalJoin, but fail if the right side does not produce a match.- Specified by:
exactJoinin interfaceTable- Overrides:
exactJoinin classQueryTable
-
dropColumns
- Specified by:
dropColumnsin interfaceTable- Overrides:
dropColumnsin classQueryTable
-
renameColumns
- Specified by:
renameColumnsin interfaceTable- Overrides:
renameColumnsin classQueryTable
-
aj
public Table aj(Table rightTable, MatchPair[] columnsToMatch, MatchPair[] columnsToAdd, Table.AsOfMatchRule asOfMatchRule) Description copied from interface:TableLooks 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:
ajin interfaceTable- Overrides:
ajin classQueryTable- 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:TableJust 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:
rajin interfaceTable- Overrides:
rajin classQueryTable- 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:TableAugment 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:
naturalJoinin interfaceTable- Overrides:
naturalJoinin classQueryTable- 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:TablePerform 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
OutOfKeySpaceExceptionis 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:
joinin interfaceTable- Overrides:
joinin classQueryTable- 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
-
lastBy
Description copied from interface:TableGroups the data column according togroupByColumnsand retrieves the last for the rest of the fields- Specified by:
lastByin interfaceTable- Overrides:
lastByin classQueryTable- Parameters:
groupByColumns- The grouping columnsTable.by(String...)
-
firstBy
Description copied from interface:TableGroups the data column according togroupByColumnsand retrieves the first for the rest of the fields- Specified by:
firstByin interfaceTable- Overrides:
firstByin classQueryTable- Parameters:
groupByColumns- The grouping columnsTable.by(String...)
-
minBy
Description copied from interface:TableGroups the data column according togroupByColumnsand computes the min for the rest of the fields- Specified by:
minByin interfaceTable- Overrides:
minByin classQueryTable- Parameters:
selectColumns- The grouping columnsTable.by(String...)
-
maxBy
Description copied from interface:TableGroups the data column according togroupByColumnsand computes the max for the rest of the fields- Specified by:
maxByin interfaceTable- Overrides:
maxByin classQueryTable- Parameters:
selectColumns- The grouping columnsTable.by(String...)}
-
medianBy
Description copied from interface:TableGroups the data column according togroupByColumnsand computes the median for the rest of the fields- Specified by:
medianByin interfaceTable- Overrides:
medianByin classQueryTable- Parameters:
selectColumns- The grouping columnsTable.by(String...)}
-
countBy
- Specified by:
countByin interfaceTable- Overrides:
countByin classQueryTable
-
ungroup
Description copied from interface:TableUngroups a table by converting arrays into columns.- Specified by:
ungroupin interfaceTable- Overrides:
ungroupin classQueryTable- 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
-
headPct
Description copied from interface:TableProvides a head that selects a dynamic number of rows based on a percent.- Specified by:
headPctin interfaceTable- Overrides:
headPctin classQueryTable- 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
- Specified by:
tailPctin interfaceTable- Overrides:
tailPctin classQueryTable
-
by
- Specified by:
byin interfaceTable- Overrides:
byin classQueryTable
-
headBy
- Specified by:
headByin interfaceTable- Overrides:
headByin classQueryTable
-
tailBy
- Specified by:
tailByin interfaceTable- Overrides:
tailByin classQueryTable
-
applyToAllBy
public Table applyToAllBy(String formulaColumn, String columnParamName, SelectColumn... groupByColumns) Description copied from interface:TableGroups data according to groupByColumns and applies formulaColumn to each of columns not altered by the grouping operation.columnParamNameis used as place-holder for the name of each column insideformulaColumn.- Specified by:
applyToAllByin interfaceTable- Overrides:
applyToAllByin classQueryTable- 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:TableGroups the data column according togroupByColumnsand computes the sum for the rest of the fields- Specified by:
sumByin interfaceTable- Overrides:
sumByin classQueryTable- Parameters:
groupByColumns- The grouping columnsTable.by(String...)
-
absSumBy
Description copied from interface:TableGroups the data column according togroupByColumnsand computes the sum of the absolute values for the rest of the fields- Specified by:
absSumByin interfaceTable- Overrides:
absSumByin classQueryTable- Parameters:
groupByColumns- The grouping columnsTable.by(String...)
-
avgBy
Description copied from interface:TableGroups the data column according togroupByColumnsand computes the average for the rest of the fields- Specified by:
avgByin interfaceTable- Overrides:
avgByin classQueryTable- Parameters:
groupByColumns- The grouping columnsTable.by(String...)
-
wavgBy
Description copied from interface:TableGroups the data column according togroupByColumnsand computes the weighted average using weightColumn for the rest of the fields- Specified by:
wavgByin interfaceTable- Overrides:
wavgByin classQueryTable- Parameters:
weightColumn- the column to use for the weightgroupByColumns- The grouping columnsTable.by(String...)
-
stdBy
- Specified by:
stdByin interfaceTable- Overrides:
stdByin classQueryTable
-
varBy
Description copied from interface:TableGroups the data column according togroupByColumnsand computes the variance for the rest of the fields- Specified by:
varByin interfaceTable- Overrides:
varByin classQueryTable- Parameters:
groupByColumns- The grouping columnsTable.by(String...)
-
where
- Specified by:
wherein interfaceTable- Overrides:
wherein classQueryTable
-
whereIn
Description copied from interface:TableFilters 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.- Specified by:
whereInin interfaceTable- Overrides:
whereInin classQueryTable- 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
-
select
- Specified by:
selectin interfaceTable- Overrides:
selectin classQueryTable
-
selectDistinct
- Specified by:
selectDistinctin interfaceTable- Overrides:
selectDistinctin classQueryTable
-
update
- Specified by:
updatein interfaceTable- Overrides:
updatein classQueryTable
-
view
- Specified by:
viewin interfaceTable- Overrides:
viewin classQueryTable
-
updateView
- Specified by:
updateViewin interfaceTable- Overrides:
updateViewin classQueryTable
-
lazyUpdate
Description copied from interface:TableCompute 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:
lazyUpdatein interfaceTable- Overrides:
lazyUpdatein classQueryTable- Parameters:
columns- the columns to add- Returns:
- a new Table with the columns added; to be computed on demand
-
flatten
Description copied from interface:TableCreates a version of this table with a flat index (V2 only).- Specified by:
flattenin interfaceTable- Overrides:
flattenin classQueryTable
-
preemptiveUpdatesTable
- Specified by:
preemptiveUpdatesTablein interfaceTable- Overrides:
preemptiveUpdatesTablein classQueryTable
-
preemptiveSnapshotTable
- Specified by:
preemptiveSnapshotTablein interfaceTable- Overrides:
preemptiveSnapshotTablein classQueryTable
-
byExternal
Description copied from interface:TableCreate aTableMapfrom 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:
byExternalin interfaceTable- Overrides:
byExternalin classQueryTable- 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, SelectColumn... columns) Create a rollup table. A rollup table aggregates by the specified columns, and then creates a hierarchical table which re-aggregates using one less aggregation column on each level. The column that is no longer part of the aggregation key is replaced with null on each level.- Parameters:
comboAggregateFactory- the ComboAggregateFactory describing the aggregationcolumns- the columns to group by- Returns:
- a hierarchical table with the rollup applied
- ImplNote:
- The Preemptive version of this method will return a non-preemptive table
-
treeTable
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:
treeTablein interfaceTable- Overrides:
treeTablein classQueryTable- 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
- ImplNote:
- The Preemptive version of this method will return a non-preemptive table
-
reverse
Description copied from class:QueryTableThe 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.- Specified by:
reversein interfaceTable- Overrides:
reversein classQueryTable- Returns:
- the reversed table
-
snapshot
Description copied from interface:TableSnapshot "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:
snapshotin interfaceTable- Overrides:
snapshotin classQueryTable- 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:
snapshotIncrementalin interfaceTable- Overrides:
snapshotIncrementalin classQueryTable
-
snapshotHistory
- Specified by:
snapshotHistoryin interfaceTable- Overrides:
snapshotHistoryin classQueryTable
-
getSubTable
- Specified by:
getSubTablein interfaceTable- Overrides:
getSubTablein classQueryTable
-