Repository navigation
pxf: Scan's options pinned per option; validator and schema errors carry no row position (#166) - #174
Merged
Merged
Conversation
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.
This was referenced Nov 7, 2026
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.
Fixes #166.
You decided #166 as option 2:
DatasetReader::Scankeeps 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 itsatRowmoves only a decode error to the row. cpp'sAtRowmoved every error. Now:BindCheckedRowruns the schema check before the decode and the validator after it, and returns their errors unchanged.opts.reportstill gets the report.on_secret_fieldis a decode error. It keeps the row's position and the column, as in Go.Scanchecks the column paths before the schema, as Go does. A row type that breaks both gets the column's error.Evidence
test/pxf_dataset_scan_options_test.cchas 7 tests: one per option, plus the hook error and the check order. Each binds one row throughScanand throughParse+BindRow, and requires the two to agree. The protos, rows and exact texts are the ones protowire-go'sdataset_scan_options_test.gouses on #281, and those Go tests pass there.ValidatorandSkipValidatefail with the2:1:prefix. The 4 tests that check an option is honoured pass on the old code too, as expected: cpp already honoured them.dataset_reader.ccand its header.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.