org.eigenbase.rel.metadata
Class ReflectiveRelMetadataProvider

java.lang.Object
  extended by org.eigenbase.rel.metadata.ReflectiveRelMetadataProvider
All Implemented Interfaces:
RelMetadataProvider, ReflectiveVisitor
Direct Known Subclasses:
FarragoRelMetadataProvider, FarragoTestPersonalityFactory.FarragoTestRelMetadataProvider, FtrsDataServer.FtrsRelMetadataProvider, LoptMetadataProvider, MedJdbcMetadataProvider, RelMdColumnOrigins, RelMdColumnUniqueness, RelMdDistinctRowCount, RelMdExplainVisibility, RelMdPercentageOriginalRows, RelMdPopulationSize, RelMdRowCount, RelMdSelectivity, RelMdUniqueKeys

public abstract class ReflectiveRelMetadataProvider
extends Object
implements RelMetadataProvider, ReflectiveVisitor

ReflectiveRelMetadataProvider provides an abstract base for reflective implementations of the RelMetadataProvider interface. For an example, see DefaultRelMetadataProvider.

TODO jvs 28-Mar-2006: most of this should probably be refactored into ReflectUtil.

Version:
$Id: //open/dev/farrago/src/org/eigenbase/rel/metadata/ReflectiveRelMetadataProvider.java#9 $
Author:
John V. Sichi

Field Summary
private  Map<String,List<Class>> parameterTypeMap
           
private  ReflectiveVisitDispatcher<ReflectiveRelMetadataProvider,RelNode> visitDispatcher
           
 
Constructor Summary
protected ReflectiveRelMetadataProvider()
          Creates a ReflectiveRelMetadataProvider.
 
Method Summary
 Object getRelMetadata(RelNode rel, String metadataQueryName, Object[] args)
          Retrieves metadata about a relational expression.
protected  void mapParameterTypes(String metadataQueryName, List<Class> parameterTypes)
          Maps the parameter type signature to look up for a given metadata query.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

parameterTypeMap

private final Map<String,List<Class>> parameterTypeMap

visitDispatcher

private final ReflectiveVisitDispatcher<ReflectiveRelMetadataProvider,RelNode> visitDispatcher
Constructor Detail

ReflectiveRelMetadataProvider

protected ReflectiveRelMetadataProvider()
Creates a ReflectiveRelMetadataProvider.

Method Detail

mapParameterTypes

protected void mapParameterTypes(String metadataQueryName,
                                 List<Class> parameterTypes)
Maps the parameter type signature to look up for a given metadata query.

Parameters:
metadataQueryName - name of metadata query to map
parameterTypes - argument types (beyond the overloaded rel type) to map

getRelMetadata

public Object getRelMetadata(RelNode rel,
                             String metadataQueryName,
                             Object[] args)
Description copied from interface: RelMetadataProvider
Retrieves metadata about a relational expression.

Specified by:
getRelMetadata in interface RelMetadataProvider
Parameters:
rel - relational expression of interest
metadataQueryName - name of metadata query to invoke
args - arguments to metadata query (expected number and type depend on query name; must have well-defined hashCode/equals for use by caching); null can be used instead of empty array
Returns:
metadata result (actual type depends on query name), or null if the provider cannot answer the given query/rel combination; it is better to return null than to return a possibly incorrect answer