Repository navigation
test: make JSON tests independent of the JSON backend's error details - #1428
Merged
Merged
Conversation
- arrow/compute: TestIsInDecimal's expected array was `[true, false true]`
(missing comma), which only parsed because go-json 0.10 was lenient.
- arrow/array: truncated input is reported as io.ErrUnexpectedEOF by
encoding/json before Go 1.27's v2 semantics and by go-json before 0.11,
but as a syntax error ("unexpected end of JSON input") otherwise. Assert
that truncation is an error and not a clean io.EOF (the apache#1341
invariant), accepting either form.
- parquet/variant: TestBuilderJSONErrors pinned messages from whichever
internal branch the tokenizer happened to reach; check only that
ParseJSON rejects the input.
These failed on main with -tags arrow_json_stdlib under Go 1.27, and fail
with github.com/goccy/go-json v0.11.2 (apache#1357).
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
The Dependabot bump of
github.com/goccy/go-jsonto v0.11.2 (#1357) fails CI. go-json 0.11 is stricter and followsencoding/json's behaviour for the Go version it is built with, which exposed three tests that depended on lenient parsing or on backend-specific error details:arrow/computeTestIsInDecimal: the expected array literal is[true, false true](missing comma); go-json 0.10 accepted it.arrow/arrayTestIntegerArrsJSONandTestRecordBuilderUnmarshalOneReturnUnexpectedEOF: under Go 1.27's v2 JSON semantics, truncated input is reported as a syntax error ("unexpected end of JSON input") instead ofio.ErrUnexpectedEOF.parquet/variantTestBuilderJSONErrors: the error message depends on which tokenizer call first notices the malformed input.The last two already fail on
mainwith the standard-library backend (-tags arrow_json_stdlib, also used for TinyGo) under Go 1.27, independent of the bump.What changes are included in this PR?
Test-only:
TestIsInDecimal.assertTruncatedJSONErrorchecks that truncated input is an error and not a cleanio.EOF— the invariant fix(array/record): bldr stop ignore unexpected EOF #1341 added — while accepting eitherio.ErrUnexpectedEOFor an "unexpected end of JSON input" syntax error.TestBuilderJSONErrorskeeps all its malformed inputs but only checks thatParseJSONrejects them.Are these changes tested?
The affected packages (
arrow/array,arrow/compute,parquet/variant) pass with Go 1.26 and Go 1.27, each with go-json v0.10.6, go-json v0.11.2 and-tags arrow_json_stdlib. Disabling theio.EOF→io.ErrUnexpectedEOFconversion inRecordBuilder.unmarshalOnestill failsTestRecordBuilderUnmarshalOneReturnUnexpectedEOF("truncated input must not be reported as a clean EOF").Are there any user-facing changes?
No.