GroupIntoBatches para elementos não KV

De acordo comDocumentação do Apache Beam 2.0.0 SDK GroupIntoBatches funciona apenas comKV coleções.

Meu conjunto de dados contém apenas valores e não é necessário introduzir chaves. No entanto, para fazer uso deGroupIntoBatches Eu tive que implementar chaves "falsas" com uma string vazia como chave:

static class FakeKVFn extends DoFn<String, KV<String, String>> {
  @ProcessElement
  public void processElement(ProcessContext c) {
    c.output(KV.of("", c.element()));
  }
}

Portanto, o pipeline geral se parece com o seguinte:

public static void main(String[] args) {
  PipelineOptions options = PipelineOptionsFactory.create();
  Pipeline p = Pipeline.create(options);

  long batchSize = 100L;

  p.apply("ReadLines", TextIO.read().from("./input.txt"))
      .apply("FakeKV", ParDo.of(new FakeKVFn()))
      .apply(GroupIntoBatches.<String, String>ofSize(batchSize))
      .setCoder(KvCoder.of(StringUtf8Coder.of(), IterableCoder.of(StringUtf8Coder.of())))
      .apply(ParDo.of(new DoFn<KV<String, Iterable<String>>, String>() {
        @ProcessElement
        public void processElement(ProcessContext c) {
          c.output(callWebService(c.element().getValue()));
        }
      }))
      .apply("WriteResults", TextIO.write().to("./output/"));

  p.run().waitUntilFinish();
}

Existe alguma maneira de agrupar em lotes sem introduzir chaves "falsas"?

questionAnswers(1)

yourAnswerToTheQuestion