Format, Parameters
UNCOLLECT can expand each row in the data stream into multiple rows. The input column (ARRAY type) of UNCOLLECT releases each element of its arrays into an independent row, and the homologous columns of the input column copy their respective rows in order to fill up the column length while keeping the intra-row correlations. The expanded column has a length that equals the sum of lengths of all the arrays in the input column.
Syntax:
- Format: uncollect
<column>
as<alias>
- Parameters: see table below
- Affected columns:
<column>
and all its homologous columns
Name | Category | Specification | Description |
---|---|---|---|
<column> |
NODE,EDGE,PATH,ATTR,ARRAY,TABLE | / | The array columns to be uncollected |
<alias> |
string | With the same naming convention as custom alias | The alias after uncollection of array columns, non-omittable |
Analysis
n(2).e()[:3].n(4) as path
with pnodes(path) as a1
uncollect a1 as a2
return path, a2
In the UQL statement above, UNCOLLECT expands an ARRAY column into 6 rows and duplicates its homologous columns into 6 rows:
Common Usage
Example: find paths from Card CA001 to CA003 within 3 steps, deduplicate the nodes on the paths and return
ab().src({_id == "CA001"}).dest({_id == "CA003"}).depth(:3) as p
with pnodes(p) as a
uncollect a as n
return distinct(n)