Kotlin / dataframe

Structured data processing in Kotlin
https://kotlin.github.io/dataframe/overview.html
Apache License 2.0
818 stars 58 forks source link

Missing overloads for `Iterable<ArrayLike>.toDataFrame()` #676

Open Jolanrensen opened 5 months ago

Jolanrensen commented 5 months ago

Currently, running

listOf(intArrayOf(1, 2, 3), intArrayOf(4, 5, 6)).toDataFrame()

results in:

No accessor found for property val kotlin.IntArray.size: kotlin.Int
kotlin.reflect.jvm.internal.KotlinReflectionInternalError: No accessor found for property val kotlin.IntArray.size: kotlin.Int

This is because toDataFrame() defaults to toDataFrame { properties() }, so it tries to dissect the properties of the IntArray class in this instance.

Instead, I believe this should create a DataFrame<ValueProperty<IntArray>>, like for the other primitives.

There is a challenge to adding these though. I found adding the overload Iterable<BooleanArray>.toDataFrame() breaks calls to Iterable<AnyBaseCol>.toDataFrame() for some reason. And adding them like <B : BooleanArray?> Iterable<B>.toDataFrame() is impossible, because arrays are illegal supertypes...

Jolanrensen commented 5 months ago

Actually, we might be missing overloads for other value-like types as well, like LocalDateTime, LocalDate, Duration, Instant, Enum, Temporal, maybe more

Jolanrensen commented 5 months ago

And align the behavior with unfold: https://github.com/Kotlin/dataframe/issues/677