com.lucidera.lcs
Class LcsIndexOnlyScanRel

java.lang.Object
  extended by org.eigenbase.rel.AbstractRelNode
      extended by org.eigenbase.rel.SingleRel
          extended by net.sf.farrago.fennel.rel.FennelSingleRel
              extended by net.sf.farrago.fennel.rel.FennelOptionalRel
                  extended by com.lucidera.lcs.LcsIndexOnlyScanRel
All Implemented Interfaces:
Cloneable, FennelRel, RelNode

public class LcsIndexOnlyScanRel
extends FennelOptionalRel

A relation for performing an index only scan of a table (as opposed to performing a regular row scan). It may have the benefit of a sorted result set.

Version:
$Id: //open/dev/farrago/src/com/lucidera/lcs/LcsIndexOnlyScanRel.java#11 $
Author:
John Pham

Field Summary
private  boolean fullScan
           
private  FemLocalIndex index
           
private  Integer[] inputDirectiveProj
           
private  Integer[] inputJoinProj
           
private  Integer[] inputKeyProj
           
private  boolean isOuter
           
private  boolean isUniqueKey
           
private  Integer[] projectedColumns
           
private  LcsTable table
           
 
Fields inherited from class org.eigenbase.rel.AbstractRelNode
digest, id, rowType, traits
 
Fields inherited from interface net.sf.farrago.query.FennelRel
FENNEL_EXEC_CONVENTION
 
Fields inherited from interface org.eigenbase.rel.RelNode
emptyArray
 
Constructor Summary
  LcsIndexOnlyScanRel(LcsRowScanRel rowScan, FemLocalIndex index, Integer[] proj)
          Constructs an index-only scan from a row scan.
  LcsIndexOnlyScanRel(RelOptCluster cluster, RelNode child, LcsIndexSearchRel searchRel, FemLocalIndex index, Integer[] proj)
          Constructs an index only scan based upon another index scan.
private LcsIndexOnlyScanRel(RelOptCluster cluster, RelNode child, LcsTable table, FemLocalIndex index, boolean fullScan, Integer[] projectedColumns, boolean isUniqueKey, boolean isOuter, Integer[] inputKeyProj, Integer[] inputJoinProj, Integer[] inputDirectiveProj)
          Common method for creating an index only scan
 
Method Summary
 LcsIndexOnlyScanRel clone()
          Clones this RelNode.
protected  RelDataType deriveRowType()
           
 void explain(RelOptPlanWriter pw)
           
 Integer[] getOutputProj()
           
 FemExecutionStreamDef toStreamDef(FennelRelImplementor implementor)
          Converts this relational expression to FemExecutionStreamDef form.
 
Methods inherited from class net.sf.farrago.fennel.rel.FennelOptionalRel
childrenAccept, getInputs, getRows, implementFennelChild
 
Methods inherited from class net.sf.farrago.fennel.rel.FennelSingleRel
getCollations, getFarragoTypeFactory
 
Methods inherited from class org.eigenbase.rel.SingleRel
getChild, replaceInput
 
Methods inherited from class org.eigenbase.rel.AbstractRelNode
cloneTraits, collectVariablesSet, collectVariablesUsed, computeDigest, computeSelfCost, getChildExps, getCluster, getCollationList, getConvention, getCorrelVariable, getDescription, getDigest, getExpectedInputRowType, getId, getInput, getOrCreateCorrelVariable, getQuery, getRelTypeName, getRowType, getTable, getTraits, getVariablesStopped, inheritTraitsFrom, isAccessTo, isDistinct, isValid, onRegister, recomputeDigest, register, registerCorrelVariable, setCorrelVariable, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.eigenbase.rel.RelNode
collectVariablesSet, collectVariablesUsed, computeSelfCost, getChildExps, getCluster, getCollationList, getConvention, getCorrelVariable, getDescription, getDigest, getExpectedInputRowType, getId, getInput, getOrCreateCorrelVariable, getQuery, getRelTypeName, getRowType, getTable, getTraits, getVariablesStopped, isAccessTo, isDistinct, isValid, onRegister, recomputeDigest, registerCorrelVariable, replaceInput, setCorrelVariable
 

