scwhittle commented on code in PR #37762:
URL: https://github.com/apache/beam/pull/37762#discussion_r2910825267
##########
runners/google-cloud-dataflow-java/worker/src/main/java/org/apache/beam/runners/dataflow/worker/WindmillReaderIteratorBase.java:
##########
@@ -48,30 +54,38 @@ public boolean start() throws IOException {
@Override
public boolean advance() throws IOException {
- if (bundleIndex == work.getMessageBundlesCount()
- || messageIndex ==
work.getMessageBundles(bundleIndex).getMessagesCount()) {
- current = Optional.absent();
- return false;
- }
- ++messageIndex;
- for (; bundleIndex < work.getMessageBundlesCount(); ++bundleIndex,
messageIndex = 0) {
+ while (true) {
+ if (bundleIndex >= work.getMessageBundlesCount()) {
+ current = null;
+ return false;
+ }
Windmill.InputMessageBundle bundle = work.getMessageBundles(bundleIndex);
- if (messageIndex < bundle.getMessagesCount()) {
- current = Optional.of(decodeMessage(bundle.getMessages(messageIndex)));
+ ++messageIndex;
+ if (messageIndex >= bundle.getMessagesCount()) {
+ messageIndex = -1;
+ ++bundleIndex;
+ continue;
+ }
+ try {
+ current =
checkNotNull(decodeMessage(bundle.getMessages(messageIndex)));
return true;
+ } catch (RuntimeException | IOException e) {
+ if (Boolean.TRUE.equals(skipUndecodableElements.get())) {
+ LOG.error("Skipping input element due to decoding error", e);
Review Comment:
done
--
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]