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

Method equals_reader

arrow-integration-test/src/lib.rs:221–242  ·  view source on GitHub ↗

Compare the Arrow JSON with a record batch reader

(&self, reader: &mut dyn RecordBatchReader)

Source from the content-addressed store, hash-verified

219impl ArrowJson {
220 /// Compare the Arrow JSON with a record batch reader
221 pub fn equals_reader(&self, reader: &mut dyn RecordBatchReader) -> Result<bool> {
222 if !self.schema.equals_schema(&reader.schema()) {
223 return Ok(false);
224 }
225
226 for json_batch in self.get_record_batches()?.into_iter() {
227 let batch = reader.next();
228 match batch {
229 Some(Ok(batch)) => {
230 if json_batch != batch {
231 println!("json: {json_batch:?}");
232 println!("batch: {batch:?}");
233 return Ok(false);
234 }
235 }
236 Some(Err(e)) => return Err(e),
237 None => return Ok(false),
238 }
239 }
240
241 Ok(true)
242 }
243
244 /// Convert the stored dictionaries to `Vec[RecordBatch]`
245 pub fn get_record_batches(&self) -> Result<Vec<RecordBatch>> {

Callers

nothing calls this directly

Calls 5

equals_schemaMethod · 0.80
get_record_batchesMethod · 0.80
schemaMethod · 0.45
into_iterMethod · 0.45
nextMethod · 0.45

Tested by

no test coverage detected