Package org.apache.calcite.rel.metadata
Class ChainedRelMetadataProvider
java.lang.Object
org.apache.calcite.rel.metadata.ChainedRelMetadataProvider
- All Implemented Interfaces:
RelMetadataProvider
- Direct Known Subclasses:
DefaultRelMetadataProvider
Implementation of the
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.
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
ChainedRelMetadataProvider
(com.google.common.collect.ImmutableList<RelMetadataProvider> providers) Creates a chain. -
Method Summary
Modifier and TypeMethodDescription<@Nullable M extends @Nullable Metadata>
@Nullable UnboundMetadata<M>Deprecated.boolean
List<MetadataHandler<?>>
handlers
(Class<? extends MetadataHandler<?>> handlerClass) Retrieves a list ofMetadataHandler
for implements a particularMetadataHandler
.class.<M extends Metadata>
com.google.common.collect.Multimap<Method,MetadataHandler<M>> handlers
(MetadataDef<M> def) Deprecated.int
hashCode()
static RelMetadataProvider
of
(List<RelMetadataProvider> list) Creates a chain.
-
Constructor Details
-
ChainedRelMetadataProvider
protected ChainedRelMetadataProvider(com.google.common.collect.ImmutableList<RelMetadataProvider> providers) Creates a chain.
-
-
Method Details
-
equals
-
hashCode
public int hashCode() -
apply
@Deprecated public <@Nullable M extends @Nullable Metadata> @Nullable UnboundMetadata<M> apply(Class<? extends RelNode> relClass, Class<? extends @Nullable M> metadataClass) Deprecated.Description copied from interface:RelMetadataProvider
Retrieves metadata of a particular type and for a particular sub-class of relational expression.The 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);
- Specified by:
apply
in interfaceRelMetadataProvider
- Parameters:
relClass
- Type of relational expressionmetadataClass
- Type of metadata- Returns:
- Function that will field a metadata instance; or null if this provider cannot supply metadata of this type
-
handlers
@Deprecated public <M extends Metadata> com.google.common.collect.Multimap<Method,MetadataHandler<M>> handlers(MetadataDef<M> def) Deprecated.- Specified by:
handlers
in interfaceRelMetadataProvider
-
handlers
Description copied from interface:RelMetadataProvider
Retrieves a list ofMetadataHandler
for implements a particularMetadataHandler
.class. The resolution order is specificity of the relNode class, with preference given to handlers that occur earlier in the list. For instance, given a return list of {A, B, C} where A implements RelNode and Scan, B implements Scan, and C implements LogicalScan and Filter. Scan dispatches to a.method(Scan) LogicalFilter dispatches to c.method(Filter). LogicalScan dispatches to c.method(LogicalScan). Aggregate dispatches to a.method(RelNode). The behavior is undefined if the class hierarchy for dispatching is not a tree.- Specified by:
handlers
in interfaceRelMetadataProvider
-
of
Creates a chain.
-