Repository: spark
Updated Branches:
  refs/heads/master dd88fa3d3 -> a1d98c6dc


[SPARK-21982] Set locale to US

## What changes were proposed in this pull request?

In UtilsSuite Locale was set by default to US, but at the moment of using 
format function it wasn't, taking by default JVM locale which could be 
different than US making this test fail.

## How was this patch tested?
Unit test (UtilsSuite)

Author: German Schiavon <germanschia...@gmail.com>

Closes #19205 from Gschiavon/fix/test-locale.


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

Branch: refs/heads/master
Commit: a1d98c6dcdf387121139d1566f5b1924e2a02a75
Parents: dd88fa3
Author: German Schiavon <germanschia...@gmail.com>
Authored: Wed Sep 13 09:52:45 2017 +0100
Committer: Sean Owen <so...@cloudera.com>
Committed: Wed Sep 13 09:52:45 2017 +0100

----------------------------------------------------------------------
 core/src/main/scala/org/apache/spark/util/Utils.scala | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/a1d98c6d/core/src/main/scala/org/apache/spark/util/Utils.scala
----------------------------------------------------------------------
diff --git a/core/src/main/scala/org/apache/spark/util/Utils.scala 
b/core/src/main/scala/org/apache/spark/util/Utils.scala
index 1e8250f..bc08808 100644
--- a/core/src/main/scala/org/apache/spark/util/Utils.scala
+++ b/core/src/main/scala/org/apache/spark/util/Utils.scala
@@ -1193,16 +1193,17 @@ private[spark] object Utils extends Logging {
     val second = 1000
     val minute = 60 * second
     val hour = 60 * minute
+    val locale = Locale.US
 
     ms match {
       case t if t < second =>
-        "%d ms".format(t)
+        "%d ms".formatLocal(locale, t)
       case t if t < minute =>
-        "%.1f s".format(t.toFloat / second)
+        "%.1f s".formatLocal(locale, t.toFloat / second)
       case t if t < hour =>
-        "%.1f m".format(t.toFloat / minute)
+        "%.1f m".formatLocal(locale, t.toFloat / minute)
       case t =>
-        "%.2f h".format(t.toFloat / hour)
+        "%.2f h".formatLocal(locale, t.toFloat / hour)
     }
   }
 


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

Reply via email to