You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by tg...@apache.org on 2017/06/16 16:33:24 UTC

[2/2] beam git commit: Use the appropriate context in CombineTest Coder

Use the appropriate context in CombineTest Coder

The Accumulator was improperly decoding the seed value in the outer
context, as it is in the nested context.


Project: http://git-wip-us.apache.org/repos/asf/beam/repo
Commit: http://git-wip-us.apache.org/repos/asf/beam/commit/027d89c9
Tree: http://git-wip-us.apache.org/repos/asf/beam/tree/027d89c9
Diff: http://git-wip-us.apache.org/repos/asf/beam/diff/027d89c9

Branch: refs/heads/master
Commit: 027d89c91f8851195dedbab2879699738376ff77
Parents: d5261d7
Author: Thomas Groh <tg...@google.com>
Authored: Thu Jun 15 13:54:47 2017 -0700
Committer: Thomas Groh <tg...@google.com>
Committed: Fri Jun 16 09:33:13 2017 -0700

----------------------------------------------------------------------
 .../java/org/apache/beam/sdk/transforms/CombineTest.java     | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/beam/blob/027d89c9/sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/CombineTest.java
----------------------------------------------------------------------
diff --git a/sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/CombineTest.java b/sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/CombineTest.java
index 6a4348d..c4ba62d 100644
--- a/sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/CombineTest.java
+++ b/sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/CombineTest.java
@@ -1000,7 +1000,7 @@ public class CombineTest implements Serializable {
           @Override
           public void encode(Accumulator accumulator, OutputStream outStream, Coder.Context context)
               throws CoderException, IOException {
-            StringUtf8Coder.of().encode(accumulator.seed, outStream, context);
+            StringUtf8Coder.of().encode(accumulator.seed, outStream, context.nested());
             StringUtf8Coder.of().encode(accumulator.value, outStream, context);
           }
 
@@ -1012,9 +1012,9 @@ public class CombineTest implements Serializable {
           @Override
           public Accumulator decode(InputStream inStream, Coder.Context context)
               throws CoderException, IOException {
-            return new Accumulator(
-                StringUtf8Coder.of().decode(inStream, context),
-                StringUtf8Coder.of().decode(inStream, context));
+            String seed = StringUtf8Coder.of().decode(inStream, context.nested());
+            String value = StringUtf8Coder.of().decode(inStream, context);
+            return new Accumulator(seed, value);
           }
         };
       }