Skip to content

Commit 2a063cb

Browse files
explode fixes
1 parent 9bdbb54 commit 2a063cb

File tree

3 files changed

+10
-6
lines changed
  • core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api
  • plugins/kotlin-dataframe/src/org/jetbrains/kotlinx/dataframe/plugin/impl/api

3 files changed

+10
-6
lines changed

core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/explode.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ private val defaultExplodeColumns: ColumnsSelector<*, *> = {
2525

2626
/**
2727
* Splits list-like values in the specified [\columns] and spreads them vertically —
28-
* that is, adds a separate row for each element (one value per row).
28+
* that is, it adds a separate row for each element (one value per row).
2929
* Values in all other columns are duplicated to preserve row context.
3030
*
3131
* If no [\columns] are specified, all columns (at any depth) containing
3232
* [List] or [DataFrame] values will be exploded.
3333
*
34-
* If [dropEmpty] is `true`, rows with empty lists or DataFrames will be removed.
34+
* If [dropEmpty] is `true`, rows with empty lists or [DataFrame]s will be removed.
3535
* If `false`, such rows will be exploded into `null` values.
3636
*
3737
* Returns a new [DataFrame] with exploded columns.
@@ -117,7 +117,7 @@ public fun <T, C> DataFrame<T>.explode(vararg columns: KProperty<C>, dropEmpty:
117117

118118
/**
119119
* Splits list-like values in the specified [\columns] of this [DataRow] and spreads them vertically —
120-
* that is, adds a separate row for each element (one value per row)
120+
* that is, it adds a separate row for each element (one value per row)
121121
* and combine them into new [DataFrame].
122122
* Values in all other columns are duplicated to preserve row context.
123123
*
@@ -201,7 +201,7 @@ public fun <T, C> DataRow<T>.explode(vararg columns: KProperty<C>, dropEmpty: Bo
201201

202202
/**
203203
* Splits list-like values in this [DataColumn] and spreads them vertically —
204-
* that is, adds a separate row for each element (one value per row).
204+
* that is, it adds a separate row for each element (one value per row).
205205
*
206206
* Returns a new [DataColumn] with the exploded values.
207207
* The resulting column will have a new type (`List<T>` → `T`).

core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/gather.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,8 @@ public fun <T, C, K, R> Gather<T, C?, K, R>.notNull(): Gather<T, C, K, R> = wher
259259
* .mapValues { (it + 0.5).toFloat() }
260260
* .into("series", "value")
261261
* ```
262+
*
263+
* @see [explode]
262264
* @return A new [Gather] instance with exploded list values.
263265
*/
264266
@Interpretable("GatherExplodeLists")
@@ -296,6 +298,8 @@ public fun <T, C, K, R> Gather<T, C, K, R>.explodeLists(): Gather<T, C, K, R> =
296298
* .mapValues { (it + 0.5).toFloat() }
297299
* .into("series", "value")
298300
* ```
301+
*
302+
* @see [explode]
299303
* @return A new [Gather] instance with exploded list values.
300304
*/
301305
@JvmName("explodeListsTyped")

plugins/kotlin-dataframe/src/org/jetbrains/kotlinx/dataframe/plugin/impl/api/explode.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ import org.jetbrains.kotlinx.dataframe.plugin.impl.simpleColumnOf
1616
internal class Explode0 : AbstractInterpreter<PluginDataFrameSchema>() {
1717
val Arguments.dropEmpty: Boolean by arg(defaultValue = Present(true))
1818
val Arguments.receiver: PluginDataFrameSchema by dataFrame()
19-
val Arguments.selector: ColumnsResolver? by arg(defaultValue = Present(null))
19+
val Arguments.columns: ColumnsResolver? by arg(defaultValue = Present(null))
2020
override val Arguments.startingSchema get() = receiver
2121

2222
override fun Arguments.interpret(): PluginDataFrameSchema {
23-
val columns = selector ?: object : ColumnsResolver {
23+
val columns = columns ?: object : ColumnsResolver {
2424
override fun resolve(df: PluginDataFrameSchema): List<ColumnWithPathApproximation> {
2525
return df.flatten(includeFrames = false).filter {
2626
val column = it.column

0 commit comments

Comments
 (0)