You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2021/08/30 15:57:00 UTC

[GitHub] [beam] lostluck commented on a change in pull request #15399: [BEAM-5097] Increment counter for "small words" in go SDK example

lostluck commented on a change in pull request #15399:
URL: https://github.com/apache/beam/pull/15399#discussion_r698606271



##########
File path: sdks/go/examples/cookbook/combine/combine.go
##########
@@ -67,11 +68,13 @@ type extractFn struct {
 	MinLength int `json:"min_length"`
 }
 
-func (f *extractFn) ProcessElement(row WordRow, emit func(string, string)) {
+func (f *extractFn) ProcessElement(ctx context.Context, row WordRow, emit func(string, string)) {
+

Review comment:
       nit: rm spare line

##########
File path: sdks/go/examples/wordcount/wordcount.go
##########
@@ -111,9 +111,11 @@ func init() {
 }
 
 var (
-	wordRE  = regexp.MustCompile(`[a-zA-Z]+('[a-z])?`)
-	empty   = beam.NewCounter("extract", "emptyLines")
-	lineLen = beam.NewDistribution("extract", "lineLenDistro")
+	wordRE      = regexp.MustCompile(`[a-zA-Z]+('[a-z])?`)
+	empty       = beam.NewCounter("extract", "emptyLines")
+	minLength   = flag.Int("min_length", 9, "Minimum word length")

Review comment:
       Since this is a new flag, and this example doesn't filter words, we might want to just call it "small_word_length" instead, and clarify that it determines what gets counted.




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