MCPcopy Create free account
hub / github.com/apache/arrow-rs / get_next

Method get_next

arrow-array/src/ffi_stream.rs:237–263  ·  view source on GitHub ↗
(&mut self, out: *mut FFI_ArrowArray)

Source from the content-addressed store, hash-verified

235 }
236
237 pub fn get_next(&mut self, out: *mut FFI_ArrowArray) -> i32 {
238 let private_data = self.get_private_data();
239 let reader = &mut private_data.batch_reader;
240
241 match reader.next() {
242 None => {
243 // Marks ArrowArray released to indicate reaching the end of stream.
244 unsafe { std::ptr::write(out, FFI_ArrowArray::empty()) }
245 0
246 }
247 Some(next_batch) => {
248 if let Ok(batch) = next_batch {
249 let struct_array = StructArray::from(batch);
250 let array = FFI_ArrowArray::new(&struct_array.to_data());
251
252 unsafe { std::ptr::write_unaligned(out, array) };
253 0
254 } else {
255 let err = &next_batch.unwrap_err();
256 private_data.last_error = Some(
257 CString::new(err.to_string()).expect("Error string has a null byte in it."),
258 );
259 get_error_code(err)
260 }
261 }
262 }
263 }
264
265 pub fn get_last_error(&mut self) -> Option<&CString> {
266 self.get_private_data().last_error.as_ref()

Callers 1

get_nextFunction · 0.80

Calls 4

get_error_codeFunction · 0.85
get_private_dataMethod · 0.80
nextMethod · 0.45
to_dataMethod · 0.45

Tested by

no test coverage detected