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

    https://github.com/apache/spark/pull/18532#discussion_r125763819
  
    --- Diff: 
sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/csv/UnivocityParserSuite.scala
 ---
    @@ -130,17 +130,17 @@ class UnivocityParserSuite extends SparkFunSuite {
           
DateTimeUtils.millisToDays(DateTimeUtils.stringToTime("2015-01-01").getTime))
       }
     
    -  test("Float and Double Types are cast without respect to platform 
default Locale") {
    -    val originalLocale = Locale.getDefault
    -    try {
    -      Locale.setDefault(new Locale("fr", "FR"))
    -      // Would parse as 1.0 in fr-FR
    -      val options = new CSVOptions(Map.empty[String, String], "GMT")
    -      assert(parser.makeConverter("_1", FloatType, options = 
options).apply("1,00") == 100.0)
    -      assert(parser.makeConverter("_1", DoubleType, options = 
options).apply("1,00") == 100.0)
    -    } finally {
    -      Locale.setDefault(originalLocale)
    -    }
    +  test("Throws exception for casting an invalid string to Float and Double 
Types") {
    +    val options = new CSVOptions(Map.empty[String, String], "GMT")
    +    var message = intercept[NumberFormatException] {
    +      parser.makeConverter("_1", FloatType, options = 
options).apply("10u000")
    +    }.getMessage
    +    assert(message.contains("10u000"))
    +
    +    message = intercept[NumberFormatException] {
    +      parser.makeConverter("_1", DoubleType, options = 
options).apply("10u000")
    +    }.getMessage
    +    assert(message.contains("10u000"))
    --- End diff --
    
    dito


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