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

Function test_parse_string_view_single_column

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

Source from the content-addressed store, hash-verified

2796
2797 #[test]
2798 fn test_parse_string_view_single_column() {
2799 let csv = ["foo", "something_cannot_be_inlined", "foobar"].join("\n");
2800 let schema = Arc::new(Schema::new(vec![Field::new(
2801 "c1",
2802 DataType::Utf8View,
2803 true,
2804 )]));
2805
2806 let mut decoder = ReaderBuilder::new(schema).build_decoder();
2807
2808 let decoded = decoder.decode(csv.as_bytes()).unwrap();
2809 assert_eq!(decoded, csv.len());
2810 decoder.decode(&[]).unwrap();
2811
2812 let batch = decoder.flush().unwrap().unwrap();
2813 assert_eq!(batch.num_columns(), 1);
2814 assert_eq!(batch.num_rows(), 3);
2815 let col = batch.column(0).as_string_view();
2816 assert_eq!(col.data_type(), &DataType::Utf8View);
2817 assert_eq!(col.value(0), "foo");
2818 assert_eq!(col.value(1), "something_cannot_be_inlined");
2819 assert_eq!(col.value(2), "foobar");
2820 }
2821
2822 #[test]
2823 fn test_parse_string_view_multi_column() {

Callers

nothing calls this directly

Calls 7

joinMethod · 0.80
as_string_viewMethod · 0.80
build_decoderMethod · 0.45
decodeMethod · 0.45
as_bytesMethod · 0.45
flushMethod · 0.45
columnMethod · 0.45

Tested by

no test coverage detected