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

Function test_csv_from_buf_reader

arrow-csv/src/reader/mod.rs:1429–1448  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1427
1428 #[test]
1429 fn test_csv_from_buf_reader() {
1430 let schema = Schema::new(vec![
1431 Field::new("city", DataType::Utf8, false),
1432 Field::new("lat", DataType::Float64, false),
1433 Field::new("lng", DataType::Float64, false),
1434 ]);
1435
1436 let file_with_headers = File::open("test/data/uk_cities_with_headers.csv").unwrap();
1437 let file_without_headers = File::open("test/data/uk_cities.csv").unwrap();
1438 let both_files = file_with_headers
1439 .chain(Cursor::new("\n".to_string()))
1440 .chain(file_without_headers);
1441 let mut csv = ReaderBuilder::new(Arc::new(schema))
1442 .with_header(true)
1443 .build(both_files)
1444 .unwrap();
1445 let batch = csv.next().unwrap().unwrap();
1446 assert_eq!(74, batch.num_rows());
1447 assert_eq!(3, batch.num_columns());
1448 }
1449
1450 #[test]
1451 fn test_csv_with_schema_inference() {

Callers

nothing calls this directly

Calls 3

buildMethod · 0.45
with_headerMethod · 0.45
nextMethod · 0.45

Tested by

no test coverage detected