Skip to content

FieldKind.of logic is wrong for FrameColumn/ColumnGroup #1498

@koperagen

Description

@koperagen

For example expected type of a is DataColumn<DataFrame<LocalType>?>, but schema - FrameColumn.

val df = dataFrameOf("a" to columnOf(List(4) {
    dataFrameOf(
        "c" to columnOf(2)
    )
}))

val res = df.convert { a }.with { it.takeIf { it.rowsCount() % 2 == 0 } }
res[0].a?.c


// FieldKind.of is wrong =(
println(res.compileTimeSchema())

For now this logic is used in toDataFrame (library), compileTimeSchema (library), and extract schema from DataSchema declarations (compiler plugin, maybe in Jupyter integration)

Potential problems:

  1. Incorrect compileTimeSchema
  2. Extension properties for res are correct, but after another operation plugin will perform extract schema and probably some kind of runtime exception could happen while accessing a/c in df1
    val df1 = res.add("addMe") { 123 }

Metadata

Metadata

Assignees

No one assigned

    Labels

    Compiler pluginAnything related to the DataFrame Compiler PluginbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions