com.lucidera.lcs
Class LcsIndexGuide

java.lang.Object
  extended by com.lucidera.lcs.LcsIndexGuide

public class LcsIndexGuide
extends Object

LcsIndexGuide provides information about the mapping from catalog definitions for LCS tables and their clusters to their Fennel representation.

Version:
$Id: //open/dev/farrago/src/com/lucidera/lcs/LcsIndexGuide.java#48 $
Author:
Zelaine Fong

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

LbmBitmapSegMaxSize

public static final int LbmBitmapSegMaxSize
See Also:
Constant Field Values

typeFactory

private FarragoTypeFactory typeFactory

repos

private FarragoRepos repos

table

private CwmColumnSet table

unflattenedRowType

private RelDataType unflattenedRowType

flattenedRowType

private RelDataType flattenedRowType

flatteningMap

private int[] flatteningMap

clusteredIndexes

private List<FemLocalIndex> clusteredIndexes

clusterMap

private List<Integer> clusterMap

numFlattenedCols

private int numFlattenedCols

numUnFlattenedCols

private int numUnFlattenedCols

clusterToRootPageIdParamIdMap

private Map<FemLocalIndex,Integer> clusterToRootPageIdParamIdMap

ordinalToClusterMap

private Map<Integer,FemLocalIndex> ordinalToClusterMap
Constructor Detail

LcsIndexGuide

LcsIndexGuide(FarragoTypeFactory typeFactory,
              CwmColumnSet table,
              List<FemLocalIndex> clusteredIndexes)
Construct an IndexGuide using a specific list of clustered indexes

Parameters:
typeFactory -
table - the column store table
clusteredIndexes - list of clustered indexes

LcsIndexGuide

LcsIndexGuide(FarragoTypeFactory typeFactory,
              CwmColumnSet table)
Construct an IndexGuide using the default list of indexes

Parameters:
typeFactory -
table - the column store table

LcsIndexGuide

LcsIndexGuide(FarragoTypeFactory typeFactory,
              CwmColumnSet table,
              FemLocalIndex unclusteredIndex)
Construct an IndexGuide using an unclustered index

Parameters:
typeFactory -
table - the column store table
unclusteredIndex - an unclustered index
Method Detail

getIndexCoverageSet

public 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.

Parameters:
repos - repository
index - the specified index
candidateIndexes - candidate indexes
singleMatch - if true, find only the first candidate index that covers each column in the specified index; otherwise, find all candidate indexes that cover each column
requireNonEmpty - if true, the return list must be non-empty
Returns:
the list of indexes from the candidate list covering the specified index

getFlattenedRowType

public RelDataType getFlattenedRowType()
Returns:
the flattened row type for the indexed table

createClusterMap

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. E.g.,


 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 }

 

Parameters:
clusteredIndexes - ordered list of clusters

addClusterCols

private void addClusterCols(int colOrdinal)
Flattens a column and adds an entry for each subcolumn within the flattened column into clusterMap

Parameters:
colOrdinal - 0-based ordinal representing an unflattened column

getNumFlattenedSubCols

public int getNumFlattenedSubCols(int colOrdinal)
Returns number of subcolumns corresponding to a column once it is flattened.

Parameters:
colOrdinal - 0-based ordinal representing an unflattened column
Returns:
number of subcolumns in flattened column

getNumFlattenedClusterCols

public int getNumFlattenedClusterCols(FemLocalIndex index)
Retrieves number of columns in a clustered index

Parameters:
index - the clustered index
Returns:
number of columns

getNumFlattenedClusterCols

public int getNumFlattenedClusterCols()
Retrieves number of columns in all the clustered indexes accessed

Returns:
number of columns

getClusterTupleDesc

public FemTupleDescriptor getClusterTupleDesc(FemLocalIndex index)
Creates a tuple descriptor corresponding to a clustered index

Parameters:
index - clustered index
Returns:
tuple descriptor for cluster

computeProjectedColumns

public Integer[] computeProjectedColumns(Integer[] origProj)
Creates a projection list relative to the cluster columns

