Skip to content

DatasetReader: a cut-off last row reads as the end of the dataset; limits differ from protowire-go #45

Closed

Description

@bfrancojr

pxf.DatasetReader doesn't match protowire-go's streaming reader. The worst case: a dataset whose last row was cut off reads as a shorter, complete dataset, with no error.

Measured (main df004ec, protowire-cpp v2.0.0)

The spec's testdata/dataset fixtures through DatasetReader.from_bytes(...).scan(...), schema test.v1.AllTypes:

Fixture Spec / Go streaming Python streaming Python unmarshal_full
truncated-row-eof.pxf reject 1 row, then scan returns False reject
truncated-row-then-rows.pxf reject 1 row, then False reject
junk-between-rows.pxf reject 1 row, then False reject
rows-end-at-directive.pxf accept, 2 rows 2 rows accept

Causes

  1. protowire-cpp's reader (DatasetReader: a cut-off row ends the stream silently, and its limits differ from protowire-go's protowire-cpp#164): it ends the stream at a broken row instead of failing, holds bytes while seeking a row's end with no MaxMessageSize cap, and parses rows without MaxBytesLiteralLength (DatasetReader ignores UnmarshalOptions::max_bytes_literal_length when it parses a row protowire-cpp#160, pinned here as an xfail).
  2. This port's scan passes max_message_size to bind_row for every row. Go binds a row "under every limit but MaxMessageSize", because the synthetic body repeats the column names and is wider than the row. This half can be fixed here. It belongs with pxf.bind_row promises (pxf.default) and (pxf.required) but applies neither #24, which decides how bind_row binds (its own code or cpp's BindRow).

Done when

  • The four fixtures above give Go's verdicts through DatasetReader, with a test that runs them (after protowire-cpp#164 is fixed and the pin moves).
  • scan doesn't apply max_message_size to the bound row, with a test.

Blocked by trendvidia/protowire-cpp#164 for the first item.

Activity

  1. bfrancojr commented on Nov 7, 2026

    @bfrancojr
    CollaboratorAuthor

    The protowire-cpp half of this is fixed on cpp's main. It is not in a cpp release yet; v2.0.0 predates it.

    Evidence on cpp: test/pxf_corpus_test.cc streams every spec dataset fixture through DatasetReader and requires the same verdict and error as Parse. truncated-row-eof, truncated-row-then-rows and junk-between-rows are now refused there. DatasetReaderEnds.MatchProtowireGo checks 590 cut points against a table generated from protowire-go v1.16.1.

    What is left here:

    • Move the cpp pin once a release carries #167, then run the four fixtures through DatasetReader.from_bytes(...).scan(...) and drop the #160 xfail.
    • The scan half (not applying max_message_size to the bound row) is still this port's to fix. That is unchanged.
  2. bfrancojr commented on Nov 7, 2026

    @bfrancojr
    CollaboratorAuthor

    protowire-cpp v2.1.0 is released (tag v2.1.0 → a4977b2) and carries trendvidia/protowire-cpp#167 (#164), #162 (#160) and the rest of the DatasetReader fixes. The first item here can go ahead now: move the cpp pin to v2.1.0, run the four fixtures through DatasetReader.from_bytes(...).scan(...), and drop the #160 xfail. The scan half is unchanged and still this port's to fix.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions