You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2022/06/09 00:54:16 UTC
[GitHub] [spark] wangyum commented on a diff in pull request #36810: [SPARK-39417][SQL] Handle Null partition values in PartitioningUtils
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-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org