fix: clarify StringViewBuilder.UnmarshalOne expected type#897
fix: clarify StringViewBuilder.UnmarshalOne expected type#897fallintoplace wants to merge 2 commits into
Conversation
zeroshade
left a comment
There was a problem hiding this comment.
The production change (reflect.TypeOf([]byte{}) -> reflect.TypeOf(string(""))) is right — a StringViewBuilder should report string. But the test doesn't compile:
arrow/array/string_test.go:914:27: cannot use dec (variable of type *encoding/json.Decoder)
as *github.com/apache/arrow-go/v18/internal/json.Decoder value in argument to bldr.UnmarshalOne
UnmarshalOne takes arrow's vendored *internal/json.Decoder, not the stdlib one. Import github.com/apache/arrow-go/v18/internal/json (e.g. import json "github.com/apache/arrow-go/v18/internal/json") in the test instead of encoding/json. With that it should pass. Verified against the PR head with go test.
|
@fallintoplace nudge — the production change is correct; only the test is broken: it uses the stdlib |
Summary
Problem
StringViewBuilder.UnmarshalOnereports ajson.UnmarshalTypeErrorwith an expected type of[]byte{}for unsupported token types.Change
StringViewBuilder.UnmarshalOneto reportreflect.TypeOf("")when an unsupported JSON token is encountered.TestStringViewBuilderUnmarshalOneWrongTypeinarrow/array/string_test.go.Impact
StringBuilderbehavior.Testing
stringfor unsupported JSON token input.