Compare the Arrow JSON with a record batch reader
(&self, reader: &mut dyn RecordBatchReader)
| 219 | impl 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>> { |
nothing calls this directly
no test coverage detected