Uh oh!
There was an error while loading. Please reload this page.
[SPARK-25945][SQL] Support locale while parsing date/timestamp from CSV/JSON - #22951
[SPARK-25945][SQL] Support locale while parsing date/timestamp from CSV/JSON#22951MaxGekk wants to merge 12 commits into
Conversation
MaxGekk
commented
Nov 5, 2018
I will update docs soon. |
SparkQA
commented
Nov 5, 2018
Test build #98489 has finished for PR 22951 at commit
|
MaxGekk
commented
Nov 6, 2018
@HyukjinKwon@dongjoon-hyun Please, review the changes. |
SparkQA
commented
Nov 6, 2018
Test build #98507 has finished for PR 22951 at commit
|
HyukjinKwon
commented
Nov 7, 2018
Looks good. I or someone else should take a closer look before getting this in. |
dongjoon-hyun
commented
Nov 7, 2018
Could you rebase this once again, @MaxGekk ? |
# Conflicts: # sql/core/src/test/scala/org/apache/spark/sql/CsvFunctionsSuite.scala
SparkQA
commented
Nov 7, 2018
Test build #98541 has finished for PR 22951 at commit
|
HyukjinKwon
commented
Nov 7, 2018
retest this please |
SparkQA
commented
Nov 7, 2018
Test build #98543 has finished for PR 22951 at commit
|
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
SparkQA
commented
Nov 7, 2018
Test build #98567 has finished for PR 22951 at commit
|
dongjoon-hyun
commented
Nov 8, 2018
Could you take a look once more, @HyukjinKwon ? |
HyukjinKwon
commented
Nov 8, 2018
OMG, what does |
| the default value, empty string. | ||
| :param locale: sets a locale as language tag in IETF BCP 47 format. If None is set, | ||
| it uses the default value, ``en-US``. For instance, ``locale`` is used while | ||
| parsing dates and timestamps. |
There was a problem hiding this comment.
I think ideally we should apply to decimal parsing too actually. But yea we can leave it separate.
There was a problem hiding this comment.
It seems parsing decimals using locale will be slightly tricky in JSON case because we leave this to Jackson by calling its method getCurrentToken and getDecimalValue, and I haven't found how to pass locale to it. Probably we will need a custom deserialiser?
In the CSV case, it should be easier since we convert strings ourselves. I will try to do that for CSV first of all when this PR be merged.
There was a problem hiding this comment.
Here is the PR for parsing decimals from CSV: #22979
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| maxCharsPerColumn=None, maxMalformedLogPerPartition=None, mode=None, | ||
| columnNameOfCorruptRecord=None, multiLine=None, charToEscapeQuoteEscaping=None, | ||
| samplingRatio=None, enforceSchema=None, emptyValue=None): | ||
| samplingRatio=None, enforceSchema=None, emptyValue=None, locale=None): |
There was a problem hiding this comment.
Let's add emptyValue in streaming.py in the same separate PR.
There was a problem hiding this comment.
It seems it exists in streaming.py:
spark/python/pyspark/sql/streaming.py
Line 567 in 08c76b5
MaxGekk
commented
Nov 8, 2018
It is 3 letters prefix of |
# Conflicts: # sql/core/src/test/scala/org/apache/spark/sql/CsvFunctionsSuite.scala # sql/core/src/test/scala/org/apache/spark/sql/JsonFunctionsSuite.scala
SparkQA
commented
Nov 8, 2018
Test build #98583 has finished for PR 22951 at commit
|
MaxGekk
commented
Nov 8, 2018
jenkins, retest this, please |
SparkQA
commented
Nov 8, 2018
Test build #98587 has finished for PR 22951 at commit
|
MaxGekk
commented
Nov 8, 2018
jenkins, retest this, please |
SparkQA
commented
Nov 8, 2018
Test build #98591 has finished for PR 22951 at commit
|
HyukjinKwon
commented
Nov 8, 2018
retest this please |
SparkQA
commented
Nov 8, 2018
Test build #98598 has finished for PR 22951 at commit
|
HyukjinKwon
commented
Nov 9, 2018
Merged to master. |
HyukjinKwon
commented
Nov 9, 2018
Actually let me leave a cc for @srowen. I remember we talked about it before. |
…SV/JSON ## What changes were proposed in this pull request? In the PR, I propose to add new option `locale` into CSVOptions/JSONOptions to make parsing date/timestamps in local languages possible. Currently the locale is hard coded to `Locale.US`. ## How was this patch tested? Added two tests for parsing a date from CSV/JSON - `ноя 2018`. Closesapache#22951 from MaxGekk/locale. Authored-by: Maxim Gekk <max.gekk@gmail.com> Signed-off-by: hyukjinkwon <gurwls223@apache.org>
What changes were proposed in this pull request?
In the PR, I propose to add new option
localeinto CSVOptions/JSONOptions to make parsing date/timestamps in local languages possible. Currently the locale is hard coded toLocale.US.How was this patch tested?
Added two tests for parsing a date from CSV/JSON -
ноя 2018.