com.lucidera.lcs
Class LcsRowScanRelBase

java.lang.Object
  extended by org.eigenbase.rel.AbstractRelNode
      extended by net.sf.farrago.fennel.rel.FennelMultipleRel
          extended by com.lucidera.lcs.LcsRowScanRelBase
All Implemented Interfaces:
Cloneable, FennelRel, RelNode
Direct Known Subclasses:
LcsRowScanRel, LcsSamplingRowScanRel

public abstract class LcsRowScanRelBase
extends FennelMultipleRel


Field Summary
(package private)  List<FemLocalIndex> clusteredIndexes
           
(package private)  RelOptConnection connection
           
private  LcsIndexGuide indexGuide
           
(package private)  double inputSelectivity
          Selectivity from filtering using the inputs.
(package private)  boolean isFullScan
          Types of scans to perform.
(package private)  LcsTable lcsTable
           
(package private)  Integer[] projectedColumns
          Array of 0-based flattened column ordinals to project; if null, project all columns.
(package private)  Integer[] residualColumns
          Array of 0-based flattened filter column ordinals.
 
Fields inherited from class net.sf.farrago.fennel.rel.FennelMultipleRel
inputs
 
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
LcsRowScanRelBase(RelOptCluster cluster, RelNode[] children, LcsTable lcsTable, List<FemLocalIndex> clusteredIndexes, RelOptConnection connection, Integer[] projectedColumns, boolean isFullScan, Integer[] resCols, double inputSelectivity)
          Creates a new LcsRowScanRel object.
 
Method Summary
 RelOptCost computeCost(RelOptPlanner planner, double dRows)
           
 RelOptCost computeSelfCost(RelOptPlanner planner)
          Returns the cost of this plan (not including children).
protected  FemLcsRowScanStreamDef createScanStream(FennelRelImplementor implementor)
           
protected  RelDataType deriveRowType()
           
 void explain(RelOptPlanWriter pw)
           
protected  void explain(RelOptPlanWriter pw, String[] subclassTerms, Object[] subclassValues)
          Explains this LcsRowScanRelBase, appending the additional terms and values from a subclass.
 List<FemLocalIndex> getClusteredIndexes()
           
 RelFieldCollation[] getCollations()
          TODO: jhyde, 2006/3/28: unify with RelNode.getCollationList()
 FemAbstractColumn getColumnForFieldAccess(int fieldOrdinal)
          Gets the column referenced by a FieldAccess relative to this scan.
 RelOptConnection getConnection()
           
 LcsIndexGuide getIndexGuide()
           
 double getInputSelectivity()
           
 int getOriginalColumnOrdinal(int projOrdinal)
          Gets the original column pos(relative to the table) at projOrdinal
 int getProjectedColumnOrdinal(int origColOrdinal)
          Returns the projected column ordinal for a given column ordinal, relative to this scan.
 Integer[] getProjectedColumns()
           
 double getRows()
          Returns an estimate of the number of rows this relational expression will return.
 RelOptTable getTable()
          If this relational expression represents an access to a table, returns that table, otherwise returns null.
 boolean hasResidualFilters()
           
 Object implementFennelChild(FennelRelImplementor implementor)
          Visits this relational expression as part of the implementation process.
 boolean isFullScan()
           
 FemExecutionStreamDef toStreamDef(FennelRelImplementor implementor)
          Converts this relational expression to FemExecutionStreamDef form.
 
Methods inherited from class net.sf.farrago.fennel.rel.FennelMultipleRel
getFarragoTypeFactory, getInputs, replaceInput
 
Methods inherited from class org.eigenbase.rel.AbstractRelNode
childrenAccept, clone, cloneTraits, collectVariablesSet, collectVariablesUsed, computeDigest, getChildExps, getCluster, getCollationList, getConvention, getCorrelVariable, getDescription, getDigest, getExpectedInputRowType, getId, getInput, getOrCreateCorrelVariable, getQuery, getRelTypeName, getRowType, 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
childrenAccept, clone, collectVariablesSet, collectVariablesUsed, getChildExps, getCluster, getCollationList, getConvention, getCorrelVariable, getDescription, getDigest, getExpectedInputRowType, getId, getInput, getOrCreateCorrelVariable, getQuery, getRelTypeName, getRowType, getTraits, getVariablesStopped, isAccessTo, isDistinct, isValid, onRegister, recomputeDigest, registerCorrelVariable, setCorrelVariable
 

Field Detail

indexGuide

private LcsIndexGuide indexGuide

clusteredIndexes

final List<FemLocalIndex> clusteredIndexes

lcsTable

final LcsTable lcsTable

connection

RelOptConnection connection

projectedColumns

final Integer[] projectedColumns
Array of 0-based flattened column ordinals to project; if null, project all columns. Note that these ordinals are relative to the table.


isFullScan

boolean isFullScan
Types of scans to perform.


residualColumns

final Integer[] residualColumns
Array of 0-based flattened filter column ordinals.


inputSelectivity

double inputSelectivity
Selectivity from filtering using the inputs. Possible inputs are index searches and residual filter values.

