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 2020/04/01 02:18:09 UTC

[GitHub] [beam] lukecwik commented on a change in pull request #11271: [BEAM-9624] Adds Convert to Accumulators operator for use in combiner lifting for streaming pipelines

lukecwik commented on a change in pull request #11271: [BEAM-9624] Adds Convert to Accumulators operator for use in combiner lifting for streaming pipelines
URL: https://github.com/apache/beam/pull/11271#discussion_r401318044
 
 

 ##########
 File path: sdks/go/pkg/beam/core/runtime/exec/combine_test.go
 ##########
 @@ -113,6 +113,40 @@ func TestLiftedCombine(t *testing.T) {
 
 }
 
+// TestConvertToaccumulators verifies that if we just do ConvertToAccumulators instead
+// of LiftedCombine before the GBK we still get the right answer.
+func TestConvertToAccumulators(t *testing.T) {
+	withCoder := func(t *testing.T, suffix string, key interface{}, keyCoder *coder.Coder) {
+		for _, test := range tests {
+			t.Run(fnName(test.Fn)+"_"+suffix, func(t *testing.T) {
+				edge := getCombineEdge(t, test.Fn, reflectx.Int, test.AccumCoder)
+
+				out := &CaptureNode{UID: 1}
+				extract := &ExtractOutput{Combine: &Combine{UID: 2, Fn: edge.CombineFn, Out: out}}
+				merge := &MergeAccumulators{Combine: &Combine{UID: 3, Fn: edge.CombineFn, Out: extract}}
+				gbk := &simpleGBK{UID: 4, KeyCoder: keyCoder, Out: merge}
+				convertToAccumulators := &ConvertToAccumulators{Combine: &Combine{UID: 5, Fn: edge.CombineFn, Out: gbk}}
 
 Review comment:
   This will validate that you get the right output but doesn't actually ensure that convertToAccumulators didn't do any combining.
   
   It might be worthwhile to just test the convertToAccumulators step without any of the other steps alongside it.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services