Skip to content

Bug using Gremlin to sort  #290

Closed
Closed

Description

@choeoe

ArcadeDB Version: Arcadedb 21.12.1

JDK Version: 11

OS: windows wsl

I can't sort edges and vertices directly

Expected behavior

return sorted result

Actual behavior

org.apache.tinkerpop.gremlin.driver.exception.ResponseException: class org.apache.tinkerpop.gremlin.arcadedb.structure.ArcadeVertex cannot be cast to class java.lang.Comparable (org.apache.tinkerpop.gremlin.arcadedb.structure.ArcadeVertex is in unnamed module of loader 'app'; java.lang.Comparable is in module java.base of loader 'bootstrap')

Steps to reproduce

use a query: g.E().order().by(asc)

Activity

  1. lvca commented on Jan 21, 2022

    @lvca
    Member

    Reproduced

  2. self-assigned this
    on Jan 21, 2022
  3. added this to the 22.1.3 milestone on Jan 21, 2022
  4. added
    invalid
    on Jan 21, 2022
  5. lvca commented on Jan 21, 2022

    @lvca
    Member

    The issue is with the Gremlin statement. You should specify which attribute you want to sort. Working example:

      @Test
      public void sort() throws ExecutionException, InterruptedException {
        final ArcadeGraph graph = ArcadeGraph.open("./target/testOrder");
        try {
          graph.getDatabase().getSchema().getOrCreateVertexType("Person");
          graph.getDatabase().getSchema().getOrCreateEdgeType("FriendOf");
    
          Vertex alice = graph.addVertex("label", "Person", "name", "Alice");
          Vertex bob = graph.addVertex("label", "Person", "name", "Bob");
          Vertex steve = graph.addVertex("label", "Person", "name", "Steve");
    
          alice.addEdge("FriendOf", bob);
          alice.addEdge("FriendOf", steve);
          steve.addEdge("FriendOf", bob);
    
          final ArcadeGremlin gremlinReadOnly = graph.gremlin("g.E().order().by('name', asc)");
          final ResultSet result = gremlinReadOnly.execute();
    
          Assertions.assertTrue(result.hasNext());
    
        } finally {
          graph.drop();
        }
      }
  6. added a commit that references this issue on Jan 21, 2022
  7. choeoe commented on Jan 29, 2022

    @choeoe
    Author

    Thank you. However, it can be executed in JanusGraph.

  8. lvca commented on Jan 29, 2022

    @lvca
    Member

    What's the result on Janus? I mean, what's ordering if the type isn't specified?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

invalid

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions