Preserve every row in multi-file CSV responses - #577
Merged
Conversation
A file whose partition produces zero elements serializes to a bodiless CSV that pandas cannot parse, which failed the entire multi-file request. Such partitions now contribute no rows while every row from the remaining files is preserved.
CyMule
marked this pull request as ready for review
July 21, 2026 00:46
There was a problem hiding this comment.
No issues found across 4 files
Shadow auto-approve: would auto-approve. Fixes a bug in CSV multi-file output by replacing an outer merge with row concatenation, preserving all rows and removing the unnamed index column. Change is bounded, well-tested, and clearly beneficial.
Re-trigger cubic
paulkarayan
approved these changes
Jul 21, 2026
paulkarayan
left a comment
There was a problem hiding this comment.
nits:
- the CHANGELOG/description says results "union differing columns," but neither new test exercises files with different column sets. should be a quick llm addition
- line 753 item
paulkarayan
approved these changes
Jul 21, 2026
| if response.body.strip() | ||
| ] | ||
| if not frames: | ||
| return PlainTextResponse(responses[0].body) |
There was a problem hiding this comment.
nit:
do you need the response? PlainTextResponse("") seems like it would suit
…le-csv-rows # Conflicts: # CHANGELOG.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Why
CSV output for a multi-file request was built by outer-merging each file's
DataFrame into the previous one (
data.merge(resp_data, how="outer")). An outermerge joins on the intersection of columns, so identical rows across files
collapsed into a single row and legitimate duplicate rows were silently dropped
— most visibly when two uploads shared a filename. The merge also emitted the
row index as a leading unnamed column.
Impact
Multi-file CSV responses now retain every row from every file (including
duplicates and repeated filenames), union differing columns, and no longer
contain the extra unnamed index column. A file that produces no elements
contributes no rows rather than failing the whole request.
Validation
pytest test_general/api/test_app.py::test_output_format_csv_concatenates_multiple_files_without_index_column— 1 passedpytest test_general/api/test_app.py::test_output_format_csv_keeps_rows_when_one_file_has_no_elements— 1 passed