Union type columns
- Dominant language
- Kotlin
- Stars
- 1.1k
- Forks
- 83
- Avg merge
- 4d 12h
- Merged PRs (30d)
- 30
Description
There are cases, for instance when reading from JSON or [reading from EXCEL](https://github.com/Kotlin/dataframe/issues/150), or [converting iterables to DataFrames containing exceptions](https://github.com/Kotlin/dataframe/blob/ce45ed4e470cc5fa05229987c8551c2691f613cb/core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/impl/api/toDataFrame.kt#L160) where columns containing multiple types will be created.
Currently, DataFrame tries to find the lowest common ancestor of the two types, just like Kotlin's type system, which in many cases (such as for Double+String) results in `Serializable` or `Comparable<*>` (or `Any`).
In such cases, it might be beneficial to have a simple union-type wrapper so people can more easily handle both types individually or convert one of the two types to the other manually.
We could introduce a 2-type wrapper (or 3-type, n-type, but I'd rather not) with a set of extension functions (on `ValueColumn>`) and proper type-displaying to make it easier for our users. Potentially we can also investigate how other libraries handle these cases.
Contributor guide
Assessment
This issue has not been assessed yet.