@@ -36,6 +36,7 @@ import org.jetbrains.kotlinx.dataframe.type
36
36
import java.math.BigDecimal
37
37
import java.net.URL
38
38
import java.time.LocalTime
39
+ import java.util.*
39
40
import kotlin.math.roundToInt
40
41
import kotlin.math.roundToLong
41
42
import kotlin.reflect.KType
@@ -81,15 +82,15 @@ internal fun AnyCol.convertToTypeImpl(to: KType): AnyCol {
81
82
return when {
82
83
from == to -> this
83
84
from.isSubtypeOf(to) -> (this as DataColumnInternal <* >).changeType(to.withNullability(hasNulls()))
84
- else -> when (val converter = getConverter(from, to)) {
85
+ else -> when (val converter = getConverter(from, to, ParserOptions (locale = Locale .getDefault()) )) {
85
86
null -> when (from.classifier) {
86
87
Any ::class , Number ::class , java.io.Serializable ::class -> {
87
88
// find converter for every value
88
89
val values = values.map {
89
90
it?.let {
90
91
val clazz = it.javaClass.kotlin
91
92
val type = clazz.createStarProjectedType(false )
92
- val converter = getConverter(type, to) ? : throw TypeConverterNotFoundException (from, to)
93
+ val converter = getConverter(type, to, ParserOptions (locale = Locale .getDefault()) ) ? : throw TypeConverterNotFoundException (from, to)
93
94
converter(it)
94
95
}.checkNulls()
95
96
}
@@ -107,9 +108,9 @@ internal fun AnyCol.convertToTypeImpl(to: KType): AnyCol {
107
108
}
108
109
}
109
110
110
- internal val convertersCache = mutableMapOf<Pair <KType , KType >, TypeConverter ? > ()
111
+ internal val convertersCache = mutableMapOf<Triple <KType , KType , ParserOptions ? >, TypeConverter ? > ()
111
112
112
- internal fun getConverter (from : KType , to : KType ): TypeConverter ? = convertersCache.getOrPut(from to to) { createConverter(from, to) }
113
+ internal fun getConverter (from : KType , to : KType , options : ParserOptions ? = null ): TypeConverter ? = convertersCache.getOrPut(Triple ( from, to, options)) { createConverter(from, to, options ) }
113
114
114
115
internal typealias TypeConverter = (Any ) -> Any?
115
116
0 commit comments