Class AbstractFormulaColumn
java.lang.Object
io.deephaven.engine.table.impl.select.AbstractFormulaColumn
- All Implemented Interfaces:
Selectable
,FormulaColumn
,SelectColumn
- Direct Known Subclasses:
DhFormulaColumn
,FormulaColumnPython
A SelectColumn that implements a formula computed from the existing columns in the table and a query scope.
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.deephaven.engine.table.impl.select.SelectColumn
SelectColumn.ExpressionAdapter
-
Field Summary
Modifier and TypeFieldDescriptionstatic final boolean
static final String
protected Map<String,
ColumnDefinition<?>> protected final @NotNull String
protected Map<String,
? extends ColumnSource<?>> protected Future<FormulaFactory>
protected String
protected final String
protected QueryScopeParam<?>[]
protected Class<?>
protected boolean
protected boolean
protected boolean
Fields inherited from interface io.deephaven.engine.table.impl.select.SelectColumn
ZERO_LENGTH_SELECT_COLUMN_ARRAY
-
Constructor Summary
ModifierConstructorDescriptionprotected
AbstractFormulaColumn
(String columnName, String formulaString) Create a formula column for the given formula string. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
applyUsedVariables
(@NotNull Map<String, ColumnDefinition<?>> parentColumnDefinitions, @NotNull Set<String> variablesUsed, @NotNull Map<String, Object> possibleParams) protected Future<FormulaFactory>
createKernelFormulaFactory
(@NotNull CompletionStageFuture<FormulaKernelFactory> formulaKernelFactoryFuture) Get a list of the names of column arrays used in this SelectColumn.Get a list of the names of columns used in this SelectColumn.@NotNull ColumnSource<?>
Creates aColumnSource
that will evaluate the result of theformula
for a given row on demand when it is accessed.@NotNull ColumnSource<?>
Creates aColumnSource
that will evaluate the result of theformula
for a given row on demand when it is accessed and cache the resultGet a MatchPair for this column, if applicable.getName()
Get the name of the resultant column.Class<?>
Get the data component type stored in the resultant column.Class<?>
Get the data type stored in the resultant column.protected abstract FormulaSourceDescriptor
initInputs
(@NotNull TrackingRowSet rowSet, @NotNull Map<String, ? extends ColumnSource<?>> columnsOfInterest) Initialize the column from the provided set of underlying columns and row set.boolean
isRetain()
newDestInstance
(long size) Create a newWritableColumnSource
.newFlatDestInstance
(long size) Create a newimmutable
WritableColumnSource
.protected void
onCopy
(AbstractFormulaColumn copy) toString()
protected void
validateColumnDefinition
(Map<String, ColumnDefinition<?>> columnDefinitionMap) void
validateSafeForRefresh
(BaseTable<?> sourceTable) Validate that thisSelectColumn
is safe to use in the context of the provided sourceTable.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface io.deephaven.engine.table.impl.select.FormulaColumn
getFormulaShiftColPair, hasConstantArrayAccess, hasConstantValue
Methods inherited from interface io.deephaven.engine.table.impl.select.SelectColumn
copy, expression, initDef, initDef, isStateless, newColumn
-
Field Details
-
ALLOW_UNSAFE_REFRESHING_FORMULAS
public static final boolean ALLOW_UNSAFE_REFRESHING_FORMULAS -
formulaString
-
originalFormulaString
-
usedColumns
-
columnName
-
formulaFactoryFuture
-
params
-
columnSources
-
columnDefinitions
-
returnedType
-
COLUMN_SUFFIX
- See Also:
-
usedColumnArrays
-
usesI
protected boolean usesI -
usesII
protected boolean usesII -
usesK
protected boolean usesK
-
-
Constructor Details
-
AbstractFormulaColumn
Create a formula column for the given formula string.The internal formula object is generated on-demand by calling out to the Java compiler.
- Parameters:
columnName
- the result column nameformulaString
- the formula string to be parsed by the QueryLanguageParser
-
-
Method Details
-
getReturnedType
Description copied from interface:SelectColumn
Get the data type stored in the resultant column.- Specified by:
getReturnedType
in interfaceSelectColumn
- Returns:
- the type
-
getReturnedComponentType
Description copied from interface:SelectColumn
Get the data component type stored in the resultant column.- Specified by:
getReturnedComponentType
in interfaceSelectColumn
- Returns:
- the component type
-
initInputs
public List<String> initInputs(@NotNull @NotNull TrackingRowSet rowSet, @NotNull @NotNull Map<String, ? extends ColumnSource<?>> columnsOfInterest) Description copied from interface:SelectColumn
Initialize the column from the provided set of underlying columns and row set.- Specified by:
initInputs
in interfaceSelectColumn
- Parameters:
rowSet
- the base row setcolumnsOfInterest
- the input columns- Returns:
- a list of columns on which the result of this is dependent
-
validateSafeForRefresh
Description copied from interface:SelectColumn
Validate that thisSelectColumn
is safe to use in the context of the provided sourceTable.- Specified by:
validateSafeForRefresh
in interfaceSelectColumn
- Parameters:
sourceTable
- the source table
-
applyUsedVariables
-
onCopy
-
validateColumnDefinition
-
getColumns
Description copied from interface:SelectColumn
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.- Specified by:
getColumns
in interfaceSelectColumn
- Returns:
- the columns used in this SelectColumn
-
getColumnArrays
Description copied from interface:SelectColumn
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.- Specified by:
getColumnArrays
in interfaceSelectColumn
- Returns:
- the list of column arrays used
-
getDataView
Creates aColumnSource
that will evaluate the result of theformula
for a given row on demand when it is accessed. The result of this is the column source produced by callingTableOperations.updateView(java.lang.String...)
orTableOperations.view(java.lang.String...)
on aTable
.- Specified by:
getDataView
in interfaceSelectColumn
- Returns:
- a
ColumnSource
-
getLazyView
Creates aColumnSource
that will evaluate the result of theformula
for a given row on demand when it is accessed and cache the result- Specified by:
getLazyView
in interfaceSelectColumn
- Returns:
- the column source produced by calling
TableOperations.lazyUpdate(java.lang.String...)
on aTable
.
-
createKernelFormulaFactory
protected Future<FormulaFactory> createKernelFormulaFactory(@NotNull @NotNull CompletionStageFuture<FormulaKernelFactory> formulaKernelFactoryFuture) -
getSourceDescriptor
-
getName
Description copied from interface:SelectColumn
Get the name of the resultant column.- Specified by:
getName
in interfaceSelectColumn
- Returns:
- the name of the column
-
getMatchPair
Description copied from interface:SelectColumn
Get a MatchPair for this column, if applicable.- Specified by:
getMatchPair
in interfaceSelectColumn
- Returns:
-
isRetain
public boolean isRetain()- Specified by:
isRetain
in interfaceSelectColumn
- Returns:
-
toString
-
newDestInstance
Description copied from interface:SelectColumn
Create a newWritableColumnSource
. The returned column source must be capable of handling updates.- Specified by:
newDestInstance
in interfaceSelectColumn
- Parameters:
size
- A hint as to the number of rows that will be used- Returns:
- a new
WritableColumnSource
-
newFlatDestInstance
Description copied from interface:SelectColumn
Create a newimmutable
WritableColumnSource
. The returned column source should be flat, and need not handle updates.- Specified by:
newFlatDestInstance
in interfaceSelectColumn
- Parameters:
size
- A hint as to the number of rows that will be used- Returns:
- a new
WritableColumnSource
-