You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by yh...@apache.org on 2016/01/16 01:03:10 UTC

spark git commit: [SPARK-12833][HOT-FIX] Reset the locale after we set it.

Repository: spark
Updated Branches:
  refs/heads/master 5f843781e -> f6ddbb360


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

Author: Yin Huai <yh...@databricks.com>

Closes #10778 from yhuai/resetLocale.


Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/f6ddbb36
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/f6ddbb36
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/f6ddbb36

Branch: refs/heads/master
Commit: f6ddbb360ac6ac2778bbdbebbf2fcccabe73349b
Parents: 5f84378
Author: Yin Huai <yh...@databricks.com>
Authored: Fri Jan 15 16:03:05 2016 -0800
Committer: Yin Huai <yh...@databricks.com>
Committed: Fri Jan 15 16:03:05 2016 -0800

----------------------------------------------------------------------
 .../execution/datasources/csv/CSVTypeCastSuite.scala   | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/f6ddbb36/sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/csv/CSVTypeCastSuite.scala
----------------------------------------------------------------------
diff --git a/sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/csv/CSVTypeCastSuite.scala b/sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/csv/CSVTypeCastSuite.scala
index 40c5ccd..c28a250 100644
--- a/sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/csv/CSVTypeCastSuite.scala
+++ b/sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/csv/CSVTypeCastSuite.scala
@@ -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)
+    }
   }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org