You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by dk...@apache.org on 2015/06/04 12:15:53 UTC

[39/43] incubator-tinkerpop git commit: If the bindings of WhereStep don't bind, then filter -- don't throw an Exception. Now SelectStep, SelectOneStep, HasStep, and WhereStep all have the same behavior around unbound variables.

If the bindings of WhereStep don't bind, then filter -- don't throw an Exception. Now SelectStep, SelectOneStep, HasStep, and WhereStep all have the same behavior around unbound variables.


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

Branch: refs/heads/preprocessor
Commit: 89e02edd4b0b858622ddc98b9b779d90b6372491
Parents: 8b31040
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Wed Jun 3 11:01:45 2015 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Wed Jun 3 11:01:45 2015 -0600

----------------------------------------------------------------------
 .../process/traversal/step/filter/WhereStep.java      | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/89e02edd/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/WhereStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/WhereStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/WhereStep.java
index 3546f42..9822b77 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/WhereStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/WhereStep.java
@@ -140,13 +140,21 @@ public final class WhereStep<S> extends FilterStep<S> implements TraversalParent
         if (this.noStartAndEndKeys()) {
             return this.predicate.getBiPredicate().test(getStartObject(traverser), null);
         } else {
-            return this.predicate.getBiPredicate().test(
-                    null == this.startKey ? getStartObject(traverser) : this.getScopeValueByKey(this.startKey, traverser),
-                    null == this.endKey ? null : this.getScopeValueByKey(this.endKey, traverser));
+            final Object startObject = null == this.startKey ? getStartObject(traverser) : this.getOptionalScopeValueByKey(this.startKey, traverser).orElse(null);
+            if (null == startObject) return false;
+            final Object endObject;
+            if (null == this.endKey) {
+                endObject = null;
+            } else {
+                endObject = this.getOptionalScopeValueByKey(this.endKey, traverser).orElse(null);
+                if (null == endObject) return false;
+            }
+            return this.predicate.getBiPredicate().test(startObject, endObject);
         }
     }
 
     private boolean doMultiKeyFilter(final Traverser.Admin<S> traverser) {
+        // TODO: getOptionalScopeValueByKey()
         final List<Object> startObjects = new ArrayList<>();
         final List<Object> endObjects = new ArrayList<>();