GitHub user HyukjinKwon opened a pull request:
https://github.com/apache/spark/pull/12268
[SPARK-14480][SQL] Simplify CSV parsing process with a better performance
## What changes were proposed in this pull request?
https://issues.apache.org/jira/browse/SPARK-14480
In `CSVParser.scala`, there is an `Reader` wrapping `Iterator` but there
are two problems by this.
Firstly, it was actually not faster than processing line by line with
Iterator due to additional logics to wrap `Iterator` to `Reader`.
Secondly, this brought a bit of complexity because it needs additional
logics to allow every line to be read bytes by bytes. So, it was pretty
difficult to figure out issues about parsing, (eg. SPARK-14103).
This PR removes classes `CSVParser` and introduces new classes
`UnivocityParser`, `UnivocityGenerator` and `CSVUtils` to be consistent with
JSON data source (`JacksonParser`, `JacksonGenerator` and `JacksonUtils`).
Also, `DefaultSource` moves to `CSVRelation` just like `JSONRelation`.
To cut in short, this PR includes two changes,
- Parse CSV data with `Iterator` not `Reader`.
- Refactor CSV data source to be consistent with JSON data source.
## 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 SPARK-14480
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/12268.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 #12268
----
commit 0eff7e7ccf9c8298f0969b28e87532b70ddafc2e
Author: hyukjinkwon <[email protected]>
Date: 2016-04-09T03:27:13Z
Simplify CSV parsing process with a better performance
commit b5a966962845011d6d56bb45d704d83eb5e06e38
Author: hyukjinkwon <[email protected]>
Date: 2016-04-09T03:36:17Z
Remove unintentionally added test codes
----
---
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 [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]