MaxGekk commented on a change in pull request #30904:
URL: https://github.com/apache/spark/pull/30904#discussion_r547871911
##########
File path:
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/ShowPartitionsExec.scala
##########
@@ -53,9 +53,12 @@ case class ShowPartitionsExec(
var i = 0
while (i < len) {
val dataType = schema(i).dataType
- val partValue = row.get(i, dataType)
- val partValueStr = Cast(Literal(partValue, dataType), StringType,
Some(timeZoneId))
- .eval().toString
+ val partValueStr = if (row.isNullAt(i)) {
+ "null"
+ } else {
+ Cast(Literal(row.get(i, dataType), dataType), StringType,
Some(timeZoneId))
+ .eval().toString
Review comment:
Actually, NPE occurs on `null.toString`. I am thinking of the case when
`Cast(Literal(row.get(i, dataType), dataType), StringType,
Some(timeZoneId)).eval()` returns `null` for non-null input. Maybe it is better
to check the result of `eval()`, so, it should be much more reliable fix.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]