Github user okram commented on a diff in the pull request:

    https://github.com/apache/tinkerpop/pull/729#discussion_r142803300
  
    --- Diff: 
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/MathStep.java
 ---
    @@ -0,0 +1,171 @@
    +/*
    + *  Licensed to the Apache Software Foundation (ASF) under one
    + *  or more contributor license agreements.  See the NOTICE file
    + *  distributed with this work for additional information
    + *  regarding copyright ownership.  The ASF licenses this file
    + *  to you under the Apache License, Version 2.0 (the
    + *  "License"); you may not use this file except in compliance
    + *  with the License.  You may obtain a copy of the License at
    + *
    + *  http://www.apache.org/licenses/LICENSE-2.0
    + *
    + *  Unless required by applicable law or agreed to in writing,
    + *  software distributed under the License is distributed on an
    + *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    + *  KIND, either express or implied.  See the License for the
    + *  specific language governing permissions and limitations
    + *  under the License.
    + */
    +
    +package org.apache.tinkerpop.gremlin.process.traversal.step.map;
    +
    +import net.objecthunter.exp4j.Expression;
    +import net.objecthunter.exp4j.ExpressionBuilder;
    +import org.apache.tinkerpop.gremlin.process.traversal.Pop;
    +import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
    +import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
    +import org.apache.tinkerpop.gremlin.process.traversal.step.ByModulating;
    +import org.apache.tinkerpop.gremlin.process.traversal.step.PathProcessor;
    +import org.apache.tinkerpop.gremlin.process.traversal.step.Scoping;
    +import org.apache.tinkerpop.gremlin.process.traversal.step.TraversalParent;
    +import 
org.apache.tinkerpop.gremlin.process.traversal.traverser.TraverserRequirement;
    +import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalRing;
    +import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalUtil;
    +import org.apache.tinkerpop.gremlin.structure.util.StringFactory;
    +
    +import java.util.HashSet;
    +import java.util.LinkedHashSet;
    +import java.util.List;
    +import java.util.Set;
    +import java.util.regex.Matcher;
    +import java.util.regex.Pattern;
    +
    +/**
    + * @author Marko A. Rodriguez (http://markorodriguez.com)
    + */
    +public final class MathStep<S> extends MapStep<S, Double> implements 
ByModulating, TraversalParent, Scoping, PathProcessor {
    +
    +    private static final String CURRENT = "_";
    +    private final String equation;
    +    private final Set<String> variables;
    +    private TraversalRing<Object, Number> traversalRing = new 
TraversalRing<>();
    +    private Set<String> keepLabels;
    +
    +    public MathStep(final Traversal.Admin traversal, final String 
equation) {
    +        super(traversal);
    +        this.equation = equation;
    +        this.variables = MathStep.getVariables(this.equation);
    +
    +    }
    +
    +    @Override
    +    protected Traverser.Admin<Double> processNextStart() {
    +        return 
PathProcessor.processTraverserPathLabels(super.processNextStart(), 
this.keepLabels);
    +    }
    +
    +    @Override
    +    protected Double map(final Traverser.Admin<S> traverser) {
    +        final Expression expression = new ExpressionBuilder(this.equation)
    --- End diff --
    
    Not with threading. Thus, OLAP and any other execution engine that uses 
threads will get inconsistent results.


---

Reply via email to