feature(interactive): Unify the Conversion for `where subquery` in both Gremlin and Cypher.
- Dominant language
- C++
- Stars
- 3.6k
- Forks
- 468
- Avg merge
- 29m
- Merged PRs (30d)
- 1
Description
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()`
Contributor guide
Assessment
This issue has not been assessed yet.