Description
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.
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
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
Attachments
Issue Links
- is related to
-
TINKERPOP-2622 Enforce ordering semantics in feature tests
- Closed