From c48e4b7253484b76d55d037b4ae1ece12d17741b Mon Sep 17 00:00:00 2001 From: AntiTopQuark Date: Sun, 19 Mar 2023 19:02:37 +0800 Subject: [PATCH 1/3] Support the tck format for the output of EXPLAIN --- .../1.explain-and-profile.md | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/docs-2.0/3.ngql-guide/17.query-tuning-statements/1.explain-and-profile.md b/docs-2.0/3.ngql-guide/17.query-tuning-statements/1.explain-and-profile.md index 4b567fca9ab..26a5f507cbe 100644 --- a/docs-2.0/3.ngql-guide/17.query-tuning-statements/1.explain-and-profile.md +++ b/docs-2.0/3.ngql-guide/17.query-tuning-statements/1.explain-and-profile.md @@ -17,18 +17,18 @@ For example, a `SHOW TAGS` statement is processed into two `actions` and assigne * `EXPLAIN` ```ngql - EXPLAIN [format= {"row" | "dot"}] ; + EXPLAIN [format= {"row" | "dot" | "tck"}] ; ``` * `PROFILE` ```ngql - PROFILE [format= {"row" | "dot"}] ; + PROFILE [format= {"row" | "dot" | "tck"}] ; ``` ## 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, 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 @@ -114,3 +114,21 @@ 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 +In nebula-console, you can use the `format="tck"` option to support specifying the tck format, so that the generated output can be used directly in tck feature files for testing. + +```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.784ms/2.298714ms) + +Execution Plan (optimize time 46 us) + + +``` \ No newline at end of file From 672fbff8da442a81c99e11e8e5b294d9614c0dd0 Mon Sep 17 00:00:00 2001 From: AntiTopQuark Date: Sun, 26 Mar 2023 11:49:12 +0800 Subject: [PATCH 2/3] Update 1.explain-and-profile.md --- .../1.explain-and-profile.md | 40 ++++++++++++++----- 1 file changed, 29 insertions(+), 11 deletions(-) diff --git a/docs-2.0/3.ngql-guide/17.query-tuning-statements/1.explain-and-profile.md b/docs-2.0/3.ngql-guide/17.query-tuning-statements/1.explain-and-profile.md index 26a5f507cbe..88504366817 100644 --- a/docs-2.0/3.ngql-guide/17.query-tuning-statements/1.explain-and-profile.md +++ b/docs-2.0/3.ngql-guide/17.query-tuning-statements/1.explain-and-profile.md @@ -116,19 +116,37 @@ 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 -In nebula-console, you can use the `format="tck"` option to support specifying the tck format, so that the generated output can be used directly in tck feature files for testing. -```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 | +The tck format is similar to a table, but without borders and dividing lines between rows. Users can use the results as test cases in unit testing. +For information on tck format test cases, please refer to: https://github.com/vesoft-inc/nebula-graph/tree/master/tests#how-to-add-test-case. -Got 3 rows (time spent 1.784ms/2.298714ms) +- `EXPLAIN` -Execution Plan (optimize time 46 us) + ```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` -``` \ No newline at end of file + ```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 + ``` From bdde07cb866429d2d6f958085efe3c819cdaadc3 Mon Sep 17 00:00:00 2001 From: Abby <78209557+abby-cyber@users.noreply.github.com> Date: Mon, 27 Mar 2023 10:14:19 +0800 Subject: [PATCH 3/3] Update 1.explain-and-profile.md --- .../1.explain-and-profile.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs-2.0/3.ngql-guide/17.query-tuning-statements/1.explain-and-profile.md b/docs-2.0/3.ngql-guide/17.query-tuning-statements/1.explain-and-profile.md index 88504366817..c6449cfcce1 100644 --- a/docs-2.0/3.ngql-guide/17.query-tuning-statements/1.explain-and-profile.md +++ b/docs-2.0/3.ngql-guide/17.query-tuning-statements/1.explain-and-profile.md @@ -28,7 +28,7 @@ For example, a `SHOW TAGS` statement is processed into two `actions` and assigne ## Output formats -The output of an `EXPLAIN` or a `PROFILE` statement has three formats, the default `row` format , the `dot` format, 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 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 @@ -117,13 +117,13 @@ The Graphviz graph transformed from the above DOT statement is as follows. ## The `tck` format -The tck format is similar to a table, but without borders and dividing lines between rows. Users can use the results as test cases in unit testing. -For information on tck format test cases, please refer to: https://github.com/vesoft-inc/nebula-graph/tree/master/tests#how-to-add-test-case. +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; + 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 | @@ -137,7 +137,7 @@ For information on tck format test cases, please refer to: https://github.com/ve - `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; + 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 |