-
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-13509][SPARK-13507][SQL] Support for writing CSV with a single function call #11389
Closed
Closed
Changes from 2 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
a97a0a8
Support for writing CSV with a single function call
HyukjinKwon f82a2f4
Move the comments above for json.
HyukjinKwon 9fe8fca
Update comments and remove the supprot for `codec` for JSON and TEXT
HyukjinKwon c703def
Add Python API
HyukjinKwon 8efb0e3
Update upstream
HyukjinKwon 8fbad40
Add a newline at the end of the test file
HyukjinKwon 9ca920b
Update an weired indentation
HyukjinKwon fea9df8
Make path seq if it is an string
HyukjinKwon cec8442
Read without options
HyukjinKwon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -453,6 +453,12 @@ final class DataFrameWriter private[sql](df: DataFrame) { | |
* format("json").save(path) | ||
* }}} | ||
* | ||
* You can set the following JSON-specific options for writing JSON files: | ||
* <li>`compression` or `codec` (default `null`): compression codec to use when saving to file. | ||
* This should be the fully qualified name of a class implementing | ||
* [[org.apache.hadoop.io.compress.CompressionCodec]] or one of the known case-insensitive | ||
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. I'd remove the mention of org.apache.hadoop.io.compress.CompressionCodec The hadoop API is so difficult to use that I don't think it deserves to be user-facing here. It adds too much complexity to this end-user api. |
||
* shorten names(`bzip2`, `gzip`, `lz4`, and `snappy`). </li> | ||
* | ||
* @since 1.4.0 | ||
*/ | ||
def json(path: String): Unit = format("json").save(path) | ||
|
@@ -492,10 +498,33 @@ final class DataFrameWriter private[sql](df: DataFrame) { | |
* df.write().text("/path/to/output") | ||
* }}} | ||
* | ||
* You can set the following options for writing text files: | ||
* <li>`compression` or `codec` (default `null`): compression codec to use when saving to file. | ||
* This should be the fully qualified name of a class implementing | ||
* [[org.apache.hadoop.io.compress.CompressionCodec]] or one of the known case-insensitive | ||
* shorten names(`bzip2`, `gzip`, `lz4`, and `snappy`). </li> | ||
* | ||
* @since 1.6.0 | ||
*/ | ||
def text(path: String): Unit = format("text").save(path) | ||
|
||
/** | ||
* Saves the content of the [[DataFrame]] in CSV format at the specified path. | ||
* This is equivalent to: | ||
* {{{ | ||
* format("csv").save(path) | ||
* }}} | ||
* | ||
* You can set the following CSV-specific options for writing CSV files: | ||
* <li>`compression` or `codec` (default `null`): compression codec to use when saving to file. | ||
* This should be the fully qualified name of a class implementing | ||
* [[org.apache.hadoop.io.compress.CompressionCodec]] or one of the known case-insensitive | ||
* shorten names(`bzip2`, `gzip`, `lz4`, and `snappy`). </li> | ||
* | ||
* @since 2.0.0 | ||
*/ | ||
def csv(path: String): Unit = format("csv").save(path) | ||
|
||
/////////////////////////////////////////////////////////////////////////////////////// | ||
// Builder pattern config options | ||
/////////////////////////////////////////////////////////////////////////////////////// | ||
|
This file contains 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
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.
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.
just say compression, and don't mention codec.
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.
actually i'd remove codec support from the underlying source code, and only keep it for csv as an undocumented option for backward compatibility.