Kotlin/dataframe

Kotlin DataFrame compiler plugin

koperagen opened this issue · 1 comments

Place for discussion and questions about Kotlin DataFrame compiler plugin

Idea behind it is to make such code compile, provide coding assistance in project files and later in Kotlin Notebooks - on top of already existing code generation in-between notebook cells

@DataSchema
data class WikiData(val name: String, val paradigms: List<String>)

fun main() {
    val df = dataFrameOf(
        WikiData("Kotlin", listOf("object-oriented", "functional", "imperative")),
        WikiData("Haskell", listOf("Purely functional")),
        WikiData("C", listOf("imperative")),
    )
    val df1 = df.add("size") { 
        paradigms.size // `paradigms` is generated based on WikiData class structure
    }
    // `size` property is generated based on `add` argument
    df1.size.print()
}

Implementation lives here
https://github.com/Kotlin/dataframe/tree/compiler-plugin

Demo project that you can clone and run
https://github.com/koperagen/df-plugin-demo

Issue that describes required compiler API and provides some information about use case
https://youtrack.jetbrains.com/issue/KT-65859