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

verify nGQL #1129

Merged
merged 1 commit into from
Nov 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs-2.0/3.ngql-guide/10.tag-statements/6.delete-tag.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,5 @@ nebula> FETCH PROP ON * "test";

!!! Compatibility

* 在 openCypher 中,可以使用 `REMOVE v:LABEL` 语句来移除该点 `v` 的 `LABEL`;
* 相同语意,但不同语法。在 nGQL 中使用 `DELETE TAG`;
* 在 openCypher 中,可以使用 `REMOVE v:LABEL` 语句来移除该点 `v` 的 `LABEL`
* 相同语意,但不同语法。在 nGQL 中使用 `DELETE TAG`
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ nebula> INSERT VERTEX t5(p1, p2, p3) VALUES "001":("Abe", 2, 3);

# 插入失败,因为属性p1不能为NULL。
nebula> INSERT VERTEX t5(p1, p2, p3) VALUES "002":(NULL, 4, 5);
[ERROR (-8)]: Storage Error: The not null field cannot be null.
[ERROR (-1005)]: Storage Error: The not null field cannot be null.

# 属性p3为默认值NULL。
nebula> INSERT VERTEX t5(p1, p2) VALUES "003":("cd", 5);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ SET <update_prop>
```ngql
// 查看三个点是否存在,结果“Empty set”表示顶点不存在。
nebula> FETCH PROP ON * "player666", "player667", "player668";
+-----------+
| vertices_ |
+-----------+
+-----------+
Empty set

nebula> UPSERT VERTEX ON player "player666" \
Expand All @@ -69,7 +73,10 @@ nebula> UPSERT VERTEX ON player "player666" \
| __NULL__ | 30 |
+----------+----------+

nebula> UPSERT VERTEX ON player "player666" SET age = 31 WHEN name == "Joe" YIELD name AS Name, age AS Age;
nebula> UPSERT VERTEX ON player "player666" \
SET age = 31 \
WHEN name == "Joe" \
YIELD name AS Name, age AS Age;
+----------+-----+
| Name | Age |
+----------+-----+
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,19 @@ SHOW CREATE {TAG | EDGE} INDEX <index_name>;

```ngql
nebula> SHOW TAG INDEXES;
+------------------+--------------+-----------------+
| "player_index_0" | "player" | ["name"] |
+------------------+--------------+-----------------+
| "player_index_1" | "player" | ["name", "age"] |
+------------------+--------------+-----------------+
+------------------+----------+----------+
| Index Name | By Tag | Columns |
+------------------+----------+----------+
| "player_index_0" | "player" | [] |
| "player_index_1" | "player" | ["name"] |
+------------------+----------+----------+

nebula> SHOW CREATE TAG INDEX player_index_1;
+------------------+--------------------------------------------------+
| Tag Index Name | Create Tag Index |
+------------------+--------------------------------------------------+
| "player_index_1" | "CREATE TAG INDEX `player_index_1` ON `player` ( |
| | `name(20)` |
| | `name`(20) |
| | )" |
+------------------+--------------------------------------------------+
```
Expand Down
3 changes: 2 additions & 1 deletion docs-2.0/3.ngql-guide/16.subgraph-and-path/2.find-path.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ nebula> FIND ALL PATH FROM "player100" TO "team204" OVER * WHERE follow.degree i
| <("player100")-[:serve@0 {}]->("team204")> |
| <("player100")-[:follow@0 {}]->("player125")-[:serve@0 {}]->("team204")> |
| <("player100")-[:follow@0 {}]->("player101")-[:serve@0 {}]->("team204")> |
| ... |
+------------------------------------------------------------------------------+
...
```

```ngql
Expand All @@ -90,6 +90,7 @@ nebula> FIND NOLOOP PATH FROM "player100" TO "team204" OVER *;
| <("player100")-[:follow@0 {}]->("player101")-[:serve@0 {}]->("team204")> |
| <("player100")-[:follow@0 {}]->("player101")-[:follow@0 {}]->("player125")-[:serve@0 {}]->("team204")> |
| <("player100")-[:follow@0 {}]->("player101")-[:follow@0 {}]->("player102")-[:serve@0 {}]->("team204")> |
| ... |
+--------------------------------------------------------------------------------------------------------+
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ nebula> SUBMIT JOB STATS;
+------------+
| New Job Id |
+------------+
| 97 |
| 34 |
+------------+
```

Expand All @@ -66,15 +66,13 @@ Meta服务将`SUBMIT JOB`请求解析为多个任务,然后分配给进程nebu
### 示例

```ngql
nebula> SHOW JOB 96;
+----------------+---------------+------------+-------------------------+-------------------------+
| Job Id(TaskId) | Command(Dest) | Status | Start Time | Stop Time |
+----------------+---------------+------------+-------------------------+-------------------------+
| 96 | "FLUSH" | "FINISHED" | 2020-11-28T14:14:29.000 | 2020-11-28T14:14:29.000 |
| 0 | "storaged2" | "FINISHED" | 2020-11-28T14:14:29.000 | 2020-11-28T14:14:29.000 |
| 1 | "storaged0" | "FINISHED" | 2020-11-28T14:14:29.000 | 2020-11-28T14:14:29.000 |
| 2 | "storaged1" | "FINISHED" | 2020-11-28T14:14:29.000 | 2020-11-28T14:14:29.000 |
+----------------+---------------+------------+-------------------------+-------------------------+
nebula> SHOW JOB 34;
+----------------+-----------------+------------+----------------------------+----------------------------+
| Job Id(TaskId) | Command(Dest) | Status | Start Time | Stop Time |
+----------------+-----------------+------------+----------------------------+----------------------------+
| 34 | "STATS" | "FINISHED" | 2021-11-01T03:32:27.000000 | 2021-11-01T03:32:27.000000 |
| 0 | "192.168.8.111" | "FINISHED" | 2021-11-01T03:32:27.000000 | 2021-11-01T03:32:41.000000 |
+----------------+-----------------+------------+----------------------------+----------------------------+
```

|参数|说明|
Expand Down Expand Up @@ -118,14 +116,15 @@ Queue -- running -- finished -- removed

```ngql
nebula> SHOW JOBS;
+--------+----------------------+------------+-------------------------+-------------------------+
| Job Id | Command | Status | Start Time | Stop Time |
+--------+----------------------+------------+-------------------------+-------------------------+
| 97 | "STATS" | "FINISHED" | 2020-11-28T14:48:52.000 | 2020-11-28T14:48:52.000 |
| 96 | "FLUSH" | "FINISHED" | 2020-11-28T14:14:29.000 | 2020-11-28T14:14:29.000 |
| 95 | "STATS" | "FINISHED" | 2020-11-28T13:02:11.000 | 2020-11-28T13:02:11.000 |
| 86 | "REBUILD_EDGE_INDEX" | "FINISHED" | 2020-11-26T13:38:24.000 | 2020-11-26T13:38:24.000 |
+--------+----------------------+------------+-------------------------+-------------------------+
+--------+---------------------+------------+----------------------------+----------------------------+
| Job Id | Command | Status | Start Time | Stop Time |
+--------+---------------------+------------+----------------------------+----------------------------+
| 34 | "STATS" | "FINISHED" | 2021-11-01T03:32:27.000000 | 2021-11-01T03:32:27.000000 |
| 33 | "FLUSH" | "FINISHED" | 2021-11-01T03:32:15.000000 | 2021-11-01T03:32:15.000000 |
| 32 | "COMPACT" | "FINISHED" | 2021-11-01T03:32:06.000000 | 2021-11-01T03:32:06.000000 |
| 31 | "REBUILD_TAG_INDEX" | "FINISHED" | 2021-10-29T05:39:16.000000 | 2021-10-29T05:39:17.000000 |
| 10 | "COMPACT" | "FINISHED" | 2021-10-26T02:27:05.000000 | 2021-10-26T02:27:05.000000 |
+--------+---------------------+------------+----------------------------+----------------------------+
```

