Skip to content

pxf: Scan's options pinned per option; validator and schema errors carry no row position (#166) - #174

Merged
trendvidia merged 1 commit into
mainfrom
dataset-scan-options-166
Nov 7, 2026
Merged

trendvidia merged 1 commit into
mainfrom
dataset-scan-options-166

Conversation

@bfrancojr

@bfrancojr bfrancojr commented Nov 7, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #166.

You decided #166 as option 2: DatasetReader::Scan keeps honouring the caller's options, and protowire-go changes to match (trendvidia/protowire-go#280, PR trendvidia/protowire-go#281). So cpp's behaviour stays. This PR adds the tests and the header line from the done-when, plus one text fix that came out of measuring the two ports side by side.

The text fix

A validator's refusal or a schema violation was reported with the row's position in front: 2:1: check: id: denied (...), 2:1: PXF schema violations: .... Go returns both as they are, because its atRow moves only a decode error to the row. cpp's AtRow moved every error. Now:

  • BindCheckedRow runs the schema check before the decode and the validator after it, and returns their errors unchanged. opts.report still gets the report.
  • A hook's error from on_secret_field is a decode error. It keeps the row's position and the column, as in Go.
  • Scan checks the column paths before the schema, as Go does. A row type that breaks both gets the column's error.

Evidence

  • New test/pxf_dataset_scan_options_test.cc has 7 tests: one per option, plus the hook error and the check order. Each binds one row through Scan and through Parse + BindRow, and requires the two to agree. The protos, rows and exact texts are the ones protowire-go's dataset_scan_options_test.go uses on #281, and those Go tests pass there.
  • Without the source change, Validator and SkipValidate fail with the 2:1: prefix. The 4 tests that check an option is honoured pass on the old code too, as expected: cpp already honoured them.
  • Locally, ctest passes 742 of 742, and all 7 new tests appear by name. clang-format 18 has been applied, and local clang-tidy 23 reports nothing on dataset_reader.cc and its header.
  • The probe from DatasetReader::Scan honours options protowire-go's Scan drops (skip_validate, skip_post_decode, discard_unknown, on_secret_field, validator) #166, re-run against Go #281, gives cpp's verdict in all 12 cases.
  • CI on 45a42a2 (head): all 11 checks pass, including CodeQL, ASan + UBSan, clang-tidy 18, the differential against protowire-go, and Windows.

Order

This PR doesn't depend on Go's: cpp's behaviour was already the decided one. Merging #281 is what makes the two ports agree.

protowire-go moves only a decode error (its *Error) to the row being
bound. cpp's AtRow positioned every error, so a validator's refusal
read 2:1: check: ... and a schema violation 2:1: PXF schema
violations: ... through Scan and BindRow. BindCheckedRow now runs the
schema check before the decode and the validator after it, and returns
their errors as they are. A hook's error from on_secret_field is a
decode error and keeps the row's position and column. Scan checks the
column paths before the schema, as Go does.

#166 itself is decided the other way: cpp's Scan already honours
skip_validate, skip_post_decode, discard_unknown, on_secret_field and
validator, and protowire-go changes to match (protowire-go#280). The
new tests bind one row per option through Scan and BindRow and pin
the texts Go gives on the same protos and rows.
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.

DatasetReader::Scan honours options protowire-go's Scan drops (skip_validate, skip_post_decode, discard_unknown, on_secret_field, validator)

2 participants