beam-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From k...@apache.org
Subject [01/50] incubator-beam git commit: Restores StateContexts.stateContextFromComponents
Date Wed, 23 Nov 2016 06:51:57 GMT
Repository: incubator-beam
Updated Branches:
  refs/heads/gearpump-runner a14927f40 -> 28124050d


Restores StateContexts.stateContextFromComponents

It must be temporarily restored for compatibility with
current Dataflow worker in order for integration tests
to pass.


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

Branch: refs/heads/gearpump-runner
Commit: a23ae20760011634338e1c1eca9ec1891335fd6b
Parents: 90a0d0e
Author: Eugene Kirpichov <kirpichov@google.com>
Authored: Wed Nov 16 13:52:52 2016 -0800
Committer: Eugene Kirpichov <kirpichov@google.com>
Committed: Thu Nov 17 13:18:36 2016 -0800

----------------------------------------------------------------------
 .../beam/sdk/util/state/StateContexts.java      | 39 ++++++++++++++++++++
 1 file changed, 39 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/a23ae207/sdks/java/core/src/main/java/org/apache/beam/sdk/util/state/StateContexts.java
----------------------------------------------------------------------
diff --git a/sdks/java/core/src/main/java/org/apache/beam/sdk/util/state/StateContexts.java
b/sdks/java/core/src/main/java/org/apache/beam/sdk/util/state/StateContexts.java
index 81121e1..858d6fe 100644
--- a/sdks/java/core/src/main/java/org/apache/beam/sdk/util/state/StateContexts.java
+++ b/sdks/java/core/src/main/java/org/apache/beam/sdk/util/state/StateContexts.java
@@ -17,8 +17,10 @@
  */
 package org.apache.beam.sdk.util.state;
 
+import javax.annotation.Nullable;
 import org.apache.beam.sdk.options.PipelineOptions;
 import org.apache.beam.sdk.transforms.windowing.BoundedWindow;
+import org.apache.beam.sdk.util.WindowingInternals;
 import org.apache.beam.sdk.values.PCollectionView;
 
 /**
@@ -49,4 +51,41 @@ public class StateContexts {
   public static <W extends BoundedWindow> StateContext<W> nullContext() {
     return (StateContext<W>) NULL_CONTEXT;
   }
+
+  /**
+   * Deprecated, do not use.
+   *
+   * <p>This exists only for temporary compatibility with Dataflow worker and should
be deleted
+   * once a worker image is released that uses runners-core build after
+   * https://github.com/apache/incubator-beam/pull/1353.
+   */
+  @Deprecated
+  public static <W extends BoundedWindow> StateContext<W> createFromComponents(
+      @Nullable final PipelineOptions options,
+      final WindowingInternals<?, ?> windowingInternals,
+      final W window) {
+    @SuppressWarnings("unchecked")
+    StateContext<W> typedNullContext = (StateContext<W>) NULL_CONTEXT;
+    if (options == null) {
+      return typedNullContext;
+    } else {
+      return new StateContext<W>() {
+
+        @Override
+        public PipelineOptions getPipelineOptions() {
+          return options;
+        }
+
+        @Override
+        public <T> T sideInput(PCollectionView<T> view) {
+          return windowingInternals.sideInput(view, window);
+        }
+
+        @Override
+        public W window() {
+          return window;
+        }
+      };
+    }
+  }
 }


Mime
View raw message