Parameters:
origProj - original projection list relative to the table; if null, project all columns from table
Returns:
projection list created

computeProjectedColumn

private Integer computeProjectedColumn(int i)

testIndexCoverage

public boolean testIndexCoverage(FemLocalIndex index,
                                 Integer[] projection)
Determines if an index is referenced by projection list

Parameters:
index - clustered index being checked
projection - array of flattened ordinals of projected columns
Returns:
true if at least one column in the clustered index is referenced in the projection list

testColumnCoverage

public boolean testColumnCoverage(FemAbstractColumn column,
                                  Integer[] projection)
Determines if a column is referenced by projection list.

Parameters:
column - column being checked
projection - array of flattened ordinals of projected columns
Returns:
true if the column (or one of its sub-fields for a column with structured type) is referenced in the projection list

flattenOrdinal

private int flattenOrdinal(int columnOrdinal)

unFlattenOrdinal

public int unFlattenOrdinal(int fieldOrdinal)
Returns the unflattened column ordinal corresponding to a flattened field ordinal

Parameters:
fieldOrdinal - flattened ordinal
Returns:
unflattened ordinal

createClusteredBTreeTupleDesc

public FemTupleDescriptor createClusteredBTreeTupleDesc()
Creates a tuple descriptor for the BTree index corresponding to a clustered index. For LCS clustered indexes, the stored tuple is always the same: [RID, PageId]; and the key is just the RID. In Fennel, both attributes are represented as 64-bit ints.

Returns:
btree tuple descriptor

appendInt64Attr

private void appendInt64Attr(FemTupleDescriptor tupleDesc)

appendBitmapAttr

private void appendBitmapAttr(FemTupleDescriptor tupleDesc)

createClusteredBTreeRidDesc

public FemTupleProjection createClusteredBTreeRidDesc()
Creates a tuple projection for the RID attribute of the BTree index corresponding to a clustered index.

Returns:
RID attribute projection
See Also:
createClusteredBTreeTupleDesc()

createClusteredBTreePageIdDesc

public FemTupleProjection createClusteredBTreePageIdDesc()
Creates a tuple projection for the PageId attribute of the BTree index tuple corresponding to a clustered index.

Returns:
PageId attribute projection
See Also:
createClusteredBTreeTupleDesc()

createUnclusteredBTreeTupleDesc

public FemTupleDescriptor createUnclusteredBTreeTupleDesc(FemLocalIndex index)
Creates a tuple descriptor for the BTree index corresponding to an unclustered index.

For LCS unclustered indexes, the stored tuple is [K1, K2, ..., RID, BITMAP, BITMAP], and the key is [K1, K2, ..., RID]

Parameters:
index - unclustered index
Returns:
btree tuple descriptor

createUnclusteredBTreeBitmapDesc

public FemTupleDescriptor createUnclusteredBTreeBitmapDesc()

createUnclusteredBTreeKeyProj

public FemTupleProjection createUnclusteredBTreeKeyProj(FemLocalIndex index)
Creates a tuple projection for the key attributes of the BTree index corresponding to an unclustered index.

Parameters:
index - unclustered index
Returns:
key attribute projection
See Also:
createUnclusteredBTreeTupleDesc(net.sf.farrago.fem.med.FemLocalIndex)

createUnclusteredBTreeBitmapProj

public FemTupleProjection createUnclusteredBTreeBitmapProj(FemLocalIndex index)

createUnclusteredRowType

public RelDataType createUnclusteredRowType(FemLocalIndex index,
                                            Integer[] proj)
Creates a row data type for a projection of an index. The projection may include both key columns and bitmap columns.

Parameters:
index - the index to be projected
proj - a projection on the index
Returns:
row data type based on projections of an index
See Also:
createUnclusteredBTreeTupleDesc(net.sf.farrago.fem.med.FemLocalIndex)

createSplicerErrorType

public RelDataType createSplicerErrorType(FemLocalIndex uniqueIndex)
Creates the row data type of error records produced by a splicer when there unique constraint violations. The row type generated contains the same column types as the btree key [K1, K2, ..., RID]

Parameters:
uniqueIndex - the unique index updated by the splicer
Returns:
row data type for splicer error records

