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

Support the tck format for the output of EXPLAIN #2664

Merged
merged 4 commits into from
Mar 31, 2023
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,18 @@
- `EXPLAIN`

```ngql
EXPLAIN [format= {"row" | "dot"}] <your_nGQL_statement>;
EXPLAIN [format= {"row" | "dot" | "tck"}] <your_nGQL_statement>;
```

- `PROFILE`

```ngql
PROFILE [format= {"row" | "dot"}] <your_nGQL_statement>;
PROFILE [format= {"row" | "dot" | "tck"}] <your_nGQL_statement>;
```

## 输出格式

`EXPLAIN`或`PROFILE`语句的输出有两种格式:`row`(默认)`dot`。用户可以使用`format`选项修改输出格式。
`EXPLAIN`或`PROFILE`语句的输出有三种格式:`row`(默认)`dot`和`tck`。用户可以使用`format`选项修改输出格式。

## `row`格式

Expand Down Expand Up @@ -111,3 +111,52 @@ Execution Plan
将上述示例的 DOT 语言转换为 Graphviz 图,如下所示。

![Graphviz graph of EXPLAIN SHOW TAGS](https://docs-cdn.nebula-graph.com.cn/docs-2.0/3.ngql-guide/16.query-tuning-statements/explain-show-tags.png)

## `tck`格式

`tck`格式类似于表格,但是没有边框和行之间的间的分割线。用户可以将结果用在单元测试的测试用例中。
关于`tck`格式的测试用例,参见 [TCK case](https://github.com/vesoft-inc/nebula/tree/master/tests/tck/features)。

- `EXPLAIN`

```ngql
nebula> EXPLAIN format="tck" FETCH PROP ON player "player_1","player_2","player_3" YIELD properties(vertex).name as name, properties(vertex).age as age;
Execution succeeded (time spent 261µs/613.718µs)

Execution Plan (optimize time 28 us)


| id | name | dependencies | profiling data | operator info |
| 2 | Project | 1 | | |
| 1 | GetVertices | 0 | | |
| 0 | Start | | | |


Wed, 22 Mar 2023 23:15:52 CST

```

- `PROFILE`

```ngql
nebula> PROFILE format="tck" FETCH PROP ON player "player_1","player_2","player_3" YIELD properties(vertex).name as name, properties(vertex).age as age;

| name | age |
| "Piter Park" | 24 |
| "aaa" | 24 |
| "ccc" | 24 |

Got 3 rows (time spent 1.474ms/2.19677ms)

Execution Plan (optimize time 41 us)


| id | name | dependencies | profiling data | operator info |
| 2 | Project | 1 | {"rows":3,"version":0} | |
| 1 | GetVertices | 0 | {"resp[0]":{"exec":"232(us)","host":"127.0.0.1:9779","total":"758(us)"},"rows":3,"total_rpc":"875(us)","version":0} | |
| 0 | Start | | {"rows":0,"version":0} | |


Wed, 22 Mar 2023 23:16:13 CST

```