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

feature(interactive): Unify the Conversion for where subquery in both Gremlin and Cypher. #3766

Open
shirly121 opened this issue May 6, 2024 · 0 comments
Assignees

Comments

@shirly121
Copy link
Collaborator

shirly121 commented May 6, 2024

There's currently an inconsistency in handling where subquery between the Cypher and Gremlin.
Specifically, for the following Gremlin query:

g.V().as('a').out().out().as('b').where(as('b').out().as('a'))

This query is transformed into an apply operation in Gremlin.

The equivalent Cypher query:

MATCH (a)-[]->()-[]-(b)
WHERE (b)-[]->(a)

is transformed into a semi-join with two Match, Match (a)-[]->()-[]-(b) Semi-Join Match (b)-[]->(a), in Cypher.

Solution

Provide a unified API through GraphBuilder to convert the following queries respectively into their corresponding Calcite-Based IR joins:

  1. Transform where subquery into a semi-join.
  2. where not subquery into an anti-join.

Apply unified optimizations at the Calcite-Based IR layer:

  1. Extract the common pattern to avoid duplicated computation.
  2. Implement more advanced equivalent transformations, e.g., g.V().out().where(out()) -> g.V().out().as('a').out().select('a').dedup()
@shirly121 shirly121 changed the title refactor(interactive): Convert Where (as('a')..as('b')) in Gremlin to Semi-Join feature(interactive): Convert Where (as('a')..as('b')) in Gremlin to Semi-Join May 6, 2024
@shirly121 shirly121 changed the title feature(interactive): Convert Where (as('a')..as('b')) in Gremlin to Semi-Join feature(interactive): Unify the Conversion for where subquery in both Gremlin and Cypher. May 6, 2024
@shirly121 shirly121 self-assigned this May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant