Skip to content

Commit

Permalink
[bug] NPE occurs for StringType when column value is null.
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeCooker17 committed Sep 14, 2023
1 parent 0daf6c4 commit 283f930
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 283f930

Please sign in to comment.