Uh oh!
There was an error while loading. Please reload this page.
ARROW-11119: [Rust] Expose functions to parse a single CSV column / StringRecord into an array / recordBatch - #9084
ARROW-11119: [Rust] Expose functions to parse a single CSV column / StringRecord into an array / recordBatch#9084jorgecarleitao wants to merge 1 commit into
Conversation
codecov-io
commented
Jan 3, 2021
Codecov Report
Continue to review full report at Codecov.
|
This looks cool @jorgecarleitao ! Some thoughts for the future of csv /other parsers:
|
| /// This function errors iff: | ||
| /// * _any_ entry from `rows` at `column_index` cannot be parsed into the DataType. | ||
| /// * The [array::datatypes::DataType] is not supported. | ||
| pub fn build_array( |
There was a problem hiding this comment.
The downside is that this creates a dependency on StringRecord in the public API, making it harder to remove it when we want?
| let projection: Vec<usize> = match projection { | ||
| Some(ref v) => v.clone(), | ||
| None => fields.iter().enumerate().map(|(i, _)| i).collect(), | ||
| None => (0..fields.len()).collect(), |
There was a problem hiding this comment.
👍 I think the v.clone() could maybe even be removed?
alamb
commented
Jan 19, 2021
Given the age of this PR I think we should rebase it against latest master prior to merging it in |
Dandandan
commented
Jan 19, 2021
Do you still want to move this in @jorgecarleitao ?
|
jorgecarleitao
commented
Jan 20, 2021
@Dandandan , you have a good point, and since you are working on the cast for this, I would also prefer to wait and see the result of that before committing to the |
alamb
commented
Feb 13, 2021
What is the status of this PR? As part of trying to clean up the backlog of Rust PRs in this repo, I am going through seemingly stale PRs and pinging the authors to see if there are any plans to continue the work or conversation. |
This PR exposes two new functions:
[StringRecord]) andStringRecord.The motivation for the first function is that parsing arrays is trivially parallelizable. Thus, people may want to use e.g
rayonto iterate in parallel over fields to build each array. IMOarrowcrate should not make any assumption about how people want to parallelize this, and only offer the functionality to do it, in the same way we do it with kernels.The motivation for the second function stems from the fact that parsing (not the IO reading) is the slowest operation in reading a CSV and people may want to iterate over the CSV differently. The main use-case here is to split the read of a single CSV file in multiple parts (using
seek), and returning record batches (DataFusion is the example here) in parallel. Again, IMO the arrow crate should not make assumptions about how to perform this work, and instead offer the necessary CPU-blocking core functionality for users to build on top of.The latter function is just a utility of the former function on which no parallelism is used (arrays are built in sequence).