Class JaninoRelMetadataProvider

All Implemented Interfaces:

public class JaninoRelMetadataProvider
extends Object
implements RelMetadataProvider
Implementation of the RelMetadataProvider interface that generates a class that dispatches to the underlying providers.
  • Field Details

  • Method Details

    • of

      public static JaninoRelMetadataProvider of​(RelMetadataProvider provider)
      Creates a JaninoRelMetadataProvider.
      provider - Underlying provider
    • equals

      public boolean equals​(@Nullable Object obj)
      equals in class Object
    • hashCode

      public int hashCode()
      hashCode in class Object
    • apply

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

      public <M extends Metadata><Method,​MetadataHandler<M>> handlers​(MetadataDef<M> def)
      Specified by:
      handlers in interface RelMetadataProvider
    • register

      public void register​(Iterable<Class<? extends RelNode>> classes)
      Registers some classes. Does not flush the providers, but next time we need to generate a provider, it will handle all of these classes. So, calling this method reduces the number of times we need to re-generate.