## STOP JOB
Expand Down
12 changes: 6 additions & 6 deletions docs-2.0/3.ngql-guide/8.clauses-and-options/group-by.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,16 @@ nebula> GO FROM "player100" OVER follow BIDIRECT \
+---------------------+------------+
| Player | Name_Count |
+---------------------+------------+
| "Shaquille O'Neal" | 1 |
| "Tiago Splitter" | 1 |
| "Aron Baynes" | 1 |
| "Boris Diaw" | 1 |
| "Manu Ginobili" | 2 |
| "Dejounte Murray" | 1 |
| "Danny Green" | 1 |
| "Tony Parker" | 2 |
| "Shaquille O'Neal" | 1 |
| "Boris Diaw" | 1 |
| "LaMarcus Aldridge" | 1 |
| "Tony Parker" | 2 |
| "Marco Belinelli" | 1 |
| "Dejounte Murray" | 1 |
| "Danny Green" | 1 |
| "Aron Baynes" | 1 |
+---------------------+------------+
```

Expand Down
6 changes: 3 additions & 3 deletions docs-2.0/3.ngql-guide/8.clauses-and-options/limit.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ nebula> LOOKUP ON player |\

# 从排序后结果中返回第2行开始的3行数据。
nebula> GO FROM "player100" OVER follow REVERSELY \
YIELD properties($$).name AS Friend, properties($$).age AS Age \|
ORDER BY $-.Age, $-.Friend \|
LIMIT 1, 3;
YIELD properties($$).name AS Friend, properties($$).age AS Age \
| ORDER BY $-.Age, $-.Friend \
| LIMIT 1, 3;
+-------------------+-----+
| Friend | Age |
+-------------------+-----+
Expand Down
28 changes: 14 additions & 14 deletions docs-2.0/3.ngql-guide/8.clauses-and-options/order-by.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,22 +93,22 @@ nebula> MATCH (v:player) RETURN v.age AS Age, v.name AS Name \
nebula> MATCH (v:player{name:"Tim Duncan"}) --> (v2) \
RETURN v2.name AS Name, v2.age AS Age \
ORDER BY Age;
+-----------------+----------+
| Name | Age |
+-----------------+----------+
| "Tony Parker" | 36 |
| "Manu Ginobili" | 41 |
| "Spurs" | __NULL__ |
+-----------------+----------+
+-----------------+--------------+
| Name | Age |
+-----------------+--------------+
| "Tony Parker" | 36 |
| "Manu Ginobili" | 41 |
| "Spurs" | UNKNOWN_PROP |
+-----------------+--------------+

nebula> MATCH (v:player{name:"Tim Duncan"}) --> (v2) \
RETURN v2.name AS Name, v2.age AS Age \
ORDER BY Age DESC;
+-----------------+----------+
| Name | Age |
+-----------------+----------+
| "Spurs" | __NULL__ |
| "Manu Ginobili" | 41 |
| "Tony Parker" | 36 |
+-----------------+----------+
+-----------------+--------------+
| Name | Age |
+-----------------+--------------+
| "Spurs" | UNKNOWN_PROP |
| "Manu Ginobili" | 41 |
| "Tony Parker" | 36 |
+-----------------+--------------+
```
16 changes: 8 additions & 8 deletions docs-2.0/3.ngql-guide/8.clauses-and-options/return.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,13 +157,13 @@ nebula> RETURN "Amber" AS Name;
```ngql
nebula> MATCH (v:player{name:"Tim Duncan"})-[e]->(v2) \
RETURN v2.name, type(e), v2.age;
+-----------------+----------+----------+
| v2.name | type(e) | v2.age |
+-----------------+----------+----------+
| "Tony Parker" | "follow" | 36 |
| "Manu Ginobili" | "follow" | 41 |
| "Spurs" | "serve" | __NULL__ |
+-----------------+----------+----------+
+-----------------+----------+--------------+
| v2.name | type(e) | v2.age |
+-----------------+----------+--------------+
| "Tony Parker" | "follow" | 36 |
| "Manu Ginobili" | "follow" | 41 |
| "Spurs" | "serve" | UNKNOWN_PROP |
+-----------------+----------+--------------+
```

## 返回表达式结果
Expand Down Expand Up @@ -195,7 +195,7 @@ nebula> RETURN 3 > 1;
| true |
+-------+