Constructor Detail

LcsRowScanRelBase

public LcsRowScanRelBase(RelOptCluster cluster,
                         RelNode[] children,
                         LcsTable lcsTable,
                         List<FemLocalIndex> clusteredIndexes,
                         RelOptConnection connection,
                         Integer[] projectedColumns,
                         boolean isFullScan,
                         Integer[] resCols,
                         double inputSelectivity)
Creates a new LcsRowScanRel object.

Parameters:
cluster - RelOptCluster for this rel
children - children inputs into the row scan
lcsTable - table being scanned
clusteredIndexes - list of clusters to use for table access, in the order in which the clusters are to be scanned
connection - connection
projectedColumns - array of 0-based table-relative column ordinals, or null to project all columns
isFullScan - true if doing a full scan of the table
resCols - residual filter columns (0-length array if none)
Method Detail

computeSelfCost

public RelOptCost computeSelfCost(RelOptPlanner planner)
Description copied from interface: RelNode
Returns the cost of this plan (not including children). The base implementation throws an error; derived classes should override.

NOTE jvs 29-Mar-2006: Don't call this method directly. Instead, use RelMetadataQuery.getNonCumulativeCost(org.eigenbase.rel.RelNode), which gives plugins a chance to override the rel's default ideas about cost.

Specified by:
computeSelfCost in interface RelNode
Overrides:
computeSelfCost in class AbstractRelNode

getRows

public double getRows()
Description copied from interface: RelNode
Returns an estimate of the number of rows this relational expression will return.

NOTE jvs 29-Mar-2006: Don't call this method directly. Instead, use RelMetadataQuery.getRowCount(org.eigenbase.rel.RelNode), which gives plugins a chance to override the rel's default ideas about row count.

Specified by:
getRows in interface RelNode
Overrides:
getRows in class AbstractRelNode

deriveRowType

protected RelDataType deriveRowType()
Overrides:
deriveRowType in class FennelMultipleRel

explain

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

explain

protected void explain(RelOptPlanWriter pw,
                       String[] subclassTerms,
                       Object[] subclassValues)
Explains this LcsRowScanRelBase, appending the additional terms and values from a subclass.

Parameters:
pw - RelOptPrintWriter, as in explain(RelOptPlanWriter)
subclassTerms - additional terms from a subclass
subclassValues - additional values from a subclass

implementFennelChild

public Object implementFennelChild(FennelRelImplementor implementor)
Description copied from interface: FennelRel
Visits this relational expression as part of the implementation process. Fennel relational expressions are implemented in a two-phase process: first call this method, then call FennelRel.toStreamDef(net.sf.farrago.query.FennelRelImplementor).

Specified by:
implementFennelChild in interface FennelRel
Overrides:
implementFennelChild in class FennelMultipleRel

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

createScanStream

protected FemLcsRowScanStreamDef createScanStream(FennelRelImplementor implementor)

getIndexGuide

public LcsIndexGuide getIndexGuide()

computeCost

public RelOptCost computeCost(RelOptPlanner planner,
                              double dRows)

getColumnForFieldAccess

public FemAbstractColumn getColumnForFieldAccess(int fieldOrdinal)
Gets the column referenced by a FieldAccess relative to this scan.

Parameters:
fieldOrdinal - 0-based ordinal of an output field of the scan
Returns:
underlying column if the the column is a real one; otherwise, null is returned (e.g., if the column corresponds to the rid column)

getOriginalColumnOrdinal

public int getOriginalColumnOrdinal(int projOrdinal)
Gets the original column pos(relative to the table) at projOrdinal

Parameters:
projOrdinal - 0-based ordinal of an output field of the scan
Returns:
if table has projection, return the original column pos relative to the table. Otherwise, return the same value as the input.

getProjectedColumnOrdinal

public int getProjectedColumnOrdinal(int origColOrdinal)
Returns the projected column ordinal for a given column ordinal, relative to this scan.

Parameters:
origColOrdinal - original column ordinal (without projection)
Returns:
column ordinal corresponding to the column in the projection for this scan; -1 if column is not in the projection list

getTable

public RelOptTable getTable()
Description copied from interface: RelNode
If this relational expression represents an access to a table, returns that table, otherwise returns null.

Specified by:
getTable in interface RelNode
Overrides:
getTable in class AbstractRelNode

getConnection

public RelOptConnection getConnection()

getCollations

public RelFieldCollation[] getCollations()
Description copied from interface: FennelRel

TODO: jhyde, 2006/3/28: unify with RelNode.getCollationList()

Specified by:
getCollations in interface FennelRel
Overrides:
getCollations in class FennelMultipleRel
Returns:
the sort order produced by this FennelRel, or an empty array if the output is not guaranteed to be in any particular order.

getInputSelectivity

public double getInputSelectivity()

hasResidualFilters

public boolean hasResidualFilters()

getClusteredIndexes

public List<FemLocalIndex> getClusteredIndexes()

getProjectedColumns

public Integer[] getProjectedColumns()

isFullScan

public boolean isFullScan()