beam-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From echauc...@apache.org
Subject [beam] 05/37: type erasure: spark encoders require a Class<T>, pass Object and cast to Class<T>
Date Thu, 24 Oct 2019 10:21:13 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 c9e3534029811aabc00d09471ec78f943ba34028
Author: Etienne Chauchot <echauchot@apache.org>
AuthorDate: Thu Aug 29 10:57:53 2019 +0200

    type erasure: spark encoders require a Class<T>, pass Object and cast to Class<T>
---
 .../spark/structuredstreaming/translation/helpers/EncoderHelpers.java  | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/runners/spark/src/main/java/org/apache/beam/runners/spark/structuredstreaming/translation/helpers/EncoderHelpers.java
b/runners/spark/src/main/java/org/apache/beam/runners/spark/structuredstreaming/translation/helpers/EncoderHelpers.java
index ab24e37..9cb8f29 100644
--- a/runners/spark/src/main/java/org/apache/beam/runners/spark/structuredstreaming/translation/helpers/EncoderHelpers.java
+++ b/runners/spark/src/main/java/org/apache/beam/runners/spark/structuredstreaming/translation/helpers/EncoderHelpers.java
@@ -96,9 +96,10 @@ public class EncoderHelpers {
   */
 
   /** A way to construct encoders using generic serializers. */
-  public static <T> Encoder<T> fromBeamCoder(Coder<T> coder, Class<T>
claz){
+  public static <T> Encoder<T> fromBeamCoder(Coder<T> coder/*, Class<T>
claz*/){
 
     List<Expression> serialiserList = new ArrayList<>();
+    Class<T> claz = (Class<T>) Object.class;
     serialiserList.add(new EncodeUsingBeamCoder<>(claz, coder));
     ClassTag<T> classTag = ClassTag$.MODULE$.apply(claz);
     return new ExpressionEncoder<>(


Mime
View raw message