Skip to content

Commit

Permalink
small fix for one failing test in #713, where GroupBy.aggregate { thi…
Browse files Browse the repository at this point in the history
…s into "" } would break typing
  • Loading branch information
Jolanrensen committed Jul 31, 2024
1 parent 3037a97 commit 23046d8
Showing 1 changed file with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import org.jetbrains.kotlinx.dataframe.columns.ValueColumn
import org.jetbrains.kotlinx.dataframe.columns.shortPath
import org.jetbrains.kotlinx.dataframe.impl.aggregation.receivers.AggregateInternalDsl
import org.jetbrains.kotlinx.dataframe.impl.api.AggregatedPivot
import org.jetbrains.kotlinx.dataframe.impl.createStarProjectedType
import org.jetbrains.kotlinx.dataframe.impl.createTypeWithArgument
import org.jetbrains.kotlinx.dataframe.impl.getListType
import kotlin.reflect.KType
Expand Down Expand Up @@ -118,7 +119,19 @@ internal class GroupByReceiverImpl<T>(override val df: DataFrame<T>, override va
pivot.aggregator.values.clear()
}

is AggregateInternalDsl<*> -> yield(value.copy(value = value.value.df))
is AggregateInternalDsl<*> -> {
// Attempt to create DataFrame<Type> from AggregateInternalDsl<Type>
val dfType = value.type?.arguments?.firstOrNull()?.type
?.let { DataFrame::class.createTypeWithArgument(it) }
?: DataFrame::class.createStarProjectedType(nullable = false)

yield(
value.copy(
value = value.value.df,
type = dfType,
),
)
}

else -> values.add(value)
}
Expand Down

0 comments on commit 23046d8

Please sign in to comment.