#[cfg(feature = "avro")]
mod arrow_array_reader;
#[cfg(feature = "avro")]
mod reader;
#[cfg(feature = "avro")]
mod schema;
use crate::arrow::datatypes::Schema;
use crate::error::Result;
#[cfg(feature = "avro")]
pub use reader::{Reader, ReaderBuilder};
use std::io::Read;
#[cfg(feature = "avro")]
pub fn read_avro_schema_from_reader<R: Read>(reader: &mut R) -> Result<Schema> {
let avro_reader = apache_avro::Reader::new(reader)?;
let schema = avro_reader.writer_schema();
schema::to_arrow_schema(schema)
}
#[cfg(not(feature = "avro"))]
pub fn read_avro_schema_from_reader<R: Read>(_: &mut R) -> Result<Schema> {
Err(crate::error::DataFusionError::NotImplemented(
"cannot read avro schema without the 'avro' feature enabled".to_string(),
))
}