Minimal repro:
fun main() {
val df2 = dataFrameOf(
"nulls" to List(3) { null }.toColumn(),
)
}
Expected:
one value column
nulls: Nothing?
Actual:
Nothing? gets picked up by this.isSubtypeOf(typeOf<AnyRow?>()) -> ColumnKind.Group branch
internal fun KType.toColumnKind(): ColumnKind =
when {
this.isSubtypeOf(typeOf<AnyFrame>()) -> ColumnKind.Frame
this.isSubtypeOf(typeOf<AnyRow?>()) -> ColumnKind.Group
else -> ColumnKind.Value
}
This leads to strange side effects like this pretty normal looking code failing with exception:
val df2 = dataFrameOf(
"nulls" to List(3) { null }.toColumn(),
"lists" to List(3) { n -> List(n) { n } }.toColumn()
)
df2.explode { lists }
Exception in thread "main" org.jetbrains.kotlinx.dataframe.exceptions.UnequalColumnSizesException: Unequal column sizes. Expected rows count: 0. Actual column sizes:
nulls: 0
lists: 3
Fix:
Just add a Nothing? -> Kind.Value branch
Minimal repro:
Expected:
one value column
nulls: Nothing?
Actual:
Nothing? gets picked up by
this.isSubtypeOf(typeOf<AnyRow?>()) -> ColumnKind.GroupbranchThis leads to strange side effects like this pretty normal looking code failing with exception:
Exception in thread "main" org.jetbrains.kotlinx.dataframe.exceptions.UnequalColumnSizesException: Unequal column sizes. Expected rows count: 0. Actual column sizes:
nulls: 0
lists: 3
Fix:
Just add a Nothing? -> Kind.Value branch