You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by "mkuthan (via GitHub)" <gi...@apache.org> on 2023/09/22 13:07:31 UTC
[GitHub] [beam] mkuthan opened a new issue, #28612: [Feature Request]: Better assertion error message for PAssert.thatSingleton
mkuthan opened a new issue, #28612:
URL: https://github.com/apache/beam/issues/28612
### What would you like to happen?
If element doesn't exist in empty PCollection - PAssert.thatSingleton emits the following error message:
```
java.util.NoSuchElementException
org.apache.beam.sdk.Pipeline$PipelineExecutionException: java.util.NoSuchElementException
(stack trace)
Caused by: java.util.NoSuchElementException
at java.base/java.util.ArrayList$Itr.next(ArrayList.java:970)
at org.apache.beam.vendor.guava.v32_1_2_jre.com.google.common.collect.Iterators.getOnlyElement(Iterators.java:309)
at org.apache.beam.vendor.guava.v32_1_2_jre.com.google.common.collect.Iterables.getOnlyElement(Iterables.java:263)
at org.apache.beam.sdk.testing.PAssert$SingletonCheckerDoFn.processElement(PAssert.java:1613)
```
If element is not the only element in PCollection - PAssert.thatSingleton emits the following error message:
```
java.lang.IllegalArgumentException: expected one element but was: (...)
org.apache.beam.sdk.Pipeline$PipelineExecutionException: java.lang.IllegalArgumentException: expected one element but was: (...)
(stack trace)
Caused by: java.lang.IllegalArgumentException: expected one element but was: (...) at org.apache.beam.vendor.guava.v32_1_2_jre.com.google.common.collect.Iterators.getOnlyElement(Iterators.java:323)
at org.apache.beam.vendor.guava.v32_1_2_jre.com.google.common.collect.Iterables.getOnlyElement(Iterables.java:263)
at org.apache.beam.sdk.testing.PAssert$SingletonCheckerDoFn.processElement(PAssert.java:1613)
```
For presented scenarios assertion errors doesn't really help - there is no assertion call site info.
```
private static class SingletonCheckerDoFn ... {
@ProcessElement
public void processElement(ProcessContext c) {
ActualT actualContents = Iterables.getOnlyElement(c.element()); // <- runtime exception here
c.output(doChecks(site, actualContents, checkerFn)); // <- no doCheck call with proper assertion site info
}
}
```
### Issue Priority
Priority: 3 (nice-to-have improvement)
### Issue Components
- [ ] Component: Python SDK
- [X] Component: Java SDK
- [ ] Component: Go SDK
- [ ] Component: Typescript SDK
- [ ] Component: IO connector
- [ ] 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: github-unsubscribe@beam.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Feature Request]: Better assertion error message for PAssert.thatSingleton [beam]
Posted by "Amar3tto (via GitHub)" <gi...@apache.org>.
Amar3tto commented on issue #28612:
URL: https://github.com/apache/beam/issues/28612#issuecomment-2205637889
.take-issue
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Feature Request]: Better assertion error message for PAssert.thatSingleton [beam]
Posted by "Abacn (via GitHub)" <gi...@apache.org>.
Abacn closed issue #28612: [Feature Request]: Better assertion error message for PAssert.thatSingleton
URL: https://github.com/apache/beam/issues/28612
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org