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

Method register_json

datafusion/core/src/execution/context/json.rs:42–62  ·  view source on GitHub ↗

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

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

Source from the content-addressed store, hash-verified

40 /// Registers a JSON file as a table that it can be referenced
41 /// from SQL statements executed against this context.
42 pub async fn register_json(
43 &self,
44 table_ref: impl Into<TableReference>,
45 table_path: impl AsRef<str>,
46 options: JsonReadOptions<'_>,
47 ) -> Result<()> {
48 let listing_options = options
49 .to_listing_options(&self.copied_config(), self.copied_table_options());
50
51 self.register_type_check(table_path.as_ref(), &listing_options.file_extension)?;
52
53 self.register_listing_table(
54 table_ref,
55 table_path,
56 listing_options,
57 options.schema.map(|s| Arc::new(s.to_owned())),
58 None,
59 )
60 .await?;
61 Ok(())
62 }
63
64 /// Executes a query and writes the results to a partitioned JSON file.
65 pub async fn write_json(

Callers 8

roundtrip_json_sourceFunction · 0.45
create_json_scanFunction · 0.45
query_json_arrayFunction · 0.45
it_can_read_empty_ndjsonFunction · 0.45
write_json_resultsFunction · 0.45

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 3

roundtrip_json_sourceFunction · 0.36
create_json_scanFunction · 0.36