[ 
https://issues.apache.org/jira/browse/BEAM-9951?focusedWorklogId=443988&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-443988
 ]

ASF GitHub Bot logged work on BEAM-9951:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 10/Jun/20 20:52
            Start Date: 10/Jun/20 20:52
    Worklog Time Spent: 10m 
      Work Description: youngoli commented on a change in pull request #11870:
URL: https://github.com/apache/beam/pull/11870#discussion_r438401382



##########
File path: sdks/go/pkg/beam/testing/passert/count.go
##########
@@ -0,0 +1,52 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//    http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package passert
+
+import (
+       "fmt"
+
+       "github.com/apache/beam/sdks/go/pkg/beam"
+       "github.com/apache/beam/sdks/go/pkg/beam/core/typex"
+)
+
+func Count(s beam.Scope, col beam.PCollection, name string, count int) {
+       s = s.Scope(fmt.Sprintf("passert.Count(%v)", name))
+
+       if typex.IsKV(col.Type()) {
+               col = beam.DropKey(s, col)
+       }
+       counted := beam.Combine(s, &elmCountCombineFn{}, col)
+       Equals(s, counted, count)

Review comment:
       I think it could, and I considered it, but the error message isn't too 
helpful either (better than equals though). I added a ParDo0 with a custom 
error message which I think ends up being the most user-friendly.




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 443988)
    Time Spent: 4h  (was: 3h 50m)

> Create Go SDK synthetic sources.
> --------------------------------
>
>                 Key: BEAM-9951
>                 URL: https://issues.apache.org/jira/browse/BEAM-9951
>             Project: Beam
>          Issue Type: Sub-task
>          Components: sdk-go
>            Reporter: Daniel Oliveira
>            Assignee: Daniel Oliveira
>            Priority: P2
>          Time Spent: 4h
>  Remaining Estimate: 0h
>
> Create synthetic sources for the Go SDK like 
> [Java|https://github.com/apache/beam/tree/master/sdks/java/io/synthetic/src/main/java/org/apache/beam/sdk/io/synthetic]
>  and 
> [Python|https://github.com/apache/beam/blob/master/sdks/python/apache_beam/testing/synthetic_pipeline.py]
>  have.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to