flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kostas Kloudas (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (FLINK-8525) Improve queryable state code examples
Date Tue, 30 Jan 2018 10:49:00 GMT

    [ https://issues.apache.org/jira/browse/FLINK-8525?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16344859#comment-16344859

Kostas Kloudas commented on FLINK-8525:

Hi [~sonice_lj]! I agree that the code examples for the queryable state should be improved.

Now, if I understand your question correctly, the first is how can you obtain the jobId, and
the second, how can you get the key for the response, right?

The `jobId` of the job, you should get it from the WebUI, and as for the key of the result,
then this is not included in the result but you should know which key's state you requested.

Now for the examples, there are of course test-cases and ITcases in the `flink-queryable-state-runtime`
module. Search for the class `AbstractQueryableStateTestBase` for the different ITcases and
in that package you can also find more tests.

If you want, feel free to contribute some examples.

> Improve queryable state code examples
> -------------------------------------
>                 Key: FLINK-8525
>                 URL: https://issues.apache.org/jira/browse/FLINK-8525
>             Project: Flink
>          Issue Type: Improvement
>          Components: Documentation, Queryable State
>    Affects Versions: 1.4.0
>            Reporter: jia liu
>            Priority: Minor
> I't really very hard to understand the code in documents.
> {code:java}
> QueryableStateClient client = new QueryableStateClient(tmHostname, proxyPort);
> // the state descriptor of the state to be fetched.
> ValueStateDescriptor<Tuple2<Long, Long>> descriptor =
>         new ValueStateDescriptor<>(
>           "average",
>           TypeInformation.of(new TypeHint<Tuple2<Long, Long>>() {}),
>           Tuple2.of(0L, 0L));
> CompletableFuture<ValueState<Tuple2<Long, Long>>> resultFuture =
>         client.getKvState(jobId, "query-name", key, BasicTypeInfo.LONG_TYPE_INFO, descriptor);
> // now handle the returned value
> resultFuture.thenAccept(response -> {
>         try {
>             Tuple2<Long, Long> res = response.get();
>         } catch (Exception e) {
>             e.printStackTrace();
>         }
> });
> {code}
> I can't get the declaration of key and jobId from it. And the most important, there
is no test case in flink-queryable-state module.

This message was sent by Atlassian JIRA

View raw message