[jira] [Commented] (TINKERPOP-1777) Gremlin .max step returns -2147483648 for empty result sets
[ https://issues.apache.org/jira/browse/TINKERPOP-1777?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16389680#comment-16389680 ] ASF GitHub Bot commented on TINKERPOP-1777: --- Github user asfgit closed the pull request at: https://github.com/apache/tinkerpop/pull/805 > Gremlin .max step returns -2147483648 for empty result sets > --- > > Key: TINKERPOP-1777 > URL: https://issues.apache.org/jira/browse/TINKERPOP-1777 > Project: TinkerPop > Issue Type: Bug > Components: process >Affects Versions: 3.2.6 >Reporter: Sebastian Estevez >Assignee: Daniel Kuppitz >Priority: Major > Labels: breaking > > To reproduce: > {code}gremlin> g.V().values('test').max() > ==>-2147483648{code} > This should probably return an exeption, "cannot take max of nothing" -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (TINKERPOP-1777) Gremlin .max step returns -2147483648 for empty result sets
[ https://issues.apache.org/jira/browse/TINKERPOP-1777?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16389679#comment-16389679 ] ASF GitHub Bot commented on TINKERPOP-1777: --- 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. > Gremlin .max step returns -2147483648 for empty result sets > --- > > Key: TINKERPOP-1777 > URL: https://issues.apache.org/jira/browse/TINKERPOP-1777 > Project: TinkerPop > Issue Type: Bug > Components: process >Affects Versions: 3.2.6 >Reporter: Sebastian Estevez >Assignee: Daniel Kuppitz >Priority: Major > Labels: breaking > > To reproduce: > {code}gremlin> g.V().values('test').max() > ==>-2147483648{code} > This should probably return an exeption, "cannot take max of nothing" -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (TINKERPOP-1777) Gremlin .max step returns -2147483648 for empty result sets
[ https://issues.apache.org/jira/browse/TINKERPOP-1777?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16388358#comment-16388358 ] ASF GitHub Bot commented on TINKERPOP-1777: --- 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) > Gremlin .max step returns -2147483648 for empty result sets > --- > > Key: TINKERPOP-1777 > URL: https://issues.apache.org/jira/browse/TINKERPOP-1777 > Project: TinkerPop > Issue Type: Bug > Components: process >Affects Versions: 3.2.6 >Reporter: Sebastian Estevez >Assignee: Daniel Kuppitz >Priority: Major > Labels: breaking > > To reproduce: > {code}gremlin> g.V().values('test').max() > ==>-2147483648{code} > This should probably return an exeption, "cannot take max of nothing" -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (TINKERPOP-1777) Gremlin .max step returns -2147483648 for empty result sets
[ https://issues.apache.org/jira/browse/TINKERPOP-1777?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16388341#comment-16388341 ] ASF GitHub Bot commented on TINKERPOP-1777: --- 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}" > Gremlin .max step returns -2147483648 for empty result sets > --- > > Key: TINKERPOP-1777 > URL: https://issues.apache.org/jira/browse/TINKERPOP-1777 > Project: TinkerPop > Issue Type: Bug > Components: process >Affects Versions: 3.2.6 >Reporter: Sebastian Estevez >Assignee: Daniel Kuppitz >Priority: Major > Labels: breaking > > To reproduce: > {code}gremlin> g.V().values('test').max() > ==>-2147483648{code} > This should probably return an exeption, "cannot take max of nothing" -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (TINKERPOP-1777) Gremlin .max step returns -2147483648 for empty result sets
[ https://issues.apache.org/jira/browse/TINKERPOP-1777?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16384423#comment-16384423 ] ASF GitHub Bot commented on TINKERPOP-1777: --- 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? > Gremlin .max step returns -2147483648 for empty result sets > --- > > Key: TINKERPOP-1777 > URL: https://issues.apache.org/jira/browse/TINKERPOP-1777 > Project: TinkerPop > Issue Type: Bug > Components: process >Affects Versions: 3.2.6 >Reporter: Sebastian Estevez >Assignee: Daniel Kuppitz >Priority: Major > Labels: breaking > > To reproduce: > {code}gremlin> g.V().values('test').max() > ==>-2147483648{code} > This should probably return an exeption, "cannot take max of nothing" -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (TINKERPOP-1777) Gremlin .max step returns -2147483648 for empty result sets
[ https://issues.apache.org/jira/browse/TINKERPOP-1777?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16384158#comment-16384158 ] ASF GitHub Bot commented on TINKERPOP-1777: --- 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 KuppitzDate: 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 > Gremlin .max step returns -2147483648 for empty result sets > --- > > Key: TINKERPOP-1777 > URL: https://issues.apache.org/jira/browse/TINKERPOP-1777 > Project: TinkerPop > Issue Type: Bug > Components: process >Affects Versions: 3.2.6 >Reporter: Sebastian Estevez >Assignee: Daniel Kuppitz >Priority: Major > Labels: breaking > > To reproduce: > {code}gremlin> g.V().values('test').max() > ==>-2147483648{code} > This should probably return an exeption, "cannot take max of nothing" -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (TINKERPOP-1777) Gremlin .max step returns -2147483648 for empty result sets
[ https://issues.apache.org/jira/browse/TINKERPOP-1777?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16350700#comment-16350700 ] Daniel Kuppitz commented on TINKERPOP-1777: --- {{FastNoSuchElementException}} should actually be expected. There's a bug in {{ReducingBarrierStep}} that assigns the seed value although there are no elements. Easy one line fix, but the other {{NaN}} issue I mentioned is trickier than I thought. > Gremlin .max step returns -2147483648 for empty result sets > --- > > Key: TINKERPOP-1777 > URL: https://issues.apache.org/jira/browse/TINKERPOP-1777 > Project: TinkerPop > Issue Type: Bug > Components: process >Affects Versions: 3.2.6 >Reporter: Sebastian Estevez >Priority: Major > > To reproduce: > {code}gremlin> g.V().values('test').max() > ==>-2147483648{code} > This should probably return an exeption, "cannot take max of nothing" -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (TINKERPOP-1777) Gremlin .max step returns -2147483648 for empty result sets
[ https://issues.apache.org/jira/browse/TINKERPOP-1777?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16350589#comment-16350589 ] Daniel Kuppitz commented on TINKERPOP-1777: --- Hmm, with the latest changes it returns {{NaN}} for empty traversers and does throw an exception for non-numeric types. {noformat} gremlin> g.V().values('age').max() ==>35 gremlin> g.V().values('weight').max() ==>NaN gremlin> g.V().values('name').max() java.lang.String cannot be cast to java.lang.Number {noformat} I wouldn't want to make any more changes in {{NumberHelper}}, but I'd be good with the respective steps throwing {{FastNoSuchElementExceptions}}, in case {{NumberHelper}} returns {{NaN}}. Now, after doing a few tests, I'm also wondering why this is happening: {noformat} gremlin> __.inject(Double.NaN).max() ==>0 {noformat} > Gremlin .max step returns -2147483648 for empty result sets > --- > > Key: TINKERPOP-1777 > URL: https://issues.apache.org/jira/browse/TINKERPOP-1777 > Project: TinkerPop > Issue Type: Bug > Components: process >Affects Versions: 3.2.6 >Reporter: Sebastian Estevez >Priority: Major > > To reproduce: > {code}gremlin> g.V().values('test').max() > ==>-2147483648{code} > This should probably return an exeption, "cannot take max of nothing" -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (TINKERPOP-1777) Gremlin .max step returns -2147483648 for empty result sets
[ https://issues.apache.org/jira/browse/TINKERPOP-1777?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16161914#comment-16161914 ] Marko A. Rodriguez commented on TINKERPOP-1777: --- Perhaps throw a {{FastNoSuchElementException}}. > Gremlin .max step returns -2147483648 for empty result sets > --- > > Key: TINKERPOP-1777 > URL: https://issues.apache.org/jira/browse/TINKERPOP-1777 > Project: TinkerPop > Issue Type: Bug >Reporter: Sebastian Estevez > > To reproduce: > > gremlin> g.V().values('test').max() > ==>-2147483648 > > This should probably return an exeption, "cannot take max of nothing" -- This message was sent by Atlassian JIRA (v6.4.14#64029)