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

Method register_avro

datafusion/core/src/execution/context/avro.rs:40–60  ·  view source on GitHub ↗

Registers an Avro file as a table that can be referenced from SQL statements executed against this context.

(
        &self,
        table_ref: impl Into<TableReference>,
        table_path: impl AsRef<str>,
        options: AvroReadOptions<'_>,
    )

Source from the content-addressed store, hash-verified

38 /// Registers an Avro file as a table that can be referenced from
39 /// SQL statements executed against this context.
40 pub async fn register_avro(
41 &self,
42 table_ref: impl Into<TableReference>,
43 table_path: impl AsRef<str>,
44 options: AvroReadOptions<'_>,
45 ) -> Result<()> {
46 let listing_options = options
47 .to_listing_options(&self.copied_config(), self.copied_table_options());
48
49 self.register_type_check(table_path.as_ref(), &listing_options.file_extension)?;
50
51 self.register_listing_table(
52 table_ref,
53 table_path,
54 listing_options,
55 options.schema.map(|s| Arc::new(s.to_owned())),
56 None,
57 )
58 .await?;
59 Ok(())
60 }
61}

Callers 3

register_non_avro_fileFunction · 0.80
register_avro_tablesFunction · 0.80

Calls 8

newFunction · 0.85
to_listing_optionsMethod · 0.80
copied_configMethod · 0.80
copied_table_optionsMethod · 0.80
register_type_checkMethod · 0.80
as_refMethod · 0.45
mapMethod · 0.45

Tested by 2

register_non_avro_fileFunction · 0.64
register_avro_tablesFunction · 0.64