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 #2017

Merged
merged 3 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 @@ For example, a `SHOW TAGS` statement is processed into two `actions` and assigne
* `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>;
```

## Output formats

The output of an `EXPLAIN` or a `PROFILE` statement has two formats, the default `row` format and the `dot` format. You can use the `format` option to modify the output format. Omitting the `format` option indicates using the default `row` format.
The output of an `EXPLAIN` or a `PROFILE` statement has three formats, the default `row` format, the `dot` format, and the `tck` format. You can use the `format` option to modify the output format. Omitting the `format` option indicates using the default `row` format.

## The `row` format

Expand Down Expand Up @@ -114,3 +114,39 @@ Execution Plan
The Graphviz graph transformed from the above DOT statement is as follows.

![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)

## The `tck` format

The tck format is similar to a table, but without borders and dividing lines between rows. You can use the results as test cases for unit testing.
For information on tck format test cases, see [TCK cases](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
```