jiayuasu opened a new pull request, #1050:
URL: https://github.com/apache/sedona-db/pull/1050
Adds `DataFrame.unnest(*columns)`, which expands list/array column(s) so
each element becomes its own row — the relational form of pandas/GeoPandas
`explode()`.
```python
df.unnest("vals") # [10, 20, 30] -> 3 rows, other columns repeated
df.unnest("a", "b") # multiple columns unnested in parallel
(position-by-position)
df.unnest("parts") # ST_Dump(geom) -> one row per part (spatial explode)
```
## Design
- Thin wrapper over DataFusion's `DataFrame::unnest_columns`; mirrors the
existing `drop_columns` binding.
- **Engine-neutral naming** (`unnest`, matching Ibis / DuckDB SQL `UNNEST`)
rather than the pandas-flavored `explode`, consistent with the relational
DataFrame surface.
- Clear errors: no arguments -> `ValueError`; non-str argument ->
`TypeError`; unknown column -> `SedonaError` ("No field named …"); a raw
geometry (Binary) column -> `SedonaError` (unnest a multi-geometry via
`ST_Dump` first).
## Tests
New `tests/expr/test_dataframe_unnest.py` (8 tests): list-to-rows expansion,
parallel multi-column unnest, the `ST_Dump` + `unnest` multi-geometry explode,
laziness, and the four error paths. Plus a doctest on the method.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]