Skip to content

Commit

Permalink
[SPARK-12833][HOT-FIX] Reset the locale after we set it.
Browse files Browse the repository at this point in the history
Author: Yin Huai <[email protected]>

Closes apache#10778 from yhuai/resetLocale.
  • Loading branch information
yhuai committed Jan 16, 2016
1 parent 5f84378 commit f6ddbb3
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,14 @@ class CSVTypeCastSuite extends SparkFunSuite {
}

test("Float and Double Types are cast correctly with Locale") {
val locale : Locale = new Locale("fr", "FR")
Locale.setDefault(locale)
assert(CSVTypeCast.castTo("1,00", FloatType) == 1.0)
assert(CSVTypeCast.castTo("1,00", DoubleType) == 1.0)
val originalLocale = Locale.getDefault
try {
val locale : Locale = new Locale("fr", "FR")
Locale.setDefault(locale)
assert(CSVTypeCast.castTo("1,00", FloatType) == 1.0)
assert(CSVTypeCast.castTo("1,00", DoubleType) == 1.0)
} finally {
Locale.setDefault(originalLocale)
}
}
}

0 comments on commit f6ddbb3

Please sign in to comment.