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

Method infer_schema

datafusion/datasource-avro/src/file_format.rs:107–130  ·  view source on GitHub ↗
(
        &self,
        _state: &dyn Session,
        store: &Arc<dyn ObjectStore>,
        objects: &[ObjectMeta],
    )

Source from the content-addressed store, hash-verified

105 }
106
107 async fn infer_schema(
108 &self,
109 _state: &dyn Session,
110 store: &Arc<dyn ObjectStore>,
111 objects: &[ObjectMeta],
112 ) -> Result<SchemaRef> {
113 let mut schemas = vec![];
114 for object in objects {
115 let r = store.as_ref().get(&object.location).await?;
116 let schema = match r.payload {
117 GetResultPayload::File(mut file, _) => {
118 read_avro_schema_from_reader(&mut file)?
119 }
120 GetResultPayload::Stream(_) => {
121 // TODO: Fetching entire file to get schema is potentially wasteful
122 let data = r.bytes().await?;
123 read_avro_schema_from_reader(&mut data.as_ref())?
124 }
125 };
126 schemas.push(schema);
127 }
128 let merged_schema = Schema::try_merge(schemas)?;
129 Ok(Arc::new(merged_schema))
130 }
131
132 async fn infer_stats(
133 &self,

Callers

nothing calls this directly

Calls 5

newFunction · 0.85
getMethod · 0.45
as_refMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected