Uploaded image for project: 'TinkerPop'
  1. TinkerPop
  2. TINKERPOP-2641

Allow orderability on any type

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Done
    • 3.5.1
    • 3.6.0
    • process
    • None

    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

          Activity

            People

              spmallette Stephen Mallette
              spmallette Stephen Mallette
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: