beam-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From echauc...@apache.org
Subject [beam] 19/37: Add an assert of equality in the encoders test
Date Thu, 24 Oct 2019 10:18:23 GMT
This is an automated email from the ASF dual-hosted git repository.

echauchot pushed a commit to branch spark-runner_structured-streaming
in repository https://gitbox.apache.org/repos/asf/beam.git

commit 78b2d2243f0732dd802d9e6f855607d2c2f06e59
Author: Etienne Chauchot <echauchot@apache.org>
AuthorDate: Thu Sep 5 15:28:05 2019 +0200

    Add an assert of equality in the encoders test
---
 .../runners/spark/structuredstreaming/utils/EncodersTest.java  | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/runners/spark/src/test/java/org/apache/beam/runners/spark/structuredstreaming/utils/EncodersTest.java
b/runners/spark/src/test/java/org/apache/beam/runners/spark/structuredstreaming/utils/EncodersTest.java
index b3a6273..c6b8631 100644
--- a/runners/spark/src/test/java/org/apache/beam/runners/spark/structuredstreaming/utils/EncodersTest.java
+++ b/runners/spark/src/test/java/org/apache/beam/runners/spark/structuredstreaming/utils/EncodersTest.java
@@ -1,10 +1,12 @@
 package org.apache.beam.runners.spark.structuredstreaming.utils;
 
+import static org.junit.Assert.assertEquals;
+
 import java.util.ArrayList;
 import java.util.List;
 import org.apache.beam.runners.spark.structuredstreaming.translation.helpers.EncoderHelpers;
-import org.apache.beam.sdk.coders.Coder;
 import org.apache.beam.sdk.coders.VarIntCoder;
+import org.apache.spark.sql.Dataset;
 import org.apache.spark.sql.SparkSession;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -24,7 +26,9 @@ public class EncodersTest {
     data.add(1);
     data.add(2);
     data.add(3);
-    sparkSession.createDataset(data, EncoderHelpers.fromBeamCoder(VarIntCoder.of()));
-//    sparkSession.createDataset(data, EncoderHelpers.genericEncoder());
+    Dataset<Integer> dataset = sparkSession
+        .createDataset(data, EncoderHelpers.fromBeamCoder(VarIntCoder.of()));
+    List<Integer> results = dataset.collectAsList();
+    assertEquals(data, results);
   }
 }


Mime
View raw message