Repository navigation
fix: expose internal offsets in json/csv readers - #1342
Merged
Merged
Conversation
zeroshade
approved these changes
Oct 13, 2026
zeroshade
left a comment
Member
There was a problem hiding this comment.
The forwarding methods are a useful additive API, approving; the observations below (doc comments on the offset semantics and focused tests) would be good follow-ups.
Smaller observations
- minor —
arrow/csv/reader.go:1110— Please document both new exported methods, including byte units and the distinction between parser position and the location of an Arrow conversion error. For an Int64 column containing"1\nbad\n3\n4\n", I observed CSV offsets of 6, 8, and 10 with chunk sizes 1, 3, and -1, respectively, for the same conversion failure:nextncontinues through the batch andnextallreads the complete input before conversion. That is consistent with exposing the parser offset, but it is not necessarily the failing row’s position. Also clarify that offsets are relative to the supplied stream, include consumed headers, and are not the underlying buffered reader’s read-ahead position. - minor —
arrow/array/json_reader.go:232— Please add focused tests for these public methods in both readers, covering the initial offset, successful reads, EOF, and errors, including CSV headers/chunking. Exercise JSON with both the default backend andarrow_json_stdlib: for"{\"v\":1}\n{\"v\":2}\n{\"v\":3}\n", I observed an offset of 24 after EOF with the default backend versus 23 with the standard-library backend; malformed-value offsets differed too. Document and test the intended decoder-position contract without implying a backend-independent exact error location. The PR currently adds no tests for the methods. - nit —
CONTRIBUTING.md:22-31/ PR title — Considerfeat(arrow): expose input offsets in JSON and CSV readers: this adds public API across two Arrow packages, and the contributing guide recommends a top-level scope for broader changes.
Targeted reader tests and a temporary offset/allocator probe passed locally with both JSON backends. The CI workflows on this PR are awaiting maintainer approval to run.
This review was drafted by an AI-assisted tool and
confirmed by an Apache Arrow maintainer. The maintainer
approving this PR has read the findings and signed off. If
something feels off, please reply on the PR and a maintainer
will follow up.More on how Apache Arrow handles maintainer review:
CONTRIBUTING.md.
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.
Rationale for this change
When decoding non-typesafe formats like CSV and JSON it is possible decoding errors occur somewhere midstream. Without knowing the offset decoding fails at, it can become very hard to troubleshoot what/where in the data the problem is. For this I would like the Offset to be exposed to aid in troubleshooting when such problems occur.
What changes are included in this PR?
Expose internal InputOffset method directly in the CSV & JSON reader.
Are these changes tested?
No additional tests added; simple 1 to 1 exposure of internal InputOffset method.
Are there any user-facing changes?
Adds public InputOffset method on CSV & JSON readers.