newSplitter

FemSplitterStreamDef newSplitter(RelDataType outputRowType)

newBarrier

FemBarrierStreamDef newBarrier(RelDataType outputRowType,
                               BarrierReturnMode returnMode,
                               int deleteRowCountParamId)

newClusterAppend

FemLcsClusterAppendStreamDef newClusterAppend(FennelRel rel,
                                              FemLocalIndex clusterIndex,
                                              boolean hasIndexes,
                                              int rootPageIdParamId,
                                              int clusterPos,
                                              boolean alterTable)
Creates a cluster append stream for a specific clustered index.

Parameters:
rel - the RelNode that the cluster belongs to
clusterIndex - the clustered index
hasIndexes - if true, indexes will also be inserted into as part of execution of this cluster append
rootPageIdParamId - the dynamic parameter id of the root page of the cluster; only set > 0 if this is a cluster replace
clusterPos - 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 replaced
alterTable - whether we are doing ALTER TABLE ADD COLUMN
Returns:
the constructed cluster append stream

newRowScan

FemLcsRowScanStreamDef newRowScan(LcsRowScanRelBase rel,
                                  Integer[] projectedColumns,
                                  Integer[] residualColumns)

newBitmapAppend

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


newGenerator

private FemLbmGeneratorStreamDef newGenerator(FennelRel rel,
                                              FemLocalIndex index,
                                              boolean createIndex,
                                              int insertRowCountParamId)

newSorter

FemSortingStreamDef newSorter(FemLocalIndex index,
                              Double estimatedNumRows,
                              boolean ridOnly,
                              boolean earlyClose)
Creates a sort streamDef for sorting bitmap entries.

Parameters:
index - index corresponding to the bitmap entries that will be sorted
estimatedNumRows - estimated number of input rows into the sort
ridOnly - true if this sort will only be used to sort single rid values
earlyClose - 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
Returns:
the created sort streamDef

newSplicer

FemLbmSplicerStreamDef newSplicer(FennelRel rel,
                                  FemLocalIndex index,
                                  FemLocalIndex deletionIndex,
                                  int insertRowCountParamId,
                                  int writeRowCountParamId,
                                  boolean createNewIndex)

newIndexScan

FemIndexScanDef newIndexScan(FennelRel rel,
                             FemLocalIndex index,
                             Integer[] projectedColumns)

newIndexSearch

FemLbmSearchStreamDef newIndexSearch(FennelRel rel,
                                     FemLocalIndex index,
                                     boolean isUniqueKey,
                                     boolean isOuter,
                                     Integer[] inputKeyProj,
                                     Integer[] inputJoinProj,
                                     Integer[] inputDirectiveProj,
                                     Integer[] outputProj,
                                     FennelDynamicParamId startRidParamId,
                                     FennelDynamicParamId rowLimitParamId)

defineIndexScan

private void defineIndexScan(FemIndexScanDef scanStream,
                             FennelRel rel,
                             FemLocalIndex index,
                             Integer[] outputProj)

defineIndexStream

private void defineIndexStream(FemIndexStreamDef indexStream,
                               FennelRel rel,
                               FemLocalIndex index,
                               boolean clustered,
                               boolean write,
                               int rootPageIdParamId)

defineIndexAccessor

private void defineIndexAccessor(FemIndexAccessorDef indexAccessor,
                                 FennelRel rel,
                                 FemLocalIndex index,
                                 boolean clustered,
                                 boolean write,
                                 boolean readOnlyCommittedData,
                                 int rootPageIdParamId)

defineScanStream

private void defineScanStream(FemLcsRowScanStreamDef scanStream,
                              FennelRel rel,
                              boolean write)
Fills in a stream definition for this scan.

Parameters:
scanStream - stream definition to fill in
rel - the RelNode containing the cluster
write - whether the cluster will be written

failIfIndexInvalid

private void failIfIndexInvalid(FemLocalIndex index)

defineClusterScan

private void defineClusterScan(FemLocalIndex index,
                               FennelRel rel,
                               FemLcsClusterScanDef clusterScan,
                               boolean write,
                               int rootPageIdParamId)
