Skip to content

Commit

Permalink
Merge branch 'convert-comparable-to-string' into bia
Browse files Browse the repository at this point in the history
  • Loading branch information
Kopilov committed Sep 2, 2024
2 parents 297f77d + b0300e6 commit 8f3a283
Showing 1 changed file with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,16 @@ internal class ArrowWriterImpl(
}
}

private fun convertColumnToCompatible(column: AnyCol): Pair<AnyCol, Field> {
val actualField = column.toArrowField(mismatchSubscriber)
val result = try {
convertColumnToTarget(column, actualField.type)!!
} catch (e: Exception) {
column
}
return result to actualField
}

private fun infillVector(vector: FieldVector, column: AnyCol) {
when (vector) {
is VarCharVector ->
Expand Down Expand Up @@ -307,7 +317,7 @@ internal class ArrowWriterImpl(
cause = e,
),
)
column to column!!.toArrowField(mismatchSubscriber)
convertColumnToCompatible(column!!)
}
} catch (e: TypeConverterNotFoundException) {
if (strictType) {
Expand All @@ -318,7 +328,7 @@ internal class ArrowWriterImpl(
} else {
// If strictType is not enabled, use original data with its type. Target nullable is saved at this step.
mismatchSubscriber(ConvertingMismatch.TypeConversionNotFound.ConversionNotFoundIgnored(field.name, e))
column to column!!.toArrowField(mismatchSubscriber)
convertColumnToCompatible(column!!)
}
}

Expand Down

0 comments on commit 8f3a283

Please sign in to comment.