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

match returns multiple records for one edge without direction #3377

Closed
HarrisChu opened this issue Nov 29, 2021 · 3 comments
Closed

match returns multiple records for one edge without direction #3377

HarrisChu opened this issue Nov 29, 2021 · 3 comments
Assignees
Labels
need to discuss Solution: issue or PR without a clear conclusion on whether to handle it type/bug Type: something is unexpected
Milestone

Comments

@HarrisChu
Copy link
Contributor

create space s1(vid_type=int)
use s1
create edge e1()
create tag t1()
insert edge if not exists e1 values 1 -> 2 :()
create edge index idx_edge on e1()
rebuild edge index idx_edge
insert vertex  t1() values 1:()
insert vertex  t1() values 2:()

match () - [e:e1] -() return e

expected:

  1. one record

actual:

  1. two records
(root@nebula) [s1]>  match () - [e:e1] -() return e
+------------------+
| e                |
+------------------+
| [:e1 1->2 @0 {}] |
| [:e1 1->2 @0 {}] |
+------------------+
Got 2 rows (time spent 5672/12959 us)

profile

-----+----------------+--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------
| id | name           | dependencies | profiling data                                                                                                                                                               | operator info                    |
-----+----------------+--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------
| 10 | Project        | 7            | ver: 0, rows: 2, execTime: 4us, totalTime: 4us                                                                                                                               | outputVar: [                     |
|    |                |              |                                                                                                                                                                              |   {                              |
|    |                |              |                                                                                                                                                                              |     "colNames": [                |
|    |                |              |                                                                                                                                                                              |       "e"                        |
|    |                |              |                                                                                                                                                                              |     ],                           |
|    |                |              |                                                                                                                                                                              |     "type": "DATASET",           |
|    |                |              |                                                                                                                                                                              |     "name": "__Project_9"        |
|    |                |              |                                                                                                                                                                              |   }                              |
|    |                |              |                                                                                                                                                                              | ]                                |
|    |                |              |                                                                                                                                                                              | inputVar: __AppendVertices_7     |
|    |                |              |                                                                                                                                                                              | columns: [                       |
|    |                |              |                                                                                                                                                                              |   "$-.e[0] AS e"                 |
|    |                |              |                                                                                                                                                                              | ]                                |
-----+----------------+--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------
|  7 | AppendVertices | 6            | {                                                                                                                                                                            | outputVar: [                     |
|    |                |              | ver: 0, rows: 2, execTime: 54us, totalTime: 553us                                                                                                                            |   {                              |
|    |                |              | "storaged0":9779 exec/total: 66(us)/341(us)                                                                                                                                  |     "colNames": [                |
|    |                |              | total_rpc: 519(us)                                                                                                                                                           |       "_vid",                    |
|    |                |              | }                                                                                                                                                                            |       "__VAR_0",                 |
|    |                |              |                                                                                                                                                                              |       "e",                       |
|    |                |              |                                                                                                                                                                              |       "__VAR_1"                  |
|    |                |              |                                                                                                                                                                              |     ],                           |
|    |                |              |                                                                                                                                                                              |     "type": "DATASET",           |
|    |                |              |                                                                                                                                                                              |     "name": "__AppendVertices_7" |
|    |                |              |                                                                                                                                                                              |   }                              |
|    |                |              |                                                                                                                                                                              | ]                                |
|    |                |              |                                                                                                                                                                              | inputVar: __Traverse_6           |
|    |                |              |                                                                                                                                                                              | space: 11                        |
|    |                |              |                                                                                                                                                                              | dedup: true                      |
|    |                |              |                                                                                                                                                                              | limit: 0                         |
|    |                |              |                                                                                                                                                                              | filter:                          |
|    |                |              |                                                                                                                                                                              | orderBy: []                      |
|    |                |              |                                                                                                                                                                              | src: none_direct_dst($-.e)       |
|    |                |              |                                                                                                                                                                              | props: [                         |
|    |                |              |                                                                                                                                                                              |   {                              |
|    |                |              |                                                                                                                                                                              |     "props": [                   |
|    |                |              |                                                                                                                                                                              |       "_tag"                     |
|    |                |              |                                                                                                                                                                              |     ],                           |
|    |                |              |                                                                                                                                                                              |     "tagId": 13                  |
|    |                |              |                                                                                                                                                                              |   }                              |
|    |                |              |                                                                                                                                                                              | ]                                |
|    |                |              |                                                                                                                                                                              | exprs:                           |
-----+----------------+--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------
|  6 | Traverse       | 5            | {                                                                                                                                                                            | outputVar: [                     |
|    |                |              | ver: 0, rows: 2, execTime: 8us, totalTime: 827us                                                                                                                             |   {                              |
|    |                |              | step 1: {                                                                                                                                                                    |     "colNames": [                |
|    |                |              | {"storaged0":9779 exec/total/vertices: 246(us)/563(us)/2,                                                                                                                    |       "_vid",                    |
|    |                |              | total_rpc_time: 765(us)                                                                                                                                                      |       "__VAR_0",                 |
|    |                |              | storage_detail: {GetNeighborsNode:176(us),HashJoinNode:171(us),RelNode:176(us),SingleEdgeNode:110(us),TagNode:55(us)}                                                        |       "e"                        |
|    |                |              | }                                                                                                                                                                            |     ],                           |
|    |                |              | }                                                                                                                                                                            |     "type": "DATASET",           |
|    |                |              | }                                                                                                                                                                            |     "name": "__Traverse_6"       |
|    |                |              |                                                                                                                                                                              |   }                              |
|    |                |              |                                                                                                                                                                              | ]                                |
|    |                |              |                                                                                                                                                                              | inputVar: __Dedup_5              |
|    |                |              |                                                                                                                                                                              | space: 11                        |
|    |                |              |                                                                                                                                                                              | dedup: true                      |
|    |                |              |                                                                                                                                                                              | limit: -1                        |
|    |                |              |                                                                                                                                                                              | filter:                          |
|    |                |              |                                                                                                                                                                              | orderBy: []                      |
|    |                |              |                                                                                                                                                                              | src: $_vid                       |
|    |                |              |                                                                                                                                                                              | edgeTypes: []                    |
|    |                |              |                                                                                                                                                                              | edgeDirection: BOTH              |
|    |                |              |                                                                                                                                                                              | vertexProps: []                  |
|    |                |              |                                                                                                                                                                              | edgeProps: [                     |
|    |                |              |                                                                                                                                                                              |   {                              |
|    |                |              |                                                                                                                                                                              |     "props": [                   |
|    |                |              |                                                                                                                                                                              |       "_src",                    |
|    |                |              |                                                                                                                                                                              |       "_type",                   |
|    |                |              |                                                                                                                                                                              |       "_rank",                   |
|    |                |              |                                                                                                                                                                              |       "_dst"                     |
|    |                |              |                                                                                                                                                                              |     ],                           |
|    |                |              |                                                                                                                                                                              |     "type": "-12"                |
|    |                |              |                                                                                                                                                                              |   },                             |
|    |                |              |                                                                                                                                                                              |   {                              |
|    |                |              |                                                                                                                                                                              |     "props": [                   |
|    |                |              |                                                                                                                                                                              |       "_src",                    |
|    |                |              |                                                                                                                                                                              |       "_type",                   |
|    |                |              |                                                                                                                                                                              |       "_rank",                   |
|    |                |              |                                                                                                                                                                              |       "_dst"                     |
|    |                |              |                                                                                                                                                                              |     ],                           |
|    |                |              |                                                                                                                                                                              |     "type": "12"                 |
|    |                |              |                                                                                                                                                                              |   }                              |
|    |                |              |                                                                                                                                                                              | ]                                |
|    |                |              |                                                                                                                                                                              | statProps:                       |
|    |                |              |                                                                                                                                                                              | exprs:                           |
|    |                |              |                                                                                                                                                                              | random: false                    |
-----+----------------+--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------
|  5 | Dedup          | 4            | ver: 0, rows: 2, execTime: 12us, totalTime: 13us                                                                                                                             | outputVar: [                     |
|    |                |              |                                                                                                                                                                              |   {                              |
|    |                |              |                                                                                                                                                                              |     "colNames": [                |
|    |                |              |                                                                                                                                                                              |       "_vid"                     |
|    |                |              |                                                                                                                                                                              |     ],                           |
|    |                |              |                                                                                                                                                                              |     "type": "DATASET",           |
|    |                |              |                                                                                                                                                                              |     "name": "__Dedup_5"          |
|    |                |              |                                                                                                                                                                              |   }                              |
|    |                |              |                                                                                                                                                                              | ]                                |
|    |                |              |                                                                                                                                                                              | inputVar: __Union_4              |
-----+----------------+--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------
|  4 | Union          | 2,3          | ver: 0, rows: 2, execTime: 10us, totalTime: 11us                                                                                                                             | outputVar: [                     |
|    |                |              |                                                                                                                                                                              |   {                              |
|    |                |              |                                                                                                                                                                              |     "colNames": [                |
|    |                |              |                                                                                                                                                                              |       "_vid"                     |
|    |                |              |                                                                                                                                                                              |     ],                           |
|    |                |              |                                                                                                                                                                              |     "type": "DATASET",           |
|    |                |              |                                                                                                                                                                              |     "name": "__Union_4"          |
|    |                |              |                                                                                                                                                                              |   }                              |
|    |                |              |                                                                                                                                                                              | ]                                |
|    |                |              |                                                                                                                                                                              | inputVar: {                      |
|    |                |              |                                                                                                                                                                              |   "rightVar": "__Project_3",     |
|    |                |              |                                                                                                                                                                              |   "leftVar": "__Project_2"       |
|    |                |              |                                                                                                                                                                              | }                                |
-----+----------------+--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------
|  2 | Project        | 1            | ver: 0, rows: 1, execTime: 31us, totalTime: 33us                                                                                                                             | outputVar: [                     |
|    |                |              |                                                                                                                                                                              |   {                              |
|    |                |              |                                                                                                                                                                              |     "colNames": [                |
|    |                |              |                                                                                                                                                                              |       "_vid"                     |
|    |                |              |                                                                                                                                                                              |     ],                           |
|    |                |              |                                                                                                                                                                              |     "type": "DATASET",           |
|    |                |              |                                                                                                                                                                              |     "name": "__Project_2"        |
|    |                |              |                                                                                                                                                                              |   }                              |
|    |                |              |                                                                                                                                                                              | ]                                |
|    |                |              |                                                                                                                                                                              | inputVar: __IndexScan_1          |
|    |                |              |                                                                                                                                                                              | columns: [                       |
|    |                |              |                                                                                                                                                                              |   "$-._src"                      |
|    |                |              |                                                                                                                                                                              | ]                                |
-----+----------------+--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------
|  1 | IndexScan      | 0            | {                                                                                                                                                                            | outputVar: [                     |
|    |                |              | ver: 0, rows: 1, execTime: 0us, totalTime: 3053us                                                                                                                            |   {                              |
|    |                |              | "storaged0":9779 exec/total: 2140(us)/2838(us)                                                                                                                               |     "colNames": [                |
|    |                |              | storage_detail: {IndexEdgeScanNode(IndexID=14, Path=()):2021(us),IndexLimitNode(limit=9223372036854775807):2033(us),IndexProjectionNode(projectColumn=[_src,_dst]):2024(us)} |       "_src",                    |
|    |                |              | }                                                                                                                                                                            |       "_dst"                     |
|    |                |              |                                                                                                                                                                              |     ],                           |
|    |                |              |                                                                                                                                                                              |     "type": "DATASET",           |
|    |                |              |                                                                                                                                                                              |     "name": "__IndexScan_1"      |
|    |                |              |                                                                                                                                                                              |   }                              |
|    |                |              |                                                                                                                                                                              | ]                                |
|    |                |              |                                                                                                                                                                              | inputVar: __VAR_2                |
|    |                |              |                                                                                                                                                                              | space: 11                        |
|    |                |              |                                                                                                                                                                              | dedup: false                     |
|    |                |              |                                                                                                                                                                              | limit: 9223372036854775807       |
|    |                |              |                                                                                                                                                                              | filter:                          |
|    |                |              |                                                                                                                                                                              | orderBy: []                      |
|    |                |              |                                                                                                                                                                              | schemaId: 12                     |
|    |                |              |                                                                                                                                                                              | isEdge: true                     |
|    |                |              |                                                                                                                                                                              | returnCols: [                    |
|    |                |              |                                                                                                                                                                              |   "_src",                        |
|    |                |              |                                                                                                                                                                              |   "_dst"                         |
|    |                |              |                                                                                                                                                                              | ]                                |
|    |                |              |                                                                                                                                                                              | indexCtx: [                      |
|    |                |              |                                                                                                                                                                              |   {                              |
|    |                |              |                                                                                                                                                                              |     "columnHints": [],           |
|    |                |              |                                                                                                                                                                              |     "filter": "",                |
|    |                |              |                                                                                                                                                                              |     "index_id": 14               |
|    |                |              |                                                                                                                                                                              |   }                              |
|    |                |              |                                                                                                                                                                              | ]                                |
-----+----------------+--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------
|  0 | Start          |              | ver: 0, rows: 0, execTime: 0us, totalTime: 22us                                                                                                                              | outputVar: [                     |
|    |                |              |                                                                                                                                                                              |   {                              |
|    |                |              |                                                                                                                                                                              |     "colNames": [],              |
|    |                |              |                                                                                                                                                                              |     "type": "DATASET",           |
|    |                |              |                                                                                                                                                                              |     "name": "__Start_0"          |
|    |                |              |                                                                                                                                                                              |   }                              |
|    |                |              |                                                                                                                                                                              | ]                                |
-----+----------------+--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------
|  3 | Project        | 1            | ver: 0, rows: 1, execTime: 7us, totalTime: 7us                                                                                                                               | outputVar: [                     |
|    |                |              |                                                                                                                                                                              |   {                              |
|    |                |              |                                                                                                                                                                              |     "colNames": [                |
|    |                |              |                                                                                                                                                                              |       "_vid"                     |
|    |                |              |                                                                                                                                                                              |     ],                           |
|    |                |              |                                                                                                                                                                              |     "type": "DATASET",           |
|    |                |              |                                                                                                                                                                              |     "name": "__Project_3"        |
|    |                |              |                                                                                                                                                                              |   }                              |
|    |                |              |                                                                                                                                                                              | ]                                |
|    |                |              |                                                                                                                                                                              | inputVar: __IndexScan_1          |
|    |                |              |                                                                                                                                                                              | columns: [                       |
|    |                |              |                                                                                                                                                                              |   "$-._dst"                      |
|    |                |              |                                                                                                                                                                              | ]                                |
-----+----------------+--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------
@HarrisChu HarrisChu added the type/bug Type: something is unexpected label Nov 29, 2021
@HarrisChu
Copy link
Contributor Author

