You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by sp...@apache.org on 2017/04/06 11:46:32 UTC

[42/50] tinkerpop git commit: Found an ancient bug in B_LP_O_S_SE_SL_Traverser that only reared its ugly head with how LABELED_PATH requirements are now computed. Bug fixed and optimized LABELED_PATH requirment analysis.

Found an ancient bug in B_LP_O_S_SE_SL_Traverser that only reared its ugly head with how LABELED_PATH requirements are now computed. Bug fixed and optimized LABELED_PATH requirment analysis.


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

Branch: refs/heads/TINKERPOP-1577
Commit: 8ac09c8866df1bbbe23576b07bfda6820ba60c07
Parents: af5f336
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Wed Mar 29 11:41:31 2017 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Wed Mar 29 11:41:31 2017 -0600

----------------------------------------------------------------------
 CHANGELOG.asciidoc                                          | 1 +
 .../traversal/traverser/B_LP_O_S_SE_SL_Traverser.java       | 2 +-
 .../gremlin/process/traversal/util/DefaultTraversal.java    | 2 +-
 .../gremlin/process/traversal/util/TraversalHelper.java     | 9 ++++++---
 4 files changed, 9 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/8ac09c88/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index 5731497..78055af 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -26,6 +26,7 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
 TinkerPop 3.2.5 (Release Date: NOT OFFICIALLY RELEASED YET)
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
+* Fixed a `NullPointerException` bug in `B_LP_O_S_SE_SL_Traverser`.
 * `PathRetractionStrategy` now uses the marker-model to reduce recursive lookups of invalidating steps.
 * `ProfileStrategy` now uses the marker-model to reduce recursive lookups of `ProfileSideEffectStep`.
 * `Mutating` steps now implement `Scoping` interface.

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/8ac09c88/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/B_LP_O_S_SE_SL_Traverser.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/B_LP_O_S_SE_SL_Traverser.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/B_LP_O_S_SE_SL_Traverser.java
index fc16366..74a049c 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/B_LP_O_S_SE_SL_Traverser.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/B_LP_O_S_SE_SL_Traverser.java
@@ -121,7 +121,7 @@ public class B_LP_O_S_SE_SL_Traverser<T> extends B_O_S_SE_SL_Traverser<T> {
                 && ((B_LP_O_S_SE_SL_Traverser) object).t.equals(this.t)
                 && ((B_LP_O_S_SE_SL_Traverser) object).future.equals(this.future)
                 && ((B_LP_O_S_SE_SL_Traverser) object).loops == this.loops
-                && (null == this.sack || null != this.sideEffects.getSackMerger())
+                && (null == this.sack || (null != this.sideEffects && null != this.sideEffects.getSackMerger())) // hmmm... serialization in OLAP destroys the transient sideEffects
                 && ((B_LP_O_S_SE_SL_Traverser) object).path.popEquals(Pop.last, this.path); // this should be Pop.all?
     }
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/8ac09c88/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/DefaultTraversal.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/DefaultTraversal.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/DefaultTraversal.java
index c0e54db..c8f4b24 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/DefaultTraversal.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/DefaultTraversal.java
@@ -147,7 +147,7 @@ public class DefaultTraversal<S, E> implements Traversal.Admin<S, E> {
             for (final Step<?, ?> step : this.getSteps()) {
                 this.requirements.addAll(step.getRequirements());
             }
-            if (TraversalHelper.hasLabels(this))
+            if (!this.requirements.contains(TraverserRequirement.LABELED_PATH) && TraversalHelper.hasLabels(this))
                 this.requirements.add(TraverserRequirement.LABELED_PATH);
             if (!this.getSideEffects().keys().isEmpty())
                 this.requirements.add(TraverserRequirement.SIDE_EFFECTS);

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/8ac09c88/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/TraversalHelper.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/TraversalHelper.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/TraversalHelper.java
index 95862d0..de4e36f 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/TraversalHelper.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/TraversalHelper.java
@@ -45,6 +45,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.StartStep;
 import org.apache.tinkerpop.gremlin.process.traversal.step.util.BulkSet;
 import org.apache.tinkerpop.gremlin.process.traversal.step.util.EmptyStep;
 import org.apache.tinkerpop.gremlin.process.traversal.step.util.HasContainer;
+import org.apache.tinkerpop.gremlin.structure.Graph;
 import org.apache.tinkerpop.gremlin.structure.T;
 import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils;
 
@@ -435,7 +436,7 @@ public final class TraversalHelper {
      * Determine if any child step of a {@link TraversalParent} match the step given the provided {@link Predicate}.
      *
      * @param predicate the match function
-     * @param step the step to perform the action on
+     * @param step      the step to perform the action on
      * @return {@code true} if there is a match and {@code false} otherwise
      */
     public static boolean anyStepRecursively(final Predicate<Step> predicate, final TraversalParent step) {
@@ -552,8 +553,10 @@ public final class TraversalHelper {
 
     public static boolean hasLabels(final Traversal.Admin<?, ?> traversal) {
         for (final Step<?, ?> step : traversal.getSteps()) {
-            if (!step.getLabels().isEmpty())
-                return true;
+            for (final String label : step.getLabels()) {
+                if (!Graph.Hidden.isHidden(label))
+                    return true;
+            }
             if (step instanceof TraversalParent) {
                 for (final Traversal.Admin<?, ?> local : ((TraversalParent) step).getLocalChildren()) {
                     if (TraversalHelper.hasLabels(local))