MCPcopy Create free account
hub / github.com/apache/datafusion / read

Method read

datafusion/datasource-json/src/utils.rs:336–353  ·  view source on GitHub ↗
(&mut self, buf: &mut [u8])

Source from the content-addressed store, hash-verified

334
335impl<R: Read> Read for JsonArrayToNdjsonReader<R> {
336 fn read(&mut self, buf: &mut [u8]) -> std::io::Result<usize> {
337 // If output buffer is empty, fill it
338 if self.output_pos >= self.output_filled {
339 self.fill_output_buffer()?;
340 if self.output_filled == 0 {
341 return Ok(0); // EOF
342 }
343 }
344
345 // Copy from output buffer to caller's buffer
346 let available = self.output_filled - self.output_pos;
347 let to_copy = std::cmp::min(available, buf.len());
348 buf[..to_copy].copy_from_slice(
349 &self.output_buffer[self.output_pos..self.output_pos + to_copy],
350 );
351 self.output_pos += to_copy;
352 Ok(to_copy)
353 }
354}
355
356impl<R: Read> BufRead for JsonArrayToNdjsonReader<R> {

Callers 15

update_workspace_versionFunction · 0.80
update_docsFunction · 0.80
update_commit_cargo_tomlFunction · 0.80
mainFunction · 0.80
plan_extensionMethod · 0.80
catalogFunction · 0.80
table_namesMethod · 0.80
tableMethod · 0.80

Calls 3

minFunction · 0.85
fill_output_bufferMethod · 0.80
lenMethod · 0.45

Tested by 1

experimentFunction · 0.64