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

opt: passthrough not applied in OR condition #5583

Open
wey-gu opened this issue Jun 8, 2023 · 0 comments
Open

opt: passthrough not applied in OR condition #5583

wey-gu opened this issue Jun 8, 2023 · 0 comments
Labels
affects/none PR/issue: this bug affects none version. severity/none Severity of bug type/bug Type: something is unexpected

Comments

@wey-gu
Copy link
Contributor

wey-gu commented Jun 8, 2023

As @xs2tarunkukreja helped trigger in #5582 , such optimization rule could be improved to passthrough.

MATCH (i)-[e]->(o) where id(i) == 'foo' or id(o) == 'bar' return e;

See:

(root@nebula) [demo_basketballplayer]> explain MATCH (i)-[e]->(o) where id(i) == 'foo' or id(o) == 'bar' return e;
Execution succeeded (time spent 710µs/26.197334ms)

Execution Plan (optimize time 285 us)

-----+----------------+--------------+----------------+---------------------------------------------------------------
| id | name           | dependencies | profiling data | operator info                                                |
-----+----------------+--------------+----------------+---------------------------------------------------------------
| 12 | Project        | 9            |                | outputVar: {                                                 |
|    |                |              |                |   "colNames": [                                              |
|    |                |              |                |     "e"                                                      |
|    |                |              |                |   ],                                                         |
|    |                |              |                |   "type": "DATASET",                                         |
|    |                |              |                |   "name": "__Project_8"                                      |
|    |                |              |                | }                                                            |
|    |                |              |                | inputVar: __Filter_9                                         |
|    |                |              |                | columns: [                                                   |
|    |                |              |                |   "$-.e[0]"                                                  |
|    |                |              |                | ]                                                            |
-----+----------------+--------------+----------------+---------------------------------------------------------------
|  9 | Filter         | 5            |                | outputVar: {                                                 |
|    |                |              |                |   "colNames": [                                              |
|    |                |              |                |     "i",                                                     |
|    |                |              |                |     "e",                                                     |
|    |                |              |                |     "o"                                                      |
|    |                |              |                |   ],                                                         |
|    |                |              |                |   "type": "DATASET",                                         |
|    |                |              |                |   "name": "__Filter_9"                                       |
|    |                |              |                | }                                                            |
|    |                |              |                | inputVar: __AppendVertices_5                                 |
|    |                |              |                | condition: ((id($-.i)=="foo") OR (id($-.o)=="bar"))          |
|    |                |              |                | isStable: false                                              |
-----+----------------+--------------+----------------+---------------------------------------------------------------
|  5 | AppendVertices | 4            |                | outputVar: {                                                 |
|    |                |              |                |   "colNames": [                                              |
|    |                |              |                |     "i",                                                     |
|    |                |              |                |     "e",                                                     |
|    |                |              |                |     "o"                                                      |
|    |                |              |                |   ],                                                         |
|    |                |              |                |   "type": "DATASET",                                         |
|    |                |              |                |   "name": "__AppendVertices_5"                               |
|    |                |              |                | }                                                            |
|    |                |              |                | inputVar: __Traverse_4                                       |
|    |                |              |                | space: 1                                                     |
|    |                |              |                | dedup: true                                                  |
|    |                |              |                | limit: -1                                                    |
|    |                |              |                | filter:                                                      |
|    |                |              |                | orderBy: []                                                  |
|    |                |              |                | src: none_direct_dst($-.e,$-.i)                              |
|    |                |              |                | props: [                                                     |
|    |                |              |                |   {                                                          |
|    |                |              |                |     "props": [                                               |
|    |                |              |                |       "_tag"                                                 |
|    |                |              |                |     ],                                                       |
|    |                |              |                |     "tagId": 2                                               |
|    |                |              |                |   },                                                         |
|    |                |              |                |   {                                                          |
|    |                |              |                |     "props": [                                               |
|    |                |              |                |       "_tag"                                                 |
|    |                |              |                |     ],                                                       |
|    |                |              |                |     "tagId": 3                                               |
|    |                |              |                |   }                                                          |
|    |                |              |                | ]                                                            |
|    |                |              |                | exprs:                                                       |
|    |                |              |                | vertex_filter:                                               |
|    |                |              |                | if_track_previous_path: true                                 |
-----+----------------+--------------+----------------+---------------------------------------------------------------
|  4 | Traverse       | 11           |                | outputVar: {                                                 |
|    |                |              |                |   "colNames": [                                              |
|    |                |              |                |     "i",                                                     |
|    |                |              |                |     "e"                                                      |
|    |                |              |                |   ],                                                         |
|    |                |              |                |   "type": "DATASET",                                         |
|    |                |              |                |   "name": "__Traverse_4"                                     |
|    |                |              |                | }                                                            |
|    |                |              |                | inputVar: __Filter_2                                         |
|    |                |              |                | space: 1                                                     |
|    |                |              |                | dedup: true                                                  |
|    |                |              |                | limit: -1                                                    |
|    |                |              |                | filter:                                                      |
|    |                |              |                | orderBy: []                                                  |
|    |                |              |                | src: $-._vid                                                 |
|    |                |              |                | edgeTypes: []                                                |
|    |                |              |                | edgeDirection: OUT_EDGE                                      |
|    |                |              |                | vertexProps:                                                 |
|    |                |              |                | edgeProps: [                                                 |
|    |                |              |                |   {                                                          |
|    |                |              |                |     "props": [                                               |
|    |                |              |                |       "_src",                                                |
|    |                |              |                |       "_type",                                               |
|    |                |              |                |       "_rank",                                               |
|    |                |              |                |       "_dst",                                                |
|    |                |              |                |       "start_year",                                          |
|    |                |              |                |       "end_year"                                             |
|    |                |              |                |     ],                                                       |
|    |                |              |                |     "type": 4                                                |
|    |                |              |                |   },                                                         |
|    |                |              |                |   {                                                          |
|    |                |              |                |     "props": [                                               |
|    |                |              |                |       "_src",                                                |
|    |                |              |                |       "_type",                                               |
|    |                |              |                |       "_rank",                                               |
|    |                |              |                |       "_dst",                                                |
|    |                |              |                |       "degree"                                               |
|    |                |              |                |     ],                                                       |
|    |                |              |                |     "type": 5                                                |
|    |                |              |                |   }                                                          |
|    |                |              |                | ]                                                            |
|    |                |              |                | statProps:                                                   |
|    |                |              |                | exprs:                                                       |
|    |                |              |                | random: false                                                |
|    |                |              |                | steps: 1..1                                                  |
|    |                |              |                | vertex filter:                                               |
|    |                |              |                | edge filter:                                                 |
|    |                |              |                | if_track_previous_path: false                                |
|    |                |              |                | first step filter:                                           |
|    |                |              |                | tag filter:                                                  |
-----+----------------+--------------+----------------+---------------------------------------------------------------
| 11 | ScanVertices   | 3            |                | outputVar: {                                                 |
|    |                |              |                |   "colNames": [                                              |
|    |                |              |                |     "_vid",                                                  |
|    |                |              |                |     "team._tag",                                             |
|    |                |              |                |     "player._tag"                                            |
|    |                |              |                |   ],                                                         |
|    |                |              |                |   "type": "DATASET",                                         |
|    |                |              |                |   "name": "__Filter_2"                                       |
|    |                |              |                | }                                                            |
|    |                |              |                | inputVar:                                                    |
|    |                |              |                | space: 1                                                     |
|    |                |              |                | dedup: false                                                 |
|    |                |              |                | limit: -1                                                    |
|    |                |              |                | filter: (team._tag IS NOT EMPTY OR player._tag IS NOT EMPTY) |
|    |                |              |                | orderBy: []                                                  |
|    |                |              |                | props: [                                                     |
|    |                |              |                |   {                                                          |
|    |                |              |                |     "props": [                                               |
|    |                |              |                |       "_tag"                                                 |
|    |                |              |                |     ],                                                       |
|    |                |              |                |     "tagId": 3                                               |
|    |                |              |                |   },                                                         |
|    |                |              |                |   {                                                          |
|    |                |              |                |     "props": [                                               |
|    |                |              |                |       "_tag"                                                 |
|    |                |              |                |     ],                                                       |
|    |                |              |                |     "tagId": 2                                               |
|    |                |              |                |   }                                                          |
|    |                |              |                | ]                                                            |
|    |                |              |                | exprs:                                                       |
-----+----------------+--------------+----------------+---------------------------------------------------------------
|  3 | Start          |              |                | outputVar: {                                                 |
|    |                |              |                |   "colNames": [],                                            |
|    |                |              |                |   "type": "DATASET",                                         |
|    |                |              |                |   "name": "__Start_3"                                        |
|    |                |              |                | }                                                            |
-----+----------------+--------------+----------------+---------------------------------------------------------------

Thu, 08 Jun 2023 08:59:55 CST
@wey-gu wey-gu added type/enhancement Type: make the code neat or more efficient type/bug Type: something is unexpected labels Jun 8, 2023
@github-actions github-actions bot added affects/none PR/issue: this bug affects none version. severity/none Severity of bug and removed type/enhancement Type: make the code neat or more efficient labels Jun 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects/none PR/issue: this bug affects none version. severity/none Severity of bug type/bug Type: something is unexpected
Projects
None yet
Development

No branches or pull requests

1 participant