Skip to content

Make DataFrame inferred type in compile-time #1214

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

Open
Kotlin-GDE opened this issue May 25, 2025 · 4 comments
Open

Make DataFrame inferred type in compile-time #1214

Kotlin-GDE opened this issue May 25, 2025 · 4 comments
Labels
question Further information is requested

Comments

@Kotlin-GDE
Copy link

when using dataframe without kotlin notbook, columns not inferred in compile-time
how to fix that ?

@Jolanrensen Jolanrensen added the question Further information is requested label May 26, 2025
@Jolanrensen
Copy link
Collaborator

Hi there :)

For columns to be inferred in your normal Kotlin project, you will need the Compiler plugin. This will provide column accessors for any DataFrame<YourType> where YourType is a data schema interface/class you defined. (You might need to cast your dataframe to the data schema type.)
After running any operation, like add, remove, etc. the column accessors will be updated on the fly :).

If you are using an older version of DataFrame, Kotlin, or IntelliJ and you cannot yet use the compiler plugin, we also have an older Gradle/KSP plugin which can also generate column accessors, but those won't be updated on the fly after running operations. So it can only generate accessors when a data schema is defined.

Hope this can get you started!

@linux-china
Copy link

@Jolanrensen do you have any example on GitHub for Compiler plugin? I could not find Kotlin DataFrame compiler plugin example from dataframe repository.

@Kotlin-GDE
Copy link
Author

Kotlin-GDE commented May 30, 2025

hi, from docs

plugins {
    id("org.jetbrains.kotlinx.dataframe") version "1.0.0-Beta2"
}

dependencies {
    implementation("org.jetbrains.kotlinx:dataframe:1.0.0-Beta2")
}

plugin not compatible with kotlin 2.1.20 !!

@Jolanrensen
Copy link
Collaborator

Jolanrensen commented Jun 2, 2025

@linux-china You're right, we didn't put an example there yet, we'll certainly add it soon, once everything is a bit more stable :) (we do have an older example project here but it's out-of-date)

In the meantime @Kotlin-GDE is right, following https://kotlin.github.io/dataframe/compiler-plugin.html#setup should get you started (if you exactly follow each step of course), this means having the right IDE version, Kotlin version, etc.

@zaleslaw zaleslaw added this to the 1.0.0-Beta3 milestone Jun 2, 2025
@Jolanrensen Jolanrensen removed their assignment Jun 2, 2025
@Jolanrensen Jolanrensen removed this from the 1.0.0-Beta3 milestone Jun 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants