cloud-fan commented on a change in pull request #31549:
URL: https://github.com/apache/spark/pull/31549#discussion_r578402913



##########
File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/PartitioningUtils.scala
##########
@@ -189,8 +192,18 @@ object PartitioningUtils {
 
       // Finally, we create `Partition`s based on paths and resolved partition 
values.
       val partitions = 
resolvedPartitionValues.zip(pathsWithPartitionValues).map {
-        case (PartitionValues(_, literals), (path, _)) =>
-          PartitionPath(InternalRow.fromSeq(literals.map(_.value)), path)
+        case (PartitionValues(columnNames, typedValues), (path, _)) =>
+          val rowValues = columnNames.zip(typedValues).map { case (columnName, 
typedValue) =>
+            try {
+              castPartValueToDesiredType(typedValue.dataType, 
typedValue.value, zoneId)
+            } catch {
+              case NonFatal(_) if validatePartitionColumns =>
+                throw new RuntimeException(s"Failed to cast value 
`${typedValue.value}` to " +
+                  s"`${typedValue.dataType}` for partition column 
`$columnName`")
+              case _ : Throwable => null

Review comment:
       shall we catch `NonFatal(_)`?




----------------------------------------------------------------
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]

Reply via email to