Fills in a cluster scan def for this scan

Parameters:
index - clustered index corresponding to this can
rel - the RelNode containing the cluster
clusterScan - clustered scan to fill in
write - true if the cluster will be written as well as read
rootPageIdParamId - if > 0, the dynamic parameter that will supply the value of the root pageId of the cluster

getUnclusteredInputs

RexNode[] getUnclusteredInputs(RexBuilder builder)
Creates input values for a bitmap index generator

The inputs are two columns: [rowCount startRid]


getUnclusteredInputType

RelDataType getUnclusteredInputType()

getUnclusteredInputDesc

FemTupleDescriptor getUnclusteredInputDesc()

createUnclusteredBitmapRowType

public RelDataType createUnclusteredBitmapRowType()
Creates a bitmap data row type, [SRID, SegmentDir, Segments]


createUnclusteredBitmapTupleDesc

public FemTupleDescriptor createUnclusteredBitmapTupleDesc()
Creates a tuple descriptor for bitmap data


createUnclusteredBitmapKeyProj

public FemTupleProjection createUnclusteredBitmapKeyProj()
Creates a key projection for bitmap data. The only key column is the first column, SRID


newBitmapSorter

FemSortingStreamDef newBitmapSorter()

setBitmapStreamParams

private void setBitmapStreamParams(FemLbmBitOpStreamDef bitOpStream,
                                   FennelDynamicParamId startRidParamId,
                                   FennelDynamicParamId rowLimitParamId)

newBitmapIntersect

FemLbmIntersectStreamDef newBitmapIntersect(FennelDynamicParamId startRidParamId,
                                            FennelDynamicParamId rowLimitParamId)

newBitmapMinus

FemLbmMinusStreamDef newBitmapMinus(FennelDynamicParamId startRidParamId,
                                    FennelDynamicParamId rowLimitParamId,
                                    RelNode child)

createMinusOfDeletionIndex

LcsIndexMinusRel createMinusOfDeletionIndex(FennelRel rel,
                                            LcsTable lcsTable,
                                            RelNode input)

createDeletionIndexScan

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. A deletion index is searched by RID.

Parameters:
rel - the rel from which this scan is being generated
lcsTable - the table whose deletion index is to be scanned
startRidParamId - start rid parameter for the index search
rowLimitParamId - row limit parameter for the index search
fullScan - true if deletion index will be used with a full table scan
Returns:
the created index search

createDelIndexScanInput

private RelNode createDelIndexScanInput(FennelRel rel,
                                        boolean fullScan)
Creates the RelNode that corresponds to the key input into the deletion index scan. The type of input depends on whether or not a full scan is being done on the deletion index.

Parameters:
rel - the original rel from which this rel is being generated
fullScan - true if a full scan will be done on the deletion index
Returns:
the created RelNode

getIndexColumn

private FemAbstractColumn getIndexColumn(FemLocalIndex index,
                                         int position)

findSemiJoinIndex

public FemLocalIndex findSemiJoinIndex(List<Integer> semiJoinKeys,
                                       List<Integer> bestKeyList)
Determines the best index to be used to process a semijoin

Parameters:
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
Returns:
best index, if available; else null is returned

matchIndexKeys

public int matchIndexKeys(FemLocalIndex index,
                          List<Integer> keys,
                          Integer[] keyOrder)
Determines if an index matches a set of keys representing RexInputRefs

Parameters:
index - index being matched against
keys - keys representing the inputRefs that need to be matched against the index
keyOrder - returns the positions of the matching RexInputRefs in the order in which they match the index
Returns:
number of matching keys

createResidualClusterList

public List<FemLocalIndex> createResidualClusterList(Integer[] residualColumns)
Retrieves a list of clusters corresponding to clusters containing residual filtered columns. The list of clusters is returned in the same order as the residual filtered columns. Note that the number of clusters may be smaller than the number of residual columns, if a cluster has more than one column.

Parameters:
residualColumns - array of flattened ordinals corresponding to the columns that have residual filters
Returns:
the list of residual column clusters