Skip to content

Commit 7a2de0a

Browse files
committed
Removed removeColumns argument from aggregateGroupBy, as it is always true
1 parent 5068a6d commit 7a2de0a

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,8 @@ public fun <T, R> Pivot<T>.aggregate(separate: Boolean = false, body: Selector<A
2121
@Refine
2222
@Interpretable("Aggregate")
2323
public fun <T, R> Grouped<T>.aggregate(body: AggregateGroupedBody<T, R>): DataFrame<T> =
24-
aggregateGroupBy((this as GroupBy<*, *>).toDataFrame(), { groups.cast() }, removeColumns = true, body).cast<T>()
24+
aggregateGroupBy(
25+
df = (this as GroupBy<*, *>).toDataFrame(),
26+
selector = { groups.cast() },
27+
body = body,
28+
).cast()

core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/impl/GroupByImpl.kt

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ internal class GroupByImpl<T, G>(
7575
internal fun <T, G, R> aggregateGroupBy(
7676
df: DataFrame<T>,
7777
selector: ColumnSelector<T, DataFrame<G>?>,
78-
removeColumns: Boolean,
7978
body: AggregateGroupedBody<G, R>,
8079
): DataFrame<T> {
8180
val defaultAggregateName = "aggregated"
@@ -126,13 +125,11 @@ internal fun <T, G, R> aggregateGroupBy(
126125
val removedNode = removed.removedColumns.single()
127126
val insertPath = removedNode.pathFromRoot().dropLast(1)
128127

129-
if (!removeColumns) removedNode.data.wasRemoved = false
130-
131128
val columnsToInsert = groupedFrame.getColumnsWithPaths {
132129
colsAtAnyDepth().filter { !it.isColumnGroup() }
133130
}.map {
134131
ColumnToInsert(insertPath + it.path, it, removedNode)
135132
}
136-
val src = if (removeColumns) removed.df else df
137-
return src.insertImpl(columnsToInsert)
133+
134+
return removed.df.insertImpl(columnsToInsert)
138135
}

0 commit comments

Comments
 (0)