-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-27512][SQL] Avoid to replace ',' in CSV's decimal type inference for backward compatibility #24437
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-27512][SQL] Avoid to replace ',' in CSV's decimal type inference for backward compatibility #24437
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -185,6 +185,8 @@ class CSVInferSchemaSuite extends SparkFunSuite with SQLHelper { | |
| assert(inferSchema.inferField(NullType, input) == expectedType) | ||
| } | ||
|
|
||
| Seq("en-US", "ko-KR", "ru-RU", "de-DE").foreach(checkDecimalInfer(_, DecimalType(7, 0))) | ||
| // input like '1,0' is inferred as strings for backward compatibility. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry I may not know all the context, but doesn't
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The field separator here is |
||
| Seq("en-US").foreach(checkDecimalInfer(_, StringType)) | ||
| Seq("ko-KR", "ru-RU", "de-DE").foreach(checkDecimalInfer(_, DecimalType(7, 0))) | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks slightly ugly that we handle special case of
Locale.USfor JSON inside ofExprUtils.getDecimalParserbut for CSV outside of it. Maybe we unify the implementation, and handle the special cases outside of generic implementationExprUtils.getDecimalParser(or process both special cases inside of it)?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes.. we gotta do that I think .. Let's do that later when we drop the replacement thing entirely. I realised that CSV inference path alone handles it without replacement.