File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
dataframe-arrow/src/main/kotlin/org/jetbrains/kotlinx/dataframe/io Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -145,6 +145,16 @@ internal class ArrowWriterImpl(
145
145
}
146
146
}
147
147
148
+ private fun convertColumnToCompatible (column : AnyCol ): Pair <AnyCol , Field > {
149
+ val actualField = column.toArrowField(mismatchSubscriber)
150
+ val result = try {
151
+ convertColumnToTarget(column, actualField.type)!!
152
+ } catch (e: Exception ) {
153
+ column
154
+ }
155
+ return result to actualField
156
+ }
157
+
148
158
private fun infillVector (vector : FieldVector , column : AnyCol ) {
149
159
when (vector) {
150
160
is VarCharVector ->
@@ -306,7 +316,7 @@ internal class ArrowWriterImpl(
306
316
cause = e,
307
317
),
308
318
)
309
- column to column !! .toArrowField(mismatchSubscriber )
319
+ convertColumnToCompatible( column!! )
310
320
}
311
321
} catch (e: TypeConverterNotFoundException ) {
312
322
if (strictType) {
@@ -317,7 +327,7 @@ internal class ArrowWriterImpl(
317
327
} else {
318
328
// If strictType is not enabled, use original data with its type. Target nullable is saved at this step.
319
329
mismatchSubscriber(ConvertingMismatch .TypeConversionNotFound .ConversionNotFoundIgnored (field.name, e))
320
- column to column !! .toArrowField(mismatchSubscriber )
330
+ convertColumnToCompatible( column!! )
321
331
}
322
332
}
323
333
You can’t perform that action at this time.
0 commit comments