Returns the schema of the reader, useful for getting the schema without reading record batches
(&self)
| 512 | /// Returns the schema of the reader, useful for getting the schema without reading |
| 513 | /// record batches |
| 514 | pub fn schema(&self) -> SchemaRef { |
| 515 | match &self.decoder.projection { |
| 516 | Some(projection) => { |
| 517 | let fields = self.decoder.schema.fields(); |
| 518 | let projected = projection.iter().map(|i| fields[*i].clone()); |
| 519 | Arc::new(Schema::new(projected.collect::<Fields>())) |
| 520 | } |
| 521 | None => self.decoder.schema.clone(), |
| 522 | } |
| 523 | } |
| 524 | } |
| 525 | |
| 526 | impl<R: BufRead> BufReader<R> { |