Skip to content

Add header to unpartitioned CSV output - #560

Closed
dajiaohuang wants to merge 1 commit into
archivesunleashed:mainfrom
dajiaohuang:fix-csv-header-without-partition
Closed

dajiaohuang wants to merge 1 commit into
archivesunleashed:mainfrom
dajiaohuang:fix-csv-header-without-partition

Conversation

@dajiaohuang

Copy link
Copy Markdown

GitHub issue(s): None; no issue in the frozen review window describes this behavior.

What does this Pull Request do?

saveCsv enabled CSV headers only when --partition was supplied. Without partitioning, Spark's CSV writer default omitted the header, so the first output row was data rather than column names. This adds the same header=true option to the unpartitioned path.

How should this be tested?

Run mvn -B -V -Dtest=CommandLineAppCsvHeaderTest test. The new test creates a tiny synthetic WARC response and checks that both partitioned and unpartitioned CLI CSV output contains the schema header and record.

The full mvn install suite was not run: this task was constrained to synthetic archive fixtures, while the repository's existing test resources include bundled WARC datasets.

Additional Notes

No new dependencies or documentation changes.

Interested parties

None.

@ruebot

ruebot commented Oct 28, 2026

Copy link
Copy Markdown
Member

@dajiaohuang this design was purposeful. --partition 1 gives you one CSV file, and it gets a header. If you don't supply --partition it gives you many part-* files with no headers, so cat part-* > all.csv produces a clean file. But, if this is merged, each of those part files would have the headers in them, and if you cat them all together you'll have header rows spread throughout the combined csv.

@dajiaohuang

Copy link
Copy Markdown
Author

Thanks for explaining the intended multi-part CSV behavior. I overlooked that the unpartitioned writer produces multiple part files that users concatenate; enabling headers there would repeat header rows and break that workflow. This change is incompatible with the intended output contract, so I am withdrawing and closing PR #560 rather than ask maintainers to resolve it. No further action is needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants