Class CachingAsyncLookupFunction

  • All Implemented Interfaces:
    Serializable, org.apache.flink.table.functions.FunctionDefinition

    public class CachingAsyncLookupFunction
    extends org.apache.flink.table.functions.AsyncLookupFunction
    A wrapper function around user-provided async lookup function with a cache layer.

    This function will check the cache on lookup request and return entries directly on cache hit, otherwise the function will invoke the actual lookup function, and store the entry into the cache after lookup for later use.

    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      CachingAsyncLookupFunction​(org.apache.flink.table.connector.source.lookup.cache.LookupCache cache, org.apache.flink.table.functions.AsyncLookupFunction delegate)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      CompletableFuture<Collection<org.apache.flink.table.data.RowData>> asyncLookup​(org.apache.flink.table.data.RowData keyRow)  
      void close()  
      org.apache.flink.table.connector.source.lookup.cache.LookupCache getCache()  
      org.apache.flink.table.functions.AsyncLookupFunction getDelegate()  
      void open​(org.apache.flink.table.functions.FunctionContext context)  
      • Methods inherited from class org.apache.flink.table.functions.AsyncLookupFunction

        eval
      • Methods inherited from class org.apache.flink.table.functions.AsyncTableFunction

        getKind, getTypeInference
      • Methods inherited from class org.apache.flink.table.functions.UserDefinedFunction

        functionIdentifier, toString
      • Methods inherited from interface org.apache.flink.table.functions.FunctionDefinition

        getRequirements, isDeterministic, supportsConstantFolding
    • Constructor Detail

      • CachingAsyncLookupFunction

        public CachingAsyncLookupFunction​(org.apache.flink.table.connector.source.lookup.cache.LookupCache cache,
                                          org.apache.flink.table.functions.AsyncLookupFunction delegate)
    • Method Detail

      • open

        public void open​(org.apache.flink.table.functions.FunctionContext context)
                  throws Exception
        Overrides:
        open in class org.apache.flink.table.functions.UserDefinedFunction
        Throws:
        Exception
      • asyncLookup

        public CompletableFuture<Collection<org.apache.flink.table.data.RowData>> asyncLookup​(org.apache.flink.table.data.RowData keyRow)
        Specified by:
        asyncLookup in class org.apache.flink.table.functions.AsyncLookupFunction
      • close

        public void close()
                   throws Exception
        Overrides:
        close in class org.apache.flink.table.functions.UserDefinedFunction
        Throws:
        Exception
      • getDelegate

        public org.apache.flink.table.functions.AsyncLookupFunction getDelegate()
      • getCache

        @VisibleForTesting
        public org.apache.flink.table.connector.source.lookup.cache.LookupCache getCache()