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

Minor optimize for go n steps #4566

Merged
merged 6 commits into from
Sep 1, 2022
Merged

Conversation

jievince
Copy link
Contributor

@jievince jievince commented Aug 22, 2022

What type of PR is this?

  • bug
  • feature
  • enhancement

What problem(s) does this PR solve?

Issue(s) number:

Description:

Let the n-1 steps inside the loop body of the plan always use GetDstBySrc when don't need to join input for go n stesp.

How do you solve it?

Special notes for your reviewer, ex. impact of this fix, design document, etc:

Checklist:

Tests:

  • Unit test(positive and negative cases)
  • Function test
  • Performance test
  • N/A

Affects:

  • Documentation affected (Please add the label if documentation needs to be modified.)
  • Incompatibility (If it breaks the compatibility, please describe it and add the label.)
  • If it's needed to cherry-pick (If cherry-pick to some branches is required, please label the destination version(s).)
  • Performance impacted: Consumes more CPU/Memory

Release notes:

Please confirm whether to be reflected in release notes and how to describe:

ex. Fixed the bug .....

Then the result should be, in any order, with relax comparison:
| count(*) |
| 65 |
And the execution plan should be:
Copy link
Contributor Author

@jievince jievince Aug 22, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before:

-----+--------------+--------------+----------------+------------------------------------------------------------------------------------------------------
| id | name         | dependencies | profiling data | operator info                                                                                       |
-----+--------------+--------------+----------------+------------------------------------------------------------------------------------------------------
| 12 | Aggregate    | 11           |                | outputVar: {                                                                                        |
|    |              |              |                |   "colNames": [                                                                                     |
|    |              |              |                |     "count(*)"                                                                                      |
|    |              |              |                |   ],                                                                                                |
|    |              |              |                |   "name": "__Aggregate_12",                                                                         |
|    |              |              |                |   "type": "DATASET"                                                                                 |
|    |              |              |                | }                                                                                                   |
|    |              |              |                | inputVar: __Project_11                                                                              |
|    |              |              |                | groupKeys: []                                                                                       |
|    |              |              |                | groupItems: [                                                                                       |
|    |              |              |                |   {                                                                                                 |
|    |              |              |                |     "expr": "count(*)"                                                                              |
|    |              |              |                |   }                                                                                                 |
|    |              |              |                | ]                                                                                                   |
-----+--------------+--------------+----------------+------------------------------------------------------------------------------------------------------
| 11 | Project      | 10           |                | outputVar: {                                                                                        |
|    |              |              |                |   "colNames": [                                                                                     |
|    |              |              |                |     "age"                                                                                           |
|    |              |              |                |   ],                                                                                                |
|    |              |              |                |   "name": "__Project_11",                                                                           |
|    |              |              |                |   "type": "DATASET"                                                                                 |
|    |              |              |                | }                                                                                                   |
|    |              |              |                | inputVar: __LeftJoin_10                                                                             |
|    |              |              |                | columns: [                                                                                          |
|    |              |              |                |   "$__COL_0 AS age"                                                                                 |
|    |              |              |                | ]                                                                                                   |
-----+--------------+--------------+----------------+------------------------------------------------------------------------------------------------------
| 10 | LeftJoin     | 9            |                | outputVar: {                                                                                        |
|    |              |              |                |   "colNames": [                                                                                     |
|    |              |              |                |     "JOIN_DST_VID",                                                                                 |
|    |              |              |                |     "__COL_0",                                                                                      |
|    |              |              |                |     "DST_VID"                                                                                       |
|    |              |              |                |   ],                                                                                                |
|    |              |              |                |   "name": "__LeftJoin_10",                                                                          |
|    |              |              |                |   "type": "DATASET"                                                                                 |
|    |              |              |                | }                                                                                                   |
|    |              |              |                | inputVar: {                                                                                         |
|    |              |              |                |   "leftVar": {                                                                                      |
|    |              |              |                |     "__Project_7": 0                                                                                |
|    |              |              |                |   },                                                                                                |
|    |              |              |                |   "rightVar": {                                                                                     |
|    |              |              |                |     "__Project_9": 0                                                                                |
|    |              |              |                |   }                                                                                                 |
|    |              |              |                | }                                                                                                   |
|    |              |              |                | hashKeys: [                                                                                         |
|    |              |              |                |   "COLUMN[-1]"                                                                                      |
|    |              |              |                | ]                                                                                                   |
|    |              |              |                | probeKeys: [                                                                                        |
|    |              |              |                |   "COLUMN[-1]"                                                                                      |
|    |              |              |                | ]                                                                                                   |
|    |              |              |                | kind: LeftJoin                                                                                      |
-----+--------------+--------------+----------------+------------------------------------------------------------------------------------------------------
|  9 | Project      | 8            |                | outputVar: {                                                                                        |
|    |              |              |                |   "colNames": [                                                                                     |
|    |              |              |                |     "__COL_0",                                                                                      |
|    |              |              |                |     "DST_VID"                                                                                       |
|    |              |              |                |   ],                                                                                                |
|    |              |              |                |   "name": "__Project_9",                                                                            |
|    |              |              |                |   "type": "DATASET"                                                                                 |
|    |              |              |                | }                                                                                                   |
|    |              |              |                | inputVar: __GetVertices_8                                                                           |
|    |              |              |                | columns: [                                                                                          |
|    |              |              |                |   "$$.player.age AS __COL_0",                                                                       |
|    |              |              |                |   "COLUMN[0] AS DST_VID"                                                                            |
|    |              |              |                | ]                                                                                                   |
-----+--------------+--------------+----------------+------------------------------------------------------------------------------------------------------
|  8 | GetVertices  | 7            |                | outputVar: {                                                                                        |
|    |              |              |                |   "colNames": [],                                                                                   |
|    |              |              |                |   "type": "DATASET",                                                                                |
|    |              |              |                |   "name": "__GetVertices_8"                                                                         |
|    |              |              |                | }                                                                                                   |
|    |              |              |                | inputVar: __Project_7                                                                               |
|    |              |              |                | space: 1                                                                                            |
|    |              |              |                | dedup: true                                                                                         |
|    |              |              |                | limit: 9223372036854775807                                                                          |
|    |              |              |                | filter:                                                                                             |
|    |              |              |                | orderBy: []                                                                                         |
|    |              |              |                | src: COLUMN[-1]                                                                                     |
|    |              |              |                | props: [                                                                                            |
|    |              |              |                |   {                                                                                                 |
|    |              |              |                |     "props": [                                                                                      |
|    |              |              |                |       "age"                                                                                         |
|    |              |              |                |     ],                                                                                              |
|    |              |              |                |     "tagId": 2                                                                                      |
|    |              |              |                |   }                                                                                                 |
|    |              |              |                | ]                                                                                                   |
|    |              |              |                | exprs:                                                                                              |
-----+--------------+--------------+----------------+------------------------------------------------------------------------------------------------------
|  7 | Project      | 6            |                | outputVar: {                                                                                        |
|    |              |              |                |   "colNames": [                                                                                     |
|    |              |              |                |     "JOIN_DST_VID"                                                                                  |
|    |              |              |                |   ],                                                                                                |
|    |              |              |                |   "name": "__Project_7",                                                                            |
|    |              |              |                |   "type": "DATASET"                                                                                 |
|    |              |              |                | }                                                                                                   |
|    |              |              |                | inputVar: __GetNeighbors_6                                                                          |
|    |              |              |                | columns: [                                                                                          |
|    |              |              |                |   "*._dst AS JOIN_DST_VID"                                                                          |
|    |              |              |                | ]                                                                                                   |
-----+--------------+--------------+----------------+------------------------------------------------------------------------------------------------------
|  6 | GetNeighbors | 5            |                | outputVar: {                                                                                        |
|    |              |              |                |   "colNames": [],                                                                                   |
|    |              |              |                |   "type": "DATASET",                                                                                |
|    |              |              |                |   "name": "__GetNeighbors_6"                                                                        |
|    |              |              |                | }                                                                                                   |
|    |              |              |                | inputVar: __VAR_0                                                                                   |
|    |              |              |                | space: 1                                                                                            |
|    |              |              |                | dedup: false                                                                                        |
|    |              |              |                | limit: -1                                                                                           |
|    |              |              |                | filter:                                                                                             |
|    |              |              |                | orderBy: []                                                                                         |
|    |              |              |                | src: COLUMN[0]                                                                                      |
|    |              |              |                | edgeTypes: []                                                                                       |
|    |              |              |                | edgeDirection: OUT_EDGE                                                                             |
|    |              |              |                | vertexProps:                                                                                        |
|    |              |              |                | edgeProps: [                                                                                        |
|    |              |              |                |   {                                                                                                 |
|    |              |              |                |     "type": -6,                                                                                     |
|    |              |              |                |     "props": [                                                                                      |
|    |              |              |                |       "_dst"                                                                                        |
|    |              |              |                |     ]                                                                                               |
|    |              |              |                |   },                                                                                                |
|    |              |              |                |   {                                                                                                 |
|    |              |              |                |     "props": [                                                                                      |
|    |              |              |                |       "_dst"                                                                                        |
|    |              |              |                |     ],                                                                                              |
|    |              |              |                |     "type": 6                                                                                       |
|    |              |              |                |   }                                                                                                 |
|    |              |              |                | ]                                                                                                   |
|    |              |              |                | statProps:                                                                                          |
|    |              |              |                | exprs:                                                                                              |
|    |              |              |                | random: false                                                                                       |
-----+--------------+--------------+----------------+------------------------------------------------------------------------------------------------------
|  5 | Loop         | 0            |                | outputVar: {                                                                                        |
|    |              |              |                |   "colNames": [],                                                                                   |
|    |              |              |                |   "type": "DATASET",                                                                                |
|    |              |              |                |   "name": "__Loop_5"                                                                                |
|    |              |              |                | }                                                                                                   |
|    |              |              |                | inputVar:                                                                                           |
|    |              |              |                | condition: ((++($__VAR_1)<=2) AND (($__GetNeighbors_2==__EMPTY__) OR (size($__GetNeighbors_2)!=0))) |
|    |              |              |                | loopBody: 4                                                                                         |
-----+--------------+--------------+----------------+------------------------------------------------------------------------------------------------------
|  4 | Dedup        | 3            |                | branch: true, nodeId: 5                                                                             |
|    |              |              |                |                                                                                                     |
|    |              |              |                | outputVar: {                                                                                        |
|    |              |              |                |   "colNames": [],                                                                                   |
|    |              |              |                |   "name": "__VAR_0",                                                                                |
|    |              |              |                |   "type": "DATASET"                                                                                 |
|    |              |              |                | }                                                                                                   |
|    |              |              |                | inputVar: __Project_3                                                                               |
-----+--------------+--------------+----------------+------------------------------------------------------------------------------------------------------
|  3 | Project      | 2            |                | outputVar: {                                                                                        |
|    |              |              |                |   "colNames": [                                                                                     |
|    |              |              |                |     "_vid"                                                                                          |
|    |              |              |                |   ],                                                                                                |
|    |              |              |                |   "type": "DATASET",                                                                                |
|    |              |              |                |   "name": "__Project_3"                                                                             |
|    |              |              |                | }                                                                                                   |
|    |              |              |                | inputVar: __GetNeighbors_2                                                                          |
|    |              |              |                | columns: [                                                                                          |
|    |              |              |                |   "*._dst AS _vid"                                                                                  |
|    |              |              |                | ]                                                                                                   |
-----+--------------+--------------+----------------+------------------------------------------------------------------------------------------------------
|  2 | GetNeighbors | 1            |                | outputVar: {                                                                                        |
|    |              |              |                |   "colNames": [],                                                                                   |
|    |              |              |                |   "type": "DATASET",                                                                                |
|    |              |              |                |   "name": "__GetNeighbors_2"                                                                        |
|    |              |              |                | }                                                                                                   |
|    |              |              |                | inputVar: __VAR_0                                                                                   |
|    |              |              |                | space: 1                                                                                            |
|    |              |              |                | dedup: false                                                                                        |
|    |              |              |                | limit: -1                                                                                           |
|    |              |              |                | filter:                                                                                             |
|    |              |              |                | orderBy: []                                                                                         |
|    |              |              |                | src: COLUMN[0]                                                                                      |
|    |              |              |                | edgeTypes: []                                                                                       |
|    |              |              |                | edgeDirection: OUT_EDGE                                                                             |
|    |              |              |                | vertexProps:                                                                                        |
|    |              |              |                | edgeProps: [                                                                                        |
|    |              |              |                |   {                                                                                                 |
|    |              |              |                |     "type": -6,                                                                                     |
|    |              |              |                |     "props": [                                                                                      |
|    |              |              |                |       "_dst"                                                                                        |
|    |              |              |                |     ]                                                                                               |
|    |              |              |                |   },                                                                                                |
|    |              |              |                |   {                                                                                                 |
|    |              |              |                |     "type": 6,                                                                                      |
|    |              |              |                |     "props": [                                                                                      |
|    |              |              |                |       "_dst"                                                                                        |
|    |              |              |                |     ]                                                                                               |
|    |              |              |                |   }                                                                                                 |
|    |              |              |                | ]                                                                                                   |
|    |              |              |                | statProps:                                                                                          |
|    |              |              |                | exprs:                                                                                              |
|    |              |              |                | random: false                                                                                       |
-----+--------------+--------------+----------------+------------------------------------------------------------------------------------------------------
|  1 | Start        |              |                | outputVar: {                                                                                        |
|    |              |              |                |   "colNames": [],                                                                                   |
|    |              |              |                |   "type": "DATASET",                                                                                |
|    |              |              |                |   "name": "__Start_1"                                                                               |
|    |              |              |                | }                                                                                                   |
-----+--------------+--------------+----------------+------------------------------------------------------------------------------------------------------
|  0 | Start        |              |                | outputVar: {                                                                                        |
|    |              |              |                |   "colNames": [],                                                                                   |
|    |              |              |                |   "name": "__Start_0",                                                                              |
|    |              |              |                |   "type": "DATASET"                                                                                 |
|    |              |              |                | }                                                                                                   |
-----+--------------+--------------+----------------+------------------------------------------------------------------------------------------------------

