Class CachingAsyncLookupFunction

java.lang.Object
org.apache.flink.table.functions.UserDefinedFunction
org.apache.flink.table.functions.AsyncTableFunction<org.apache.flink.table.data.RowData>
org.apache.flink.table.functions.AsyncLookupFunction
org.apache.flink.table.runtime.functions.table.lookup.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:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
  • 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

    Modifier and Type
    Method
    Description
    CompletableFuture<Collection<org.apache.flink.table.data.RowData>>
    asyncLookup(org.apache.flink.table.data.RowData keyRow)
     
    void
     
    org.apache.flink.table.connector.source.lookup.cache.LookupCache
     
    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 class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.apache.flink.table.functions.FunctionDefinition

    getRequirements, isDeterministic, supportsConstantFolding
  • Field Details

  • Constructor Details

    • CachingAsyncLookupFunction

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

    • 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
    • getCache

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