-
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-5683] [SQL] Avoid multiple json generator created #4468
Conversation
Test build #27092 has started for PR 4468 at commit
|
ebeb0b3
to
aeb7801
Compare
Test build #27093 has started for PR 4468 at commit
|
Test build #27092 has finished for PR 4468 at commit
|
Test PASSed. |
Test build #27093 has finished for PR 4468 at commit
|
Test PASSed. |
iter.map(JsonRDD.rowToJSON(rowSchema, jsonFactory)) | ||
val writer = new CharArrayWriter() | ||
// create the Generator without separator inserted between 2 records | ||
val gen = new JsonFactory().createGenerator(writer).setRootValueSeparator(null) |
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.
Should we expect any test result change after using setRootValueSeparator(null)
?
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.
A
(single space) will be inserted between 2 json records (in string) by default;
Previously, we create thegenerator
object for each of record in serialization, hence it's OK with default object separator.
However, in this PR, we are trying to using a singlegenerator
for all of the records, that's why we need to set it as null, which means nothing will be inserted between records.
@chenghao-intel Thank you for the PR. It will be great if you can also attach some performance results. |
@yhuai, thanks for reviewing, in a local testing, it shows about 10-15% performance gain. |
LGTM |
@marmbrus any more comment on this? |
Author: Cheng Hao <[email protected]> Closes #4468 from chenghao-intel/json and squashes the following commits: aeb7801 [Cheng Hao] avoid multiple json generator created (cherry picked from commit a60aea8) Signed-off-by: Michael Armbrust <[email protected]>
Thanks, merged to master and 1.3 |
No description provided.