Then the result should be, in any order, with relax comparison:
| count(*) |
| 65 |
And the execution plan should be:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before:

-----+--------------+--------------+----------------+------------------------------------------------------------------------------------------------------
| id | name         | dependencies | profiling data | operator info                                                                                       |
-----+--------------+--------------+----------------+------------------------------------------------------------------------------------------------------
|  8 | Aggregate    | 7            |                | outputVar: {                                                                                        |
|    |              |              |                |   "colNames": [                                                                                     |
|    |              |              |                |     "count(*)"                                                                                      |
|    |              |              |                |   ],                                                                                                |
|    |              |              |                |   "name": "__Aggregate_8",                                                                          |
|    |              |              |                |   "type": "DATASET"                                                                                 |
|    |              |              |                | }                                                                                                   |
|    |              |              |                | inputVar: __Project_7                                                                               |
|    |              |              |                | groupKeys: []                                                                                       |
|    |              |              |                | groupItems: [                                                                                       |
|    |              |              |                |   {                                                                                                 |
|    |              |              |                |     "expr": "count(*)"                                                                              |
|    |              |              |                |   }                                                                                                 |
|    |              |              |                | ]                                                                                                   |
-----+--------------+--------------+----------------+------------------------------------------------------------------------------------------------------
|  7 | Project      | 6            |                | outputVar: {                                                                                        |
|    |              |              |                |   "colNames": [                                                                                     |
|    |              |              |                |     "dst"                                                                                           |
|    |              |              |                |   ],                                                                                                |
|    |              |              |                |   "name": "__Project_7",                                                                            |
|    |              |              |                |   "type": "DATASET"                                                                                 |
|    |              |              |                | }                                                                                                   |
|    |              |              |                | inputVar: __GetNeighbors_6                                                                          |
|    |              |              |                | columns: [                                                                                          |
|    |              |              |                |   "*._dst AS dst"                                                                                   |
|    |              |              |                | ]                                                                                                   |
-----+--------------+--------------+----------------+------------------------------------------------------------------------------------------------------
|  6 | GetNeighbors | 5            |                | outputVar: {                                                                                        |
|    |              |              |                |   "colNames": [],                                                                                   |
|    |              |              |                |   "type": "DATASET",                                                                                |
|    |              |              |                |   "name": "__GetNeighbors_6"                                                                        |
|    |              |              |                | }                                                                                                   |
|    |              |              |                | inputVar: __VAR_0                                                                                   |
|    |              |              |                | space: 1                                                                                            |
|    |              |              |                | dedup: false                                                                                        |
|    |              |              |                | limit: -1                                                                                           |
|    |              |              |                | filter:                                                                                             |
|    |              |              |                | orderBy: []                                                                                         |
|    |              |              |                | src: COLUMN[0]                                                                                      |
|    |              |              |                | edgeTypes: []                                                                                       |
|    |              |              |                | edgeDirection: OUT_EDGE                                                                             |
|    |              |              |                | vertexProps:                                                                                        |
|    |              |              |                | edgeProps: [                                                                                        |
|    |              |              |                |   {                                                                                                 |
|    |              |              |                |     "props": [                                                                                      |
|    |              |              |                |       "_dst"                                                                                        |
|    |              |              |                |     ],                                                                                              |
|    |              |              |                |     "type": -6                                                                                      |
|    |              |              |                |   },                                                                                                |
|    |              |              |                |   {                                                                                                 |
|    |              |              |                |     "type": 6,                                                                                      |
|    |              |              |                |     "props": [                                                                                      |
|    |              |              |                |       "_dst"                                                                                        |
|    |              |              |                |     ]                                                                                               |
|    |              |              |                |   }                                                                                                 |
|    |              |              |                | ]                                                                                                   |
|    |              |              |                | statProps:                                                                                          |
|    |              |              |                | exprs:                                                                                              |
|    |              |              |                | random: false                                                                                       |
-----+--------------+--------------+----------------+------------------------------------------------------------------------------------------------------
|  5 | Loop         | 0            |                | outputVar: {                                                                                        |
|    |              |              |                |   "colNames": [],                                                                                   |
|    |              |              |                |   "type": "DATASET",                                                                                |
|    |              |              |                |   "name": "__Loop_5"                                                                                |
|    |              |              |                | }                                                                                                   |
|    |              |              |                | inputVar:                                                                                           |
|    |              |              |                | condition: ((++($__VAR_1)<=2) AND (($__GetNeighbors_2==__EMPTY__) OR (size($__GetNeighbors_2)!=0))) |
|    |              |              |                | loopBody: 4                                                                                         |
-----+--------------+--------------+----------------+------------------------------------------------------------------------------------------------------
|  4 | Dedup        | 3            |                | branch: true, nodeId: 5                                                                             |
|    |              |              |                |                                                                                                     |
|    |              |              |                | outputVar: {                                                                                        |
|    |              |              |                |   "colNames": [],                                                                                   |
|    |              |              |                |   "name": "__VAR_0",                                                                                |
|    |              |              |                |   "type": "DATASET"                                                                                 |
|    |              |              |                | }                                                                                                   |
|    |              |              |                | inputVar: __Project_3                                                                               |
-----+--------------+--------------+----------------+------------------------------------------------------------------------------------------------------
|  3 | Project      | 2            |                | outputVar: {                                                                                        |
|    |              |              |                |   "colNames": [                                                                                     |
|    |              |              |                |     "_vid"                                                                                          |
|    |              |              |                |   ],                                                                                                |
|    |              |              |                |   "name": "__Project_3",                                                                            |
|    |              |              |                |   "type": "DATASET"                                                                                 |
|    |              |              |                | }                                                                                                   |
|    |              |              |                | inputVar: __GetNeighbors_2                                                                          |
|    |              |              |                | columns: [                                                                                          |
|    |              |              |                |   "*._dst AS _vid"                                                                                  |
|    |              |              |                | ]                                                                                                   |
-----+--------------+--------------+----------------+------------------------------------------------------------------------------------------------------
|  2 | GetNeighbors | 1            |                | outputVar: {                                                                                        |
|    |              |              |                |   "colNames": [],                                                                                   |
|    |              |              |                |   "name": "__GetNeighbors_2",                                                                       |
|    |              |              |                |   "type": "DATASET"                                                                                 |
|    |              |              |                | }                                                                                                   |
|    |              |              |                | inputVar: __VAR_0                                                                                   |
|    |              |              |                | space: 1                                                                                            |
|    |              |              |                | dedup: false                                                                                        |
|    |              |              |                | limit: -1                                                                                           |
|    |              |              |                | filter:                                                                                             |
|    |              |              |                | orderBy: []                                                                                         |
|    |              |              |                | src: COLUMN[0]                                                                                      |
|    |              |              |                | edgeTypes: []                                                                                       |
|    |              |              |                | edgeDirection: OUT_EDGE                                                                             |
|    |              |              |                | vertexProps:                                                                                        |
|    |              |              |                | edgeProps: [                                                                                        |
|    |              |              |                |   {                                                                                                 |
|    |              |              |                |     "props": [                                                                                      |
|    |              |              |                |       "_dst"                                                                                        |
|    |              |              |                |     ],                                                                                              |
|    |              |              |                |     "type": -6                                                                                      |
|    |              |              |                |   },                                                                                                |
|    |              |              |                |   {                                                                                                 |
|    |              |              |                |     "type": 6,                                                                                      |
|    |              |              |                |     "props": [                                                                                      |
|    |              |              |                |       "_dst"                                                                                        |
|    |              |              |                |     ]                                                                                               |
|    |              |              |                |   }                                                                                                 |
|    |              |              |                | ]                                                                                                   |
|    |              |              |                | statProps:                                                                                          |
|    |              |              |                | exprs:                                                                                              |
|    |              |              |                | random: false                                                                                       |
-----+--------------+--------------+----------------+------------------------------------------------------------------------------------------------------
|  1 | Start        |              |                | outputVar: {                                                                                        |
|    |              |              |                |   "colNames": [],                                                                                   |
|    |              |              |                |   "type": "DATASET",                                                                                |
|    |              |              |                |   "name": "__Start_1"                                                                               |
|    |              |              |                | }                                                                                                   |
-----+--------------+--------------+----------------+------------------------------------------------------------------------------------------------------
|  0 | Start        |              |                | outputVar: {                                                                                        |
|    |              |              |                |   "colNames": [],                                                                                   |
|    |              |              |                |   "name": "__Start_0",                                                                              |
|    |              |              |                |   "type": "DATASET"                                                                                 |
|    |              |              |                | }                                                                                                   |
-----+--------------+--------------+----------------+------------------------------------------------------------------------------------------------------

