Class QueryableProjection<T>
- java.lang.Object
-
- org.apache.druid.segment.projections.QueryableProjection<T>
-
public class QueryableProjection<T> extends Object
Represents a projection of some base table available to use to build aCursorHolderby aCursorFactory.Projections are a type of invisible materialized view stored inside of a
Segmentwhich can be automatically used if they match theCursorBuildSpecargument passed toCursorFactory.makeCursorHolder(CursorBuildSpec).In the most basic sense, a projection consists of: - the actual underlying projection rows (
rowSelector) - a mapping ofCursorBuildSpeccolumns to underlying projection columns (remapColumns) - and a modifiedCursorBuildSpec(cursorBuildSpec)The
getRowSelector()andgetCursorBuildSpec()methods can be used by aCursorFactoryto build aCursorHolderfor the projection instead of the base table, andwrapColumnSelectorFactory(ColumnSelectorFactory)andwrapVectorColumnSelectorFactory(VectorColumnSelectorFactory)can be used to decorate the selector factories constructed by thatCursorHolderwhenever it builds aCursororVectorCursorto ensure that all the selectors needed to satisfy the originalCursorBuildSpecare available at the correct names.
-
-
Constructor Summary
Constructors Constructor Description QueryableProjection(CursorBuildSpec cursorBuildSpec, Map<String,String> remapColumns, T rowSelector)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CursorBuildSpecgetCursorBuildSpec()The originalCursorBuildSpecof a query can be modified if a projection matches the query, such as removing virtual columns which have already been pre-computed.TgetRowSelector()Backing storage for the rows of the projection as is appropriate for the type ofCursorFactoryColumnSelectorFactorywrapColumnSelectorFactory(ColumnSelectorFactory selectorFactory)The projection can contain pre-computed virtual columns or pre-aggregated aggregation columns.VectorColumnSelectorFactorywrapVectorColumnSelectorFactory(VectorColumnSelectorFactory selectorFactory)The projection can contain pre-computed virtual columns or pre-aggregated aggregation columns.
-
-
-
Constructor Detail
-
QueryableProjection
public QueryableProjection(CursorBuildSpec cursorBuildSpec, Map<String,String> remapColumns, T rowSelector)
-
-
Method Detail
-
getCursorBuildSpec
public CursorBuildSpec getCursorBuildSpec()
The originalCursorBuildSpecof a query can be modified if a projection matches the query, such as removing virtual columns which have already been pre-computed.
-
wrapColumnSelectorFactory
public ColumnSelectorFactory wrapColumnSelectorFactory(ColumnSelectorFactory selectorFactory)
The projection can contain pre-computed virtual columns or pre-aggregated aggregation columns. At query time, these are remapped to match the desired names for all equivalent components of theCursorBuildSpec.For example, if the original
CursorBuildSpechas a sum aggregator named 'sum_x' which takes a field 'x' as input, and an equivalent sum aggregation exists on the projection with the name 'xsum' built from the base table column 'x', the wrapped column selector factory will make 'xsum' available as 'sum_x', allowing the query to use the combining aggregator instead of processing the base table for column 'x'.
-
wrapVectorColumnSelectorFactory
public VectorColumnSelectorFactory wrapVectorColumnSelectorFactory(VectorColumnSelectorFactory selectorFactory)
The projection can contain pre-computed virtual columns or pre-aggregated aggregation columns. At query time, these are remapped to match the desired names for all equivalent components of theCursorBuildSpecFor example, if the original
CursorBuildSpechas a sum aggregator named 'sum_x' which takes a field 'x' as input, and an equivalent sum aggregation exists on the projection with the name 'xsum' built from the base table column 'x', the wrapped column selector factory will make 'xsum' available as 'sum_x', allowing the query to use the combining aggregator instead of processing the base table for column 'x'.
-
getRowSelector
public T getRowSelector()
Backing storage for the rows of the projection as is appropriate for the type ofCursorFactory
-
-