Skip to content

Commit c269e08

Browse files
committed
fixes concatImpl to add defaultValue to types when it's used.
1 parent 9de6462 commit c269e08

File tree

2 files changed

+16
-2
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

+16
-2
lines changed

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import org.jetbrains.kotlinx.dataframe.hasNulls
1212
import org.jetbrains.kotlinx.dataframe.impl.columns.guessColumnType
1313
import org.jetbrains.kotlinx.dataframe.impl.commonType
1414
import org.jetbrains.kotlinx.dataframe.impl.getListType
15+
import org.jetbrains.kotlinx.dataframe.impl.guessValueType
1516
import org.jetbrains.kotlinx.dataframe.nrow
1617
import kotlin.reflect.KType
1718
import kotlin.reflect.full.withNullability
@@ -54,7 +55,13 @@ internal fun <T> concatImpl(name: String, columns: List<DataColumn<T>?>, columnS
5455
col.toList()
5556
} else {
5657
val nrow = columnSizes[index]
57-
if (!nulls && nrow > 0 && defaultValue == null) nulls = true
58+
if (!nulls && nrow > 0 && defaultValue == null) {
59+
nulls = true
60+
} else if (defaultValue != null) {
61+
types.add(
62+
guessValueType(sequenceOf(defaultValue))
63+
)
64+
}
5865
List(nrow) { defaultValue }
5966
}
6067
}

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import org.jetbrains.kotlinx.dataframe.hasNulls
1212
import org.jetbrains.kotlinx.dataframe.impl.columns.guessColumnType
1313
import org.jetbrains.kotlinx.dataframe.impl.commonType
1414
import org.jetbrains.kotlinx.dataframe.impl.getListType
15+
import org.jetbrains.kotlinx.dataframe.impl.guessValueType
1516
import org.jetbrains.kotlinx.dataframe.nrow
1617
import kotlin.reflect.KType
1718
import kotlin.reflect.full.withNullability
@@ -54,7 +55,13 @@ internal fun <T> concatImpl(name: String, columns: List<DataColumn<T>?>, columnS
5455
col.toList()
5556
} else {
5657
val nrow = columnSizes[index]
57-
if (!nulls && nrow > 0 && defaultValue == null) nulls = true
58+
if (!nulls && nrow > 0 && defaultValue == null) {
59+
nulls = true
60+
} else if (defaultValue != null) {
61+
types.add(
62+
guessValueType(sequenceOf(defaultValue))
63+
)
64+
}
5865
List(nrow) { defaultValue }
5966
}
6067
}

0 commit comments

Comments
 (0)