Uh oh!
There was an error while loading. Please reload this page.
[SPARK-23724][SPARK-23765][SQL] Line separator for the json datasource - #20885
Closed
MaxGekk wants to merge 22 commits into
Closed
[SPARK-23724][SPARK-23765][SQL] Line separator for the json datasource#20885MaxGekk wants to merge 22 commits into
MaxGekk wants to merge 22 commits into
Conversation
… sequence of bytes in hex like x0d 0a
SparkQA
commented
Mar 22, 2018
Test build #88529 has finished for PR 20885 at commit
|
# Conflicts: # python/pyspark/sql/tests.py # sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/HadoopFileLinesReader.scala # sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/text/TextFileFormat.scala # sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/text/TextOptions.scala
SparkQA
commented
Mar 22, 2018
Test build #88531 has finished for PR 20885 at commit
|
SparkQA
commented
Mar 22, 2018
Test build #88532 has finished for PR 20885 at commit
|
SparkQA
commented
Mar 23, 2018
Test build #88539 has finished for PR 20885 at commit
|
HyukjinKwon
commented
Mar 23, 2018
Member
@cloud-fan and @hvanhovell. Do you think we need the flexible option for line separator? |
SparkQA
commented
Mar 23, 2018
Test build #88540 has finished for PR 20885 at commit
|
| This applies to timestamp type. If None is set, it uses the | ||
| default value, ``yyyy-MM-dd'T'HH:mm:ss.SSSXXX``. | ||
| :param lineSep: defines the line separator that should be used for writing. If None is | ||
| set, it uses the default value, ``\\n``. |
Contributor
There was a problem hiding this comment.
it covers all ``\\r``, ``\\r\\n`` and ``\\n``.
MemberAuthor
There was a problem hiding this comment.
It is a method of DataFrameWriter. It writes exactly '\n'
| /** | ||
| * A sequence of bytes between two consecutive json records. Format of the option is: | ||
| * selector (1 char) + delimiter body (any length) | sequence of chars |
Contributor
There was a problem hiding this comment.
I'm afraid of defining our own rule here, is there any standard we can follow?
| allowNumericLeadingZero=None, allowBackslashEscapingAnyCharacter=None, | ||
| mode=None, columnNameOfCorruptRecord=None, dateFormat=None, timestampFormat=None, | ||
| multiLine=None, allowUnquotedControlChars=None): | ||
| multiLine=None, allowUnquotedControlChars=None, lineSep=None): |
| val multiLine = parameters.get("multiLine").map(_.toBoolean).getOrElse(false) | ||
| val charset: Option[String] = Some("UTF-8") |
MaxGekk
commented
Mar 29, 2018
MemberAuthor
Please, look at #20937 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
Currently, TextInputJsonDataSource uses HadoopFileLinesReader to split json file to separate lines. The former one splits json lines by LineRecordReader without providing recordDelimiter. As a consequence of that, the hadoop library reads lines terminated by one of CR, LF, or CRLF. The changes allow to specify the line separator instead of using the auto detection method of hadoop library. If the separator is not specified, the line separation method of Hadoop is used by default.
How was this patch tested?
Added new tests for writing/reading json files with custom line separator