Github user kl0u commented on a diff in the pull request: https://github.com/apache/flink/pull/4225#discussion_r125006493 --- Diff: flink-runtime/src/main/java/org/apache/flink/runtime/query/QueryableStateClient.java --- @@ -267,6 +293,177 @@ public void shutDown() { } /** + * Returns a future holding the request result. + * + * <p>If the server does not serve a KvState instance with the given ID, + * the Future will be failed with a {@link UnknownKvStateID}. + * + * <p>If the KvState instance does not hold any data for the given key + * and namespace, the Future will be failed with a {@link UnknownKeyOrNamespace}. + * + * <p>All other failures are forwarded to the Future. + * + * @param jobId JobID of the job the queryable state belongs to. + * @param queryableStateName Name under which the state is queryable. + * @param key The key we are interested in. + * @param keyTypeHint A {@link TypeHint} used to extract the type of the key. + * @param stateDescriptor The {@link StateDescriptor} of the state we want to query. + * @return Future holding the result. + */ + @PublicEvolving + public <K, V> Future<V> getKvState( + final JobID jobId, + final String queryableStateName, + final K key, + final TypeHint<K> keyTypeHint, + final StateDescriptor<?, V> stateDescriptor) { + + Preconditions.checkNotNull(keyTypeHint); + + TypeInformation<K> keyTypeInfo = keyTypeHint.getTypeInfo(); + return getKvState(jobId, queryableStateName, key, keyTypeInfo, stateDescriptor); + } + + /** + * Returns a future holding the request result. + * + * <p>If the server does not serve a KvState instance with the given ID, + * the Future will be failed with a {@link UnknownKvStateID}. + * + * <p>If the KvState instance does not hold any data for the given key + * and namespace, the Future will be failed with a {@link UnknownKeyOrNamespace}. + * + * <p>All other failures are forwarded to the Future. + * + * @param jobId JobID of the job the queryable state belongs to. + * @param queryableStateName Name under which the state is queryable. + * @param key The key we are interested in. + * @param keyTypeInfo The {@link TypeInformation} of the key. + * @param stateDescriptor The {@link StateDescriptor} of the state we want to query. + * @return Future holding the result. + */ + @PublicEvolving + public <K, V> Future<V> getKvState( + final JobID jobId, + final String queryableStateName, + final K key, + final TypeInformation<K> keyTypeInfo, + final StateDescriptor<?, V> stateDescriptor) { + + Preconditions.checkNotNull(keyTypeInfo); + + return getKvState(jobId, queryableStateName, key, VoidNamespace.INSTANCE, + keyTypeInfo, VoidNamespaceTypeInfo.INSTANCE, stateDescriptor); + } + + /** + * Returns a future holding the request result. + * + * <p>If the server does not serve a KvState instance with the given ID, + * the Future will be failed with a {@link UnknownKvStateID}. + * + * <p>If the KvState instance does not hold any data for the given key + * and namespace, the Future will be failed with a {@link UnknownKeyOrNamespace}. + * + * <p>All other failures are forwarded to the Future. + * + * @param jobId JobID of the job the queryable state belongs to. + * @param queryableStateName Name under which the state is queryable. + * @param key The key that the state we request is associated with. + * @param namespace The namespace of the state. + * @param keyTypeInfo The {@link TypeInformation} of the keys. + * @param namespaceTypeInfo The {@link TypeInformation} of the namespace. + * @param stateDescriptor The {@link StateDescriptor} of the state we want to query. + * @return Future holding the result. + */ + @PublicEvolving + public <K, V, N> Future<V> getKvState( + final JobID jobId, + final String queryableStateName, + final K key, + final N namespace, + final TypeInformation<K> keyTypeInfo, + final TypeInformation<N> namespaceTypeInfo, + final StateDescriptor<?, V> stateDescriptor) { + + Preconditions.checkNotNull(stateDescriptor); + + // initialize the value serializer based on the execution config. + stateDescriptor.initializeSerializerUnlessSet(executionConfig); + TypeSerializer<V> valueSerializer = stateDescriptor.getSerializer(); + + return getKvState(jobId, queryableStateName, key, + namespace, keyTypeInfo, namespaceTypeInfo, valueSerializer); + } + + /** + * Returns a future holding the request result. + * + * <p>If the server does not serve a KvState instance with the given ID, + * the Future will be failed with a {@link UnknownKvStateID}. + * + * <p>If the KvState instance does not hold any data for the given key + * and namespace, the Future will be failed with a {@link UnknownKeyOrNamespace}. + * + * <p>All other failures are forwarded to the Future. + * + * @param jobId JobID of the job the queryable state belongs to. + * @param queryableStateName Name under which the state is queryable. + * @param key The key that the state we request is associated with. + * @param namespace The namespace of the state. + * @param keyTypeInfo The {@link TypeInformation} of the keys. + * @param namespaceTypeInfo The {@link TypeInformation} of the namespace. + * @param valueSerializer The {@link TypeSerializer} of the state we want to query. + * @return Future holding the result. + */ + @PublicEvolving + public <K, V, N> Future<V> getKvState( + final JobID jobId, + final String queryableStateName, + final K key, + final N namespace, + final TypeInformation<K> keyTypeInfo, + final TypeInformation<N> namespaceTypeInfo, + final TypeSerializer<V> valueSerializer) { --- End diff -- You are right!
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---