[ 
https://issues.apache.org/jira/browse/TINKERPOP-2608?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Stephen Mallette closed TINKERPOP-2608.
---------------------------------------
    Fix Version/s: 3.6.0
         Assignee: Stephen Mallette
       Resolution: Done

> Enhance sample().by() semantics when by produces a null
> -------------------------------------------------------
>
>                 Key: TINKERPOP-2608
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-2608
>             Project: TinkerPop
>          Issue Type: Improvement
>          Components: process
>    Affects Versions: 3.5.1
>            Reporter: Stephen Mallette
>            Assignee: Stephen Mallette
>            Priority: Major
>              Labels: breaking
>             Fix For: 3.6.0
>
>
> We currently get a NPE for this:
> {code}
> gremlin> g.V().sample(1).by("age")
> java.lang.NullPointerException
> Type ':help' or ':h' for help.
> Display stack trace? [yN]
> {code}
> Since {{sample()}} is a filter, it seems intuitive that it could remove 
> traversers that don't resolve in the {{by()}}. Of course, that changes the 
> current semantics when the sample size is greater than or equal to the size 
> of the traverser set:
> {code}
> gremlin> g.V().sample(6).by("age")
> ==>v[1]
> ==>v[2]
> ==>v[3]
> ==>v[4]
> ==>v[5]
> ==>v[6]
> {code}
> As an aside, we might also improve this error messaging:
> {code}
> gremlin> g.V().sample(1).by("name")
> class java.lang.String cannot be cast to class java.lang.Number 
> (java.lang.String and java.lang.Number are in module java.base of loader 
> 'bootstrap')
> Type ':help' or ':h' for help.
> Display stack trace? [yN]
> {code}
> As this would change Gremlin semantics a bit, it should target the next 
> breaking version.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to