Interface SelectColumn

All Superinterfaces:
ConcurrencyControl<Selectable>, Selectable
All Known Subinterfaces:
FormulaColumn
All Known Implementing Classes:
AbstractFormulaColumn, DhFormulaColumn, FormulaColumnPython, FunctionalColumn, FunctionalColumnLong, MultiSourceFunctionalColumn, NullSelectColumn, ReinterpretedColumn, SelectColumnWithDeclaredBarriers, SelectColumnWithRespectedBarriers, SourceColumn, SwitchColumn, TableTransformationColumn

public interface SelectColumn extends Selectable, ConcurrencyControl<Selectable>
The interface for a query table to perform retrieve values from a column for select like operations.
  • Field Details

    • ZERO_LENGTH_SELECT_COLUMN_ARRAY

      static final SelectColumn[] ZERO_LENGTH_SELECT_COLUMN_ARRAY
      Convenient static final instance of a zero length Array of SelectColumns for use in toArray calls.
  • Method Details

    • of

      static SelectColumn of(Selectable selectable)
    • from

      static SelectColumn[] from(Selectable... selectables)
    • from

      static SelectColumn[] from(Collection<? extends Selectable> selectables)
    • copyFrom

      static SelectColumn[] copyFrom(SelectColumn[] selectColumns)
    • copyFrom

      static Collection<SelectColumn> copyFrom(Collection<SelectColumn> selectColumns)
    • ofStateless

      static SelectColumn ofStateless(@NotNull @NotNull Selectable selectable)
      Produce a stateless SelectColumn from selectable.
      Parameters:
      selectable - The Selectable to adapt and mark as stateless
      Returns:
      The resulting SelectColumn
    • ofStateless

      static SelectColumn[] ofStateless(@NotNull @NotNull Selectable... selectables)
      Produce a stateless SelectColumn[] from selectables.
      Parameters:
      selectables - The selectables to adapt and mark as stateless
      Returns:
      The resulting SelectColumn[] array
    • ofRecomputeOnModifiedRow

      static SelectColumn ofRecomputeOnModifiedRow(Selectable selectable)
      Produce a SelectColumn that recomputeOnModifiedRow() recomputes values on any modified row} from selectable.
      Parameters:
      selectable - The Selectable to adapt and mark as requiring row-level recomputation
      Returns:
      The resulting SelectColumn
    • initInputs

      List<String> initInputs(TrackingRowSet rowSet, Map<String,? extends ColumnSource<?>> columnsOfInterest)
      Initialize the column from the provided set of underlying columns and row set.
      Parameters:
      rowSet - the base row set
      columnsOfInterest - the input columns
      Returns:
      a list of columns on which the result of this is dependent
    • initDef

      List<String> initDef(@NotNull @NotNull Map<String,ColumnDefinition<?>> columnDefinitionMap)
      Initialize any internal column definitions from the provided initial. Any formulae will be compiled immediately using the QueryCompiler in the current ExecutionContext.
      Parameters:
      columnDefinitionMap - the starting set of column definitions; valid for this call only
      Returns:
      a list of columns on which the result of this is dependent
      ApiNote:
      Any QueryLibrary, QueryScope, or QueryCompiler usage needs to be resolved within initDef. Implementations must be idempotent. Implementations that want to hold on to the columnDefinitionMap must make a defensive copy.
    • initDef

      default List<String> initDef(@NotNull @NotNull Map<String,ColumnDefinition<?>> columnDefinitionMap, @NotNull @NotNull QueryCompilerRequestProcessor compilationRequestProcessor)
      Initialize any internal column definitions from the provided initial. A compilation request consumer is provided to allow for deferred compilation of expressions that belong to the same query.

      Compilations must be resolved before using this SelectColumn.

      Parameters:
      columnDefinitionMap - the starting set of column definitions; valid for this call only
      compilationRequestProcessor - a consumer to submit compilation requests; valid for this call only
      Returns:
      a list of columns on which the result of this is dependent
      ApiNote:
      Any QueryLibrary, QueryScope, or QueryCompiler usage needs to be resolved within initDef. Implementations must be idempotent. Implementations that want to hold on to the columnDefinitionMap must make a defensive copy.
    • getReturnedType

      Class<?> getReturnedType()
      Get the data type stored in the resultant column.
      Returns:
      the type
    • getReturnedComponentType

      Class<?> getReturnedComponentType()
      Get the data component type stored in the resultant column.
      Returns:
      the component type
    • getColumns

      List<String> getColumns()
      Get a list of the names of columns used in this SelectColumn. Behavior is undefined if none of the init* methods have been called yet.
      Returns:
      the columns used in this SelectColumn
    • getColumnArrays

      List<String> getColumnArrays()
      Get a list of the names of column arrays used in this SelectColumn. Behavior is undefined if none of the init* methods have been called yet.
      Returns:
      the list of column arrays used
    • getDataView

      @NotNull @NotNull ColumnSource<?> getDataView()
      Get a ColumnSource that can be used to access the data on demand.
      Returns:
      a ColumnSource
    • getLazyView

      @NotNull @NotNull ColumnSource<?> getLazyView()
      Returns a lazily computed view of this column.
      Returns:
      a lazily computed column source
    • getName

      String getName()
      Get the name of the resultant column.
      Returns:
      the name of the column
    • getMatchPair

      MatchPair getMatchPair()
      Get a MatchPair for this column, if applicable.
      Returns:
      the MatchPair for this column, if applicable.
    • newDestInstance

      WritableColumnSource<?> newDestInstance(long size)
      Create a new WritableColumnSource. The returned column source must be capable of handling updates.
      Parameters:
      size - A hint as to the number of rows that will be used
      Returns:
      a new WritableColumnSource
    • newFlatDestInstance

      WritableColumnSource<?> newFlatDestInstance(long size)
      Create a new immutable WritableColumnSource. The returned column source should be flat, and need not handle updates.
      Parameters:
      size - A hint as to the number of rows that will be used
      Returns:
      a new WritableColumnSource
    • isRetain

      boolean isRetain()
      Returns:
    • validateSafeForRefresh

      default void validateSafeForRefresh(BaseTable<?> sourceTable)
      Validate that this SelectColumn is safe to use in the context of the provided sourceTable.
      Parameters:
      sourceTable - the source table
    • isStateless

      boolean isStateless()
      Returns true if this column is stateless (i.e. one row does not depend on the order of evaluation for another row).
    • hasVirtualRowVariables

      default boolean hasVirtualRowVariables()
      Returns true if this column uses row virtual offset columns of i, ii or k.
    • copy

      SelectColumn copy()
      Create a copy of this SelectColumn.
      Returns:
      an independent copy of this SelectColumn.
    • recomputeOnModifiedRow

      default boolean recomputeOnModifiedRow()
      Should we ignore modified column sets, and always re-evaluate this column when the row changes?
      Returns:
      true if this column should be evaluated on every row modification
    • withRecomputeOnModifiedRow

      default SelectColumn withRecomputeOnModifiedRow()
      Create a copy of this SelectColumn that always re-evaluates itself when a row is modified.
    • newColumn

      default ColumnName newColumn()
      Description copied from interface: Selectable
      The new column name, to be added to the new table.
      Specified by:
      newColumn in interface Selectable
      Returns:
      the new column name
    • expression

      default Expression expression()
      Description copied from interface: Selectable
      The expression.
      Specified by:
      expression in interface Selectable
      Returns:
      the expression
    • hasConstantArrayAccess

      default boolean hasConstantArrayAccess()
    • hasConstantValue

      default boolean hasConstantValue()
    • maybeGetSourceColumn

      default Optional<SourceColumn> maybeGetSourceColumn()
    • maybeGetFormulaColumn

      default Optional<FormulaColumn> maybeGetFormulaColumn()
    • withSerial

      default SelectColumn withSerial()
      Description copied from interface: ConcurrencyControl
      Applies serial concurrency control to the expression.

      The serial wrapped filter/selectable is guaranteed to process exactly the set of rows as if any prior filters/selectables were applied, but it will do so in a serial manner. If this is a filter, then the expression will not evaluate additional rows or skip rows that future filters may eliminate. Take care when selecting marking filters/selectables as serial, as the operation will not be able to take advantage of powerful optimizations.

      • Concurrency impact: The expression will never be invoked concurrently with itself.
      • Intra-expression ordering impact: Rows are evaluated sequentially in row set order.
      • Inter-expression ordering impact: For a filter, serial acts as an absolute reordering barrier, ensuring that no parts of a filter are executed out of order relative to this serial wrapper.

        For selectables, additional ordering constraints are controlled by the value of the QueryTable.SERIAL_SELECT_IMPLICIT_BARRIERS. This is set by the property QueryTable.serialSelectImplicitBarriers (defaulting to the value of QueryTable.statelessSelectByDefault).

        If QueryTable.SERIAL_SELECT_IMPLICIT_BARRIERS is false, then no additional ordering between selectable expressions is imposed. As with every select or update call, if column B references column A, then the necessary inputs from column A are evaluated before column B is evaluated. To impose further ordering constraints, use barriers.

        If QueryTable.SERIAL_SELECT_IMPLICIT_BARRIERS is true, then a serial selectable is an absolute barrier with respect to all other serial selectables. This prohibits serial selectables from being evaluated concurrently, permitting them to access global state. Selectables that are not serial may be reordered with respect to a serial selectable.

      Specified by:
      withSerial in interface ConcurrencyControl<Selectable>
      Specified by:
      withSerial in interface Selectable
      Returns:
      a new instance of T with serial concurrency control applied.
    • withDeclaredBarriers

      default SelectColumn withDeclaredBarriers(Object... declaredBarriers)
      Description copied from interface: ConcurrencyControl
      Designates the filter/selectable as declaring the specified barrier object(s).

      A barrier does not affect concurrency but imposes an ordering constraint for the filters or selectables that respect the same barrier. When a filter/selectable is marked as respecting a barrier object, it indicates that the respecting filter/selectable will be executed entirely after the filter/selectable declaring the barrier.

      Each barrier must be unique and declared by at most one filter. Object equals and Object.hashCode() hashCode will be used to determine uniqueness and identification of barrier objects.

      Specified by:
      withDeclaredBarriers in interface ConcurrencyControl<Selectable>
      Specified by:
      withDeclaredBarriers in interface Selectable
      Parameters:
      declaredBarriers - the unique barrier object identifiers
      Returns:
      a new instance of T with the declaredBarriers applied
    • withRespectedBarriers

      default SelectColumn withRespectedBarriers(Object... respectedBarriers)
      Description copied from interface: ConcurrencyControl
      Specifies that the filter/selectable should respect the ordering constraints of the given barriers.

      Filters that define a barrier (using ConcurrencyControl.withDeclaredBarriers(Object...)) will be executed entirely before filters/selectables that respect that barrier.

      It is an error to respect a barrier that has not already been defined per the natural left to right ordering of filters/selectables at the operation level. This is to minimize the risk of user error as the API is loosely typed.

      Object equals and Object.hashCode() hashCode will be used to identify which barriers are respected.

      Specified by:
      withRespectedBarriers in interface ConcurrencyControl<Selectable>
      Specified by:
      withRespectedBarriers in interface Selectable
      Parameters:
      respectedBarriers - the unique barrier object identifiers to respect
      Returns:
      a new instance of T with the respects barrier rule applied