[
https://issues.apache.org/jira/browse/BEAM-12548?focusedWorklogId=623720&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-623720
]
ASF GitHub Bot logged work on BEAM-12548:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 16/Jul/21 16:30
Start Date: 16/Jul/21 16:30
Worklog Time Spent: 10m
Work Description: jrmccluskey commented on a change in pull request
#15175:
URL: https://github.com/apache/beam/pull/15175#discussion_r671383900
##########
File path: sdks/go/pkg/beam/testing/passert/floats.go
##########
@@ -70,3 +122,13 @@ func (f *boundsFn) ProcessElement(_ []byte, col
func(*beam.T) bool) error {
}
return errors.New(strings.Join(errorStrings, "\n"))
}
+
+func toFloat(input beam.T) float64 {
+ return
reflect.ValueOf(input.(interface{})).Convert(reflectx.Float64).Interface().(float64)
+}
+
+func validateNonComplexNumber(t reflect.Type) {
+ if !reflectx.IsNumber(t) || reflectx.IsComplex(t) {
+ panic(fmt.Sprintf("type must be a non-complex number: %v", t))
Review comment:
Changed
##########
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:
Done and unit tested
--
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]
Issue Time Tracking
-------------------
Worklog Id: (was: 623720)
Time Spent: 7h 10m (was: 7h)
> [Go SDK] PAssert improvements
> -----------------------------
>
> Key: BEAM-12548
> URL: https://issues.apache.org/jira/browse/BEAM-12548
> Project: Beam
> Issue Type: Improvement
> Components: sdk-go
> Reporter: Robert Burke
> Assignee: Jack McCluskey
> Priority: P2
> Time Spent: 7h 10m
> Remaining Estimate: 0h
>
> The Go SDK Passert package could be more helpful.
> It could haveĀ GoDoc examples for correct and less clear use of each of the
> functions (like both the variadic and PCollection approaches forĀ
> passert.Equals).
> There could be better/more sophisticated handling for floating point values,
> eg with thresholds.
> There could be special/magic handling for synthetic KV types that could then
> be used for handling Equals against KV PCollections.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)