singhpratech commented on PR #1320:
URL: https://github.com/apache/arrow-go/pull/1320#issuecomment-5761446354

   Yes, you're right, thanks. I'd looked at the datum types and their `Release` 
methods but not at who calls this, and the inline `NewMapScalar` in `exec.go` 
is exactly what the comment said you couldn't do. I've rewritten it along the 
lines you describe: no reference is added and `Release` consumes the one you 
passed in, so a borrowed value has to stay alive elsewhere and shouldn't be 
released through the Datum, while a temporary created for the Datum has to be. 
I also mention that `NewDatum` itself does the second thing.
   
   I had a look at the other callers too. The sort and cumulative entry points 
borrow, as does the set-lookup value set; `NewDatum` and the map literal 
transfer. Both are in use, so describing the contract seemed better than 
forbidding temporaries.


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to