[GitHub] tinkerpop pull request #805: TINKERPOP-1777 Gremlin .max step returns -21474...
Github user asfgit closed the pull request at: https://github.com/apache/tinkerpop/pull/805 ---
[GitHub] tinkerpop pull request #805: TINKERPOP-1777 Gremlin .max step returns -21474...
Github user dkuppitz commented on a diff in the pull request: https://github.com/apache/tinkerpop/pull/805#discussion_r172874794 --- Diff: gremlin-test/features/branch/Union.feature --- @@ -135,7 +135,6 @@ Feature: Step - union() | d[3].l | | d[0].l | | d[1.9].d | - | d[0].i | --- End diff -- > just so i'm clear, this value is no longer in the output because vadas (aka v[2]) has no out edges to sum a weight on...is that right? Exactly. It's the same thing as doing just `g.V(2).outE()` - the traverser would simply die as there are no outgoing edges. Likewise with `outE().values('weight').sum()`, there simply is no sum, hence the traverser dies. ---
[GitHub] tinkerpop pull request #805: TINKERPOP-1777 Gremlin .max step returns -21474...
Github user spmallette commented on a diff in the pull request: https://github.com/apache/tinkerpop/pull/805#discussion_r172629315 --- Diff: gremlin-test/features/branch/Union.feature --- @@ -135,7 +135,6 @@ Feature: Step - union() | d[3].l | | d[0].l | | d[1.9].d | - | d[0].i | --- End diff -- just so i'm clear, this value is no longer in the output because vadas (aka `v[2]`) has no out edges to sum a weight on...is that right? if so, do you happen to know what catches the thrown `FastNoSuchElementException` and prevents it from bubbling up just kill the whole traversal? (i'm just trying to follow how the code works here for my own edification) ---
[GitHub] tinkerpop pull request #805: TINKERPOP-1777 Gremlin .max step returns -21474...
Github user spmallette commented on a diff in the pull request: https://github.com/apache/tinkerpop/pull/805#discussion_r172627151 --- Diff: docs/src/upgrade/release-3.4.x.asciidoc --- @@ -28,3 +28,45 @@ NEED AN IMAGE Please see the link:https://github.com/apache/tinkerpop/blob/3.4.0/CHANGELOG.asciidoc#release-3-4-0[changelog] for a complete list of all the modifications that are part of this release. === Upgrading for Users + + Modifications to reducing barrier steps + +The behavior of `min()`, `max()`, `mean()` and `sum()` has been modified to return no result if there's no input. Previously these steps yielded the internal seed value: + +[source,groovy] + +gremlin> g.V().values('foo').min() +==>NaN +gremlin> g.V().values('foo').max() +==>NaN +gremlin> g.V().values('foo').mean() +==>NaN +gremlin> g.V().values('foo').sum() +==>0 + + +These traversals will no longer emit a result. Note, that this also affects more complex scenarios, e.g. if these steps are used in `by()` modulators: + +[source,groovy] + +gremlin> g.V().group(). +..1> by(label). +..2> by(outE().values("weight").sum()) +==>[software:0,person:3.5] + + +Since software vertices have no outgoing edges and thus no weight values to sum, `software` will no longer show up in the result. In order to get the same result as before, one would +have to add a `coalesce()`-step: + +[source,groovy] + +gremlin> g.V().group(). +..1> by(label). +..2> by(outE().values("weight").sum()) +==>[person:3.5] +gremlin> +gremlin> g.V().group(). +..1> by(label). +..2> by(coalesce(outE().values("weight"), constant(0)).sum()) +==>[software:0,person:3.5] + --- End diff -- please add the "See: {jira_issue}" ---
[GitHub] tinkerpop pull request #805: TINKERPOP-1777 Gremlin .max step returns -21474...
Github user spmallette commented on a diff in the pull request: https://github.com/apache/tinkerpop/pull/805#discussion_r172001752 --- Diff: CHANGELOG.asciidoc --- @@ -25,6 +25,8 @@ NEED AND IMAGE This release also includes changes from <>. +* Fixed a bug in `ReducingBarrierStep`, that returned the provided seed value despite no elements being available. --- End diff -- Should this be a changelog entry for 3.4.0 as this is pointed at the master branch? ---
[GitHub] tinkerpop pull request #805: TINKERPOP-1777 Gremlin .max step returns -21474...
GitHub user dkuppitz opened a pull request: https://github.com/apache/tinkerpop/pull/805 TINKERPOP-1777 Gremlin .max step returns -2147483648 for empty result sets https://issues.apache.org/jira/browse/TINKERPOP-1777 Fixed the behavior of `min()`, `max()`, `mean()` and `sum()`. If no input is given, these steps will now throw a `FastNoElementException`. Also adjusted existing test cases to be in line with the new behavior. `docker/build.sh -t -i` passed. VOTE: +1 You can merge this pull request into a Git repository by running: $ git pull https://github.com/apache/tinkerpop TINKERPOP-1777 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/tinkerpop/pull/805.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #805 commit 32014426f12478e13d73b3c1bdca8df6d79d08da Author: Daniel Kuppitz Date: 2018-02-27T17:15:07Z Fixed the behavior of `min()`, `max()`, `mean()` and `sum()`. If no input is given, these steps will now throw a `FastNoElementException`. Also adjusted existing test cases to be in line with the new behavior. commit 7149f8e8c1c255420b19748632ee4d928480f2e2 Author: Daniel Kuppitz Date: 2018-03-02T21:04:58Z Updated release docs ---