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

The length() function returns NULLs instead of the length of a path #4862

Closed
abby-cyber opened this issue Nov 11, 2022 · 6 comments · Fixed by #4884
Closed

The length() function returns NULLs instead of the length of a path #4862

abby-cyber opened this issue Nov 11, 2022 · 6 comments · Fixed by #4884
Assignees
Labels
type/bug Type: something is unexpected
Milestone

Comments

@abby-cyber
Copy link
Contributor

abby-cyber commented Nov 11, 2022

image

The length() function returns NULLs instead of the path length when I want to query the name in returned paths.

@abby-cyber abby-cyber added the type/bug Type: something is unexpected label Nov 11, 2022
@abby-cyber abby-cyber changed the title The length() function returns NULLs instead of Strings The length() function returns NULLs instead of the length of a path Nov 11, 2022
@Sophie-Xie Sophie-Xie added this to the v3.4.0 milestone Nov 11, 2022
@Shylock-Hg Shylock-Hg self-assigned this Nov 16, 2022
@czpmango
Copy link
Contributor

Just need throw runtime error for incompatible types, this is my test in neo4j 4.2.4:

neo4j@neo4j> create (v:player{name:"czp"})-[:like]->();
Added 2 nodes, Created 1 relationships, Set 1 properties, Added 1 labels

neo4j@neo4j> match p=(v:player)--() return length(p),size(v.name),length(v.name);
LENGTH cannot be used on strings

neo4j@neo4j> match p=(v:player)--() return length(p),size(v.name);
+--------------------------+
| length(p) | size(v.name) |
+--------------------------+
| 1         | 3            |
+--------------------------+

neo4j@neo4j> match p=(v:player)--() return length(p),size(v.prop);
+--------------------------+
| length(p) | size(v.prop) |
+--------------------------+
| 1         | NULL         |
+--------------------------+

@Shylock-Hg
Copy link
Contributor

A bug of properties prune

(root@nebula) [nba]> explain match (v) where id(v) == 'Tim Duncan' return length(v.player.name)
Execution succeeded (time spent 4791/6365 us)

Execution Plan (optimize time 2369 us)

-----+----------------+--------------+----------------+--------------------------------
| id | name           | dependencies | profiling data | operator info                 |
-----+----------------+--------------+----------------+--------------------------------
|  6 | Project        | 7            |                | outputVar: {                  |
|    |                |              |                |   "colNames": [               |
|    |                |              |                |     "length(v.player.name)"   |
|    |                |              |                |   ],                          |
|    |                |              |                |   "type": "DATASET",          |
|    |                |              |                |   "name": "__Project_6"       |
|    |                |              |                | }                             |
|    |                |              |                | inputVar: __Project_5         |
|    |                |              |                | columns: [                    |
|    |                |              |                |   "length(v.player.name)"     |
|    |                |              |                | ]                             |
-----+----------------+--------------+----------------+--------------------------------
|  7 | AppendVertices | 2            |                | outputVar: {                  |
|    |                |              |                |   "colNames": [               |
|    |                |              |                |     "v"                       |
|    |                |              |                |   ],                          |
|    |                |              |                |   "type": "DATASET",          |
|    |                |              |                |   "name": "__Project_5"       |
|    |                |              |                | }                             |
|    |                |              |                | inputVar: __Dedup_2           |
|    |                |              |                | space: 2                      |
|    |                |              |                | dedup: true                   |
|    |                |              |                | limit: -1                     |
|    |                |              |                | filter:                       |
|    |                |              |                | orderBy: []                   |
|    |                |              |                | src: $-._vid                  |
|    |                |              |                | props: [                      |
|    |                |              |                |   {                           |
|    |                |              |                |     "props": [                |
|    |                |              |                |       "_tag"                  |
|    |                |              |                |     ],                        |
|    |                |              |                |     "tagId": 9                |
|    |                |              |                |   },                          |
|    |                |              |                |   {                           |
|    |                |              |                |     "tagId": 8,               |
|    |                |              |                |     "props": [                |
|    |                |              |                |       "_tag"                  |
|    |                |              |                |     ]                         |
|    |                |              |                |   },                          |
|    |                |              |                |   {                           |
|    |                |              |                |     "props": [                |
|    |                |              |                |       "_tag"                  |
|    |                |              |                |     ],                        |
|    |                |              |                |     "tagId": 10               |
|    |                |              |                |   }                           |
|    |                |              |                | ]                             |
|    |                |              |                | exprs:                        |
|    |                |              |                | vertex_filter:                |
|    |                |              |                | if_track_previous_path: false |
-----+----------------+--------------+----------------+--------------------------------
|  2 | Dedup          | 1            |                | outputVar: {                  |
|    |                |              |                |   "colNames": [               |
|    |                |              |                |     "_vid"                    |
|    |                |              |                |   ],                          |
|    |                |              |                |   "type": "DATASET",          |
|    |                |              |                |   "name": "__Dedup_2"         |
|    |                |              |                | }                             |
|    |                |              |                | inputVar: __VAR_0             |
-----+----------------+--------------+----------------+--------------------------------
|  1 | PassThrough    | 3            |                | outputVar: {                  |
|    |                |              |                |   "colNames": [               |
|    |                |              |                |     "_vid"                    |
|    |                |              |                |   ],                          |
|    |                |              |                |   "type": "DATASET",          |
|    |                |              |                |   "name": "__VAR_0"           |
|    |                |              |                | }                             |
|    |                |              |                | inputVar:                     |
-----+----------------+--------------+----------------+--------------------------------
|  3 | Start          |              |                | outputVar: {                  |
|    |                |              |                |   "colNames": [],             |
|    |                |              |                |   "name": "__Start_3",        |
|    |                |              |                |   "type": "DATASET"           |
|    |                |              |                | }                             |
-----+----------------+--------------+----------------+--------------------------------

Wed, 16 Nov 2022 10:32:58 CST

@czpmango
Copy link
Contributor

czpmango commented Nov 16, 2022

A bug of properties prune

Exactly, but the behavior of the length function is also wrong.

@Shylock-Hg
Copy link
Contributor

Shylock-Hg commented Nov 16, 2022

A bug of properties prune

Exactly, but the behavior of the length function is also wrong.

We support length(STRING)

@czpmango
Copy link
Contributor

czpmango commented Nov 16, 2022

A bug of properties prune

Exactly, but the behavior of the length function is also wrong.

We support length(STRING)

We should not support length(STRING)

@Shylock-Hg
Copy link
Contributor

Shylock-Hg commented Nov 16, 2022

A bug of properties prune

Exactly, but the behavior of the length function is also wrong.

We support length(STRING)

We should not support length(STRING)

Compatibility

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug Type: something is unexpected
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants