Skip to content

Commit

Permalink
[bug] NPE occurs for StringType when column value is null. (#141)
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeCooker17 authored Sep 15, 2023
1 parent 32ec6c0 commit d46d5df
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d46d5df

Please sign in to comment.