lostluck commented on a change in pull request #15175:
URL: https://github.com/apache/beam/pull/15175#discussion_r671343729
##########
File path: sdks/go/pkg/beam/testing/passert/floats.go
##########
@@ -26,6 +26,56 @@ import (
"github.com/apache/beam/sdks/go/pkg/beam/internal/errors"
)
+// EqualsFloat checks that two PCollections of floats are equal, with each
element
+// being within a specified threshold of its corresponding element. Both
PCollections
+// are loaded into memory, sorted, and compared element by element.
+func EqualsFloat(s beam.Scope, observed, expected beam.PCollection, threshold
float64) {
Review comment:
Oh good point there. I would not try and capture errors from ParDo0. It
would largely fail if the thresholdFn had any output PCollections, which we can
see statically it doesn't, and the additional validation is sufficient to cover
other errors it might pull since they are more specific than what is checked by
ParDo0 at construction.
The examples are largely the beam.ParDo* functions themselves. There's a
single general "TryParDo" that does all the work for the ParDo* functions. See
https://github.com/apache/beam/blob/master/sdks/go/pkg/beam/pardo.go#L86
I don't recommend duplicating all of that code or using the TryParDo there,
just showing the example. Another example is TryExternal:
https://github.com/apache/beam/blob/master/sdks/go/pkg/beam/external.go#L38
--
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]