beam-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From p..@apache.org
Subject [1/2] beam git commit: flink-runner: constructs exception string only when neccessary, it reduces per-element expensive calls(String.format and getSimpleName) in FlinkAssignContext.
Date Thu, 14 Sep 2017 09:21:28 GMT
Repository: beam
Updated Branches:
  refs/heads/master 50532f0a9 -> fa4ecea26


flink-runner: constructs exception string only when neccessary, it reduces per-element expensive
calls(String.format and getSimpleName) in FlinkAssignContext.


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

Branch: refs/heads/master
Commit: 31f51d28c574ea1792312a528b25793230787486
Parents: 50532f0
Author: Pei He <pei@apache.org>
Authored: Tue Sep 12 17:26:28 2017 +0800
Committer: Pei He <pei@apache.org>
Committed: Thu Sep 14 17:20:54 2017 +0800

----------------------------------------------------------------------
 .../translation/functions/FlinkAssignContext.java  | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/beam/blob/31f51d28/runners/flink/src/main/java/org/apache/beam/runners/flink/translation/functions/FlinkAssignContext.java
----------------------------------------------------------------------
diff --git a/runners/flink/src/main/java/org/apache/beam/runners/flink/translation/functions/FlinkAssignContext.java
b/runners/flink/src/main/java/org/apache/beam/runners/flink/translation/functions/FlinkAssignContext.java
index 447b1e5..26d6721 100644
--- a/runners/flink/src/main/java/org/apache/beam/runners/flink/translation/functions/FlinkAssignContext.java
+++ b/runners/flink/src/main/java/org/apache/beam/runners/flink/translation/functions/FlinkAssignContext.java
@@ -17,8 +17,6 @@
  */
 package org.apache.beam.runners.flink.translation.functions;
 
-import static com.google.common.base.Preconditions.checkArgument;
-
 import com.google.common.collect.Iterables;
 import org.apache.beam.sdk.transforms.windowing.BoundedWindow;
 import org.apache.beam.sdk.transforms.windowing.WindowFn;
@@ -35,13 +33,14 @@ class FlinkAssignContext<InputT, W extends BoundedWindow>
 
   FlinkAssignContext(WindowFn<InputT, W> fn, WindowedValue<InputT> value) {
     fn.super();
-    checkArgument(
-        Iterables.size(value.getWindows()) == 1,
-        String.format(
-            "%s passed to window assignment must be in a single window, but it was in %s:
%s",
-            WindowedValue.class.getSimpleName(),
-            Iterables.size(value.getWindows()),
-            value.getWindows()));
+    if (Iterables.size(value.getWindows()) != 1) {
+      throw new IllegalArgumentException(
+          String.format(
+              "%s passed to window assignment must be in a single window, but it was in %s:
%s",
+              WindowedValue.class.getSimpleName(),
+              Iterables.size(value.getWindows()),
+              value.getWindows()));
+    }
     this.value = value;
   }
 


Mime
View raw message