public class ChainedRelMetadataProvider extends Object implements RelMetadataProvider
RelMetadataProvider
interface via the
Glossary.CHAIN_OF_RESPONSIBILITY_PATTERN.
When a consumer calls the apply(java.lang.Class<? extends org.apache.calcite.rel.RelNode>, java.lang.Class<? extends org.apache.calcite.rel.metadata.Metadata>) method to ask for a provider
for a particular type of RelNode and Metadata, scans the list
of underlying providers.
| Modifier | Constructor and Description |
|---|---|
protected |
ChainedRelMetadataProvider(com.google.common.collect.ImmutableList<RelMetadataProvider> providers)
Creates a chain.
|
| Modifier and Type | Method and Description |
|---|---|
com.google.common.base.Function<RelNode,Metadata> |
apply(Class<? extends RelNode> relClass,
Class<? extends Metadata> metadataClass)
Retrieves metadata of a particular type and for a particular sub-class
of relational expression.
|
static RelMetadataProvider |
of(List<RelMetadataProvider> list)
Creates a chain.
|
protected ChainedRelMetadataProvider(com.google.common.collect.ImmutableList<RelMetadataProvider> providers)
public com.google.common.base.Function<RelNode,Metadata> apply(Class<? extends RelNode> relClass, Class<? extends Metadata> metadataClass)
RelMetadataProviderThe object returned is a function. It can be applied to a relational expression of the given type to create a metadata object.
For example, you might call
RelMetadataProvider provider; LogicalFilter filter; RexNode predicate; Function<RelNode, Metadata> function = provider.apply(LogicalFilter.class, Selectivity.class}; Selectivity selectivity = function.apply(filter); Double d = selectivity.selectivity(predicate);
apply in interface RelMetadataProviderrelClass - Type of relational expressionmetadataClass - Type of metadatapublic static RelMetadataProvider of(List<RelMetadataProvider> list)
Copyright © 2012–2015 The Apache Software Foundation. All rights reserved.