GitHub user HyukjinKwon opened a pull request: https://github.com/apache/spark/pull/13809
[SPARK-16104][SQL] Do not creaate CSV writer object for every flush when writing ## What changes were proposed in this pull request? This PR let `CsvWriter` object is not created for each time but able to be reused. This way was taken after from JSON data source. Original `CsvWriter` was being created for each row but it was enhanced in https://github.com/apache/spark/pull/13229. However, it still creates `CsvWriter` object for each `flush()` in `LineCsvWriter`. It seems it does not have to close the object and re-create every flush. It follows the original logic as it is but `CsvWriter` is reused by reseting `CharArrayWriter`. ## How was this patch tested? Existing tests should cover this. You can merge this pull request into a Git repository by running: $ git pull https://github.com/HyukjinKwon/spark write-perf Alternatively you can review and apply these changes as the patch at: https://github.com/apache/spark/pull/13809.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #13809 ---- commit a62a26fe52fedcdb98e4a9d8cd258681f81b6864 Author: hyukjinkwon <gurwls...@gmail.com> Date: 2016-06-21T12:34:32Z Do not creaate CSV writer object for every flush when writing ---- --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org