beam-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tg...@apache.org
Subject [2/2] beam git commit: Use Structural Value when comparing Window(AndTrigger) Namespaces
Date Mon, 24 Apr 2017 18:07:20 GMT
Use Structural Value when comparing Window(AndTrigger) Namespaces

This makes sure we don't use a potentially default equals method and
instead compare based on the Coder, which is how Beam defines equality.


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

Branch: refs/heads/master
Commit: 14a859070b10329027d86393bd36a65812b7446e
Parents: f8d6168
Author: Thomas Groh <tgroh@google.com>
Authored: Thu Apr 20 20:00:55 2017 -0700
Committer: Thomas Groh <tgroh@google.com>
Committed: Mon Apr 24 11:05:26 2017 -0700

----------------------------------------------------------------------
 .../org/apache/beam/runners/core/StateNamespaces.java  | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/beam/blob/14a85907/runners/core-java/src/main/java/org/apache/beam/runners/core/StateNamespaces.java
----------------------------------------------------------------------
diff --git a/runners/core-java/src/main/java/org/apache/beam/runners/core/StateNamespaces.java
b/runners/core-java/src/main/java/org/apache/beam/runners/core/StateNamespaces.java
index e13c912..481aff9 100644
--- a/runners/core-java/src/main/java/org/apache/beam/runners/core/StateNamespaces.java
+++ b/runners/core-java/src/main/java/org/apache/beam/runners/core/StateNamespaces.java
@@ -142,7 +142,12 @@ public class StateNamespaces {
       }
 
       WindowNamespace<?> that = (WindowNamespace<?>) obj;
-      return Objects.equals(this.window, that.window);
+      return Objects.equals(
+          this.windowStructuralValue(), that.windowStructuralValue());
+    }
+
+    private Object windowStructuralValue() {
+      return windowCoder.structuralValue(window);
     }
 
     @Override
@@ -223,7 +228,11 @@ public class StateNamespaces {
 
       WindowAndTriggerNamespace<?> that = (WindowAndTriggerNamespace<?>) obj;
       return this.triggerIndex == that.triggerIndex
-          && Objects.equals(this.window, that.window);
+          && Objects.equals(this.windowStructuralValue(), that.windowStructuralValue());
+    }
+
+    private Object windowStructuralValue() {
+      return windowCoder.structuralValue(window);
     }
 
     @Override


Mime
View raw message