Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Unexpected Type Inference in PathExpand #3730

Closed
BingqingLyu opened this issue Apr 22, 2024 · 3 comments · Fixed by #3889
Closed

[BUG] Unexpected Type Inference in PathExpand #3730

BingqingLyu opened this issue Apr 22, 2024 · 3 comments · Fixed by #3889
Assignees
Labels

Comments

@BingqingLyu
Copy link
Collaborator

Describe the bug

On LDBC Dataset (sf=0.1), we can run the following two queries:

# gremlin tests
gremlin> g.V().hasLabel("PERSON").has("id",933).out("5..6").endV().hasLabel("PLACE").has("id",999).count()
==>392

while a simiilar query in cypher is:

# cypher tests
@neo4j> Match (a:PERSON{id:933})-[c*5..6]->(b:PLACE{id:999})
        return a.id, b.id
        Limit 10;
+----------+
| id | id0 |
+----------+
+----------+

The results in the Cypher is empty, which is not as expected. The reason is that, in this case, the type inference tells that the type of c should be isLocatedIn (from the edge type that Person-isLocatedIn-Place). However, in PathExpand, this is not as expected. The path could be like Person-Knows[4..5]-Person-IsLocatedIn-Place, etc.

Copy link
Contributor

/cc @shirly121, this issus/pr has had no activity for for a long time, could you folks help to review the status ?
To suppress further notifications,

  • for issues,
    • if it is waiting for further response from the reporter/author, please help to add the label requires-further-info,
    • if you have already started working on it, please add the label work-in-progress to the issue,
    • if this issue requires further designing discussion and not in current plan, or won't be fixed, please add the label requires-further-discussion or wontfix to the issue,
  • for pull requests,
    • if you are still working on it and it is not ready for reviewing, please convert this pull request as draft PR,
    • if you have decided to hold this development on, please add the requires-further-discussion label to the pull request.
      Thanks!

@BingqingLyu
Copy link
Collaborator Author

Fixed in #3837

@BingqingLyu
Copy link
Collaborator Author

BingqingLyu commented Jun 4, 2024

There leaves a bug in the type infer in PathExpand.

For example, running the following query on LDBC dataset,

MATCH(a)-[*1..2]->(b) RETURN COUNT(a) AS pathCnt;

The inferred type of PathExpandBase within PathExpand is:
ExpandEdge(with direction IN) type ids: {0,1,3,5,6,7,10,11,12,13,15,16,17,21,22};
GetV type ids: {0,1,2,3,5,6,7}

While here the GetV types missed 4, i.e., Forum, while Forum is also a valid type for the expanded vertices (i.e., of a).

I guess, the reason is that the direction is not correctly considered in path, since forum only has out-neighbors in schema, but in this case, the expand direction is IN.

BingqingLyu added a commit to shirly121/GraphScope that referenced this issue Jun 5, 2024
sighingnow pushed a commit that referenced this issue Jun 7, 2024
…zation (#3889)

Type inference of path expand is bound to the user-given query order,
which may be reversed after optimization. Re-infer the type of path
expand after optimization if changes occur.

Fixes #3730
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants