You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: support fixed-size arrays in data readers (#726)
## Summary
- support parsing explicitly typed fixed-size arrays from CSV `LOAD
FROM`, including nested arrays, quoted strings, temporal values, and
length validation
- support fixed-size array values in the JSON reader and when
materializing `COPY FROM` results into graph properties
- support Arrow `FIXED_SIZE_LIST` columns in the Parquet reader,
including nested arrays and scalar child types
- add end-to-end CSV, JSON, and Parquet array coverage and document the
explicit `CAST(..., T[N])` workflow
Variable-length `LIST` types such as `FLOAT[]` remain unsupported by
these readers. Users must explicitly specify a fixed-size array type
such as `FLOAT[3]`; implicit LIST-to-ARRAY conversion is not performed.
## Testing
- `python3 -m pytest -q tools/python_bind/tests/test_load_array.py` — 15
passed
Fixes#441Fixes#442Fixes#443
---------
Co-authored-by: Longbin Lai <longbin.lai@gmail.com>
Copy file name to clipboardExpand all lines: doc/source/data_io/import_data.md
+19-1Lines changed: 19 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -240,7 +240,25 @@ The following options control how CSV files are parsed during `COPY FROM`. These
240
240
|`quoting`| bool |`true`| Whether to enable quote processing |
241
241
|`escaping`| bool |`true`| Whether to enable escape character processing |
242
242
243
-
> **Array limitation:**`COPY FROM` CSV currently does not auto-detect or directly materialize fixed-size `ARRAY` columns from bracketed CSV fields such as `"[1,2,3]"`. Use Cypher literals/parameters for array properties, or a typed non-CSV ingestion path when available.
243
+
`COPY FROM` supports loading `ARRAY` data from CSV,
244
+
JSON, and Parquet files. NeuG does not implicitly convert input values to
245
+
`ARRAY`; use `LOAD FROM` and explicitly cast the column to a fixed-size
246
+
`ARRAY` type.
247
+
248
+
For example, given a `person_array.csv` file with an array column:
249
+
250
+
```csv
251
+
id,name,address
252
+
1,Alice,"[Beijing,Hangzhou,Shanghai]"
253
+
2,Bob,"[London,Paris,Berlin]"
254
+
```
255
+
256
+
```cypher
257
+
COPY Person FROM (
258
+
LOAD FROM "person_array.csv" (delim=',')
259
+
RETURN id, name, CAST(address, 'STRING[3]') AS addresses
Copy file name to clipboardExpand all lines: doc/source/data_io/load_data.md
+17-1Lines changed: 17 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -46,7 +46,23 @@ LOAD FROM "person.csv" (delim=',', header=true)
46
46
RETURN name, age;
47
47
```
48
48
49
-
> **Array limitation:**`LOAD FROM` CSV currently does not parse CSV fields into fixed-size `ARRAY` values. A quoted field such as `"[1,2,3]"` is read as a `STRING`, and casting CSV columns to `INT64[3]`/other fixed-size array targets inside `LOAD FROM` is not supported yet.
49
+
NeuG supports reading `ARRAY` data from CSV, JSON,
50
+
and Parquet files. NeuG does not implicitly convert input values to `ARRAY`;
51
+
explicitly cast the column to a fixed-size `ARRAY` type in the `RETURN`
52
+
clause.
53
+
54
+
For example, given a `person_array.csv` file with an array column:
55
+
56
+
```csv
57
+
id,name,address
58
+
1,Alice,"[Beijing,Hangzhou,Shanghai]"
59
+
2,Bob,"[London,Paris,Berlin]"
60
+
```
61
+
62
+
```cypher
63
+
LOAD FROM "person_array.csv" (delim=',')
64
+
RETURN id, name, CAST(address, 'STRING[3]') AS addresses;
0 commit comments