Class JsTable

All Implemented Interfaces:
JoinableTable, JsITable, ServerObject, HasTableBinding, Revivable

@TsName(namespace="dh", name="Table") public class JsTable extends HasLifecycle implements HasTableBinding, JoinableTable, ServerObject, JsITable, Revivable
Provides access to data in a table. Note that several methods present their response through Promises. This allows the client to:
  1. Avoid actually connecting to the server until necessary.
  2. Permit some changes not to inform the UI right away that they have taken place.
  • Field Details

    • EVENT_SIZECHANGED

      @JsProperty(namespace="dh.Table") public static final String EVENT_SIZECHANGED
      The table size has updated, so live scrollbars and the like can be updated accordingly.
      See Also:
    • EVENT_UPDATED

      @JsProperty(namespace="dh.Table") public static final String EVENT_UPDATED
      event.detail is the currently visible window, the same as if getViewportData was called and resolved. Listening to this event removes the need to listen to the finer grained events below for data changes. In contrast, using the finer grained events may enable only updating the specific rows which saw a change.
      See Also:
    • EVENT_ROWADDED

      @JsProperty(namespace="dh.Table") public static final String EVENT_ROWADDED
      Finer grained visibility into data being added, rather than just seeing the currently visible viewport. Provides the row being added, and the offset it will exist at.
      See Also:
    • EVENT_ROWREMOVED

      @JsProperty(namespace="dh.Table") public static final String EVENT_ROWREMOVED
      Finer grained visibility into data being removed, rather than just seeing the currently visible viewport. Provides the row being removed, and the offset it used to exist at.
      See Also:
    • EVENT_ROWUPDATED

      @JsProperty(namespace="dh.Table") public static final String EVENT_ROWUPDATED
      Finer grained visibility into data being updated, rather than just seeing the currently visible viewport. Provides the row being updated and the offset it exists at.
      See Also:
    • EVENT_SORTCHANGED

      @JsProperty(namespace="dh.Table") public static final String EVENT_SORTCHANGED
      Indicates that a sort has occurred, and that the UI should be replaced with the current viewport.
      See Also:
    • EVENT_FILTERCHANGED

      @JsProperty(namespace="dh.Table") public static final String EVENT_FILTERCHANGED
      Indicates that a filter has occurred, and that the UI should be replaced with the current viewport.
      See Also:
    • EVENT_CUSTOMCOLUMNSCHANGED

      @JsProperty(namespace="dh.Table") public static final String EVENT_CUSTOMCOLUMNSCHANGED
      Indicates that columns for this table have changed, and column headers should be updated.
      See Also:
    • EVENT_DISCONNECT

      @JsProperty(namespace="dh.Table") public static final String EVENT_DISCONNECT
      This table has lost its connection to the server. Events will not fire and data will not update until the connection is reestablished, at which point EVENT_RECONNECT will fire, or EVENT_RECONNECTFAILED if this table cannot be re-established. A reconnect will be attempted automatically. Subscriptions made from this table report their own lifecycle with the same event names.
      See Also:
    • EVENT_RECONNECT

      @JsProperty(namespace="dh.Table") public static final String EVENT_RECONNECT
      This table has reconnected to the server, and data will update again. Any viewport or subscription that was active before the disconnect has been re-requested; its data follows in updated events on the object it was subscribed through, this table or the subscription.
      See Also:
    • EVENT_RECONNECTFAILED

      @JsProperty(namespace="dh.Table") public static final String EVENT_RECONNECTFAILED
      This table could not be re-established after a reconnect and cannot be used again; fetch a new one. The event.detail value describes the failure. This says nothing about the connection as a whole: other tables may have reconnected.
      See Also:
    • EVENT_REQUEST_FAILED

      @JsProperty(namespace="dh.Table") public static final String EVENT_REQUEST_FAILED
      Indicates that an error occurred on this table on the server or while communicating with it. The message will provide more insight, but recent operations were likely unsuccessful and may need to be reapplied.
      See Also:
    • EVENT_REQUEST_SUCCEEDED

      @JsProperty(namespace="dh.Table") public static final String EVENT_REQUEST_SUCCEEDED
      Indicates that a pending change to this table, such as a new sort or filter, was applied on the server. Any EVENT_SORTCHANGED, EVENT_FILTERCHANGED, or EVENT_CUSTOMCOLUMNSCHANGED resulting from that change fires after this event.
      See Also:
    • SIZE_UNCOALESCED

      @JsProperty(namespace="dh.Table") public static final double SIZE_UNCOALESCED
      The size the table will have if it is uncoalesced.
      See Also:
    • INTERNAL_EVENT_STATECHANGED

      public static final String INTERNAL_EVENT_STATECHANGED
      See Also:
    • INTERNAL_EVENT_SIZELISTENER

      public static final String INTERNAL_EVENT_SIZELISTENER
      See Also:
    • MAX_BATCH_TIME

      public static final int MAX_BATCH_TIME
      See Also:
  • Constructor Details

    • JsTable

      public JsTable(WorkerConnection workerConnection, ClientTableState state)
      Creates a new Table directly from an existing ClientTableState (CTS). The CTS manages all fetch operations, so this is just a simple constructor to get a table that points to the given state.
  • Method Details

    • reverse

      @JsMethod(namespace="dh.Table") public static Sort reverse()
      A Sort that can be used to reverse a table. This can be passed into an array in applySort. Note that Tree Tables do not support reverse.
      Returns:
      Sort
    • refetch

      public elemental2.promise.Promise<JsTable> refetch()
      Description copied from class: HasLifecycle
      Indicate that a new session has been created on the server, and this object should re-create its corresponding server-side object if possible. Override this to implement custom behavior, being sure to call reconnect() when finished.
      Overrides:
      refetch in class HasLifecycle
      Returns:
      a promise that will resolve when this object is reconnected
    • typedTicket

      public TypedTicket typedTicket()
      Specified by:
      typedTicket in interface ServerObject
    • operations

      @JsMethod public JsPendingTable<JsResolvedTable> operations()
      This table's server-side state as it is now, as a pending table to chain operations on. Like every TableOperations, it stands for one fixed table: a later applyFilter(io.deephaven.web.client.api.filter.FilterCondition[]), applySort(io.deephaven.web.client.api.Sort[]) or other change to this table does not move it; call operations() again to build on the changed table. Like any pending table, it can only be used in the task that created it; await or resolve() it to keep the table longer, as a JsResolvedTable to close when done. This table is unaffected by anything done with it.
      Returns:
      a pending table over this table's current state
      Throws:
      IllegalStateException - if this table is closed
    • batch

      @JsMethod public elemental2.promise.Promise<JsTable> batch(JsConsumer<RequestBatcher> userCode)
    • findColumn

      @JsMethod public Column findColumn(String key)
      Retrieve a column by the given name. You should prefer to always retrieve a new Column instance instead of caching a returned value.
      Specified by:
      findColumn in interface JsITable
      Parameters:
      key -
      Returns:
      Column
    • findColumns

      @JsMethod public Column[] findColumns(String[] keys)
      Retrieve multiple columns specified by the given names.
      Parameters:
      keys -
      Returns:
      Column array
    • lastVisibleState

      public ClientTableState lastVisibleState()
      Returns the current state if active, or the last state which was active which represents the state we will return to if an error occurs with the state we're presently waiting on. This lets user code access the last known table size and columns.
    • isAlive

      public boolean isAlive()
      Specified by:
      isAlive in interface HasTableBinding
    • state

      public ClientTableState state()
      Specified by:
      state in interface HasTableBinding
      Specified by:
      state in interface JoinableTable
    • hasInputTable

      @JsProperty(name="hasInputTable") public boolean hasInputTable()
      true if this table represents a user Input Table (see dh.InputTable). When true, you may call inputTable() to add or remove data from the underlying table.
    • isBlinkTable

      @JsMethod public boolean isBlinkTable()
      Checks whether this table is a blink table.
      Returns:
      true if this table is a blink table; false otherwise.
    • inputTable

      @JsMethod public elemental2.promise.Promise<JsInputTable> inputTable()
      If hasInputTable() is true, you may call this method to gain access to an JsInputTable object which can be used to mutate the data within the table. If the table is not an Input Table, the promise will be immediately rejected.
    • close

      @JsMethod public void close()
      Description copied from interface: JsITable
      Signals that the table is no longer used, so the server can release its resources. Logs a warning if called more than once.
      Specified by:
      close in interface JsITable
    • getAttributes

      @JsMethod public elemental2.core.JsArray<String> getAttributes()
      Description copied from interface: JsITable
      The names of all attributes defined on this table.
      Specified by:
      getAttributes in interface JsITable
      Returns:
      an array of attributes defined on this table
    • getAttribute

      @JsMethod public @JsNullable Object getAttribute(String attributeName)
      Description copied from interface: JsITable
      Reads an attribute's value as a string. Only primitive and string values are sent to the client. An attribute listed by JsITable.getAttributes() with any other value cannot be read here.
      Specified by:
      getAttribute in interface JsITable
      Parameters:
      attributeName - the name of the attribute to read
      Returns:
      the value of the attribute or null if none with that name exists
    • getColumns

      @JsProperty public elemental2.core.JsArray<Column> getColumns()
      The columns that are present on this table. This is always all possible columns. If you specify fewer columns in setViewport(double, double, JsArray), you will get only those columns in your ViewportData.
      Specified by:
      getColumns in interface JsITable
      Returns:
      the columns in this table
    • getLayoutHints

      @JsProperty public @JsNullable JsLayoutHints getLayoutHints()
      Layout hints for displaying this table.
    • getSize

      @JsProperty public double getSize()
      The total count of rows in the table. If there is a viewport subscription active, this size will be updated when the subscription updates. If not, and isUncoalesced() is true, the size will be SIZE_UNCOALESCED. Otherwise, the size will be updated when the server's update graph processes changes.

      When the size changes, the EVENT_SIZECHANGED event will be fired.

      Specified by:
      getSize in interface JsITable
      Returns:
      the size of the table
    • getDescription

      @JsProperty public @JsNullable String getDescription()
      The table description attribute.
      Returns:
      The description, or null.
    • getTotalSize

      @JsProperty public double getTotalSize()
      The total count of the rows in the table, excluding any filters. Unlike getSize(), changes to this value will not result in any event. If the table is unfiltered, this will return the same size as getSize(). If this table was uncoalesced before it was filtered, this will return SIZE_UNCOALESCED.
    • getSort

      @JsProperty public elemental2.core.JsArray<Sort> getSort()
      An ordered list of Sorts to apply to the table. To update, call applySort(Sort[]). Note that this getter will return the new value immediately, even though it may take a little time to update on the server. You may listen for the EVENT_SORTCHANGED event to know when to update the UI.
    • getFilter

      @JsProperty public elemental2.core.JsArray<FilterCondition> getFilter()
      An ordered list of filter conditions to apply to the table. To update, call applyFilter(FilterCondition[]). Note that this getter will return the new value immediately, even though it may take a little time to update on the server. You may listen for the EVENT_FILTERCHANGED event to know when to update the UI.
    • applySort

      @JsMethod public elemental2.core.JsArray<Sort> applySort(Sort[] sort)
      Replace the currently set sort on this table. Returns the previously set value. Note that the sort property will immediately return the new value, but you may receive update events using the old sort before the new sort is applied, and the EVENT_SORTCHANGED event fires. Reusing existing, applied sorts may enable this to perform better on the server. The EVENT_UPDATED event will also fire, but EVENT_ROWADDED and EVENT_ROWREMOVED will not.
      Parameters:
      sort -
    • applyFilter

      @JsMethod public elemental2.core.JsArray<FilterCondition> applyFilter(FilterCondition[] filter)
      Replace the currently set filters on the table. Returns the previously set value. Note that the filter property will immediately return the new value, but you may receive update events using the old filter before the new one is applied, and the EVENT_FILTERCHANGED event fires. Reusing existing, applied filters may enable this to perform better on the server. The EVENT_UPDATED event will also fire, but EVENT_ROWADDED and EVENT_ROWREMOVED will not.
      Parameters:
      filter -
    • applyCustomColumns

      @JsMethod public elemental2.core.JsArray<CustomColumn> applyCustomColumns(elemental2.core.JsArray<JsTable.CustomColumnArgUnionType> customColumns)
      Used when adding new filter and sort operations to the table, as long as they are present.
      Parameters:
      customColumns -
    • getCustomColumns

      @JsProperty public elemental2.core.JsArray<CustomColumn> getCustomColumns()
      An ordered list of custom column formulas to add to the table, either adding new columns or replacing existing ones. To update, call applyCustomColumns(JsArray).
    • setViewport

      public TableViewportSubscription setViewport(double firstRow, double lastRow)
      Overload for Java (since JS just omits the optional params).
    • setViewport

      public TableViewportSubscription setViewport(double firstRow, double lastRow, elemental2.core.JsArray<Column> columns)
      Overload for Java (since JS just omits the optional param).
    • setViewport

      @JsMethod @Deprecated public TableViewportSubscription setViewport(double firstRow, double lastRow, @JsOptional @JsNullable elemental2.core.JsArray<Column> columns, @JsOptional @JsNullable Double updateIntervalMs, @JsOptional @JsNullable Boolean isReverseViewport)
      Deprecated.
      If the columns parameter is not provided, all columns will be used. If the updateIntervalMs parameter is not provided, a default of one second will be used. Until this is called, no data will be available. Invoking this will result in events to be fired once data becomes available, starting with an updated event and a rowadded event per row in that range. The returned object allows the viewport to be closed when no longer needed.
      Parameters:
      firstRow -
      lastRow -
      columns -
      updateIntervalMs -
    • getViewportData

      @JsMethod @Deprecated public elemental2.promise.Promise<@TsTypeRef(ViewportData.class) AbstractTableSubscription.UpdateEventData> getViewportData()
      Gets the currently visible viewport. If the current set of operations has not yet resulted in data, it will not resolve until that data is ready. If this table is closed before the promise resolves, it will be rejected - to separate the lifespan of this promise from the table itself, call TableViewportSubscription.getViewportData() on the result from setViewport(double, double).
      Returns:
      Promise of TableData
    • subscribe

      public TableSubscription subscribe(elemental2.core.JsArray<Column> columns)
      Overload for java (since js just omits the optional var)
    • subscribe

      @JsMethod @Deprecated public TableSubscription subscribe(elemental2.core.JsArray<Column> columns, @JsOptional @JsNullable Double updateIntervalMs)
      Creates a subscription to the specified columns, across all rows in the table. The optional parameter updateIntervalMs may be specified to indicate how often the server should send updates, defaulting to one second if omitted. Useful for charts or taking a snapshot of the table atomically. The initial snapshot will arrive in a single event, but later changes will be sent as updates. However, this may still be very expensive to run from a browser for very large tables. Each call to subscribe creates a new subscription, which must have AbstractTableSubscription.close() called on it to stop it, and all events are fired from the TableSubscription instance.
      Parameters:
      columns -
      updateIntervalMs -
    • createSubscription

      @JsMethod public TableSubscription createSubscription(@TsTypeRef(SubscriptionOptions.class) @TsTypeRef(SubscriptionOptions.class) Object options)
      Description copied from interface: JsITable
      Creates a subscription to the specified columns, across all rows in the table. Useful for charts or taking a snapshot of the table atomically. The initial snapshot arrives in a single event, and later changes arrive as updates. However, this may still be very expensive to run from a browser for very large tables. Each call creates a new subscription, which must have AbstractTableSubscription.close() called on it to stop it and release its resources, and all events are fired from the TableSubscription instance.
      Specified by:
      createSubscription in interface JsITable
      Parameters:
      options - the subscription options, described in DataOptions.SubscriptionOptions
      Returns:
      a new TableSubscription
    • createViewportSubscription

      @JsMethod public TableViewportSubscription createViewportSubscription(@TsTypeRef(ViewportSubscriptionOptions.class) @TsTypeRef(ViewportSubscriptionOptions.class) Object options)
      Description copied from interface: JsITable
      Creates a viewport subscription to the specified columns, across the specified rows in the table. The returned TableViewportSubscription instance allows the viewport to be changed over time, and events are fired from it when the data changes or when a viewport change is applied. Each call creates a new subscription, which must have TableViewportSubscription.close() called on it to stop it and release its resources.
      Specified by:
      createViewportSubscription in interface JsITable
      Parameters:
      options - the viewport subscription options, described in DataOptions.ViewportSubscriptionOptions
      Returns:
      a new TableViewportSubscription
    • createSnapshot

      @JsMethod public elemental2.promise.Promise<TableData> createSnapshot(@TsTypeRef(SnapshotOptions.class) @TsTypeRef(SnapshotOptions.class) Object options)
      Description copied from interface: JsITable
      Returns a promise of a TableData instance containing a snapshot of the current state of the table, within the bounds of the specified rows and columns.
      Specified by:
      createSnapshot in interface JsITable
      Parameters:
      options - the snapshot options, described in DataOptions.SnapshotOptions
      Returns:
      a promise of TableData
    • selectDistinct

      @JsMethod public elemental2.promise.Promise<JsTable> selectDistinct(Column[] columns)
      A new table containing the distinct tuples of values from the given columns that are present in the original table. This table can be manipulated as any other table. Sorting is often desired as the default sort is the order of appearance of values from the original table.
      Parameters:
      columns -
      Returns:
      a promise of the distinct table
    • selectDistinct

      public JsPendingTable<JsTable> selectDistinct(Column[] columns, TableTicket handle)
      As selectDistinct(Column[]), into a ticket the caller allocated earlier.
    • copy

      @JsMethod public elemental2.promise.Promise<JsTable> copy()
      Creates a new copy of this table, so it can be sorted and filtered separately, and maintain a different viewport. The copy is of this table as it is now, and must be closed when no longer needed. To chain operations on this table instead, use operations().
      Returns:
      Promise of dh.Table
    • copy

      public elemental2.promise.Promise<JsTable> copy(boolean resolved)
    • getTotalsTable

      @JsMethod public elemental2.promise.Promise<JsTotalsTable> getTotalsTable(@JsOptional @TsTypeRef(JsTotalsTableConfig.class) @JsNullable @TsTypeRef(JsTotalsTableConfig.class) Object config)
      A promise that will resolve to a Totals Table of this table. This table will obey the configurations provided as a parameter, or will use the table's default if no parameter is provided, and be updated once per second as necessary. Note that multiple calls to this method will each produce a new dh.TotalsTable which must have close() called on it when not in use.
      Parameters:
      config -
      Returns:
      Promise of dh.TotalsTable
    • getTotalsTableConfig

      @JsProperty public JsTotalsTableConfig getTotalsTableConfig()
      The default configuration to be used when building a dh.TotalsTable for this table.
      Returns:
      dh.TotalsTableConfig
    • getGrandTotalsTable

      @JsMethod public elemental2.promise.Promise<JsTotalsTable> getGrandTotalsTable(@JsOptional @TsTypeRef(JsTotalsTableConfig.class) @JsNullable @TsTypeRef(JsTotalsTableConfig.class) Object config)
      A promise that will resolve to a Totals Table of this table, ignoring any filters. See getTotalsTable(Object) for more specifics.
      Parameters:
      config -
      Returns:
      promise of dh.TotalsTable
    • rollup

      @JsMethod public elemental2.promise.Promise<JsTreeTable> rollup(@TsTypeRef(JsRollupConfig.class) @TsTypeRef(JsRollupConfig.class) Object configObject)
      a promise that will resolve to a new roll-up dh.TreeTable of this table. Multiple calls to this method will each produce a new dh.TreeTable which must have close() called on it when not in use.
      Parameters:
      configObject - specifies which columns to aggregate and which to group by, and other rollup behavior
      Returns:
      Promise of dh.TreeTable
    • treeTable

      @JsMethod public elemental2.promise.Promise<JsTreeTable> treeTable(@TsTypeRef(JsTreeTableConfig.class) @TsTypeRef(JsTreeTableConfig.class) Object configObject)
      A promise that will resolve to a new dh.TreeTable of this table. Multiple calls to this method will each produce a new dh.TreeTable which must have close() called on it when not in use.
      Parameters:
      configObject - specifies which column to use as the row ID, and which for parent ID, and how to handle rows with no parent
      Returns:
      Promise of dh.TreeTable
    • freeze

      @JsMethod public elemental2.promise.Promise<JsTable> freeze()
      A "frozen" version of this table (a server-side snapshot of the entire source table). Viewports on the frozen table will not update. This does not change the original table, and the new table will not have any of the client side sorts/filters/columns. New client side sorts/filters/columns can be added to the frozen copy.
      Specified by:
      freeze in interface JoinableTable
      Returns:
      a promise of the frozen table
    • snapshot

      @JsMethod public elemental2.promise.Promise<JsTable> snapshot(JsTableReference baseTable, @JsOptional @JsNullable Boolean doInitialSnapshot, @JsOptional @JsNullable elemental2.core.ReadonlyArray<JsTable.MatchPairUnion> stampColumns)
      Description copied from interface: JoinableTable
      Creates a server-side snapshot of baseTable when this table updates.
      Specified by:
      snapshot in interface JoinableTable
      Parameters:
      baseTable - The table to snapshot.
      doInitialSnapshot - Whether to create an initial snapshot immediately.
      stampColumns - Optional list of stamp column match pairs to include in the result.
      Returns:
      A promise that resolves to the snapshot table.
    • join

      @JsMethod @Deprecated public elemental2.promise.Promise<JsTable> join(String joinType, JsTableReference rightTable, elemental2.core.ReadonlyArray<JsTable.MatchPairUnion> columnsToMatch, @JsOptional @JsNullable elemental2.core.ReadonlyArray<JsTable.MatchPairUnion> columnsToAdd, @JsOptional @JsNullable String asOfMatchRule)
      Deprecated.
      Description copied from interface: JoinableTable
      Joins this table to the provided table, using one of the specified join types:
      • AJ, ReverseAJ (or RAJ) - Inexact timeseries joins, based on the provided matching rule.
      • CROSS_JOIN (or Join) - Cross join of all rows that have matching values in both tables.
      • EXACT_JOIN (or ExactJoin) - Matches values in exactly one row in the right table, with errors if there is not exactly one.
      • NATURAL_JOIN (or Natural) - Matches values in at most one row in the right table, with nulls if there is no match or errors if there are multiple matches.
      Note that Left join is not supported here, unlike DHE.

      See the Choose a join method document for more guidance on picking a join operation.

      Specified by:
      join in interface JoinableTable
      Parameters:
      joinType - The type of join to perform, see the list above.
      rightTable - The table to match to values in this table.
      columnsToMatch - Columns that should match.
      columnsToAdd - Columns from the right table to add to the result - empty/null/absent to add all columns.
      asOfMatchRule - If joinType is AJ/RAJ/ReverseAJ, the match rule to use.
      Returns:
      A promise that will resolve to the joined table.
    • asOfJoin

      @JsMethod public elemental2.promise.Promise<JsTable> asOfJoin(JsTableReference rightTable, elemental2.core.ReadonlyArray<JsTable.MatchPairUnion> columnsToMatch, @JsOptional @JsNullable elemental2.core.ReadonlyArray<JsTable.MatchPairUnion> columnsToAdd, @JsOptional @JsNullable String asOfMatchRule)
      Description copied from interface: JoinableTable
      Performs an inexact timeseries join, where rows in this table will have columns added from the closest matching row from the right table.

      The asOfMatchRule value can be one of:

      • LESS_THAN_EQUAL
      • LESS_THAN
      • GREATER_THAN_EQUAL
      • GREATER_THAN
      Specified by:
      asOfJoin in interface JoinableTable
      Parameters:
      rightTable - The table to match to values in this table.
      columnsToMatch - The columns that should match, according to the asOfMatchRole.
      columnsToAdd - Columns from the right table to add to the resulting table, empty/null/absent to add all columns.
      asOfMatchRule - The match rule to use, see above.
      Returns:
      A promise that will resolve to the joined table.
    • crossJoin

      @JsMethod public elemental2.promise.Promise<JsTable> crossJoin(JsTableReference rightTable, elemental2.core.ReadonlyArray<JsTable.MatchPairUnion> columnsToMatch, @JsOptional @JsNullable elemental2.core.ReadonlyArray<JsTable.MatchPairUnion> columnsToAdd, @JsOptional @JsNullable Double reserveBits)
      Description copied from interface: JoinableTable
      A promise that will be resolved with the newly created table holding the results of the specified cross join operation. The columnsToAdd parameter is optional, not specifying it will result in all columns from the right table being added to the output. The reserveBits optional parameter lets the client control how the key space is distributed between the rows in the two tables, see the Java Table class for details.
      Specified by:
      crossJoin in interface JoinableTable
      Parameters:
      rightTable - The table to match to values in this table.
      columnsToMatch - The columns that should match exactly.
      columnsToAdd - Columns from the right table to add to the resulting table, empty/null/absent to add all columns.
      reserveBits - The number of bits of key-space to initially reserve per group, null/absent will let the server select a value.
      Returns:
      A promise that will resolve to the joined table.
    • exactJoin

      @JsMethod public elemental2.promise.Promise<JsTable> exactJoin(JsTableReference rightTable, elemental2.core.ReadonlyArray<JsTable.MatchPairUnion> columnsToMatch, @JsOptional @JsNullable elemental2.core.ReadonlyArray<JsTable.MatchPairUnion> columnsToAdd)
      Description copied from interface: JoinableTable
      A promise that will be resolved with the newly created table holding the results of the specified exact join operation. The columnsToAdd parameter is optional, not specifying it will result in all columns from the right table being added to the output.
      Specified by:
      exactJoin in interface JoinableTable
      Parameters:
      rightTable - The table to match to values in this table.
      columnsToMatch - The columns that should match exactly.
      columnsToAdd - Columns from the right table to add to the resulting table, empty/null/absent to add all columns.
      Returns:
      A promise that will resolve to the joined table.
    • naturalJoin

      @JsMethod public elemental2.promise.Promise<JsTable> naturalJoin(JsTableReference rightTable, elemental2.core.ReadonlyArray<JsTable.MatchPairUnion> columnsToMatch, @JsOptional @JsNullable elemental2.core.ReadonlyArray<JsTable.MatchPairUnion> columnsToAdd)
      Description copied from interface: JoinableTable
      A promise that will be resolved with the newly created table holding the results of the specified natural join operation. The columnsToAdd parameter is optional, not specifying it will result in all columns from the right table being added to the output.
      Specified by:
      naturalJoin in interface JoinableTable
      Parameters:
      rightTable - The table to match to values in this table.
      columnsToMatch - The columns that should match exactly.
      columnsToAdd - Columns from the right table to add to the resulting table. Empty/null/absent to add all columns.
      Returns:
      A promise that will resolve to the joined table.
    • byExternal

      @JsMethod public elemental2.promise.Promise<JsPartitionedTable> byExternal(Object keys, @JsOptional @JsNullable Boolean dropKeys)
      Parameters:
      keys - The partition key column name or names.
      dropKeys - Whether to drop the key columns from the partitioned constituent tables.
      Returns:
      Promise of JsPartitionedTable.
    • partitionBy

      @JsMethod public elemental2.promise.Promise<JsPartitionedTable> partitionBy(Object keys, @JsOptional @JsNullable Boolean dropKeys)
      Creates a new dh.PartitionedTable from the contents of the current table, partitioning data based on the specified keys.
      Parameters:
      keys -
      dropKeys -
      Returns:
      Promise of dh.PartitionedTable
    • getColumnStatistics

      @JsMethod public elemental2.promise.Promise<JsColumnStatistics> getColumnStatistics(Column.ColumnOrName column)
      Description copied from interface: JsITable
      Computes statistics for one column of this table, such as its count, sum and average for a numeric column, or its most common values for other types.
      Specified by:
      getColumnStatistics in interface JsITable
      Parameters:
      column - the column, or the name of the column, to compute statistics for
      Returns:
      a promise of the ColumnStatistics for that column
    • seekRow

      @JsMethod public elemental2.promise.Promise<Double> seekRow(double startingRow, Column.ColumnOrName column, @TsTypeRef(ValueType.class) @TsTypeRef(ValueType.class) String valueType, jsinterop.base.Any seekValue, @JsOptional @JsNullable Boolean insensitive, @JsOptional @JsNullable Boolean contains, @JsOptional @JsNullable Boolean isBackwards)
      Finds the next row, after startingRow and wrapping around, whose value in column matches seekValue.
      Parameters:
      startingRow - the position of the row to search after
      column - the column, or the name of the column, to search
      valueType - the type to compare seekValue as
      seekValue - the value to find
      insensitive - optionally, true to ignore case. Defaults to false.
      contains - optionally, true to match values that contain seekValue rather than equal it. Defaults to false.
      isBackwards - optionally, true to search backward. Defaults to false.
      Returns:
      a promise of the position of the matching row, or -1 if no row matches
    • maybeRevive

      public void maybeRevive(ClientTableState state)
    • revive

      public void revive(ClientTableState state)
      Specified by:
      revive in interface Revivable
    • downsample

      public elemental2.promise.Promise<JsTable> downsample(LongWrapper[] zoomRange, int pixelCount, String xCol, String[] yCols)
      Get a downsampled version of the table. Currently only supports downsampling with an Instant or long xCol.
      Parameters:
      zoomRange - The visible range as [start, end] or null to always use all data.
      pixelCount - The width of the visible area in pixels.
      xCol - The name of the X column to downsample. Must be an Instant or long.
      yCols - The names of the Y columns to downsample.
      Returns:
      A promise that resolves to the downsampled table.
    • isClosed

      @JsProperty(name="isClosed") public boolean isClosed()
      true if this table has been closed.
      Returns:
      boolean
    • isRefreshing

      @JsProperty(name="isRefreshing") public boolean isRefreshing()
      true if this table may receive updates from the server, including size changed events, updated events after initial snapshot.
      Returns:
      boolean
    • isUncoalesced

      @JsProperty(name="isUncoalesced") public boolean isUncoalesced()
      Read-only. true if this table is uncoalesced, indicating that work must be done before the table can be used.

      Uncoalesced tables are expensive to operate on - filter to a single partition or range of partitions before subscribing to access only the desired data efficiently. A subscription can be specified without a filter, but this can be very expensive. To see which partitions are available, check each column on the table to see which have Column.getIsPartitionColumn() as true, and filter those columns. To read the possible values for those columns, use selectDistinct(Column[]).

      Returns:
      true if the table is uncoaleced and should be filtered before operating on it, otherwise false.
    • getPluginName

      @JsProperty public @JsNullable String getPluginName()
      The plugin name attribute for this table.
      Returns:
      The plugin name, or null.
    • getHandle

      public TableTicket getHandle()
      Specified by:
      getHandle in interface HasTableBinding
    • getHeadHandle

      public TableTicket getHeadHandle()
    • toString

      @JsMethod public String toString()
      Gets a string representation of this table instance.
      Overrides:
      toString in class Object
      Returns:
      A string representation of this table.
    • getConnection

      public WorkerConnection getConnection()
      Specified by:
      getConnection in interface ServerObject
    • isActive

      public boolean isActive(ClientTableState state)
    • setState

      public void setState(ClientTableState state)
      Specified by:
      setState in interface HasTableBinding
    • getBinding

      public ActiveTableBinding getBinding()
    • getCache

      public StateCache getCache()
    • hasHandle

      public boolean hasHandle(TableTicket tableHandle)
      Specified by:
      hasHandle in interface HasTableBinding
    • hasRollbackHandle

      public boolean hasRollbackHandle(TableTicket tableHandle)
    • setRollback

      public void setRollback(ActiveTableBinding rollbackTo)
      Specified by:
      setRollback in interface HasTableBinding
    • rollback

      public void rollback()
      Specified by:
      rollback in interface HasTableBinding
    • setSize

      public void setSize(double s)
    • getSubscriptionId

      public int getSubscriptionId()
    • maybeReviveSubscription

      public void maybeReviveSubscription()
      Specified by:
      maybeReviveSubscription in interface HasTableBinding