diff --git a/spark-doris-connector/src/main/scala/org/apache/doris/spark/sql/SchemaUtils.scala b/spark-doris-connector/src/main/scala/org/apache/doris/spark/sql/SchemaUtils.scala index f5a6a159..86a403f5 100644 --- a/spark-doris-connector/src/main/scala/org/apache/doris/spark/sql/SchemaUtils.scala +++ b/spark-doris-connector/src/main/scala/org/apache/doris/spark/sql/SchemaUtils.scala @@ -156,7 +156,7 @@ private[spark] object SchemaUtils { case LongType => row.getLong(ordinal) case FloatType => row.getFloat(ordinal) case DoubleType => row.getDouble(ordinal) - case StringType => row.getUTF8String(ordinal).toString + case StringType => Option(row.getUTF8String(ordinal)).map(_.toString).getOrElse(DataUtil.NULL_VALUE) case TimestampType => LocalDateTime.ofEpochSecond(row.getLong(ordinal) / 100000, (row.getLong(ordinal) % 1000).toInt, ZoneOffset.UTC) new Timestamp(row.getLong(ordinal) / 1000).toString