public class ReflectiveRelMetadataProvider extends Object implements RelMetadataProvider, ReflectiveVisitor
RelMetadataProvider interface that dispatches
metadata methods to methods on a given object via reflection.
The methods on the target object must be public and non-static, and have
the same signature as the implemented metadata method except for an
additional first parameter of type RelNode or a sub-class. That
parameter gives this provider an indication of that relational expressions it
can handle.
For an example, see RelMdColumnOrigins.SOURCE.
| Modifier | Constructor and Description |
|---|---|
protected |
ReflectiveRelMetadataProvider(ConcurrentMap<Class<RelNode>,UnboundMetadata> map,
Class<? extends Metadata> metadataClass0,
com.google.common.collect.Multimap<Method,MetadataHandler<?>> handlerMap,
Class<? extends MetadataHandler<?>> handlerClass)
Creates a ReflectiveRelMetadataProvider.
|
| Modifier and Type | Method and Description |
|---|---|
<M extends Metadata> |
apply(Class<? extends RelNode> relClass)
Deprecated.
|
<M extends Metadata> |
apply(Class<? extends RelNode> relClass,
Class<? extends M> metadataClass)
Deprecated.
|
List<MetadataHandler<?>> |
handlers(Class<? extends MetadataHandler<?>> handlerClass)
Retrieves a list of
MetadataHandler for implements a particular
MetadataHandler.class. |
<M extends Metadata> |
handlers(MetadataDef<M> def)
Deprecated.
|
static <M extends Metadata> |
reflectiveSource(MetadataHandler<? extends M> handler,
Class<? extends MetadataHandler<M>> handlerClass) |
static RelMetadataProvider |
reflectiveSource(MetadataHandler target,
Method... methods)
Deprecated.
|
static RelMetadataProvider |
reflectiveSource(Method method,
MetadataHandler target)
Deprecated.
|
protected ReflectiveRelMetadataProvider(ConcurrentMap<Class<RelNode>,UnboundMetadata> map, Class<? extends Metadata> metadataClass0, com.google.common.collect.Multimap<Method,MetadataHandler<?>> handlerMap, Class<? extends MetadataHandler<?>> handlerClass)
map - MapmetadataClass0 - Metadata classhandlerMap - Methods handled and the objects to call them on@Deprecated public static RelMetadataProvider reflectiveSource(Method method, MetadataHandler target)
RelMetadataProvider that scans for
methods with a preceding argument.
For example, BuiltInMetadata.Selectivity has a method
BuiltInMetadata.Selectivity.getSelectivity(RexNode).
A class
class RelMdSelectivity { public Double getSelectivity(Union rel, RexNode predicate) { } public Double getSelectivity(Filter rel, RexNode predicate) { }
provides implementations of selectivity for relational expressions
that extend Union
or Filter.
@Deprecated public static RelMetadataProvider reflectiveSource(MetadataHandler target, Method... methods)
public static <M extends Metadata> RelMetadataProvider reflectiveSource(MetadataHandler<? extends M> handler, Class<? extends MetadataHandler<M>> handlerClass)
@Deprecated public <M extends Metadata> com.google.common.collect.Multimap<Method,MetadataHandler<M>> handlers(MetadataDef<M> def)
handlers in interface RelMetadataProviderpublic List<MetadataHandler<?>> handlers(Class<? extends MetadataHandler<?>> handlerClass)
RelMetadataProviderMetadataHandler for implements a particular
MetadataHandler.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.handlers in interface RelMetadataProvider@Deprecated public <M extends Metadata> @Nullable 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 metadata@Deprecated public <M extends Metadata> @Nullable UnboundMetadata<M> apply(Class<? extends RelNode> relClass)
Copyright © 2012-2022 Apache Software Foundation. All Rights Reserved.