RETURN 1+1, rand32(1, 5);
nebula> RETURN 1+1, rand32(1, 5);
+-------+-------------+
| (1+1) | rand32(1,5) |
+-------+-------------+
Expand Down
5 changes: 4 additions & 1 deletion docs-2.0/3.ngql-guide/8.clauses-and-options/where.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ nebula> MATCH (v:player) \
| "Boris Diaw" | 36 |
| "DeAndre Jordan" | 30 |
+-------------------------+-------+
...
```

### 过滤rank
Expand Down Expand Up @@ -301,7 +302,9 @@ nebula> MATCH (v:player) \
| "Joel Embiid" | 25 |
+-------------------------+-------+

nebula> LOOKUP ON player WHERE player.age IN [25,28] YIELD properties(vertex).name, properties(vertex).age;
nebula> LOOKUP ON player \
WHERE player.age IN [25,28] \
YIELD properties(vertex).name, properties(vertex).age;
+-------------+-------------------------+------------------------+
| VertexID | properties(VERTEX).name | properties(VERTEX).age |
+-------------+-------------------------+------------------------+
Expand Down
34 changes: 16 additions & 18 deletions docs-2.0/3.ngql-guide/8.clauses-and-options/with.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,22 @@ nebula> MATCH p=(v:player{name:"Tim Duncan"})--() \
WITH nodes(p) AS n \
UNWIND n AS n1 \
RETURN DISTINCT n1;
+----------------------------------------------------------------------+
| n1 |
+----------------------------------------------------------------------+
| ("player100" :star{} :person{} :player{age: 42, name: "Tim Duncan"}) |
| ("player101" :player{age: 36, name: "Tony Parker"}) |
| ("team204" :team{name: "Spurs"}) |
| ("player102" :player{age: 33, name: "LaMarcus Aldridge"}) |
| ("player125" :player{age: 41, name: "Manu Ginobili"}) |
| ("player104" :player{age: 32, name: "Marco Belinelli"}) |
| ("player144" :player{age: 47, name: "Shaquile O'Neal"}) |
| ("player105" :player{age: 31, name: "Danny Green"}) |
| ("player113" :player{age: 29, name: "Dejounte Murray"}) |
| ("player107" :player{age: 32, name: "Aron Baynes"}) |
| ("player109" :player{age: 34, name: "Tiago Splitter"}) |
| ("player108" :player{age: 36, name: "Boris Diaw"}) |
+----------------------------------------------------------------------+
+-----------------------------------------------------------+
| n1 |
+-----------------------------------------------------------+
| ("player100" :player{age: 42, name: "Tim Duncan"}) |
| ("player101" :player{age: 36, name: "Tony Parker"}) |
| ("team204" :team{name: "Spurs"}) |
| ("player102" :player{age: 33, name: "LaMarcus Aldridge"}) |
| ("player125" :player{age: 41, name: "Manu Ginobili"}) |
| ("player104" :player{age: 32, name: "Marco Belinelli"}) |
| ("player144" :player{age: 47, name: "Shaquille O'Neal"}) |
| ("player105" :player{age: 31, name: "Danny Green"}) |
| ("player113" :player{age: 29, name: "Dejounte Murray"}) |
| ("player107" :player{age: 32, name: "Aron Baynes"}) |
| ("player109" :player{age: 34, name: "Tiago Splitter"}) |
| ("player108" :player{age: 36, name: "Boris Diaw"}) |
+-----------------------------------------------------------+
```

### 示例2
Expand All @@ -60,9 +60,7 @@ nebula> MATCH (v) \
+----------+
| tags_f |
+----------+
| "star" |
| "player" |
| "person" |
+----------+
```

Expand Down
2 changes: 1 addition & 1 deletion docs-2.0/3.ngql-guide/9.space-statements/5.drop-space.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
DROP SPACE [IF EXISTS] <graph_space_name>;
```

`IF NOT EXISTS`关键字可以检测待删除的图空间是否存在,只有存在时,才会删除图空间。
`IF EXISTS`关键字可以检测待删除的图空间是否存在,只有存在时,才会删除图空间。

`DROP SPACE`语句不会立刻删除硬盘上对应图空间的目录和文件,请使用`USE`语句指定其他任意图空间,然后执行`SUBMIT JOB COMPACT`。

Expand Down