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.AsyncLookupFunctionA 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
-
-
Field Summary
Fields Modifier and Type Field Description static StringLOOKUP_CACHE_METRIC_GROUP_NAME
-
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)voidclose()org.apache.flink.table.connector.source.lookup.cache.LookupCachegetCache()voidopen(org.apache.flink.table.functions.FunctionContext context)-
Methods inherited from class org.apache.flink.table.functions.AsyncTableFunction
getKind, getTypeInference
-
Methods inherited from class org.apache.flink.table.functions.UserDefinedFunction
functionIdentifier, toString
-
-
-
-
Field Detail
-
LOOKUP_CACHE_METRIC_GROUP_NAME
public static final String LOOKUP_CACHE_METRIC_GROUP_NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
open
public void open(org.apache.flink.table.functions.FunctionContext context) throws Exception- Overrides:
openin classorg.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:
asyncLookupin classorg.apache.flink.table.functions.AsyncLookupFunction
-
close
public void close() throws Exception- Overrides:
closein classorg.apache.flink.table.functions.UserDefinedFunction- Throws:
Exception
-
getCache
@VisibleForTesting public org.apache.flink.table.connector.source.lookup.cache.LookupCache getCache()
-
-