wangyum commented on code in PR #36810: URL: https://github.com/apache/spark/pull/36810#discussion_r892980250
########## sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/PartitioningUtils.scala: ########## @@ -359,7 +359,12 @@ object PartitioningUtils extends SQLConfHelper{ def removeLeadingZerosFromNumberTypePartition(value: String, dataType: DataType): String = dataType match { case ByteType | ShortType | IntegerType | LongType | FloatType | DoubleType => - castPartValueToDesiredType(dataType, value, null).toString + val castedPartVal = castPartValueToDesiredType(dataType, value, null) + if (castedPartVal != null) { + castedPartVal.toString + } else { + null + } Review Comment: `Option(castPartValueToDesiredType(dataType, value, null)).map(_.toString).orNull`? -- 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. To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org