-
Notifications
You must be signed in to change notification settings - Fork 76
Open
Labels
bugSomething isn't workingSomething isn't working
Milestone
Description
When a class contains computed properties, convertTo() still expects values for those properties to be defined:
@DataSchema
data class Foo (val first : Int, val second : Int) {
val total : Int get() = first.plus(second)
val highest : Int get() = listOf<Int>(first, second).max()
}
val df : DataFrame<Foo> = dataFrameOf("first", "second") (
1, 2,
25, 75,
500, 499
).convertTo<Foo>()
java.lang.IllegalArgumentException: The following columns were not found in DataFrame: [highest, total], and their type was not nullable. Use fill to initialize these columns
This affects post-processing after .readCSV(), making it tricky to properly create/convert to a DataFrame reflecting known classes. Instead it's much easier to read the CSV externally, convert rows to collection of classes, then use .toDataFrame().
Trying to use fill results in Unresolved Reference and Type Mismatch (it's certainly possible I have the wrong syntax):
val df : DataFrame<Foo> = dataFrameOf("first", "second") (
1, 2,
25, 75,
500, 499
).convertTo<Foo> {
fill { total }.with { first.plus(second) }
}
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working