Skip to content

SQL: "bothE" function returns number of edges instead of array of edges #1590

Closed

Description

@gramian

ArcadeDB Version:

ArcadeDB Server v24.5.1-SNAPSHOT (build 7872d1acb3616c2866613dabcb7d899322bb3348/1715204385992/main)

OS and JDK Version:

Running on Mac OS X 12.7.4 - OpenJDK 64-Bit Server VM 17.0.11 (Homebrew)

Expected behavior

[{"@cat":"e","@type":"E","@rid":"#25:0","@in":"#1:0","@out":"#1:0"},{"@cat":"e","@type":"E","@rid":"#25:0","@in":"#1:0","@out":"#1:0"}]

Actual behavior

2

Steps to reproduce

CREATE VERTEX TYPE V;
CREATE EDGE TYPE E;
INSERT INTO V;
CREATE EDGE E FROM (SELECT FROM V) TO (SELECT FROM V);
SELECT bothE() FROM V;

Activity

  1. gramian commented on May 17, 2024

    @gramian
    CollaboratorAuthor
  2. gramian commented on Jun 9, 2024

    @gramian
    CollaboratorAuthor

    @lvca this is weird:

    Changing in https://github.com/ArcadeData/arcadedb/blob/main/engine/src/main/java/com/arcadedb/graph/GraphEngine.java#L438 :

    return result;

    to:

    return () -> result;
    

    seems to make it work, but I do not understand why, as for vertices (see getVertices in the same file) it works correctly without the () ->.

  3. lvca commented on Jun 9, 2024

    @lvca
    Member

    The issue is here:

    if (useCollectionSizeForEdges && value.iterator().next() instanceof Edge)
    . The serializer for studio put edge count every time a collection of edges is present.

    From studio if you want to see the result in a table use this SELECT expand( bothE() ) FROM V.

    With HTTP/JSON API, the recommended serializer used is "graph" that also uses this settings, so the result would still be 2.

  4. self-assigned this
    on Jun 9, 2024
  5. added this to the 24.6.1 milestone on Jun 9, 2024
  6. gramian commented on Jun 9, 2024

    @gramian
    CollaboratorAuthor

    OK, but why do inE and outE work as expected? Also I confirm that bothE works in console.

  7. lvca commented on Jun 12, 2024

    @lvca
    Member

    The reason is that bothE returns a collection. I think it was introduced to avoid serializing vertices with thousands of edges. But in your case you're expressly asking for them, so it should return the edges, not the counter.

  8. modified the milestones: 24.6.1, 24.8.1 on Jul 23, 2024
  9. modified the milestones: 24.10.1, 24.11.1 on Oct 12, 2024
  10. modified the milestones: 24.11.1, 24.11.2 on Nov 5, 2024
  11. modified the milestones: 24.11.2, on Dec 9, 2024
  12. 12 remaining items

  13. modified the milestones: 25.5.1, 25.6.1 on May 30, 2025
  14. modified the milestones: 25.6.1, 25.7.1 on Jul 4, 2025
  15. added
    in progress
    on Aug 10, 2025
  16. added theissue type on Aug 10, 2025
  17. removed
    in progress
    on Aug 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions