You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tinkerpop.apache.org by "Zheng Qin (Jira)" <ji...@apache.org> on 2021/08/22 09:28:00 UTC

[jira] [Created] (TINKERPOP-2604) TinkerGraph could not order vertex/edge without specified property.

Zheng Qin created TINKERPOP-2604:
------------------------------------

             Summary: TinkerGraph could not order vertex/edge without specified property.
                 Key: TINKERPOP-2604
                 URL: https://issues.apache.org/jira/browse/TINKERPOP-2604
             Project: TinkerPop
          Issue Type: Bug
          Components: tinkergraph
    Affects Versions: 3.4.10
         Environment: Version: 3.4.10
OS : CentOS8
Storage Backend: in-memory
            Reporter: Zheng Qin


h2. TinkerGraph could not order vertex/edge without specified property
h3. Environment
bq. Version: 3.4.10
bq.OS : CentOS8
bq.Storage Backend: in-memory
h3. 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 TinkerGraph, as we can get the result by the same query in JanusGraph.
h3. Current behavior
An exception was thrown:

{code:java}
java.util.concurrent.ExecutionException: org.apache.tinkerpop.gremlin.driver.exception.ResponseException: org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerVertex 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.ValidateTinkerOrderAsc.main(ValidateTinkerOrderAsc.java:27)
Caused by: org.apache.tinkerpop.gremlin.driver.exception.ResponseException: org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerVertex cannot be cast to java.lang.Comparable
{code}
h3. Reproduce

{code:java}
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);
}
{code}
We could successfully run the *order()* step with specified property in TinkerGraph, 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 TinkerGraph.






--
This message was sent by Atlassian Jira
(v8.3.4#803005)