[ 
https://issues.apache.org/jira/browse/TINKERPOP-1777?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=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)

Reply via email to