Github user chenghao-intel commented on a diff in the pull request: https://github.com/apache/spark/pull/8026#discussion_r42506907 --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/PartitioningUtils.scala --- @@ -236,15 +241,22 @@ private[sql] object PartitioningUtils { } /** - * Converts a string to a [[Literal]] with automatic type inference. Currently only supports - * [[IntegerType]], [[LongType]], [[DoubleType]], [[DecimalType.SYSTEM_DEFAULT]], and - * [[StringType]]. + * Converts a string to a [[Literal]] with automatic type inference if no field type specified. + * Auto inference only supports [[IntegerType]], [[LongType]], [[DoubleType]], + * [[DecimalType.SYSTEM_DEFAULT]], and [[StringType]]. */ private[sql] def inferPartitionColumnValue( + expectedDT: Option[DataType], --- End diff -- We need to pass the expect the data type down and then get the associated literal-based partition column value; and @liancheng's suggestion kind of like get the literal (maybe string based) first, and then do casting outside, however, this probably lose some data precision during the re-casting. For example: The path looks like, /part1=1.000, and with the auto inference, we will get a Double, and it will be cast to string as `1.0` if what user expect is StringType; However, this is totally different if we get it as StringType directly, which supposed to be `1.000`.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org