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 M>) method to ask for a provider
for a particular type of RelNode and Metadata, scans the list
of underlying providers.
| Modifier and Type | Class and Description |
|---|---|
private static class |
ChainedRelMetadataProvider.ChainedInvocationHandler
Invocation handler that calls a list of
Metadata objects,
returning the first non-null value. |
| Modifier and Type | Field and Description |
|---|---|
private com.google.common.collect.ImmutableList<RelMetadataProvider> |
providers |
| Modifier | Constructor and Description |
|---|---|
protected |
ChainedRelMetadataProvider(com.google.common.collect.ImmutableList<RelMetadataProvider> providers)
Creates a chain.
|
| Modifier and Type | Method and Description |
|---|---|
<M extends Metadata> |
apply(Class<? extends RelNode> relClass,
Class<? extends M> metadataClass)
Retrieves metadata of a particular type and for a particular sub-class
of relational expression.
|
boolean |
equals(Object obj) |
<M extends Metadata> |
handlers(MetadataDef<M> def) |
int |
hashCode() |
static RelMetadataProvider |
of(List<RelMetadataProvider> list)
Creates a chain.
|
private final com.google.common.collect.ImmutableList<RelMetadataProvider> providers
protected ChainedRelMetadataProvider(com.google.common.collect.ImmutableList<RelMetadataProvider> providers)
public <M extends Metadata> UnboundMetadata<M> apply(Class<? extends RelNode> relClass, Class<? extends M> 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 <M extends Metadata> com.google.common.collect.Multimap<Method,MetadataHandler<M>> handlers(MetadataDef<M> def)
handlers in interface RelMetadataProviderpublic static RelMetadataProvider of(List<RelMetadataProvider> list)
Copyright © 2012–2018 The Apache Software Foundation. All rights reserved.