On Tue, Apr 7, 2020, 12:04 PM Antoine Pitrou <anto...@python.org> wrote:
> > Le 07/04/2020 à 18:49, Todd Lipcon a écrit : > >> > >> Hmm, the spec may not be clear enough on this, but if you move a child > >> and release the parent, then the other children are not usable anymore. > >> > >> In your case, you don't call release() on every child. You just call > >> release() on the parent once you are done with all children. So the > >> synchronization has to be managed on the consumer side, the producer > >> doesn't see any of it. > >> > > > > I'm not sure I follow. If the consumer takes a top-level ArrowArray, and > > then moves out each of the children, then calls release() on the > top-level > > array, the expectation is that the chlidren stay valid, according to the > > spec. > > According to the spec, once you move a child, you are supposed to > release the parent ("immediately afterwards"). Then by construction you > cannot move other children. I don't know if we want to make it possible > to move several children before releasing the parent. Abstractly, that > may sound desirable, but we should check that doesn't impose further > constraints on the producer. > Re-orienting the discussion on something more concrete, suppose that an ArrowArray is used to convey a result set from a database query, and suppose that the resources associated with each column in the result set are independent of the other columns. Should it not be possible to select a subset of the columns and release the resources of the columns that are not needed? > However, if as a consumer you're simply processing all children, then > there's no need to move them. Just release the parent when you are > finished with all children. > > Regards > > Antoine. >