Clean up and centralize `col.convertToX()`/`df.convert {}.toX()` implementations
- Dominant language
- Kotlin
- Stars
- 1.1k
- Forks
- 83
- Avg merge
- 4d 12h
- Merged PRs (30d)
- 30
Description
Following up on https://github.com/Kotlin/dataframe/pull/1777
The implementation of convert.kt is now 4000+ lines long and many functions duplicate conversion logic of DataFrame.
For instance:
```kt
public fun DataColumn.convertToStdlibInstant(): DataColumn =
map { it.toStdlibInstant() }
public fun DataColumn.convertToStdlibInstant(): DataColumn =
map { it?.let { StdlibInstant.parse(it) } }
```
These could and should be replaced simply with `convertTo()`. Using these conversions instead centralized the logic in one place, which makes maintenance and predictability easier, plus it makes us test our automatic conversions more thoroughly :)
We should also probably consider splitting up the file per family of functions to keep things understandable.
Also, we should check whether non-null overloads are required for `Convert<>.toX(): DataFrame`. I remember @koperagen mentioning this.
In short:
- Split up the file in more manageable chunks, group functions together by type or family
- Replace logic with `convertTo<>()` calls where possible to centralize conversion logic
- Remove `null` overloads (if possible)
Contributor guide
Assessment
This issue has not been assessed yet.