Skip to content

[format] Skip the CSV header only in the split that contains it - #9065

Open
thswlsqls wants to merge 1 commit into
apache:masterfrom
thswlsqls:fix/csv-header-skip-only-first-split
Open

[format] Skip the CSV header only in the split that contains it#9065
thswlsqls wants to merge 1 commit into
apache:masterfrom
thswlsqls:fix/csv-header-skip-only-first-split

Conversation

@thswlsqls

Copy link
Copy Markdown
Contributor

Purpose

fix #9063

  • CsvFileReader#setupReading skipped a line on every split, but the header only exists at byte 0, so a split with offset > 0 dropped its own first data row.
  • A header-bearing CSV larger than source.split.target-size lost one row per extra split.
  • The boundary record is already dropped by StandardLineReader#skipFirstLine and read in full by the previous split, so guarding on offset == 0 cannot duplicate rows and leaves the single-split path unchanged; a comment records this.

Tests

  • Added CsvFileFormatTest#testHeaderSkippedOnlyInFirstSplit: reads a 50-row file as two segments via createReader(context, offset, length) and asserts no row is lost or duplicated, with csv.include-header true and false. Fails on master (49 of 50 rows).
  • mvn -pl paimon-format -DfailIfNoTests=false clean install — 530 tests passed.
  • No existing test changes result: the existing read() helper only uses createReader(context).

CsvFileReader#setupReading skipped a line on every split, but the header
only exists at byte 0. Splits with a non-zero offset therefore dropped
their own first data row, so a header-bearing CSV larger than
source.split.target-size silently lost one row per extra split.

Generated-by: Claude Code
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.

[Bug] CSV reader skips a data row in every split after the first when csv.include-header is enabled

1 participant