Then the result should be, in any order, with relax comparison:
| count(*) |
| 10 |
And the execution plan should be:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before:

-----+--------------+--------------+----------------+------------------------------------------------------------------------------------------------------
| id | name         | dependencies | profiling data | operator info                                                                                       |
-----+--------------+--------------+----------------+------------------------------------------------------------------------------------------------------
| 13 | Aggregate    | 12           |                | outputVar: {                                                                                        |
|    |              |              |                |   "colNames": [                                                                                     |
|    |              |              |                |     "count(*)"                                                                                      |
|    |              |              |                |   ],                                                                                                |
|    |              |              |                |   "type": "DATASET",                                                                                |
|    |              |              |                |   "name": "__Aggregate_13"                                                                          |
|    |              |              |                | }                                                                                                   |
|    |              |              |                | inputVar: __Project_12                                                                              |
|    |              |              |                | groupKeys: []                                                                                       |
|    |              |              |                | groupItems: [                                                                                       |
|    |              |              |                |   {                                                                                                 |
|    |              |              |                |     "expr": "count(*)"                                                                              |
|    |              |              |                |   }                                                                                                 |
|    |              |              |                | ]                                                                                                   |
-----+--------------+--------------+----------------+------------------------------------------------------------------------------------------------------
| 12 | Project      | 11           |                | outputVar: {                                                                                        |
|    |              |              |                |   "colNames": [                                                                                     |
|    |              |              |                |     "age"                                                                                           |
|    |              |              |                |   ],                                                                                                |
|    |              |              |                |   "name": "__Project_12",                                                                           |
|    |              |              |                |   "type": "DATASET"                                                                                 |
|    |              |              |                | }                                                                                                   |
|    |              |              |                | inputVar: __Filter_11                                                                               |
|    |              |              |                | columns: [                                                                                          |
|    |              |              |                |   "$__COL_0 AS age"                                                                                 |
|    |              |              |                | ]                                                                                                   |
-----+--------------+--------------+----------------+------------------------------------------------------------------------------------------------------
| 11 | Filter       | 10           |                | outputVar: {                                                                                        |
|    |              |              |                |   "colNames": [                                                                                     |
|    |              |              |                |     "JOIN_DST_VID",                                                                                 |
|    |              |              |                |     "__COL_0",                                                                                      |
|    |              |              |                |     "DST_VID"                                                                                       |
|    |              |              |                |   ],                                                                                                |
|    |              |              |                |   "name": "__Filter_11",                                                                            |
|    |              |              |                |   "type": "DATASET"                                                                                 |
|    |              |              |                | }                                                                                                   |
|    |              |              |                | inputVar: __LeftJoin_10                                                                             |
|    |              |              |                | condition: ($__COL_0>36)                                                                            |
|    |              |              |                | isStable: false                                                                                     |
-----+--------------+--------------+----------------+------------------------------------------------------------------------------------------------------
| 10 | LeftJoin     | 9            |                | outputVar: {                                                                                        |
|    |              |              |                |   "colNames": [                                                                                     |
|    |              |              |                |     "JOIN_DST_VID",                                                                                 |
|    |              |              |                |     "__COL_0",                                                                                      |
|    |              |              |                |     "DST_VID"                                                                                       |
|    |              |              |                |   ],                                                                                                |
|    |              |              |                |   "type": "DATASET",                                                                                |
|    |              |              |                |   "name": "__LeftJoin_10"                                                                           |
|    |              |              |                | }                                                                                                   |
|    |              |              |                | inputVar: {                                                                                         |
|    |              |              |                |   "rightVar": {                                                                                     |
|    |              |              |                |     "__Project_9": 0                                                                                |
|    |              |              |                |   },                                                                                                |
|    |              |              |                |   "leftVar": {                                                                                      |
|    |              |              |                |     "__Project_7": 0                                                                                |
|    |              |              |                |   }                                                                                                 |
|    |              |              |                | }                                                                                                   |
|    |              |              |                | hashKeys: [                                                                                         |
|    |              |              |                |   "COLUMN[-1]"                                                                                      |
|    |              |              |                | ]                                                                                                   |
|    |              |              |                | probeKeys: [                                                                                        |
|    |              |              |                |   "COLUMN[-1]"                                                                                      |
|    |              |              |                | ]                                                                                                   |
|    |              |              |                | kind: LeftJoin                                                                                      |
-----+--------------+--------------+----------------+------------------------------------------------------------------------------------------------------
|  9 | Project      | 8            |                | outputVar: {                                                                                        |
|    |              |              |                |   "colNames": [                                                                                     |
|    |              |              |                |     "__COL_0",                                                                                      |
|    |              |              |                |     "DST_VID"                                                                                       |
|    |              |              |                |   ],                                                                                                |
|    |              |              |                |   "name": "__Project_9",                                                                            |
|    |              |              |                |   "type": "DATASET"                                                                                 |
|    |              |              |                | }                                                                                                   |
|    |              |              |                | inputVar: __GetVertices_8                                                                           |
|    |              |              |                | columns: [                                                                                          |
|    |              |              |                |   "$$.player.age AS __COL_0",                                                                       |
|    |              |              |                |   "COLUMN[0] AS DST_VID"                                                                            |
|    |              |              |                | ]                                                                                                   |
-----+--------------+--------------+----------------+------------------------------------------------------------------------------------------------------
|  8 | GetVertices  | 7            |                | outputVar: {                                                                                        |
|    |              |              |                |   "colNames": [],                                                                                   |
|    |              |              |                |   "type": "DATASET",                                                                                |
|    |              |              |                |   "name": "__GetVertices_8"                                                                         |
|    |              |              |                | }                                                                                                   |
|    |              |              |                | inputVar: __Project_7                                                                               |
|    |              |              |                | space: 1                                                                                            |
|    |              |              |                | dedup: true                                                                                         |
|    |              |              |                | limit: 9223372036854775807                                                                          |
|    |              |              |                | filter:                                                                                             |
|    |              |              |                | orderBy: []                                                                                         |
|    |              |              |                | src: COLUMN[-1]                                                                                     |
|    |              |              |                | props: [                                                                                            |
|    |              |              |                |   {                                                                                                 |
|    |              |              |                |     "props": [                                                                                      |
|    |              |              |                |       "age"                                                                                         |
|    |              |              |                |     ],                                                                                              |
|    |              |              |                |     "tagId": 2                                                                                      |
|    |              |              |                |   }                                                                                                 |
|    |              |              |                | ]                                                                                                   |
|    |              |              |                | exprs:                                                                                              |
-----+--------------+--------------+----------------+------------------------------------------------------------------------------------------------------
|  7 | Project      | 6            |                | outputVar: {                                                                                        |
|    |              |              |                |   "colNames": [                                                                                     |
|    |              |              |                |     "JOIN_DST_VID"                                                                                  |
|    |              |              |                |   ],                                                                                                |
|    |              |              |                |   "type": "DATASET",                                                                                |
|    |              |              |                |   "name": "__Project_7"                                                                             |
|    |              |              |                | }                                                                                                   |
|    |              |              |                | inputVar: __GetNeighbors_6                                                                          |
|    |              |              |                | columns: [                                                                                          |
|    |              |              |                |   "*._dst AS JOIN_DST_VID"                                                                          |
|    |              |              |                | ]                                                                                                   |
-----+--------------+--------------+----------------+------------------------------------------------------------------------------------------------------
|  6 | GetNeighbors | 5            |                | outputVar: {                                                                                        |
|    |              |              |                |   "colNames": [],                                                                                   |
|    |              |              |                |   "type": "DATASET",                                                                                |
|    |              |              |                |   "name": "__GetNeighbors_6"                                                                        |
|    |              |              |                | }                                                                                                   |
|    |              |              |                | inputVar: __VAR_0                                                                                   |
|    |              |              |                | space: 1                                                                                            |
|    |              |              |                | dedup: false                                                                                        |
|    |              |              |                | limit: -1                                                                                           |
|    |              |              |                | filter:                                                                                             |
|    |              |              |                | orderBy: []                                                                                         |
|    |              |              |                | src: COLUMN[0]                                                                                      |
|    |              |              |                | edgeTypes: []                                                                                       |
|    |              |              |                | edgeDirection: OUT_EDGE                                                                             |
|    |              |              |                | vertexProps:                                                                                        |
|    |              |              |                | edgeProps: [                                                                                        |
|    |              |              |                |   {                                                                                                 |
|    |              |              |                |     "props": [                                                                                      |
|    |              |              |                |       "_dst"                                                                                        |
|    |              |              |                |     ],                                                                                              |
|    |              |              |                |     "type": 5                                                                                       |
|    |              |              |                |   },                                                                                                |
|    |              |              |                |   {                                                                                                 |
|    |              |              |                |     "props": [                                                                                      |
|    |              |              |                |       "_dst"                                                                                        |
|    |              |              |                |     ],                                                                                              |
|    |              |              |                |     "type": 6                                                                                       |
|    |              |              |                |   },                                                                                                |
|    |              |              |                |   {                                                                                                 |
|    |              |              |                |     "props": [                                                                                      |
|    |              |              |                |       "_dst"                                                                                        |
|    |              |              |                |     ],                                                                                              |
|    |              |              |                |     "type": 7                                                                                       |
|    |              |              |                |   }                                                                                                 |
|    |              |              |                | ]                                                                                                   |
|    |              |              |                | statProps:                                                                                          |
|    |              |              |                | exprs:                                                                                              |
|    |              |              |                | random: false                                                                                       |
-----+--------------+--------------+----------------+------------------------------------------------------------------------------------------------------
|  5 | Loop         | 0            |                | outputVar: {                                                                                        |
|    |              |              |                |   "colNames": [],                                                                                   |
|    |              |              |                |   "type": "DATASET",                                                                                |
|    |              |              |                |   "name": "__Loop_5"                                                                                |
|    |              |              |                | }                                                                                                   |
|    |              |              |                | inputVar:                                                                                           |
|    |              |              |                | condition: ((++($__VAR_1)<=2) AND (($__GetNeighbors_2==__EMPTY__) OR (size($__GetNeighbors_2)!=0))) |
|    |              |              |                | loopBody: 4                                                                                         |
-----+--------------+--------------+----------------+------------------------------------------------------------------------------------------------------
|  4 | Dedup        | 3            |                | branch: true, nodeId: 5                                                                             |
|    |              |              |                |                                                                                                     |
|    |              |              |                | outputVar: {                                                                                        |
|    |              |              |                |   "colNames": [],                                                                                   |
|    |              |              |                |   "name": "__VAR_0",                                                                                |
|    |              |              |                |   "type": "DATASET"                                                                                 |
|    |              |              |                | }                                                                                                   |
|    |              |              |                | inputVar: __Project_3                                                                               |
-----+--------------+--------------+----------------+------------------------------------------------------------------------------------------------------
|  3 | Project      | 2            |                | outputVar: {                                                                                        |
|    |              |              |                |   "colNames": [                                                                                     |
|    |              |              |                |     "_vid"                                                                                          |
|    |              |              |                |   ],                                                                                                |
|    |              |              |                |   "name": "__Project_3",                                                                            |
|    |              |              |                |   "type": "DATASET"                                                                                 |
|    |              |              |                | }                                                                                                   |
|    |              |              |                | inputVar: __GetNeighbors_2                                                                          |
|    |              |              |                | columns: [                                                                                          |
|    |              |              |                |   "*._dst AS _vid"                                                                                  |
|    |              |              |                | ]                                                                                                   |
-----+--------------+--------------+----------------+------------------------------------------------------------------------------------------------------
|  2 | GetNeighbors | 1            |                | outputVar: {                                                                                        |
|    |              |              |                |   "colNames": [],                                                                                   |
|    |              |              |                |   "name": "__GetNeighbors_2",                                                                       |
|    |              |              |                |   "type": "DATASET"                                                                                 |
|    |              |              |                | }                                                                                                   |
|    |              |              |                | inputVar: __VAR_0                                                                                   |
|    |              |              |                | space: 1                                                                                            |
|    |              |              |                | dedup: false                                                                                        |
|    |              |              |                | limit: -1                                                                                           |
|    |              |              |                | filter:                                                                                             |
|    |              |              |                | orderBy: []                                                                                         |
|    |              |              |                | src: COLUMN[0]                                                                                      |
|    |              |              |                | edgeTypes: []                                                                                       |
|    |              |              |                | edgeDirection: OUT_EDGE                                                                             |
|    |              |              |                | vertexProps:                                                                                        |
|    |              |              |                | edgeProps: [                                                                                        |
|    |              |              |                |   {                                                                                                 |
|    |              |              |                |     "type": 5,                                                                                      |
|    |              |              |                |     "props": [                                                                                      |
|    |              |              |                |       "_dst"                                                                                        |
|    |              |              |                |     ]                                                                                               |
|    |              |              |                |   },                                                                                                |
|    |              |              |                |   {                                                                                                 |
|    |              |              |                |     "props": [                                                                                      |
|    |              |              |                |       "_dst"                                                                                        |
|    |              |              |                |     ],                                                                                              |
|    |              |              |                |     "type": 6                                                                                       |
|    |              |              |                |   },                                                                                                |
|    |              |              |                |   {                                                                                                 |
|    |              |              |                |     "type": 7,                                                                                      |
|    |              |              |                |     "props": [                                                                                      |
|    |              |              |                |       "_dst"                                                                                        |
|    |              |              |                |     ]                                                                                               |
|    |              |              |                |   }                                                                                                 |
|    |              |              |                | ]                                                                                                   |
|    |              |              |                | statProps:                                                                                          |
|    |              |              |                | exprs:                                                                                              |
|    |              |              |                | random: false                                                                                       |
-----+--------------+--------------+----------------+------------------------------------------------------------------------------------------------------
|  1 | Start        |              |                | outputVar: {                                                                                        |
|    |              |              |                |   "colNames": [],                                                                                   |
|    |              |              |                |   "name": "__Start_1",                                                                              |
|    |              |              |                |   "type": "DATASET"                                                                                 |
|    |              |              |                | }                                                                                                   |
-----+--------------+--------------+----------------+------------------------------------------------------------------------------------------------------
|  0 | Start        |              |                | outputVar: {                                                                                        |
|    |              |              |                |   "colNames": [],                                                                                   |
|    |              |              |                |   "type": "DATASET",                                                                                |
|    |              |              |                |   "name": "__Start_0"                                                                               |
|    |              |              |                | }                                                                                                   |

