org.eigenbase.rel.metadata
Class CachingRelMetadataProvider

java.lang.Object
  extended by org.eigenbase.rel.metadata.CachingRelMetadataProvider
All Implemented Interfaces:
RelMetadataProvider

public class CachingRelMetadataProvider
extends Object
implements RelMetadataProvider

CachingRelMetadataProvider implements the RelMetadataProvider interface by caching results from an underlying provider.

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

Nested Class Summary
private static class CachingRelMetadataProvider.CacheEntry
           
 
Field Summary
private  Map<List,CachingRelMetadataProvider.CacheEntry> cache
           
private  RelOptPlanner planner
           
private  RelMetadataProvider underlyingProvider
           
 
Constructor Summary
CachingRelMetadataProvider(RelMetadataProvider underlyingProvider, RelOptPlanner planner)
           
 
Method Summary
 Object getRelMetadata(RelNode rel, String metadataQueryName, Object[] args)
          Retrieves metadata about a relational expression.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cache

private final Map<List,CachingRelMetadataProvider.CacheEntry> cache

underlyingProvider

private final RelMetadataProvider underlyingProvider

planner

private final RelOptPlanner planner
Constructor Detail

CachingRelMetadataProvider

public CachingRelMetadataProvider(RelMetadataProvider underlyingProvider,
                                  RelOptPlanner planner)
Method Detail

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