Skip to content

The behavior of YIELD is inconsistent #3480

Closed
@yixinglu

Description

@yixinglu

Please check the FAQ documentation before raising an issue

Describe the bug (required)

Steps to reproduce the behavior:

(root@nebula) [nba_int_vid]> unwind [[1,3,5],[0]] as e return e | yield reduce(s=list[], i IN collect($-.e) | s + i) AS a
+--------------+
| a            |
+--------------+
| [1, 3, 5, 0] |
+--------------+
Got 1 rows (time spent 5322/5902 us)

Thu, 16 Dec 2021 11:30:40 CST

(root@nebula) [nba_int_vid]> unwind [[1,3,5],[0]] as e return e | yield reduce(s=list[], i IN collect($-.e) | s + i) AS a | yield $-.a
[ERROR (-1009)]: SemanticError: `$-.a', not exist prop `a'

Thu, 16 Dec 2021 11:30:48 CST

BUT it's ok for following query:

(root@nebula) [nba_int_vid]> yield 4 as t | yield reduce(s=list[], i IN [$-.t] | s + i) as a
+-----+
| a   |
+-----+
| [4] |
+-----+
Got 1 rows (time spent 2330/2827 us)

Thu, 16 Dec 2021 11:34:53 CST
(root@nebula) [nba_int_vid]> yield 4 as t | yield reduce(s=list[], i IN [$-.t] | s + i) as a | yield $-.a
+------+
| $-.a |
+------+
| [4]  |
+------+

What's the difference between above two queries? It's so confused for me.

Metadata

Metadata

Assignees

Labels

type/bugType: something is unexpected

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions