@@ -103,15 +103,18 @@ pub unsafe extern "C-unwind" fn vx_cuda_array_export_arrow_device(
103103 } )
104104}
105105
106- /// Scan a Vortex partition as an Arrow C Device stream.
106+ /// Consume a Vortex partition and scan it as an Arrow C Device stream.
107+ ///
108+ /// This function takes ownership of `partition`. Callers must not free or reuse it after calling
109+ /// this function, regardless of success or failure.
107110///
108111/// On success returns `0` and writes an owned `ArrowDeviceArrayStream` to `out_stream`. The stream
109- /// owns the partition and must be released through its embedded Arrow `release` callback. Each
110- /// produced `ArrowDeviceArray` is exported on one CUDA device and is independently released by the
111- /// consumer through the embedded `ArrowArray.release` callback.
112+ /// owns the resulting scan iterator. The caller must release the stream through its embedded Arrow
113+ /// `release` callback, and must release each produced `ArrowDeviceArray` through its embedded
114+ /// `ArrowArray.release` callback.
112115///
113116/// On error returns `1` and, when `error_out` is non-null, writes a `vx_error` (free with
114- /// `vx_error_free`). If `partition` is consumed by this call, callers must not free or reuse it.
117+ /// `vx_error_free`).
115118///
116119/// # Safety
117120///
@@ -129,9 +132,9 @@ pub unsafe extern "C-unwind" fn vx_cuda_partition_scan_arrow_device(
129132 vortex_ensure ! ( !partition. is_null( ) , "null vx_partition" ) ;
130133 vortex_ensure ! ( !out_stream. is_null( ) , "null ArrowDeviceArrayStream output" ) ;
131134
135+ let ( dtype, array_iter) = unsafe { vx_partition_into_array_iter ( partition) } ?;
132136 let session = session_with_cuda ( unsafe { vx_session_ref ( session) } ?) ?;
133137 let ctx = CudaSession :: create_execution_ctx ( & session) ?;
134- let ( dtype, array_iter) = unsafe { vx_partition_into_array_iter ( partition) } ?;
135138 let device_stream =
136139 vortex_cuda:: export_device_array_stream_from_iter_with_ctx ( array_iter, dtype, ctx) ;
137140
0 commit comments