|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.lucidera.lcs.LcsIndexGuide
public class LcsIndexGuide
LcsIndexGuide provides information about the mapping from catalog definitions for LCS tables and their clusters to their Fennel representation.
Field Summary | |
---|---|
private List<FemLocalIndex> |
clusteredIndexes
|
private List<Integer> |
clusterMap
|
private Map<FemLocalIndex,Integer> |
clusterToRootPageIdParamIdMap
|
private RelDataType |
flattenedRowType
|
private int[] |
flatteningMap
|
static int |
LbmBitmapSegMaxSize
|
private int |
numFlattenedCols
|
private int |
numUnFlattenedCols
|
private Map<Integer,FemLocalIndex> |
ordinalToClusterMap
|
private FarragoRepos |
repos
|
private CwmColumnSet |
table
|
private FarragoTypeFactory |
typeFactory
|
private RelDataType |
unflattenedRowType
|
Constructor Summary | |
---|---|
LcsIndexGuide(FarragoTypeFactory typeFactory,
CwmColumnSet table)
Construct an IndexGuide using the default list of indexes |
|
LcsIndexGuide(FarragoTypeFactory typeFactory,
CwmColumnSet table,
FemLocalIndex unclusteredIndex)
Construct an IndexGuide using an unclustered index |
|
LcsIndexGuide(FarragoTypeFactory typeFactory,
CwmColumnSet table,
List<FemLocalIndex> clusteredIndexes)
Construct an IndexGuide using a specific list of clustered indexes |
Method Summary | |
---|---|
private void |
addClusterCols(int colOrdinal)
Flattens a column and adds an entry for each subcolumn within the flattened column into clusterMap |
private void |
appendBitmapAttr(FemTupleDescriptor tupleDesc)
|
private void |
appendInt64Attr(FemTupleDescriptor tupleDesc)
|
private Integer |
computeProjectedColumn(int i)
|
Integer[] |
computeProjectedColumns(Integer[] origProj)
Creates a projection list relative to the cluster columns |
FemTupleProjection |
createClusteredBTreePageIdDesc()
Creates a tuple projection for the PageId attribute of the BTree index tuple corresponding to a clustered index. |
FemTupleProjection |
createClusteredBTreeRidDesc()
Creates a tuple projection for the RID attribute of the BTree index corresponding to a clustered index. |
FemTupleDescriptor |
createClusteredBTreeTupleDesc()
Creates a tuple descriptor for the BTree index corresponding to a clustered index. |
private void |
createClusterMap(List<FemLocalIndex> clusteredIndexes)
Creates an array mapping cluster columns to table columns, the order of the array matching the order of the cluster columns in an ordered list of clusters. |
(package private) LcsIndexSearchRel |
createDeletionIndexScan(FennelRel rel,
LcsTable lcsTable,
FennelRelParamId startRidParamId,
FennelRelParamId rowLimitParamId,
boolean fullScan)
Creates an index search on the deletion index corresponding to an lcs table. |
private RelNode |
createDelIndexScanInput(FennelRel rel,
boolean fullScan)
Creates the RelNode that corresponds to the key input into the deletion index scan. |
(package private) LcsIndexMinusRel |
createMinusOfDeletionIndex(FennelRel rel,
LcsTable lcsTable,
RelNode input)
|
List<FemLocalIndex> |
createResidualClusterList(Integer[] residualColumns)
Retrieves a list of clusters corresponding to clusters containing residual filtered columns. |
RelDataType |
createSplicerErrorType(FemLocalIndex uniqueIndex)
Creates the row data type of error records produced by a splicer when there unique constraint violations. |
FemTupleProjection |
createUnclusteredBitmapKeyProj()
Creates a key projection for bitmap data. |
RelDataType |
createUnclusteredBitmapRowType()
Creates a bitmap data row type, [SRID, SegmentDir, Segments] |
FemTupleDescriptor |
createUnclusteredBitmapTupleDesc()
Creates a tuple descriptor for bitmap data |
FemTupleDescriptor |
createUnclusteredBTreeBitmapDesc()
|
FemTupleProjection |
createUnclusteredBTreeBitmapProj(FemLocalIndex index)
|
FemTupleProjection |
createUnclusteredBTreeKeyProj(FemLocalIndex index)
Creates a tuple projection for the key attributes of the BTree index corresponding to an unclustered index. |
FemTupleDescriptor |
createUnclusteredBTreeTupleDesc(FemLocalIndex index)
Creates a tuple descriptor for the BTree index corresponding to an unclustered index. |
RelDataType |
createUnclusteredRowType(FemLocalIndex index,
Integer[] proj)
Creates a row data type for a projection of an index. |
private void |
defineClusterScan(FemLocalIndex index,
FennelRel rel,
FemLcsClusterScanDef clusterScan,
boolean write,
int rootPageIdParamId)
Fills in a cluster scan def for this scan |
private void |
defineIndexAccessor(FemIndexAccessorDef indexAccessor,
FennelRel rel,
FemLocalIndex index,
boolean clustered,
boolean write,
boolean readOnlyCommittedData,
int rootPageIdParamId)
|
private void |
defineIndexScan(FemIndexScanDef scanStream,
FennelRel rel,
FemLocalIndex index,
Integer[] outputProj)
|
private void |
defineIndexStream(FemIndexStreamDef indexStream,
FennelRel rel,
FemLocalIndex index,
boolean clustered,
boolean write,
int rootPageIdParamId)
|
private void |
defineScanStream(FemLcsRowScanStreamDef scanStream,
FennelRel rel,
boolean write)
Fills in a stream definition for this scan. |
private void |
failIfIndexInvalid(FemLocalIndex index)
|
FemLocalIndex |
findSemiJoinIndex(List<Integer> semiJoinKeys,
List<Integer> bestKeyList)
Determines the best index to be used to process a semijoin |
private int |
flattenOrdinal(int columnOrdinal)
|
FemTupleDescriptor |
getClusterTupleDesc(FemLocalIndex index)
Creates a tuple descriptor corresponding to a clustered index |
RelDataType |
getFlattenedRowType()
|
private FemAbstractColumn |
getIndexColumn(FemLocalIndex index,
int position)
|
static List<FemLocalIndex> |
getIndexCoverageSet(FarragoRepos repos,
FemLocalIndex index,
List<FemLocalIndex> candidateIndexes,
boolean singleMatch,
boolean requireNonEmpty)
Determines the list of indexes from a candidate index list those indexes that contain at least one column matching the columns of a specified index. |
int |
getNumFlattenedClusterCols()
Retrieves number of columns in all the clustered indexes accessed |
int |
getNumFlattenedClusterCols(FemLocalIndex index)
Retrieves number of columns in a clustered index |
int |
getNumFlattenedSubCols(int colOrdinal)
Returns number of subcolumns corresponding to a column once it is flattened. |
(package private) FemTupleDescriptor |
getUnclusteredInputDesc()
|
(package private) RexNode[] |
getUnclusteredInputs(RexBuilder builder)
Creates input values for a bitmap index generator |
(package private) RelDataType |
getUnclusteredInputType()
|
int |
matchIndexKeys(FemLocalIndex index,
List<Integer> keys,
Integer[] keyOrder)
Determines if an index matches a set of keys representing RexInputRefs |
(package private) FemBarrierStreamDef |
newBarrier(RelDataType outputRowType,
BarrierReturnMode returnMode,
int deleteRowCountParamId)
|
(package private) LcsCompositeStreamDef |
newBitmapAppend(FennelRel rel,
FemLocalIndex index,
FemLocalIndex deletionIndex,
FennelRelImplementor implementor,
boolean createIndex,
FennelRelParamId insertDynParamId,
boolean createNewIndex)
Creates a set of streams for updating a bitmap index |
(package private) FemLbmIntersectStreamDef |
newBitmapIntersect(FennelDynamicParamId startRidParamId,
FennelDynamicParamId rowLimitParamId)
|
(package private) FemLbmMinusStreamDef |
newBitmapMinus(FennelDynamicParamId startRidParamId,
FennelDynamicParamId rowLimitParamId,
RelNode child)
|
(package private) FemSortingStreamDef |
newBitmapSorter()
|
(package private) FemLcsClusterAppendStreamDef |
newClusterAppend(FennelRel rel,
FemLocalIndex clusterIndex,
boolean hasIndexes,
int rootPageIdParamId,
int clusterPos,
boolean alterTable)
Creates a cluster append stream for a specific clustered index. |
private FemLbmGeneratorStreamDef |
newGenerator(FennelRel rel,
FemLocalIndex index,
boolean createIndex,
int insertRowCountParamId)
|
(package private) FemIndexScanDef |
newIndexScan(FennelRel rel,
FemLocalIndex index,
Integer[] projectedColumns)
|
(package private) FemLbmSearchStreamDef |
newIndexSearch(FennelRel rel,
FemLocalIndex index,
boolean isUniqueKey,
boolean isOuter,
Integer[] inputKeyProj,
Integer[] inputJoinProj,
Integer[] inputDirectiveProj,
Integer[] outputProj,
FennelDynamicParamId startRidParamId,
FennelDynamicParamId rowLimitParamId)
|
(package private) FemLcsRowScanStreamDef |
newRowScan(LcsRowScanRelBase rel,
Integer[] projectedColumns,
Integer[] residualColumns)
|
(package private) FemSortingStreamDef |
newSorter(FemLocalIndex index,
Double estimatedNumRows,
boolean ridOnly,
boolean earlyClose)
Creates a sort streamDef for sorting bitmap entries. |
(package private) FemLbmSplicerStreamDef |
newSplicer(FennelRel rel,
FemLocalIndex index,
FemLocalIndex deletionIndex,
int insertRowCountParamId,
int writeRowCountParamId,
boolean createNewIndex)
|
(package private) FemSplitterStreamDef |
newSplitter(RelDataType outputRowType)
|
private void |
setBitmapStreamParams(FemLbmBitOpStreamDef bitOpStream,
FennelDynamicParamId startRidParamId,
FennelDynamicParamId rowLimitParamId)
|
boolean |
testColumnCoverage(FemAbstractColumn column,
Integer[] projection)
Determines if a column is referenced by projection list. |
boolean |
testIndexCoverage(FemLocalIndex index,
Integer[] projection)
Determines if an index is referenced by projection list |
int |
unFlattenOrdinal(int fieldOrdinal)
Returns the unflattened column ordinal corresponding to a flattened field ordinal |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int LbmBitmapSegMaxSize
private FarragoTypeFactory typeFactory
private FarragoRepos repos
private CwmColumnSet table
private RelDataType unflattenedRowType
private RelDataType flattenedRowType
private int[] flatteningMap
private List<FemLocalIndex> clusteredIndexes
private List<Integer> clusterMap
private int numFlattenedCols
private int numUnFlattenedCols
private Map<FemLocalIndex,Integer> clusterToRootPageIdParamIdMap
private Map<Integer,FemLocalIndex> ordinalToClusterMap
Constructor Detail |
---|
LcsIndexGuide(FarragoTypeFactory typeFactory, CwmColumnSet table, List<FemLocalIndex> clusteredIndexes)
typeFactory
- table
- the column store tableclusteredIndexes
- list of clustered indexesLcsIndexGuide(FarragoTypeFactory typeFactory, CwmColumnSet table)
typeFactory
- table
- the column store tableLcsIndexGuide(FarragoTypeFactory typeFactory, CwmColumnSet table, FemLocalIndex unclusteredIndex)
typeFactory
- table
- the column store tableunclusteredIndex
- an unclustered indexMethod Detail |
---|
public static List<FemLocalIndex> getIndexCoverageSet(FarragoRepos repos, FemLocalIndex index, List<FemLocalIndex> candidateIndexes, boolean singleMatch, boolean requireNonEmpty)
repos
- repositoryindex
- the specified indexcandidateIndexes
- candidate indexessingleMatch
- if true, find only the first candidate index that
covers each column in the specified index; otherwise, find all candidate
indexes that cover each columnrequireNonEmpty
- if true, the return list must be non-empty
public RelDataType getFlattenedRowType()
private void createClusterMap(List<FemLocalIndex> clusteredIndexes)
create table t(a int, b int, c int, d int);
create clustered index it_c on t(c);
create clustered index it_ab on t(a, b);
create clustered index it_d on t(d);
clusterMap[] = { 2, 0, 1, 3 }
clusteredIndexes
- ordered list of clustersprivate void addClusterCols(int colOrdinal)
colOrdinal
- 0-based ordinal representing an unflattened columnpublic int getNumFlattenedSubCols(int colOrdinal)
colOrdinal
- 0-based ordinal representing an unflattened column
public int getNumFlattenedClusterCols(FemLocalIndex index)
index
- the clustered index
public int getNumFlattenedClusterCols()
public FemTupleDescriptor getClusterTupleDesc(FemLocalIndex index)
index
- clustered index
public Integer[] computeProjectedColumns(Integer[] origProj)
origProj
- original projection list relative to the table; if null,
project all columns from table
private Integer computeProjectedColumn(int i)
public boolean testIndexCoverage(FemLocalIndex index, Integer[] projection)
index
- clustered index being checkedprojection
- array of flattened ordinals of projected columns
public boolean testColumnCoverage(FemAbstractColumn column, Integer[] projection)
column
- column being checkedprojection
- array of flattened ordinals of projected columns
private int flattenOrdinal(int columnOrdinal)
public int unFlattenOrdinal(int fieldOrdinal)
fieldOrdinal
- flattened ordinal
public FemTupleDescriptor createClusteredBTreeTupleDesc()
private void appendInt64Attr(FemTupleDescriptor tupleDesc)
private void appendBitmapAttr(FemTupleDescriptor tupleDesc)
public FemTupleProjection createClusteredBTreeRidDesc()
createClusteredBTreeTupleDesc()
public FemTupleProjection createClusteredBTreePageIdDesc()
createClusteredBTreeTupleDesc()
public FemTupleDescriptor createUnclusteredBTreeTupleDesc(FemLocalIndex index)
For LCS unclustered indexes, the stored tuple is [K1, K2, ..., RID, BITMAP, BITMAP], and the key is [K1, K2, ..., RID]
index
- unclustered index
public FemTupleDescriptor createUnclusteredBTreeBitmapDesc()
public FemTupleProjection createUnclusteredBTreeKeyProj(FemLocalIndex index)
index
- unclustered index
createUnclusteredBTreeTupleDesc(net.sf.farrago.fem.med.FemLocalIndex)
public FemTupleProjection createUnclusteredBTreeBitmapProj(FemLocalIndex index)
public RelDataType createUnclusteredRowType(FemLocalIndex index, Integer[] proj)
index
- the index to be projectedproj
- a projection on the index
createUnclusteredBTreeTupleDesc(net.sf.farrago.fem.med.FemLocalIndex)
public RelDataType createSplicerErrorType(FemLocalIndex uniqueIndex)
uniqueIndex
- the unique index updated by the splicer
FemSplitterStreamDef newSplitter(RelDataType outputRowType)
FemBarrierStreamDef newBarrier(RelDataType outputRowType, BarrierReturnMode returnMode, int deleteRowCountParamId)
FemLcsClusterAppendStreamDef newClusterAppend(FennelRel rel, FemLocalIndex clusterIndex, boolean hasIndexes, int rootPageIdParamId, int clusterPos, boolean alterTable)
rel
- the RelNode that the cluster belongs toclusterIndex
- the clustered indexhasIndexes
- if true, indexes will also be inserted into as part of
execution of this cluster appendrootPageIdParamId
- the dynamic parameter id of the root page of the
cluster; only set > 0 if this is a cluster replaceclusterPos
- only used if this is a cluster replace, in which case,
it corresponds to the position of this cluster from the list of clusters
that will be replacedalterTable
- whether we are doing ALTER TABLE ADD COLUMN
FemLcsRowScanStreamDef newRowScan(LcsRowScanRelBase rel, Integer[] projectedColumns, Integer[] residualColumns)
LcsCompositeStreamDef newBitmapAppend(FennelRel rel, FemLocalIndex index, FemLocalIndex deletionIndex, FennelRelImplementor implementor, boolean createIndex, FennelRelParamId insertDynParamId, boolean createNewIndex)
private FemLbmGeneratorStreamDef newGenerator(FennelRel rel, FemLocalIndex index, boolean createIndex, int insertRowCountParamId)
FemSortingStreamDef newSorter(FemLocalIndex index, Double estimatedNumRows, boolean ridOnly, boolean earlyClose)
index
- index corresponding to the bitmap entries that will be
sortedestimatedNumRows
- estimated number of input rows into the sortridOnly
- true if this sort will only be used to sort single rid
valuesearlyClose
- if true, setup the sorter to do an early close on its
producers; in that case, the sorter will explicitly close its producers
once it has read all its input; this is needed in the case where the
producers of the sort reference a table that's modified by the consumers
of the sort
FemLbmSplicerStreamDef newSplicer(FennelRel rel, FemLocalIndex index, FemLocalIndex deletionIndex, int insertRowCountParamId, int writeRowCountParamId, boolean createNewIndex)
FemIndexScanDef newIndexScan(FennelRel rel, FemLocalIndex index, Integer[] projectedColumns)
FemLbmSearchStreamDef newIndexSearch(FennelRel rel, FemLocalIndex index, boolean isUniqueKey, boolean isOuter, Integer[] inputKeyProj, Integer[] inputJoinProj, Integer[] inputDirectiveProj, Integer[] outputProj, FennelDynamicParamId startRidParamId, FennelDynamicParamId rowLimitParamId)
private void defineIndexScan(FemIndexScanDef scanStream, FennelRel rel, FemLocalIndex index, Integer[] outputProj)
private void defineIndexStream(FemIndexStreamDef indexStream, FennelRel rel, FemLocalIndex index, boolean clustered, boolean write, int rootPageIdParamId)
private void defineIndexAccessor(FemIndexAccessorDef indexAccessor, FennelRel rel, FemLocalIndex index, boolean clustered, boolean write, boolean readOnlyCommittedData, int rootPageIdParamId)
private void defineScanStream(FemLcsRowScanStreamDef scanStream, FennelRel rel, boolean write)
scanStream
- stream definition to fill inrel
- the RelNode containing the clusterwrite
- whether the cluster will be writtenprivate void failIfIndexInvalid(FemLocalIndex index)
private void defineClusterScan(FemLocalIndex index, FennelRel rel, FemLcsClusterScanDef clusterScan, boolean write, int rootPageIdParamId)
index
- clustered index corresponding to this canrel
- the RelNode containing the clusterclusterScan
- clustered scan to fill inwrite
- true if the cluster will be written as well as readrootPageIdParamId
- if > 0, the dynamic parameter that will supply
the value of the root pageId of the clusterRexNode[] getUnclusteredInputs(RexBuilder builder)
The inputs are two columns: [rowCount startRid]
RelDataType getUnclusteredInputType()
FemTupleDescriptor getUnclusteredInputDesc()
public RelDataType createUnclusteredBitmapRowType()
public FemTupleDescriptor createUnclusteredBitmapTupleDesc()
public FemTupleProjection createUnclusteredBitmapKeyProj()
FemSortingStreamDef newBitmapSorter()
private void setBitmapStreamParams(FemLbmBitOpStreamDef bitOpStream, FennelDynamicParamId startRidParamId, FennelDynamicParamId rowLimitParamId)
FemLbmIntersectStreamDef newBitmapIntersect(FennelDynamicParamId startRidParamId, FennelDynamicParamId rowLimitParamId)
FemLbmMinusStreamDef newBitmapMinus(FennelDynamicParamId startRidParamId, FennelDynamicParamId rowLimitParamId, RelNode child)
LcsIndexMinusRel createMinusOfDeletionIndex(FennelRel rel, LcsTable lcsTable, RelNode input)
LcsIndexSearchRel createDeletionIndexScan(FennelRel rel, LcsTable lcsTable, FennelRelParamId startRidParamId, FennelRelParamId rowLimitParamId, boolean fullScan)
rel
- the rel from which this scan is being generatedlcsTable
- the table whose deletion index is to be scannedstartRidParamId
- start rid parameter for the index searchrowLimitParamId
- row limit parameter for the index searchfullScan
- true if deletion index will be used with a full table
scan
private RelNode createDelIndexScanInput(FennelRel rel, boolean fullScan)
rel
- the original rel from which this rel is being generatedfullScan
- true if a full scan will be done on the deletion index
private FemAbstractColumn getIndexColumn(FemLocalIndex index, int position)
public FemLocalIndex findSemiJoinIndex(List<Integer> semiJoinKeys, List<Integer> bestKeyList)
semiJoinKeys
- keys of the semijoin that we are trying to find an
index for.bestKeyList
- appends the list of specific keys within the input
parameter that match an index if an appropriate index is available
public int matchIndexKeys(FemLocalIndex index, List<Integer> keys, Integer[] keyOrder)
index
- index being matched againstkeys
- keys representing the inputRefs that need to be matched
against the indexkeyOrder
- returns the positions of the matching RexInputRefs in the
order in which they match the index
public List<FemLocalIndex> createResidualClusterList(Integer[] residualColumns)
residualColumns
- array of flattened ordinals corresponding to the
columns that have residual filters
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |