Define default behavior for flattening results of `unfold` and `groupBy` aggregations
- Dominant language
- Kotlin
- Stars
- 1.1k
- Forks
- 83
- Avg merge
- 4d 12h
- Merged PRs (30d)
- 30
Description
### Problem
Results of `unfold` and `groupBy` aggregations often produce `FrameColumn` (nested structure), which users typically have to manually flatten.
This leads to repetitive patterns:
df.groupBy { ... }.aggregate { ... }.flatten()
In many data processing workflows, users expect a flat tabular result by default.
### Design question
Should results of `unfold` and aggregation operations be flattened automatically?
Options:
- keep current behavior (manual `flatten()`)
- auto-flatten results by default
- introduce an explicit option (e.g. `flatten = true`)
### Expected
Define a consistent default behavior for result shape of these operations.
### Acceptance criteria
- Decision made on default behavior (manual vs automatic flattening)
- Behavior implemented or explicitly documented
- If auto-flatten is introduced:
- nested structures are flattened consistently
- If not:
- documentation explains when `flatten()` is required
- Add example covering aggregation + flattening
### Motivation
DataFrame is designed for tabular data processing, where flat structures are the common case :contentReference[oaicite:0]{index=0}
Requiring manual flattening in common workflows reduces usability and leads to boilerplate.
This behavior must be clearly defined before 1.0, as it affects the shape of core API results.
```
When using `unfold` or `groupBy` aggregations, it always feels bit cumbersome to call `flatten` on the result to pull the columns out of the FrameColumn.
I'd argue that by default the user always expects a flattened result because that's the behavior in r and python.
```
Contributor guide
Assessment
This issue has not been assessed yet.