Skip to content

DataSchema no longer auto-generating column accessors (Gradle, plugin v.0.13.1) #1042

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
2x2xplz opened this issue Jan 30, 2025 · 2 comments
Closed

Comments

@2x2xplz
Copy link

2x2xplz commented Jan 30, 2025

Upgraded a Gradle/JVM project and found out that my @DataSchema-annotated classes are no longer generating column accessors. Backtracked and found it works fine in 0.12.1 then stops working in 0.13.1.

Image Image

A very basic example:

package org.example

import org.jetbrains.kotlinx.dataframe.DataFrame
import org.jetbrains.kotlinx.dataframe.annotations.DataSchema
import org.jetbrains.kotlinx.dataframe.api.groupBy
import org.jetbrains.kotlinx.dataframe.api.sumFor
import org.jetbrains.kotlinx.dataframe.api.toDataFrame


@DataSchema
data class StoreHour(
    val weekday : Int,
    val hour : Int,
    val sales : Double,
    val taxCollected : Double
)

fun main() {
    val name = "Kotlin"
    println("Hello, $name!")

    for (i in 1..5) {
        println("i = $i")
    }

    val storeHours : List<StoreHour> = listOf(
        StoreHour(2, 7, 500.0, 40.0),
        StoreHour(2, 8, 650.0, 60.0),
        StoreHour(2, 9, 770.0, 70.0),
        StoreHour(2, 10, 900.0, 80.0)
    )

    val df : DataFrame<StoreHour> = storeHours.toDataFrame() //.cast<StoreHour>()

    println(df)

    val dfSums : DataFrame<StoreHour> = df.groupBy { weekday }.sumFor { sales and taxCollected }

    println(dfSums)

}

and my build.gradle.kts:

plugins {
    kotlin("jvm") version "2.0.20"
    id("com.google.devtools.ksp") version "2.1.10-1.0.29" // "2.0.20-1.0.25"
    id("org.jetbrains.kotlinx.dataframe") version "0.13.1" // 0.12.1
}

group = "org.example"
version = "1.0-SNAPSHOT"

repositories {
    mavenCentral()
}

dependencies {
    testImplementation(kotlin("test"))
    implementation("org.jetbrains.kotlinx:dataframe:0.13.1") // 0.12.1
}

tasks.test {
    useJUnitPlatform()
}
kotlin {
    jvmToolchain(21)
}

and when I roll back to 0.12.1 in gradle (both plugin and dependency) and the ksp plugin back to 2.0.20-1.0.25, everything works as expected:

Image Image

I experimented with the ksp plugin version but that doesn't seem to have any effect on the schema generation (other than it won't build/assemble when using the wrong version)

I also see that release notes for 0.13.1 mention a change to ColumnsSelection DSL #372 but the syntax I'm using still appears to be supported in the 0.15 documentation

Thanks for any help getting this working again.

@koperagen
Copy link
Collaborator

koperagen commented Jan 30, 2025

Hi! Thank you for the report. This looks quite problematic :( Seems that our gradle plugin can't setup ksp dependency with ksp 2.1.0+

I suggest to do the following:
Remove dataframe from gradle plugins:

plugins {
  kotlin("jvm") version "2.1.10"
  id("com.google.devtools.ksp") version "2.1.10-1.0.29"
}

Add symbol-processor to ksp directly:

dependencies {
    ksp("org.jetbrains.kotlinx.dataframe:symbol-processor-all:0.13.1")
}

@koperagen koperagen added this to the 0.16 milestone Jan 30, 2025
@2x2xplz
Copy link
Author

2x2xplz commented Jan 30, 2025

Thanks! Using the ksp dependency rather than the dataframe plugin appears to solve the issue. I upgraded to latest (0.15) and seems to be working great, all my columns are recognized and the program compiles.

@2x2xplz 2x2xplz closed this as completed Jan 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants