You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "fallintoplace (via GitHub)" <gi...@apache.org> on 2026/07/11 08:14:47 UTC
[PR] fix(array): validate JSON start offsets [arrow-go]
fallintoplace opened a new pull request, #929:
URL: https://github.com/apache/arrow-go/pull/929
### What
Validate `WithStartOffset` before JSON decoding. Negative offsets are rejected, seek errors are returned, and a seeker must report the requested position. The same validation is shared by `FromJSON` and `RecordFromJSON`.
### Tests
- `go test ./arrow/array -count=1`
- `pre-commit run golangci-lint-full --all-files`
Regression coverage includes seek errors, incorrect positions, negative offsets that must not call `Seek`, and a successful offset with the expected decoded values.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix(array): validate JSON start offsets [arrow-go]
Posted by "zeroshade (via GitHub)" <gi...@apache.org>.
zeroshade commented on code in PR #929:
URL: https://github.com/apache/arrow-go/pull/929#discussion_r3566723346
##########
arrow/array/util.go:
##########
@@ -219,14 +237,8 @@ func RecordFromJSON(mem memory.Allocator, schema *arrow.Schema, r io.Reader, opt
o(&cfg)
}
- if cfg.startOffset != 0 {
- seeker, ok := r.(io.ReadSeeker)
- if !ok {
- return nil, 0, errors.New("using StartOffset option requires reader to be a ReadSeeker, cannot seek")
- }
- if _, err := seeker.Seek(cfg.startOffset, io.SeekStart); err != nil {
- return nil, 0, fmt.Errorf("failed to seek to start offset %d: %w", cfg.startOffset, err)
- }
+ if err := seekJSONStartOffset(r, cfg.startOffset); err != nil {
Review Comment:
Since this shared helper now backs `RecordFromJSON` too, please add a direct `RecordFromJSON` test (one seek-failure path + one successful-offset path); the new tests currently only exercise `FromJSON`.
##########
arrow/array/util.go:
##########
@@ -74,6 +74,29 @@ func WithUseNumber() FromJSONOption {
}
}
+func seekJSONStartOffset(r io.Reader, offset int64) error {
Review Comment:
Note: the error text changed (e.g. `RecordFromJSON` previously returned `failed to seek to start offset %d`). If any downstream code/tests assert on the old message, they'll need updating.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix(array): validate JSON start offsets [arrow-go]
Posted by "zeroshade (via GitHub)" <gi...@apache.org>.
zeroshade merged PR #929:
URL: https://github.com/apache/arrow-go/pull/929
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org