@jievince jievince added the ready-for-testing PR: ready for the CI test label Aug 22, 2022
@critical27
Copy link
Contributor

ctest failed~

@jievince
Copy link
Contributor Author

ctest failed~

ok, I will fix it.

@jievince jievince changed the title Minor fixes and improvements Optimize for go n steps Aug 29, 2022
@@ -66,34 +66,34 @@ Feature: single shortestPath
| <("Blake Griffin" :player{age: 30, name: "Blake Griffin"})-[:like@0 {likeness: -1}]->("Chris Paul" :player{age: 33, name: "Chris Paul"})-[:like@0 {likeness: 90}]->("LeBron James" :player{age: 34, name: "LeBron James"})> |
When executing query:
"""
MATCH p = shortestPath( (a:player{age:30})-[e*..5]->(b:team) ) RETURN p
MATCH p = shortestPath( (a:player{age:30})-[e*..5]->(b:team) ) RETURN b, length(p)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why modify this test?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The result of this test is not deterministic, similar to #4431.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test failed on my local machine. But the change to my pr has nothing to do with the shortest path, and I don't know why I failed the test.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test failed on my local machine. But the change to my pr has nothing to do with the shortest path, and I don't know why I failed the test.

@nevermore3 Could you help explain it?

Copy link
Contributor

@nevermore3 nevermore3 Aug 30, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i fixed test case in #4583

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i fixed test case in #4583

ok, Thanks

@jievince jievince changed the title Optimize for go n steps Minor optimize for go n steps Sep 1, 2022
@critical27
Copy link
Contributor

Good job~

@critical27 critical27 merged commit 51d84a4 into vesoft-inc:master Sep 1, 2022
caton-hpg pushed a commit to caton-hpg/nebula that referenced this pull request Sep 1, 2022
* Minor fixes and improvements

* fix ctest

* fix rewriteVertexEdge2EdgeProp

* fix fix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-for-testing PR: ready for the CI test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants