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

Neo4j-Gremlin could not order vertex/edge without specified property

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Done
    • 3.4.10
    • 3.6.0
    • neo4j
    • None
    • Tinkerpop Version : 3.4.10
      Neo4j Version : 3.5.27
      OS : CentOS8
      Storage Backend: in-memory

    Description

      Neo4j-Gremlin could not order vertex/edge without specified property

      Environment

      Tinkerpop Version : 3.4.10

      Neo4j Version : 3.5.27

      OS : CentOS8

      Storage Backend: in-memory

      Data size: 100 vertices, 200 edges

      Bug description

      We expect to get the vertexes/edges ordered by their ID using gremlin order query without specified property like "g.V()/E().order().by(asc/desc)" in Neo4j-Gremlin, as we can get the result by the same query in JanusGraph.

      Current behavior

      An exception was thrown:

      java.util.concurrent.ExecutionException: org.apache.tinkerpop.gremlin.driver.exception.ResponseException: org.apache.tinkerpop.gremlin.neo4j.structure.Neo4jVertex cannot be cast to java.lang.Comparablejava.util.concurrent.ExecutionException: org.apache.tinkerpop.gremlin.driver.exception.ResponseException: org.apache.tinkerpop.gremlin.neo4j.structure.Neo4jVertex cannot be cast to java.lang.Comparable at java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:357) at java.util.concurrent.CompletableFuture.get(CompletableFuture.java:1908) at org.gdbtesting.validation.ValidateNeo4jOrderAsc.main(ValidateNeo4jOrderAsc.java:30)Caused by: org.apache.tinkerpop.gremlin.driver.exception.ResponseException: org.apache.tinkerpop.gremlin.neo4j.structure.Neo4jVertex cannot be cast to java.lang.Comparable
      

      Reproduce

      GraphTraversalSource g = connection.getG();
      g.E().drop().iterate();
      g.V().drop().iterate();
      try {
          Vertex v1 = g.addV().property("price",3).next();
          Vertex v2 = g.addV().property("price",4).next();
          Vertex v3 = g.addV().property("price",5).next();
          Vertex v4 = g.addV().property("price",6).next();    
          String query = "g.V().order().by(asc)";
          System.out.println("query: " + query);
          try{
               List<Result> results;
               results = connection.getClient().submit(query).all().get();
               for (Result r : results) {             System.out.println(r);          }
              }catch(Exception e){
                   e.printStackTrace();
              }     } catch (Exception e) {
                e.printStackTrace();
      } finally {
           System.exit(0);
      }
      

      We could successfully run the order() step with specified property in Neo4j-Gremlin, like using "g.V().id().order().by(asc)" to get vertexes ordered by vertex ID. We bring up the issue for we are wondering whether query without specified property, like "g.V()/E().order().by(asc/desc)", is grammatically correct or not, as we find it could be accepted in JanusGraph while get exception above in Neo4j-Gremlin.

       

      Attachments

        Issue Links

          Activity

            People

              spmallette Stephen Mallette
              YidingZhong GrandA
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: