-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Compiler plugin] Propagate nullability in toDataFrame tree conversion
- Loading branch information
Showing
5 changed files
with
108 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
plugins/kotlin-dataframe/testData/box/toDataFrame_nullableList.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import org.jetbrains.kotlinx.dataframe.* | ||
import org.jetbrains.kotlinx.dataframe.annotations.* | ||
import org.jetbrains.kotlinx.dataframe.api.* | ||
import org.jetbrains.kotlinx.dataframe.io.* | ||
|
||
@DataSchema | ||
data class D( | ||
val s: String | ||
) | ||
|
||
fun box(): String { | ||
val df1 = listOf(D("bb"), null).toDataFrame() | ||
df1.schema().print() | ||
df1.compileTimeSchema().print() | ||
return "OK" | ||
} |
27 changes: 27 additions & 0 deletions
27
plugins/kotlin-dataframe/testData/box/toDataFrame_nullableListSubtree.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import org.jetbrains.kotlinx.dataframe.* | ||
import org.jetbrains.kotlinx.dataframe.annotations.* | ||
import org.jetbrains.kotlinx.dataframe.api.* | ||
import org.jetbrains.kotlinx.dataframe.io.* | ||
|
||
@DataSchema | ||
data class D( | ||
val s: String | ||
) | ||
|
||
class Subtree( | ||
val p: Int, | ||
val l: List<Int>, | ||
val ld: List<D>, | ||
) | ||
|
||
class Root(val a: Subtree) | ||
|
||
fun box(): String { | ||
val l = listOf( | ||
Root(Subtree(123, listOf(1), listOf(D("ff")))), | ||
null | ||
) | ||
val df = l.toDataFrame(maxDepth = 2) | ||
df.compareSchemas(strict = true) | ||
return "OK" | ||
} |
27 changes: 27 additions & 0 deletions
27
plugins/kotlin-dataframe/testData/box/toDataFrame_nullableSubtree.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import org.jetbrains.kotlinx.dataframe.* | ||
import org.jetbrains.kotlinx.dataframe.annotations.* | ||
import org.jetbrains.kotlinx.dataframe.api.* | ||
import org.jetbrains.kotlinx.dataframe.io.* | ||
|
||
@DataSchema | ||
data class D( | ||
val s: String | ||
) | ||
|
||
class Subtree( | ||
val p: Int, | ||
val l: List<Int>, | ||
val ld: List<D>, | ||
) | ||
|
||
class Root(val a: Subtree?) | ||
|
||
fun box(): String { | ||
val l = listOf( | ||
Root(Subtree(123, listOf(1), listOf(D("ff")))), | ||
Root(null) | ||
) | ||
val df = l.toDataFrame(maxDepth = 2) | ||
df.compareSchemas(strict = true) | ||
return "OK" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters