dkuppitz commented on a change in pull request #997: TINKERPOP-2095 GroupStep looks for irrelevant barrier steps URL: https://github.com/apache/tinkerpop/pull/997#discussion_r235802573
########## File path: gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/GroupStep.java ########## @@ -59,19 +60,36 @@ public GroupStep(final Traversal.Admin traversal) { super(traversal); this.valueTraversal = this.integrateChild(__.fold().asAdmin()); - this.barrierStep = TraversalHelper.getFirstStepOfAssignableClass(Barrier.class, this.valueTraversal).orElse(null); + this.barrierStep = determineBarrierStep(this.valueTraversal); this.setReducingBiOperator(new GroupBiOperator<>(null == this.barrierStep ? Operator.assign : this.barrierStep.getMemoryComputeKey().getReducer())); this.setSeedSupplier(HashMapSupplier.instance()); } + /** + * Determines the first (non-local) barrier step in the provided traversal. This method is used by {@link GroupStep} + * and {@link org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.GroupSideEffectStep} to ultimately + * determine the reducing reducing bi-operator. + * + * @param traversal The traversal to inspect. + * @return The first non-local barrier step or {@code null} if no such step was found. + */ + public static <S, V> Barrier determineBarrierStep(final Traversal.Admin<S, V> traversal) { Review comment: I wanted to make it package private, but unfortunately `GroupSideEffectStep` resides in a different package. I prefer having it public instead of duplicating the code in `GroupSideEffectStep`. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services