You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by ok...@apache.org on 2015/02/13 00:33:21 UTC

incubator-tinkerpop git commit: added sum(local), mean(local), min(local), max(local) and respective XXXLocalStep.

Repository: incubator-tinkerpop
Updated Branches:
  refs/heads/master 8099f7349 -> 4c88d660d


added sum(local),mean(local),min(local),max(local) and respective XXXLocalStep.


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

Branch: refs/heads/master
Commit: 4c88d660db881af71be23b0851b25f5a0316c500
Parents: 8099f73
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Thu Feb 12 16:33:16 2015 -0700
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Thu Feb 12 16:33:16 2015 -0700

----------------------------------------------------------------------
 CHANGELOG.asciidoc                              |   2 +-
 docs/src/the-traversal.asciidoc                 |   8 ++
 .../graph/traversal/ElementTraversal.java       |  16 +++
 .../process/graph/traversal/GraphTraversal.java |  37 +++--
 .../gremlin/process/graph/traversal/__.java     |  17 +++
 .../graph/traversal/step/map/LambdaMapStep.java |   2 +-
 .../graph/traversal/step/map/MaxGlobalStep.java |  73 ++++++++++
 .../graph/traversal/step/map/MaxLocalStep.java  |  59 ++++++++
 .../graph/traversal/step/map/MaxStep.java       |  73 ----------
 .../traversal/step/map/MeanGlobalStep.java      | 136 +++++++++++++++++++
 .../graph/traversal/step/map/MeanLocalStep.java |  60 ++++++++
 .../graph/traversal/step/map/MeanStep.java      | 136 -------------------
 .../graph/traversal/step/map/MinGlobalStep.java |  73 ++++++++++
 .../graph/traversal/step/map/MinLocalStep.java  |  59 ++++++++
 .../graph/traversal/step/map/MinStep.java       |  73 ----------
 .../graph/traversal/step/map/SumGlobalStep.java |  79 +++++++++++
 .../graph/traversal/step/map/SumLocalStep.java  |  57 ++++++++
 .../graph/traversal/step/map/SumStep.java       |  79 -----------
 .../util/function/MeanNumberSupplier.java       |   8 +-
 19 files changed, 672 insertions(+), 375 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/4c88d660/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index 42aaa1f..c94a08b 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -9,7 +9,7 @@ image::http://www.tinkerpop.com/docs/current/images/gremlin-hindu.png[width=225]
 TinkerPop 3.0.0.M8 (Release Date: NOT OFFICIALLY RELEASED YET)
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-* Added `CountLocalStep` / `count(local)` for counting the objects in the current object container.
+* Added `count(local)`, `sum(local)`, `max(local)`, `min(local)`, and `mean(local)` operating on the local object (e.g. collection, map, etc.)
 * `TraversalComparator` exists which allows for `order().by(outE().count(),decr)`.
 * Apache refactoring: `com.tinkerpop` -> `org.apache.tinkerpop`.
 * `Traversal` is now `Serializable` and with 99% of queries no longer needing lambdas, Gremlin-Java works over the wire.

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/4c88d660/docs/src/the-traversal.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/the-traversal.asciidoc b/docs/src/the-traversal.asciidoc
index b0a1b56..e09ee78 100644
--- a/docs/src/the-traversal.asciidoc
+++ b/docs/src/the-traversal.asciidoc
@@ -756,6 +756,8 @@ g.V().values('age').max()
 g.V().repeat(both()).times(3).values('age').max()
 ----
 
+IMPORTANT: `max(local)` determines the max of the current, local object (not the objects in the traversal stream). This works for `Collection` and `Number`-type objects. For any other object, a max of `Double.NaN` is returned.
+
 [[mean-step]]
 Mean Step
 ~~~~~~~~~
@@ -771,6 +773,8 @@ g.V().repeat(both()).times(3).values('age').dedup().mean()
 
 <1> Realize that traversers are being bulked by `repeat()`. There may be more of a particular number than another, thus altering the average.
 
+IMPORTANT: `mean(local)` determines the mean of the current, local object (not the objects in the traversal stream). This works for `Collection` and `Number`-type objects. For any other object, a mean of `Double.NaN` is returned.
+
 [[min-step]]
 Min Step
 ~~~~~~~~
@@ -783,6 +787,8 @@ g.V().values('age').min()
 g.V().repeat(both()).times(3).values('age').min()
 ----
 
+IMPORTANT: `min(local)` determines the min of the current, local object (not the objects in the traversal stream). This works for `Collection` and `Number`-type objects. For any other object, a min of `Double.NaN` is returned.
+
 [[or-step]]
 Or Step
 ~~~~~~~
@@ -1238,6 +1244,8 @@ g.V().values('age').sum()
 g.V().repeat(both()).times(3).values('age').sum()
 ----
 
+IMPORTANT: `sum(local)` determines the sum of the current, local object (not the objects in the traversal stream). This works for `Collection`-type objects. For any other object, a sum of `Double.NaN` is returned.
+
 [[timelimit-step]]
 TimeLimit Step
 ~~~~~~~~~~~~~~

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/4c88d660/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/ElementTraversal.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/ElementTraversal.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/ElementTraversal.java
index 2b70428..516acff 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/ElementTraversal.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/ElementTraversal.java
@@ -190,18 +190,34 @@ public abstract interface ElementTraversal<A extends Element> {
         return this.start().sum();
     }
 
