Skip to content

Commit

Permalink
Support the tck format for the output of EXPLAIN (#2017)
Browse files Browse the repository at this point in the history
* Support the tck format for the output of EXPLAIN

* Update 1.explain-and-profile.md

* Update 1.explain-and-profile.md

---------

Co-authored-by: Abby <78209557+abby-cyber@users.noreply.github.com>
  • Loading branch information
AntiTopQuark and abby-cyber authored Mar 31, 2023
1 parent 6b935eb commit dbcb969
Showing 1 changed file with 39 additions and 3 deletions.
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
```

0 comments on commit dbcb969

Please sign in to comment.