[ https://issues.apache.org/jira/browse/TINKERPOP-1869?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16452245#comment-16452245 ]
ASF GitHub Bot commented on TINKERPOP-1869: ------------------------------------------- Github user jorgebay commented on a diff in the pull request: https://github.com/apache/tinkerpop/pull/857#discussion_r184057436 --- Diff: gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/StandardVerificationStrategy.java --- @@ -63,15 +64,17 @@ public void apply(final Traversal.Admin<?, ?> traversal) { throw new VerificationException("The parent of a reducing barrier can not be repeat()-step: " + step, traversal); } - // The ProfileSideEffectStep must be the last step, 2nd last step when accompanied by the cap step, - // or 3rd to last when the traversal ends with a RequirementsStep. + // The ProfileSideEffectStep must be one of the following + // (1) the last step + // (2) 2nd last step when accompanied by the cap step or none step (i.e. iterate() to nothing) + // (3) 3rd to last when the traversal ends with a RequirementsStep. final Step<?, ?> endStep = traversal.asAdmin().getEndStep(); if (TraversalHelper.hasStepOfClass(ProfileSideEffectStep.class, traversal) && !(endStep instanceof ProfileSideEffectStep || (endStep instanceof SideEffectCapStep && endStep.getPreviousStep() instanceof ProfileSideEffectStep) || - (endStep instanceof RequirementsStep && ( - endStep.getPreviousStep() instanceof SideEffectCapStep || - endStep.getPreviousStep() instanceof ProfileSideEffectStep)))) { + (endStep instanceof NoneStep && endStep.getPreviousStep() instanceof SideEffectCapStep && endStep.getPreviousStep().getPreviousStep() instanceof ProfileSideEffectStep) || --- End diff -- I think we can save some `instanceof` checks if we introduce a method similar to `TraversalHelper.hasStepOfClass(ProfileSideEffectStep.class, traversal)` but instead of returning a boolean, it returns the step instance. Then, from the `ProfileSideEffectStep` instance itself, it's easier to do the checks. > Profile step and iterate do not play nicely with each other > ----------------------------------------------------------- > > Key: TINKERPOP-1869 > URL: https://issues.apache.org/jira/browse/TINKERPOP-1869 > Project: TinkerPop > Issue Type: Bug > Components: process > Affects Versions: 3.3.1 > Reporter: Bryn Cooke > Assignee: stephen mallette > Priority: Minor > > Profile step doesn't like it if there are any other steps after it. However > if someone calls profile().iterate() they will get an error as iterate > appends a NoneStep to the end of the traversal. > Even though this means that the results of the profile would never be > returned I think that profile step should allow None step to follow it. -- This message was sent by Atlassian JIRA (v7.6.3#76005)