Skip to content
Snippets Groups Projects
Commit f6ddbb36 authored by Yin Huai's avatar Yin Huai
Browse files

[SPARK-12833][HOT-FIX] Reset the locale after we set it.

Author: Yin Huai <yhuai@databricks.com>

Closes #10778 from yhuai/resetLocale.
parent 5f843781
No related branches found
No related tags found
No related merge requests found
...@@ -90,9 +90,14 @@ class CSVTypeCastSuite extends SparkFunSuite { ...@@ -90,9 +90,14 @@ class CSVTypeCastSuite extends SparkFunSuite {
} }
test("Float and Double Types are cast correctly with Locale") { test("Float and Double Types are cast correctly with Locale") {
val locale : Locale = new Locale("fr", "FR") val originalLocale = Locale.getDefault
Locale.setDefault(locale) try {
assert(CSVTypeCast.castTo("1,00", FloatType) == 1.0) val locale : Locale = new Locale("fr", "FR")
assert(CSVTypeCast.castTo("1,00", DoubleType) == 1.0) Locale.setDefault(locale)
assert(CSVTypeCast.castTo("1,00", FloatType) == 1.0)
assert(CSVTypeCast.castTo("1,00", DoubleType) == 1.0)
} finally {
Locale.setDefault(originalLocale)
}
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment