beam-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lc...@apache.org
Subject [beam] branch master updated: Return no environment more often
Date Mon, 29 Jan 2018 23:49:21 GMT
This is an automated email from the ASF dual-hosted git repository.

lcwik pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/beam.git


The following commit(s) were added to refs/heads/master by this push:
     new 4593d97  Return no environment more often
4593d97 is described below

commit 4593d9762296f3a012a1e2781d9b9c29e16ffb75
Author: Thomas Groh <tgroh@google.com>
AuthorDate: Fri Jan 26 18:21:11 2018 -0800

    Return no environment more often
    
    Some PTransforms have an environment only sometimes. In this
    case, the EnvironmentID will be the empty string instead of
    null, but this should still return 'no environment'
---
 .../org/apache/beam/runners/core/construction/Environments.java     | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/runners/core-construction-java/src/main/java/org/apache/beam/runners/core/construction/Environments.java
b/runners/core-construction-java/src/main/java/org/apache/beam/runners/core/construction/Environments.java
index 978fc71..3613cf9 100644
--- a/runners/core-construction-java/src/main/java/org/apache/beam/runners/core/construction/Environments.java
+++ b/runners/core-construction-java/src/main/java/org/apache/beam/runners/core/construction/Environments.java
@@ -18,6 +18,7 @@
 
 package org.apache.beam.runners.core.construction;
 
+import com.google.common.base.Strings;
 import com.google.common.collect.ImmutableMap;
 import com.google.protobuf.InvalidProtocolBufferException;
 import java.io.IOException;
@@ -62,7 +63,10 @@ public class Environments {
           KNOWN_URN_SPEC_EXTRACTORS
               .getOrDefault(ptransform.getSpec().getUrn(), DEFAULT_SPEC_EXTRACTOR)
               .getEnvironmentId(ptransform);
-      if (envId != null) {
+      if (!Strings.isNullOrEmpty(envId)) {
+        // Some PTransform payloads may have an empty (default) Environment ID, for example
a
+        // WindowIntoPayload with a known WindowFn. Others will never have an Environment
ID, such
+        // as a GroupByKeyPayload, and the Default extractor returns null in this case.
         return Optional.of(components.getEnvironment(envId));
       } else {
         return Optional.empty();

-- 
To stop receiving notification emails like this one, please contact
lcwik@apache.org.

Mime
View raw message