-
Notifications
You must be signed in to change notification settings - Fork 4.3k
GH-50925: [C++] Allow CSV reader to pad rows with missing trailing fields #50926
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
base: main
Are you sure you want to change the base?
Changes from all 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 |
|---|---|---|
|
|
@@ -61,6 +61,8 @@ struct ARROW_EXPORT ParseOptions { | |
| bool ignore_empty_lines = true; | ||
| /// A handler function for rows which do not have the correct number of columns | ||
| InvalidRowHandler invalid_row_handler; | ||
| /// Whether rows with fewer columns than expected are padded with nulls. | ||
| bool pad_short_rows = 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. PyArrow's ParseOptions does not expose this new option (constructor/property, pickle/equality, and Cython declaration). If PyArrow should support it, please add the binding and tests.
Contributor
Author
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. I feel that Python's functional support is a subset of C++'s. I didn't break the compilation of the Python code. If anyone needs this functionality, they can add the binding. |
||
|
|
||
| /// Create parsing options with default values | ||
| static ParseOptions Defaults(); | ||
|
|
||
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.
This can freeze an all-missing first block as a null-typed column in StreamingReader. If a later block contains a value, the frozen NullConverter rejects it. I'm not sure if this is a blocker but it seems to be better than before?
Uh oh!
There was an error while loading. Please reload this page.
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.
I think this is in line with expectations. The data size used for schema inference can be adjusted via the
block_sizeoption inReadOptions(though the data size used for schema inference is not exactly the same asblock_size, as there are several branching conditions involved).