net.sf.farrago.namespace.impl
Class MedAbstractColumnMetadata

java.lang.Object
  extended by net.sf.farrago.namespace.impl.MedAbstractColumnMetadata
Direct Known Subclasses:
FarragoColumnMetadata, FtrsDataServer.FtrsColumnMetadata, LcsColumnMetadata

public abstract class MedAbstractColumnMetadata
extends Object

MedAbstractColumnMetadata is a base class that provides common logic for implementing certain metadata queries that relate to columns. Other classes should derive from this class to provide implementations specific to different data wrappers.

Version:
$Id: //open/dev/farrago/src/net/sf/farrago/namespace/impl/MedAbstractColumnMetadata.java#15 $
Author:
Zelaine Fong

Constructor Summary
MedAbstractColumnMetadata()
           
 
Method Summary
private  void addKeyCols(RelNode rel, FarragoRepos repos, List<FemAbstractColumn> keyCols, boolean checkNulls, Set<BitSet> keyList)
          Forms bitmaps representing the columns in a constraint and adds them to a set
 Boolean areColumnsUnique(RelNode rel, BitSet columns, FarragoRepos repos)
          Deprecated.  
 Boolean areColumnsUnique(RelNode rel, BitSet columns, FarragoRepos repos, boolean ignoreNulls)
           
static Boolean areColumnsUniqueForKeys(Set<BitSet> uniqueColSets, BitSet columns)
           
 Double getDistinctRowCount(RelNode rel, BitSet groupKey, RexNode predicate)
           
 Double getPopulationSize(RelNode rel, BitSet groupKey)
           
 Set<BitSet> getUniqueKeys(RelNode rel, FarragoRepos repos)
          Deprecated.  
 Set<BitSet> getUniqueKeys(RelNode rel, FarragoRepos repos, boolean ignoreNulls)
           
protected abstract  int mapColumnToField(RelNode rel, FemAbstractColumn keyCol)
          Maps a FemAbstractColumn to its corresponding field reference in the RelNode.
protected abstract  FemAbstractColumn mapFieldToColumn(RelNode rel, int fieldNo)
          Maps a field reference to its underlying FemAbstractColumn
protected abstract  int mapFieldToColumnOrdinal(RelNode rel, int fieldNo)
          Maps a field reference to the underlying column ordinal corresponding to the FemAbstractColumn representing the column.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MedAbstractColumnMetadata

public MedAbstractColumnMetadata()
Method Detail

getUniqueKeys

public Set<BitSet> getUniqueKeys(RelNode rel,
                                 FarragoRepos repos)
Deprecated. 


getUniqueKeys

public Set<BitSet> getUniqueKeys(RelNode rel,
                                 FarragoRepos repos,
                                 boolean ignoreNulls)

addKeyCols

private void addKeyCols(RelNode rel,
                        FarragoRepos repos,
                        List<FemAbstractColumn> keyCols,
                        boolean checkNulls,
                        Set<BitSet> keyList)
Forms bitmaps representing the columns in a constraint and adds them to a set

Parameters:
rel - RelNode that the constraint belongs to
repos - repository
keyCols - list of columns that make up a constraint
checkNulls - if true, don't add the columns of the constraint if the columns allow nulls
keyList - the set where the bitmaps will be added

mapColumnToField

protected abstract int mapColumnToField(RelNode rel,
                                        FemAbstractColumn keyCol)
Maps a FemAbstractColumn to its corresponding field reference in the RelNode.

Parameters:
rel - RelNode corresponding to the column
keyCol - the column whose field ordinal will be returned
Returns:
field ordinal relative to the RelNode; -1 if the column is not accessed by the RelNode

areColumnsUnique

public Boolean areColumnsUnique(RelNode rel,
                                BitSet columns,
                                FarragoRepos repos)
Deprecated. 


areColumnsUnique

public Boolean areColumnsUnique(RelNode rel,
                                BitSet columns,
                                FarragoRepos repos,
                                boolean ignoreNulls)

areColumnsUniqueForKeys

public static Boolean areColumnsUniqueForKeys(Set<BitSet> uniqueColSets,
                                              BitSet columns)

getPopulationSize

public Double getPopulationSize(RelNode rel,
                                BitSet groupKey)

mapFieldToColumnOrdinal

protected abstract int mapFieldToColumnOrdinal(RelNode rel,
                                               int fieldNo)
Maps a field reference to the underlying column ordinal corresponding to the FemAbstractColumn representing the column.

Parameters:
rel - RelNode corresponding to the column
fieldNo - the ordinal of the field reference
Returns:
column ordinal of the underlying FemAbstractColumn; -1 if the column does not map to actual FemAbstractColumn

getDistinctRowCount

public Double getDistinctRowCount(RelNode rel,
                                  BitSet groupKey,
                                  RexNode predicate)

mapFieldToColumn

protected abstract FemAbstractColumn mapFieldToColumn(RelNode rel,
                                                      int fieldNo)
Maps a field reference to its underlying FemAbstractColumn

Parameters:
rel - RelNode corresponding to the field
fieldNo - the ordinal of the field reference
Returns:
underlying FemAbstractColumn; null if no underlying FemAbstractColumn