damccorm opened a new issue, #20850:
URL: https://github.com/apache/beam/issues/20850
After applying `FixedWindows` on a streaming source, a `GroupByKey`
operation won't emit keyed elements in a window.
This example without `GroupByKey` prints all the windowed elements:
```
pipeline
.apply("ReadFromPubsub",
PubsubIO.readStrings().fromSubscription(subscriptionPath))
.apply(Window.into(FixedWindows.of(Duration.standardSeconds(5L))))
.apply(WithKeys.of("bobcat"))
.apply(MapElements.into(TypeDescriptors.nulls()).via(
(KV<String,
String> pair) -> {
LOG.info("Key: " + pair.getKey() + "\tValue: " + pair.getValue());
return null;
}
));
```
This example with `GroupByKey` doesn't emit anything:
```
pipeline
.apply("ReadFromPubsub",
PubsubIO.readStrings().fromSubscription(subscriptionPath))
.apply(Window.into(FixedWindows.of(Duration.standardSeconds(5L))))
.apply(WithKeys.of("bobcat"))
.apply(GroupByKey.create())
.apply(FlatMapElements.into(TypeDescriptors.nulls()).via(
(KV<String, Iterable<String>> pair) -> {
pair.getValue().forEach(message -> LOG.info("Message:
" + message));
return null;
}
));
```
I'm using DirectRunner. The same logic works for Python using both the
DirectRunner and DataflowRunner.
Imported from Jira
[BEAM-12075](https://issues.apache.org/jira/browse/BEAM-12075). Original Jira
may contain additional context.
Reported by: tianzi.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]