[ 
https://issues.apache.org/jira/browse/TINKERPOP-2641?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17465006#comment-17465006
 ] 

Divij Vaidya commented on TINKERPOP-2641:
-----------------------------------------

Adding a note so that we don't forget. As part of completion of the ticket, we 
need to update the orderability semantics at 
https://tinkerpop.apache.org/docs/3.6.0-SNAPSHOT/dev/provider/#_composite_types_3

> Allow orderability on any type
> ------------------------------
>
>                 Key: TINKERPOP-2641
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-2641
>             Project: TinkerPop
>          Issue Type: Improvement
>          Components: process
>    Affects Versions: 3.5.1
>            Reporter: Stephen Mallette
>            Priority: Major
>
> Currently, TinkerPop follows comparability for orderability, thus 
> non-comparable and mixed-type values will fail in ordering. The proposed 
> change is to be able to order any types.
> {code}
> gremlin> g.V().order(). // 3.5.x
> org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerVertex cannot be 
> cast to java.lang.Comparable
> Type ':help' or ':h' for help.
> Display stack trace? [yN]
> gremlin> g.V(1).values('name').union(identity(),V(2)).order() // 3.5.x
> org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerVertex cannot be 
> cast to java.lang.Comparable
> Type ':help' or ':h' for help.
> Display stack trace? [yN]n
> gremlin> g.V().order()  // proposed
> ==>v[1]
> ==>v[2]
> ==>v[3]
> ==>v[4]
> ==>v[5]
> ==>v[6]
> gremlin> g.V(1).values('name').union(identity(),V(2)).order() // proposed
> ==>v[2]
> ==>marko
> gremlin> g.addV().property("key", 100)
> ==>v[0]
> gremlin> g.addV().property("key", "100000")
> ==>v[2]
> gremlin> g.V().values('key').order() // 3.5.x
> java.lang.Integer cannot be cast to java.lang.String
> Type ':help' or ':h' for help.
> Display stack trace? [yN]
> gremlin> g.V().values('key').order() // proposed
> ==>100
> ==>100000
> {code}
> To sort across any types of values, we define the order between each type as 
> follows:
> (In this order, ID, label, property key and property value are considered as 
> a part of primitive types)
> * `nulltype`
> * Boolean
> * Number
> * Date
> * String
> * Vertex
> * Edge
> * VertexProperty
> * Property
> * Path
> * List
> * Map



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

Reply via email to