+    public default GraphTraversal<A, Double> sum(final Scope scope) {
+        return this.start().sum(scope);
+    }
+
     public default <E2 extends Number> GraphTraversal<A, E2> min() {
         return this.start().min();
     }
 
+    public default <E2 extends Number> GraphTraversal<A, E2> min(final Scope scope) {
+        return this.start().min(scope);
+    }
+
     public default <E2 extends Number> GraphTraversal<A, E2> max() {
         return this.start().max();
     }
 
+    public default <E2 extends Number> GraphTraversal<A, E2> max(final Scope scope) {
+        return this.start().max(scope);
+    }
+
     public default GraphTraversal<A, Double> mean() {
         return this.start().mean();
     }
 
+    public default GraphTraversal<A, Double> mean(final Scope scope) {
+        return this.start().mean(scope);
+    }
+
     ///////////////////// FILTER STEPS /////////////////////
 
     public default GraphTraversal<A, A> filter(final Predicate<Traverser<A>> predicate) {

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/4c88d660/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/GraphTraversal.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/GraphTraversal.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/GraphTraversal.java
index d2a0656..83e4175 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/GraphTraversal.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/GraphTraversal.java
@@ -65,9 +65,12 @@ import org.apache.tinkerpop.gremlin.process.graph.traversal.step.map.KeyStep;
 import org.apache.tinkerpop.gremlin.process.graph.traversal.step.map.LabelStep;
 import org.apache.tinkerpop.gremlin.process.graph.traversal.step.map.LambdaFlatMapStep;
 import org.apache.tinkerpop.gremlin.process.graph.traversal.step.map.LambdaMapStep;
-import org.apache.tinkerpop.gremlin.process.graph.traversal.step.map.MaxStep;
-import org.apache.tinkerpop.gremlin.process.graph.traversal.step.map.MeanStep;
-import org.apache.tinkerpop.gremlin.process.graph.traversal.step.map.MinStep;
+import org.apache.tinkerpop.gremlin.process.graph.traversal.step.map.MaxGlobalStep;
+import org.apache.tinkerpop.gremlin.process.graph.traversal.step.map.MaxLocalStep;
+import org.apache.tinkerpop.gremlin.process.graph.traversal.step.map.MeanGlobalStep;
+import org.apache.tinkerpop.gremlin.process.graph.traversal.step.map.MeanLocalStep;
+import org.apache.tinkerpop.gremlin.process.graph.traversal.step.map.MinGlobalStep;
+import org.apache.tinkerpop.gremlin.process.graph.traversal.step.map.MinLocalStep;
 import org.apache.tinkerpop.gremlin.process.graph.traversal.step.map.OrderGlobalStep;
 import org.apache.tinkerpop.gremlin.process.graph.traversal.step.map.OrderLocalStep;
 import org.apache.tinkerpop.gremlin.process.graph.traversal.step.map.PathStep;
@@ -77,7 +80,8 @@ import org.apache.tinkerpop.gremlin.process.graph.traversal.step.map.PropertyVal
 import org.apache.tinkerpop.gremlin.process.graph.traversal.step.map.SackStep;
 import org.apache.tinkerpop.gremlin.process.graph.traversal.step.map.SelectOneStep;
 import org.apache.tinkerpop.gremlin.process.graph.traversal.step.map.SelectStep;
-import org.apache.tinkerpop.gremlin.process.graph.traversal.step.map.SumStep;
+import org.apache.tinkerpop.gremlin.process.graph.traversal.step.map.SumGlobalStep;
+import org.apache.tinkerpop.gremlin.process.graph.traversal.step.map.SumLocalStep;
 import org.apache.tinkerpop.gremlin.process.graph.traversal.step.map.UnfoldStep;
 import org.apache.tinkerpop.gremlin.process.graph.traversal.step.map.VertexStep;
 import org.apache.tinkerpop.gremlin.process.graph.traversal.step.map.match.MatchStep;
@@ -332,19 +336,36 @@ public interface GraphTraversal<S, E> extends Traversal<S, E> {
     }
 
     public default GraphTraversal<S, Double> sum() {
-        return this.asAdmin().addStep(new SumStep(this.asAdmin()));
+        return this.sum(Scope.global);
+    }
+
+    public default GraphTraversal<S, Double> sum(final Scope scope) {
+        return this.asAdmin().addStep(scope.equals(Scope.global) ? new SumGlobalStep(this.asAdmin()) : new SumLocalStep<>(this.asAdmin()));
     }
 
     public default <E2 extends Number> GraphTraversal<S, E2> max() {
-        return this.asAdmin().addStep(new MaxStep<>(this.asAdmin()));
+        return this.max(Scope.global);
+    }
+
+    public default <E2 extends Number> GraphTraversal<S, E2> max(final Scope scope) {
+        return this.asAdmin().addStep(scope.equals(Scope.global) ? new MaxGlobalStep<E2>(this.asAdmin()) : new MaxLocalStep(this.asAdmin()));
     }
 
     public default <E2 extends Number> GraphTraversal<S, E2> min() {
-        return this.asAdmin().addStep(new MinStep<>(this.asAdmin()));
+        return this.min(Scope.global);
     }
 
+    public default <E2 extends Number> GraphTraversal<S, E2> min(final Scope scope) {
+        return this.asAdmin().addStep(scope.equals(Scope.global) ? new MinGlobalStep<E2>(this.asAdmin()) : new MinLocalStep(this.asAdmin()));
+    }
+
+
     public default GraphTraversal<S, Double> mean() {
-        return this.asAdmin().addStep(new MeanStep<>(this.asAdmin()));
+        return this.mean(Scope.global);
+    }
+
+    public default GraphTraversal<S, Double> mean(final Scope scope) {
+        return this.asAdmin().addStep(scope.equals(Scope.global) ? new MeanGlobalStep<>(this.asAdmin()) : new MeanLocalStep<>(this.asAdmin()));
     }
 
     ///////////////////// FILTER STEPS /////////////////////

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/4c88d660/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/__.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/__.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/__.java
index 9c3bc51..56f1ff7 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/__.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/__.java
@@ -220,18 +220,35 @@ public class __ {
         return __.<A>start().sum();
     }
 
+    public static <A> GraphTraversal<A, Double> sum(final Scope scope) {
+        return __.<A>start().sum(scope);
+    }
+
+
     public static <A, E2 extends Number> GraphTraversal<A, E2> min() {
         return __.<A>start().min();
     }
 
+    public static <A, E2 extends Number> GraphTraversal<A, E2> min(final Scope scope) {
+        return __.<A>start().min(scope);
+    }
+
     public static <A, E2 extends Number> GraphTraversal<A, E2> max() {
         return __.<A>start().max();
     }
 
+    public static <A, E2 extends Number> GraphTraversal<A, E2> max(final Scope scope) {
+        return __.<A>start().max(scope);
+    }
+
     public static <A> GraphTraversal<A, Double> mean() {
         return __.<A>start().mean();
     }
 
+    public static <A> GraphTraversal<A, Double> mean(final Scope scope) {
+        return __.<A>start().mean(scope);
+    }
+
     ///////////////////// FILTER STEPS /////////////////////
 
     public static <A> GraphTraversal<A, A> filter(final Predicate<Traverser<A>> predicate) {

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/4c88d660/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/LambdaMapStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/LambdaMapStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/LambdaMapStep.java
index b677b2d..d22e630 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/LambdaMapStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/LambdaMapStep.java
@@ -27,7 +27,7 @@ import java.util.function.Function;
 /**
  * @author Marko A. Rodriguez (http://markorodriguez.com)
  */
-public class LambdaMapStep<S, E> extends MapStep<S, E> {
+public final class LambdaMapStep<S, E> extends MapStep<S, E> {
 
     private final Function<Traverser<S>, E> function;
 

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/4c88d660/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/MaxGlobalStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/MaxGlobalStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/MaxGlobalStep.java
new file mode 100644
index 0000000..7e013d4
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/MaxGlobalStep.java
@@ -0,0 +1,73 @@
+/*
+ * 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.graph.traversal.step.map;
+
+import org.apache.tinkerpop.gremlin.process.Traversal;
+import org.apache.tinkerpop.gremlin.process.Traverser;
+import org.apache.tinkerpop.gremlin.process.graph.traversal.step.util.ReducingBarrierStep;
+import org.apache.tinkerpop.gremlin.process.traversal.step.Reducing;
+import org.apache.tinkerpop.gremlin.process.traverser.TraverserRequirement;
+import org.apache.tinkerpop.gremlin.util.function.ConstantSupplier;
+
+import java.io.Serializable;
+import java.util.Collections;
+import java.util.Set;
+import java.util.function.BiFunction;
+
+/**
+ * @author Marko A. Rodriguez (http://markorodriguez.com)
+ */
+public final class MaxGlobalStep<S extends Number> extends ReducingBarrierStep<S, S> implements Reducing<S, Traverser<S>> {
+
+    public MaxGlobalStep(final Traversal.Admin traversal) {
+        super(traversal);
+        this.setSeedSupplier(new ConstantSupplier<>((S) Double.valueOf(Double.MIN_VALUE)));
+        this.setBiFunction(MaxBiFunction.<S>instance());
+    }
+
+    @Override
+    public Set<TraverserRequirement> getRequirements() {
+        return Collections.singleton(TraverserRequirement.OBJECT);
+    }
+
+    @Override
+    public Reducer<S, Traverser<S>> getReducer() {
+        return new Reducer<>(this.getSeedSupplier(), this.getBiFunction(), true);
+    }
+
+    /////
+
+    private static class MaxBiFunction<S extends Number> implements BiFunction<S, Traverser<S>, S>, Serializable {
+
+        private static final MaxBiFunction INSTANCE = new MaxBiFunction();
+
+        private MaxBiFunction() {
+
+        }
+
+        @Override
+        public S apply(final S mutatingSeed, final Traverser<S> traverser) {
+            return mutatingSeed.doubleValue() > traverser.get().doubleValue() ? mutatingSeed : traverser.get();
+        }
+
+        public final static <S extends Number> MaxBiFunction<S> instance() {
+            return INSTANCE;
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/4c88d660/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/MaxLocalStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/MaxLocalStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/MaxLocalStep.java
new file mode 100644
index 0000000..059af47
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/MaxLocalStep.java
@@ -0,0 +1,59 @@
+/*
+ * 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.graph.traversal.step.map;
+
+import org.apache.tinkerpop.gremlin.process.Traversal;
+import org.apache.tinkerpop.gremlin.process.Traverser;
+import org.apache.tinkerpop.gremlin.process.traverser.TraverserRequirement;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Set;
+
+/**
+ * @author Marko A. Rodriguez (http://markorodriguez.com)
+ */
+public final class MaxLocalStep<S> extends MapStep<S, Number> {
+
+    public MaxLocalStep(final Traversal.Admin traversal) {
+        super(traversal);
+    }
+
+    @Override
+    protected Number map(final Traverser.Admin<S> traverser) {
+        final S start = traverser.get();
+        if (start instanceof Number) {
+            return (Number) start;
+        } else if (start instanceof Collection) {
+            Number temp = Double.MIN_VALUE;
+            for (final Number number : (Collection<Number>) start) {
+                if (number.doubleValue() > temp.doubleValue())
+                    temp = number;
+            }
+            return temp;
+        } else
+            return Double.NaN;
+    }
+
+
+    @Override
+    public Set<TraverserRequirement> getRequirements() {
+        return Collections.singleton(TraverserRequirement.OBJECT);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/4c88d660/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/MaxStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/MaxStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/MaxStep.java
deleted file mode 100644
index 0b507c1..0000000
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/MaxStep.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * 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.graph.traversal.step.map;
-
-import org.apache.tinkerpop.gremlin.process.Traversal;
-import org.apache.tinkerpop.gremlin.process.Traverser;
-import org.apache.tinkerpop.gremlin.process.graph.traversal.step.util.ReducingBarrierStep;
-import org.apache.tinkerpop.gremlin.process.traversal.step.Reducing;
-import org.apache.tinkerpop.gremlin.process.traverser.TraverserRequirement;
-import org.apache.tinkerpop.gremlin.util.function.ConstantSupplier;
-
-import java.io.Serializable;
-import java.util.Collections;
-import java.util.Set;
-import java.util.function.BiFunction;
-
-/**
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-public final class MaxStep<S extends Number> extends ReducingBarrierStep<S, S> implements Reducing<S, Traverser<S>> {
-
-    public MaxStep(final Traversal.Admin traversal) {
-        super(traversal);
-        this.setSeedSupplier(new ConstantSupplier<>((S) Double.valueOf(Double.MIN_VALUE)));
-        this.setBiFunction(MaxBiFunction.<S>instance());
-    }
-
-    @Override
-    public Set<TraverserRequirement> getRequirements() {
-        return Collections.singleton(TraverserRequirement.OBJECT);
-    }
-
-    @Override
-    public Reducer<S, Traverser<S>> getReducer() {
-        return new Reducer<>(this.getSeedSupplier(), this.getBiFunction(), true);
-    }
-
-    /////
-
-    private static class MaxBiFunction<S extends Number> implements BiFunction<S, Traverser<S>, S>, Serializable {
-
-        private static final MaxBiFunction INSTANCE = new MaxBiFunction();
-
-        private MaxBiFunction() {
-
-        }
-
-        @Override
-        public S apply(final S mutatingSeed, final Traverser<S> traverser) {
-            return mutatingSeed.doubleValue() > traverser.get().doubleValue() ? mutatingSeed : traverser.get();
-        }
-
-        public final static <S extends Number> MaxBiFunction<S> instance() {
-            return INSTANCE;
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/4c88d660/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/MeanGlobalStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/MeanGlobalStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/MeanGlobalStep.java
new file mode 100644
index 0000000..17acfff
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/MeanGlobalStep.java
@@ -0,0 +1,136 @@
+/*
+ * 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.graph.traversal.step.map;
+
+import org.apache.tinkerpop.gremlin.process.Traversal;
+import org.apache.tinkerpop.gremlin.process.Traverser;
+import org.apache.tinkerpop.gremlin.process.graph.traversal.step.util.ReducingBarrierStep;
+import org.apache.tinkerpop.gremlin.process.traversal.step.Reducing;
+import org.apache.tinkerpop.gremlin.process.traverser.TraverserRequirement;
+import org.apache.tinkerpop.gremlin.util.function.MeanNumberSupplier;
+
+import java.io.Serializable;
+import java.util.EnumSet;
+import java.util.Set;
+import java.util.function.BiFunction;
+import java.util.function.Supplier;
+
+/**
+ * @author Marko A. Rodriguez (http://markorodriguez.com)
+ */
+public final class MeanGlobalStep<S extends Number, E extends Number> extends ReducingBarrierStep<S, E> implements Reducing<E, Traverser<S>> {
+
+    private static final Set<TraverserRequirement> REQUIREMENTS = EnumSet.of(TraverserRequirement.OBJECT, TraverserRequirement.BULK);
+
+    public MeanGlobalStep(final Traversal.Admin traversal) {
+        super(traversal);
+        this.setSeedSupplier((Supplier) MeanNumberSupplier.instance());
+        this.setBiFunction((BiFunction) MeanBiFunction.instance());
+    }
+
+    @Override
+    public Set<TraverserRequirement> getRequirements() {
+        return REQUIREMENTS;
+    }
+
+    @Override
+    public Reducer<E, Traverser<S>> getReducer() {
+        return new Reducer<>(this.getSeedSupplier(), this.getBiFunction(), true);
+    }
+
+    /////
+
+    private static class MeanBiFunction<S extends Number> implements BiFunction<S, Traverser<S>, S>, Serializable {
+
+        private static final MeanBiFunction INSTANCE = new MeanBiFunction();
+
+        private MeanBiFunction() {
+
+        }
+
+        @Override
+        public S apply(final S mutatingSeed, final Traverser<S> traverser) {
+            return (S) ((MeanNumber) mutatingSeed).add(traverser.get(), traverser.bulk());
+        }
+
+        public final static <S extends Number> MeanBiFunction<S> instance() {
+            return INSTANCE;
+        }
+    }
+
+    ///
+
+    public static final class MeanNumber extends Number implements Comparable<Number>, FinalGet<Double> {
+
+        private long count = 0l;
+        private double sum = 0.0d;
+
+        public MeanNumber add(final Number amount, final long count) {
+            this.count = this.count + count;
+            this.sum = this.sum + (amount.doubleValue() * count);
+            return this;
+        }
+
+        @Override
+        public int intValue() {
+            return (int) (this.sum / this.count);
+        }
+
+        @Override
+        public long longValue() {
+            return (long) (this.sum / this.count);
+        }
+
+        @Override
+        public float floatValue() {
+            return (float) (this.sum / this.count);
+        }
+
+        @Override
+        public double doubleValue() {
+            return this.sum / this.count;
+        }
+
+        @Override
+        public String toString() {
+            return Double.toString(this.doubleValue());
+        }
+
+        @Override
+        public int compareTo(final Number number) {
+            return Double.valueOf(this.doubleValue()).compareTo(number.doubleValue());
+        }
+
+        @Override
+        public boolean equals(final Object object) {
+            return object instanceof Number && Double.valueOf(this.doubleValue()).equals(((Number) object).doubleValue());
+        }
+
+        @Override
+        public int hashCode() {
+            return Double.valueOf(this.doubleValue()).hashCode();
+        }
+
+        @Override
+        public Double getFinal() {
+            return this.doubleValue();
+        }
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/4c88d660/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/MeanLocalStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/MeanLocalStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/MeanLocalStep.java
new file mode 100644
index 0000000..659e4d3
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/MeanLocalStep.java
@@ -0,0 +1,60 @@
+/*
+ * 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.graph.traversal.step.map;
+
+import org.apache.tinkerpop.gremlin.process.Traversal;
+import org.apache.tinkerpop.gremlin.process.Traverser;
+import org.apache.tinkerpop.gremlin.process.traverser.TraverserRequirement;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Set;
+
+/**
+ * @author Marko A. Rodriguez (http://markorodriguez.com)
+ */
+public final class MeanLocalStep<S> extends MapStep<S, Double> {
+
+    public MeanLocalStep(final Traversal.Admin traversal) {
+        super(traversal);
+    }
+
+    @Override
+    protected Double map(final Traverser.Admin<S> traverser) {
+        final S start = traverser.get();
+        if (start instanceof Collection) {
+            double sum = 0.0d;
+            int count = 0;
+            for (final Number number : (Collection<Number>) start) {
+                count++;
+                sum = sum + number.doubleValue();
+            }
+            return sum / count;
+        } else if (start instanceof Number) {
+            return ((Number) start).doubleValue();
+        } else {
+            return Double.NaN;
+        }
+    }
+
+    @Override
+    public Set<TraverserRequirement> getRequirements() {
+        return Collections.singleton(TraverserRequirement.OBJECT);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/4c88d660/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/MeanStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/MeanStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/MeanStep.java
deleted file mode 100644
index f0ecb40..0000000
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/MeanStep.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * 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.graph.traversal.step.map;
-
-import org.apache.tinkerpop.gremlin.process.Traversal;
-import org.apache.tinkerpop.gremlin.process.Traverser;
-import org.apache.tinkerpop.gremlin.process.graph.traversal.step.util.ReducingBarrierStep;
-import org.apache.tinkerpop.gremlin.process.traversal.step.Reducing;
-import org.apache.tinkerpop.gremlin.process.traverser.TraverserRequirement;
-import org.apache.tinkerpop.gremlin.util.function.MeanNumberSupplier;
-
-import java.io.Serializable;
-import java.util.EnumSet;
-import java.util.Set;
-import java.util.function.BiFunction;
-import java.util.function.Supplier;
-
-/**
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-public final class MeanStep<S extends Number, E extends Number> extends ReducingBarrierStep<S, E> implements Reducing<E, Traverser<S>> {
-
-    private static final Set<TraverserRequirement> REQUIREMENTS = EnumSet.of(TraverserRequirement.OBJECT, TraverserRequirement.BULK);
-
-    public MeanStep(final Traversal.Admin traversal) {
-        super(traversal);
-        this.setSeedSupplier((Supplier) MeanNumberSupplier.instance());
-        this.setBiFunction((BiFunction) MeanBiFunction.instance());
-    }
-
-    @Override
-    public Set<TraverserRequirement> getRequirements() {
-        return REQUIREMENTS;
-    }
-
-    @Override
-    public Reducer<E, Traverser<S>> getReducer() {
-        return new Reducer<>(this.getSeedSupplier(), this.getBiFunction(), true);
-    }
-
-    /////
-
-    private static class MeanBiFunction<S extends Number> implements BiFunction<S, Traverser<S>, S>, Serializable {
-
-        private static final MeanBiFunction INSTANCE = new MeanBiFunction();
-
-        private MeanBiFunction() {
-
-        }
-
-        @Override
-        public S apply(final S mutatingSeed, final Traverser<S> traverser) {
-            return (S) ((MeanNumber) mutatingSeed).add(traverser.get(), traverser.bulk());
-        }
-
-        public final static <S extends Number> MeanBiFunction<S> instance() {
-            return INSTANCE;
-        }
-    }
-
-    ///
-
-    public static final class MeanNumber extends Number implements Comparable<Number>, FinalGet<Double> {
-
-        private long count = 0l;
-        private double sum = 0.0d;
-
-        public MeanNumber add(final Number amount, final long count) {
-            this.count = this.count + count;
-            this.sum = this.sum + (amount.doubleValue() * count);
-            return this;
-        }
-
-        @Override
-        public int intValue() {
-            return (int) (this.sum / this.count);
-        }
-
-        @Override
-        public long longValue() {
-            return (long) (this.sum / this.count);
-        }
-
-        @Override
-        public float floatValue() {
-            return (float) (this.sum / this.count);
-        }
-
-        @Override
-        public double doubleValue() {
-            return this.sum / this.count;
-        }
-
-        @Override
-        public String toString() {
-            return Double.toString(this.doubleValue());
-        }
-
-        @Override
-        public int compareTo(final Number number) {
-            return Double.valueOf(this.doubleValue()).compareTo(number.doubleValue());
-        }
-
-        @Override
-        public boolean equals(final Object object) {
-            return object instanceof Number && Double.valueOf(this.doubleValue()).equals(((Number) object).doubleValue());
-        }
-
-        @Override
-        public int hashCode() {
-            return Double.valueOf(this.doubleValue()).hashCode();
-        }
-
-        @Override
-        public Double getFinal() {
-            return this.doubleValue();
-        }
-    }
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/4c88d660/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/MinGlobalStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/MinGlobalStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/MinGlobalStep.java
new file mode 100644
index 0000000..a1fd769
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/MinGlobalStep.java
@@ -0,0 +1,73 @@
+/*
+ * 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.graph.traversal.step.map;
+
+import org.apache.tinkerpop.gremlin.process.Traversal;
+import org.apache.tinkerpop.gremlin.process.Traverser;
+import org.apache.tinkerpop.gremlin.process.graph.traversal.step.util.ReducingBarrierStep;
+import org.apache.tinkerpop.gremlin.process.traversal.step.Reducing;
+import org.apache.tinkerpop.gremlin.process.traverser.TraverserRequirement;
+import org.apache.tinkerpop.gremlin.util.function.ConstantSupplier;
+
+import java.io.Serializable;
+import java.util.Collections;
+import java.util.Set;
+import java.util.function.BiFunction;
+
+/**
+ * @author Marko A. Rodriguez (http://markorodriguez.com)
+ */
+public final class MinGlobalStep<S extends Number> extends ReducingBarrierStep<S, S> implements Reducing<S, Traverser<S>> {
+
+    public MinGlobalStep(final Traversal.Admin traversal) {
+        super(traversal);
+        this.setSeedSupplier(new ConstantSupplier<>((S) Double.valueOf(Double.MAX_VALUE)));
+        this.setBiFunction(MinBiFunction.instance());
+    }
+
+    @Override
+    public Set<TraverserRequirement> getRequirements() {
+        return Collections.singleton(TraverserRequirement.OBJECT);
+    }
+
+    @Override
+    public Reducer<S, Traverser<S>> getReducer() {
+        return new Reducer<>(this.getSeedSupplier(), this.getBiFunction(), true);
+    }
+
+    /////
+
+    private static class MinBiFunction<S extends Number> implements BiFunction<S, Traverser<S>, S>, Serializable {
+
+        private static final MinBiFunction INSTANCE = new MinBiFunction();
+
+        private MinBiFunction() {
+
+        }
+
+        @Override
+        public S apply(final S mutatingSeed, final Traverser<S> traverser) {
+            return mutatingSeed.doubleValue() < traverser.get().doubleValue() ? mutatingSeed : traverser.get();
+        }
+
+        public final static <S extends Number> MinBiFunction<S> instance() {
+            return INSTANCE;
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/4c88d660/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/MinLocalStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/MinLocalStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/MinLocalStep.java
new file mode 100644
index 0000000..e5020b0
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/MinLocalStep.java
@@ -0,0 +1,59 @@
+/*
+ * 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.graph.traversal.step.map;
+
+import org.apache.tinkerpop.gremlin.process.Traversal;
+import org.apache.tinkerpop.gremlin.process.Traverser;
+import org.apache.tinkerpop.gremlin.process.traverser.TraverserRequirement;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Set;
+
+/**
+ * @author Marko A. Rodriguez (http://markorodriguez.com)
+ */
+public final class MinLocalStep<S> extends MapStep<S, Number> {
+
+    public MinLocalStep(final Traversal.Admin traversal) {
+        super(traversal);
+    }
+
+    @Override
+    protected Number map(final Traverser.Admin<S> traverser) {
+        final S start = traverser.get();
+        if (start instanceof Number) {
+            return (Number) start;
+        } else if (start instanceof Collection) {
+            Number temp = Double.MIN_VALUE;
+            for (final Number number : (Collection<Number>) start) {
+                if (number.doubleValue() < temp.doubleValue())
+                    temp = number;
+            }
+            return temp;
+        } else
+            return Double.NaN;
+    }
+
+
+    @Override
+    public Set<TraverserRequirement> getRequirements() {
+        return Collections.singleton(TraverserRequirement.OBJECT);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/4c88d660/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/MinStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/MinStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/MinStep.java
deleted file mode 100644
index 1157fb3..0000000
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/MinStep.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * 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.graph.traversal.step.map;
-
-import org.apache.tinkerpop.gremlin.process.Traversal;
-import org.apache.tinkerpop.gremlin.process.Traverser;
-import org.apache.tinkerpop.gremlin.process.graph.traversal.step.util.ReducingBarrierStep;
-import org.apache.tinkerpop.gremlin.process.traversal.step.Reducing;
-import org.apache.tinkerpop.gremlin.process.traverser.TraverserRequirement;
-import org.apache.tinkerpop.gremlin.util.function.ConstantSupplier;
-
-import java.io.Serializable;
-import java.util.Collections;
-import java.util.Set;
-import java.util.function.BiFunction;
-
-/**
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-public final class MinStep<S extends Number> extends ReducingBarrierStep<S, S> implements Reducing<S, Traverser<S>> {
-
-    public MinStep(final Traversal.Admin traversal) {
-        super(traversal);
-        this.setSeedSupplier(new ConstantSupplier<>((S) Double.valueOf(Double.MAX_VALUE)));
-        this.setBiFunction(MinBiFunction.instance());
-    }
-
-    @Override
-    public Set<TraverserRequirement> getRequirements() {
-        return Collections.singleton(TraverserRequirement.OBJECT);
-    }
-
-    @Override
-    public Reducer<S, Traverser<S>> getReducer() {
-        return new Reducer<>(this.getSeedSupplier(), this.getBiFunction(), true);
-    }
-
-    /////
-
-    private static class MinBiFunction<S extends Number> implements BiFunction<S, Traverser<S>, S>, Serializable {
-
-        private static final MinBiFunction INSTANCE = new MinBiFunction();
-
-        private MinBiFunction() {
-
-        }
-
-        @Override
-        public S apply(final S mutatingSeed, final Traverser<S> traverser) {
-            return mutatingSeed.doubleValue() < traverser.get().doubleValue() ? mutatingSeed : traverser.get();
-        }
-
-        public final static <S extends Number> MinBiFunction<S> instance() {
-            return INSTANCE;
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/4c88d660/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/SumGlobalStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/SumGlobalStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/SumGlobalStep.java
new file mode 100644
index 0000000..e0623db
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/SumGlobalStep.java
@@ -0,0 +1,79 @@
+/*
+ * 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.graph.traversal.step.map;
+
+import org.apache.tinkerpop.gremlin.process.Traversal;
+import org.apache.tinkerpop.gremlin.process.Traverser;
+import org.apache.tinkerpop.gremlin.process.graph.traversal.step.util.ReducingBarrierStep;
+import org.apache.tinkerpop.gremlin.process.traversal.step.Reducing;
+import org.apache.tinkerpop.gremlin.process.traverser.TraverserRequirement;
+import org.apache.tinkerpop.gremlin.util.function.ConstantSupplier;
+
+import java.io.Serializable;
+import java.util.EnumSet;
+import java.util.Set;
+import java.util.function.BiFunction;
+
+/**
+ * @author Marko A. Rodriguez (http://markorodriguez.com)
+ */
+public final class SumGlobalStep extends ReducingBarrierStep<Number, Double> implements Reducing<Double, Traverser<Number>> {
+
+    private static final Set<TraverserRequirement> REQUIREMENTS = EnumSet.of(
+            TraverserRequirement.BULK,
+            TraverserRequirement.OBJECT
+    );
+
+    public SumGlobalStep(final Traversal.Admin traversal) {
+        super(traversal);
+        this.setSeedSupplier(new ConstantSupplier<>(0.0d));
+        this.setBiFunction(SumBiFunction.instance());
+    }
+
+
+    @Override
+    public Set<TraverserRequirement> getRequirements() {
+        return REQUIREMENTS;
+    }
+
+    @Override
+    public Reducer<Double, Traverser<Number>> getReducer() {
+        return new Reducer<>(this.getSeedSupplier(), this.getBiFunction(), true);
+    }
+
+    /////
+
+    private static class SumBiFunction<S extends Number> implements BiFunction<Double, Traverser<S>, Double>, Serializable {
+
+        private static final SumBiFunction INSTANCE = new SumBiFunction();
+
+        private SumBiFunction() {
+
+        }
+
+        @Override
+        public Double apply(final Double mutatingSeed, final Traverser<S> traverser) {
+            return mutatingSeed + (traverser.get().doubleValue() * traverser.bulk());
+        }
+
+        public final static <S extends Number> SumBiFunction<S> instance() {
+            return INSTANCE;
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/4c88d660/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/SumLocalStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/SumLocalStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/SumLocalStep.java
new file mode 100644
index 0000000..d20d6e0
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/SumLocalStep.java
@@ -0,0 +1,57 @@
+/*
+ * 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.graph.traversal.step.map;
+
+import org.apache.tinkerpop.gremlin.process.Traversal;
+import org.apache.tinkerpop.gremlin.process.Traverser;
+import org.apache.tinkerpop.gremlin.process.traverser.TraverserRequirement;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Set;
+
+/**
+ * @author Marko A. Rodriguez (http://markorodriguez.com)
+ */
+public final class SumLocalStep<S> extends MapStep<S, Double> {
+
+    public SumLocalStep(final Traversal.Admin traversal) {
+        super(traversal);
+    }
+
+    @Override
+    protected Double map(final Traverser.Admin<S> traverser) {
+        final S start = traverser.get();
+        if (start instanceof Collection) {
+            double sum = 0.0d;
+            for (final Number number : (Collection<Number>) start) {
+                sum = sum + number.doubleValue();
+            }
+            return sum * traverser.bulk();
+        } else if (start instanceof Number) {
+            return ((Number) start).doubleValue() * traverser.bulk();
+        } else
+            return Double.NaN;
+    }
+
+    @Override
+    public Set<TraverserRequirement> getRequirements() {
+        return Collections.singleton(TraverserRequirement.OBJECT);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/4c88d660/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/SumStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/SumStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/SumStep.java
deleted file mode 100644
index e288ee6..0000000
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/graph/traversal/step/map/SumStep.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * 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.graph.traversal.step.map;
-
-import org.apache.tinkerpop.gremlin.process.Traversal;
-import org.apache.tinkerpop.gremlin.process.Traverser;
-import org.apache.tinkerpop.gremlin.process.graph.traversal.step.util.ReducingBarrierStep;
-import org.apache.tinkerpop.gremlin.process.traversal.step.Reducing;
-import org.apache.tinkerpop.gremlin.process.traverser.TraverserRequirement;
-import org.apache.tinkerpop.gremlin.util.function.ConstantSupplier;
-
-import java.io.Serializable;
-import java.util.EnumSet;
-import java.util.Set;
-import java.util.function.BiFunction;
-
-/**
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-public final class SumStep extends ReducingBarrierStep<Number, Double> implements Reducing<Double, Traverser<Number>> {
-
-    private static final Set<TraverserRequirement> REQUIREMENTS = EnumSet.of(
-            TraverserRequirement.BULK,
-            TraverserRequirement.OBJECT
-    );
-
-    public SumStep(final Traversal.Admin traversal) {
-        super(traversal);
-        this.setSeedSupplier(new ConstantSupplier<>(0.0d));
-        this.setBiFunction(SumBiFunction.instance());
-    }
-
-
-    @Override
-    public Set<TraverserRequirement> getRequirements() {
-        return REQUIREMENTS;
-    }
-
-    @Override
-    public Reducer<Double, Traverser<Number>> getReducer() {
-        return new Reducer<>(this.getSeedSupplier(), this.getBiFunction(), true);
-    }
-
-    /////
-
-    private static class SumBiFunction<S extends Number> implements BiFunction<Double, Traverser<S>, Double>, Serializable {
-
-        private static final SumBiFunction INSTANCE = new SumBiFunction();
-
-        private SumBiFunction() {
-
-        }
-
-        @Override
-        public Double apply(final Double mutatingSeed, final Traverser<S> traverser) {
-            return mutatingSeed + (traverser.get().doubleValue() * traverser.bulk());
-        }
-
-        public final static <S extends Number> SumBiFunction<S> instance() {
-            return INSTANCE;
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/4c88d660/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/util/function/MeanNumberSupplier.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/util/function/MeanNumberSupplier.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/util/function/MeanNumberSupplier.java
index 08d419e..56d64f5 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/util/function/MeanNumberSupplier.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/util/function/MeanNumberSupplier.java
@@ -22,12 +22,12 @@ package org.apache.tinkerpop.gremlin.util.function;
  * @author Marko A. Rodriguez (http://markorodriguez.com)
  */
 
-import org.apache.tinkerpop.gremlin.process.graph.traversal.step.map.MeanStep;
+import org.apache.tinkerpop.gremlin.process.graph.traversal.step.map.MeanGlobalStep;
 
 import java.io.Serializable;
 import java.util.function.Supplier;
 
-public final class MeanNumberSupplier implements Supplier<MeanStep.MeanNumber>, Serializable {
+public final class MeanNumberSupplier implements Supplier<MeanGlobalStep.MeanNumber>, Serializable {
 
     private static final MeanNumberSupplier INSTANCE = new MeanNumberSupplier();
 
@@ -36,8 +36,8 @@ public final class MeanNumberSupplier implements Supplier<MeanStep.MeanNumber>,
     }
 
     @Override
-    public MeanStep.MeanNumber get() {
-        return new MeanStep.MeanNumber();
+    public MeanGlobalStep.MeanNumber get() {
+        return new MeanGlobalStep.MeanNumber();
     }
 
     public static MeanNumberSupplier instance() {