docs(compute): attach the NewDatumWithoutOwning doc comment and say what Release does to it - #1320
Open
singhpratech wants to merge 1 commit into
Open
singhpratech wants to merge 1 commit into
singhpratech wants to merge 1 commit into
Conversation
…hat Release does to it
The comment above NewDatumWithoutOwning was separated from the declaration
by a blank line, so go doc and pkg.go.dev show the function with no
documentation at all. The text itself had a broken sentence and ended in
stray characters ("convenience function.+-").
The comment now sits on the declaration and states the contract: the
Datum owns nothing, the caller keeps the value alive and must not call
Release on the Datum, and a Release call releases the caller's reference,
which with a C-backed allocator or cdata-imported buffers frees memory
under a live value.
Documentation only. Whether a non-owning Datum should refuse Release is
left to apache#1298.
singhpratech
added a commit
to singhpratech/ArrowMetal
that referenced
this pull request
Sep 17, 2026
…ing doc comment for #1298
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 comment above
NewDatumWithoutOwningis separated from the declaration by a blank line, sogo docand pkg.go.dev show the function with no documentation at all. The text itself has asentence with no main clause and ends in stray characters (
convenience function.+-). Thefunction's one hazard, a
Releasecall that releases the caller's reference (#1298), is the thinga reader most needs to see and currently cannot.
What changes are included in this PR?
The comment now sits on the declaration and states the contract: the returned
Datumowns nothing,the caller keeps the value alive for as long as the
Datumis in use and must not callReleaseonit, and since the
Datumis an ordinaryArrayDatum/ChunkedDatum/RecordDatum/TableDatum/ScalarDatum, aReleasecall compiles and releases the caller's reference, which with a C-backedallocator or cdata-imported buffers frees memory under a live value. It ends by pointing at
NewDatumfor the owning case.Are these changes tested?
Documentation only.
go doc ./arrow/compute NewDatumWithoutOwningrenders the two paragraphs;gofmt and
go vet ./arrow/compute/are clean.Are there any user-facing changes?
Documentation only. Whether a non-owning
Datumshould refuseRelease(a no-op, a distincttype, or a panic) is a separate decision and stays with #1298; this change does not close it.