beam-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lc...@apache.org
Subject [1/2] beam git commit: Update SDK Coders to return the Empty List from getCoderArguments
Date Wed, 10 May 2017 23:18:57 GMT
Repository: beam
Updated Branches:
  refs/heads/master 40d73068d -> c6ac3eca0


Update SDK Coders to return the Empty List from getCoderArguments

Brings existing Coders in line with the documentation


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

Branch: refs/heads/master
Commit: 5a4e13149fb9648cb19428e8eef1fdddf2169785
Parents: 40d7306
Author: Thomas Groh <tgroh@google.com>
Authored: Wed May 10 08:56:54 2017 -0700
Committer: Luke Cwik <lcwik@google.com>
Committed: Wed May 10 16:18:19 2017 -0700

----------------------------------------------------------------------
 .../main/java/org/apache/beam/sdk/coders/AvroCoder.java |  5 -----
 .../java/org/apache/beam/sdk/coders/ByteArrayCoder.java |  6 ------
 .../org/apache/beam/sdk/transforms/join/UnionCoder.java |  3 ++-
 .../java/org/apache/beam/sdk/util/WindowedValue.java    | 12 ++++++++++--
 .../org/apache/beam/sdk/transforms/CombineFnsTest.java  |  3 ++-
 5 files changed, 14 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/beam/blob/5a4e1314/sdks/java/core/src/main/java/org/apache/beam/sdk/coders/AvroCoder.java
----------------------------------------------------------------------
diff --git a/sdks/java/core/src/main/java/org/apache/beam/sdk/coders/AvroCoder.java b/sdks/java/core/src/main/java/org/apache/beam/sdk/coders/AvroCoder.java
index bba669d..94b4a9f 100644
--- a/sdks/java/core/src/main/java/org/apache/beam/sdk/coders/AvroCoder.java
+++ b/sdks/java/core/src/main/java/org/apache/beam/sdk/coders/AvroCoder.java
@@ -318,11 +318,6 @@ public class AvroCoder<T> extends CustomCoder<T> {
     return reader.get().read(null, decoderInstance);
   }
 
-  @Override
-  public List<? extends Coder<?>> getCoderArguments() {
-    return null;
-  }
-
   /**
    * @throws NonDeterministicException when the type may not be deterministically
    * encoded using the given {@link Schema}, the {@code directBinaryEncoder}, and the

http://git-wip-us.apache.org/repos/asf/beam/blob/5a4e1314/sdks/java/core/src/main/java/org/apache/beam/sdk/coders/ByteArrayCoder.java
----------------------------------------------------------------------
diff --git a/sdks/java/core/src/main/java/org/apache/beam/sdk/coders/ByteArrayCoder.java b/sdks/java/core/src/main/java/org/apache/beam/sdk/coders/ByteArrayCoder.java
index 3b38388..16094dd 100644
--- a/sdks/java/core/src/main/java/org/apache/beam/sdk/coders/ByteArrayCoder.java
+++ b/sdks/java/core/src/main/java/org/apache/beam/sdk/coders/ByteArrayCoder.java
@@ -21,7 +21,6 @@ import com.google.common.io.ByteStreams;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
-import java.util.List;
 import org.apache.beam.sdk.util.ExposedByteArrayOutputStream;
 import org.apache.beam.sdk.util.StreamUtils;
 import org.apache.beam.sdk.util.VarInt;
@@ -113,11 +112,6 @@ public class ByteArrayCoder extends AtomicCoder<byte[]> {
   }
 
   @Override
-  public List<? extends Coder<?>> getCoderArguments() {
-    return null;
-  }
-
-  @Override
   public void verifyDeterministic() {}
 
   /**

http://git-wip-us.apache.org/repos/asf/beam/blob/5a4e1314/sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/join/UnionCoder.java
----------------------------------------------------------------------
diff --git a/sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/join/UnionCoder.java
b/sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/join/UnionCoder.java
index 66959d3..6590ca0 100644
--- a/sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/join/UnionCoder.java
+++ b/sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/join/UnionCoder.java
@@ -20,6 +20,7 @@ package org.apache.beam.sdk.transforms.join;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
+import java.util.Collections;
 import java.util.List;
 import org.apache.beam.sdk.coders.Coder;
 import org.apache.beam.sdk.coders.CoderException;
@@ -94,7 +95,7 @@ public class UnionCoder extends StructuredCoder<RawUnionValue> {
 
   @Override
   public List<? extends Coder<?>> getCoderArguments() {
-    return null;
+    return Collections.emptyList();
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/beam/blob/5a4e1314/sdks/java/core/src/main/java/org/apache/beam/sdk/util/WindowedValue.java
----------------------------------------------------------------------
diff --git a/sdks/java/core/src/main/java/org/apache/beam/sdk/util/WindowedValue.java b/sdks/java/core/src/main/java/org/apache/beam/sdk/util/WindowedValue.java
index 444521a..8300954 100644
--- a/sdks/java/core/src/main/java/org/apache/beam/sdk/util/WindowedValue.java
+++ b/sdks/java/core/src/main/java/org/apache/beam/sdk/util/WindowedValue.java
@@ -685,9 +685,17 @@ public abstract class WindowedValue<T> {
       valueCoder.registerByteSizeObserver(value.getValue(), observer);
     }
 
+    /**
+     * {@inheritDoc}.
+     *
+     * @return a singleton list containing the {@code valueCoder} of this
+     *         {@link FullWindowedValueCoder}.
+     */
     @Override
     public List<? extends Coder<?>> getCoderArguments() {
-      return null;
+      // The value type is the only generic type parameter exposed by this coder. The component
+      // coders include the window coder as well
+      return Collections.singletonList(valueCoder);
     }
 
     @Override
@@ -758,7 +766,7 @@ public abstract class WindowedValue<T> {
 
     @Override
     public List<? extends Coder<?>> getCoderArguments() {
-      return Arrays.<Coder<?>>asList(valueCoder);
+      return Collections.singletonList(valueCoder);
     }
   }
 }

http://git-wip-us.apache.org/repos/asf/beam/blob/5a4e1314/sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/CombineFnsTest.java
----------------------------------------------------------------------
diff --git a/sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/CombineFnsTest.java
b/sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/CombineFnsTest.java
index 33c652a..aeb7692 100644
--- a/sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/CombineFnsTest.java
+++ b/sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/CombineFnsTest.java
@@ -27,6 +27,7 @@ import java.io.InputStream;
 import java.io.OutputStream;
 import java.io.Serializable;
 import java.util.Arrays;
+import java.util.Collections;
 import java.util.List;
 import org.apache.beam.sdk.coders.AtomicCoder;
 import org.apache.beam.sdk.coders.BigEndianIntegerCoder;
@@ -360,7 +361,7 @@ public class  CombineFnsTest {
 
     @Override
     public List<? extends Coder<?>> getCoderArguments() {
-      return null;
+      return Collections.emptyList();
     }
 
     @Override


Mime
View raw message