Class JaninoRelMetadataProvider

    • Method Detail

      • maxSize

        private static <K,​V> com.google.common.cache.CacheBuilder<K,​V> maxSize​(com.google.common.cache.CacheBuilder<K,​V> builder,
                                                                                           int size)
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • apply

        public <M extends MetadataUnboundMetadata<M> apply​(java.lang.Class<? extends RelNode> relClass,
                                                             java.lang.Class<? extends 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
        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
      • findProvider

        private static java.lang.String findProvider​(java.util.List<Pair<java.lang.String,​MetadataHandler>> providerList,
                                                     java.lang.Class<?> declaringClass)
      • argList

        private static java.lang.StringBuilder argList​(java.lang.StringBuilder buff,
                                                       java.lang.reflect.Method method)
        Returns e.g. ", ignoreNulls".
      • safeArgList

        private static java.lang.StringBuilder safeArgList​(java.lang.StringBuilder buff,
                                                           java.lang.reflect.Method method)
        Returns e.g. ", ignoreNulls".
      • paramList

        private static java.lang.StringBuilder paramList​(java.lang.StringBuilder buff,
                                                         java.lang.reflect.Method method)
        Returns e.g. ",\n boolean ignoreNulls".
      • compile

        static <M extends MetadataMetadataHandler<M> compile​(java.lang.String className,
                                                               java.lang.String classBody,
                                                               MetadataDef<M> def,
                                                               java.util.List<java.lang.Object> argList)
                                                        throws org.codehaus.commons.compiler.CompileException,
                                                               java.io.IOException
        Throws:
        org.codehaus.commons.compiler.CompileException
        java.io.IOException
      • register

        public void register​(java.lang.Iterable<java.lang.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.