-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-25514][SQL] Generating pretty JSON by to_json #22534
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
Changes from 3 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 |
|---|---|---|
|
|
@@ -113,6 +113,11 @@ private[sql] class JSONOptions( | |
| } | ||
| val lineSeparatorInWrite: String = lineSeparator.getOrElse("\n") | ||
|
|
||
| /** | ||
| * Generating JSON strings in pretty representation if the parameter enabled. | ||
|
||
| */ | ||
| val pretty: Boolean = parameters.get("pretty").map(_.toBoolean).getOrElse(false) | ||
|
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. hm .. so now finally this became an actual problem. This is specifically for JSON functions and documented nowhere. Can we deal with this problem? |
||
|
|
||
| /** Sets config options on a Jackson [[JsonFactory]]. */ | ||
| def setJacksonOptions(factory: JsonFactory): Unit = { | ||
| factory.configure(JsonParser.Feature.ALLOW_COMMENTS, allowComments) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3619,6 +3619,8 @@ object functions { | |
| * @param e a column containing a struct, an array or a map. | ||
| * @param options options to control how the struct column is converted into a json string. | ||
| * accepts the same options and the json data source. | ||
| * Additionally the function supports the `pretty` option which enables | ||
| * pretty JSON generation. | ||
| * | ||
| * @group collection_funcs | ||
| * @since 2.1.0 | ||
|
|
@@ -3635,6 +3637,8 @@ object functions { | |
| * @param e a column containing a struct, an array or a map. | ||
| * @param options options to control how the struct column is converted into a json string. | ||
| * accepts the same options and the json data source. | ||
| * Additionally the function supports the `pretty` option which enables | ||
|
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. For clarification, we don't support this in JSON datasource officially since it's not documented. |
||
| * pretty JSON generation. | ||
| * | ||
| * @group collection_funcs | ||
| * @since 2.1.0 | ||
|
|
||
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.
nit: I would say
\code{pretty}