Skip to content
This repository was archived by the owner on Jan 9, 2020. It is now read-only.

Commit a1d98c6

Browse files
Gschiavonsrowen
authored andcommitted
[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 <[email protected]> Closes apache#19205 from Gschiavon/fix/test-locale.
1 parent dd88fa3 commit a1d98c6

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

core/src/main/scala/org/apache/spark/util/Utils.scala

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1193,16 +1193,17 @@ private[spark] object Utils extends Logging {
11931193
val second = 1000
11941194
val minute = 60 * second
11951195
val hour = 60 * minute
1196+
val locale = Locale.US
11961197

11971198
ms match {
11981199
case t if t < second =>
1199-
"%d ms".format(t)
1200+
"%d ms".formatLocal(locale, t)
12001201
case t if t < minute =>
1201-
"%.1f s".format(t.toFloat / second)
1202+
"%.1f s".formatLocal(locale, t.toFloat / second)
12021203
case t if t < hour =>
1203-
"%.1f m".format(t.toFloat / minute)
1204+
"%.1f m".formatLocal(locale, t.toFloat / minute)
12041205
case t =>
1205-
"%.2f h".format(t.toFloat / hour)
1206+
"%.2f h".formatLocal(locale, t.toFloat / hour)
12061207
}
12071208
}
12081209

0 commit comments

Comments
 (0)