Skip to content

Commit 9d39aea

Browse files
committed
K2 compatibility: split up add-dsl in gatherImpl due to failing tests at runtime (it failed at typeOf<K>() deep in ColumnsContainer<T>.mapToColumn(name, typeOf<R>(), infer, body), this avoids the call)
1 parent 5297fa1 commit 9d39aea

File tree

2 files changed

+28
-30
lines changed
  • core
    • generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/impl/api
    • src/main/kotlin/org/jetbrains/kotlinx/dataframe/impl/api

2 files changed

+28
-30
lines changed

core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/impl/api/gather.kt

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -40,21 +40,20 @@ internal fun <T, C, K, R> Gather<T, C, K, R>.gatherImpl(
4040
// optimization when no filter is applied
4141
if (filter == null) {
4242
// add key and value columns
43-
df = df.add { // add columns for names and values
44-
if (keysColumn != null) {
45-
keysColumn from { keys }
46-
}
47-
if (valuesColumn != null) {
48-
valuesColumn from { row ->
49-
columnsToGather.map { col ->
50-
val value = col[row]
51-
if (valueTransform != null) {
52-
when {
53-
explode && value is List<*> -> (value as List<C>).map(valueTransform)
54-
else -> valueTransform(value)
55-
}
56-
} else value
57-
}
43+
if (keysColumn != null) {
44+
df = df.add(keysColumn) { keys }
45+
}
46+
47+
if (valuesColumn != null) {
48+
df = df.add(valuesColumn) { row ->
49+
columnsToGather.map { col ->
50+
val value = col[row]
51+
if (valueTransform != null) {
52+
when {
53+
explode && value is List<*> -> (value as List<C>).map(valueTransform)
54+
else -> valueTransform(value)
55+
}
56+
} else value
5857
}
5958
}
6059
}

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

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -40,21 +40,20 @@ internal fun <T, C, K, R> Gather<T, C, K, R>.gatherImpl(
4040
// optimization when no filter is applied
4141
if (filter == null) {
4242
// add key and value columns
43-
df = df.add { // add columns for names and values
44-
if (keysColumn != null) {
45-
keysColumn from { keys }
46-
}
47-
if (valuesColumn != null) {
48-
valuesColumn from { row ->
49-
columnsToGather.map { col ->
50-
val value = col[row]
51-
if (valueTransform != null) {
52-
when {
53-
explode && value is List<*> -> (value as List<C>).map(valueTransform)
54-
else -> valueTransform(value)
55-
}
56-
} else value
57-
}
43+
if (keysColumn != null) {
44+
df = df.add(keysColumn) { keys }
45+
}
46+
47+
if (valuesColumn != null) {
48+
df = df.add(valuesColumn) { row ->
49+
columnsToGather.map { col ->
50+
val value = col[row]
51+
if (valueTransform != null) {
52+
when {
53+
explode && value is List<*> -> (value as List<C>).map(valueTransform)
54+
else -> valueTransform(value)
55+
}
56+
} else value
5857
}
5958
}
6059
}

0 commit comments

Comments
 (0)