-
Notifications
You must be signed in to change notification settings - Fork 28.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SPARK-18076][CORE][SQL] Fix default Locale used in DateFormat, NumberFormat to Locale.US #15610
Conversation
CC @HyukjinKwon |
Test build #67453 has finished for PR 15610 at commit
|
I support this PR in general. Let also me try to help verify this with some comments within a couple of coming days (I have been testing related ones too). |
@srowen, It seems we should fix
Also, IMHO, it seems okay to change the failed test test("Float and Double Types are cast correctly with Locale") {
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 test("Float and Double Types are cast correctly with US Locale") {
val originalLocale = Locale.getDefault
try {
val locale : Locale = new Locale("fr", "FR")
Locale.setDefault(locale)
assert(CSVTypeCast.castTo("1,00", FloatType) == 100.0)
assert(CSVTypeCast.castTo("1,00", DoubleType) == 100.0)
} finally {
Locale.setDefault(originalLocale)
}
} in order to test if setting other locales does not affect the converted results as this PR proposes the fixed locale. One concern about this is to not consider the default locale in JVM for parsing CSV and JSON but I think we might be able to introduce another option to set the locale if this is problematic (with default value |
Test build #67508 has finished for PR 15610 at commit
|
Merged to master/2.1. I think this is important as a fix though bears noting the change in release notes. I tagged the JIRA. |
…rFormat to Locale.US ## What changes were proposed in this pull request? Fix `Locale.US` for all usages of `DateFormat`, `NumberFormat` ## How was this patch tested? Existing tests. Author: Sean Owen <[email protected]> Closes #15610 from srowen/SPARK-18076. (cherry picked from commit 9c8deef) Signed-off-by: Sean Owen <[email protected]>
…rFormat to Locale.US ## What changes were proposed in this pull request? Fix `Locale.US` for all usages of `DateFormat`, `NumberFormat` ## How was this patch tested? Existing tests. Author: Sean Owen <[email protected]> Closes apache#15610 from srowen/SPARK-18076.
What changes were proposed in this pull request?
Fix
Locale.US
for all usages ofDateFormat
,NumberFormat
How was this patch tested?
Existing tests.