Package com.illumon.iris.db.v2.select
Class AbstractFormulaColumn
java.lang.Object
com.illumon.iris.db.v2.select.AbstractFormulaColumn
- All Implemented Interfaces:
FormulaColumn
,SelectColumn
- Direct Known Subclasses:
DhFormulaColumn
,NumbaFormulaColumn
public abstract class AbstractFormulaColumn extends Object implements FormulaColumn
A SelectColumn that implements a formula computed from the existing columns in the table and a query scope.
-
Field Summary
Fields Modifier and Type Field Description static String
COLUMN_SUFFIX
protected String
columnName
protected Map<String,? extends ColumnSource>
columnSources
protected String
formulaString
protected Param[]
params
protected Class
returnedType
protected List<String>
usedColumnArrays
protected List<String>
usedColumns
protected List<String>
userParams
protected boolean
usesI
protected boolean
usesII
protected boolean
usesK
Fields inherited from interface com.illumon.iris.db.v2.select.SelectColumn
ZERO_LENGTH_SELECT_COLUMN_ARRAY
-
Method Summary
Modifier and Type Method Description protected void
applyUsedVariables(Map<String,com.illumon.dataobjects.ColumnDefinition> columnDefinitionMap, Set<String> variablesUsed)
protected FormulaFactory
createFormulaFactory()
boolean
disallowRefresh()
Should we disallow use of this column for refreshing tables? Some formulas can not be reliably computed with a refreshing table, therefore we will refuse to compute those values.List<String>
getColumnArrays()
Get a list of the names of column arrays used in this SelectColumn.List<String>
getColumns()
Get a list of the names of columns used in this SelectColumn.ColumnSource
getDataView()
Creates aColumnSource
that will evaluate the result of theformula
for a given row on demand when it is accessed.protected abstract FormulaKernelFactory
getFormulaKernelFactory()
ColumnSource
getLazyView()
Creates aColumnSource
that will evaluate the result of theformula
for a given row on demand when it is accessed and cache the resultMatchPair
getMatchPair()
Get a MatchPair for this column, if applicable.String
getName()
Get the name of the resultant column.Class
getReturnedType()
Get the data type stored in the resultant column.protected abstract FormulaSourceDescriptor
getSourceDescriptor()
List<String>
initInputs(Table table)
Initialize the SelectColumn using the input table and return a list of underlying columns that this SelectColumn is dependent upon.List<String>
initInputs(Index index, Map<String,? extends ColumnSource> columnsOfInterest)
Initialize the column from the provided set of underlying columns and index.boolean
isRetain()
static DbArrayBase
makeAppropriateDbArrayWrapper(ColumnSource cs, Index index)
WritableSource
newDestInstance(long size)
Create a newWritableSource
with sufficient capacity for the rows in the index.String
toString()
ColumnSource
updateData(WritableSource result, long destPos, long sourcePos)
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.select.FormulaColumn
getFormulaShiftColPair, hasConstantArrayAccess, hasConstantValue
Methods inherited from interface com.illumon.iris.db.v2.select.SelectColumn
alwaysEvaluate, alwaysEvaluateCopy, copy, getConstantValueView, initDef
-
Field Details
-
formulaString
-
usedColumns
-
columnName
-
userParams
-
params
-
columnSources
-
returnedType
-
COLUMN_SUFFIX
- See Also:
- Constant Field Values
-
usedColumnArrays
-
usesI
protected boolean usesI -
usesII
protected boolean usesII -
usesK
protected boolean usesK
-
-
Method Details
-
initInputs
Description copied from interface:SelectColumn
Initialize the SelectColumn using the input table and return a list of underlying columns that this SelectColumn is dependent upon.- Specified by:
initInputs
in interfaceSelectColumn
- Parameters:
table
- the table to initialize internals from- Returns:
- a list containing all columns from 'table' that the result depends on
-
getReturnedType
Description copied from interface:SelectColumn
Get the data type stored in the resultant column.- Specified by:
getReturnedType
in interfaceSelectColumn
- Returns:
- the type
-
initInputs
Description copied from interface:SelectColumn
Initialize the column from the provided set of underlying columns and index.- Specified by:
initInputs
in interfaceSelectColumn
- Parameters:
index
- the base indexcolumnsOfInterest
- the input columns- Returns:
- a list of columns on which the result of this is dependent
-
applyUsedVariables
-
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
-
updateData
- Specified by:
updateData
in interfaceFormulaColumn
-
getDataView
Creates a
ColumnSource
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 calling
Table.updateView(com.illumon.iris.db.v2.select.SelectColumn...)
orTable.view(com.illumon.iris.db.v2.select.SelectColumn...)
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
Table.lazyUpdate(com.illumon.iris.db.v2.select.SelectColumn...)
on aTable
.
-
createFormulaFactory
-
makeAppropriateDbArrayWrapper
-
getSourceDescriptor
-
getFormulaKernelFactory
-
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 newWritableSource
with sufficient capacity for the rows in the index.- Specified by:
newDestInstance
in interfaceSelectColumn
- Parameters:
size
- The number of rows to allocate- Returns:
- a new
WritableSource
with sufficient capacity for 'dataSubset'
-
disallowRefresh
public boolean disallowRefresh()Description copied from interface:SelectColumn
Should we disallow use of this column for refreshing tables? Some formulas can not be reliably computed with a refreshing table, therefore we will refuse to compute those values.- Specified by:
disallowRefresh
in interfaceSelectColumn
-