Skip to content

Commit

Permalink
refine doc
Browse files Browse the repository at this point in the history
  • Loading branch information
shirly121 committed Oct 22, 2024
1 parent 8639daa commit b90b2eb
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 14 deletions.
2 changes: 1 addition & 1 deletion docs/interactive_engine/gopt.md
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ MATCH (a {name:'Alice'})-[b {creationDate: 20120324}]->(c {name: 'Bob'})
Return a, b, c;
```
The rule can also be combined with other relational optimization techniques, such as Calcite’s `FilterIntoJoinRule`, which optimizes filtering after a join. For example, consider a query with multiple `MATCH` clauses followed by a filtering condition:
The rule can also be combined with other relational optimization techniques, such as Calcite’s `FilterIntoJoinRule`, which optimizes filtering based on a join operator. For example, consider a query with multiple `MATCH` clauses followed by a filtering condition:
```cypher
MATCH (a)-[b]->(c)
Expand Down
31 changes: 18 additions & 13 deletions docs/interactive_engine/neo4j/supported_cypher.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,35 +117,40 @@ Note that some Aggregator operators, such as `max()`, we listed here are impleme
| User Defined Functions | convert integer value to datetime | datetime(1287230400000) | gs.function.datetime(1287230400000) | <input type="checkbox" disabled checked /> | |

## Clause
A notable limitation for now is that we do not
allow specifying multiple `MATCH` clauses in **one** query. For example,
the following code will not compile:
Currently, we support multiple `MATCH` clauses within a single Cypher query, and the entire query can be converted into different logical plans under different circumstances.

By default, we transform multiple `MATCH` clauses into a `Join` tree.

For example:

```Cypher
// phase 1
MATCH (a) -[]-> (b)
WITH a, b
MATCH (a) -[]-> () -[]-> (b) # second MATCH clause
// phase 2
MATCH (a) -[]-> () -[]-> (b)
// phase 3
RETURN a, b;
```

Besides, we support `OPTIONAL MATCH`. For example,
the following query can be supported:
```Cypher
MATCH (a) -[]-> (b)
Optional MATCH (b) -[]-> (c)
RETURN a, b, c;
```
In this case, an `INNER JOIN` operator is used to combine the results from the first two phases, with phase 1 as the left input and phase 2 as the right input. This works similarly for `OPTIONAL MATCH` clauses, except that the join type would be a `LEFT OUTER JOIN` instead of an `INNER JOIN`.

If the `FlatJoinToExpandRule` is registered, the `Join` operator will be eliminated, and the query will be transformed into a sequence of `Expand` and `GetV` operators, while preserving the execution order specified by the user. For more details, see [GOpt](../gopt.md#flatjointoexpandrule).

| Keyword | Comments | Supported | Todo
|:---|---|:---:|:---|
| MATCH | only one Match clause is allowed | <input type="checkbox" disabled checked /> |
| OPTIONAL MATCH | implements as left outer join | <input type="checkbox" checked /> | |
| MATCH | description about a graph pattern | <input type="checkbox" disabled checked /> |
| OPTIONAL MATCH | implements as left outer join by default | <input type="checkbox" checked /> | |
| RETURN .. [AS] | | <input type="checkbox" disabled checked /> | |
| WITH .. [AS] | project, aggregate, distinct | <input type="checkbox" disabled checked /> | |
| WHERE | | <input type="checkbox" disabled checked /> | |
| WHERE NOT EXIST (an edge/path) | implements as anti join | <input type="checkbox" checked />| |
| ORDER BY | | <input type="checkbox" disabled checked /> | |
| LIMIT | | <input type="checkbox" disabled checked /> | |
| UNFOLD | The operation is similar to SQL's 'UNSET', as it unfolds elements from a collection type | <input type="checkbox" disabled checked /> | |
| UNION CALL | merge the results from different branches, with each branch represented by a `CALL` operator | <input type="checkbox" disabled checked /> | |

Additionally, we support two types of procedure call invocations in Cypher:
- We offer a set of built-in procedures that can be invoked directly within Cypher queries. These procedures are all prefixed with `gs.procedure.`.
Expand Down

0 comments on commit b90b2eb

Please sign in to comment.