roee88 opened a new issue #595:
URL: https://github.com/apache/arrow-rs/issues/595


   The FFI implementation deviates from the C Data Interface specification in 
[Release callback semantics – for 
producers](https://arrow.apache.org/docs/format/CDataInterface.html#release-callback-semantics-for-producers).
   
   > The release callback MUST walk all children structures (including the 
optional dictionary) and call their own release callbacks.
   
   The current implementation doesn't walk through the direct children but 
rather only through the children in private data. This blocks support for 
moving child arrays.
   
   It also assumes that child arrays are not already released. This assumption 
is not true for the case of child array move. The release member must be 
checked to be not null before dropping/releasing an array.
   
   The current implementation doesn't seem to release the dictionary array.
   
   Please see the reference implementation in the spec:
   
   ```c
   static void ReleaseExportedArray(struct ArrowArray* array) {
     // This should not be called on already released array
     assert(array->format != NULL);
   
     // Release children
     for (int64_t i = 0; i < array->n_children; ++i) {
       struct ArrowArray* child = array->children[i];
       if (child->release != NULL) {
         child->release(child);
         assert(child->release == NULL);
       }
     }
   
     // Release dictionary
     struct ArrowArray* dict = array->dictionary;
     if (dict != NULL && dict->release != NULL) {
       dict->release(dict);
       assert(dict->release == NULL);
     }
   
     // TODO here: release and/or deallocate all data directly owned by
     // the ArrowArray struct, such as the private_data.
   
     // Mark array released
     array->release = NULL;
   }
   ```
   


-- 
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-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to