beam-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From k...@apache.org
Subject [1/2] beam git commit: Add tests for serialization of BigQueryIO.TableRowInfoCoder
Date Tue, 07 Mar 2017 00:36:45 GMT
Repository: beam
Updated Branches:
  refs/heads/master 5d120bd3f -> 410534b1f


Add tests for serialization of BigQueryIO.TableRowInfoCoder


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

Branch: refs/heads/master
Commit: 57886246a08e82a2cff0d6b95816b76a5b912595
Parents: 5d120bd
Author: Kenneth Knowles <klk@google.com>
Authored: Mon Mar 6 16:02:54 2017 -0800
Committer: Kenneth Knowles <klk@google.com>
Committed: Mon Mar 6 16:02:54 2017 -0800

----------------------------------------------------------------------
 .../beam/sdk/io/gcp/bigquery/BigQueryIO.java       |  3 ++-
 .../beam/sdk/io/gcp/bigquery/BigQueryIOTest.java   | 17 +++++++++++++++++
 2 files changed, 19 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/beam/blob/57886246/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryIO.java
----------------------------------------------------------------------
diff --git a/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryIO.java
b/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryIO.java
index be9a786..0e1c6fc 100644
--- a/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryIO.java
+++ b/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryIO.java
@@ -2887,7 +2887,8 @@ public class BigQueryIO {
     VarIntCoder shardNumberCoder;
   }
 
-  private static class TableRowInfoCoder extends AtomicCoder<TableRowInfo> {
+  @VisibleForTesting
+  static class TableRowInfoCoder extends AtomicCoder<TableRowInfo> {
     private static final TableRowInfoCoder INSTANCE = new TableRowInfoCoder();
 
     @JsonCreator

http://git-wip-us.apache.org/repos/asf/beam/blob/57886246/sdks/java/io/google-cloud-platform/src/test/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryIOTest.java
----------------------------------------------------------------------
diff --git a/sdks/java/io/google-cloud-platform/src/test/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryIOTest.java
b/sdks/java/io/google-cloud-platform/src/test/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryIOTest.java
index fe41703..c9061a3 100644
--- a/sdks/java/io/google-cloud-platform/src/test/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryIOTest.java
+++ b/sdks/java/io/google-cloud-platform/src/test/java/org/apache/beam/sdk/io/gcp/bigquery/BigQueryIOTest.java
@@ -145,6 +145,7 @@ import org.apache.beam.sdk.transforms.display.DisplayData;
 import org.apache.beam.sdk.transforms.display.DisplayDataEvaluator;
 import org.apache.beam.sdk.transforms.windowing.BoundedWindow;
 import org.apache.beam.sdk.transforms.windowing.GlobalWindow;
+import org.apache.beam.sdk.transforms.windowing.IntervalWindow;
 import org.apache.beam.sdk.transforms.windowing.NonMergingWindowFn;
 import org.apache.beam.sdk.transforms.windowing.Window;
 import org.apache.beam.sdk.transforms.windowing.WindowFn;
@@ -154,6 +155,7 @@ import org.apache.beam.sdk.util.IOChannelUtils;
 import org.apache.beam.sdk.util.MimeTypes;
 import org.apache.beam.sdk.util.PCollectionViews;
 import org.apache.beam.sdk.util.Transport;
+import org.apache.beam.sdk.util.WindowedValue;
 import org.apache.beam.sdk.util.WindowingStrategy;
 import org.apache.beam.sdk.values.KV;
 import org.apache.beam.sdk.values.PCollection;
@@ -2475,6 +2477,21 @@ public class BigQueryIOTest implements Serializable {
   }
 
   @Test
+  public void testTableRowInfoCoderSerializable() {
+    CoderProperties.coderSerializable(BigQueryIO.TableRowInfoCoder.of());
+  }
+
+  @Test
+  public void testComplexCoderSerializable() {
+    CoderProperties.coderSerializable(
+        WindowedValue.getFullCoder(
+            KvCoder.of(
+                BigQueryIO.ShardedKeyCoder.of(StringUtf8Coder.of()),
+                BigQueryIO.TableRowInfoCoder.of()),
+            IntervalWindow.getCoder()));
+  }
+
+  @Test
   public void testUniqueStepIdRead() {
     RuntimeTestOptions options = PipelineOptionsFactory.as(RuntimeTestOptions.class);
     BigQueryOptions bqOptions = options.as(BigQueryOptions.class);


Mime
View raw message