Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-8525

Improve queryable state code examples

    XMLWordPrintableJSON

Details

    Description

      I't really very hard to understand the code in documents.

      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();
              }
      });
      

      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.

      Attachments

        Activity

          People

            Unassigned Unassigned
            sonice_lj jia liu
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: