Abacn opened a new issue, #31505:
URL: https://github.com/apache/beam/issues/31505
### What happened?
Example:
```java
private static final Logger LOG =
LoggerFactory.getLogger(DoFnErrorTest.class);
static class SomeDoFn extends DoFn<Long, Long> {
@ProcessElement
public void process(@Element Long input, OutputReceiver<Long> receiver) {
try {
receiver.output(input);
} catch (Exception e) {
LOG.error("suppressing error", e);
}
}
}
static class ErrorDoFn extends DoFn<Long, Long> {
@ProcessElement
public void process(ProcessContext ctx) {
Long element = ctx.element();
if (element == 1) {
throw new RuntimeException("Exception!");
}
}
}
public static void main(String[] argv) {
PipelineOptions options =
PipelineOptionsFactory.fromArgs(argv).as(PipelineOptions.class);
Pipeline p = Pipeline.create(options);
p.apply(Create.of(0L, 1L, 2L))
.apply(ParDo.of(new DoFnErrorTest.SomeDoFn()))
.apply(ParDo.of(new DoFnErrorTest.ErrorDoFn()));
p.run().waitUntilFinish();
}
```
The pipeline failed (as expected) in direct runner, but it succeeded in
Dataflow runner (legacy worker or runner v2)
This is due to how Dataflow runner executes DoFns. Dataflow will fuse steps,
and the output() of upstream DoFn essentially calling downstream DoFn's
processElement (via reflection). If downstream process raised an Error,
upstream DoFn can catch it.
imo This behavior is very confusing.
### Issue Priority
Priority: 2 (default / most bugs should be filed as P2)
### Issue Components
- [ ] Component: Python SDK
- [X] Component: Java SDK
- [ ] Component: Go SDK
- [ ] Component: Typescript SDK
- [ ] Component: IO connector
- [ ] Component: Beam YAML
- [ ] Component: Beam examples
- [ ] Component: Beam playground
- [ ] Component: Beam katas
- [ ] Component: Website
- [ ] Component: Spark Runner
- [ ] Component: Flink Runner
- [ ] Component: Samza Runner
- [ ] Component: Twister2 Runner
- [ ] Component: Hazelcast Jet Runner
- [ ] Component: Google Cloud Dataflow Runner
--
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]