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/08/06 17:12:30 UTC
[PR] fix(arrow/csv): append null for invalid fixed-size binary values [arrow-go]
fallintoplace opened a new pull request, #1121:
URL: https://github.com/apache/arrow-go/pull/1121
### What does this change do?\n\nKeep the CSV record length consistent when a fixed-size binary value has the wrong length.\n\n### Why?\n\nOther parse failures append a null. This path only set Err, so Next returned an empty record instead of a row with a null value.\n\n### Tests\n\n- go test ./arrow/csv -run TestFixedSizeBinaryParseErrorAppendsNull
--
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(arrow/csv): append null for invalid fixed-size binary values [arrow-go]
Posted by "zeroshade (via GitHub)" <gi...@apache.org>.
zeroshade commented on code in PR #1121:
URL: https://github.com/apache/arrow-go/pull/1121#discussion_r3752061123
##########
arrow/csv/reader_test.go:
##########
@@ -219,6 +219,32 @@ func TestCSVReadInvalidFields(t *testing.T) {
}
}
+func TestFixedSizeBinaryParseErrorAppendsNull(t *testing.T) {
+ schema := arrow.NewSchema(
+ []arrow.Field{
+ {Name: "id", Type: arrow.PrimitiveTypes.Int64},
+ {Name: "value", Type: &arrow.FixedSizeBinaryType{ByteWidth: 3}},
+ {Name: "name", Type: arrow.BinaryTypes.String},
+ },
+ nil,
+ )
+ r := csv.NewReader(strings.NewReader("1,AQ==,name\n"), schema, csv.WithHeader(false))
+ defer r.Release()
+
+ require.True(t, r.Next())
+ require.ErrorIs(t, r.Err(), arrow.ErrInvalid)
+
+ record := r.RecordBatch()
+ defer record.Release()
Review Comment:
This double-releases the record batch, which is what's failing CI.
`RecordBatch()` returns `r.cur` directly — a borrowed reference, no `Retain()`. The reader owns it ("valid until the next call to Next"), and `Reader.Release()` releases `r.cur` itself. No other test in this file releases the batch it gets back from `RecordBatch()`.
Defers run LIFO, so `record.Release()` fires first and drops the refcount to zero, then `r.Release()` releases it a second time and trips `debug.Assert(rec.refCount.Load() > 0, "too many releases")` in `array/record.go:244`. The stack lands on line 246, the closing brace, which is where the deferred calls execute.
CI runs with `-tags assert,test,ccalloc`, which is why this fires there but not under a plain `go test ./arrow/csv` — that's why the command in the PR description passes locally. Worth running with `-tags assert` when a test touches refcounts.
Fix: drop this line. (Or `record.Retain()` before it, but simply removing it matches the rest of the file.)
--
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(arrow/csv): append null for invalid fixed-size binary values [arrow-go]
Posted by "zeroshade (via GitHub)" <gi...@apache.org>.
zeroshade merged PR #1121:
URL: https://github.com/apache/arrow-go/pull/1121
--
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