MCPcopy Create free account
hub / github.com/apache/arrow-rs / read_file

Function read_file

arrow-json/src/reader/mod.rs:1885–1895  ·  view source on GitHub ↗
(path: &str, schema: Option<Schema>)

Source from the content-addressed store, hash-verified

1883 }
1884
1885 fn read_file(path: &str, schema: Option<Schema>) -> Reader<BufReader<File>> {
1886 let file = File::open(path).unwrap();
1887 let mut reader = BufReader::new(file);
1888 let schema = schema.unwrap_or_else(|| {
1889 let (schema, _) = infer_json_schema(&mut reader, None).unwrap();
1890 reader.rewind().unwrap();
1891 schema
1892 });
1893 let builder = ReaderBuilder::new(Arc::new(schema)).with_batch_size(64);
1894 builder.build(reader).unwrap()
1895 }
1896
1897 #[test]
1898 fn test_json_basic() {

Calls 3

infer_json_schemaFunction · 0.85
with_batch_sizeMethod · 0.45
buildMethod · 0.45