Interface RelMetadataProvider

All Known Implementing Classes:
CachingRelMetadataProvider, ChainedRelMetadataProvider, DefaultRelMetadataProvider, JaninoRelMetadataProvider, ReflectiveRelMetadataProvider, VolcanoRelMetadataProvider

public interface RelMetadataProvider
RelMetadataProvider defines an interface for obtaining metadata about relational expressions. This interface is weakly-typed and is not intended to be called directly in most contexts; instead, use a strongly-typed facade such as RelMetadataQuery.

For background and motivation, see wiki.

If your provider is not a singleton, we recommend that you implement Object.equals(Object) and Object.hashCode() methods. This makes the cache of JaninoRelMetadataProvider more effective.

  • Method Summary

    Modifier and Type Method Description
    <@Nullable M extends @Nullable Metadata>
    @Nullable UnboundMetadata<M>
    apply​(Class<? extends RelNode> relClass, Class<? extends @Nullable M> metadataClass)
    Retrieves metadata of a particular type and for a particular sub-class of relational expression.
    <M extends Metadata>
    com.google.common.collect.Multimap<Method,​MetadataHandler<M>>
    handlers​(MetadataDef<M> def)  
  • Method Details

    • apply

      <@Nullable M extends @Nullable Metadata> @Nullable UnboundMetadata<M> apply​(Class<? extends RelNode> relClass, Class<? extends @Nullable M> metadataClass)
      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);
       
      Parameters:
      relClass - Type of relational expression
      metadataClass - Type of metadata
      Returns:
      Function that will field a metadata instance; or null if this provider cannot supply metadata of this type
    • handlers

      <M extends Metadata> com.google.common.collect.Multimap<Method,​MetadataHandler<M>> handlers​(MetadataDef<M> def)