HarrisChu commented Nov 29, 2021

guess that one is src:1, dst:2, edgeType:9, the other is src:2, dst:1, edgeType:-9.

@Sophie-Xie Sophie-Xie added this to the v3.0.0 milestone Nov 30, 2021
@czpmango
Copy link
Contributor

guess that one is src:1, dst:2, edgeType:9, the other is src:2, dst:1, edgeType:-9.

I know what you mean. But, regardless of how the implementation layer does it, the semantics of the cypher statement itself needs to be expanded from the starting point and the end point. Therefore, the two rows of results are expected

@HarrisChu HarrisChu added the need to discuss Solution: issue or PR without a clear conclusion on whether to handle it label Nov 30, 2021
@HarrisChu
Copy link
Contributor Author

not a bug, more info to understand this.

(root@nebula) [s1]> match (v1) - [e:e1] -(v2) return v1,e,v2
+-----------+------------------+-----------+
| v1        | e                | v2        |
+-----------+------------------+-----------+
| (2 :t1{}) | [:e1 1->2 @0 {}] | (1 :t1{}) |
| (1 :t1{}) | [:e1 1->2 @0 {}] | (2 :t1{}) |
+-----------+------------------+-----------+
Got 2 rows (time spent 5185/17529 us)

Tue, 30 Nov 2021 11:55:15 CST

just match the same edge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need to discuss Solution: issue or PR without a clear conclusion on whether to handle it type/bug Type: something is unexpected
Projects
None yet
Development

No branches or pull requests

4 participants