Github user HyukjinKwon commented on a diff in the pull request:

    https://github.com/apache/spark/pull/14947#discussion_r78306768
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/PartitioningUtils.scala
 ---
    @@ -307,20 +308,34 @@ object PartitioningUtils {
     
       /**
        * Converts a string to a [[Literal]] with automatic type inference.  
Currently only supports
    -   * [[IntegerType]], [[LongType]], [[DoubleType]], 
[[DecimalType.SYSTEM_DEFAULT]], and
    -   * [[StringType]].
    +   * [[IntegerType]], [[LongType]], [[DoubleType]], 
[[DecimalType.SYSTEM_DEFAULT]], [[DateType]]
    +   * [[TimestampType]], and [[StringType]].
        */
       private[datasources] def inferPartitionColumnValue(
           raw: String,
           defaultPartitionName: String,
           typeInference: Boolean): Literal = {
    +    val decimalTry = Try {
    +      // `BigDecimal` conversion can fail when the `field` is not a form 
of number.
    +      val bigDecimal = new JBigDecimal(raw)
    +      // It reduces the cases for decimals by disallowing values having 
scale (eg. `1.1`).
    +      require(bigDecimal.scale <= 0)
    +      // `DecimalType` conversion can fail when
    +      //   1. The precision is bigger than 38.
    +      //   2. scale is bigger than precision.
    --- End diff --
    
    Checked and I added some more end-to-end tests.


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to