Kotlin / dataframe

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

rename{}.into{} broken after upgrade to 13.1 #670

Closed rossetti closed 2 months ago

rossetti commented 2 months ago

The following code works under release: "org.jetbrains.kotlinx:dataframe-core:0.12.0"

    fun withRepViewStatistics(responseName: String): AnyFrame {
        val stat_name by column<String>()
        var dm = withinRepViewStatistics.filter { stat_name() == responseName }
        val rep_value by column<Double>()
        val exp_name by column<String>()
        val rep_id by column<Int>()
        dm = dm.select(exp_name, rep_id, rep_value)
//        println(dm.schema())
        dm = dm.rename { rep_value }.into(responseName)
        return dm
//        return dm.select("exp_name", "rep_id", "rep_value").rename{dm.getColumn("rep_value")}.into(responseName)
    }

Upgrading to "org.jetbrains.kotlinx:dataframe-core:0.13.1" causes the following error:

Exception in thread "main" java.lang.NoClassDefFoundError: org/jetbrains/kotlinx/dataframe/columns/ColumnsResolver at ksl.utilities.io.dbutil.KSLDatabase$withRepViewStatistics$1.invoke(KSLDatabase.kt:273) at ksl.utilities.io.dbutil.KSLDatabase$withRepViewStatistics$1.invoke(KSLDatabase.kt:273) at org.jetbrains.kotlinx.dataframe.impl.columns.ConstructorsKt$toColumnSet$1.invoke(constructors.kt:176) at org.jetbrains.kotlinx.dataframe.impl.columns.ConstructorsKt$toColumnSet$1.invoke(constructors.kt:174) at org.jetbrains.kotlinx.dataframe.impl.columns.ConstructorsKt$createColumnSet$1.resolve(constructors.kt:153) at org.jetbrains.kotlinx.dataframe.impl.columns.UtilsKt.resolve(Utils.kt:247) at org.jetbrains.kotlinx.dataframe.impl.UtilsKt.getColumnsWithPaths(Utils.kt:201) at org.jetbrains.kotlinx.dataframe.api.DataFrameGetKt.getColumnsWithPaths(DataFrameGet.kt:27) at org.jetbrains.kotlinx.dataframe.impl.api.RenameKt.renameImpl(rename.kt:24) at org.jetbrains.kotlinx.dataframe.impl.api.RenameKt.renameImpl(rename.kt:19) at org.jetbrains.kotlinx.dataframe.api.RenameKt.into(rename.kt:57) at ksl.utilities.io.dbutil.KSLDatabase.withRepViewStatistics(KSLDatabase.kt:273) at ksl.controls.experiments.FactorialExperiment.responseAsDataFrame(FactorialExperiment.kt:205) at ksl.examples.general.running.TestFactorialDOEKt.simulateFactorialDesign(TestFactorialDOE.kt:82) at ksl.examples.general.running.TestFactorialDOEKt.main(TestFactorialDOE.kt:32) at ksl.examples.general.running.TestFactorialDOEKt.main(TestFactorialDOE.kt) Caused by: java.lang.ClassNotFoundException: org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520) ... 16 more

Jolanrensen commented 2 months ago

I cannot reproduce it on my end, neither at 0.12.0 nor 0.13.1

Looking at the error java.lang.ClassNotFoundException: org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver, however, I suspect there might be a version mismatch somewhere in your codebase/caches. This class did not exist in 0.12 yet, so when you updated to 0.13.1 it might still try to access a cache somewhere. If clearing caches doesn't solve it, you could try to analyze your dependencies to see if another library perhaps introduces dataframe 0.12 alongside 0.13.

rossetti commented 2 months ago

It looks like clearing the cache worked. I would not have thought of that as the underlying problem if you had not provided your guidance. So, thanks.