Field Detail

fullScan

private final boolean fullScan

projectedColumns

private final Integer[] projectedColumns

isUniqueKey

private final boolean isUniqueKey

isOuter

private final boolean isOuter

inputKeyProj

private final Integer[] inputKeyProj

inputJoinProj

private final Integer[] inputJoinProj

inputDirectiveProj

private final Integer[] inputDirectiveProj

table

private final LcsTable table

index

private final FemLocalIndex index
Constructor Detail

LcsIndexOnlyScanRel

public LcsIndexOnlyScanRel(RelOptCluster cluster,
                           RelNode child,
                           LcsIndexSearchRel searchRel,
                           FemLocalIndex index,
                           Integer[] proj)
Constructs an index only scan based upon another index scan. The index scan already has an input.

Parameters:
cluster - the environment for the scan
child - the index scan input, which produces search directives
searchRel - the index search to be converted into an index only scan
index - index to be scanned, may differ from the one in searchRel
proj - keys to be projected from the index

LcsIndexOnlyScanRel

public LcsIndexOnlyScanRel(LcsRowScanRel rowScan,
                           FemLocalIndex index,
                           Integer[] proj)
Constructs an index-only scan from a row scan.

Parameters:
rowScan - row scan
index - the index to be scanned
proj - keys to be projected from the index

LcsIndexOnlyScanRel

private LcsIndexOnlyScanRel(RelOptCluster cluster,
                            RelNode child,
                            LcsTable table,
                            FemLocalIndex index,
                            boolean fullScan,
                            Integer[] projectedColumns,
                            boolean isUniqueKey,
                            boolean isOuter,
                            Integer[] inputKeyProj,
                            Integer[] inputJoinProj,
                            Integer[] inputDirectiveProj)
Common method for creating an index only scan

Parameters:
cluster - the environment for the scan
child - the child of the scan
table - the table of the index to be scanned
index - the index to be scanned
fullScan - true if the entire index is being scanned
projectedColumns - for full scans, the output projection. Should be null for searches
isUniqueKey - TODO
isOuter - TODO
inputKeyProj - for searches, the key columns
inputJoinProj - for index joins applied to searches, the input keys to be output
inputDirectiveProj - for searches, the search directive columns
Method Detail

clone

public LcsIndexOnlyScanRel clone()
Description copied from interface: RelNode
Clones this RelNode.

Traits of the RelNode must be explicitly cloned, using AbstractRelNode.inheritTraitsFrom(AbstractRelNode), as the RelNode may have traits of which it has no knowledge. Example implementation:

     public MyRelNode clone()
     {
         MyRelNode clone = new MyRelNode(...);
         clone.inheritTraitsFrom(this);
         return clone;
     }
 
N.B.: This method must be overridden whenever an existing, concrete RelNode is extended. Otherwise, calling clone() will produce a differently typed RelNode, resulting in invalid or incorrect query plans.

Specified by:
clone in interface RelNode
Specified by:
clone in class AbstractRelNode
Returns:
a clone of this RelNode

deriveRowType

protected RelDataType deriveRowType()
Overrides:
deriveRowType in class SingleRel

explain

public void explain(RelOptPlanWriter pw)
Specified by:
explain in interface RelNode
Overrides:
explain in class SingleRel

toStreamDef

public FemExecutionStreamDef toStreamDef(FennelRelImplementor implementor)
Description copied from interface: FennelRel
Converts this relational expression to FemExecutionStreamDef form. In the process, the relational expression will almost certainly call FennelRelImplementor.visitFennelChild(net.sf.farrago.query.FennelRel, int) on each of its children.

Parameters:
implementor - for generating Java code
Returns:
generated FemExecutionStreamDef

getOutputProj

public Integer[] getOutputProj()