srowen commented on a change in pull request #33291:
URL: https://github.com/apache/spark/pull/33291#discussion_r667923793



##########
File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/PartitioningUtils.scala
##########
@@ -351,10 +351,24 @@ object PartitioningUtils {
    */
   def getPathFragment(spec: TablePartitionSpec, partitionSchema: StructType): 
String = {
     partitionSchema.map { field =>
-      escapePathName(field.name) + "=" + 
getPartitionValueString(spec(field.name))
+      escapePathName(field.name) + "=" +
+        getPartitionValueString(
+          removeLeadingZerosFromNumberTypePartition(spec(field.name), 
field.dataType))
     }.mkString("/")
   }
 
+  def removeLeadingZerosFromNumberTypePartition(value: String, dataType: 
DataType): String = {
+    dataType match {
+      case ByteType => value.toByte.toString

Review comment:
       Would it not be sufficient to call .toLong.toString for any integer 
type? might be simpler.
   Also, would float/double ever be used as a partition key?




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

Reply via email to