Skip to content

Commit

Permalink
[Compiler plugin] Align Flatten.separator default argument with the l…
Browse files Browse the repository at this point in the history
…ibrary
  • Loading branch information
koperagen committed Oct 23, 2024
1 parent c55726c commit 58e91d3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import org.jetbrains.kotlinx.dataframe.plugin.impl.toPluginDataFrameSchema
class FlattenDefault : AbstractSchemaModificationInterpreter() {
val Arguments.receiver by dataFrame()
val Arguments.keepParentNameForColumns: Boolean by arg(defaultValue = Present(false))
val Arguments.separator: String by arg(defaultValue = Present("."))
val Arguments.separator: String by arg(defaultValue = Present("_"))

override fun Arguments.interpret(): PluginDataFrameSchema {
return receiver.asDataFrame().flatten(keepParentNameForColumns, separator).toPluginDataFrameSchema()
Expand All @@ -24,7 +24,7 @@ class FlattenDefault : AbstractSchemaModificationInterpreter() {
class Flatten0 : AbstractSchemaModificationInterpreter() {
val Arguments.receiver by dataFrame()
val Arguments.keepParentNameForColumns: Boolean by arg(defaultValue = Present(false))
val Arguments.separator: String by arg(defaultValue = Present("."))
val Arguments.separator: String by arg(defaultValue = Present("_"))
val Arguments.columns: ColumnsResolver by arg()

override fun Arguments.interpret(): PluginDataFrameSchema {
Expand Down
2 changes: 2 additions & 0 deletions plugins/kotlin-dataframe/testData/box/flatten.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ fun box(): String {
flattened.compareSchemas(strict = true)
flattened.ungroup { f }.compareSchemas(strict = true)

grouped.flatten(keepParentNameForColumns = true) { f.e }.compareSchemas(strict = true)

grouped.flatten { f.e and f }.compareSchemas(strict = true)
return "OK"
}
Expand Down

0 comments on commit 58e91d3

Please sign in to comment.