You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by ec...@apache.org on 2019/09/06 08:53:05 UTC

[beam] branch spark-runner_structured-streaming updated (cfdf4a4 -> f0f2078)

This is an automated email from the ASF dual-hosted git repository.

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


    from cfdf4a4  Improve exceptions catching
     new 3a333fb  Put Encoders expressions serializable
     new f0f2078  Catch Exception instead of IOException because some coders to not throw Exceptions at all (e.g.VoidCoder)

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../translation/helpers/EncoderHelpers.java               | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)


[beam] 02/02: Catch Exception instead of IOException because some coders to not throw Exceptions at all (e.g.VoidCoder)

Posted by ec...@apache.org.
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 f0f20786ff284290b3536ed23356ee6724fc1adc
Author: Etienne Chauchot <ec...@apache.org>
AuthorDate: Fri Sep 6 10:42:00 2019 +0200

    Catch Exception instead of IOException because some coders to not throw Exceptions at all (e.g.VoidCoder)
---
 .../structuredstreaming/translation/helpers/EncoderHelpers.java   | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

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 e7c5bb7..218dc0a 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
@@ -149,7 +149,7 @@ public class EncoderHelpers {
             $beamCoder.encode(${input.value}, baos);
             ${ev.value} =  baos.toByteArray();
         }
-        } catch (java.io.IOException e) {
+        } catch (Exception e) {
           throw org.apache.beam.sdk.util.UserCodeException.wrap(e);
         }
       */
@@ -162,7 +162,7 @@ public class EncoderHelpers {
       parts.add(".encode(");
       parts.add(", baos); ");
       parts.add(
-          " = baos.toByteArray();}} catch (java.io.IOException e) {throw org.apache.beam.sdk.util.UserCodeException.wrap(e);}");
+          " = baos.toByteArray();}} catch (Exception e) {throw org.apache.beam.sdk.util.UserCodeException.wrap(e);}");
 
       StringContext sc =
           new StringContext(JavaConversions.collectionAsScalaIterable(parts).toSeq());
@@ -265,7 +265,7 @@ public class EncoderHelpers {
             ${input.isNull} ?
             ${CodeGenerator.defaultValue(dataType)} :
             ($javaType) $beamCoder.decode(new java.io.ByteArrayInputStream(${input.value}));
-           } catch (java.io.IOException e) {
+           } catch (Exception e) {
             throw org.apache.beam.sdk.util.UserCodeException.wrap(e);
            }
       */
@@ -280,7 +280,7 @@ public class EncoderHelpers {
       parts.add(") ");
       parts.add(".decode(new java.io.ByteArrayInputStream(");
       parts.add(
-          "));  } catch (java.io.IOException e) {throw org.apache.beam.sdk.util.UserCodeException.wrap(e);}");
+          "));  } catch (Exception e) {throw org.apache.beam.sdk.util.UserCodeException.wrap(e);}");
 
       StringContext sc =
           new StringContext(JavaConversions.collectionAsScalaIterable(parts).toSeq());


[beam] 01/02: Put Encoders expressions serializable

Posted by ec...@apache.org.
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 3a333fb2fbdbe32df9e6eaaa6484f53692c805c1
Author: Etienne Chauchot <ec...@apache.org>
AuthorDate: Fri Sep 6 10:31:36 2019 +0200

    Put Encoders expressions serializable
---
 .../structuredstreaming/translation/helpers/EncoderHelpers.java    | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

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 f4ea6fa..e7c5bb7 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
@@ -20,6 +20,7 @@ package org.apache.beam.runners.spark.structuredstreaming.translation.helpers;
 import static org.apache.spark.sql.types.DataTypes.BinaryType;
 
 import java.io.ByteArrayInputStream;
+import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Objects;
@@ -114,7 +115,8 @@ public class EncoderHelpers {
    *
    * @param <T>: Type of elements ot be serialized.
    */
-  public static class EncodeUsingBeamCoder<T> extends UnaryExpression implements NonSQLExpression {
+  public static class EncodeUsingBeamCoder<T> extends UnaryExpression
+      implements NonSQLExpression, Serializable {
 
     private Expression child;
     private Coder<T> beamCoder;
@@ -229,7 +231,8 @@ public class EncoderHelpers {
    *
    * @param <T>: Type of elements ot be serialized.
    */
-  public static class DecodeUsingBeamCoder<T> extends UnaryExpression implements NonSQLExpression {
+  public static class DecodeUsingBeamCoder<T> extends UnaryExpression
+      implements NonSQLExpression, Serializable {
 
     private Expression child;
     private ClassTag<T> classTag;