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 -
Constructor Summary
ConstructorsConstructorDescriptionCachingAsyncLookupFunction(org.apache.flink.table.connector.source.lookup.cache.LookupCache cache, org.apache.flink.table.functions.AsyncLookupFunction delegate) -
Method Summary
Modifier and TypeMethodDescriptionCompletableFuture<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.AsyncLookupFunction
evalMethods inherited from class org.apache.flink.table.functions.AsyncTableFunction
getKind, getTypeInferenceMethods inherited from class org.apache.flink.table.functions.UserDefinedFunction
functionIdentifier, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.flink.table.functions.FunctionDefinition
getRequirements, isDeterministic, supportsConstantFolding
-
Field Details
-
LOOKUP_CACHE_METRIC_GROUP_NAME
- See Also:
-
-
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
- 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
- Overrides:
closein classorg.apache.flink.table.functions.UserDefinedFunction- Throws:
Exception
-
getCache
@VisibleForTesting public org.apache.flink.table.connector.source.lookup.cache.LookupCache getCache()
-